eclair snapshot
diff --git a/apps/BluetoothDebug/Android.mk b/apps/BluetoothDebug/Android.mk
new file mode 100644
index 0000000..9a9971b
--- /dev/null
+++ b/apps/BluetoothDebug/Android.mk
@@ -0,0 +1,13 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_JAVA_LIBRARIES :=
+
+LOCAL_PACKAGE_NAME := BluetoothDebug
+LOCAL_CERTIFICATE := platform
+
+include $(BUILD_PACKAGE)
diff --git a/apps/BluetoothDebug/AndroidManifest.xml b/apps/BluetoothDebug/AndroidManifest.xml
new file mode 100644
index 0000000..784526e
--- /dev/null
+++ b/apps/BluetoothDebug/AndroidManifest.xml
@@ -0,0 +1,38 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+        package="com.android.bluetoothdebug" >
+    <uses-permission android:name="android.permission.BLUETOOTH" />
+    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
+
+    <application android:label="Bluetooth Debug" >
+        <receiver android:name="DebugReceiver">
+            <intent-filter>
+                <action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
+                <action android:name="android.bluetooth.adapter.action.SCAN_MODE_CHANGED" />
+                <action android:name="android.bluetooth.adapter.action.DISCOVERY_STARTED" />
+                <action android:name="android.bluetooth.adapter.action.DISCOVERY_FINISHED" />
+                <action android:name="android.bluetooth.adapter.action.LOCAL_NAME_CHANGED" />
+
+                <action android:name="android.bluetooth.device.action.FOUND" />
+                <action android:name="android.bluetooth.device.action.DISAPPEARED" />
+                <action android:name="android.bluetooth.device.action.CLASS_CHANGED" />
+                <action android:name="android.bluetooth.device.action.ACL_CONNECTED" />
+                <action android:name="android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED" />
+                <action android:name="android.bluetooth.device.action.ACL_DISCONNECTED" />
+                <action android:name="android.bluetooth.device.action.NAME_CHANGED" />
+                <action android:name="android.bluetooth.device.action.BOND_STATE_CHANGED" />
+                <action android:name="android.bluetooth.device.action.NAME_FAILED" />
+                <action android:name="android.bluetooth.device.action.PAIRING_REQUEST" />
+                <action android:name="android.bluetooth.device.action.PAIRING_CANCEL" />
+                <action android:name="android.bluetooth.device.action.UUID" />
+
+                <action android:name="android.bluetooth.headset.action.STATE_CHANGED" />
+                <action android:name="android.bluetooth.headset.action.AUDIO_STATE_CHANGED" />
+
+                <action android:name="android.bluetooth.a2dp.action.SINK_STATE_CHANGED" />
+
+                <action android:name="android.bluetooth.devicepicker.action.LAUNCH" />
+                <action android:name="android.bluetooth.devicepicker.action.DEVICE_SELECTED" />
+            </intent-filter>
+        </receiver>
+    </application>
+</manifest>
diff --git a/apps/BluetoothDebug/NOTICE b/apps/BluetoothDebug/NOTICE
new file mode 100644
index 0000000..9df2554
--- /dev/null
+++ b/apps/BluetoothDebug/NOTICE
@@ -0,0 +1,190 @@
+
+   Copyright (c) 2005-2009, The Android Open Source Project
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
diff --git a/apps/BluetoothDebug/src/com/android/bluetoothdebug/DebugReceiver.java b/apps/BluetoothDebug/src/com/android/bluetoothdebug/DebugReceiver.java
new file mode 100644
index 0000000..7be3c99
--- /dev/null
+++ b/apps/BluetoothDebug/src/com/android/bluetoothdebug/DebugReceiver.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.bluetoothdebug;
+
+import android.bluetooth.BluetoothA2dp;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothClass;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothDevicePicker;
+import android.bluetooth.BluetoothHeadset;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+
+/**
+ * Prints Bluetooth intents to logcat. For example:
+ * BTDEBUG : a.b.device.a.FOUND
+ * BTDEBUG :       a.b.device.e.DEVICE = 00:18:13:F2:CC:33
+ * BTDEBUG :       a.b.device.e.RSSI = -35
+ * BTDEBUG :       a.b.device.e.CLASS = 200404
+ * BTDEBUG : a.b.adapter.a.DISCOVERY_FINISHED
+ * BTDEBUG : a.b.device.a.BOND_STATE_CHANGED
+ * BTDEBUG :       a.b.device.e.DEVICE = 00:18:13:F2:CC:33
+ * BTDEBUG :       a.b.device.e.BOND_STATE = 11
+ * BTDEBUG :       a.b.device.e.PREVIOUS_BOND_STATE = 10
+ */
+public class DebugReceiver extends BroadcastReceiver {
+    private static final String TAG = "BTDEBUG";
+
+    public void onReceive(Context context, Intent intent) {
+        Log.d(TAG, shorten(intent.getAction()));
+
+        Bundle bundle = intent.getExtras();
+        if (bundle == null) return;
+        for (String extra : bundle.keySet()) {
+            Log.d(TAG, "\t" + shorten(extra) + " = " + bundle.get(extra));
+        }
+    }
+
+    // shorten string to shorthand
+    // android.bluetooth.device.extra.DEVICE -> a.b.device.e.DEVICE
+    private static String shorten(String action) {
+        return action.replace("android", "a")
+                     .replace("bluetooth", "b")
+                     .replace("extra", "e")
+                     .replace("action", "a");
+    }
+
+}
diff --git a/apps/CustomLocale/.gitignore b/apps/CustomLocale/.gitignore
new file mode 100644
index 0000000..90f9db7
--- /dev/null
+++ b/apps/CustomLocale/.gitignore
@@ -0,0 +1,5 @@
+.classpath
+.project
+bin
+default.properties
+gen
diff --git a/apps/CustomLocale/res/drawable-hdpi/icon.png b/apps/CustomLocale/res/drawable-hdpi/icon.png
new file mode 100755
index 0000000..60fbdf5
--- /dev/null
+++ b/apps/CustomLocale/res/drawable-hdpi/icon.png
Binary files differ
diff --git a/apps/CustomLocale/res/drawable/icon.png b/apps/CustomLocale/res/drawable-mdpi/icon.png
similarity index 100%
rename from apps/CustomLocale/res/drawable/icon.png
rename to apps/CustomLocale/res/drawable-mdpi/icon.png
Binary files differ
diff --git a/apps/CustomLocale/res/layout/new_locale.xml b/apps/CustomLocale/res/layout/new_locale.xml
index d0d9d6c..fafb16e 100644
--- a/apps/CustomLocale/res/layout/new_locale.xml
+++ b/apps/CustomLocale/res/layout/new_locale.xml
@@ -21,7 +21,7 @@
     android:paddingLeft="8dip"
     android:paddingRight="8dip">
     <TextView
-        android:layout_width="wrap_content"
+        android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:text="@string/new_locale_label" />
     <EditText
diff --git a/apps/CustomLocale/src/com/android/customlocale/CustomLocaleActivity.java b/apps/CustomLocale/src/com/android/customlocale/CustomLocaleActivity.java
index 768f910..69b9c5b 100644
--- a/apps/CustomLocale/src/com/android/customlocale/CustomLocaleActivity.java
+++ b/apps/CustomLocale/src/com/android/customlocale/CustomLocaleActivity.java
@@ -289,7 +289,15 @@
             IActivityManager am = ActivityManagerNative.getDefault();
             Configuration config = am.getConfiguration();
 
-            Locale loc = new Locale(locale);
+            Locale loc = null;
+
+            String[] langCountry = locale.split("_");
+            if (langCountry.length == 2) {
+                loc = new Locale(langCountry[0], langCountry[1]);
+            } else {
+                loc = new Locale(locale);
+            }
+            
             config.locale = loc;
 
             // indicate this isn't some passing default - the user wants this
diff --git a/apps/CustomLocale/src/com/android/customlocale/NewLocaleDialog.java b/apps/CustomLocale/src/com/android/customlocale/NewLocaleDialog.java
index 3626f73..04f7222 100644
--- a/apps/CustomLocale/src/com/android/customlocale/NewLocaleDialog.java
+++ b/apps/CustomLocale/src/com/android/customlocale/NewLocaleDialog.java
@@ -31,8 +31,7 @@
  * "en_US") via an intent with a "locale" extra string and a "select" extra
  * boolean.
  */
-public class NewLocaleDialog extends Activity
-    implements View.OnClickListener, View.OnKeyListener {
+public class NewLocaleDialog extends Activity implements View.OnClickListener {
 
     public static final String INTENT_EXTRA_LOCALE = "locale";
     public static final String INTENT_EXTRA_SELECT = "select";
@@ -55,13 +54,9 @@
 
         mButtonAdd = (Button) findViewById(R.id.add);
         mButtonAdd.setOnClickListener(this);
-        mButtonAdd.setEnabled(false);
 
         mButtonAddSelect = (Button) findViewById(R.id.add_and_select);
         mButtonAddSelect.setOnClickListener(this);
-        mButtonAddSelect.setEnabled(false);
-        
-        mEditText.setOnKeyListener(this);
     }
 
     public void onClick(View v) {
@@ -79,15 +74,4 @@
 
         finish();
     }
-
-    public boolean onKey(View v, int keyCode, KeyEvent event) {
-        boolean isEmpty = TextUtils.isEmpty(mEditText.getText());
-        if (isEmpty != mWasEmpty) {
-            mWasEmpty = isEmpty;
-            
-            mButtonAdd.setEnabled(!isEmpty);
-            mButtonAddSelect.setEnabled(!isEmpty);
-        }
-        return false;
-    }
 }
diff --git a/apps/Development/AndroidManifest.xml b/apps/Development/AndroidManifest.xml
index 4f8df3e..7f0f594 100644
--- a/apps/Development/AndroidManifest.xml
+++ b/apps/Development/AndroidManifest.xml
@@ -31,6 +31,9 @@
     <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.ALL_SERVICES" />
     <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.YouTubeUser" />
     <uses-permission android:name="com.google.android.googleapps.permission.ACCESS_GOOGLE_PASSWORD" />
+    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
+    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
+    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
 
     <application android:label="Dev Tools"
             android:icon="@drawable/ic_launcher_devtools">
@@ -73,6 +76,22 @@
             </intent-filter>
         </activity>
 
+        <activity android:name="AccountsTester" android:label="AccountsTester"
+                  android:theme="@android:style/Theme.Light">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.TEST" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name="SyncAdapterDriver" android:label="Sync Tester"
+                  android:theme="@android:style/Theme.Light">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.TEST" />
+            </intent-filter>
+        </activity>
+
         <activity android:name="DataList">
         </activity>
         <activity android:name="Details">
diff --git a/apps/Development/res/drawable-hdpi/ic_launcher_devtools.png b/apps/Development/res/drawable-hdpi/ic_launcher_devtools.png
new file mode 100755
index 0000000..60fbdf5
--- /dev/null
+++ b/apps/Development/res/drawable-hdpi/ic_launcher_devtools.png
Binary files differ
diff --git a/apps/Development/res/drawable-hdpi/stat_sample.png b/apps/Development/res/drawable-hdpi/stat_sample.png
new file mode 100755
index 0000000..adb9dcb
--- /dev/null
+++ b/apps/Development/res/drawable-hdpi/stat_sample.png
Binary files differ
diff --git a/apps/Development/res/drawable/ic_launcher_devtools.png b/apps/Development/res/drawable-mdpi/ic_launcher_devtools.png
similarity index 100%
rename from apps/Development/res/drawable/ic_launcher_devtools.png
rename to apps/Development/res/drawable-mdpi/ic_launcher_devtools.png
Binary files differ
diff --git a/apps/Development/res/drawable/stat_sample.png b/apps/Development/res/drawable-mdpi/stat_sample.png
similarity index 100%
rename from apps/Development/res/drawable/stat_sample.png
rename to apps/Development/res/drawable-mdpi/stat_sample.png
Binary files differ
diff --git a/apps/Development/res/layout/account_list_context_menu.xml b/apps/Development/res/layout/account_list_context_menu.xml
new file mode 100644
index 0000000..50e7ca1
--- /dev/null
+++ b/apps/Development/res/layout/account_list_context_menu.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 Google Inc.
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:id="@+id/accounts_tester_remove_account"
+        android:title="@string/accounts_tester_remove_account" />
+
+    <item android:id="@+id/accounts_tester_get_auth_token"
+        android:title="@string/accounts_tester_get_auth_token" />
+
+    <item android:id="@+id/accounts_tester_invalidate_auth_token"
+        android:title="@string/accounts_tester_invalidate_auth_token" />
+
+    <item android:id="@+id/accounts_tester_update_credentials"
+        android:title="@string/accounts_tester_update_credentials" />
+
+    <item android:id="@+id/accounts_tester_confirm_credentials"
+        android:title="@string/accounts_tester_confirm_credentials" />
+
+</menu>
diff --git a/apps/Development/res/layout/account_list_view.xml b/apps/Development/res/layout/account_list_view.xml
new file mode 100644
index 0000000..d255672
--- /dev/null
+++ b/apps/Development/res/layout/account_list_view.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<ListView
+   xmlns:android="http://schemas.android.com/apk/res/android"
+   android:layout_width="fill_parent"
+   android:layout_height="fill_parent"/>
diff --git a/apps/Development/res/layout/accounts_tester.xml b/apps/Development/res/layout/accounts_tester.xml
new file mode 100644
index 0000000..e69f505
--- /dev/null
+++ b/apps/Development/res/layout/accounts_tester.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+
+    <LinearLayout
+       android:orientation="vertical"
+       android:layout_width="fill_parent"
+       android:layout_height="wrap_content">
+
+        <ListView android:id="@+id/accounts_tester_authenticators_list"
+           android:layout_width="fill_parent" android:layout_height="fill_parent"/>
+
+      <LinearLayout
+         android:orientation="horizontal"
+         android:layout_width="fill_parent"
+         android:layout_height="wrap_content">
+
+          <TextView android:id="@+id/accounts_tester_account_types_spinner_label"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"
+                   android:text="@string/accounts_tester_select_account_type"/>
+
+          <Spinner android:id="@+id/accounts_tester_account_types_spinner"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"/>
+      </LinearLayout>
+
+      <LinearLayout
+         android:orientation="vertical"
+         android:layout_width="fill_parent"
+         android:layout_height="wrap_content">
+          <LinearLayout
+             android:orientation="horizontal"
+             android:layout_width="fill_parent"
+             android:layout_height="wrap_content">
+         <Button
+            android:id="@+id/accounts_tester_get_accounts_by_type"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/accounts_tester_get_accounts_by_type"/>
+
+         <Button
+            android:id="@+id/accounts_tester_get_all_accounts"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/accounts_tester_get_all_accounts"/>
+              <Button android:id="@+id/accounts_tester_add_account"
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:text="@string/accounts_tester_add_account"/>
+
+              <Button android:id="@+id/accounts_tester_edit_properties"
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"
+                 android:text="@string/accounts_tester_edit_properties"/>
+          </LinearLayout>
+
+          <LinearLayout
+             android:orientation="horizontal"
+             android:layout_width="fill_parent"
+             android:layout_height="wrap_content">
+              <TextView android:id="@+id/accounts_tester_desiredFeatures"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:text="@string/accounts_tester_desired_features_label"/>
+
+          <EditText android:id="@+id/accounts_tester_desired_features"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"
+                   android:minEms="15"/>
+          </LinearLayout>
+          <LinearLayout
+             android:orientation="horizontal"
+             android:layout_width="fill_parent"
+             android:layout_height="wrap_content">
+              <TextView android:id="@+id/accounts_tester_desiredFeatures"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:text="@string/accounts_tester_desired_authtokentype_label"/>
+
+          <EditText android:id="@+id/accounts_tester_desired_authtokentype"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"
+                   android:minEms="15"/>
+          </LinearLayout>
+       </LinearLayout>
+    </LinearLayout>
+
+    <LinearLayout
+       android:orientation="horizontal"
+       android:layout_width="fill_parent"
+       android:layout_height="wrap_content">
+
+       <ListView android:id="@+id/accounts_tester_accounts_list"
+           android:layout_width="fill_parent" android:layout_height="fill_parent"/>
+
+    </LinearLayout>
+
+</LinearLayout>
diff --git a/apps/Development/res/layout/authenticators_list_item.xml b/apps/Development/res/layout/authenticators_list_item.xml
new file mode 100644
index 0000000..309a818
--- /dev/null
+++ b/apps/Development/res/layout/authenticators_list_item.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:paddingTop="1dip"
+    android:paddingBottom="1dip"
+    android:paddingLeft="9dip"
+    android:paddingRight="9dip">
+
+    <ImageView android:id="@+id/accounts_tester_authenticator_icon"
+        android:paddingRight="9dip"
+        android:layout_gravity="center_vertical"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"/>
+
+    <TextView android:id="@+id/accounts_tester_authenticator_label"
+        android:layout_width="wrap_content"
+        android:layout_height="fill_parent"
+        android:gravity="center_vertical"
+        android:textAppearance="?android:attr/textAppearanceLarge"
+        android:layout_gravity="center_horizontal|center_vertical" />
+</LinearLayout>
+
diff --git a/apps/Development/res/layout/development_settings.xml b/apps/Development/res/layout/development_settings.xml
index 4f185aa..7bad3bb 100644
--- a/apps/Development/res/layout/development_settings.xml
+++ b/apps/Development/res/layout/development_settings.xml
@@ -68,10 +68,17 @@
             android:layout_alignParentLeft="true"
             android:text="@string/development_settings_show_updates_text" />
 
+        <CheckBox android:id="@+id/compatibility_mode"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/show_updates"
+            android:layout_alignParentLeft="true"
+            android:text="@string/development_settings_compatibility_mode_text" />
+
         <Spinner android:id="@+id/max_procs"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
-            android:layout_below="@id/show_updates"
+            android:layout_below="@id/compatibility_mode"
             android:layout_alignParentLeft="true" />
 
         <View android:id="@+id/separator2"
diff --git a/apps/Development/res/layout/get_auth_token_view.xml b/apps/Development/res/layout/get_auth_token_view.xml
new file mode 100644
index 0000000..f371523
--- /dev/null
+++ b/apps/Development/res/layout/get_auth_token_view.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+
+    <TextView android:id="@+id/accounts_tester_get_auth_token_dialog_message"
+        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:text="@string/accounts_tester_enter_auth_token_type" />
+
+    <EditText android:id="@+id/accounts_tester_auth_token_type"
+              android:singleLine="true"
+              android:layout_width="fill_parent"
+              android:layout_height="wrap_content"
+              android:minWidth="250dip"
+              android:scrollHorizontally="true"
+              android:capitalize="none"
+              android:autoText="false"/>
+
+</LinearLayout>
diff --git a/apps/Development/res/layout/package_list_item.xml b/apps/Development/res/layout/package_list_item.xml
new file mode 100644
index 0000000..6a0faee
--- /dev/null
+++ b/apps/Development/res/layout/package_list_item.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:orientation="vertical"
+    android:gravity="fill" >
+
+    <LinearLayout
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:orientation="horizontal"
+        android:paddingRight="6dip"
+        android:paddingLeft="6dip"
+        android:gravity="center_vertical" >
+    
+        <ImageView android:id="@+id/icon"
+            android:layout_width="@android:dimen/app_icon_size"
+            android:layout_height="@android:dimen/app_icon_size"
+            android:layout_marginLeft="5dip"
+            android:layout_marginRight="11dip"
+            android:layout_gravity="center_vertical"
+            android:scaleType="fitCenter"/>
+    
+        <LinearLayout
+            android:orientation="vertical"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content" >
+            <TextView android:id="@+id/name"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:textStyle="bold"
+                android:singleLine="true"
+                android:ellipsize="marquee"
+                android:layout_marginBottom="2dip" />
+            <TextView android:id="@+id/description"
+                android:layout_marginTop="-4dip"
+                android:layout_gravity="center_vertical|left"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:paddingRight="4dip"
+                android:singleLine="true"
+                android:ellipsize="marquee"
+                android:textAppearance="?android:attr/textAppearanceSmall" />
+        </LinearLayout>
+    </LinearLayout>
+</LinearLayout>
diff --git a/apps/Development/res/layout/sync_adapter_driver.xml b/apps/Development/res/layout/sync_adapter_driver.xml
new file mode 100644
index 0000000..58c0ebb
--- /dev/null
+++ b/apps/Development/res/layout/sync_adapter_driver.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+
+    <LinearLayout android:orientation="vertical"
+		  android:layout_width="fill_parent"
+		  android:layout_height="wrap_content">
+        <TextView android:id="@+id/sync_adapters_spinner_label"
+		android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+		android:textSize="22dip"
+                android:text="@string/sync_adapters_spinner_label"/>
+
+        <Spinner android:id="@+id/sync_adapters_spinner"
+                 android:layout_width="wrap_content"
+                 android:layout_height="wrap_content"/>
+        <LinearLayout
+	   android:orientation="horizontal"
+           android:layout_width="fill_parent"
+           android:layout_height="52dip">
+            <Button
+	       android:id="@+id/bind_button"
+	       android:layout_width="0dip"
+	       android:layout_height="wrap_content"
+	       android:text="@string/bind_button"
+               android:onClick="initiateBind"
+               android:layout_weight="2"/>
+
+            <Button
+               android:id="@+id/unbind_button"
+               android:layout_width="0dip"
+               android:layout_height="wrap_content"
+               android:text="@string/unbind_button"
+               android:onClick="initiateUnbind"
+               android:layout_weight="2"/>
+        </LinearLayout>
+
+        <TextView android:id="@+id/bound_adapter_text_view"
+                  android:layout_width="wrap_content"
+                  android:textSize="20dip"
+                  android:layout_height="wrap_content"/>
+
+        <LinearLayout
+           android:orientation="horizontal"
+           android:layout_width="fill_parent"
+           android:layout_height="52dip">
+            <Button
+               android:id="@+id/start_sync_button"
+               android:layout_width="0dip"
+               android:layout_height="wrap_content"
+               android:text="@string/start_sync_button"
+               android:onClick="startSyncSelected"
+               android:layout_weight="2"/>
+
+            <Button
+    	       android:id="@+id/cancel_sync_button"
+               android:layout_width="0dip"
+               android:layout_height="wrap_content"
+               android:text="@string/cancel_sync_button"
+               android:onClick="cancelSync"
+               android:layout_weight="2"/>
+        </LinearLayout>
+
+        <TextView android:id="@+id/status_text_view"
+                  android:layout_width="wrap_content"
+                  android:layout_height="wrap_content"/>
+    </LinearLayout>
+</LinearLayout>
diff --git a/apps/Development/res/layout/sync_adapter_item.xml b/apps/Development/res/layout/sync_adapter_item.xml
new file mode 100644
index 0000000..d818c78
--- /dev/null
+++ b/apps/Development/res/layout/sync_adapter_item.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@android:id/text1"
+	style="?android:attr/spinnerItemStyle"
+    android:singleLine="true"
+    android:layout_width="fill_parent"
+    android:layout_height="52dip"
+    android:ellipsize="marquee" />
diff --git a/apps/Development/res/values/strings.xml b/apps/Development/res/values/strings.xml
index 4c84548..c8a3f8b 100644
--- a/apps/Development/res/values/strings.xml
+++ b/apps/Development/res/values/strings.xml
@@ -77,6 +77,9 @@
     <string name="development_settings_always_finish_text">Immediately destroy activities</string>
     <string name="development_settings_show_load_text">Show running processes</string>
     <string name="development_settings_show_updates_text">Show screen updates</string>
+    <string name="development_settings_compatibility_mode_text">Disable compatibility mode</string>
+    <string name="development_settings_compatibility_mode_toast">Reboot required for
+            change to take effect.</string>
     <string name="development_settings_enable_gl_text">Enable OpenGL ES (reboot needed)</string>
     <string name="development_settings_allow_mock_location_text">Allow mock locations for testing</string>
     <string name="development_settings_wait_for_debugger_text">Wait for debugger</string>
@@ -133,4 +136,44 @@
     <string name="perm_list_header_text">Apps using permission  </string>
     <string name="source_uid_text">Source uid :  </string>
     <string name="shared_pkgs_text">Packages accessing via shared uid :  </string>
+
+    <!-- AccountsTester -->
+    <string name="accounts_tester_app_name">Accounts Tester</string>
+    <string name="accounts_tester_get_accounts_by_type">Get By Type</string>
+    <string name="accounts_tester_get_all_accounts">Get All</string>
+    <string name="accounts_tester_add_account">Add</string>
+    <string name="accounts_tester_select_account_type">Select Account Type</string>
+    <string name="accounts_tester_process_name_header">Process Name:</string>
+    <string name="accounts_tester_remove_account">remove</string>
+    <string name="accounts_tester_get_auth_token">authenticate</string>
+    <string name="accounts_tester_invalidate_auth_token">invalidate token</string>
+    <string name="accounts_tester_account_context_menu_title">account operations</string>
+    <string name="accounts_tester_do_get_auth_token">Ok</string>
+    <string name="accounts_tester_enter_auth_token_type">Enter the authtoken type:</string>
+    <string name="accounts_tester_update_credentials">Update Credentials</string>
+    <string name="accounts_tester_confirm_credentials">Confirm Credentials</string>
+    <string name="accounts_tester_edit_properties">Properties</string>
+    <string name="accounts_tester_desired_authtokentype_label">authtoken type:</string>
+    <string name="accounts_tester_desired_features_label">features:</string>
+
+    <!-- SyncAdapterDriver -->
+    <string name="bind_button">bind</string>
+    <string name="unbind_button">unbind</string>
+    <string name="start_sync_button">start sync</string>
+    <string name="cancel_sync_button">cancel sync</string>
+    <string name="sync_adapters_spinner_label">Registered Sync Adapters:</string>
+    <string name="status_starting_sync_format">Starting a sync of account %s...</string>
+    <string name="status_remote_exception_while_starting_sync">Got a RemoteException while starting the sync</string>
+    <string name="status_canceled_sync">Canceled the sync</string>
+    <string name="status_remote_exception_while_canceling_sync">Got a RemoteException while canceling the sync</string>
+    <string name="status_received_heartbeat">Received heartbeat</string>
+    <string name="status_sync_failed_format">Sync failed: %s</string>
+    <string name="status_sync_succeeded_format">Sync succeeded: %s</string>
+    <string name="status_already_bound">Already bound to sync adapter</string>
+    <string name="status_sync_adapter_not_selected">No selected sync adapter</string>
+    <string name="binding_connected_format">Connected to Sync Adapter\n\tauthority: %s\n\taccount type: %s</string>
+    <string name="binding_not_connected">Not connected to a sync adapter</string>
+    <string name="binding_bind_failed">Bind failed</string>
+    <string name="binding_waiting_for_connection">Waiting for service to be connected...</string>
+    <string name="select_account_to_sync">Select account to sync</string>
 </resources>
diff --git a/apps/Development/src/com/android/development/AccountsTester.java b/apps/Development/src/com/android/development/AccountsTester.java
new file mode 100644
index 0000000..8e09c3d
--- /dev/null
+++ b/apps/Development/src/com/android/development/AccountsTester.java
@@ -0,0 +1,431 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.development;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.app.AlertDialog;
+import android.content.*;
+import android.content.pm.PackageManager;
+import android.accounts.*;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.os.Handler;
+import android.view.*;
+import android.widget.*;
+import android.widget.ArrayAdapter;
+import android.util.Log;
+import android.text.TextUtils;
+
+import java.io.IOException;
+
+public class AccountsTester extends Activity implements OnAccountsUpdateListener {
+    private static final String TAG = "AccountsTester";
+    private Spinner mAccountTypesSpinner;
+    private ListView mAccountsListView;
+    private ListView mAuthenticatorsListView;
+    private AccountManager mAccountManager;
+    private String mLongPressedAccount = null;
+    private static final String COM_GOOGLE = "com.google";
+    private AuthenticatorDescription[] mAuthenticatorDescs;
+
+    private static final int GET_AUTH_TOKEN_DIALOG_ID = 1;
+    private static final int UPDATE_CREDENTIALS_DIALOG_ID = 2;
+    private static final int INVALIDATE_AUTH_TOKEN_DIALOG_ID = 3;
+    private EditText mDesiredAuthTokenTypeEditText;
+    private EditText mDesiredFeaturesEditText;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        mAccountManager = AccountManager.get(this);
+        setContentView(R.layout.accounts_tester);
+        ButtonClickListener buttonClickListener = new ButtonClickListener();
+
+        mAccountTypesSpinner = (Spinner) findViewById(R.id.accounts_tester_account_types_spinner);
+        mAccountsListView = (ListView) findViewById(R.id.accounts_tester_accounts_list);
+        mAuthenticatorsListView = (ListView) findViewById(R.id.accounts_tester_authenticators_list);
+        registerForContextMenu(mAccountsListView);
+        getAuthenticatorTypes();
+        findViewById(R.id.accounts_tester_get_all_accounts).setOnClickListener(buttonClickListener);
+        findViewById(R.id.accounts_tester_get_accounts_by_type).setOnClickListener(
+                buttonClickListener);
+        findViewById(R.id.accounts_tester_add_account).setOnClickListener(buttonClickListener);
+        findViewById(R.id.accounts_tester_edit_properties).setOnClickListener(buttonClickListener);
+        mDesiredAuthTokenTypeEditText =
+                (EditText) findViewById(R.id.accounts_tester_desired_authtokentype);
+        mDesiredFeaturesEditText = (EditText) findViewById(R.id.accounts_tester_desired_features);
+    }
+
+    private static class AuthenticatorsArrayAdapter extends ArrayAdapter<AuthenticatorDescription> {
+        protected LayoutInflater mInflater;
+        private static final int mResource = R.layout.authenticators_list_item;
+
+        public AuthenticatorsArrayAdapter(Context context, AuthenticatorDescription[] items) {
+            super(context, mResource, items);
+            mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+        }
+
+        static class ViewHolder {
+            TextView label;
+            ImageView icon;
+        }
+
+        @Override
+        public View getView(int position, View convertView, ViewGroup parent) {
+            // A ViewHolder keeps references to children views to avoid unneccessary calls
+            // to findViewById() on each row.
+            ViewHolder holder;
+
+            // When convertView is not null, we can reuse it directly, there is no need
+            // to reinflate it. We only inflate a new View when the convertView supplied
+            // by ListView is null.
+            if (convertView == null) {
+                convertView = mInflater.inflate(R.layout.authenticators_list_item, null);
+
+                // Creates a ViewHolder and store references to the two children views
+                // we want to bind data to.
+                holder = new ViewHolder();
+                holder.label = (TextView) convertView.findViewById(
+                        R.id.accounts_tester_authenticator_label);
+                holder.icon = (ImageView) convertView.findViewById(
+                        R.id.accounts_tester_authenticator_icon);
+
+                convertView.setTag(holder);
+            } else {
+                // Get the ViewHolder back to get fast access to the TextView
+                // and the ImageView.
+                holder = (ViewHolder) convertView.getTag();
+            }
+
+            final AuthenticatorDescription desc = getItem(position);
+            final String packageName = desc.packageName;
+            try {
+                final Context authContext = getContext().createPackageContext(packageName, 0);
+
+                // Set text field
+                holder.label.setText(authContext.getString(desc.labelId));
+
+                // Set resource icon
+                holder.icon.setImageDrawable(authContext.getResources().getDrawable(desc.iconId));
+            } catch (PackageManager.NameNotFoundException e) {
+                Log.d(TAG, "error getting the Package Context for " + packageName, e);
+            }
+
+            return convertView;
+        }
+    }
+
+    private void getAuthenticatorTypes() {
+        mAuthenticatorDescs = mAccountManager.getAuthenticatorTypes();
+        String[] names = new String[mAuthenticatorDescs.length];
+        for (int i = 0; i < mAuthenticatorDescs.length; i++) {
+            Context authContext;
+            try {
+                authContext = createPackageContext(mAuthenticatorDescs[i].packageName, 0);
+            } catch (PackageManager.NameNotFoundException e) {
+                continue;
+            }
+            names[i] = authContext.getString(mAuthenticatorDescs[i].labelId);
+        }
+
+        ArrayAdapter<String> adapter =
+                new ArrayAdapter<String>(AccountsTester.this,
+                android.R.layout.simple_spinner_item, names);
+        mAccountTypesSpinner.setAdapter(adapter);
+
+        mAuthenticatorsListView.setAdapter(new AuthenticatorsArrayAdapter(
+                AccountsTester.this, mAuthenticatorDescs));
+    }
+
+    public void onAccountsUpdated(Account[] accounts) {
+        Log.d(TAG, "onAccountsUpdated: \n  " + TextUtils.join("\n  ", accounts));
+        String[] accountNames = new String[accounts.length];
+        for (int i = 0; i < accounts.length; i++) {
+            accountNames[i] = accounts[i].name;
+        }
+        ArrayAdapter<String> adapter =
+                new ArrayAdapter<String>(AccountsTester.this,
+                android.R.layout.simple_list_item_1, accountNames);
+        mAccountsListView.setAdapter(adapter);
+    }
+
+    protected void onStart() {
+        super.onStart();
+        final Handler mainHandler = new Handler(getMainLooper());
+        mAccountManager.addOnAccountsUpdatedListener(this, mainHandler,
+                true /* updateImmediately */);
+    }
+
+    protected void onStop() {
+        super.onStop();
+        mAccountManager.removeOnAccountsUpdatedListener(this);
+    }
+
+    class ButtonClickListener implements View.OnClickListener {
+        public void onClick(View v) {
+            if (R.id.accounts_tester_get_all_accounts == v.getId()) {
+                onAccountsUpdated(mAccountManager.getAccounts());
+            } else if (R.id.accounts_tester_get_accounts_by_type == v.getId()) {
+                String type = getSelectedAuthenticator().type;
+                onAccountsUpdated(mAccountManager.getAccountsByType(type));
+            } else if (R.id.accounts_tester_add_account == v.getId()) {
+                AccountManagerCallback<Bundle> callback = new AccountManagerCallback<Bundle>() {
+                    public void run(AccountManagerFuture<Bundle> future) {
+                        try {
+                            Bundle bundle = future.getResult();
+                            bundle.keySet();
+                            Log.d(TAG, "account added: " + bundle);
+                        } catch (OperationCanceledException e) {
+                            Log.d(TAG, "addAccount was canceled");
+                        } catch (IOException e) {
+                            Log.d(TAG, "addAccount failed: " + e);
+                        } catch (AuthenticatorException e) {
+                            Log.d(TAG, "addAccount failed: " + e);
+                        }
+                    }
+                };
+                String authTokenType = mDesiredAuthTokenTypeEditText.getText().toString();
+                if (TextUtils.isEmpty(authTokenType)) {
+                    authTokenType = null;
+                }
+                String featureString = mDesiredFeaturesEditText.getText().toString();
+                String[] requiredFeatures = TextUtils.split(featureString, " ");
+                if (requiredFeatures.length == 0) {
+                    requiredFeatures = null;
+                }
+                mAccountManager.addAccount(getSelectedAuthenticator().type,
+                        authTokenType, requiredFeatures, null /* options */,
+                        AccountsTester.this, callback, null /* handler */);
+            } else if (R.id.accounts_tester_edit_properties == v.getId()) {
+                mAccountManager.editProperties(getSelectedAuthenticator().type,
+                        AccountsTester.this, new EditPropertiesCallback(), null /* handler */);
+            } else {
+                // unknown button
+            }
+        }
+
+        private class EditPropertiesCallback implements AccountManagerCallback<Bundle> {
+            public void run(AccountManagerFuture<Bundle> future) {
+                try {
+                    Bundle bundle = future.getResult();
+                    bundle.keySet();
+                    Log.d(TAG, "editProperties succeeded: " + bundle);
+                } catch (OperationCanceledException e) {
+                    Log.d(TAG, "editProperties was canceled");
+                } catch (IOException e) {
+                    Log.d(TAG, "editProperties failed: ", e);
+                } catch (AuthenticatorException e) {
+                    Log.d(TAG, "editProperties failed: ", e);
+                }
+            }
+        }
+    }
+
+    private AuthenticatorDescription getSelectedAuthenticator() {
+        return mAuthenticatorDescs[mAccountTypesSpinner.getSelectedItemPosition()];
+    }
+
+    @Override
+    public void onCreateContextMenu(ContextMenu menu, View v,
+            ContextMenu.ContextMenuInfo menuInfo) {
+        menu.setHeaderTitle(R.string.accounts_tester_account_context_menu_title);
+
+        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo)menuInfo;
+
+        MenuInflater inflater = getMenuInflater();
+        inflater.inflate(R.layout.account_list_context_menu, menu);
+        mLongPressedAccount = ((TextView)info.targetView).getText().toString();
+    }
+
+    @Override
+    public boolean onContextItemSelected(MenuItem item) {
+        if (item.getItemId() == R.id.accounts_tester_remove_account) {
+            final Account account = new Account(mLongPressedAccount, COM_GOOGLE);
+            mAccountManager.removeAccount(account, new AccountManagerCallback<Boolean>() {
+                public void run(AccountManagerFuture<Boolean> future) {
+                    try {
+                        Log.d(TAG, "removeAccount(" + account + ") = " + future.getResult());
+                    } catch (OperationCanceledException e) {
+                    } catch (IOException e) {
+                    } catch (AuthenticatorException e) {
+                    }
+                }
+            }, null /* handler */);
+        } else if (item.getItemId() == R.id.accounts_tester_get_auth_token) {
+            showDialog(GET_AUTH_TOKEN_DIALOG_ID);
+        } else if (item.getItemId() == R.id.accounts_tester_invalidate_auth_token) {
+            showDialog(INVALIDATE_AUTH_TOKEN_DIALOG_ID);
+        } else if (item.getItemId() == R.id.accounts_tester_update_credentials) {
+            showDialog(UPDATE_CREDENTIALS_DIALOG_ID);
+        } else if (item.getItemId() == R.id.accounts_tester_confirm_credentials) {
+            mAccountManager.confirmCredentials(new Account(mLongPressedAccount, COM_GOOGLE), null,
+                    AccountsTester.this, new ConfirmCredentialsCallback(), null /* handler */);
+        }
+        return true;
+    }
+
+    @Override
+    protected Dialog onCreateDialog(final int id) {
+        if (id == GET_AUTH_TOKEN_DIALOG_ID || id == INVALIDATE_AUTH_TOKEN_DIALOG_ID
+                || id == UPDATE_CREDENTIALS_DIALOG_ID) {
+            final View view = LayoutInflater.from(this).inflate(R.layout.get_auth_token_view, null);
+            AlertDialog.Builder builder = new AlertDialog.Builder(this);
+            builder.setPositiveButton(R.string.accounts_tester_do_get_auth_token,
+                    new DialogInterface.OnClickListener() {
+                        public void onClick(DialogInterface dialog, int which) {
+                            EditText value = (EditText) view.findViewById(
+                                    R.id.accounts_tester_auth_token_type);
+
+                            String authTokenType = value.getText().toString();
+                            AccountManagerCallback<Bundle> callback = new AccountManagerCallback<Bundle>() {
+                                public void run(AccountManagerFuture<Bundle> future) {
+                                    try {
+                                        Bundle bundle = future.getResult();
+                                        bundle.keySet();
+                                        Log.d(TAG, "dialog " + id + " success: " + bundle);
+                                    } catch (OperationCanceledException e) {
+                                        Log.d(TAG, "dialog " + id + " canceled");
+                                    } catch (IOException e) {
+                                        Log.d(TAG, "dialog " + id + " failed: " + e);
+                                    } catch (AuthenticatorException e) {
+                                        Log.d(TAG, "dialog " + id + " failed: " + e);
+                                    }
+                                }
+                            };
+                            final Account account = new Account(mLongPressedAccount,
+                                    COM_GOOGLE);
+                            if (id == GET_AUTH_TOKEN_DIALOG_ID) {
+                                mAccountManager.getAuthToken(account, authTokenType,
+                                        null /* loginOptions */, AccountsTester.this,
+                                        callback, null /* handler */);
+                            } else if (id == INVALIDATE_AUTH_TOKEN_DIALOG_ID) {
+                                mAccountManager.getAuthToken(account, authTokenType, false,
+                                        new GetAndInvalidateAuthTokenCallback(), null);
+                            } else {
+                                mAccountManager.updateCredentials(
+                                        account,
+                                        authTokenType, null /* loginOptions */,
+                                        AccountsTester.this, callback, null /* handler */);
+                            }
+                        }
+            });
+            builder.setView(view);
+            return builder.create();
+        }
+        return super.onCreateDialog(id);
+    }
+
+    AccountManagerCallback<Bundle> newAccountsCallback(String type, String[] features) {
+        return new GetAccountsCallback(type, features);
+    }
+
+    class GetAccountsCallback implements AccountManagerCallback<Bundle> {
+        final String[] mFeatures;
+        final String mAccountType;
+
+        public GetAccountsCallback(String type, String[] features) {
+            mFeatures = features;
+            mAccountType = type;
+        }
+
+        public void run(AccountManagerFuture<Bundle> future) {
+            Log.d(TAG, "GetAccountsCallback: type " + mAccountType
+                    + ", features "
+                    + (mFeatures == null ? "none" : TextUtils.join(",", mFeatures)));
+            try {
+                Bundle result = future.getResult();
+                Parcelable[] accounts = result.getParcelableArray(AccountManager.KEY_ACCOUNTS);
+                Log.d(TAG, "found " + accounts.length + " accounts");
+                for (Parcelable account : accounts) {
+                    Log.d(TAG, "  " + account);
+                }
+            } catch (OperationCanceledException e) {
+                Log.d(TAG, "failure", e);
+            } catch (IOException e) {
+                Log.d(TAG, "failure", e);
+            } catch (AuthenticatorException e) {
+                Log.d(TAG, "failure", e);
+            }
+        }
+    }
+
+    AccountManagerCallback<Bundle> newAuthTokensCallback(String type, String authTokenType, String[] features) {
+        return new GetAuthTokenCallback(type, authTokenType, features);
+    }
+
+    class GetAuthTokenCallback implements AccountManagerCallback<Bundle> {
+        final String[] mFeatures;
+        final String mAccountType;
+        final String mAuthTokenType;
+
+        public GetAuthTokenCallback(String type, String authTokenType, String[] features) {
+            mFeatures = features;
+            mAccountType = type;
+            mAuthTokenType = authTokenType;
+        }
+
+        public void run(AccountManagerFuture<Bundle> future) {
+            Log.d(TAG, "GetAuthTokenCallback: type " + mAccountType
+                    + ", features "
+                    + (mFeatures == null ? "none" : TextUtils.join(",", mFeatures)));
+            try {
+                Bundle result = future.getResult();
+                result.keySet();
+                Log.d(TAG, "  result: " + result);
+            } catch (OperationCanceledException e) {
+                Log.d(TAG, "failure", e);
+            } catch (IOException e) {
+                Log.d(TAG, "failure", e);
+            } catch (AuthenticatorException e) {
+                Log.d(TAG, "failure", e);
+            }
+        }
+    }
+
+    private class GetAndInvalidateAuthTokenCallback implements AccountManagerCallback<Bundle> {
+        public void run(AccountManagerFuture<Bundle> future) {
+            try {
+                Bundle bundle = future.getResult();
+                String authToken = bundle.getString(AccountManager.KEY_AUTHTOKEN);
+                mAccountManager.invalidateAuthToken(COM_GOOGLE, authToken);
+            } catch (OperationCanceledException e) {
+                Log.d(TAG, "invalidate: interrupted while getting authToken");
+            } catch (IOException e) {
+                Log.d(TAG, "invalidate: error getting authToken", e);
+            } catch (AuthenticatorException e) {
+                Log.d(TAG, "invalidate: error getting authToken", e);
+            }
+        }
+    }
+
+    private static class ConfirmCredentialsCallback implements AccountManagerCallback<Bundle> {
+        public void run(AccountManagerFuture<Bundle> future) {
+            try {
+                Bundle bundle = future.getResult();
+                bundle.keySet();
+                Log.d(TAG, "confirmCredentials success: " + bundle);
+            } catch (OperationCanceledException e) {
+                Log.d(TAG, "confirmCredentials canceled");
+            } catch (AuthenticatorException e) {
+                Log.d(TAG, "confirmCredentials failed: " + e);
+            } catch (IOException e) {
+                Log.d(TAG, "confirmCredentials failed: " + e);
+            }
+        }
+    }
+}
diff --git a/apps/Development/src/com/android/development/AppPicker.java b/apps/Development/src/com/android/development/AppPicker.java
index 693defb..28040c2 100644
--- a/apps/Development/src/com/android/development/AppPicker.java
+++ b/apps/Development/src/com/android/development/AppPicker.java
@@ -17,11 +17,14 @@
 
 package com.android.development;
 
+import com.android.development.PackageBrowser.MyPackageInfo;
+
 import android.app.ActivityManagerNative;
 import android.app.ListActivity;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
 import android.os.Bundle;
 import android.os.RemoteException;
 import android.provider.Settings;
@@ -29,10 +32,12 @@
 import android.view.ViewGroup;
 import android.view.LayoutInflater;
 import android.widget.BaseAdapter;
+import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.TextView;
 
 import java.text.Collator;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
@@ -67,96 +72,67 @@
     @Override
     protected void onListItemClick(ListView l, View v, int position, long id)
     {
-        ApplicationInfo app = mAdapter.appForPosition(position);
+        MyApplicationInfo app = mAdapter.itemForPosition(position);
         Intent intent = new Intent();
-        if (app != null) intent.setAction(app.packageName);
+        if (app.info != null) intent.setAction(app.info.packageName);
         setResult(RESULT_OK, intent);
         
-        /* This is a temporary fix for 824637 while it is blocked by 805226.  When 805226 is resolved, please remove this. */
         try {
             boolean waitForDebugger = Settings.System.getInt(
                     getContentResolver(), Settings.System.WAIT_FOR_DEBUGGER, 0) != 0;
             ActivityManagerNative.getDefault().setDebugApp(
-                    app != null ? app.packageName : null, waitForDebugger, true);
+                    app.info != null ? app.info.packageName : null, waitForDebugger, true);
         } catch (RemoteException ex) {
         }
         
         finish();
     }
 
-    private final class AppListAdapter extends BaseAdapter
-    {
-        public AppListAdapter(Context context)
-        {
-            mContext = context;
-            mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+    class MyApplicationInfo {
+        ApplicationInfo info;
+        String label;
+    }
+    
+    public class AppListAdapter extends ArrayAdapter<MyApplicationInfo> {
+        private List<MyApplicationInfo> mPackageInfoList = new ArrayList<MyApplicationInfo>();
 
-            mList = context.getPackageManager().getInstalledApplications(0);
-            if (mList != null) {
-                Collections.sort(mList, sDisplayNameComparator);
-                mList.add(0, null);
+        public AppListAdapter(Context context) {
+            super(context, R.layout.package_list_item);
+            List<ApplicationInfo> pkgs = context.getPackageManager().getInstalledApplications(0);
+            for (int i=0; i<pkgs.size(); i++) {
+                MyApplicationInfo info = new MyApplicationInfo();
+                info.info = pkgs.get(i);
+                info.label = info.info.loadLabel(getPackageManager()).toString();
+                mPackageInfoList.add(info);
             }
+            Collections.sort(mPackageInfoList, sDisplayNameComparator);
+            MyApplicationInfo info = new MyApplicationInfo();
+            info.label = "(none)";
+            mPackageInfoList.add(0, info);
+            setSource(mPackageInfoList);
         }
     
-        public ApplicationInfo appForPosition(int position)
-        {
-            if (mList == null) {
-                return null;
-            }
-
-            return mList.get(position);
-        }
-
-        public int getCount()
-        {
-            return mList != null ? mList.size() : 0;
-        }
-
-        public Object getItem(int position)
-        {
-            return position;
-        }
-    
-        public long getItemId(int position)
-        {
-            return position;
-        }
-    
-        public View getView(int position, View convertView, ViewGroup parent)
-        {
-            View view;
-            if (convertView == null) {
-                view = mInflater.inflate(
-                        android.R.layout.simple_list_item_1, parent, false);
+        @Override
+        public void bindView(View view, MyApplicationInfo info) {
+            ImageView icon = (ImageView)view.findViewById(R.id.icon);
+            TextView name = (TextView)view.findViewById(R.id.name);
+            TextView description = (TextView)view.findViewById(R.id.description);
+            name.setText(info.label);
+            if (info.info != null) {
+                icon.setImageDrawable(info.info.loadIcon(getPackageManager()));
+                description.setText(info.info.packageName);
             } else {
-                view = convertView;
+                icon.setImageDrawable(null);
+                description.setText("");
             }
-            bindView(view, mList.get(position));
-            return view;
         }
-    
-        private final void bindView(View view, ApplicationInfo info)
-        {
-            TextView text = (TextView)view.findViewById(android.R.id.text1);
-    
-            text.setText(info != null ? info.packageName : "(none)");
-        }
-    
-        protected final Context mContext;
-        protected final LayoutInflater mInflater;
-    
-        protected List<ApplicationInfo> mList;
-        
     }
 
-    private final static Comparator sDisplayNameComparator = new Comparator() {
+    private final static Comparator<MyApplicationInfo> sDisplayNameComparator
+            = new Comparator<MyApplicationInfo>() {
         public final int
-        compare(Object a, Object b)
-        {
-            CharSequence  sa = ((ApplicationInfo) a).packageName;
-            CharSequence  sb = ((ApplicationInfo) b).packageName;
-
-            return collator.compare(sa, sb);
+        compare(MyApplicationInfo a, MyApplicationInfo b) {
+            return collator.compare(a.label, b.label);
         }
 
         private final Collator   collator = Collator.getInstance();
diff --git a/apps/Development/src/com/android/development/DevelopmentSettings.java b/apps/Development/src/com/android/development/DevelopmentSettings.java
index 3b4848a..9cb6fc6 100644
--- a/apps/Development/src/com/android/development/DevelopmentSettings.java
+++ b/apps/Development/src/com/android/development/DevelopmentSettings.java
@@ -38,6 +38,7 @@
 import android.widget.CheckBox;
 import android.widget.CompoundButton;
 import android.widget.Spinner;
+import android.widget.Toast;
 import android.widget.AdapterView.OnItemSelectedListener;
 
 import java.io.FileInputStream;
@@ -58,6 +59,7 @@
     private CheckBox mShowBackgroundCB;
     private CheckBox mShowSleepCB;
     private CheckBox mShowXmppCB;
+    private CheckBox mCompatibilityModeCB;
     private Spinner mMaxProcsSpinner;
     private Spinner mWindowAnimationScaleSpinner;
     private Spinner mTransitionAnimationScaleSpinner;
@@ -69,6 +71,7 @@
     private int mProcessLimit;
     private boolean mShowSleep;
     private boolean mShowXmpp;
+    private boolean mCompatibilityMode;
     private AnimationScaleSelectedListener mWindowAnimationScale
             = new AnimationScaleSelectedListener(0);
     private AnimationScaleSelectedListener mTransitionAnimationScale
@@ -106,6 +109,8 @@
         mShowSleepCB.setOnClickListener(mShowSleepClicked);
         mShowXmppCB = (CheckBox)findViewById(R.id.show_xmpp);
         mShowXmppCB.setOnClickListener(mShowXmppClicked);
+        mCompatibilityModeCB = (CheckBox)findViewById(R.id.compatibility_mode);
+        mCompatibilityModeCB.setOnClickListener(mCompatibilityModeClicked);
         mMaxProcsSpinner = (Spinner)findViewById(R.id.max_procs);
         mMaxProcsSpinner.setOnItemSelectedListener(mMaxProcsChanged);
         ArrayAdapter<String> adapter = new ArrayAdapter<String>(
@@ -168,7 +173,8 @@
         updateSharedOptions();
         updateFlingerOptions();
         updateSleepOptions();
-        updateXmppOptions();        
+        updateXmppOptions();
+        updateCompatibilityOptions();
 
         try {
             FileInputStream  in = new FileInputStream( FONT_HINTING_FILE );
@@ -235,6 +241,17 @@
                 Settings.System.SHOW_PROCESSES, 0) != 0);
     }
 
+    private void writeCompatibilityOptions() {
+        Settings.System.putInt(getContentResolver(),
+                Settings.System.COMPATIBILITY_MODE, mCompatibilityMode ? 0 : 1);
+    }
+
+    private void updateCompatibilityOptions() {
+        mCompatibilityMode = Settings.System.getInt(
+            getContentResolver(), Settings.System.COMPATIBILITY_MODE, 1) == 0;
+        mCompatibilityModeCB.setChecked(mCompatibilityMode);
+    }
+
     private void updateFlingerOptions() {
         // magic communication with surface flinger.
         try {
@@ -332,6 +349,19 @@
         }
     };
 
+    private View.OnClickListener mCompatibilityModeClicked =
+        new View.OnClickListener() {
+    public void onClick(View v) {
+        mCompatibilityMode = ((CheckBox)v).isChecked();
+        writeCompatibilityOptions();
+        updateCompatibilityOptions();
+        Toast toast = Toast.makeText(DevelopmentSettings.this,
+                R.string.development_settings_compatibility_mode_toast,
+                Toast.LENGTH_LONG);
+        toast.show();
+    }
+};
+
     private View.OnClickListener mShowLoadClicked = new View.OnClickListener() {
         public void onClick(View v) {
             boolean value = ((CheckBox)v).isChecked();
diff --git a/apps/Development/src/com/android/development/PackageBrowser.java b/apps/Development/src/com/android/development/PackageBrowser.java
index e4c233f..689183d 100644
--- a/apps/Development/src/com/android/development/PackageBrowser.java
+++ b/apps/Development/src/com/android/development/PackageBrowser.java
@@ -31,27 +31,38 @@
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
+import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.TextView;
 
 import java.text.Collator;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 
-public class PackageBrowser extends ListActivity
-{
+public class PackageBrowser extends ListActivity {
+    static class MyPackageInfo {
+        PackageInfo info;
+        String label;
+    }
+    
     private PackageListAdapter mAdapter;
-    private List<PackageInfo> mPackageInfoList = null;
+    private List<MyPackageInfo> mPackageInfoList = new ArrayList<MyPackageInfo>();
     private Handler mHandler;
+    private BroadcastReceiver mRegisteredReceiver;
 
-    public class PackageListAdapter extends ArrayAdapter<PackageInfo>
-    {
+    public class PackageListAdapter extends ArrayAdapter<MyPackageInfo> {
 
-        public PackageListAdapter(Context context)
-        {
-            super(context, android.R.layout.simple_list_item_1);
-            mPackageInfoList = context.getPackageManager().getInstalledPackages(0);
+        public PackageListAdapter(Context context) {
+            super(context, R.layout.package_list_item);
+            List<PackageInfo> pkgs = context.getPackageManager().getInstalledPackages(0);
+            for (int i=0; i<pkgs.size(); i++) {
+                MyPackageInfo info = new MyPackageInfo();
+                info.info = pkgs.get(i);
+                info.label = info.info.applicationInfo.loadLabel(getPackageManager()).toString();
+                mPackageInfoList.add(info);
+            }
             if (mPackageInfoList != null) {
                 Collections.sort(mPackageInfoList, sDisplayNameComparator);
             }
@@ -59,10 +70,13 @@
         }
     
         @Override
-        public void bindView(View view, PackageInfo info)
-        {
-            TextView text = (TextView)view.findViewById(android.R.id.text1);
-            text.setText(info.packageName);
+        public void bindView(View view, MyPackageInfo info) {
+            ImageView icon = (ImageView)view.findViewById(R.id.icon);
+            TextView name = (TextView)view.findViewById(R.id.name);
+            TextView description = (TextView)view.findViewById(R.id.description);
+            icon.setImageDrawable(info.info.applicationInfo.loadIcon(getPackageManager()));
+            name.setText(info.label);
+            description.setText(info.info.packageName);
         }
     }
 
@@ -78,13 +92,11 @@
         }
     }
 
-    private final static Comparator sDisplayNameComparator = new Comparator() {
+    private final static Comparator<MyPackageInfo> sDisplayNameComparator
+            = new Comparator<MyPackageInfo>() {
         public final int
-        compare(Object a, Object b)
-        {
-            CharSequence  sa = ((PackageInfo) a).packageName;
-            CharSequence  sb = ((PackageInfo) b).packageName;
-            return collator.compare(sa, sb);
+        compare(MyPackageInfo a, MyPackageInfo b) {
+            return collator.compare(a.label, b.label);
         }
 
         private final Collator   collator = Collator.getInstance();
@@ -98,6 +110,14 @@
         registerIntentReceivers();
     }
 
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        if (mRegisteredReceiver != null) {
+            unregisterReceiver(mRegisteredReceiver);
+        }
+    }
+
     private void setupAdapter() {
         mAdapter = new PackageListAdapter(this);
         setListAdapter(mAdapter);
@@ -119,9 +139,9 @@
         final int curSelection = getSelectedItemPosition();
         if (curSelection >= 0) {
             // todo: verification dialog for package deletion
-            final PackageInfo packageInfo = mAdapter.itemForPosition(curSelection);
+            final MyPackageInfo packageInfo = mAdapter.itemForPosition(curSelection);
             if (packageInfo != null) {
-                getPackageManager().deletePackage(packageInfo.packageName,
+                getPackageManager().deletePackage(packageInfo.info.packageName,
                                                   new IPackageDeleteObserver.Stub() {
                     public void packageDeleted(boolean succeeded) throws RemoteException {
                         if (succeeded) {
@@ -133,7 +153,7 @@
                                 });
 
                             // todo: verification dialog for data directory
-                            final String dataPath = packageInfo.applicationInfo.dataDir;
+                            final String dataPath = packageInfo.info.applicationInfo.dataDir;
                             // todo: delete the data directory
                         } else {
                             mHandler.post(new Runnable() {
@@ -159,17 +179,17 @@
         filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
         filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
         filter.addDataScheme("package");
-        registerReceiver(new ApplicationsIntentReceiver(), filter);
+        mRegisteredReceiver = new ApplicationsIntentReceiver();
+        registerReceiver(mRegisteredReceiver, filter);
     }
 
     @Override
-    protected void onListItemClick(ListView l, View v, int position, long id)
-    {
-        PackageInfo info =
+    protected void onListItemClick(ListView l, View v, int position, long id) {
+        MyPackageInfo info =
             mAdapter.itemForPosition(position);
         if (info != null) {
             Intent intent = new Intent(
-                null, Uri.fromParts("package", info.packageName, null));
+                null, Uri.fromParts("package", info.info.packageName, null));
             intent.setClass(this, PackageSummary.class);
             startActivity(intent);
         }
diff --git a/apps/Development/src/com/android/development/PackageSummary.java b/apps/Development/src/com/android/development/PackageSummary.java
index a6bbbb2..5610559 100644
--- a/apps/Development/src/com/android/development/PackageSummary.java
+++ b/apps/Development/src/com/android/development/PackageSummary.java
@@ -31,6 +31,7 @@
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.RemoteException;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.Button;
@@ -90,7 +91,8 @@
             info = pm.getPackageInfo(mPackageName,
                 PackageManager.GET_ACTIVITIES | PackageManager.GET_RECEIVERS
                 | PackageManager.GET_SERVICES | PackageManager.GET_PROVIDERS
-                | PackageManager.GET_INSTRUMENTATION);
+                | PackageManager.GET_INSTRUMENTATION
+                | PackageManager.GET_DISABLED_COMPONENTS);
         } catch (PackageManager.NameNotFoundException e) {
         }
 
@@ -192,6 +194,7 @@
                     ActivityInfo ai = info.receivers[i];
                     Button view = (Button)inflate.inflate(
                         R.layout.package_item, null, false);
+                    Log.i("foo", "Receiver #" + i + " of " + N + ": " + ai);
                     setItemText(view, info, ai.name);
                     receivers.addView(view, lp);
                 }
diff --git a/apps/Development/src/com/android/development/PointerLocation.java b/apps/Development/src/com/android/development/PointerLocation.java
index 668e9ba..38b4af2 100644
--- a/apps/Development/src/com/android/development/PointerLocation.java
+++ b/apps/Development/src/com/android/development/PointerLocation.java
@@ -20,11 +20,11 @@
 import android.content.Context;
 import android.graphics.Canvas;
 import android.graphics.Paint;
-import android.graphics.Rect;
 import android.graphics.Paint.FontMetricsInt;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.MotionEvent;
+import android.view.ViewConfiguration;
 import android.view.WindowManager;
 import android.view.VelocityTracker;
 import android.view.View;
@@ -47,16 +47,9 @@
         getWindow().setAttributes(lp);
     }
     
-    public class MyView extends View {
-        private final Paint mTextPaint;
-        private final Paint mTextBackgroundPaint;
-        private final Paint mTextLevelPaint;
-        private final Paint mPaint;
-        private final Paint mTargetPaint;
-        private final FontMetricsInt mTextMetrics = new FontMetricsInt();
+    public static class PointerState {
         private final ArrayList<Float> mXs = new ArrayList<Float>();
         private final ArrayList<Float> mYs = new ArrayList<Float>();
-        private int mHeaderBottom;
         private boolean mCurDown;
         private int mCurX;
         private int mCurY;
@@ -64,12 +57,31 @@
         private float mCurSize;
         private int mCurWidth;
         private VelocityTracker mVelocity;
+    }
+    
+    public class MyView extends View {
+        private final ViewConfiguration mVC;
+        private final Paint mTextPaint;
+        private final Paint mTextBackgroundPaint;
+        private final Paint mTextLevelPaint;
+        private final Paint mPaint;
+        private final Paint mTargetPaint;
+        private final Paint mPathPaint;
+        private final FontMetricsInt mTextMetrics = new FontMetricsInt();
+        private int mHeaderBottom;
+        private boolean mCurDown;
+        private int mCurNumPointers;
+        private int mMaxNumPointers;
+        private final ArrayList<PointerState> mPointers
+                 = new ArrayList<PointerState>();
         
         public MyView(Context c) {
             super(c);
+            mVC = ViewConfiguration.get(c);
             mTextPaint = new Paint();
             mTextPaint.setAntiAlias(true);
-            mTextPaint.setTextSize(10);
+            mTextPaint.setTextSize(10
+                    * getResources().getDisplayMetrics().density);
             mTextPaint.setARGB(255, 0, 0, 0);
             mTextBackgroundPaint = new Paint();
             mTextBackgroundPaint.setAntiAlias(false);
@@ -84,9 +96,16 @@
             mPaint.setStrokeWidth(2);
             mTargetPaint = new Paint();
             mTargetPaint.setAntiAlias(false);
-            mTargetPaint.setARGB(192, 0, 0, 255);
+            mTargetPaint.setARGB(255, 0, 0, 192);
+            mPathPaint = new Paint();
+            mPathPaint.setAntiAlias(false);
+            mPathPaint.setARGB(255, 0, 96, 255);
             mPaint.setStyle(Paint.Style.STROKE);
             mPaint.setStrokeWidth(1);
+            
+            PointerState ps = new PointerState();
+            ps.mVelocity = VelocityTracker.obtain();
+            mPointers.add(ps);
         }
 
         @Override
@@ -103,58 +122,119 @@
 
         @Override
         protected void onDraw(Canvas canvas) {
-            int w = getWidth()/5;
-            int base = -mTextMetrics.ascent+1;
-            int bottom = mHeaderBottom;
-            canvas.drawRect(0, 0, w-1, bottom, mTextBackgroundPaint);
-            canvas.drawText("X: " + mCurX, 1, base, mTextPaint);
-            canvas.drawRect(w, 0, (w * 2) - 1, bottom, mTextBackgroundPaint);
-            canvas.drawText("Y: " + mCurY, 1 + w, base, mTextPaint);
-            canvas.drawRect(w * 2, 0, (w * 3) - 1, bottom, mTextBackgroundPaint);
-            canvas.drawRect(w * 2, 0, (w * 2) + (mCurPressure * w) - 1, bottom, mTextLevelPaint);
-            canvas.drawText("Pres: " + mCurPressure, 1 + w * 2, base, mTextPaint);
-            canvas.drawRect(w * 3, 0, (w * 4) - 1, bottom, mTextBackgroundPaint);
-            canvas.drawRect(w * 3, 0, (w * 3) + (mCurSize * w) - 1, bottom, mTextLevelPaint);
-            canvas.drawText("Size: " + mCurSize, 1 + w * 3, base, mTextPaint);
-            canvas.drawRect(w * 4, 0, getWidth(), bottom, mTextBackgroundPaint);
-            int velocity = mVelocity == null ? 0 : (int) (mVelocity.getYVelocity() * 1000);
-            canvas.drawText("yVel: " + velocity, 1 + w * 4, base, mTextPaint);
+            final int w = getWidth();
+            final int itemW = w/7;
+            final int base = -mTextMetrics.ascent+1;
+            final int bottom = mHeaderBottom;
             
-            final int N = mXs.size();
-            float lastX=0, lastY=0;
-            mPaint.setARGB(255, 0, 255, 255);
-            for (int i=0; i<N; i++) {
-                float x = mXs.get(i);
-                float y = mYs.get(i);
-                if (i > 0) {
-                    canvas.drawLine(lastX, lastY, x, y, mTargetPaint);
-                    canvas.drawPoint(lastX, lastY, mPaint);
+            final int NP = mPointers.size();
+            
+            if (NP > 0) {
+                final PointerState ps = mPointers.get(0);
+                canvas.drawRect(0, 0, itemW-1, bottom,mTextBackgroundPaint);
+                canvas.drawText("P: " + mCurNumPointers + " / " + mMaxNumPointers,
+                        1, base, mTextPaint);
+                
+                final int N = ps.mXs.size();
+                if ((mCurDown && ps.mCurDown) || N == 0) {
+                    canvas.drawRect(itemW, 0, (itemW * 2) - 1, bottom, mTextBackgroundPaint);
+                    canvas.drawText("X: " + ps.mCurX, 1 + itemW, base, mTextPaint);
+                    canvas.drawRect(itemW * 2, 0, (itemW * 3) - 1, bottom, mTextBackgroundPaint);
+                    canvas.drawText("Y: " + ps.mCurY, 1 + itemW * 2, base, mTextPaint);
+                } else {
+                    float dx = ps.mXs.get(N-1) - ps.mXs.get(0);
+                    float dy = ps.mYs.get(N-1) - ps.mYs.get(0);
+                    canvas.drawRect(itemW, 0, (itemW * 2) - 1, bottom,
+                            Math.abs(dx) < mVC.getScaledTouchSlop()
+                            ? mTextBackgroundPaint : mTextLevelPaint);
+                    canvas.drawText("dX: " + String.format("%.1f", dx), 1 + itemW, base, mTextPaint);
+                    canvas.drawRect(itemW * 2, 0, (itemW * 3) - 1, bottom,
+                            Math.abs(dy) < mVC.getScaledTouchSlop()
+                            ? mTextBackgroundPaint : mTextLevelPaint);
+                    canvas.drawText("dY: " + String.format("%.1f", dy), 1 + itemW * 2, base, mTextPaint);
                 }
-                lastX = x;
-                lastY = y;
-            }
-            if (mVelocity != null) {
-                mPaint.setARGB(255, 255, 0, 0);
-                float xVel = mVelocity.getXVelocity() * (1000/60);
-                float yVel = mVelocity.getYVelocity() * (1000/60);
-                canvas.drawLine(lastX, lastY, lastX+xVel, lastY+yVel, mPaint);
-            } else {
-                canvas.drawPoint(lastX, lastY, mPaint);
+                
+                canvas.drawRect(itemW * 3, 0, (itemW * 4) - 1, bottom, mTextBackgroundPaint);
+                int velocity = ps.mVelocity == null ? 0 : (int) (ps.mVelocity.getXVelocity() * 1000);
+                canvas.drawText("Xv: " + velocity, 1 + itemW * 3, base, mTextPaint);
+                
+                canvas.drawRect(itemW * 4, 0, (itemW * 5) - 1, bottom, mTextBackgroundPaint);
+                velocity = ps.mVelocity == null ? 0 : (int) (ps.mVelocity.getYVelocity() * 1000);
+                canvas.drawText("Yv: " + velocity, 1 + itemW * 4, base, mTextPaint);
+                
+                canvas.drawRect(itemW * 5, 0, (itemW * 6) - 1, bottom, mTextBackgroundPaint);
+                canvas.drawRect(itemW * 5, 0, (itemW * 5) + (ps.mCurPressure * itemW) - 1,
+                        bottom, mTextLevelPaint);
+                canvas.drawText("Prs: " + String.format("%.2f", ps.mCurPressure), 1 + itemW * 5,
+                        base, mTextPaint);
+                
+                canvas.drawRect(itemW * 6, 0, w, bottom, mTextBackgroundPaint);
+                canvas.drawRect(itemW * 6, 0, (itemW * 6) + (ps.mCurSize * itemW) - 1,
+                        bottom, mTextLevelPaint);
+                canvas.drawText("Size: " + String.format("%.2f", ps.mCurSize), 1 + itemW * 6,
+                        base, mTextPaint);
             }
             
-            if (mCurDown) {
-                canvas.drawLine(0, (int)mCurY, getWidth(), (int)mCurY, mTargetPaint);
-                canvas.drawLine((int)mCurX, 0, (int)mCurX, getHeight(), mTargetPaint);
-                int pressureLevel = (int)(mCurPressure*255);
-                mPaint.setARGB(255, pressureLevel, 128, 255-pressureLevel);
-                canvas.drawPoint(mCurX, mCurY, mPaint);
-                canvas.drawCircle(mCurX, mCurY, mCurWidth, mPaint);
+            for (int p=0; p<NP; p++) {
+                final PointerState ps = mPointers.get(p);
+                
+                if (mCurDown && ps.mCurDown) {
+                    canvas.drawLine(0, (int)ps.mCurY, getWidth(), (int)ps.mCurY, mTargetPaint);
+                    canvas.drawLine((int)ps.mCurX, 0, (int)ps.mCurX, getHeight(), mTargetPaint);
+                    int pressureLevel = (int)(ps.mCurPressure*255);
+                    mPaint.setARGB(255, pressureLevel, 128, 255-pressureLevel);
+                    canvas.drawPoint(ps.mCurX, ps.mCurY, mPaint);
+                    canvas.drawCircle(ps.mCurX, ps.mCurY, ps.mCurWidth, mPaint);
+                }
+            }
+            
+            for (int p=0; p<NP; p++) {
+                final PointerState ps = mPointers.get(p);
+                
+                final int N = ps.mXs.size();
+                float lastX=0, lastY=0;
+                boolean haveLast = false;
+                boolean drawn = false;
+                mPaint.setARGB(255, 128, 255, 255);
+                for (int i=0; i<N; i++) {
+                    float x = ps.mXs.get(i);
+                    float y = ps.mYs.get(i);
+                    if (Float.isNaN(x)) {
+                        haveLast = false;
+                        continue;
+                    }
+                    if (haveLast) {
+                        canvas.drawLine(lastX, lastY, x, y, mPathPaint);
+                        canvas.drawPoint(lastX, lastY, mPaint);
+                        drawn = true;
+                    }
+                    lastX = x;
+                    lastY = y;
+                    haveLast = true;
+                }
+                
+                if (drawn) {
+                    if (ps.mVelocity != null) {
+                        mPaint.setARGB(255, 255, 64, 128);
+                        float xVel = ps.mVelocity.getXVelocity() * (1000/60);
+                        float yVel = ps.mVelocity.getYVelocity() * (1000/60);
+                        canvas.drawLine(lastX, lastY, lastX+xVel, lastY+yVel, mPaint);
+                    } else {
+                        canvas.drawPoint(lastX, lastY, mPaint);
+                    }
+                }
             }
         }
 
         @Override
         public boolean onTouchEvent(MotionEvent event) {
             int action = event.getAction();
+            
+            //Log.i("Pointer", "Motion: action=0x" + Integer.toHexString(action)
+            //        + " pointers=" + event.getPointerCount());
+            
+            int NP = mPointers.size();
+            
             //mRect.set(0, 0, getWidth(), mHeaderBottom+1);
             //invalidate(mRect);
             //if (mCurDown) {
@@ -164,26 +244,91 @@
             //    mRect.setEmpty();
             //}
             if (action == MotionEvent.ACTION_DOWN) {
-                mXs.clear();
-                mYs.clear();
-                mVelocity = VelocityTracker.obtain();
+                for (int p=0; p<NP; p++) {
+                    final PointerState ps = mPointers.get(p);
+                    ps.mXs.clear();
+                    ps.mYs.clear();
+                    ps.mVelocity = VelocityTracker.obtain();
+                    ps.mCurDown = false;
+                }
+                mPointers.get(0).mCurDown = true;
+                mMaxNumPointers = 0;
+                Log.i("Pointer", "Pointer 1: DOWN");
             }
-            mVelocity.addMovement(event);
-            mVelocity.computeCurrentVelocity(1);
-            final int N = event.getHistorySize();
-            for (int i=0; i<N; i++) {
-                mXs.add(event.getHistoricalX(i));
-                mYs.add(event.getHistoricalY(i));
+            
+            if ((action&MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_DOWN) {
+                final int id = (action&MotionEvent.ACTION_POINTER_ID_MASK)
+                        >> MotionEvent.ACTION_POINTER_ID_SHIFT;
+                while (NP <= id) {
+                    PointerState ps = new PointerState();
+                    ps.mVelocity = VelocityTracker.obtain();
+                    mPointers.add(ps);
+                    NP++;
+                }
+                final PointerState ps = mPointers.get(id);
+                ps.mVelocity = VelocityTracker.obtain();
+                ps.mCurDown = true;
+                Log.i("Pointer", "Pointer " + (id+1) + ": DOWN");
             }
-            mXs.add(event.getX());
-            mYs.add(event.getY());
-            mCurDown = action == MotionEvent.ACTION_DOWN
-                    || action == MotionEvent.ACTION_MOVE;
-            mCurX = (int)event.getX();
-            mCurY = (int)event.getY();
-            mCurPressure = event.getPressure();
-            mCurSize = event.getSize();
-            mCurWidth = (int)(mCurSize*(getWidth()/3));
+            
+            final int NI = event.getPointerCount();
+            
+            mCurDown = action != MotionEvent.ACTION_UP
+                    && action != MotionEvent.ACTION_CANCEL;
+            mCurNumPointers = mCurDown ? NI : 0;
+            if (mMaxNumPointers < mCurNumPointers) {
+                mMaxNumPointers = mCurNumPointers;
+            }
+            
+            for (int i=0; i<NI; i++) {
+                final PointerState ps = mPointers.get(event.getPointerId(i));
+                ps.mVelocity.addMovement(event);
+                ps.mVelocity.computeCurrentVelocity(1);
+                final int N = event.getHistorySize();
+                for (int j=0; j<N; j++) {
+                    Log.i("Pointer", "Pointer " + (i+1) + ": ("
+                            + event.getHistoricalX(i, j)
+                            + ", " + event.getHistoricalY(i, j) + ")"
+                            + " Prs=" + event.getHistoricalPressure(i, j)
+                            + " Size=" + event.getHistoricalSize(i, j));
+                    ps.mXs.add(event.getHistoricalX(i, j));
+                    ps.mYs.add(event.getHistoricalY(i, j));
+                }
+                Log.i("Pointer", "Pointer " + (i+1) + ": ("
+                        + event.getX(i) + ", " + event.getY(i) + ")"
+                        + " Prs=" + event.getPressure(i)
+                        + " Size=" + event.getSize(i));
+                ps.mXs.add(event.getX(i));
+                ps.mYs.add(event.getY(i));
+                ps.mCurX = (int)event.getX(i);
+                ps.mCurY = (int)event.getY(i);
+                //Log.i("Pointer", "Pointer #" + p + ": (" + ps.mCurX
+                //        + "," + ps.mCurY + ")");
+                ps.mCurPressure = event.getPressure(i);
+                ps.mCurSize = event.getSize(i);
+                ps.mCurWidth = (int)(ps.mCurSize*(getWidth()/3));
+            }
+            
+            if ((action&MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP) {
+                final int id = (action&MotionEvent.ACTION_POINTER_ID_MASK)
+                        >> MotionEvent.ACTION_POINTER_ID_SHIFT;
+                final PointerState ps = mPointers.get(id);
+                ps.mXs.add(Float.NaN);
+                ps.mYs.add(Float.NaN);
+                ps.mCurDown = false;
+                Log.i("Pointer", "Pointer " + (id+1) + ": UP");
+            }
+            
+            if (action == MotionEvent.ACTION_UP) {
+                for (int i=0; i<NI; i++) {
+                    final PointerState ps = mPointers.get(event.getPointerId(i));
+                    if (ps.mCurDown) {
+                        ps.mCurDown = false;
+                        Log.i("Pointer", "Pointer " + (i+1) + ": UP");
+                    }
+                }
+            }
+            
             //if (mCurDown) {
             //    mRect.union(mCurX-mCurWidth-3, mCurY-mCurWidth-3,
             //            mCurX+mCurWidth+3, mCurY+mCurWidth+3);
diff --git a/apps/Development/src/com/android/development/SyncAdapterDriver.java b/apps/Development/src/com/android/development/SyncAdapterDriver.java
new file mode 100644
index 0000000..c37075f
--- /dev/null
+++ b/apps/Development/src/com/android/development/SyncAdapterDriver.java
@@ -0,0 +1,374 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.development;
+
+import android.app.Activity;
+import android.app.PendingIntent;
+import android.app.Dialog;
+import android.app.AlertDialog;
+import android.content.res.TypedArray;
+import android.content.pm.RegisteredServicesCache;
+import android.content.pm.RegisteredServicesCacheListener;
+import android.content.SyncAdapterType;
+import android.content.ISyncAdapter;
+import android.content.ISyncContext;
+import android.content.ServiceConnection;
+import android.content.ComponentName;
+import android.content.SyncResult;
+import android.content.Intent;
+import android.content.Context;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.widget.ArrayAdapter;
+import android.widget.AdapterView;
+import android.widget.Spinner;
+import android.widget.Button;
+import android.widget.TextView;
+import android.widget.ListView;
+import android.util.AttributeSet;
+import android.provider.Settings;
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.view.View;
+import android.view.LayoutInflater;
+
+import java.util.Collection;
+
+public class SyncAdapterDriver extends Activity
+        implements RegisteredServicesCacheListener<SyncAdapterType>,
+        AdapterView.OnItemClickListener {
+    private Spinner mSyncAdapterSpinner;
+
+    private Button mBindButton;
+    private Button mUnbindButton;
+    private TextView mBoundAdapterTextView;
+    private Button mStartSyncButton;
+    private Button mCancelSyncButton;
+    private TextView mStatusTextView;
+    private Object[] mSyncAdapters;
+    private SyncAdaptersCache mSyncAdaptersCache;
+    private final Object mSyncAdaptersLock = new Object();
+
+    private static final int DIALOG_ID_PICK_ACCOUNT = 1;
+    private ListView mAccountPickerView = null;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        mSyncAdaptersCache = new SyncAdaptersCache(this);
+        setContentView(R.layout.sync_adapter_driver);
+
+        mSyncAdapterSpinner = (Spinner) findViewById(R.id.sync_adapters_spinner);
+        mBindButton = (Button) findViewById(R.id.bind_button);
+        mUnbindButton = (Button) findViewById(R.id.unbind_button);
+        mBoundAdapterTextView = (TextView) findViewById(R.id.bound_adapter_text_view);
+
+        mStartSyncButton = (Button) findViewById(R.id.start_sync_button);
+        mCancelSyncButton = (Button) findViewById(R.id.cancel_sync_button);
+
+        mStatusTextView = (TextView) findViewById(R.id.status_text_view);
+
+        getSyncAdapters();
+        mSyncAdaptersCache.setListener(this, null /* Handler */);
+    }
+
+    protected void onDestroy() {
+        mSyncAdaptersCache.close();
+        super.onDestroy();
+    }
+
+    private void getSyncAdapters() {
+        Collection<RegisteredServicesCache.ServiceInfo<SyncAdapterType>> all =
+                mSyncAdaptersCache.getAllServices();
+        synchronized (mSyncAdaptersLock) {
+            mSyncAdapters = new Object[all.size()];
+            String[] names = new String[mSyncAdapters.length];
+            int i = 0;
+            for (RegisteredServicesCache.ServiceInfo<SyncAdapterType> item : all) {
+                mSyncAdapters[i] = item;
+                names[i] = item.type.authority + " - " + item.type.accountType;
+                i++;
+            }
+
+            ArrayAdapter<String> adapter =
+                    new ArrayAdapter<String>(this,
+                    R.layout.sync_adapter_item, names);
+            mSyncAdapterSpinner.setAdapter(adapter);
+        }
+    }
+
+    void updateUi() {
+        boolean isBound;
+        boolean hasServiceConnection;
+        synchronized (mServiceConnectionLock) {
+            hasServiceConnection = mActiveServiceConnection != null;
+            isBound = hasServiceConnection && mActiveServiceConnection.mBoundSyncAdapter != null;
+        }
+        mStartSyncButton.setEnabled(isBound);
+        mCancelSyncButton.setEnabled(isBound);
+        mBindButton.setEnabled(!hasServiceConnection);
+        mUnbindButton.setEnabled(hasServiceConnection);
+    }
+
+    public void startSyncSelected(View view) {
+        synchronized (mServiceConnectionLock) {
+            ISyncAdapter syncAdapter = null;
+            if (mActiveServiceConnection != null) {
+                syncAdapter = mActiveServiceConnection.mBoundSyncAdapter;
+            }
+
+            if (syncAdapter != null) {
+                removeDialog(DIALOG_ID_PICK_ACCOUNT);
+
+                mAccountPickerView = (ListView) LayoutInflater.from(this).inflate(
+                        R.layout.account_list_view, null);
+                mAccountPickerView.setOnItemClickListener(this);
+                Account accounts[] = AccountManager.get(this).getAccountsByType(
+                        mActiveServiceConnection.mSyncAdapter.type.accountType);
+                String[] accountNames = new String[accounts.length];
+                for (int i = 0; i < accounts.length; i++) {
+                    accountNames[i] = accounts[i].name;
+                }
+                ArrayAdapter<String> adapter =
+                        new ArrayAdapter<String>(SyncAdapterDriver.this,
+                        android.R.layout.simple_list_item_1, accountNames);
+                mAccountPickerView.setAdapter(adapter);
+
+                showDialog(DIALOG_ID_PICK_ACCOUNT);
+            }
+        }
+        updateUi();
+    }
+
+    private void startSync(String accountName) {
+        synchronized (mServiceConnectionLock) {
+            ISyncAdapter syncAdapter = null;
+            if (mActiveServiceConnection != null) {
+                syncAdapter = mActiveServiceConnection.mBoundSyncAdapter;
+            }
+
+            if (syncAdapter != null) {
+                try {
+                    mStatusTextView.setText(
+                            getString(R.string.status_starting_sync_format, accountName));
+                    Account account = new Account(accountName,
+                            mActiveServiceConnection.mSyncAdapter.type.accountType);
+                    syncAdapter.startSync(mActiveServiceConnection,
+                            mActiveServiceConnection.mSyncAdapter.type.authority,
+                            account, new Bundle());
+                } catch (RemoteException e) {
+                    mStatusTextView.setText(
+                            getString(R.string.status_remote_exception_while_starting_sync));
+                }
+            }
+        }
+        updateUi();
+    }
+
+    public void cancelSync(View view) {
+        synchronized (mServiceConnectionLock) {
+            ISyncAdapter syncAdapter = null;
+            if (mActiveServiceConnection != null) {
+                syncAdapter = mActiveServiceConnection.mBoundSyncAdapter;
+            }
+
+            if (syncAdapter != null) {
+                try {
+                    mStatusTextView.setText(getString(R.string.status_canceled_sync));
+                    syncAdapter.cancelSync(mActiveServiceConnection);
+                } catch (RemoteException e) {
+                    mStatusTextView.setText(
+                            getString(R.string.status_remote_exception_while_canceling_sync));
+                }
+            }
+        }
+        updateUi();
+    }
+
+    public void onServiceChanged(SyncAdapterType type, boolean removed) {
+        getSyncAdapters();
+    }
+
+    @Override
+    protected Dialog onCreateDialog(final int id) {
+        if (id == DIALOG_ID_PICK_ACCOUNT) {
+            AlertDialog.Builder builder = new AlertDialog.Builder(this);
+            builder.setMessage(R.string.select_account_to_sync);
+            builder.setInverseBackgroundForced(true);
+            builder.setView(mAccountPickerView);
+            return builder.create();
+        }
+        return super.onCreateDialog(id);
+    }
+
+    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+        TextView item = (TextView) view;
+        final String accountName = item.getText().toString();
+        dismissDialog(DIALOG_ID_PICK_ACCOUNT);
+        startSync(accountName);
+    }
+
+    private class MyServiceConnection extends ISyncContext.Stub implements ServiceConnection {
+        private volatile ISyncAdapter mBoundSyncAdapter;
+        final RegisteredServicesCache.ServiceInfo<SyncAdapterType> mSyncAdapter;
+
+        public MyServiceConnection(
+                RegisteredServicesCache.ServiceInfo<SyncAdapterType> syncAdapter) {
+            mSyncAdapter = syncAdapter;
+        }
+
+        public void onServiceConnected(ComponentName name, IBinder service) {
+            mBoundSyncAdapter = ISyncAdapter.Stub.asInterface(service);
+            final SyncAdapterType type = mActiveServiceConnection.mSyncAdapter.type;
+            mBoundAdapterTextView.setText(getString(R.string.binding_connected_format,
+                    type.authority, type.accountType));
+            updateUi();
+        }
+
+        public void onServiceDisconnected(ComponentName name) {
+            mBoundAdapterTextView.setText(getString(R.string.binding_not_connected));
+            mBoundSyncAdapter = null;
+            updateUi();
+        }
+
+        public void sendHeartbeat() {
+            runOnUiThread(new Runnable() {
+                public void run() {
+                    uiThreadSendHeartbeat();
+                }
+            });
+        }
+
+        public void uiThreadSendHeartbeat() {
+            mStatusTextView.setText(getString(R.string.status_received_heartbeat));
+        }
+
+        public void uiThreadOnFinished(SyncResult result) {
+            if (result.hasError()) {
+                mStatusTextView.setText(
+                        getString(R.string.status_sync_failed_format, result.toString()));
+            } else {
+                mStatusTextView.setText(
+                        getString(R.string.status_sync_succeeded_format, result.toString()));
+            }
+        }
+
+        public void onFinished(final SyncResult result) throws RemoteException {
+            runOnUiThread(new Runnable() {
+                public void run() {
+                    uiThreadOnFinished(result);
+                }
+            });
+        }
+    }
+
+    final Object mServiceConnectionLock = new Object();
+    MyServiceConnection mActiveServiceConnection;
+
+    public void initiateBind(View view) {
+        synchronized (mServiceConnectionLock) {
+            if (mActiveServiceConnection != null) {
+                mStatusTextView.setText(getString(R.string.status_already_bound));
+                return;
+            }
+
+            RegisteredServicesCache.ServiceInfo<SyncAdapterType> syncAdapter =
+                    getSelectedSyncAdapter();
+            if (syncAdapter == null) {
+                mStatusTextView.setText(getString(R.string.status_sync_adapter_not_selected));
+                return;
+            }
+
+            mActiveServiceConnection = new MyServiceConnection(syncAdapter);
+
+            Intent intent = new Intent();
+            intent.setAction("android.content.SyncAdapter");
+            intent.setComponent(syncAdapter.componentName);
+            intent.putExtra(Intent.EXTRA_CLIENT_LABEL,
+                    com.android.internal.R.string.sync_binding_label);
+            intent.putExtra(Intent.EXTRA_CLIENT_INTENT, PendingIntent.getActivity(
+                    this, 0, new Intent(Settings.ACTION_SYNC_SETTINGS), 0));
+            if (!bindService(intent, mActiveServiceConnection, Context.BIND_AUTO_CREATE)) {
+                mBoundAdapterTextView.setText(getString(R.string.binding_bind_failed));
+                mActiveServiceConnection = null;
+                return;
+            }
+            mBoundAdapterTextView.setText(getString(R.string.binding_waiting_for_connection));
+        }
+        updateUi();
+    }
+
+    public void initiateUnbind(View view) {
+        synchronized (mServiceConnectionLock) {
+            if (mActiveServiceConnection == null) {
+                return;
+            }
+            mBoundAdapterTextView.setText("");
+            unbindService(mActiveServiceConnection);
+            mActiveServiceConnection = null;
+        }
+        updateUi();
+    }
+
+    private RegisteredServicesCache.ServiceInfo<SyncAdapterType> getSelectedSyncAdapter() {
+        synchronized (mSyncAdaptersLock) {
+            final int position = mSyncAdapterSpinner.getSelectedItemPosition();
+            if (position == AdapterView.INVALID_POSITION) {
+                return null;
+            }
+            try {
+                //noinspection unchecked
+                return (RegisteredServicesCache.ServiceInfo<SyncAdapterType>)
+                        mSyncAdapters[position];
+            } catch (Exception e) {
+                return null;
+            }
+        }
+    }
+
+    static class SyncAdaptersCache extends RegisteredServicesCache<SyncAdapterType> {
+        private static final String SERVICE_INTERFACE = "android.content.SyncAdapter";
+        private static final String SERVICE_META_DATA = "android.content.SyncAdapter";
+        private static final String ATTRIBUTES_NAME = "sync-adapter";
+
+        SyncAdaptersCache(Context context) {
+            super(context, SERVICE_INTERFACE, SERVICE_META_DATA, ATTRIBUTES_NAME, null);
+        }
+
+        public SyncAdapterType parseServiceAttributes(String packageName, AttributeSet attrs) {
+            TypedArray sa = mContext.getResources().obtainAttributes(attrs,
+                    com.android.internal.R.styleable.SyncAdapter);
+            try {
+                final String authority =
+                        sa.getString(com.android.internal.R.styleable.SyncAdapter_contentAuthority);
+                final String accountType =
+                        sa.getString(com.android.internal.R.styleable.SyncAdapter_accountType);
+                if (authority == null || accountType == null) {
+                    return null;
+                }
+                final boolean userVisible = sa.getBoolean(
+                        com.android.internal.R.styleable.SyncAdapter_userVisible, true);
+                final boolean supportsUploading = sa.getBoolean(
+                        com.android.internal.R.styleable.SyncAdapter_supportsUploading, true);
+                return new SyncAdapterType(authority, accountType, userVisible, supportsUploading);
+            } finally {
+                sa.recycle();
+            }
+        }
+    }
+}
diff --git a/apps/FontLab/src/com/android/fontlab/FontLab.java b/apps/FontLab/src/com/android/fontlab/FontLab.java
index 27f2d4c..611d34d 100644
--- a/apps/FontLab/src/com/android/fontlab/FontLab.java
+++ b/apps/FontLab/src/com/android/fontlab/FontLab.java
@@ -30,8 +30,7 @@
 import android.view.View;
 import android.widget.TextView;
 
-class FontLab extends Activity
-{
+public class FontLab extends Activity {
     private static final int MIN_SIZE = 1;
     private static final int MAX_SIZE = 60;
     
@@ -39,6 +38,10 @@
     private static final int MAX_SCALE_X = 20;
     private static final int MIN_SCALE_X = -19;   // -20 would make zero-scale
 
+    private static final int MAX_GAMMA = 40;
+    private static final int MIN_GAMMA = 1;
+    private static final float GAMMA_RANGE = 20;
+
     private static final String[] sText = {
         "Applications Contacts Maps Google Browser Text messages Address book"
         + " Development Earth Quake Settings Voicemail Zoolander. Four score"
@@ -107,13 +110,17 @@
         updateText();
         
         setDefaultKeyMode(Activity.DEFAULT_KEYS_SHORTCUT);
+
+        mColumn1.setPadding(5, 0, 5, 0);
+        mColumn2.setPadding(5, 0, 5, 0);
     }
     
     private void updateTitle() {
         Typeface tf = mColumn1.getTypeface();
-        String title = " ps=" + mFontSize + " scaleX="
+        String title = " PS=" + mFontSize + " X="
                     + (1 + mTextScaleXDelta/SCALE_X_RANGE)
-                    + " gamma=" + (mGamma/20.f)
+                    + " G=" + (mGamma/GAMMA_RANGE)
+                    + " S=" + ((mColumn1.getPaintFlags() & Paint.SUBPIXEL_TEXT_FLAG) != 0 ? 1 : 0)
                     + " " + sTypefaceName[mFontIndex]
                     + " " + sStyleName[tf.getStyle()]
                     ;
@@ -133,9 +140,9 @@
         "Regular", "Bold", "Italic", "Bold Italic"
     };
     private static final String sTypefaceName[] = {
-        "Droid Sans",
-        "Droid Serif",
-        "Droid Mono"
+        "Sans",
+        "Serif",
+        "Mono"
     };
     private static final Typeface sTypeface[] = {
         Typeface.SANS_SERIF,
@@ -198,6 +205,7 @@
             int mask = item.getItemId();
             mColumn1.setPaintFlags(mColumn1.getPaintFlags() ^ mask);
             mColumn2.setPaintFlags(mColumn2.getPaintFlags() ^ mask);
+            updateTitle();
             return true;
         }
     };
@@ -233,10 +241,11 @@
 
         addFontMenu(menu, FONT_INDEX_SANS);
         addFontMenu(menu, FONT_INDEX_SERIF);
-        addFontMenu(menu, FONT_INDEX_MONO);
+//        addFontMenu(menu, FONT_INDEX_MONO);
         addStyleMenu(menu, Typeface.BOLD, 'b');
         addStyleMenu(menu, Typeface.ITALIC, 'i');
-        addFlagMenu(menu, Paint.DEV_KERN_TEXT_FLAG, "DevKern", 'k');
+        addFlagMenu(menu, Paint.SUBPIXEL_TEXT_FLAG, "SubPixel", 's');
+        //        addFlagMenu(menu, Paint.DEV_KERN_TEXT_FLAG, "DevKern", 'k');
         menu.add(0, 0, 0, "Text").setOnMenuItemClickListener(mTextCallback).setAlphabeticShortcut('t');
         
         return true;
@@ -286,14 +295,14 @@
             case KeyEvent.KEYCODE_DPAD_LEFT:
                 scaleX -= 1;
                 break;
-                /*
             case KeyEvent.KEYCODE_U:
+            case KeyEvent.KEYCODE_VOLUME_UP:
                 changeGamma(1);
                 return true;
             case KeyEvent.KEYCODE_D:
+            case KeyEvent.KEYCODE_VOLUME_DOWN:
                 changeGamma(-1);
                 return true;
-                 */
             default:
                 return super.onKeyDown(keyCode, event);
         }
@@ -318,16 +327,18 @@
 
         return super.onKeyDown(keyCode, event);
     }
-    
-    private int mGamma = 28;    // current default is 1.4 (* 20)
+
+    // default to gamma of 1.0
+    private int mGamma = Math.round(1.0f * GAMMA_RANGE);
+
     private void changeGamma(int delta) {
-        int gamma = Math.min(100, Math.max(1, mGamma + delta));
+        int gamma = Math.min(MAX_GAMMA, Math.max(MIN_GAMMA, mGamma + delta));
         if (gamma != mGamma) {
             mGamma = gamma;
             updateTitle();
-//            Paint.setTextGamma(mGamma / 20.f);
+            float blackGamma = mGamma / GAMMA_RANGE;
+            Typeface.setGammaForText(blackGamma, 1 / blackGamma);
             mContentView.invalidate();
-            android.util.Log.d("skia", "setTextGamma " + mGamma);
         }
     }
     
diff --git a/apps/GestureBuilder/res/drawable-hdpi/ic_gesturebuilder.png b/apps/GestureBuilder/res/drawable-hdpi/ic_gesturebuilder.png
new file mode 100755
index 0000000..595b9e1
--- /dev/null
+++ b/apps/GestureBuilder/res/drawable-hdpi/ic_gesturebuilder.png
Binary files differ
diff --git a/apps/GestureBuilder/res/drawable/ic_gesturebuilder.png b/apps/GestureBuilder/res/drawable-mdpi/ic_gesturebuilder.png
similarity index 100%
rename from apps/GestureBuilder/res/drawable/ic_gesturebuilder.png
rename to apps/GestureBuilder/res/drawable-mdpi/ic_gesturebuilder.png
Binary files differ
diff --git a/apps/NinePatchLab/Android.mk b/apps/NinePatchLab/Android.mk
new file mode 100644
index 0000000..c49a095
--- /dev/null
+++ b/apps/NinePatchLab/Android.mk
@@ -0,0 +1,10 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_PACKAGE_NAME := NinePatchLab
+
+include $(BUILD_PACKAGE)
diff --git a/apps/NinePatchLab/AndroidManifest.xml b/apps/NinePatchLab/AndroidManifest.xml
new file mode 100644
index 0000000..8726511
--- /dev/null
+++ b/apps/NinePatchLab/AndroidManifest.xml
@@ -0,0 +1,11 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.ninepatchlab">
+    <application android:label="9-patch-lab">
+		<activity android:name="NinePatchLab">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+		</activity>
+    </application>
+</manifest>
diff --git a/ndk/build/platforms/android-3/common/include/cstddef b/apps/NinePatchLab/MODULE_LICENSE_APACHE2
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/cstddef
copy to apps/NinePatchLab/MODULE_LICENSE_APACHE2
diff --git a/apps/NinePatchLab/NOTICE b/apps/NinePatchLab/NOTICE
new file mode 100644
index 0000000..c5b1efa
--- /dev/null
+++ b/apps/NinePatchLab/NOTICE
@@ -0,0 +1,190 @@
+
+   Copyright (c) 2005-2008, The Android Open Source Project
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
diff --git a/apps/NinePatchLab/res/drawable/bg_grad_blue.9.png b/apps/NinePatchLab/res/drawable/bg_grad_blue.9.png
new file mode 100644
index 0000000..5572ae3
--- /dev/null
+++ b/apps/NinePatchLab/res/drawable/bg_grad_blue.9.png
Binary files differ
diff --git a/apps/NinePatchLab/res/drawable/bg_grad_green.9.png b/apps/NinePatchLab/res/drawable/bg_grad_green.9.png
new file mode 100644
index 0000000..7710673
--- /dev/null
+++ b/apps/NinePatchLab/res/drawable/bg_grad_green.9.png
Binary files differ
diff --git a/apps/NinePatchLab/res/drawable/bg_grad_grey.9.png b/apps/NinePatchLab/res/drawable/bg_grad_grey.9.png
new file mode 100644
index 0000000..95abd89
--- /dev/null
+++ b/apps/NinePatchLab/res/drawable/bg_grad_grey.9.png
Binary files differ
diff --git a/apps/NinePatchLab/res/drawable/bg_grad_red.9.png b/apps/NinePatchLab/res/drawable/bg_grad_red.9.png
new file mode 100644
index 0000000..f6caa7e
--- /dev/null
+++ b/apps/NinePatchLab/res/drawable/bg_grad_red.9.png
Binary files differ
diff --git a/apps/NinePatchLab/res/drawable/bg_grad_yellow.9.png b/apps/NinePatchLab/res/drawable/bg_grad_yellow.9.png
new file mode 100644
index 0000000..d6d78d2
--- /dev/null
+++ b/apps/NinePatchLab/res/drawable/bg_grad_yellow.9.png
Binary files differ
diff --git a/apps/NinePatchLab/res/drawable/btn_dark_ticks_stretch_multiple.9.png b/apps/NinePatchLab/res/drawable/btn_dark_ticks_stretch_multiple.9.png
new file mode 100644
index 0000000..8ca03ee
--- /dev/null
+++ b/apps/NinePatchLab/res/drawable/btn_dark_ticks_stretch_multiple.9.png
Binary files differ
diff --git a/apps/NinePatchLab/res/drawable/btn_dark_ticks_stretch_single.9.png b/apps/NinePatchLab/res/drawable/btn_dark_ticks_stretch_single.9.png
new file mode 100644
index 0000000..1b47fbd
--- /dev/null
+++ b/apps/NinePatchLab/res/drawable/btn_dark_ticks_stretch_single.9.png
Binary files differ
diff --git a/apps/NinePatchLab/res/drawable/btn_light_ticks_stretch_multiple.9.png b/apps/NinePatchLab/res/drawable/btn_light_ticks_stretch_multiple.9.png
new file mode 100644
index 0000000..725c74e
--- /dev/null
+++ b/apps/NinePatchLab/res/drawable/btn_light_ticks_stretch_multiple.9.png
Binary files differ
diff --git a/apps/NinePatchLab/res/drawable/btn_light_ticks_stretch_single.9.png b/apps/NinePatchLab/res/drawable/btn_light_ticks_stretch_single.9.png
new file mode 100644
index 0000000..996bf1c
--- /dev/null
+++ b/apps/NinePatchLab/res/drawable/btn_light_ticks_stretch_single.9.png
Binary files differ
diff --git a/apps/NinePatchLab/res/drawable/btn_transparent_ticks_stretch_multiple.9.png b/apps/NinePatchLab/res/drawable/btn_transparent_ticks_stretch_multiple.9.png
new file mode 100644
index 0000000..327290f
--- /dev/null
+++ b/apps/NinePatchLab/res/drawable/btn_transparent_ticks_stretch_multiple.9.png
Binary files differ
diff --git a/apps/NinePatchLab/res/drawable/btn_transparent_ticks_stretch_single.9.png b/apps/NinePatchLab/res/drawable/btn_transparent_ticks_stretch_single.9.png
new file mode 100644
index 0000000..8d919c4
--- /dev/null
+++ b/apps/NinePatchLab/res/drawable/btn_transparent_ticks_stretch_single.9.png
Binary files differ
diff --git a/apps/NinePatchLab/src/com/android/ninepatch/NinePatchLab.java b/apps/NinePatchLab/src/com/android/ninepatch/NinePatchLab.java
new file mode 100644
index 0000000..bcb61a7
--- /dev/null
+++ b/apps/NinePatchLab/src/com/android/ninepatch/NinePatchLab.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ninepatchlab;
+
+import com.android.ninepatchlab.R;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.*;
+import android.graphics.drawable.*;
+import android.os.Bundle;
+import android.os.SystemClock;
+import android.view.KeyEvent;
+import android.view.*;
+
+public class NinePatchLab extends Activity {
+    public NinePatchLab() {}
+
+    Drawable[]  mButtons;
+    Drawable[]  mBGs;
+    float       mScale;
+    
+    boolean     mShowFPS = true;
+    boolean     mDoDither = true;
+    boolean     mDoFilter = true;
+    int         mCurrBGIndex;
+
+    private static final int FPS_COUNTER_LIMIT = 30;
+    private int mFPSTime;
+    private int mFPSCounter;
+    private int mFPSAve;
+    
+    private View mView;
+    
+    private void updateTitle() {
+        String title = "D=" + mDoDither + " F=" + mDoFilter;
+        if (mShowFPS) {
+            title += " FPS=" + mFPSAve;
+        }
+        setTitle(title);
+    }
+
+    private static Drawable make_custom_bg() {
+        int[] colors = new int[] {
+            //            0xFFFF0000, 0xFFFF00FF, 0xFF0000FF, 0xFF00FFFF, 0xFF00FF00,  0xFFFFFF00, 0xFFFF0000
+            0xFFFF0000, 0xFF0000FF
+        };
+        return new GradientDrawable(GradientDrawable.Orientation.TR_BL,
+                                    colors);
+    }
+    
+    private static Drawable make_solid_bg() {
+        return new ColorDrawable(0xFF008800);
+    }
+    
+    private class NPView extends View {
+
+        public NPView(Context context) {
+            super(context);
+            setFocusable(true);
+
+            int[] bgs = new int[] {
+                R.drawable.bg_grad_blue,
+                R.drawable.bg_grad_green,
+                R.drawable.bg_grad_grey,
+                R.drawable.bg_grad_red,
+                R.drawable.bg_grad_yellow,
+            };
+            int[] ids = new int[] {
+                R.drawable.btn_dark_ticks_stretch_multiple,
+                R.drawable.btn_dark_ticks_stretch_single,
+                R.drawable.btn_transparent_ticks_stretch_multiple,
+                R.drawable.btn_transparent_ticks_stretch_single,
+                R.drawable.btn_light_ticks_stretch_multiple,
+                R.drawable.btn_light_ticks_stretch_single,
+            };
+            
+            mButtons = new Drawable[ids.length];
+            mBGs = new Drawable[bgs.length + 2];
+            
+            Resources res = context.getResources();
+
+            for (int i = 0; i < ids.length; i++) {
+                mButtons[i] = res.getDrawable(ids[i]);
+            }
+            for (int i = 0; i < bgs.length; i++) {
+                mBGs[i] = res.getDrawable(bgs[i]);
+            }
+            mBGs[bgs.length] = make_custom_bg();
+            mBGs[bgs.length+1] = make_solid_bg();
+            
+            mScale = res.getDisplayMetrics().density;
+        }
+
+        private static final int MARGIN_X = 16;
+        private static final int MARGIN_Y = 8;
+
+        private void setDrawableFlags(Drawable dr) {
+            dr.setDither(mDoDither);
+            dr.setFilterBitmap(mDoFilter);
+        }
+
+        protected void onDraw(Canvas canvas) {
+            long now = 0;
+            if (mShowFPS) {
+                now = SystemClock.uptimeMillis();
+            }
+
+            Drawable bg = mBGs[mCurrBGIndex];
+            bg.setBounds(0, 0, getWidth(), getHeight());
+            setDrawableFlags(bg);
+            bg.draw(canvas);
+
+            final int WIDTH = getWidth() - 2*MARGIN_X;
+            final int HEIGHT = getHeight() - 2*MARGIN_Y;
+            final int N = mButtons.length;
+            final int gapSize = Math.round(mScale * 8);
+            final int drHeight = (HEIGHT - (N - 1) * gapSize) / N;
+            final int drWidth = WIDTH;
+            
+//            canvas.drawColor(0xFF5F810C);
+            canvas.translate(MARGIN_X, MARGIN_Y);
+
+            for (Drawable dr : mButtons) {
+                dr.setBounds(0, 0, drWidth, drHeight);
+                setDrawableFlags(dr);
+                dr.draw(canvas);
+                canvas.translate(0, drHeight + gapSize);
+            }
+
+            if (mShowFPS) {
+                mFPSTime += (int)(SystemClock.uptimeMillis() - now);
+                mFPSCounter += 1;
+                if (mFPSCounter > FPS_COUNTER_LIMIT) {
+                    mFPSAve = mFPSCounter * 1000 / mFPSTime;
+                    updateTitle();
+                    mFPSTime = 0;
+                    mFPSCounter = 0;
+                }
+                invalidate();
+            }
+        }
+    }
+
+    private void toggleFPS() {
+        mShowFPS = !mShowFPS;
+        if (mShowFPS) {
+            mFPSCounter = 0;
+            mFPSTime = 0;
+            mView.invalidate();
+        }
+    }
+
+    @Override public boolean onKeyDown(int keyCode, KeyEvent event) {
+        switch (keyCode) {
+            case KeyEvent.KEYCODE_DPAD_DOWN:
+                mDoFilter = !mDoFilter;
+                updateTitle();
+                mView.invalidate();
+                return true;
+            case KeyEvent.KEYCODE_DPAD_UP:
+                mDoDither = !mDoDither;
+                updateTitle();
+                mView.invalidate();
+                return true;
+            case KeyEvent.KEYCODE_DPAD_RIGHT:
+                mCurrBGIndex = (mCurrBGIndex + 1) % mBGs.length;
+                mView.invalidate();
+                return true;
+            case KeyEvent.KEYCODE_DPAD_LEFT:
+                mCurrBGIndex -= 1;
+                if (mCurrBGIndex < 0) {
+                    mCurrBGIndex = 0;
+                }
+                mView.invalidate();
+                return true;
+            case KeyEvent.KEYCODE_VOLUME_UP:
+                toggleFPS();
+                return true;
+            case KeyEvent.KEYCODE_U:
+            case KeyEvent.KEYCODE_D:
+            case KeyEvent.KEYCODE_VOLUME_DOWN:
+                return super.onKeyDown(keyCode, event);
+        }
+        return super.onKeyDown(keyCode, event);
+    }
+
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        mView = new NPView(this);
+        setContentView(mView);
+    }
+        
+}
+
diff --git a/apps/SpareParts/res/drawable-hdpi/app_icon.png b/apps/SpareParts/res/drawable-hdpi/app_icon.png
new file mode 100755
index 0000000..60fbdf5
--- /dev/null
+++ b/apps/SpareParts/res/drawable-hdpi/app_icon.png
Binary files differ
diff --git a/apps/SpareParts/res/drawable/app_icon.png b/apps/SpareParts/res/drawable-mdpi/app_icon.png
similarity index 100%
rename from apps/SpareParts/res/drawable/app_icon.png
rename to apps/SpareParts/res/drawable-mdpi/app_icon.png
Binary files differ
diff --git a/apps/Term/Android.mk b/apps/Term/Android.mk
index 843aec5..9ff6c0d 100644
--- a/apps/Term/Android.mk
+++ b/apps/Term/Android.mk
@@ -1,3 +1,26 @@
+#
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This makefile shows how to build a shared library and an activity that
+# bundles the shared library and calls it using JNI.
+
+TOP_LOCAL_PATH:= $(call my-dir)
+
+# Build activity
+
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
 
@@ -7,4 +30,11 @@
 
 LOCAL_PACKAGE_NAME := Term
 
+LOCAL_JNI_SHARED_LIBRARIES := libterm
+
 include $(BUILD_PACKAGE)
+
+# ============================================================
+
+# Also build all of the sub-targets under this one: the shared library.
+include $(call all-makefiles-under,$(LOCAL_PATH))
\ No newline at end of file
diff --git a/apps/Term/jni/Android.mk b/apps/Term/jni/Android.mk
new file mode 100644
index 0000000..2fe4a75
--- /dev/null
+++ b/apps/Term/jni/Android.mk
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This makefile supplies the rules for building a library of JNI code for
+# use by our example of how to bundle a shared library with an APK.
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := eng
+
+# This is the target being built.
+LOCAL_MODULE:= libterm
+
+
+# All of the source files that we will compile.
+LOCAL_SRC_FILES:= \
+  termExec.cpp
+
+# All of the shared libraries we link against.
+LOCAL_SHARED_LIBRARIES := \
+	libutils
+
+# No static libraries.
+LOCAL_STATIC_LIBRARIES :=
+
+# Also need the JNI headers.
+LOCAL_C_INCLUDES += \
+	$(JNI_H_INCLUDE)
+
+# No special compiler flags.
+LOCAL_CFLAGS +=
+
+# Don't prelink this library.  For more efficient code, you may want
+# to add this library to the prelink map and set this to true. However,
+# it's difficult to do this for applications that are not supplied as
+# part of a system image.
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/apps/Term/jni/termExec.cpp b/apps/Term/jni/termExec.cpp
new file mode 100644
index 0000000..d0666cc
--- /dev/null
+++ b/apps/Term/jni/termExec.cpp
@@ -0,0 +1,347 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "Exec"
+
+#include "jni.h"
+#include "utils/Log.h"
+#include "utils/misc.h"
+#include "android_runtime/AndroidRuntime.h"
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/wait.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <termios.h>
+
+static jclass class_fileDescriptor;
+static jfieldID field_fileDescriptor_descriptor;
+static jmethodID method_fileDescriptor_init;
+
+
+class String8 {
+public:
+    String8() {
+        mString = 0;
+    }
+    
+    ~String8() {
+        if (mString) {
+            free(mString);
+        }
+    }
+
+    void set(const char16_t* o, size_t numChars) {
+        mString = (char*) malloc(numChars + 1);
+        for (size_t i = 0; i < numChars; i++) {
+            mString[i] = (char) o[i];
+        }
+        mString[numChars] = '\0';
+    }
+    
+    const char* string() {
+        return mString;
+    }
+private:
+    char* mString;
+};
+
+static int create_subprocess(const char *cmd, const char *arg0, const char *arg1,
+    int* pProcessId)
+{
+    char *devname;
+    int ptm;
+    pid_t pid;
+
+    ptm = open("/dev/ptmx", O_RDWR); // | O_NOCTTY);
+    if(ptm < 0){
+        LOGE("[ cannot open /dev/ptmx - %s ]\n",strerror(errno));
+        return -1;
+    }
+    fcntl(ptm, F_SETFD, FD_CLOEXEC);
+
+    if(grantpt(ptm) || unlockpt(ptm) ||
+       ((devname = (char*) ptsname(ptm)) == 0)){
+        LOGE("[ trouble with /dev/ptmx - %s ]\n", strerror(errno));
+        return -1;
+    }
+    
+    pid = fork();
+    if(pid < 0) {
+        LOGE("- fork failed: %s -\n", strerror(errno));
+        return -1;
+    }
+
+    if(pid == 0){
+        close(ptm);
+
+        int pts;
+
+        setsid();
+        
+        pts = open(devname, O_RDWR);
+        if(pts < 0) exit(-1);
+
+        dup2(pts, 0);
+        dup2(pts, 1);
+        dup2(pts, 2);
+
+        execl(cmd, cmd, arg0, arg1, NULL);
+        exit(-1);
+    } else {
+        *pProcessId = (int) pid;
+        return ptm;
+    }
+}
+
+
+static jobject android_os_Exec_createSubProcess(JNIEnv *env, jobject clazz,
+    jstring cmd, jstring arg0, jstring arg1, jintArray processIdArray)
+{
+    const jchar* str = cmd ? env->GetStringCritical(cmd, 0) : 0;
+    String8 cmd_8;
+    if (str) {
+        cmd_8.set(str, env->GetStringLength(cmd));
+        env->ReleaseStringCritical(cmd, str);
+    }
+
+    str = arg0 ? env->GetStringCritical(arg0, 0) : 0;
+    const char* arg0Str = 0;
+    String8 arg0_8;
+    if (str) {
+        arg0_8.set(str, env->GetStringLength(arg0));
+        env->ReleaseStringCritical(arg0, str);
+        arg0Str = arg0_8.string();
+    }
+
+    str = arg1 ? env->GetStringCritical(arg1, 0) : 0;
+    const char* arg1Str = 0;
+    String8 arg1_8;
+    if (str) {
+        arg1_8.set(str, env->GetStringLength(arg1));
+        env->ReleaseStringCritical(arg1, str);
+        arg1Str = arg1_8.string();
+    }
+
+    int procId;
+    int ptm = create_subprocess(cmd_8.string(), arg0Str, arg1Str, &procId);
+    
+    if (processIdArray) {
+        int procIdLen = env->GetArrayLength(processIdArray);
+        if (procIdLen > 0) {
+            jboolean isCopy;
+    
+            int* pProcId = (int*) env->GetPrimitiveArrayCritical(processIdArray, &isCopy);
+            if (pProcId) {
+                *pProcId = procId;
+                env->ReleasePrimitiveArrayCritical(processIdArray, pProcId, 0);
+            }
+        }
+    }
+    
+    jobject result = env->NewObject(class_fileDescriptor, method_fileDescriptor_init);
+    
+    if (!result) {
+        LOGE("Couldn't create a FileDescriptor.");
+    }
+    else {
+        env->SetIntField(result, field_fileDescriptor_descriptor, ptm);
+    }
+    
+    return result;
+}
+
+
+static void android_os_Exec_setPtyWindowSize(JNIEnv *env, jobject clazz,
+    jobject fileDescriptor, jint row, jint col, jint xpixel, jint ypixel)
+{
+    int fd;
+    struct winsize sz;
+
+    fd = env->GetIntField(fileDescriptor, field_fileDescriptor_descriptor);
+
+    if (env->ExceptionOccurred() != NULL) {
+        return;
+    }
+    
+    sz.ws_row = row;
+    sz.ws_col = col;
+    sz.ws_xpixel = xpixel;
+    sz.ws_ypixel = ypixel;
+    
+    ioctl(fd, TIOCSWINSZ, &sz);
+}
+
+static int android_os_Exec_waitFor(JNIEnv *env, jobject clazz,
+    jint procId) {
+    int status;
+    waitpid(procId, &status, 0);
+    int result = 0;
+    if (WIFEXITED(status)) {
+        result = WEXITSTATUS(status);
+    }
+    return result;
+}
+
+static void android_os_Exec_close(JNIEnv *env, jobject clazz, jobject fileDescriptor)
+{
+    int fd;
+    struct winsize sz;
+
+    fd = env->GetIntField(fileDescriptor, field_fileDescriptor_descriptor);
+
+    if (env->ExceptionOccurred() != NULL) {
+        return;
+    }
+    
+    close(fd);
+}
+
+
+static int register_FileDescriptor(JNIEnv *env)
+{
+    class_fileDescriptor = env->FindClass("java/io/FileDescriptor");
+
+    if (class_fileDescriptor == NULL) {
+        LOGE("Can't find java/io/FileDescriptor");
+        return -1;
+    }
+
+    field_fileDescriptor_descriptor = env->GetFieldID(class_fileDescriptor, "descriptor", "I");
+
+    if (field_fileDescriptor_descriptor == NULL) {
+        LOGE("Can't find FileDescriptor.descriptor");
+        return -1;
+    }
+
+    method_fileDescriptor_init = env->GetMethodID(class_fileDescriptor, "<init>", "()V");
+    if (method_fileDescriptor_init == NULL) {
+        LOGE("Can't find FileDescriptor.init");
+        return -1;
+     }
+     return 0;
+}
+
+
+static const char *classPathName = "com/android/term/Exec";
+
+static JNINativeMethod method_table[] = {
+    { "createSubprocess", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[I)Ljava/io/FileDescriptor;",
+        (void*) android_os_Exec_createSubProcess },
+    { "setPtyWindowSize", "(Ljava/io/FileDescriptor;IIII)V",
+        (void*) android_os_Exec_setPtyWindowSize},
+    { "waitFor", "(I)I",
+        (void*) android_os_Exec_waitFor},
+    { "close", "(Ljava/io/FileDescriptor;)V",
+        (void*) android_os_Exec_close}
+};
+
+/*
+ * Register several native methods for one class.
+ */
+static int registerNativeMethods(JNIEnv* env, const char* className,
+    JNINativeMethod* gMethods, int numMethods)
+{
+    jclass clazz;
+
+    clazz = env->FindClass(className);
+    if (clazz == NULL) {
+        LOGE("Native registration unable to find class '%s'", className);
+        return JNI_FALSE;
+    }
+    if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) {
+        LOGE("RegisterNatives failed for '%s'", className);
+        return JNI_FALSE;
+    }
+
+    return JNI_TRUE;
+}
+
+/*
+ * Register native methods for all classes we know about.
+ *
+ * returns JNI_TRUE on success.
+ */
+static int registerNatives(JNIEnv* env)
+{
+  if (!registerNativeMethods(env, classPathName, method_table, 
+                 sizeof(method_table) / sizeof(method_table[0]))) {
+    return JNI_FALSE;
+  }
+
+  return JNI_TRUE;
+}
+
+
+// ----------------------------------------------------------------------------
+
+/*
+ * This is called by the VM when the shared library is first loaded.
+ */
+ 
+typedef union {
+    JNIEnv* env;
+    void* venv;
+} UnionJNIEnvToVoid;
+
+jint JNI_OnLoad(JavaVM* vm, void* reserved) {
+    UnionJNIEnvToVoid uenv;
+    uenv.venv = NULL;
+    jint result = -1;
+    JNIEnv* env = NULL;
+    
+    LOGI("JNI_OnLoad");
+
+    if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) {
+        LOGE("ERROR: GetEnv failed");
+        goto bail;
+    }
+    env = uenv.env;
+    
+    if ((result = register_FileDescriptor(env)) < 0) {
+        LOGE("ERROR: registerFileDescriptor failed");
+        goto bail;
+    }
+
+    if (registerNatives(env) != JNI_TRUE) {
+        LOGE("ERROR: registerNatives failed");
+        goto bail;
+    }
+    
+    result = JNI_VERSION_1_4;
+    
+bail:
+    return result;
+}
diff --git a/apps/Term/res/drawable-hdpi/app_terminal.png b/apps/Term/res/drawable-hdpi/app_terminal.png
new file mode 100755
index 0000000..278b2a5
--- /dev/null
+++ b/apps/Term/res/drawable-hdpi/app_terminal.png
Binary files differ
diff --git a/apps/Term/res/drawable-hdpi/atari_small.png b/apps/Term/res/drawable-hdpi/atari_small.png
new file mode 100755
index 0000000..8bdd624
--- /dev/null
+++ b/apps/Term/res/drawable-hdpi/atari_small.png
Binary files differ
diff --git a/apps/Term/res/drawable/app_terminal.png b/apps/Term/res/drawable-mdpi/app_terminal.png
similarity index 100%
rename from apps/Term/res/drawable/app_terminal.png
rename to apps/Term/res/drawable-mdpi/app_terminal.png
Binary files differ
diff --git a/apps/Term/res/drawable/atari_small.png b/apps/Term/res/drawable-mdpi/atari_small.png
similarity index 100%
rename from apps/Term/res/drawable/atari_small.png
rename to apps/Term/res/drawable-mdpi/atari_small.png
Binary files differ
diff --git a/apps/Term/src/com/android/term/Exec.java b/apps/Term/src/com/android/term/Exec.java
new file mode 100644
index 0000000..b53acfc
--- /dev/null
+++ b/apps/Term/src/com/android/term/Exec.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.term;
+
+import java.io.FileDescriptor;
+
+/**
+ * Utility methods for creating and managing a subprocess.
+ * <p>
+ * Note: The native methods access a package-private
+ * java.io.FileDescriptor field to get and set the raw Linux
+ * file descriptor. This might break if the implementation of
+ * java.io.FileDescriptor is changed.
+ */
+
+public class Exec
+{
+    static {
+        System.loadLibrary("term");
+    }
+
+    /**
+     * Create a subprocess. Differs from java.lang.ProcessBuilder in
+     * that a pty is used to communicate with the subprocess.
+     * <p>
+     * Callers are responsible for calling Exec.close() on the returned
+     * file descriptor.
+     *
+     * @param cmd The command to execute
+     * @param arg0 The first argument to the command, may be null
+     * @param arg1 the second argument to the command, may be null
+     * @param processId A one-element array to which the process ID of the
+     * started process will be written.
+     * @return the file descriptor of the started process.
+     *
+     */
+    public static native FileDescriptor createSubprocess(
+        String cmd, String arg0, String arg1, int[] processId);
+        
+    /**
+     * Set the widow size for a given pty. Allows programs
+     * connected to the pty learn how large their screen is.
+     */
+    public static native void setPtyWindowSize(FileDescriptor fd,
+       int row, int col, int xpixel, int ypixel);
+
+    /**
+     * Causes the calling thread to wait for the process associated with the
+     * receiver to finish executing.
+     *
+     * @return The exit value of the Process being waited on
+     *
+     */
+    public static native int waitFor(int processId);
+
+    /**
+     * Close a given file descriptor.
+     */
+    public static native void close(FileDescriptor fd);
+}
+
diff --git a/apps/Term/src/com/android/term/Term.java b/apps/Term/src/com/android/term/Term.java
index 34cd7e1..6041baf 100644
--- a/apps/Term/src/com/android/term/Term.java
+++ b/apps/Term/src/com/android/term/Term.java
@@ -16,6 +16,12 @@
 
 package com.android.term;
 
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+
 import android.app.Activity;
 import android.app.AlertDialog;
 import android.content.Context;
@@ -35,7 +41,6 @@
 import android.graphics.Typeface;
 import android.net.Uri;
 import android.os.Bundle;
-import android.os.Exec;
 import android.os.Handler;
 import android.os.Message;
 import android.preference.PreferenceManager;
@@ -54,12 +59,6 @@
 import android.view.inputmethod.ExtractedTextRequest;
 import android.view.inputmethod.InputConnection;
 
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-
 /**
  * A terminal emulator activity.
  */
@@ -96,10 +95,7 @@
 
     /**
      * The pseudo-teletype (pty) file descriptor that we use to communicate with
-     * another process, typically a shell. Currently we just use this to get the
-     * mTermIn / mTermOut file descriptors, but when we implement resizing of
-     * the terminal we will need it to issue the ioctl to inform the other
-     * process that we've changed the terminal size.
+     * another process, typically a shell.
      */
     private FileDescriptor mTermFd;
 
@@ -188,6 +184,15 @@
         updatePrefs();
     }
 
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+        if (mTermFd != null) {
+            Exec.close(mTermFd);
+            mTermFd = null;
+        }
+    }
+
     private void startListening() {
         int[] processId = new int[1];
 
diff --git a/build/Android.mk b/build/Android.mk
index cba96c6..d804ce7 100644
--- a/build/Android.mk
+++ b/build/Android.mk
@@ -4,7 +4,7 @@
 # anywhere else, and the rules don't support.  Aditionally, the depenencies on
 # these files don't really matter, because they are all generated as part of
 # building the docs.  So for the dependency, we just use the
-# offline-sdk-timestamp file, which is the $@ of the droiddoc rule.
+# api-stubs-timestamp file, which is the $@ of the droiddoc rule.
 # We also need to depend on framework-res.apk, in order to pull the
 # resource files out of there for aapt.
 #
@@ -22,7 +22,7 @@
 $(full_target): PRIVATE_CLASS_INTERMEDIATES_DIR := $(classes_dir)
 $(full_target): PRIVATE_FRAMEWORK_RES_PACKAGE := $(framework_res_package)
 
-$(full_target): $(OUT_DOCS)/offline-sdk-timestamp $(framework_res_package)
+$(full_target): $(OUT_DOCS)/api-stubs-timestamp $(framework_res_package)
 	@echo Compiling SDK Stubs: $@
 	$(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR)
 	$(hide) mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR)
diff --git a/build/sdk-darwin-x86.atree b/build/sdk-darwin-x86.atree
index 19be137..120fff0 100644
--- a/build/sdk-darwin-x86.atree
+++ b/build/sdk-darwin-x86.atree
@@ -3,6 +3,7 @@
 
 # swt
 prebuilt/darwin-x86/swt/swt.jar tools/lib/x86/swt.jar
+prebuilt/darwin-x86_64/swt/swt.jar tools/lib/x86_64/swt.jar
 
 
 # JetCreator (only available on mac/windows)
diff --git a/build/sdk.atree b/build/sdk.atree
index 16d65de..85952ea 100644
--- a/build/sdk.atree
+++ b/build/sdk.atree
@@ -51,15 +51,17 @@
 # sdk scripts
 development/tools/scripts/AndroidManifest.template platforms/${PLATFORM_NAME}/templates/AndroidManifest.template
 development/tools/scripts/AndroidManifest.tests.template platforms/${PLATFORM_NAME}/templates/AndroidManifest.tests.template
-development/tools/scripts/iml.template platforms/${PLATFORM_NAME}/templates/iml.template
-development/tools/scripts/ipr.template platforms/${PLATFORM_NAME}/templates/ipr.template
-development/tools/scripts/iws.template platforms/${PLATFORM_NAME}/templates/iws.template
 development/tools/scripts/java_file.template platforms/${PLATFORM_NAME}/templates/java_file.template
 development/tools/scripts/java_tests_file.template platforms/${PLATFORM_NAME}/templates/java_tests_file.template
 development/tools/scripts/layout.template platforms/${PLATFORM_NAME}/templates/layout.template
 development/tools/scripts/strings.template platforms/${PLATFORM_NAME}/templates/strings.template
 development/tools/scripts/android_rules.xml platforms/${PLATFORM_NAME}/templates/android_rules.xml
+development/tools/scripts/android_test_rules.xml platforms/${PLATFORM_NAME}/templates/android_test_rules.xml
+development/tools/scripts/icon_ldpi.png platforms/${PLATFORM_NAME}/templates/icon_ldpi.png
+development/tools/scripts/icon_mdpi.png platforms/${PLATFORM_NAME}/templates/icon_mdpi.png
+development/tools/scripts/icon_hdpi.png platforms/${PLATFORM_NAME}/templates/icon_hdpi.png
 development/tools/scripts/build.template tools/lib/build.template
+development/tools/scripts/devices.xml tools/lib/devices.xml
 
 # emacs support
 development/tools/scripts/android.el tools/lib/android.el
@@ -121,10 +123,21 @@
 framework/draw9patch.jar tools/lib/draw9patch.jar
 framework/swing-worker-1.1.jar tools/lib/swing-worker-1.1.jar
 
+# layoutopt
+bin/layoutopt tools/layoutopt
+framework/layoutopt.jar tools/lib/layoutopt.jar
+framework/uix.jar tools/lib/uix.jar
+framework/groovy-all-1.6.5.jar tools/lib/groovy-all-1.6.5.jar
+
 # traceview
 bin/traceview tools/traceview
 framework/traceview.jar tools/lib/traceview.jar
 
+# emma lib for code coverage support
+framework/emmalib.jar tools/lib/emma_device.jar
+external/emma/lib/emma.jar tools/lib/emma.jar
+external/emma/lib/emma_ant.jar tools/lib/emma_ant.jar
+
 # custom ant tasks
 framework/anttasks.jar tools/lib/anttasks.jar
 
@@ -144,10 +157,12 @@
 external/qemu/android/avd/hardware-properties.ini tools/lib/hardware-properties.ini
 
 # emulator skins
-development/emulator/skins/HVGA     platforms/${PLATFORM_NAME}/skins/HVGA
-development/emulator/skins/QVGA     platforms/${PLATFORM_NAME}/skins/QVGA
-development/emulator/skins/WVGA800  platforms/${PLATFORM_NAME}/skins/WVGA800
-development/emulator/skins/WVGA854  platforms/${PLATFORM_NAME}/skins/WVGA854
+development/emulator/skins/QVGA      platforms/${PLATFORM_NAME}/skins/QVGA
+development/emulator/skins/WQVGA432  platforms/${PLATFORM_NAME}/skins/WQVGA432
+development/emulator/skins/WQVGA400  platforms/${PLATFORM_NAME}/skins/WQVGA400
+development/emulator/skins/HVGA      platforms/${PLATFORM_NAME}/skins/HVGA
+development/emulator/skins/WVGA800   platforms/${PLATFORM_NAME}/skins/WVGA800
+development/emulator/skins/WVGA854   platforms/${PLATFORM_NAME}/skins/WVGA854
 
 # NOTICE files are copied by build/core/Makefile
 development/tools/scripts/sdk_files_NOTICE.txt platforms/${PLATFORM_NAME}/templates/NOTICE.txt
@@ -171,16 +186,21 @@
 docs/categories.txt platforms/${PLATFORM_NAME}/data/categories.txt
 docs/widgets.txt platforms/${PLATFORM_NAME}/data/widgets.txt
 framework/layoutlib.jar platforms/${PLATFORM_NAME}/data/layoutlib.jar
+
+# framework resources for layoutlib
 frameworks/base/core/res/res platforms/${PLATFORM_NAME}/data/res
-frameworks/base/data/fonts/fonts.xml platforms/${PLATFORM_NAME}/data/fonts/fonts.xml
-frameworks/base/data/fonts/DroidSans.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSans.ttf
-frameworks/base/data/fonts/DroidSans-Bold.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSans-Bold.ttf
-frameworks/base/data/fonts/DroidSansFallback.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSansFallback.ttf
-frameworks/base/data/fonts/DroidSansMono.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSansMono.ttf
-frameworks/base/data/fonts/DroidSerif-Bold.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSerif-Bold.ttf
+
+# fonts for layoutlib.
+frameworks/base/data/fonts/fonts.xml                 platforms/${PLATFORM_NAME}/data/fonts/fonts.xml
+frameworks/base/data/fonts/DroidSans.ttf             platforms/${PLATFORM_NAME}/data/fonts/DroidSans.ttf
+frameworks/base/data/fonts/DroidSans-Bold.ttf        platforms/${PLATFORM_NAME}/data/fonts/DroidSans-Bold.ttf
+frameworks/base/data/fonts/DroidSansMono.ttf         platforms/${PLATFORM_NAME}/data/fonts/DroidSansMono.ttf
+frameworks/base/data/fonts/DroidSerif-Bold.ttf       platforms/${PLATFORM_NAME}/data/fonts/DroidSerif-Bold.ttf
 frameworks/base/data/fonts/DroidSerif-BoldItalic.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSerif-BoldItalic.ttf
-frameworks/base/data/fonts/DroidSerif-Italic.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSerif-Italic.ttf
-frameworks/base/data/fonts/DroidSerif-Regular.ttf platforms/${PLATFORM_NAME}/data/fonts/DroidSerif-Regular.ttf
+frameworks/base/data/fonts/DroidSerif-Italic.ttf     platforms/${PLATFORM_NAME}/data/fonts/DroidSerif-Italic.ttf
+frameworks/base/data/fonts/DroidSerif-Regular.ttf    platforms/${PLATFORM_NAME}/data/fonts/DroidSerif-Regular.ttf
+frameworks/base/data/fonts/DroidSansFallback.ttf     platforms/${PLATFORM_NAME}/data/fonts/DroidSansFallback.ttf
+frameworks/base/data/fonts/DroidSansJapanese.ttf     platforms/${PLATFORM_NAME}/data/fonts/DroidSansJapanese.ttf
 
 # empty add-on folder with just a readme
 development/tools/scripts/README_add-ons.txt add-ons/README.txt
diff --git a/build/tools/make_windows_sdk.sh b/build/tools/make_windows_sdk.sh
index 9b688e6..97c7bc7 100755
--- a/build/tools/make_windows_sdk.sh
+++ b/build/tools/make_windows_sdk.sh
@@ -1,11 +1,17 @@
 #!/bin/bash
 # Quick semi-auto file to build Windows SDK tools.
 #
-# Limitations:
+# Limitations and requirements:
 # - Expects the emulator has been built first, will pick it up from prebuilt.
 # - Run in Cygwin
-# - Needs Cygwin package zip
 # - Expects to have one of the existing SDK (Darwin or Linux) to build the Windows one
+# - Needs Cygwin packages: autoconf, bison, curl, flex, gcc, g++, git,
+#   gnupg, make, mingw-zlib, python, zip, unzip
+# - Must NOT have cygwin package readline (its GPL license might taint the SDK if
+#   it gets compiled in)
+# - Does not need a Java Development Kit or any other tools outside of cygwin.
+# - If you think you may have Windows versions of tools (e.g. make) installed, it may
+#   reduce confusion levels to 'export PATH=/usr/bin'
 
 set -e  # Fail this script as soon as a command fails -- fail early, fail fast
 
@@ -60,6 +66,10 @@
         # SDK number if you want, but not after, e.g these are valid:
         #    android_sdk_4242_platform.zip or blah_42_.zip
         #
+        # Note that the root directory name in the zip must match the zip
+        # name, too, so there's no point just changing the zip name to match
+        # the above format.
+        #
         # SDK_NUMBER will be empty if nothing matched.
         filename=`basename "$SDK_ZIP"`
         SDK_NUMBER=`echo $filename | sed -n 's/^.*_\([^_./]\+\)_[^_.]*\..*$/\1/p'`
@@ -89,7 +99,7 @@
         fastboot \
         hprof-conv \
         mksdcard \
-        sqlite3 \
+        sdklauncher sqlite3 \
         zipalign \
         || die "Build failed"
 }
@@ -131,7 +141,7 @@
     TOOLS="$TEMP_SDK_DIR/tools"
     LIB="$TEMP_SDK_DIR/tools/lib"
     rm -v "$TOOLS"/{adb,android,apkbuilder,ddms,dmtracedump,draw9patch,emulator}
-    rm -v "$TOOLS"/{hierarchyviewer,hprof-conv,mksdcard,sqlite3,traceview,zipalign}
+    rm -v "$TOOLS"/{hierarchyviewer,hprof-conv,layoutopt,mksdcard,sqlite3,traceview,zipalign}
     rm -v "$LIB"/*/swt.jar
     rm -v "$PLATFORM_TOOLS"/{aapt,aidl,dx,dexdump}
 
@@ -143,6 +153,9 @@
     mkdir -pv "$LIB"/x86_64
     cp -v prebuilt/windows-x86_64/swt/swt.jar  "$LIB"/x86_64/
 
+    # Move the SDK Setup (aka sdklauncher) to the root of the SDK (it was copied in tools above)
+    mv "$TOOLS/sdklauncher.exe" "$TEMP_SDK_DIR/SDK Setup.exe"    
+
     # If you want the emulator NOTICE in the tools dir, uncomment the following line:
     # cp -v external/qemu/NOTICE "$TOOLS"/emulator_NOTICE.txt
 
@@ -154,6 +167,7 @@
     cp -v development/tools/ddms/app/etc/ddms.bat                   "$TOOLS"/
     cp -v development/tools/traceview/etc/traceview.bat             "$TOOLS"/
     cp -v development/tools/hierarchyviewer/etc/hierarchyviewer.bat "$TOOLS"/
+    cp -v development/tools/layoutopt/app/etc/layoutopt.bat         "$TOOLS"/
     cp -v development/tools/draw9patch/etc/draw9patch.bat           "$TOOLS"/
     cp -v development/tools/sdkmanager/app/etc/android.bat          "$TOOLS"/
 
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeyNetworkMonitor.java b/cmds/monkey/src/com/android/commands/monkey/MonkeyNetworkMonitor.java
index ad2421a..13cab44 100644
--- a/cmds/monkey/src/com/android/commands/monkey/MonkeyNetworkMonitor.java
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeyNetworkMonitor.java
@@ -40,7 +40,7 @@
     private long mElapsedTime = 0; // amount of time spent between start() and stop()
     
     public void performReceive(Intent intent, int resultCode, String data, Bundle extras,
-            boolean ordered) throws RemoteException {
+            boolean ordered, boolean sticky) throws RemoteException {
         NetworkInfo ni = (NetworkInfo) intent.getParcelableExtra(
                 ConnectivityManager.EXTRA_NETWORK_INFO);
         if (LDEBUG) System.out.println("Network state changed: " 
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
index 869af2c..783dcf6 100644
--- a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
@@ -16,6 +16,7 @@
 
 package com.android.commands.monkey;
 
+import android.content.ComponentName;
 import android.os.SystemClock;
 import android.view.KeyEvent;
 
@@ -28,6 +29,7 @@
 import java.util.LinkedList;
 import java.util.StringTokenizer;
 
+import android.view.KeyEvent;
 /**
  * monkey event queue. It takes a script to produce events
  * 
@@ -52,6 +54,8 @@
     private static final String HEADER_TYPE = "type=";
     private static final String HEADER_COUNT = "count=";
     private static final String HEADER_SPEED = "speed=";
+    // New script type
+    private static final String USER_EVENT_TYPE = "user";
     
     private long mLastRecordedDownTimeKey = 0;    
     private long mLastRecordedDownTimeMotion = 0;
@@ -59,6 +63,7 @@
     private long mLastExportDownTimeMotion = 0;
     private long mLastExportEventTime = -1;
     private long mLastRecordedEventTime = -1;
+    private String mScriptType = USER_EVENT_TYPE;
     
     private static final boolean THIS_DEBUG = false;
     // a parameter that compensates the difference of real elapsed time and 
@@ -77,10 +82,15 @@
     private static final String EVENT_KEYWORD_TRACKBALL = "DispatchTrackball";
     private static final String EVENT_KEYWORD_KEY = "DispatchKey";
     private static final String EVENT_KEYWORD_FLIP = "DispatchFlip";
-    
+    private static final String EVENT_KEYWORD_KEYPRESS = "DispatchPress";
+    private static final String EVENT_KEYWORD_ACTIVITY = "LaunchActivity";
+    private static final String EVENT_KEYWORD_WAIT = "UserWait";
+    private static final String EVENT_KEYWORD_LONGPRESS = "LongPress";
+
     // a line at the end of the header
     private static final String STARTING_DATA_LINE = "start data >>";    
     private boolean mFileOpened = false;    
+    private static int LONGPRESS_WAIT_TIME = 2000; // wait time for the long press
     
     FileInputStream mFStream;
     DataInputStream mInputStream;
@@ -125,7 +135,7 @@
             while ((sLine = mBufferReader.readLine()) != null) {
                 sLine = sLine.trim();
                 if (sLine.indexOf(HEADER_TYPE) >= 0) {
-                    // at this point, we only have one type of script
+                    mScriptType = sLine.substring(HEADER_TYPE.length() + 1).trim();
                 } else if (sLine.indexOf(HEADER_COUNT) >= 0) {
                     try {
                         mEventCountInScript = Integer.parseInt(sLine.substring(
@@ -161,21 +171,12 @@
         }        
         return false;        
     }    
-    
-    private void processLine(String s) {
-        int index1 = s.indexOf('(');
-        int index2 = s.indexOf(')');
-        
-        if (index1 < 0 || index2 < 0) {
-            return;
-        }
-        
-        StringTokenizer st = new StringTokenizer(
-                s.substring(index1 + 1, index2), ",");
-        
+
+    private void handleRawEvent(String s, StringTokenizer st) {
         if (s.indexOf(EVENT_KEYWORD_KEY) >= 0) {
             // key events
             try {
+                System.out.println(" old key\n");
                 long downTime = Long.parseLong(st.nextToken());
                 long eventTime = Long.parseLong(st.nextToken());
                 int action = Integer.parseInt(st.nextToken());
@@ -184,18 +185,22 @@
                 int metaState = Integer.parseInt(st.nextToken());
                 int device = Integer.parseInt(st.nextToken());
                 int scancode = Integer.parseInt(st.nextToken());
-                
-                MonkeyKeyEvent e = new MonkeyKeyEvent(downTime, eventTime,
-                        action, code, repeat, metaState, device, scancode);
+
+                MonkeyKeyEvent e =
+                        new MonkeyKeyEvent(downTime, eventTime, action, code, repeat, metaState,
+                                device, scancode);
+                System.out.println(" Key code " + code + "\n");
+
                 mQ.addLast(e);
-                
+                System.out.println("Added key up \n");
+
             } catch (NumberFormatException e) {
-                // something wrong with this line in the script               
+                // something wrong with this line in the script
             }
         } else if (s.indexOf(EVENT_KEYWORD_POINTER) >= 0 || 
                 s.indexOf(EVENT_KEYWORD_TRACKBALL) >= 0) {
-            // trackball/pointer event 
-            try {                
+            // trackball/pointer event
+            try {
                 long downTime = Long.parseLong(st.nextToken());
                 long eventTime = Long.parseLong(st.nextToken());
                 int action = Integer.parseInt(st.nextToken());
@@ -208,25 +213,78 @@
                 float yPrecision = Float.parseFloat(st.nextToken());
                 int device = Integer.parseInt(st.nextToken());
                 int edgeFlags = Integer.parseInt(st.nextToken());
-                
-                int type = MonkeyEvent.EVENT_TYPE_TRACKBALL;                
+
+                int type = MonkeyEvent.EVENT_TYPE_TRACKBALL;
                 if (s.indexOf("Pointer") > 0) {
                     type = MonkeyEvent.EVENT_TYPE_POINTER;
-                }                
-                MonkeyMotionEvent e = new MonkeyMotionEvent(type, downTime, eventTime,
-                        action, x, y, pressure, size, metaState, xPrecision, yPrecision,
-                        device, edgeFlags);
-                mQ.addLast(e);                
+                }
+                MonkeyMotionEvent e =
+                        new MonkeyMotionEvent(type, downTime, eventTime, action, x, y, pressure,
+                                size, metaState, xPrecision, yPrecision, device, edgeFlags);
+                mQ.addLast(e);
             } catch (NumberFormatException e) {
-                // we ignore this event                
+                // we ignore this event
             }
         } else if (s.indexOf(EVENT_KEYWORD_FLIP) >= 0) {
             boolean keyboardOpen = Boolean.parseBoolean(st.nextToken());
             MonkeyFlipEvent e = new MonkeyFlipEvent(keyboardOpen);
             mQ.addLast(e);
         }
+
     }
-    
+
+    private void handleUserEvent(String s, StringTokenizer st) {
+        if (s.indexOf(EVENT_KEYWORD_ACTIVITY) >= 0) {
+            String pkg_name = st.nextToken();
+            String cl_name = st.nextToken();
+            ComponentName mApp = new ComponentName(pkg_name, cl_name);
+            MonkeyActivityEvent e = new MonkeyActivityEvent(mApp);
+            mQ.addLast(e);
+
+        } else if (s.indexOf(EVENT_KEYWORD_WAIT) >= 0) {
+            long sleeptime = Integer.parseInt(st.nextToken());
+            MonkeyWaitEvent e = new MonkeyWaitEvent(sleeptime);
+            mQ.addLast(e);
+
+        } else if (s.indexOf(EVENT_KEYWORD_KEYPRESS) >= 0) {
+            String key_name = st.nextToken();
+            int keyCode = MonkeySourceRandom.getKeyCode(key_name);
+            MonkeyKeyEvent e = new MonkeyKeyEvent(KeyEvent.ACTION_DOWN, keyCode);
+            mQ.addLast(e);
+            e = new MonkeyKeyEvent(KeyEvent.ACTION_UP, keyCode);
+            mQ.addLast(e);
+        } else if (s.indexOf(EVENT_KEYWORD_LONGPRESS) >= 0) {
+            // handle the long press
+            MonkeyKeyEvent e = new MonkeyKeyEvent(KeyEvent.ACTION_DOWN,
+                    KeyEvent.KEYCODE_DPAD_CENTER);
+            mQ.addLast(e);
+            MonkeyWaitEvent we = new MonkeyWaitEvent(LONGPRESS_WAIT_TIME);
+            mQ.addLast(we);
+            e = new MonkeyKeyEvent(KeyEvent.ACTION_UP,
+                    KeyEvent.KEYCODE_DPAD_CENTER);
+            mQ.addLast(e);
+        }
+    }
+
+    private void processLine(String s) {
+        int index1 = s.indexOf('(');
+        int index2 = s.indexOf(')');
+
+        if (index1 < 0 || index2 < 0) {
+            return;
+        }
+
+        StringTokenizer st = new StringTokenizer(
+                s.substring(index1 + 1, index2), ",");
+        if (mScriptType.compareTo(USER_EVENT_TYPE) == 0) {
+            // User event type
+            handleUserEvent(s, st);
+        } else {
+            // Raw type
+            handleRawEvent(s,st);
+        }
+    }
+
     private void closeFile() {
         mFileOpened = false;        
         if (THIS_DEBUG) {
@@ -253,31 +311,27 @@
     }
     
     /**
-     * read next batch of events from the provided script file
+      * read next batch of events from the provided script file
      * @return true if success
      */
     private boolean readNextBatch() {
+        /*
+         * The script should restore the original state when it run multiple
+         * times.
+         */
         String sLine = null;
         int readCount = 0;
-        
+
         if (THIS_DEBUG) {
             System.out.println("readNextBatch(): reading next batch of events");
         }
-        
+
         if (!mFileOpened) {
             if (!readScriptHeader()) {
                 closeFile();
                 return false;
-            }             
+            }
             resetValue();
-            
-            /* 
-            * In order to allow the Monkey to replay captured events multiple times
-            * we need to define a default start UI, which is the home screen
-            * Otherwise, it won't be accurate since the captured events 
-            * could end anywhere
-            */
-            addHomeKeyEvent();
         }
         
         try {            
@@ -418,7 +472,6 @@
         }
         MonkeyEvent e = mQ.getFirst();
         mQ.removeFirst();
-        
         if (e.getEventType() == MonkeyEvent.EVENT_TYPE_KEY) {
             adjustKeyEventTime((MonkeyKeyEvent) e);        
         } else if (e.getEventType() == MonkeyEvent.EVENT_TYPE_POINTER || 
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeyWaitEvent.java b/cmds/monkey/src/com/android/commands/monkey/MonkeyWaitEvent.java
new file mode 100644
index 0000000..87a41c1
--- /dev/null
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeyWaitEvent.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.commands.monkey;
+
+import android.app.IActivityManager;
+import android.view.IWindowManager;
+
+
+/**
+ * monkey throttle event
+ */
+public class MonkeyWaitEvent extends MonkeyEvent {
+    private long mWaitTime;
+
+    public MonkeyWaitEvent(long waitTime) {
+        super(MonkeyEvent.EVENT_TYPE_THROTTLE);
+        mWaitTime = waitTime;
+    }
+
+    @Override
+    public int injectEvent(IWindowManager iwm, IActivityManager iam, int verbose) {
+        if (verbose > 1) {
+            System.out.println("Wait Event for " + mWaitTime + " milliseconds");
+        }
+        try {
+            Thread.sleep(mWaitTime);
+        } catch (InterruptedException e1) {
+            System.out.println("** Monkey interrupted in sleep.");
+            return MonkeyEvent.INJECT_FAIL;
+        }
+
+        return MonkeyEvent.INJECT_SUCCESS;
+    }
+}
diff --git a/emulator/keymaps/AVRCP.kl b/emulator/keymaps/AVRCP.kl
index d0eba10..aeb3c8a 100644
--- a/emulator/keymaps/AVRCP.kl
+++ b/emulator/keymaps/AVRCP.kl
@@ -1,6 +1,7 @@
-key 164   MEDIA_PLAY_PAUSE    WAKE
-key 128   MEDIA_STOP          WAKE
+key 200   MEDIA_PLAY_PAUSE    WAKE
+key 201   MEDIA_PLAY_PAUSE    WAKE
+key 166   MEDIA_STOP          WAKE
 key 163   MEDIA_NEXT          WAKE
 key 165   MEDIA_PREVIOUS      WAKE
 key 168   MEDIA_REWIND        WAKE
-key 159   MEDIA_FAST_FORWARD  WAKE
+key 208   MEDIA_FAST_FORWARD  WAKE
diff --git a/emulator/qtools/dmtrace.cpp b/emulator/qtools/dmtrace.cpp
index 6d9250a..c486c5f 100644
--- a/emulator/qtools/dmtrace.cpp
+++ b/emulator/qtools/dmtrace.cpp
@@ -5,6 +5,7 @@
 #include <unistd.h>
 #include <inttypes.h>
 #include <string.h>
+#include <unistd.h>
 #include "dmtrace.h"
 
 static const short kVersion = 2;
@@ -163,7 +164,7 @@
     //   sig = "()I"
 
     // Find the first parenthesis, the start of the signature.
-    char *paren = strchr(name, '(');
+    char *paren = (char*)strchr(name, '(');
 
     // If not found, then add the original name.
     if (paren == NULL) {
@@ -180,7 +181,7 @@
     *paren = 0;
 
     // Search for the last period, the start of the method name
-    char *dot = strrchr(name, '.');
+    char *dot = (char*)strrchr(name, '.');
 
     // If not found, then add the original name.
     if (dot == NULL || dot == name) {
diff --git a/emulator/qtools/trace_reader.cpp b/emulator/qtools/trace_reader.cpp
index d2af64f..47b5d93 100644
--- a/emulator/qtools/trace_reader.cpp
+++ b/emulator/qtools/trace_reader.cpp
@@ -1009,10 +1009,10 @@
 // be freed by the caller after it is no longer needed.
 static char *ExtractDexPathFromMmap(const char *mmap_path)
 {
-    char *end = rindex(mmap_path, '@');
+    const char *end = rindex(mmap_path, '@');
     if (end == NULL)
         return NULL;
-    char *start = rindex(mmap_path, '/');
+    const char *start = rindex(mmap_path, '/');
     if (start == NULL)
         return NULL;
     int len = end - start;
diff --git a/emulator/skins/HVGA/layout b/emulator/skins/HVGA/layout
index 7117824..cc82dde 100644
--- a/emulator/skins/HVGA/layout
+++ b/emulator/skins/HVGA/layout
@@ -18,7 +18,7 @@
             y       0
         }
     }
-    
+
     controls {
         background {
             image   controls.png
@@ -357,7 +357,7 @@
         height    534
         color     0xe0e0e0
         event     EV_SW:0:1
-        
+
         part1 {
             name    portrait
             x       0
@@ -394,6 +394,12 @@
         color     0xe0e0e0
         event     EV_SW:0:0
 
+        # the framework _always_ assume that the DPad
+        # has been physically rotated in landscape mode.
+        # however, with this skin, this is not the case
+        #
+        dpad-rotation 3
+
         part1 {
             name    portrait
             x       800
diff --git a/emulator/skins/QVGA/layout b/emulator/skins/QVGA/layout
index f98e7bd..96f2133 100644
--- a/emulator/skins/QVGA/layout
+++ b/emulator/skins/QVGA/layout
@@ -393,6 +393,9 @@
         color     0xe0e0e0
         event     EV_SW:0:0
 
+        dpad-rotation 3
+
+
         part1 {
             name    portrait
             x       800
diff --git a/emulator/skins/WQVGA400/arrow_down.png b/emulator/skins/WQVGA400/arrow_down.png
new file mode 100644
index 0000000..b9fde22
--- /dev/null
+++ b/emulator/skins/WQVGA400/arrow_down.png
Binary files differ
diff --git a/emulator/skins/WQVGA400/arrow_left.png b/emulator/skins/WQVGA400/arrow_left.png
new file mode 100644
index 0000000..281b192
--- /dev/null
+++ b/emulator/skins/WQVGA400/arrow_left.png
Binary files differ
diff --git a/emulator/skins/WQVGA400/arrow_right.png b/emulator/skins/WQVGA400/arrow_right.png
new file mode 100644
index 0000000..4cbc65d
--- /dev/null
+++ b/emulator/skins/WQVGA400/arrow_right.png
Binary files differ
diff --git a/emulator/skins/WQVGA400/arrow_up.png b/emulator/skins/WQVGA400/arrow_up.png
new file mode 100644
index 0000000..29c7121
--- /dev/null
+++ b/emulator/skins/WQVGA400/arrow_up.png
Binary files differ
diff --git a/emulator/skins/WQVGA400/background_land.png b/emulator/skins/WQVGA400/background_land.png
new file mode 100644
index 0000000..c3fbee9
--- /dev/null
+++ b/emulator/skins/WQVGA400/background_land.png
Binary files differ
diff --git a/emulator/skins/WQVGA400/background_port.png b/emulator/skins/WQVGA400/background_port.png
new file mode 100644
index 0000000..c88edb8
--- /dev/null
+++ b/emulator/skins/WQVGA400/background_port.png
Binary files differ
diff --git a/emulator/skins/WQVGA400/button.png b/emulator/skins/WQVGA400/button.png
new file mode 100644
index 0000000..8281d20
--- /dev/null
+++ b/emulator/skins/WQVGA400/button.png
Binary files differ
diff --git a/emulator/skins/WQVGA400/controls.png b/emulator/skins/WQVGA400/controls.png
new file mode 100644
index 0000000..04b85e2
--- /dev/null
+++ b/emulator/skins/WQVGA400/controls.png
Binary files differ
diff --git a/emulator/skins/WQVGA400/hardware.ini b/emulator/skins/WQVGA400/hardware.ini
new file mode 100644
index 0000000..2efe617
--- /dev/null
+++ b/emulator/skins/WQVGA400/hardware.ini
@@ -0,0 +1,2 @@
+# skin-specific hardware values
+hw.lcd.density=120
\ No newline at end of file
diff --git a/emulator/skins/WQVGA400/key.png b/emulator/skins/WQVGA400/key.png
new file mode 100644
index 0000000..40b03bf
--- /dev/null
+++ b/emulator/skins/WQVGA400/key.png
Binary files differ
diff --git a/emulator/skins/WQVGA400/keyboard.png b/emulator/skins/WQVGA400/keyboard.png
new file mode 100644
index 0000000..ca49dcf
--- /dev/null
+++ b/emulator/skins/WQVGA400/keyboard.png
Binary files differ
diff --git a/emulator/skins/WQVGA400/layout b/emulator/skins/WQVGA400/layout
new file mode 100644
index 0000000..4d71adf
--- /dev/null
+++ b/emulator/skins/WQVGA400/layout
@@ -0,0 +1,438 @@
+parts {
+    portrait {
+        background {
+            image   background_port.png
+        }
+    }
+    landscape {
+        background {
+            image   background_land.png
+        }
+    }
+
+    device {
+        display {
+            width   240
+            height  400
+            x       0
+            y       0
+        }
+    }
+    
+    controls {
+        background {
+            image   controls.png
+        }
+        buttons {
+            soft-left {
+                    image button.png
+                    x 56
+                    y 142
+            }
+            home {
+                    image button.png
+                    x 0
+                    y 142
+            }
+            back {
+                    image button.png
+                    x 112
+                    y 142
+            }
+            dpad-up {
+                    image arrow_up.png
+                    x 77
+                    y 53
+            }
+            dpad-down {
+                    image arrow_down.png
+                    x 77
+                    y 106
+            }
+            dpad-left {
+                    image arrow_left.png
+                    x 53
+                    y 53
+            }
+            dpad-right {
+                    image arrow_right.png
+                    x 123
+                    y 53
+            }
+            dpad-center {
+                    image select.png
+                    x 77
+                    y 81
+            }
+            phone-dial {
+                    image button.png
+                    x 0
+                    y 71
+            }
+            phone-hangup {
+                    image button.png
+                    x 168
+                    y 71
+            }
+
+            power {
+                    image button.png
+                    x 168
+                    y 0
+            }
+
+            volume-up {
+                    image button.png
+                    x 112
+                    y 0
+            }
+
+            volume-down {
+                    image button.png
+                    x 56
+                    y 0
+            }
+
+            search {
+                    image button.png
+                    x 168
+                    y 142
+            }
+
+        }
+    }
+
+    keyboard {
+        background {
+            image   keyboard.png
+        }
+        buttons {
+            1 {
+                image  key.png
+                x  5
+                y  5
+            }
+            2 {
+                image  key.png
+                x 42
+                y 5
+            }
+            3 {
+                image  key.png
+                x 79
+                y 5
+            }
+            4 {
+                image  key.png
+                x 116
+                y 5
+            }
+            5 {
+                image  key.png
+                x 153
+                y 5
+            }
+            6 {
+                image  key.png
+                x 190
+                y 5
+            }
+            7 {
+                image  key.png
+                x 227
+                y 5
+            }
+            8 {
+                image  key.png
+                x 264
+                y 5
+            }
+            9 {
+                image  key.png
+                x 301
+                y 5
+            }
+            0 {
+                image  key.png
+                x 338
+                y 5
+            }
+
+            q {
+                image  key.png
+                x  5
+                y  41
+            }
+            w {
+                image  key.png
+                x 42
+                y 41
+            }
+            e {
+                image  key.png
+                x 79
+                y 41
+            }
+            r {
+                image  key.png
+                x 116
+                y 41
+            }
+            t {
+                image  key.png
+                x 153
+                y 41
+            }
+            y {
+                image  key.png
+                x 190
+                y 41
+            }
+            u {
+                image  key.png
+                x 227
+                y 41
+            }
+            i {
+                image  key.png
+                x 264
+                y 41
+            }
+            o {
+                image  key.png
+                x 301
+                y 41
+            }
+            p {
+                image  key.png
+                x 338
+                y 41
+            }
+
+            a {
+                image  key.png
+                x  5
+                y 77
+            }
+            s {
+                image  key.png
+                x 42
+                y 77
+            }
+            d {
+                image  key.png
+                x 79
+                y 77
+            }
+            f {
+                image  key.png
+                x 116
+                y 77
+            }
+            g {
+                image  key.png
+                x 153
+                y 77
+            }
+            h {
+                image  key.png
+                x 190
+                y 77
+            }
+            j {
+                image  key.png
+                x 227
+                y 77
+            }
+            k {
+                image  key.png
+                x 264
+                y 77
+            }
+            l {
+                image  key.png
+                x 301
+                y 77
+            }
+            DEL {
+                image  key.png
+                x 338
+                y 77
+            }
+
+            CAP {
+                image  key.png
+                x  5
+                y 113
+            }
+            z {
+                image  key.png
+                x 42
+                y 113
+            }
+            x {
+                image  key.png
+                x 79
+                y 113
+            }
+            c {
+                image  key.png
+                x 116
+                y 113
+            }
+            v {
+                image  key.png
+                x 153
+                y 113
+            }
+            b {
+                image  key.png
+                x 190
+                y 113
+            }
+            n {
+                image  key.png
+                x 227
+                y 113
+            }
+            m {
+                image  key.png
+                x 264
+                y 113
+            }
+            PERIOD {
+                image  key.png
+                x 301
+                y 113
+            }
+            ENTER {
+                image  key.png
+                x 338
+                y 113
+            }
+
+            ALT {
+                image  key.png
+                x  5
+                y 149
+            }
+            SYM {
+                image  key.png
+                x 42
+                y 149
+            }
+            AT {
+                image  key.png
+                x 79
+                y 149
+            }
+            SPACE {
+                image  spacebar.png
+                x 116
+                y 149
+            }
+            SLASH {
+                image  key.png
+                x 264
+                y 149
+            }
+            COMMA {
+                image  key.png
+                x 301
+                y 149
+            }
+            ALT2 {
+                image  key.png
+                x 338
+                y 149
+            }
+
+        }
+    }
+}
+
+layouts {
+    portrait {
+        width     711
+        height    454
+        color     0xe0e0e0
+        event     EV_SW:0:1
+        
+        part1 {
+            name    portrait
+            x       0
+            y       0
+        }
+
+        part2 {
+            name    landscape
+            x       800
+            y       0
+        }
+
+        part3 {
+            name    device
+            x       28
+            y       27
+        }
+        part4 {
+            name     controls
+            x        396
+            y        37
+        }
+        part5 {
+            name     keyboard
+            x        315
+            y        248
+        }
+    }
+
+    landscape {
+        width     640
+        height    522
+        color     0xe0e0e0
+        event     EV_SW:0:0
+
+        dpad-rotation 3
+
+        part1 {
+            name    portrait
+            x       800
+            y       0
+        }
+
+        part2 {
+            name    landscape
+            x       0
+            y       0
+        }
+
+        part3 {
+            name      device
+            x         120
+            y         270
+            rotation  3
+        }
+
+        part4 {
+            name     controls
+            x        410
+            y        317
+        }
+
+        part5 {
+            name     keyboard
+            x        18
+            y        317
+        }
+    }
+}
+
+keyboard {
+    charmap qwerty2
+}
+
+network {
+    speed  full
+    delay  none
+}
diff --git a/emulator/skins/WQVGA400/select.png b/emulator/skins/WQVGA400/select.png
new file mode 100644
index 0000000..f4a65d3
--- /dev/null
+++ b/emulator/skins/WQVGA400/select.png
Binary files differ
diff --git a/emulator/skins/WQVGA400/spacebar.png b/emulator/skins/WQVGA400/spacebar.png
new file mode 100644
index 0000000..aa459bd
--- /dev/null
+++ b/emulator/skins/WQVGA400/spacebar.png
Binary files differ
diff --git a/emulator/skins/WQVGA432/layout b/emulator/skins/WQVGA432/layout
index 7e52b53..006e955 100644
--- a/emulator/skins/WQVGA432/layout
+++ b/emulator/skins/WQVGA432/layout
@@ -393,6 +393,8 @@
         color     0xe0e0e0
         event     EV_SW:0:0
 
+        dpad-rotation 3
+
         part1 {
             name    portrait
             x       800
diff --git a/emulator/skins/WVGA800/hardware.ini b/emulator/skins/WVGA800/hardware.ini
index 02e9d89..9aec915 100644
--- a/emulator/skins/WVGA800/hardware.ini
+++ b/emulator/skins/WVGA800/hardware.ini
@@ -1,2 +1,3 @@
 # skin-specific hardware values
-hw.lcd.density=240
\ No newline at end of file
+hw.lcd.density=240
+vm.heapSize=24
diff --git a/emulator/skins/WVGA800/layout b/emulator/skins/WVGA800/layout
index 6037ab8..63647f3 100644
--- a/emulator/skins/WVGA800/layout
+++ b/emulator/skins/WVGA800/layout
@@ -394,6 +394,8 @@
         color     0xe0e0e0
         event     EV_SW:0:0
 
+        dpad-rotation 3
+
         part1 {
             name    portrait
             x       900
diff --git a/emulator/skins/WVGA854/hardware.ini b/emulator/skins/WVGA854/hardware.ini
index 02e9d89..9aec915 100644
--- a/emulator/skins/WVGA854/hardware.ini
+++ b/emulator/skins/WVGA854/hardware.ini
@@ -1,2 +1,3 @@
 # skin-specific hardware values
-hw.lcd.density=240
\ No newline at end of file
+hw.lcd.density=240
+vm.heapSize=24
diff --git a/emulator/skins/WVGA854/layout b/emulator/skins/WVGA854/layout
index ab0784d..b086ddc 100644
--- a/emulator/skins/WVGA854/layout
+++ b/emulator/skins/WVGA854/layout
@@ -394,6 +394,8 @@
         color     0xe0e0e0
         event     EV_SW:0:0
 
+        dpad-rotation 3
+
         part1 {
             name    portrait
             x       900
diff --git a/host/windows/usb/android_winusb.inf b/host/windows/usb/android_winusb.inf
index de4f93e..f88af7e 100755
--- a/host/windows/usb/android_winusb.inf
+++ b/host/windows/usb/android_winusb.inf
@@ -3,12 +3,12 @@
 ;

 [Version]

 Signature           = "$Windows NT$"

-Class               = AndroidUsbDeviceClass
-ClassGuid           = {3F966BD9-FA04-4ec5-991C-D326973B5128}
+Class               = AndroidUsbDeviceClass

+ClassGuid           = {3F966BD9-FA04-4ec5-991C-D326973B5128}

 Provider            = %ProviderName%

-DriverVer           = 08/11/2009,2.0.0010.00002
-CatalogFile.NTx86   = androidwinusb86.cat
-CatalogFile.NTamd64 = androidwinusba64.cat
+DriverVer           = 08/11/2009,2.0.0010.00002

+CatalogFile.NTx86   = androidwinusb86.cat

+CatalogFile.NTamd64 = androidwinusba64.cat

 

 ;

 ; This section seems to be required for WinUsb driver installation.

@@ -32,6 +32,13 @@
 %SingleBootLoaderInterface% = USB_Install, USB\VID_0BB4&PID_0FFF

 ; HTC Magic

 %CompositeAdbInterface%     = USB_Install, USB\VID_0BB4&PID_0C03&MI_01

+;

+;Moto Sholes

+%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_D00D

+%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_0002

+%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_0002&MI_01

+%SingleAdbInterface%        = USB_Install, USB\VID_22B8&PID_41DB

+%CompositeAdbInterface%     = USB_Install, USB\VID_22B8&PID_41DB&MI_01

 

 [Google.NTamd64]

 ; HTC Dream

@@ -40,6 +47,13 @@
 %SingleBootLoaderInterface% = USB_Install, USB\VID_0BB4&PID_0FFF

 ; HTC Magic

 %CompositeAdbInterface%     = USB_Install, USB\VID_0BB4&PID_0C03&MI_01

+;

+;Moto Sholes

+%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_D00D

+%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_0002

+%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_0002&MI_01

+%SingleAdbInterface%        = USB_Install, USB\VID_22B8&PID_41DB

+%CompositeAdbInterface%     = USB_Install, USB\VID_22B8&PID_41DB&MI_01

 

 [USB_Install]

 Include = winusb.inf

diff --git a/ide/eclipse/.classpath b/ide/eclipse/.classpath
index 71e8d29..71694d4 100644
--- a/ide/eclipse/.classpath
+++ b/ide/eclipse/.classpath
@@ -9,8 +9,6 @@
 	<classpathentry kind="src" path="packages/apps/Email/src"/>
 	<classpathentry kind="src" path="packages/apps/GoogleSearch/src"/>
 	<classpathentry kind="src" path="packages/apps/HTMLViewer/src"/>
-	<classpathentry kind="src" path="packages/apps/IM/src"/>
-	<classpathentry kind="src" path="packages/apps/IM/plugin"/>
 	<classpathentry kind="src" path="packages/apps/Launcher/src"/>
 	<classpathentry kind="src" path="packages/apps/Music/src"/>
 	<classpathentry kind="src" path="packages/apps/Mms/src"/>
@@ -28,8 +26,6 @@
 	<classpathentry kind="src" path="packages/providers/ImProvider/src"/>
 	<classpathentry kind="src" path="packages/providers/MediaProvider/src"/>
 	<classpathentry kind="src" path="packages/providers/TelephonyProvider/src"/>
-	<classpathentry kind="src" path="vendor/google/apps/Street/src"/>
-	<classpathentry kind="src" path="vendor/google/apps/YouTube/src"/>
 	<classpathentry kind="src" path="frameworks/base/awt"/>
 	<classpathentry kind="src" path="frameworks/base/cmds/am/src"/>
 	<classpathentry kind="src" path="frameworks/base/cmds/input/src"/>
@@ -39,6 +35,7 @@
 	<classpathentry kind="src" path="frameworks/base/core/config/sdk"/>
 	<classpathentry kind="src" path="frameworks/base/graphics/java"/>
 	<classpathentry kind="src" path="frameworks/base/im/java"/>
+	<classpathentry kind="src" path="frameworks/base/keystore/java"/>
 	<classpathentry kind="src" path="frameworks/base/location/java"/>
 	<classpathentry kind="src" path="frameworks/base/media/java"/>
 	<classpathentry kind="src" path="frameworks/base/opengl/java"/>
@@ -49,6 +46,7 @@
 	<classpathentry kind="src" path="frameworks/base/telephony/java"/>
 	<classpathentry kind="src" path="frameworks/base/test-runner"/>
 	<classpathentry kind="src" path="frameworks/base/tts/java"/>
+	<classpathentry kind="src" path="frameworks/base/vpn/java"/>
 	<classpathentry kind="src" path="frameworks/base/wifi/java"/>
 	<classpathentry kind="src" path="frameworks/policies/base/phone"/>
 	<classpathentry kind="src" path="development/samples/ApiDemos/src"/>
@@ -94,17 +92,15 @@
 	<classpathentry kind="src" path="dalvik/libcore/x-net/src/main/java"/>
 	<classpathentry kind="src" path="dalvik/libcore/xml/src/main/java"/>
 	<classpathentry kind="src" path="out/target/common/obj/APPS/ApiDemos_intermediates/src/src"/>
-	<classpathentry kind="src" path="out/target/common/obj/APPS/Browser_intermediates/src/src"/>
-	<classpathentry kind="src" path="out/target/common/obj/APPS/IM_intermediates/src/src"/>
+	<classpathentry kind="src" path="out/target/common/obj/APPS/Email_intermediates/src/src"/>
 	<classpathentry kind="src" path="out/target/common/obj/APPS/Music_intermediates/src/src"/>
 	<classpathentry kind="src" path="out/target/common/obj/APPS/Phone_intermediates/src/src"/>
 	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/com.android.im.plugin_intermediates/src"/>
 	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java"/>
-	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/im/java"/>
 	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/location/java"/>
 	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/media/java"/>
 	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/telephony/java"/>
-	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/tts/java"/>
+	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/vpn/java"/>
 	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/wifi/java"/>
 	<classpathentry kind="src" path="out/target/common/R"/>
 	<classpathentry kind="src" path="external/tagsoup/src"/>
@@ -114,6 +110,6 @@
 	<classpathentry kind="lib" path="external/googleclient/googleclient-lib.jar"/>
 	<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/google-framework_intermediates/javalib.jar"/>
 	<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/googlelogin-client_intermediates/javalib.jar"/>
-	<classpathentry kind="lib" path="packages/apps/Calculator/arity-1.3.1.jar"/>
+	<classpathentry kind="lib" path="packages/apps/Calculator/arity-1.3.3.jar"/>
 	<classpathentry kind="output" path="out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes"/>
 </classpath>
diff --git a/ide/eclipse/android-formatting.xml b/ide/eclipse/android-formatting.xml
index 71af915..a64d4c6 100644
--- a/ide/eclipse/android-formatting.xml
+++ b/ide/eclipse/android-formatting.xml
@@ -91,7 +91,7 @@
 <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
 <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
 <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
 <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
 <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
 <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
diff --git a/ndk/apps/hello-gl2/Application.mk b/ndk/apps/hello-gl2/Application.mk
new file mode 100644
index 0000000..6f884bf
--- /dev/null
+++ b/ndk/apps/hello-gl2/Application.mk
@@ -0,0 +1,3 @@
+APP_PROJECT_PATH := $(call my-dir)/project
+APP_MODULES      := libgl2jni
+
diff --git a/ndk/apps/hello-gl2/project/Android.mk b/ndk/apps/hello-gl2/project/Android.mk
new file mode 100644
index 0000000..2e36165
--- /dev/null
+++ b/ndk/apps/hello-gl2/project/Android.mk
@@ -0,0 +1,10 @@
+LOCAL_PATH:= $(LOCAL_PATH)/jni
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE    := libgl2jni
+LOCAL_CFLAGS    := -Werror
+LOCAL_SRC_FILES := gl_code.cpp
+LOCAL_LDLIBS    := -llog -lGLESv2
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/ndk/apps/hello-gl2/project/AndroidManifest.xml b/ndk/apps/hello-gl2/project/AndroidManifest.xml
new file mode 100644
index 0000000..0ef6fb0
--- /dev/null
+++ b/ndk/apps/hello-gl2/project/AndroidManifest.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License"); 
+** you may not use this file except in compliance with the License. 
+** You may obtain a copy of the License at 
+**
+**     http://www.apache.org/licenses/LICENSE-2.0 
+**
+** Unless required by applicable law or agreed to in writing, software 
+** distributed under the License is distributed on an "AS IS" BASIS, 
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.gl2jni">
+    <application
+            android:label="@string/gl2jni_activity">
+        <activity android:name="GL2JNIActivity"
+                android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
+            	android:launchMode="singleTask"
+            	android:configChanges="orientation|keyboardHidden">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+    <uses-sdk android:minSdkVersion="5"/>
+</manifest>
diff --git a/ndk/apps/hello-gl2/project/default.properties b/ndk/apps/hello-gl2/project/default.properties
new file mode 100644
index 0000000..dbf05f2
--- /dev/null
+++ b/ndk/apps/hello-gl2/project/default.properties
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+# 
+# This file must be checked in Version Control Systems.
+# 
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-5
diff --git a/ndk/apps/hello-gl2/project/jni/Android.mk b/ndk/apps/hello-gl2/project/jni/Android.mk
new file mode 100644
index 0000000..a995c86
--- /dev/null
+++ b/ndk/apps/hello-gl2/project/jni/Android.mk
@@ -0,0 +1,24 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE    := libgl2jni
+LOCAL_CFLAGS    := -Werror
+LOCAL_SRC_FILES := gl_code.cpp
+LOCAL_LDLIBS    := -llog -lGLESv2
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/ndk/apps/hello-gl2/project/jni/gl_code.cpp b/ndk/apps/hello-gl2/project/jni/gl_code.cpp
new file mode 100644
index 0000000..e1e30ce
--- /dev/null
+++ b/ndk/apps/hello-gl2/project/jni/gl_code.cpp
@@ -0,0 +1,182 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// OpenGL ES 2.0 code
+
+#include <jni.h>
+#include <android/log.h>
+
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#define  LOG_TAG    "libgl2jni"
+#define  LOGI(...)  __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
+#define  LOGE(...)  __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
+
+static void printGLString(const char *name, GLenum s) {
+    const char *v = (const char *) glGetString(s);
+    LOGI("GL %s = %s\n", name, v);
+}
+
+static void checkGlError(const char* op) {
+    for (GLint error = glGetError(); error; error
+            = glGetError()) {
+        LOGI("after %s() glError (0x%x)\n", op, error);
+    }
+}
+
+static const char gVertexShader[] = "attribute vec4 vPosition;\n"
+    "void main() {\n"
+    "  gl_Position = vPosition;\n"
+    "}\n";
+
+static const char gFragmentShader[] = "precision mediump float;\n"
+    "void main() {\n"
+    "  gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
+    "}\n";
+
+GLuint loadShader(GLenum shaderType, const char* pSource) {
+    GLuint shader = glCreateShader(shaderType);
+    if (shader) {
+        glShaderSource(shader, 1, &pSource, NULL);
+        glCompileShader(shader);
+        GLint compiled = 0;
+        glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
+        if (!compiled) {
+            GLint infoLen = 0;
+            glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
+            if (infoLen) {
+                char* buf = (char*) malloc(infoLen);
+                if (buf) {
+                    glGetShaderInfoLog(shader, infoLen, NULL, buf);
+                    LOGE("Could not compile shader %d:\n%s\n",
+                            shaderType, buf);
+                    free(buf);
+                }
+                glDeleteShader(shader);
+                shader = 0;
+            }
+        }
+    }
+    return shader;
+}
+
+GLuint createProgram(const char* pVertexSource, const char* pFragmentSource) {
+    GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource);
+    if (!vertexShader) {
+        return 0;
+    }
+
+    GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource);
+    if (!pixelShader) {
+        return 0;
+    }
+
+    GLuint program = glCreateProgram();
+    if (program) {
+        glAttachShader(program, vertexShader);
+        checkGlError("glAttachShader");
+        glAttachShader(program, pixelShader);
+        checkGlError("glAttachShader");
+        glLinkProgram(program);
+        GLint linkStatus = GL_FALSE;
+        glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
+        if (linkStatus != GL_TRUE) {
+            GLint bufLength = 0;
+            glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
+            if (bufLength) {
+                char* buf = (char*) malloc(bufLength);
+                if (buf) {
+                    glGetProgramInfoLog(program, bufLength, NULL, buf);
+                    LOGE("Could not link program:\n%s\n", buf);
+                    free(buf);
+                }
+            }
+            glDeleteProgram(program);
+            program = 0;
+        }
+    }
+    return program;
+}
+
+GLuint gProgram;
+GLuint gvPositionHandle;
+
+bool setupGraphics(int w, int h) {
+    printGLString("Version", GL_VERSION);
+    printGLString("Vendor", GL_VENDOR);
+    printGLString("Renderer", GL_RENDERER);
+    printGLString("Extensions", GL_EXTENSIONS);
+
+    LOGI("setupGraphics(%d, %d)", w, h);
+    gProgram = createProgram(gVertexShader, gFragmentShader);
+    if (!gProgram) {
+        LOGE("Could not create program.");
+        return false;
+    }
+    gvPositionHandle = glGetAttribLocation(gProgram, "vPosition");
+    checkGlError("glGetAttribLocation");
+    LOGI("glGetAttribLocation(\"vPosition\") = %d\n",
+            gvPositionHandle);
+
+    glViewport(0, 0, w, h);
+    checkGlError("glViewport");
+    return true;
+}
+
+const GLfloat gTriangleVertices[] = { 0.0f, 0.5f, -0.5f, -0.5f,
+        0.5f, -0.5f };
+
+void renderFrame() {
+    static float grey;
+    grey += 0.01f;
+    if (grey > 1.0f) {
+        grey = 0.0f;
+    }
+    glClearColor(grey, grey, grey, 1.0f);
+    checkGlError("glClearColor");
+    glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
+    checkGlError("glClear");
+
+    glUseProgram(gProgram);
+    checkGlError("glUseProgram");
+
+    glVertexAttribPointer(gvPositionHandle, 2, GL_FLOAT, GL_FALSE, 0, gTriangleVertices);
+    checkGlError("glVertexAttribPointer");
+    glEnableVertexAttribArray(gvPositionHandle);
+    checkGlError("glEnableVertexAttribArray");
+    glDrawArrays(GL_TRIANGLES, 0, 3);
+    checkGlError("glDrawArrays");
+}
+
+extern "C" {
+    JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_init(JNIEnv * env, jobject obj,  jint width, jint height);
+    JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_step(JNIEnv * env, jobject obj);
+};
+
+JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_init(JNIEnv * env, jobject obj,  jint width, jint height)
+{
+    setupGraphics(width, height);
+}
+
+JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_step(JNIEnv * env, jobject obj)
+{
+    renderFrame();
+}
diff --git a/ndk/apps/hello-gl2/project/res/values/strings.xml b/ndk/apps/hello-gl2/project/res/values/strings.xml
new file mode 100644
index 0000000..e3f7331
--- /dev/null
+++ b/ndk/apps/hello-gl2/project/res/values/strings.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2006, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License"); 
+** you may not use this file except in compliance with the License. 
+** You may obtain a copy of the License at 
+**
+**     http://www.apache.org/licenses/LICENSE-2.0 
+**
+** Unless required by applicable law or agreed to in writing, software 
+** distributed under the License is distributed on an "AS IS" BASIS, 
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+-->
+
+<!-- This file contains resource definitions for displayed strings, allowing
+     them to be changed based on the locale and options. -->
+
+<resources>
+    <!-- Simple strings. -->
+    <string name="gl2jni_activity">GL2JNI</string>
+
+</resources>
+
diff --git a/ndk/apps/hello-gl2/project/src/com/android/gl2jni/GL2JNIActivity.java b/ndk/apps/hello-gl2/project/src/com/android/gl2jni/GL2JNIActivity.java
new file mode 100644
index 0000000..c366a2c
--- /dev/null
+++ b/ndk/apps/hello-gl2/project/src/com/android/gl2jni/GL2JNIActivity.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gl2jni;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.WindowManager;
+
+import java.io.File;
+
+
+public class GL2JNIActivity extends Activity {
+
+    GL2JNIView mView;
+
+    @Override protected void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        mView = new GL2JNIView(getApplication());
+	setContentView(mView);
+    }
+
+    @Override protected void onPause() {
+        super.onPause();
+        mView.onPause();
+    }
+
+    @Override protected void onResume() {
+        super.onResume();
+        mView.onResume();
+    }
+}
diff --git a/ndk/apps/hello-gl2/project/src/com/android/gl2jni/GL2JNILib.java b/ndk/apps/hello-gl2/project/src/com/android/gl2jni/GL2JNILib.java
new file mode 100644
index 0000000..040a984
--- /dev/null
+++ b/ndk/apps/hello-gl2/project/src/com/android/gl2jni/GL2JNILib.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gl2jni;
+
+// Wrapper for native library
+
+public class GL2JNILib {
+
+     static {
+         System.loadLibrary("gl2jni");
+     }
+
+    /**
+     * @param width the current view width
+     * @param height the current view height
+     */
+     public static native void init(int width, int height);
+     public static native void step();
+}
diff --git a/ndk/apps/hello-gl2/project/src/com/android/gl2jni/GL2JNIView.java b/ndk/apps/hello-gl2/project/src/com/android/gl2jni/GL2JNIView.java
new file mode 100644
index 0000000..72b1dfb
--- /dev/null
+++ b/ndk/apps/hello-gl2/project/src/com/android/gl2jni/GL2JNIView.java
@@ -0,0 +1,296 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.gl2jni;
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import android.content.Context;
+import android.opengl.GLSurfaceView;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.egl.EGLContext;
+import javax.microedition.khronos.egl.EGLDisplay;
+import javax.microedition.khronos.opengles.GL10;
+
+/**
+ * An implementation of SurfaceView that uses the dedicated surface for
+ * displaying an OpenGL animation.  This allows the animation to run in a
+ * separate thread, without requiring that it be driven by the update mechanism
+ * of the view hierarchy.
+ *
+ * The application-specific rendering code is delegated to a GLView.Renderer
+ * instance.
+ */
+class GL2JNIView extends GLSurfaceView {
+    private static String TAG = "GL2JNIView";
+
+    public GL2JNIView(Context context) {
+        super(context);
+        init(false, 0, 0);
+    }
+
+    public GL2JNIView(Context context, boolean translucent, int depth, int stencil) {
+        super(context);
+        init(translucent, depth, stencil);
+    }
+
+    private void init(boolean translucent, int depth, int stencil) {
+        setEGLContextFactory(new ContextFactory());
+        setEGLConfigChooser( translucent ?
+              new ConfigChooser(8,8,8,8, depth, stencil) :
+              new ConfigChooser(5,6,5,0, depth, stencil));
+        setRenderer(new Renderer());
+    }
+
+    private static class ContextFactory implements GLSurfaceView.EGLContextFactory {
+        private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
+        public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
+            Log.w(TAG, "creating OpenGL ES 2.0 context");
+            checkEglError("Before eglCreateContext", egl);
+            int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
+            EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
+            checkEglError("After eglCreateContext", egl);
+            return context;
+        }
+
+        public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
+            egl.eglDestroyContext(display, context);
+        }
+    }
+
+    private static void checkEglError(String prompt, EGL10 egl) {
+        int error;
+        while ((error = egl.eglGetError()) != EGL10.EGL_SUCCESS) {
+            Log.e(TAG, String.format("%s: EGL error: 0x%x", prompt, error));
+        }
+    }
+
+    private static class ConfigChooser implements GLSurfaceView.EGLConfigChooser {
+        private static int EGL_OPENGL_ES2_BIT = 4;
+        private static int[] s_configAttribs2 =
+        {
+            EGL10.EGL_RED_SIZE, 4,
+            EGL10.EGL_GREEN_SIZE, 4,
+            EGL10.EGL_BLUE_SIZE, 4,
+            EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+            EGL10.EGL_NONE
+        };
+
+        public ConfigChooser(int r, int g, int b, int a, int depth, int stencil) {
+            mRedSize = r;
+            mGreenSize = g;
+            mBlueSize = b;
+            mAlphaSize = a;
+            mDepthSize = depth;
+            mStencilSize = stencil;
+        }
+
+        public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
+
+            int[] num_config = new int[1];
+            egl.eglChooseConfig(display, s_configAttribs2, null, 0, num_config);
+
+            int numConfigs = num_config[0];
+
+            if (numConfigs <= 0) {
+                throw new IllegalArgumentException("No configs match configSpec");
+            }
+            EGLConfig[] configs = new EGLConfig[numConfigs];
+            egl.eglChooseConfig(display, s_configAttribs2, configs, numConfigs, num_config);
+            // printConfigs(egl, display, configs);
+            return chooseConfig(egl, display, configs);
+        }
+
+        public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display,
+                EGLConfig[] configs) {
+            EGLConfig closestConfig = null;
+            int closestDistance = 1000;
+            for(EGLConfig config : configs) {
+                int d = findConfigAttrib(egl, display, config,
+                        EGL10.EGL_DEPTH_SIZE, 0);
+                int s = findConfigAttrib(egl, display, config,
+                        EGL10.EGL_STENCIL_SIZE, 0);
+                if (d >= mDepthSize && s>= mStencilSize) {
+                    int r = findConfigAttrib(egl, display, config,
+                            EGL10.EGL_RED_SIZE, 0);
+                    int g = findConfigAttrib(egl, display, config,
+                             EGL10.EGL_GREEN_SIZE, 0);
+                    int b = findConfigAttrib(egl, display, config,
+                              EGL10.EGL_BLUE_SIZE, 0);
+                    int a = findConfigAttrib(egl, display, config,
+                            EGL10.EGL_ALPHA_SIZE, 0);
+                    int distance = Math.abs(r - mRedSize)
+                                + Math.abs(g - mGreenSize)
+                                + Math.abs(b - mBlueSize)
+                                + Math.abs(a - mAlphaSize);
+                    if (distance < closestDistance) {
+                        closestDistance = distance;
+                        closestConfig = config;
+                    }
+                }
+            }
+            return closestConfig;
+        }
+
+        private int findConfigAttrib(EGL10 egl, EGLDisplay display,
+                EGLConfig config, int attribute, int defaultValue) {
+
+            if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
+                return mValue[0];
+            }
+            return defaultValue;
+        }
+
+        private void printConfigs(EGL10 egl, EGLDisplay display,
+            EGLConfig[] configs) {
+            int numConfigs = configs.length;
+            Log.w(TAG, String.format("%d configurations", numConfigs));
+            for (int i = 0; i < numConfigs; i++) {
+                Log.w(TAG, String.format("Configuration %d:\n", i));
+                printConfig(egl, display, configs[i]);
+            }
+        }
+
+        private void printConfig(EGL10 egl, EGLDisplay display,
+                EGLConfig config) {
+            int[] attributes = {
+                    EGL10.EGL_BUFFER_SIZE,
+                    EGL10.EGL_ALPHA_SIZE,
+                    EGL10.EGL_BLUE_SIZE,
+                    EGL10.EGL_GREEN_SIZE,
+                    EGL10.EGL_RED_SIZE,
+                    EGL10.EGL_DEPTH_SIZE,
+                    EGL10.EGL_STENCIL_SIZE,
+                    EGL10.EGL_CONFIG_CAVEAT,
+                    EGL10.EGL_CONFIG_ID,
+                    EGL10.EGL_LEVEL,
+                    EGL10.EGL_MAX_PBUFFER_HEIGHT,
+                    EGL10.EGL_MAX_PBUFFER_PIXELS,
+                    EGL10.EGL_MAX_PBUFFER_WIDTH,
+                    EGL10.EGL_NATIVE_RENDERABLE,
+                    EGL10.EGL_NATIVE_VISUAL_ID,
+                    EGL10.EGL_NATIVE_VISUAL_TYPE,
+                    0x3030, // EGL10.EGL_PRESERVED_RESOURCES,
+                    EGL10.EGL_SAMPLES,
+                    EGL10.EGL_SAMPLE_BUFFERS,
+                    EGL10.EGL_SURFACE_TYPE,
+                    EGL10.EGL_TRANSPARENT_TYPE,
+                    EGL10.EGL_TRANSPARENT_RED_VALUE,
+                    EGL10.EGL_TRANSPARENT_GREEN_VALUE,
+                    EGL10.EGL_TRANSPARENT_BLUE_VALUE,
+                    0x3039, // EGL10.EGL_BIND_TO_TEXTURE_RGB,
+                    0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGBA,
+                    0x303B, // EGL10.EGL_MIN_SWAP_INTERVAL,
+                    0x303C, // EGL10.EGL_MAX_SWAP_INTERVAL,
+                    EGL10.EGL_LUMINANCE_SIZE,
+                    EGL10.EGL_ALPHA_MASK_SIZE,
+                    EGL10.EGL_COLOR_BUFFER_TYPE,
+                    EGL10.EGL_RENDERABLE_TYPE,
+                    0x3042 // EGL10.EGL_CONFORMANT
+            };
+            String[] names = {
+                    "EGL_BUFFER_SIZE",
+                    "EGL_ALPHA_SIZE",
+                    "EGL_BLUE_SIZE",
+                    "EGL_GREEN_SIZE",
+                    "EGL_RED_SIZE",
+                    "EGL_DEPTH_SIZE",
+                    "EGL_STENCIL_SIZE",
+                    "EGL_CONFIG_CAVEAT",
+                    "EGL_CONFIG_ID",
+                    "EGL_LEVEL",
+                    "EGL_MAX_PBUFFER_HEIGHT",
+                    "EGL_MAX_PBUFFER_PIXELS",
+                    "EGL_MAX_PBUFFER_WIDTH",
+                    "EGL_NATIVE_RENDERABLE",
+                    "EGL_NATIVE_VISUAL_ID",
+                    "EGL_NATIVE_VISUAL_TYPE",
+                    "EGL_PRESERVED_RESOURCES",
+                    "EGL_SAMPLES",
+                    "EGL_SAMPLE_BUFFERS",
+                    "EGL_SURFACE_TYPE",
+                    "EGL_TRANSPARENT_TYPE",
+                    "EGL_TRANSPARENT_RED_VALUE",
+                    "EGL_TRANSPARENT_GREEN_VALUE",
+                    "EGL_TRANSPARENT_BLUE_VALUE",
+                    "EGL_BIND_TO_TEXTURE_RGB",
+                    "EGL_BIND_TO_TEXTURE_RGBA",
+                    "EGL_MIN_SWAP_INTERVAL",
+                    "EGL_MAX_SWAP_INTERVAL",
+                    "EGL_LUMINANCE_SIZE",
+                    "EGL_ALPHA_MASK_SIZE",
+                    "EGL_COLOR_BUFFER_TYPE",
+                    "EGL_RENDERABLE_TYPE",
+                    "EGL_CONFORMANT"
+            };
+            int[] value = new int[1];
+            for (int i = 0; i < attributes.length; i++) {
+                int attribute = attributes[i];
+                String name = names[i];
+                if ( egl.eglGetConfigAttrib(display, config, attribute, value)) {
+                    Log.w(TAG, String.format("  %s: %d\n", name, value[0]));
+                } else {
+                    // Log.w(TAG, String.format("  %s: failed\n", name));
+                    while (egl.eglGetError() != EGL10.EGL_SUCCESS);
+                }
+            }
+        }
+
+        // Subclasses can adjust these values:
+        protected int mRedSize;
+        protected int mGreenSize;
+        protected int mBlueSize;
+        protected int mAlphaSize;
+        protected int mDepthSize;
+        protected int mStencilSize;
+        private int[] mValue = new int[1];
+    }
+
+    private static class Renderer implements GLSurfaceView.Renderer {
+        public void onDrawFrame(GL10 gl) {
+            GL2JNILib.step();
+        }
+
+        public void onSurfaceChanged(GL10 gl, int width, int height) {
+            GL2JNILib.init(width, height);
+        }
+
+        public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+            // Do nothing.
+        }
+    }
+}
+
diff --git a/ndk/build/core/add-application.mk b/ndk/build/core/add-application.mk
index bec8d5e..3505d1f 100644
--- a/ndk/build/core/add-application.mk
+++ b/ndk/build/core/add-application.mk
@@ -61,7 +61,7 @@
 ifndef APP_PLATFORM
     _local_props := $(strip $(wildcard $(APP_PROJECT_PATH)/default.properties))
     ifdef _local_props
-        APP_PLATFORM := $(strip $(shell awk -f $(BUILD_SYSTEM)/extract-platform.awk < $(_local_props)))
+        APP_PLATFORM := $(strip $(shell $(HOST_AWK) -f $(BUILD_SYSTEM)/extract-platform.awk < $(_local_props)))
         $(call ndk_log,  Found APP_PLATFORM=$(APP_PLATFORM) in $(_local_props))
     else
         APP_PLATFORM := android-3
@@ -69,11 +69,14 @@
     endif
 endif
 
+# Check that the value of APP_PLATFORM corresponds to a known platform
+# If not, we're going to use the max supported platform value.
+#
 _bad_platform := $(strip $(filter-out $(NDK_ALL_PLATFORMS),$(APP_PLATFORM)))
 ifdef _bad_platform
-    $(call __ndk_info,Application $(_name) targets platform '$(_bad_platform)')
-    $(call __ndk_info,which is not supported by this release of the Android NDK)
-    $(call __ndk_error,Aborting...)
+    $(call __ndk_info,Application $(_name) targets unknown platform '$(_bad_platform)')
+    APP_PLATFORM := android-$(NDK_MAX_PLATFORM_LEVEL)
+    $(call __ndk_info,Switching to $(APP_PLATFORM))
 endif
 
 # If APP_BUILD_SCRIPT is defined, check that the file exists.
diff --git a/ndk/build/core/main.mk b/ndk/build/core/main.mk
index a460556..91ffb71 100644
--- a/ndk/build/core/main.mk
+++ b/ndk/build/core/main.mk
@@ -114,6 +114,18 @@
   $(eval include $(BUILD_SYSTEM)/add-platform.mk)\
 )
 
+# we're going to find the maximum platform number of the form android-<number>
+# ignore others, which could correspond to special and experimental cases
+NDK_ALL_PLATFORM_LEVELS := $(filter android-%,$(NDK_ALL_PLATFORMS))
+NDK_ALL_PLATFORM_LEVELS := $(patsubst android-%,%,$(NDK_ALL_PLATFORM_LEVELS))
+$(call ndk_log,Found stable platform levels: $(NDK_ALL_PLATFORM_LEVELS))
+
+NDK_MAX_PLATFORM_LEVEL := 3
+$(foreach level,$(NDK_ALL_PLATFORM_LEVELS),\
+  $(eval NDK_MAX_PLATFORM_LEVEL := $$(call max,$$(NDK_MAX_PLATFORM_LEVEL),$$(level)))\
+)
+$(call ndk_log,Found max platform level: $(NDK_MAX_PLATFORM_LEVEL))
+
 # ====================================================================
 #
 # Read all application configuration files
diff --git a/ndk/build/host-setup.sh b/ndk/build/host-setup.sh
index 6ee08da..a29cf84 100755
--- a/ndk/build/host-setup.sh
+++ b/ndk/build/host-setup.sh
@@ -116,7 +116,7 @@
     fi
     local result
     result=`echo "" | $executable -f build/check-awk.awk`
-    if [ "$result" == "Pass" ] ; then
+    if [ "$result" = "Pass" ] ; then
         AWK="$1"
     fi
     log2 "    Check $result"
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/alloca.h b/ndk/build/platforms/android-3/arch-arm/usr/include/alloca.h
deleted file mode 120000
index ac859df..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/alloca.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/alloca.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/alloca.h b/ndk/build/platforms/android-3/arch-arm/usr/include/alloca.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/alloca.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/alloca.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/android/log.h b/ndk/build/platforms/android-3/arch-arm/usr/include/android/log.h
deleted file mode 120000
index da91a66..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/android/log.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/android/log.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/android/log.h b/ndk/build/platforms/android-3/arch-arm/usr/include/android/log.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/android/log.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/android/log.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/arpa/inet.h b/ndk/build/platforms/android-3/arch-arm/usr/include/arpa/inet.h
deleted file mode 120000
index 760a19d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/arpa/inet.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/arpa/inet.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/arpa/inet.h b/ndk/build/platforms/android-3/arch-arm/usr/include/arpa/inet.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/arpa/inet.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/arpa/inet.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/arpa/nameser.h b/ndk/build/platforms/android-3/arch-arm/usr/include/arpa/nameser.h
deleted file mode 120000
index 73f9311..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/arpa/nameser.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/arpa/nameser.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/arpa/nameser.h b/ndk/build/platforms/android-3/arch-arm/usr/include/arpa/nameser.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/arpa/nameser.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/arpa/nameser.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/4level-fixup.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/4level-fixup.h
deleted file mode 120000
index 4493a92..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/4level-fixup.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/4level-fixup.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/4level-fixup.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/4level-fixup.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/4level-fixup.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/4level-fixup.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/audit_dir_write.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/audit_dir_write.h
deleted file mode 120000
index 6576f52..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/audit_dir_write.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/audit_dir_write.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/audit_dir_write.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/audit_dir_write.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/audit_dir_write.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/audit_dir_write.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/__ffs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/__ffs.h
deleted file mode 120000
index 9a68edc..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/__ffs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/__ffs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/__ffs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/__ffs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/bitops/__ffs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/__ffs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/atomic.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/atomic.h
deleted file mode 120000
index 32afeb4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/atomic.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/atomic.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/atomic.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/atomic.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/bitops/atomic.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/atomic.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/ffz.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/ffz.h
deleted file mode 120000
index 50c5214..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/ffz.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/ffz.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/ffz.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/ffz.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/bitops/ffz.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/ffz.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/find.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/find.h
deleted file mode 120000
index 9b40acd..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/find.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/find.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/find.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/find.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/bitops/find.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/find.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/fls.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/fls.h
deleted file mode 120000
index 5171887..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/fls.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/fls.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/fls.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/fls.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/bitops/fls.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/fls.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/fls64.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/fls64.h
deleted file mode 120000
index 8728e6a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/fls64.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/fls64.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/fls64.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/fls64.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/bitops/fls64.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/fls64.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/le.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/le.h
deleted file mode 120000
index 91b46c7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/le.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/le.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/le.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/le.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/bitops/le.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/le.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/non-atomic.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/non-atomic.h
deleted file mode 120000
index 177973e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/non-atomic.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/non-atomic.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/non-atomic.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/non-atomic.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/bitops/non-atomic.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bitops/non-atomic.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bug.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bug.h
deleted file mode 120000
index d898f3a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bug.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/bug.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bug.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bug.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/bug.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/bug.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/cputime.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/cputime.h
deleted file mode 120000
index 7892fb4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/cputime.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/cputime.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/cputime.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/cputime.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/cputime.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/cputime.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/emergency-restart.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/emergency-restart.h
deleted file mode 120000
index 3005c74..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/emergency-restart.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/emergency-restart.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/emergency-restart.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/emergency-restart.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/emergency-restart.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/emergency-restart.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/errno-base.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/errno-base.h
deleted file mode 120000
index 7b7d9bd..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/errno-base.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/errno-base.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/errno-base.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/errno-base.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/errno-base.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/errno-base.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/errno.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/errno.h
deleted file mode 120000
index bdd6dd4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/errno.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/errno.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/errno.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/errno.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/errno.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/errno.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/fcntl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/fcntl.h
deleted file mode 120000
index 3506aa8..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/fcntl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/fcntl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/fcntl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/fcntl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/fcntl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/fcntl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/futex.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/futex.h
deleted file mode 120000
index cbd47bf..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/futex.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/futex.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/futex.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/futex.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/futex.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/futex.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/ioctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/ioctl.h
deleted file mode 120000
index 7a11623..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/ioctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/ioctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/ioctl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/ioctl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/ioctl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/ipc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/ipc.h
deleted file mode 120000
index 339894e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/ipc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/ipc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/ipc.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/ipc.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/ipc.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/local.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/local.h
deleted file mode 120000
index 0e9344d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/local.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/local.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/local.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/local.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/local.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/local.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/memory_model.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/memory_model.h
deleted file mode 120000
index 3bbc82b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/memory_model.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/memory_model.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/memory_model.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/memory_model.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/memory_model.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/memory_model.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/mman.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/mman.h
deleted file mode 120000
index fbab125..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/mman.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/mman.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/mman.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/mman.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/mman.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/mman.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/mutex-xchg.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/mutex-xchg.h
deleted file mode 120000
index c7bc238..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/mutex-xchg.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/mutex-xchg.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/mutex-xchg.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/mutex-xchg.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/mutex-xchg.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/mutex-xchg.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/percpu.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/percpu.h
deleted file mode 120000
index 2d899db..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/percpu.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/percpu.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/percpu.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/percpu.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/percpu.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/percpu.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/pgtable-nopud.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/pgtable-nopud.h
deleted file mode 120000
index ac2157e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/pgtable-nopud.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/pgtable-nopud.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/pgtable-nopud.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/pgtable-nopud.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/pgtable-nopud.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/pgtable-nopud.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/pgtable.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/pgtable.h
deleted file mode 120000
index 4c70646..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/pgtable.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/pgtable.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/pgtable.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/pgtable.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/pgtable.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/pgtable.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/poll.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/poll.h
deleted file mode 120000
index 2bd359a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/poll.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/poll.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/poll.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/poll.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/poll.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/poll.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/resource.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/resource.h
deleted file mode 120000
index 28f331a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/resource.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/resource.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/resource.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/resource.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/resource.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/resource.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/sections.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/sections.h
deleted file mode 120000
index c6885f3..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/sections.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/sections.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/sections.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/sections.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/sections.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/sections.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/siginfo.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/siginfo.h
deleted file mode 120000
index d38f211..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/siginfo.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/siginfo.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/siginfo.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/siginfo.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/siginfo.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/siginfo.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/signal.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/signal.h
deleted file mode 120000
index 05ca352..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/signal.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/signal.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/signal.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/signal.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/signal.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/signal.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/tlb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/tlb.h
deleted file mode 120000
index 94baa95..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/tlb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/tlb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/tlb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/tlb.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/tlb.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/tlb.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/topology.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/topology.h
deleted file mode 120000
index e85b48f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/topology.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/topology.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/topology.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/topology.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/topology.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/topology.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/xor.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/xor.h
deleted file mode 120000
index baf2118..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/xor.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/xor.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/xor.h b/ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/xor.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/asm-generic/xor.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/asm-generic/xor.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/assert.h b/ndk/build/platforms/android-3/arch-arm/usr/include/assert.h
deleted file mode 120000
index 1572c5b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/assert.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/assert.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/assert.h b/ndk/build/platforms/android-3/arch-arm/usr/include/assert.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/assert.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/assert.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/byteswap.h b/ndk/build/platforms/android-3/arch-arm/usr/include/byteswap.h
deleted file mode 120000
index 153ee73..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/byteswap.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/byteswap.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/byteswap.h b/ndk/build/platforms/android-3/arch-arm/usr/include/byteswap.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/byteswap.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/byteswap.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/cstddef b/ndk/build/platforms/android-3/arch-arm/usr/include/cstddef
deleted file mode 120000
index cec20fd..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/cstddef
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/cstddef
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/cstddef b/ndk/build/platforms/android-3/arch-arm/usr/include/cstddef
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/cstddef
rename to ndk/build/platforms/android-3/arch-arm/usr/include/cstddef
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/ctype.h b/ndk/build/platforms/android-3/arch-arm/usr/include/ctype.h
deleted file mode 120000
index f1b315c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/ctype.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/ctype.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/ctype.h b/ndk/build/platforms/android-3/arch-arm/usr/include/ctype.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/ctype.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/ctype.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/dirent.h b/ndk/build/platforms/android-3/arch-arm/usr/include/dirent.h
deleted file mode 120000
index 315be03..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/dirent.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/dirent.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/dirent.h b/ndk/build/platforms/android-3/arch-arm/usr/include/dirent.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/dirent.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/dirent.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/dlfcn.h b/ndk/build/platforms/android-3/arch-arm/usr/include/dlfcn.h
deleted file mode 120000
index 5748e5a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/dlfcn.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/dlfcn.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/dlfcn.h b/ndk/build/platforms/android-3/arch-arm/usr/include/dlfcn.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/dlfcn.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/dlfcn.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/elf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/elf.h
deleted file mode 120000
index f4e2f5e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/elf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/elf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/elf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/elf.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/elf.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/elf.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/endian.h b/ndk/build/platforms/android-3/arch-arm/usr/include/endian.h
index 04204ed..475b48c 100644
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/endian.h
+++ b/ndk/build/platforms/android-3/arch-arm/usr/include/endian.h
@@ -1,10 +1,33 @@
-/*	$OpenBSD: endian.h,v 1.3 2005/12/13 00:35:23 millert Exp $	*/
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _ENDIAN_H_
+#define _ENDIAN_H_
 
-#ifdef __ARMEB__
-#define _BYTE_ORDER _BIG_ENDIAN
-#else
-#define _BYTE_ORDER _LITTLE_ENDIAN
-#endif
-#define	__STRICT_ALIGNMENT
-#include <sys/types.h>
 #include <sys/endian.h>
+
+#endif /* _ENDIAN_H_ */
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/err.h b/ndk/build/platforms/android-3/arch-arm/usr/include/err.h
deleted file mode 120000
index de81816..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/err.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/err.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/err.h b/ndk/build/platforms/android-3/arch-arm/usr/include/err.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/err.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/err.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/errno.h b/ndk/build/platforms/android-3/arch-arm/usr/include/errno.h
deleted file mode 120000
index 2e638ba..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/errno.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/errno.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/errno.h b/ndk/build/platforms/android-3/arch-arm/usr/include/errno.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/errno.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/errno.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/fcntl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/fcntl.h
deleted file mode 120000
index cb8c1df..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/fcntl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/fcntl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/fcntl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/fcntl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/fcntl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/fcntl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/features.h b/ndk/build/platforms/android-3/arch-arm/usr/include/features.h
deleted file mode 120000
index 6587ebd..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/features.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/features.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/features.h b/ndk/build/platforms/android-3/arch-arm/usr/include/features.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/features.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/features.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/fnmatch.h b/ndk/build/platforms/android-3/arch-arm/usr/include/fnmatch.h
deleted file mode 120000
index 52c0687..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/fnmatch.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/fnmatch.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/fnmatch.h b/ndk/build/platforms/android-3/arch-arm/usr/include/fnmatch.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/fnmatch.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/fnmatch.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/getopt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/getopt.h
deleted file mode 120000
index 857cf27..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/getopt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/getopt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/getopt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/getopt.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/getopt.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/getopt.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/grp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/grp.h
deleted file mode 120000
index c599451..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/grp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/grp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/grp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/grp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/grp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/grp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/inttypes.h b/ndk/build/platforms/android-3/arch-arm/usr/include/inttypes.h
deleted file mode 120000
index 5283d60..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/inttypes.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/inttypes.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/inttypes.h b/ndk/build/platforms/android-3/arch-arm/usr/include/inttypes.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/inttypes.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/inttypes.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/jni.h b/ndk/build/platforms/android-3/arch-arm/usr/include/jni.h
deleted file mode 120000
index e49af21..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/jni.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/jni.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/jni.h b/ndk/build/platforms/android-3/arch-arm/usr/include/jni.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/jni.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/jni.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/lastlog.h b/ndk/build/platforms/android-3/arch-arm/usr/include/lastlog.h
deleted file mode 120000
index fe63cd3..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/lastlog.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/lastlog.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/lastlog.h b/ndk/build/platforms/android-3/arch-arm/usr/include/lastlog.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/lastlog.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/lastlog.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/libgen.h b/ndk/build/platforms/android-3/arch-arm/usr/include/libgen.h
deleted file mode 120000
index 0f626b6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/libgen.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/libgen.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/libgen.h b/ndk/build/platforms/android-3/arch-arm/usr/include/libgen.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/libgen.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/libgen.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/limits.h b/ndk/build/platforms/android-3/arch-arm/usr/include/limits.h
deleted file mode 120000
index 60f67bf..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/limits.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/limits.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/limits.h b/ndk/build/platforms/android-3/arch-arm/usr/include/limits.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/limits.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/limits.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/a.out.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/a.out.h
deleted file mode 120000
index e1bffda..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/a.out.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/a.out.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/a.out.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/a.out.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/a.out.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/a.out.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/aio_abi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/aio_abi.h
deleted file mode 120000
index cd94485..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/aio_abi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/aio_abi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/aio_abi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/aio_abi.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/aio_abi.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/aio_abi.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/akm8976.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/akm8976.h
deleted file mode 120000
index 1d8b858..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/akm8976.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/akm8976.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/akm8976.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/akm8976.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/akm8976.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/akm8976.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/android_alarm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/android_alarm.h
deleted file mode 120000
index 383aabd..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/android_alarm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/android_alarm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/android_alarm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/android_alarm.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/android_alarm.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/android_alarm.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/android_pmem.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/android_pmem.h
deleted file mode 120000
index 2485ad8..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/android_pmem.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/android_pmem.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/android_pmem.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/android_pmem.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/android_pmem.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/android_pmem.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/android_power.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/android_power.h
deleted file mode 120000
index 05f970a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/android_power.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/android_power.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/android_power.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/android_power.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/android_power.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/android_power.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/apm_bios.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/apm_bios.h
deleted file mode 120000
index cbcfb5a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/apm_bios.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/apm_bios.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/apm_bios.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/apm_bios.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/apm_bios.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/apm_bios.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ashmem.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ashmem.h
deleted file mode 120000
index 3cc1881..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ashmem.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ashmem.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ashmem.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ashmem.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ashmem.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ashmem.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ata.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ata.h
deleted file mode 120000
index 4640b5f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ata.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ata.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ata.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ata.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ata.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ata.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atm.h
deleted file mode 120000
index 377242f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/atm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/atm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atm.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/atm.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/atm.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmapi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmapi.h
deleted file mode 120000
index 0d7f085..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmapi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/atmapi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/atmapi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmapi.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/atmapi.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmapi.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmdev.h
deleted file mode 120000
index f1f9a5f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/atmdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/atmdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmdev.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/atmdev.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmdev.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmioc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmioc.h
deleted file mode 120000
index 3b1e711..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmioc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/atmioc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/atmioc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmioc.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/atmioc.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmioc.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmppp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmppp.h
deleted file mode 120000
index 785c8fb..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmppp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/atmppp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/atmppp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmppp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/atmppp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmppp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmsap.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmsap.h
deleted file mode 120000
index bc0f5a8..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmsap.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/atmsap.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/atmsap.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmsap.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/atmsap.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/atmsap.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/attribute_container.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/attribute_container.h
deleted file mode 120000
index 3834481..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/attribute_container.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/attribute_container.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/attribute_container.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/attribute_container.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/attribute_container.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/attribute_container.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/auto_fs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/auto_fs.h
deleted file mode 120000
index 8d3e7b9..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/auto_fs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/auto_fs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/auto_fs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/auto_fs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/auto_fs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/auto_fs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/autoconf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/autoconf.h
deleted file mode 120000
index 41a58f5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/autoconf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/autoconf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/autoconf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/autoconf.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/autoconf.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/autoconf.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/auxvec.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/auxvec.h
deleted file mode 120000
index 5602220..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/auxvec.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/auxvec.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/auxvec.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/auxvec.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/auxvec.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/auxvec.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/backing-dev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/backing-dev.h
deleted file mode 120000
index 427296e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/backing-dev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/backing-dev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/backing-dev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/backing-dev.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/backing-dev.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/backing-dev.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/binder.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/binder.h
deleted file mode 120000
index 39fcca7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/binder.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/binder.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/binder.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/binder.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/binder.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/binder.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/binfmts.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/binfmts.h
deleted file mode 120000
index d938c2f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/binfmts.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/binfmts.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/binfmts.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/binfmts.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/binfmts.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/binfmts.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/bio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/bio.h
deleted file mode 120000
index 9a8ee71..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/bio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/bio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/bio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/bio.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/bio.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/bio.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/bitmap.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/bitmap.h
deleted file mode 120000
index 5db6297..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/bitmap.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/bitmap.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/bitmap.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/bitmap.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/bitmap.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/bitmap.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/bitops.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/bitops.h
deleted file mode 120000
index 5d0fcbb..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/bitops.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/bitops.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/bitops.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/bitops.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/bitops.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/bitops.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/blkdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/blkdev.h
deleted file mode 120000
index fb45957..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/blkdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/blkdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/blkdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/blkdev.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/blkdev.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/blkdev.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/blkpg.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/blkpg.h
deleted file mode 120000
index bc5f38f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/blkpg.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/blkpg.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/blkpg.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/blkpg.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/blkpg.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/blkpg.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/blockgroup_lock.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/blockgroup_lock.h
deleted file mode 120000
index 587f7f1..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/blockgroup_lock.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/blockgroup_lock.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/blockgroup_lock.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/blockgroup_lock.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/blockgroup_lock.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/blockgroup_lock.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/big_endian.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/big_endian.h
deleted file mode 120000
index ce97246..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/big_endian.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/byteorder/big_endian.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/byteorder/big_endian.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/big_endian.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/byteorder/big_endian.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/big_endian.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/generic.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/generic.h
deleted file mode 120000
index d865701..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/generic.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/byteorder/generic.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/byteorder/generic.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/generic.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/byteorder/generic.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/generic.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/little_endian.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/little_endian.h
deleted file mode 120000
index 9b117fa..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/little_endian.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/byteorder/little_endian.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/byteorder/little_endian.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/little_endian.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/byteorder/little_endian.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/little_endian.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/swab.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/swab.h
deleted file mode 120000
index b3da56e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/swab.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/byteorder/swab.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/byteorder/swab.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/swab.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/byteorder/swab.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/swab.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/swabb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/swabb.h
deleted file mode 120000
index d6d7ade..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/swabb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/byteorder/swabb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/byteorder/swabb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/swabb.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/byteorder/swabb.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/byteorder/swabb.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cache.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cache.h
deleted file mode 120000
index 74ed7c9..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cache.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/cache.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/cache.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cache.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/cache.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/cache.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/calc64.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/calc64.h
deleted file mode 120000
index e12ad54..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/calc64.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/calc64.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/calc64.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/calc64.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/calc64.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/calc64.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/capability.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/capability.h
deleted file mode 120000
index 9674918..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/capability.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/capability.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/capability.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/capability.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/capability.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/capability.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/capi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/capi.h
deleted file mode 120000
index e937bc1..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/capi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/capi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/capi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/capi.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/capi.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/capi.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cdev.h
deleted file mode 120000
index aa3f937..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/cdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/cdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cdev.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/cdev.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/cdev.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cdrom.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cdrom.h
deleted file mode 120000
index f8a7cfe..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cdrom.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/cdrom.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/cdrom.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cdrom.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/cdrom.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/cdrom.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/circ_buf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/circ_buf.h
deleted file mode 120000
index ada0bca..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/circ_buf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/circ_buf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/circ_buf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/circ_buf.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/circ_buf.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/circ_buf.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/clk.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/clk.h
deleted file mode 120000
index 246f4ad..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/clk.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/clk.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/clk.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/clk.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/clk.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/clk.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/coda.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/coda.h
deleted file mode 120000
index e577be5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/coda.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/coda.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/coda.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/coda.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/coda.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/coda.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/coda_fs_i.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/coda_fs_i.h
deleted file mode 120000
index bd7a507..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/coda_fs_i.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/coda_fs_i.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/coda_fs_i.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/coda_fs_i.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/coda_fs_i.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/coda_fs_i.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/compat.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/compat.h
deleted file mode 120000
index c323a32..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/compat.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/compat.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/compat.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/compat.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/compat.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/compat.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/compiler-gcc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/compiler-gcc.h
deleted file mode 120000
index 6609cf6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/compiler-gcc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/compiler-gcc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/compiler-gcc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/compiler-gcc.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/compiler-gcc.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/compiler-gcc.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/compiler.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/compiler.h
deleted file mode 120000
index c3c0a7c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/compiler.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/compiler.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/compiler.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/compiler.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/compiler.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/compiler.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/completion.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/completion.h
deleted file mode 120000
index af28044..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/completion.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/completion.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/completion.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/completion.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/completion.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/completion.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/config.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/config.h
deleted file mode 120000
index 71028f6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/config.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/config.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/config.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/config.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/config.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/config.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/console_struct.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/console_struct.h
deleted file mode 120000
index 7aa8514..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/console_struct.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/console_struct.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/console_struct.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/console_struct.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/console_struct.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/console_struct.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cpu.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cpu.h
deleted file mode 120000
index 2608247..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cpu.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/cpu.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/cpu.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cpu.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/cpu.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/cpu.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cpumask.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cpumask.h
deleted file mode 120000
index c8f6de0..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cpumask.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/cpumask.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/cpumask.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/cpumask.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/cpumask.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/cpumask.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ctype.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ctype.h
deleted file mode 120000
index e008d1e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ctype.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ctype.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ctype.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ctype.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ctype.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ctype.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dccp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dccp.h
deleted file mode 120000
index bc11d40..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dccp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/dccp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/dccp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dccp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/dccp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/dccp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/debug_locks.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/debug_locks.h
deleted file mode 120000
index 561a5bc..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/debug_locks.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/debug_locks.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/debug_locks.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/debug_locks.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/debug_locks.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/debug_locks.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/delay.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/delay.h
deleted file mode 120000
index d934a13..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/delay.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/delay.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/delay.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/delay.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/delay.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/delay.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/device.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/device.h
deleted file mode 120000
index 2440aba..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/device.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/device.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/device.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/device.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/device.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/device.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dirent.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dirent.h
deleted file mode 120000
index f16f4a4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dirent.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/dirent.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/dirent.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dirent.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/dirent.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/dirent.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dm-ioctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dm-ioctl.h
deleted file mode 120000
index d7305d2..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dm-ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/dm-ioctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/dm-ioctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dm-ioctl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/dm-ioctl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/dm-ioctl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dma-mapping.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dma-mapping.h
deleted file mode 120000
index d8f5664..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dma-mapping.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/dma-mapping.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/dma-mapping.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dma-mapping.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/dma-mapping.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/dma-mapping.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dmaengine.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dmaengine.h
deleted file mode 120000
index 31efa05..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dmaengine.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/dmaengine.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/dmaengine.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/dmaengine.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/dmaengine.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/dmaengine.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/efs_dir.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/efs_dir.h
deleted file mode 120000
index 5aae574..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/efs_dir.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/efs_dir.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/efs_dir.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/efs_dir.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/efs_dir.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/efs_dir.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/efs_fs_i.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/efs_fs_i.h
deleted file mode 120000
index 1ea12f6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/efs_fs_i.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/efs_fs_i.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/efs_fs_i.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/efs_fs_i.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/efs_fs_i.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/efs_fs_i.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/efs_fs_sb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/efs_fs_sb.h
deleted file mode 120000
index 9ece7e1..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/efs_fs_sb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/efs_fs_sb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/efs_fs_sb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/efs_fs_sb.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/efs_fs_sb.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/efs_fs_sb.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/elevator.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/elevator.h
deleted file mode 120000
index a15375f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/elevator.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/elevator.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/elevator.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/elevator.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/elevator.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/elevator.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/elf-em.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/elf-em.h
deleted file mode 120000
index a70534c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/elf-em.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/elf-em.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/elf-em.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/elf-em.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/elf-em.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/elf-em.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/elf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/elf.h
deleted file mode 120000
index 4455674..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/elf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/elf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/elf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/elf.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/elf.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/elf.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/err.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/err.h
deleted file mode 120000
index 7bc3976..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/err.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/err.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/err.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/err.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/err.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/err.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/errno.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/errno.h
deleted file mode 120000
index 17901cf..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/errno.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/errno.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/errno.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/errno.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/errno.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/errno.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/errqueue.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/errqueue.h
deleted file mode 120000
index f857679..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/errqueue.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/errqueue.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/errqueue.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/errqueue.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/errqueue.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/errqueue.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/etherdevice.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/etherdevice.h
deleted file mode 120000
index c6fc657..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/etherdevice.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/etherdevice.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/etherdevice.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/etherdevice.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/etherdevice.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/etherdevice.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ext2_fs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ext2_fs.h
deleted file mode 120000
index 6d1ef48..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ext2_fs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ext2_fs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ext2_fs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ext2_fs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ext2_fs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ext2_fs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ext3_fs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ext3_fs.h
deleted file mode 120000
index 401d884..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ext3_fs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ext3_fs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ext3_fs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ext3_fs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ext3_fs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ext3_fs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fadvise.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fadvise.h
deleted file mode 120000
index 28391d0..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fadvise.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/fadvise.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/fadvise.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fadvise.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/fadvise.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/fadvise.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fb.h
deleted file mode 120000
index 678e85b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/fb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/fb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fb.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/fb.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/fb.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fcntl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fcntl.h
deleted file mode 120000
index 628a481..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fcntl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/fcntl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/fcntl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fcntl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/fcntl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/fcntl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fd.h
deleted file mode 120000
index 27d6d08..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/fd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/fd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fd.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/fd.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/fd.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/file.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/file.h
deleted file mode 120000
index d063b5e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/file.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/file.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/file.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/file.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/file.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/file.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/filter.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/filter.h
deleted file mode 120000
index 54c78a3..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/filter.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/filter.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/filter.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/filter.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/filter.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/filter.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fs.h
deleted file mode 120000
index c72717d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/fs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/fs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/fs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/fs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/fs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ftape.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ftape.h
deleted file mode 120000
index 59efd2b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ftape.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ftape.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ftape.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ftape.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ftape.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ftape.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/futex.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/futex.h
deleted file mode 120000
index cbfdedb..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/futex.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/futex.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/futex.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/futex.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/futex.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/futex.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/genhd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/genhd.h
deleted file mode 120000
index 4182ac6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/genhd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/genhd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/genhd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/genhd.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/genhd.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/genhd.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/gfp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/gfp.h
deleted file mode 120000
index 955489e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/gfp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/gfp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/gfp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/gfp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/gfp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/gfp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hardirq.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hardirq.h
deleted file mode 120000
index 01128bd..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hardirq.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/hardirq.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/hardirq.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hardirq.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/hardirq.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/hardirq.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hdlc/ioctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hdlc/ioctl.h
deleted file mode 120000
index 7679e36..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hdlc/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/hdlc/ioctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/hdlc/ioctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hdlc/ioctl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/hdlc/ioctl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/hdlc/ioctl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hdreg.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hdreg.h
deleted file mode 120000
index 35aea04..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/hdreg.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/hdreg.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hdreg.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/hdreg.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/hdreg.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hdsmart.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hdsmart.h
deleted file mode 120000
index 383f58c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hdsmart.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/hdsmart.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/hdsmart.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hdsmart.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/hdsmart.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/hdsmart.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/highmem.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/highmem.h
deleted file mode 120000
index 0f41fc7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/highmem.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/highmem.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/highmem.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/highmem.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/highmem.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/highmem.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hil.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hil.h
deleted file mode 120000
index 2bee8bb..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hil.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/hil.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/hil.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/hil.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/hil.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/hil.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/i2c.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/i2c.h
deleted file mode 120000
index 514ff43..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/i2c.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/i2c.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/i2c.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/i2c.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/i2c.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/i2c.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/icmp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/icmp.h
deleted file mode 120000
index 87771a7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/icmp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/icmp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/icmp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/icmp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/icmp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/icmp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if.h
deleted file mode 120000
index 176aae6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/if.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/if.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/if.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_arcnet.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_arcnet.h
deleted file mode 120000
index 0d04ae3..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_arcnet.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_arcnet.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_arcnet.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_arcnet.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/if_arcnet.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_arcnet.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_arp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_arp.h
deleted file mode 120000
index 536a142..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_arp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_arp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_arp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_arp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/if_arp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_arp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_bridge.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_bridge.h
deleted file mode 120000
index ad36ad5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_bridge.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_bridge.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_bridge.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_bridge.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/if_bridge.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_bridge.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_ether.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_ether.h
deleted file mode 120000
index 4dc3348..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_ether.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_ether.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_ether.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_ether.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/if_ether.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_ether.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_fc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_fc.h
deleted file mode 120000
index 087ec19..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_fc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_fc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_fc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_fc.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/if_fc.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_fc.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_fddi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_fddi.h
deleted file mode 120000
index 6c439ad..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_fddi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_fddi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_fddi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_fddi.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/if_fddi.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_fddi.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_hippi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_hippi.h
deleted file mode 120000
index f4febf9..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_hippi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_hippi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_hippi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_hippi.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/if_hippi.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_hippi.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_packet.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_packet.h
deleted file mode 120000
index d48d404..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_packet.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_packet.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_packet.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_packet.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/if_packet.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_packet.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_ppp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_ppp.h
deleted file mode 120000
index 1c0292e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_ppp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_ppp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_ppp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_ppp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/if_ppp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_ppp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_tr.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_tr.h
deleted file mode 120000
index 115cd17..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_tr.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_tr.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_tr.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_tr.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/if_tr.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_tr.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_tun.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_tun.h
deleted file mode 120000
index f127941..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_tun.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_tun.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_tun.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_tun.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/if_tun.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_tun.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_vlan.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_vlan.h
deleted file mode 120000
index f20fce0..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_vlan.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_vlan.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_vlan.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_vlan.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/if_vlan.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/if_vlan.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/in.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/in.h
deleted file mode 120000
index 0e127e0..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/in.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/in.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/in.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/in.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/in.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/in.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/in6.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/in6.h
deleted file mode 120000
index 18c3130..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/in6.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/in6.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/in6.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/in6.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/in6.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/in6.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/init.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/init.h
deleted file mode 120000
index 488bb0a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/init.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/init.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/init.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/init.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/init.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/init.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/inotify.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/inotify.h
deleted file mode 120000
index 41670ad..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/inotify.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/inotify.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/inotify.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/inotify.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/inotify.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/inotify.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/input.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/input.h
deleted file mode 120000
index 423edd7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/input.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/input.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/input.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/input.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/input.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/input.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/interrupt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/interrupt.h
deleted file mode 120000
index b5cd63c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/interrupt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/interrupt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/interrupt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/interrupt.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/interrupt.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/interrupt.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ioctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ioctl.h
deleted file mode 120000
index b30e479..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ioctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ioctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ioctl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ioctl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ioctl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ioport.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ioport.h
deleted file mode 120000
index d90526d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ioport.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ioport.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ioport.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ioport.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ioport.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ioport.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ioprio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ioprio.h
deleted file mode 120000
index 1634241..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ioprio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ioprio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ioprio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ioprio.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ioprio.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ioprio.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ip.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ip.h
deleted file mode 120000
index e89967b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ip.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ip.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ip.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ip.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ip.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ip.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipc.h
deleted file mode 120000
index 60f3881..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ipc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ipc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipc.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ipc.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipc.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipmi_msgdefs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipmi_msgdefs.h
deleted file mode 120000
index 2cfe5ac..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipmi_msgdefs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ipmi_msgdefs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ipmi_msgdefs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipmi_msgdefs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ipmi_msgdefs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipmi_msgdefs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipmi_smi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipmi_smi.h
deleted file mode 120000
index 9a796a2..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipmi_smi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ipmi_smi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ipmi_smi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipmi_smi.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ipmi_smi.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipmi_smi.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipx.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipx.h
deleted file mode 120000
index dd5d4b9..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipx.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ipx.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ipx.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipx.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ipx.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ipx.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irq.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irq.h
deleted file mode 120000
index aa6cf1a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irq.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/irq.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/irq.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irq.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/irq.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/irq.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irq_cpustat.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irq_cpustat.h
deleted file mode 120000
index 4a329b4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irq_cpustat.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/irq_cpustat.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/irq_cpustat.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irq_cpustat.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/irq_cpustat.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/irq_cpustat.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irqflags.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irqflags.h
deleted file mode 120000
index fa80886..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irqflags.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/irqflags.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/irqflags.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irqflags.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/irqflags.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/irqflags.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irqreturn.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irqreturn.h
deleted file mode 120000
index 739fa62..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irqreturn.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/irqreturn.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/irqreturn.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/irqreturn.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/irqreturn.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/irqreturn.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/jbd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/jbd.h
deleted file mode 120000
index 9594286..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/jbd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/jbd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/jbd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/jbd.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/jbd.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/jbd.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/jiffies.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/jiffies.h
deleted file mode 120000
index 5accf6a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/jiffies.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/jiffies.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/jiffies.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/jiffies.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/jiffies.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/jiffies.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kd.h
deleted file mode 120000
index e7005fa..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/kd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kd.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/kd.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/kd.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kdev_t.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kdev_t.h
deleted file mode 120000
index fffcdac..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kdev_t.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kdev_t.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/kdev_t.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kdev_t.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/kdev_t.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/kdev_t.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kernel.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kernel.h
deleted file mode 120000
index 4b3447c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kernel.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kernel.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/kernel.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kernel.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/kernel.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/kernel.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kernel_stat.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kernel_stat.h
deleted file mode 120000
index 2f1598b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kernel_stat.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kernel_stat.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/kernel_stat.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kernel_stat.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/kernel_stat.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/kernel_stat.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kernelcapi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kernelcapi.h
deleted file mode 120000
index 78f09ac..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kernelcapi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kernelcapi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/kernelcapi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kernelcapi.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/kernelcapi.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/kernelcapi.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kexec.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kexec.h
deleted file mode 120000
index 883b34f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kexec.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kexec.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/kexec.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kexec.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/kexec.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/kexec.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/key.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/key.h
deleted file mode 120000
index a43f262..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/key.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/key.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/key.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/key.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/key.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/key.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/keyboard.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/keyboard.h
deleted file mode 120000
index f1e952c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/keyboard.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/keyboard.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/keyboard.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/keyboard.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/keyboard.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/keyboard.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/keychord.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/keychord.h
deleted file mode 120000
index 4af7a30..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/keychord.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/keychord.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/keychord.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/keychord.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/keychord.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/keychord.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/klist.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/klist.h
deleted file mode 120000
index 6c121e7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/klist.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/klist.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/klist.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/klist.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/klist.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/klist.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kmod.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kmod.h
deleted file mode 120000
index 0fc11ce..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kmod.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kmod.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/kmod.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kmod.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/kmod.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/kmod.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kobject.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kobject.h
deleted file mode 120000
index 1e2eb82..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kobject.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kobject.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/kobject.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kobject.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/kobject.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/kobject.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kref.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kref.h
deleted file mode 120000
index 84f0760..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kref.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kref.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/kref.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/kref.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/kref.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/kref.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ktime.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ktime.h
deleted file mode 120000
index bd9e539..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ktime.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ktime.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ktime.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ktime.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ktime.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ktime.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/limits.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/limits.h
deleted file mode 120000
index 998a2f3..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/limits.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/limits.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/limits.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/limits.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/limits.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/limits.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/linkage.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/linkage.h
deleted file mode 120000
index 9981e49..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/linkage.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/linkage.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/linkage.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/linkage.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/linkage.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/linkage.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/list.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/list.h
deleted file mode 120000
index 8b5214f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/list.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/list.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/list.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/list.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/list.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/list.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/lockd/nlm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/lockd/nlm.h
deleted file mode 120000
index 1f70297..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/lockd/nlm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/lockd/nlm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/lockd/nlm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/lockd/nlm.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/lockd/nlm.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/lockd/nlm.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/lockd/xdr.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/lockd/xdr.h
deleted file mode 120000
index 59987cf..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/lockd/xdr.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/lockd/xdr.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/lockd/xdr.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/lockd/xdr.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/lockd/xdr.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/lockd/xdr.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/lockdep.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/lockdep.h
deleted file mode 120000
index 6a6ae87..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/lockdep.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/lockdep.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/lockdep.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/lockdep.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/lockdep.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/lockdep.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/loop.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/loop.h
deleted file mode 120000
index 6c91215..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/loop.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/loop.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/loop.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/loop.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/loop.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/loop.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/magic.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/magic.h
deleted file mode 120000
index afafcfd..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/magic.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/magic.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/magic.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/magic.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/magic.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/magic.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/major.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/major.h
deleted file mode 120000
index f08b244..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/major.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/major.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/major.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/major.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/major.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/major.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mc146818rtc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mc146818rtc.h
deleted file mode 120000
index 4286741..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mc146818rtc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mc146818rtc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mc146818rtc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mc146818rtc.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mc146818rtc.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mc146818rtc.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mca.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mca.h
deleted file mode 120000
index 1f34bde..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mca.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mca.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mca.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mca.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mca.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mca.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mempolicy.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mempolicy.h
deleted file mode 120000
index 2690b14..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mempolicy.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mempolicy.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mempolicy.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mempolicy.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mempolicy.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mempolicy.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mempool.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mempool.h
deleted file mode 120000
index eaed026..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mempool.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mempool.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mempool.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mempool.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mempool.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mempool.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/miscdevice.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/miscdevice.h
deleted file mode 120000
index 7de3342..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/miscdevice.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/miscdevice.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/miscdevice.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/miscdevice.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/miscdevice.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/miscdevice.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mm.h
deleted file mode 120000
index 111cc15..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mm.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mm.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mm.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmc/card.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmc/card.h
deleted file mode 120000
index 0a25330..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmc/card.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mmc/card.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mmc/card.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmc/card.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mmc/card.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmc/card.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmc/host.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmc/host.h
deleted file mode 120000
index 61ab0f6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmc/host.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mmc/host.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mmc/host.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmc/host.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mmc/host.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmc/host.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmc/mmc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmc/mmc.h
deleted file mode 120000
index ca8b23e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmc/mmc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mmc/mmc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mmc/mmc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmc/mmc.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mmc/mmc.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmc/mmc.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmzone.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmzone.h
deleted file mode 120000
index 6bd8d97..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmzone.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mmzone.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mmzone.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmzone.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mmzone.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mmzone.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mod_devicetable.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mod_devicetable.h
deleted file mode 120000
index 1104eb5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mod_devicetable.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mod_devicetable.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mod_devicetable.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mod_devicetable.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mod_devicetable.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mod_devicetable.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/module.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/module.h
deleted file mode 120000
index 93b3b19..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/module.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/module.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/module.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/module.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/module.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/module.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/moduleparam.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/moduleparam.h
deleted file mode 120000
index 1f544b7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/moduleparam.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/moduleparam.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/moduleparam.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/moduleparam.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/moduleparam.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/moduleparam.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mount.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mount.h
deleted file mode 120000
index 5ac8a42..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mount.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mount.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mount.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mount.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mount.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mount.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msdos_fs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msdos_fs.h
deleted file mode 120000
index de01ab3..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msdos_fs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/msdos_fs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/msdos_fs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msdos_fs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/msdos_fs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/msdos_fs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msg.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msg.h
deleted file mode 120000
index 4b5c4f9..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msg.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/msg.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/msg.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msg.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/msg.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/msg.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msm_adsp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msm_adsp.h
deleted file mode 120000
index 620ab8d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msm_adsp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/msm_adsp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/msm_adsp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msm_adsp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/msm_adsp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/msm_adsp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msm_audio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msm_audio.h
deleted file mode 120000
index 730a831..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msm_audio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/msm_audio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/msm_audio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msm_audio.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/msm_audio.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/msm_audio.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msm_mdp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msm_mdp.h
deleted file mode 120000
index d4ff409..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msm_mdp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/msm_mdp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/msm_mdp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/msm_mdp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/msm_mdp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/msm_mdp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mt9t013.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mt9t013.h
deleted file mode 120000
index 8a2b5c0..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mt9t013.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mt9t013.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mt9t013.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mt9t013.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mt9t013.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mt9t013.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/bbm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/bbm.h
deleted file mode 120000
index d2d24c5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/bbm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/bbm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/bbm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/bbm.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mtd/bbm.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/bbm.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/blktrans.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/blktrans.h
deleted file mode 120000
index f16b497..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/blktrans.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/blktrans.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/blktrans.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/blktrans.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mtd/blktrans.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/blktrans.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/cfi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/cfi.h
deleted file mode 120000
index 468e5e8..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/cfi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/cfi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/cfi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/cfi.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mtd/cfi.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/cfi.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/cfi_endian.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/cfi_endian.h
deleted file mode 120000
index 3f9e287..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/cfi_endian.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/cfi_endian.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/cfi_endian.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/cfi_endian.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mtd/cfi_endian.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/cfi_endian.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/compatmac.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/compatmac.h
deleted file mode 120000
index ed02458..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/compatmac.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/compatmac.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/compatmac.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/compatmac.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mtd/compatmac.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/compatmac.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/flashchip.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/flashchip.h
deleted file mode 120000
index 96a349d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/flashchip.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/flashchip.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/flashchip.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/flashchip.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mtd/flashchip.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/flashchip.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/map.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/map.h
deleted file mode 120000
index fee2465..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/map.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/map.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/map.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/map.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mtd/map.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/map.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/mtd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/mtd.h
deleted file mode 120000
index 7821ca4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/mtd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/mtd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/mtd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/mtd.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mtd/mtd.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/mtd.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/nand.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/nand.h
deleted file mode 120000
index 00fe26e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/nand.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/nand.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/nand.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/nand.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mtd/nand.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/nand.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/nand_ecc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/nand_ecc.h
deleted file mode 120000
index 3c780f2..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/nand_ecc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/nand_ecc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/nand_ecc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/nand_ecc.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mtd/nand_ecc.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/nand_ecc.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/nftl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/nftl.h
deleted file mode 120000
index b68add4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/nftl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/nftl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/nftl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/nftl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mtd/nftl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/nftl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/onenand_regs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/onenand_regs.h
deleted file mode 120000
index cf98f5e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/onenand_regs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/onenand_regs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/onenand_regs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/onenand_regs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mtd/onenand_regs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/onenand_regs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/partitions.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/partitions.h
deleted file mode 120000
index 1943ac4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/partitions.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/partitions.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/partitions.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/partitions.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mtd/partitions.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtd/partitions.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtio.h
deleted file mode 120000
index e4a665b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mtio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtio.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mtio.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mtio.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mutex-debug.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mutex-debug.h
deleted file mode 120000
index b03b89e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mutex-debug.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mutex-debug.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mutex-debug.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mutex-debug.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mutex-debug.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mutex-debug.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mutex.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mutex.h
deleted file mode 120000
index adaf51c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mutex.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mutex.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/mutex.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/mutex.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/mutex.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/mutex.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ncp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ncp.h
deleted file mode 120000
index 36de989..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ncp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ncp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ncp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ncp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ncp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ncp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ncp_mount.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ncp_mount.h
deleted file mode 120000
index d8e6b48..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ncp_mount.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ncp_mount.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ncp_mount.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ncp_mount.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ncp_mount.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ncp_mount.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ncp_no.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ncp_no.h
deleted file mode 120000
index 4e59a2b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ncp_no.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ncp_no.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ncp_no.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ncp_no.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ncp_no.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ncp_no.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/net.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/net.h
deleted file mode 120000
index 9ff68ce..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/net.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/net.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/net.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/net.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/net.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/net.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netdevice.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netdevice.h
deleted file mode 120000
index 103b2df..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netdevice.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/netdevice.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netdevice.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netdevice.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netdevice.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netdevice.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter.h
deleted file mode 120000
index 81c9328..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/netfilter.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_common.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_common.h
deleted file mode 120000
index 840faca..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_common.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/nf_conntrack_common.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_common.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_common.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_common.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_common.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_ftp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_ftp.h
deleted file mode 120000
index 3a8e544..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_ftp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/nf_conntrack_ftp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_ftp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_ftp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_ftp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_ftp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_sctp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_sctp.h
deleted file mode 120000
index 17c5b25..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_sctp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/nf_conntrack_sctp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_sctp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_sctp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_sctp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_sctp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_tcp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_tcp.h
deleted file mode 120000
index 483187d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_tcp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/nf_conntrack_tcp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_tcp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_tcp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_tcp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_tcp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_tuple_common.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_tuple_common.h
deleted file mode 120000
index 2335e58..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_tuple_common.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/nf_conntrack_tuple_common.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_tuple_common.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_tuple_common.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_tuple_common.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nf_conntrack_tuple_common.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nfnetlink.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nfnetlink.h
deleted file mode 120000
index 434215d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nfnetlink.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/nfnetlink.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/nfnetlink.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nfnetlink.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/nfnetlink.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nfnetlink.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nfnetlink_conntrack.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nfnetlink_conntrack.h
deleted file mode 120000
index 87cc812..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nfnetlink_conntrack.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/nfnetlink_conntrack.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/nfnetlink_conntrack.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nfnetlink_conntrack.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/nfnetlink_conntrack.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/nfnetlink_conntrack.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/x_tables.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/x_tables.h
deleted file mode 120000
index d2b9746..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/x_tables.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/x_tables.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/x_tables.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/x_tables.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/x_tables.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/x_tables.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_CLASSIFY.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_CLASSIFY.h
deleted file mode 120000
index a3b868a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_CLASSIFY.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_CLASSIFY.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_CLASSIFY.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_CLASSIFY.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_CLASSIFY.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_CLASSIFY.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_CONNSECMARK.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_CONNSECMARK.h
deleted file mode 120000
index 725dafb..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_CONNSECMARK.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_CONNSECMARK.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_CONNSECMARK.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_CONNSECMARK.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_CONNSECMARK.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_CONNSECMARK.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_NFQUEUE.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_NFQUEUE.h
deleted file mode 120000
index 851f571..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_NFQUEUE.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_NFQUEUE.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_NFQUEUE.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_NFQUEUE.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_NFQUEUE.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_NFQUEUE.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_SECMARK.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_SECMARK.h
deleted file mode 120000
index 02dfc1b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_SECMARK.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_SECMARK.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_SECMARK.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_SECMARK.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_SECMARK.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_SECMARK.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_comment.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_comment.h
deleted file mode 120000
index 141f426..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_comment.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_comment.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_comment.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_comment.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_comment.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_comment.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_connbytes.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_connbytes.h
deleted file mode 120000
index 7e67ee9..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_connbytes.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_connbytes.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_connbytes.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_connbytes.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_connbytes.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_connbytes.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_conntrack.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_conntrack.h
deleted file mode 120000
index 04a1729..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_conntrack.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_conntrack.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_conntrack.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_conntrack.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_conntrack.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_conntrack.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_dccp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_dccp.h
deleted file mode 120000
index 6bdc874..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_dccp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_dccp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_dccp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_dccp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_dccp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_dccp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_esp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_esp.h
deleted file mode 120000
index a27d0cc..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_esp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_esp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_esp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_esp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_esp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_esp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_helper.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_helper.h
deleted file mode 120000
index 6b958db..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_helper.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_helper.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_helper.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_helper.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_helper.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_helper.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_length.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_length.h
deleted file mode 120000
index 680ef6b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_length.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_length.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_length.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_length.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_length.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_length.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_limit.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_limit.h
deleted file mode 120000
index 24bce98..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_limit.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_limit.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_limit.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_limit.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_limit.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_limit.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_mac.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_mac.h
deleted file mode 120000
index 24af1fc..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_mac.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_mac.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_mac.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_mac.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_mac.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_mac.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_multiport.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_multiport.h
deleted file mode 120000
index 80b337d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_multiport.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_multiport.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_multiport.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_multiport.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_multiport.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_multiport.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_physdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_physdev.h
deleted file mode 120000
index c6ad18c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_physdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_physdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_physdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_physdev.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_physdev.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_physdev.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_pkttype.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_pkttype.h
deleted file mode 120000
index 3551c0d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_pkttype.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_pkttype.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_pkttype.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_pkttype.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_pkttype.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_pkttype.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_quota.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_quota.h
deleted file mode 120000
index fc9f8b0..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_quota.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_quota.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_quota.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_quota.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_quota.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_quota.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_realm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_realm.h
deleted file mode 120000
index 7c0e5f6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_realm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_realm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_realm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_realm.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_realm.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_realm.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_sctp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_sctp.h
deleted file mode 120000
index cede7c7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_sctp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_sctp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_sctp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_sctp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_sctp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_sctp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_state.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_state.h
deleted file mode 120000
index 3f2ee91..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_state.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_state.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_state.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_state.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_state.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_state.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_statistic.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_statistic.h
deleted file mode 120000
index dc1fe25..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_statistic.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_statistic.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_statistic.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_statistic.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_statistic.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_statistic.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_string.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_string.h
deleted file mode 120000
index c19bebe..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_string.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_string.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_string.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_string.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_string.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_string.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_tcpmss.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_tcpmss.h
deleted file mode 120000
index 90cf9d5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_tcpmss.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_tcpmss.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_tcpmss.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_tcpmss.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_tcpmss.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_tcpmss.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_tcpudp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_tcpudp.h
deleted file mode 120000
index 4e3f6b5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_tcpudp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_tcpudp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_tcpudp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_tcpudp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_tcpudp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter/xt_tcpudp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_arp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_arp.h
deleted file mode 120000
index e6172ef..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_arp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/netfilter_arp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_arp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_arp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_arp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_arp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_arp/arp_tables.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_arp/arp_tables.h
deleted file mode 120000
index b31b8c2..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_arp/arp_tables.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_arp/arp_tables.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_arp/arp_tables.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_arp/arp_tables.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_arp/arp_tables.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_arp/arp_tables.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_bridge.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_bridge.h
deleted file mode 120000
index f582040..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_bridge.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/netfilter_bridge.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_bridge.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_bridge.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_bridge.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_bridge.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4.h
deleted file mode 120000
index 1daca65..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/netfilter_ipv4.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack.h
deleted file mode 120000
index 841b2e9..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ip_conntrack.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_conntrack.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_conntrack.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
deleted file mode 120000
index 109ccef..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat.h
deleted file mode 120000
index 9b17b22..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ip_nat.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_nat.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_nat.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat_rule.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat_rule.h
deleted file mode 120000
index fe78e7f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat_rule.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ip_nat_rule.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_nat_rule.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat_rule.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_nat_rule.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat_rule.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_queue.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_queue.h
deleted file mode 120000
index 3ea52ca..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_queue.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ip_queue.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_queue.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_queue.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_queue.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_queue.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_tables.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_tables.h
deleted file mode 120000
index 0f8460d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_tables.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ip_tables.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_tables.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_tables.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_tables.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ip_tables.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
deleted file mode 120000
index f908438..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_CLASSIFY.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_DSCP.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_DSCP.h
deleted file mode 120000
index 29058d2..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_DSCP.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_DSCP.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_DSCP.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_DSCP.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_DSCP.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_DSCP.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ECN.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ECN.h
deleted file mode 120000
index fc1128c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ECN.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_ECN.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_ECN.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ECN.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_ECN.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ECN.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_LOG.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_LOG.h
deleted file mode 120000
index b5dbb55..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_LOG.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_LOG.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_LOG.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_LOG.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_LOG.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_LOG.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
deleted file mode 120000
index 3686206..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_NFQUEUE.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_REJECT.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_REJECT.h
deleted file mode 120000
index b3f1023..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_REJECT.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_REJECT.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_REJECT.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_REJECT.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_REJECT.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_REJECT.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h
deleted file mode 120000
index fd24f6a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_TCPMSS.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_TCPMSS.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_TCPMSS.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TOS.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TOS.h
deleted file mode 120000
index bb1a243..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TOS.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_TOS.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_TOS.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TOS.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_TOS.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TOS.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TTL.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TTL.h
deleted file mode 120000
index 0ad1303..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TTL.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_TTL.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_TTL.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TTL.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_TTL.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TTL.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ULOG.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ULOG.h
deleted file mode 120000
index 9cc45e5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ULOG.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_ULOG.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_ULOG.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ULOG.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_ULOG.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ULOG.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_addrtype.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_addrtype.h
deleted file mode 120000
index 3b37d0b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_addrtype.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_addrtype.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_addrtype.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_addrtype.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_addrtype.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_addrtype.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ah.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ah.h
deleted file mode 120000
index 4b846fa..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ah.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_ah.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_ah.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ah.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_ah.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ah.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_comment.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_comment.h
deleted file mode 120000
index 96a07ea..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_comment.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_comment.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_comment.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_comment.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_comment.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_comment.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_connbytes.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_connbytes.h
deleted file mode 120000
index 76120e8..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_connbytes.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_connbytes.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_connbytes.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_connbytes.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_connbytes.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_connbytes.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dccp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dccp.h
deleted file mode 120000
index 9be071c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dccp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_dccp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_dccp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dccp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_dccp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dccp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dscp_.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dscp_.h
deleted file mode 120000
index 75879c3..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dscp_.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_dscp_.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_dscp_.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dscp_.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_dscp_.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dscp_.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_esp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_esp.h
deleted file mode 120000
index 9830294..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_esp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_esp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_esp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_esp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_esp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_esp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h
deleted file mode 120000
index 67cbcc1..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_hashlimit.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_hashlimit.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_hashlimit.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_helper.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_helper.h
deleted file mode 120000
index b7039dc..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_helper.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_helper.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_helper.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_helper.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_helper.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_helper.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_iprange.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_iprange.h
deleted file mode 120000
index d225d28..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_iprange.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_iprange.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_iprange.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_iprange.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_iprange.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_iprange.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_length.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_length.h
deleted file mode 120000
index 268a39e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_length.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_length.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_length.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_length.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_length.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_length.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_mac.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_mac.h
deleted file mode 120000
index f3cae5b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_mac.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_mac.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_mac.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_mac.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_mac.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_mac.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_owner.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_owner.h
deleted file mode 120000
index b082109..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_owner.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_owner.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_owner.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_owner.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_owner.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_owner.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_physdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_physdev.h
deleted file mode 120000
index 47258d4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_physdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_physdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_physdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_physdev.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_physdev.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_physdev.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_pkttype.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_pkttype.h
deleted file mode 120000
index dc938c1..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_pkttype.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_pkttype.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_pkttype.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_pkttype.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_pkttype.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_pkttype.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_realm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_realm.h
deleted file mode 120000
index c07b56d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_realm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_realm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_realm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_realm.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_realm.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_realm.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_recent.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_recent.h
deleted file mode 120000
index 531cb56..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_recent.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_recent.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_recent.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_recent.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_recent.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_recent.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_sctp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_sctp.h
deleted file mode 120000
index 341f347..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_sctp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_sctp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_sctp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_sctp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_sctp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_sctp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_state.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_state.h
deleted file mode 120000
index da5187b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_state.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_state.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_state.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_state.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_state.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_state.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_string.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_string.h
deleted file mode 120000
index 12d23d4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_string.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_string.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_string.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_string.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_string.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_string.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_tos_.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_tos_.h
deleted file mode 120000
index 35348cc..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_tos_.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_tos_.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_tos_.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_tos_.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_tos_.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv4/ipt_tos_.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6.h
deleted file mode 120000
index 0a37d5b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/netfilter_ipv6.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6_tables.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6_tables.h
deleted file mode 120000
index dbabff2..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6_tables.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6_tables.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6_tables.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6_tables.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6_tables.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6_tables.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_LOG.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_LOG.h
deleted file mode 120000
index c7b27c9..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_LOG.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_LOG.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_LOG.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_LOG.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_LOG.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_LOG.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h
deleted file mode 120000
index fcee66d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_REJECT.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_REJECT.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_REJECT.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ah.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ah.h
deleted file mode 120000
index 79151b0..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ah.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_ah.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_ah.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ah.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_ah.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ah.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_esp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_esp.h
deleted file mode 120000
index 4f116b7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_esp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_esp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_esp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_esp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_esp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_esp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_frag.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_frag.h
deleted file mode 120000
index 7375205..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_frag.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_frag.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_frag.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_frag.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_frag.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_frag.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h
deleted file mode 120000
index d3bc0ae..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_ipv6header.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_ipv6header.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_ipv6header.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_length.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_length.h
deleted file mode 120000
index cc583e5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_length.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_length.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_length.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_length.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_length.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_length.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_mac.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_mac.h
deleted file mode 120000
index edb21e3..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_mac.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_mac.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_mac.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_mac.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_mac.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_mac.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_opts.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_opts.h
deleted file mode 120000
index 7dd0aec..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_opts.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_opts.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_opts.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_opts.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_opts.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_opts.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_owner.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_owner.h
deleted file mode 120000
index cd6bbca..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_owner.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_owner.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_owner.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_owner.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_owner.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_owner.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_physdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_physdev.h
deleted file mode 120000
index 72d42c8..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_physdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_physdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_physdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_physdev.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_physdev.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_physdev.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_rt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_rt.h
deleted file mode 120000
index 0ade394..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_rt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_rt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_rt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_rt.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_rt.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_rt.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netlink.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netlink.h
deleted file mode 120000
index 91610b8..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netlink.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/netlink.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/netlink.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/netlink.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/netlink.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/netlink.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs.h
deleted file mode 120000
index a055478..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nfs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nfs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs2.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs2.h
deleted file mode 120000
index c3a9509..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs2.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nfs2.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfs2.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs2.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nfs2.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs2.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs3.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs3.h
deleted file mode 120000
index 4cd8d7a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs3.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nfs3.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfs3.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs3.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nfs3.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs3.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs4.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs4.h
deleted file mode 120000
index 4649859..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs4.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nfs4.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfs4.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs4.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nfs4.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs4.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs_xdr.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs_xdr.h
deleted file mode 120000
index 2f6de25..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs_xdr.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nfs_xdr.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfs_xdr.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs_xdr.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nfs_xdr.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfs_xdr.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsacl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsacl.h
deleted file mode 120000
index c44aa13..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsacl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nfsacl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsacl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsacl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nfsacl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsacl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/auth.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/auth.h
deleted file mode 120000
index f68aa51..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/auth.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/auth.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/auth.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/auth.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nfsd/auth.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/auth.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/const.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/const.h
deleted file mode 120000
index fe65cf4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/const.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/const.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/const.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/const.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nfsd/const.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/const.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/debug.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/debug.h
deleted file mode 120000
index 789ca95..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/debug.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/debug.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/debug.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/debug.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nfsd/debug.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/debug.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/export.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/export.h
deleted file mode 120000
index 811763b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/export.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/export.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/export.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/export.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nfsd/export.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/export.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/interface.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/interface.h
deleted file mode 120000
index b19512d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/interface.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/interface.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/interface.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/interface.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nfsd/interface.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/interface.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/nfsfh.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/nfsfh.h
deleted file mode 120000
index 9f3e60d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/nfsfh.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/nfsfh.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/nfsfh.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/nfsfh.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nfsd/nfsfh.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/nfsfh.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/stats.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/stats.h
deleted file mode 120000
index 744e2fb..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/stats.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/stats.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/stats.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/stats.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nfsd/stats.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/stats.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/xdr.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/xdr.h
deleted file mode 120000
index 46d7928..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/xdr.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/xdr.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/xdr.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/xdr.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nfsd/xdr.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nfsd/xdr.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/node.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/node.h
deleted file mode 120000
index e67c59f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/node.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/node.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/node.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/node.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/node.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/node.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nodemask.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nodemask.h
deleted file mode 120000
index 356c720..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nodemask.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nodemask.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nodemask.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nodemask.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nodemask.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nodemask.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/notifier.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/notifier.h
deleted file mode 120000
index a0dfdcf..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/notifier.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/notifier.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/notifier.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/notifier.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/notifier.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/notifier.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/numa.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/numa.h
deleted file mode 120000
index f0549f0..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/numa.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/numa.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/numa.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/numa.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/numa.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/numa.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nvram.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nvram.h
deleted file mode 120000
index e2bce31..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nvram.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nvram.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/nvram.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/nvram.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/nvram.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/nvram.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/omap_csmi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/omap_csmi.h
deleted file mode 120000
index 0d2c516..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/omap_csmi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/omap_csmi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/omap_csmi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/omap_csmi.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/omap_csmi.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/omap_csmi.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pagemap.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pagemap.h
deleted file mode 120000
index 3545504..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pagemap.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pagemap.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/pagemap.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pagemap.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/pagemap.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/pagemap.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/param.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/param.h
deleted file mode 120000
index edd8f98..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/param.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/param.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/param.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/param.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/param.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/param.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/patchkey.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/patchkey.h
deleted file mode 120000
index 628a75c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/patchkey.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/patchkey.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/patchkey.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/patchkey.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/patchkey.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/patchkey.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pci.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pci.h
deleted file mode 120000
index 22b0ec7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pci.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pci.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/pci.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pci.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/pci.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/pci.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pci_ids.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pci_ids.h
deleted file mode 120000
index c3475fb..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pci_ids.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pci_ids.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/pci_ids.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pci_ids.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/pci_ids.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/pci_ids.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pci_regs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pci_regs.h
deleted file mode 120000
index 853c226..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pci_regs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pci_regs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/pci_regs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pci_regs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/pci_regs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/pci_regs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/percpu.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/percpu.h
deleted file mode 120000
index 93d6b27..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/percpu.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/percpu.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/percpu.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/percpu.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/percpu.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/percpu.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/percpu_counter.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/percpu_counter.h
deleted file mode 120000
index 6c839d4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/percpu_counter.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/percpu_counter.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/percpu_counter.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/percpu_counter.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/percpu_counter.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/percpu_counter.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/personality.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/personality.h
deleted file mode 120000
index 0d6b659..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/personality.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/personality.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/personality.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/personality.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/personality.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/personality.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pfkeyv2.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pfkeyv2.h
deleted file mode 120000
index 321bbb6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pfkeyv2.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pfkeyv2.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/pfkeyv2.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pfkeyv2.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/pfkeyv2.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/pfkeyv2.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pkt_cls.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pkt_cls.h
deleted file mode 120000
index 58e8899..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pkt_cls.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pkt_cls.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/pkt_cls.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pkt_cls.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/pkt_cls.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/pkt_cls.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pkt_sched.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pkt_sched.h
deleted file mode 120000
index 77b5a47..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pkt_sched.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pkt_sched.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/pkt_sched.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pkt_sched.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/pkt_sched.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/pkt_sched.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/platform_device.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/platform_device.h
deleted file mode 120000
index baa7b55..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/platform_device.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/platform_device.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/platform_device.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/platform_device.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/platform_device.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/platform_device.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/plist.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/plist.h
deleted file mode 120000
index 4d4e542..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/plist.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/plist.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/plist.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/plist.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/plist.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/plist.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pm.h
deleted file mode 120000
index 1a4339e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/pm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pm.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/pm.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/pm.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pnp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pnp.h
deleted file mode 120000
index d7e1bb9..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pnp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pnp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/pnp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/pnp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/pnp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/pnp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/poll.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/poll.h
deleted file mode 120000
index 23c4b3f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/poll.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/poll.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/poll.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/poll.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/poll.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/poll.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/posix_acl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/posix_acl.h
deleted file mode 120000
index 29ae7cd..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/posix_acl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/posix_acl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/posix_acl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/posix_acl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/posix_acl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/posix_acl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/posix_types.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/posix_types.h
deleted file mode 120000
index bcbcf00..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/posix_types.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/posix_types.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/posix_types.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/posix_types.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/posix_types.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/posix_types.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ppdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ppdev.h
deleted file mode 120000
index 3b386a6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ppdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ppdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ppdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ppdev.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ppdev.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ppdev.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ppp_defs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ppp_defs.h
deleted file mode 120000
index 309a3d0..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ppp_defs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ppp_defs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ppp_defs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ppp_defs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ppp_defs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ppp_defs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/prctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/prctl.h
deleted file mode 120000
index 8bbe96c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/prctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/prctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/prctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/prctl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/prctl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/prctl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/preempt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/preempt.h
deleted file mode 120000
index 9b59fe3..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/preempt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/preempt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/preempt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/preempt.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/preempt.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/preempt.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/proc_fs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/proc_fs.h
deleted file mode 120000
index 6d310c4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/proc_fs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/proc_fs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/proc_fs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/proc_fs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/proc_fs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/proc_fs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ptrace.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ptrace.h
deleted file mode 120000
index 2617a6c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ptrace.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ptrace.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ptrace.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ptrace.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ptrace.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ptrace.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/qic117.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/qic117.h
deleted file mode 120000
index 7223064..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/qic117.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/qic117.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/qic117.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/qic117.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/qic117.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/qic117.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/qnxtypes.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/qnxtypes.h
deleted file mode 120000
index 5c767a3..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/qnxtypes.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/qnxtypes.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/qnxtypes.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/qnxtypes.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/qnxtypes.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/qnxtypes.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/quota.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/quota.h
deleted file mode 120000
index ed68365..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/quota.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/quota.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/quota.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/quota.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/quota.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/quota.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md.h
deleted file mode 120000
index e8599ef..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/raid/md.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/raid/md.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/raid/md.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md_k.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md_k.h
deleted file mode 120000
index 20f8ca6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md_k.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/raid/md_k.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/raid/md_k.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md_k.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/raid/md_k.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md_k.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md_p.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md_p.h
deleted file mode 120000
index f631a38..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md_p.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/raid/md_p.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/raid/md_p.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md_p.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/raid/md_p.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md_p.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md_u.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md_u.h
deleted file mode 120000
index 931271c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md_u.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/raid/md_u.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/raid/md_u.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md_u.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/raid/md_u.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/md_u.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/xor.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/xor.h
deleted file mode 120000
index b02a69a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/xor.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/raid/xor.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/raid/xor.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/xor.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/raid/xor.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/raid/xor.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/random.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/random.h
deleted file mode 120000
index 0088784..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/random.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/random.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/random.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/random.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/random.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/random.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rbtree.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rbtree.h
deleted file mode 120000
index f606d94..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rbtree.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/rbtree.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/rbtree.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rbtree.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/rbtree.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/rbtree.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rcupdate.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rcupdate.h
deleted file mode 120000
index e93235d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rcupdate.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/rcupdate.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/rcupdate.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rcupdate.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/rcupdate.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/rcupdate.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/reboot.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/reboot.h
deleted file mode 120000
index c3b86f4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/reboot.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/reboot.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/reboot.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/reboot.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/reboot.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/reboot.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/relay.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/relay.h
deleted file mode 120000
index c354e19..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/relay.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/relay.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/relay.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/relay.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/relay.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/relay.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/resource.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/resource.h
deleted file mode 120000
index 80a9f86..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/resource.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/resource.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/resource.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/resource.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/resource.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/resource.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/route.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/route.h
deleted file mode 120000
index c81b220..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/route.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/route.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/route.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/route.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/route.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/route.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rtc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rtc.h
deleted file mode 120000
index eaeecd3..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rtc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/rtc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/rtc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rtc.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/rtc.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/rtc.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rtnetlink.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rtnetlink.h
deleted file mode 120000
index 064a3d2..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rtnetlink.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/rtnetlink.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/rtnetlink.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rtnetlink.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/rtnetlink.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/rtnetlink.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rwsem.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rwsem.h
deleted file mode 120000
index 68eab47..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rwsem.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/rwsem.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/rwsem.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/rwsem.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/rwsem.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/rwsem.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sched.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sched.h
deleted file mode 120000
index e8ff88b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sched.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/sched.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sched.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sched.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sched.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sched.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sem.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sem.h
deleted file mode 120000
index 5348418..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sem.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/sem.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sem.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sem.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sem.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sem.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/seq_file.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/seq_file.h
deleted file mode 120000
index 2c25e6c..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/seq_file.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/seq_file.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/seq_file.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/seq_file.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/seq_file.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/seq_file.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/seqlock.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/seqlock.h
deleted file mode 120000
index 345108e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/seqlock.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/seqlock.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/seqlock.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/seqlock.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/seqlock.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/seqlock.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/serial_core.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/serial_core.h
deleted file mode 120000
index be40c9a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/serial_core.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/serial_core.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/serial_core.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/serial_core.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/serial_core.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/serial_core.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/serial_reg.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/serial_reg.h
deleted file mode 120000
index 60bd137..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/serial_reg.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/serial_reg.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/serial_reg.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/serial_reg.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/serial_reg.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/serial_reg.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/serio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/serio.h
deleted file mode 120000
index 4d3b062..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/serio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/serio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/serio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/serio.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/serio.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/serio.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/shm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/shm.h
deleted file mode 120000
index 4cd2df0..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/shm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/shm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/shm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/shm.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/shm.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/shm.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/signal.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/signal.h
deleted file mode 120000
index 10e9b01..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/signal.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/signal.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/signal.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/signal.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/signal.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/signal.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/skbuff.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/skbuff.h
deleted file mode 120000
index 5ff4983..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/skbuff.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/skbuff.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/skbuff.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/skbuff.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/skbuff.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/skbuff.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/slab.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/slab.h
deleted file mode 120000
index 04f089d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/slab.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/slab.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/slab.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/slab.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/slab.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/slab.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/smb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/smb.h
deleted file mode 120000
index 3f1cf22..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/smb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/smb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/smb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/smb.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/smb.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/smb.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/smp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/smp.h
deleted file mode 120000
index bfa5942..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/smp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/smp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/smp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/smp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/smp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/smp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/smp_lock.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/smp_lock.h
deleted file mode 120000
index 76d4cb0..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/smp_lock.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/smp_lock.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/smp_lock.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/smp_lock.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/smp_lock.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/smp_lock.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/socket.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/socket.h
deleted file mode 120000
index edc366f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/socket.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/socket.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/socket.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/socket.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/socket.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/socket.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sockios.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sockios.h
deleted file mode 120000
index 793adfb..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sockios.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/sockios.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sockios.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sockios.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sockios.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sockios.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/soundcard.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/soundcard.h
deleted file mode 120000
index ca37579..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/soundcard.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/soundcard.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/soundcard.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/soundcard.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/soundcard.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/soundcard.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock.h
deleted file mode 120000
index 305c46d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/spinlock.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/spinlock.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/spinlock.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_api_smp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_api_smp.h
deleted file mode 120000
index 45bfb4e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_api_smp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/spinlock_api_smp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/spinlock_api_smp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_api_smp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/spinlock_api_smp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_api_smp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_api_up.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_api_up.h
deleted file mode 120000
index b54532e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_api_up.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/spinlock_api_up.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/spinlock_api_up.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_api_up.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/spinlock_api_up.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_api_up.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_types.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_types.h
deleted file mode 120000
index 39611b7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_types.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/spinlock_types.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/spinlock_types.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_types.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/spinlock_types.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_types.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_types_up.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_types_up.h
deleted file mode 120000
index d5384d7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_types_up.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/spinlock_types_up.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/spinlock_types_up.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_types_up.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/spinlock_types_up.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_types_up.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_up.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_up.h
deleted file mode 120000
index 46b3c0e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_up.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/spinlock_up.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/spinlock_up.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_up.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/spinlock_up.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/spinlock_up.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stacktrace.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stacktrace.h
deleted file mode 120000
index 4c18232..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stacktrace.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/stacktrace.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/stacktrace.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stacktrace.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/stacktrace.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/stacktrace.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stat.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stat.h
deleted file mode 120000
index 842159b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stat.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/stat.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/stat.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stat.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/stat.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/stat.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/statfs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/statfs.h
deleted file mode 120000
index 4ac3b01..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/statfs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/statfs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/statfs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/statfs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/statfs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/statfs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stddef.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stddef.h
deleted file mode 120000
index 9b398f1..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stddef.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/stddef.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/stddef.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stddef.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/stddef.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/stddef.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/string.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/string.h
deleted file mode 120000
index 414748f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/string.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/string.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/string.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/string.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/string.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/string.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stringify.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stringify.h
deleted file mode 120000
index 44dd7ed..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stringify.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/stringify.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/stringify.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/stringify.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/stringify.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/stringify.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/auth.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/auth.h
deleted file mode 120000
index 1fbe34f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/auth.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/auth.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/auth.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/auth.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/auth.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/auth.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/auth_gss.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/auth_gss.h
deleted file mode 120000
index 7bc8ad1..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/auth_gss.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/auth_gss.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/auth_gss.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/auth_gss.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/auth_gss.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/auth_gss.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/clnt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/clnt.h
deleted file mode 120000
index 7f11a93..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/clnt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/clnt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/clnt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/clnt.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/clnt.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/clnt.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/debug.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/debug.h
deleted file mode 120000
index c95a429..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/debug.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/debug.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/debug.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/debug.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/debug.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/debug.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/gss_api.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/gss_api.h
deleted file mode 120000
index e10eba6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/gss_api.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/gss_api.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/gss_api.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/gss_api.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/gss_api.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/gss_api.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/gss_asn1.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/gss_asn1.h
deleted file mode 120000
index e860f8e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/gss_asn1.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/gss_asn1.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/gss_asn1.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/gss_asn1.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/gss_asn1.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/gss_asn1.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/gss_err.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/gss_err.h
deleted file mode 120000
index 72c7141..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/gss_err.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/gss_err.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/gss_err.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/gss_err.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/gss_err.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/gss_err.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/msg_prot.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/msg_prot.h
deleted file mode 120000
index d9cb9ae..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/msg_prot.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/msg_prot.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/msg_prot.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/msg_prot.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/msg_prot.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/msg_prot.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/sched.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/sched.h
deleted file mode 120000
index 84791a7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/sched.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/sched.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/sched.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/sched.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/sched.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/sched.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/stats.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/stats.h
deleted file mode 120000
index b115bd5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/stats.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/stats.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/stats.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/stats.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/stats.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/stats.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/svc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/svc.h
deleted file mode 120000
index 658a81e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/svc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/svc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/svc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/svc.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/svc.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/svc.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/svcauth.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/svcauth.h
deleted file mode 120000
index 8c3e841..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/svcauth.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/svcauth.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/svcauth.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/svcauth.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/svcauth.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/svcauth.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/timer.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/timer.h
deleted file mode 120000
index ce8709d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/timer.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/timer.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/timer.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/timer.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/timer.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/timer.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/types.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/types.h
deleted file mode 120000
index e7f7656..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/types.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/types.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/types.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/types.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/types.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/types.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/xdr.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/xdr.h
deleted file mode 120000
index 163e618..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/xdr.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/xdr.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/xdr.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/xdr.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/xdr.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/xdr.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/xprt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/xprt.h
deleted file mode 120000
index 6d29148..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/xprt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/xprt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/xprt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/xprt.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sunrpc/xprt.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sunrpc/xprt.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/swap.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/swap.h
deleted file mode 120000
index 47db73a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/swap.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/swap.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/swap.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/swap.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/swap.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/swap.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sysctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sysctl.h
deleted file mode 120000
index 1252a53..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sysctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/sysctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sysctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sysctl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sysctl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sysctl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sysdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sysdev.h
deleted file mode 120000
index 6691343..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sysdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/sysdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sysdev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sysdev.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sysdev.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sysdev.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sysfs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sysfs.h
deleted file mode 120000
index 0cbaad8..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sysfs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/sysfs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/sysfs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/sysfs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/sysfs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/sysfs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/taskstats.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/taskstats.h
deleted file mode 120000
index 24a178e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/taskstats.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/taskstats.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/taskstats.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/taskstats.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/taskstats.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/taskstats.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/taskstats_kern.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/taskstats_kern.h
deleted file mode 120000
index 20b2c64..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/taskstats_kern.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/taskstats_kern.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/taskstats_kern.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/taskstats_kern.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/taskstats_kern.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/taskstats_kern.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/tcp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/tcp.h
deleted file mode 120000
index 417237a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/tcp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/tcp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/tcp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/tcp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/tcp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/tcp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/telephony.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/telephony.h
deleted file mode 120000
index 44b4c18..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/telephony.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/telephony.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/telephony.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/telephony.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/telephony.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/telephony.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/termios.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/termios.h
deleted file mode 120000
index 968db97..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/termios.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/termios.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/termios.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/termios.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/termios.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/termios.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/textsearch.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/textsearch.h
deleted file mode 120000
index e033273..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/textsearch.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/textsearch.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/textsearch.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/textsearch.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/textsearch.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/textsearch.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/thread_info.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/thread_info.h
deleted file mode 120000
index 11a1011..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/thread_info.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/thread_info.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/thread_info.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/thread_info.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/thread_info.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/thread_info.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/threads.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/threads.h
deleted file mode 120000
index ef3237e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/threads.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/threads.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/threads.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/threads.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/threads.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/threads.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/time.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/time.h
deleted file mode 120000
index 2060843..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/time.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/time.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/time.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/time.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/time.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/time.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/timer.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/timer.h
deleted file mode 120000
index f81d907..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/timer.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/timer.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/timer.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/timer.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/timer.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/timer.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/times.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/times.h
deleted file mode 120000
index 8757201..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/times.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/times.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/times.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/times.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/times.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/times.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/timex.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/timex.h
deleted file mode 120000
index 49e520b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/timex.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/timex.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/timex.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/timex.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/timex.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/timex.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/tiocl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/tiocl.h
deleted file mode 120000
index ae6102b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/tiocl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/tiocl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/tiocl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/tiocl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/tiocl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/tiocl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/transport_class.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/transport_class.h
deleted file mode 120000
index 735b69b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/transport_class.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/transport_class.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/transport_class.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/transport_class.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/transport_class.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/transport_class.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/tty.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/tty.h
deleted file mode 120000
index 4e874bf..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/tty.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/tty.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/tty.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/tty.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/tty.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/tty.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/types.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/types.h
deleted file mode 120000
index 76b2511..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/types.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/types.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/types.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/types.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/types.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/types.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/udp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/udp.h
deleted file mode 120000
index 14ee4b2..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/udp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/udp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/udp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/udp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/udp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/udp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ufs_fs_i.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ufs_fs_i.h
deleted file mode 120000
index de767a7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ufs_fs_i.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ufs_fs_i.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ufs_fs_i.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ufs_fs_i.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ufs_fs_i.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ufs_fs_i.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ufs_fs_sb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ufs_fs_sb.h
deleted file mode 120000
index a78b9d3..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ufs_fs_sb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ufs_fs_sb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/ufs_fs_sb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/ufs_fs_sb.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/ufs_fs_sb.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/ufs_fs_sb.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/uio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/uio.h
deleted file mode 120000
index 95a105d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/uio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/uio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/uio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/uio.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/uio.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/uio.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/un.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/un.h
deleted file mode 120000
index 6d51e94..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/un.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/un.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/un.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/un.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/un.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/un.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/unistd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/unistd.h
deleted file mode 120000
index 7ef4a0d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/unistd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/unistd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/unistd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/unistd.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/unistd.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/unistd.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/usb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/usb.h
deleted file mode 120000
index 7da27d7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/usb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/usb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/usb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/usb.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/usb.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/usb.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/usb_ch9.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/usb_ch9.h
deleted file mode 120000
index d8a2655..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/usb_ch9.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/usb_ch9.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/usb_ch9.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/usb_ch9.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/usb_ch9.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/usb_ch9.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/usbdevice_fs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/usbdevice_fs.h
deleted file mode 120000
index b4c8de8..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/usbdevice_fs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/usbdevice_fs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/usbdevice_fs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/usbdevice_fs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/usbdevice_fs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/usbdevice_fs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/user.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/user.h
deleted file mode 120000
index 2bb072e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/user.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/user.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/user.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/user.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/user.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/user.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/utime.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/utime.h
deleted file mode 120000
index c483c28..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/utime.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/utime.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/utime.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/utime.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/utime.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/utime.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/utsname.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/utsname.h
deleted file mode 120000
index 8b0a098..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/utsname.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/utsname.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/utsname.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/utsname.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/utsname.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/utsname.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/version.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/version.h
deleted file mode 120000
index cb2ac62..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/version.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/version.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/version.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/version.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/version.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/version.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vfs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vfs.h
deleted file mode 120000
index b815962..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vfs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/vfs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/vfs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vfs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/vfs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/vfs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/videodev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/videodev.h
deleted file mode 120000
index 33e8651..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/videodev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/videodev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/videodev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/videodev.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/videodev.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/videodev.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/videodev2.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/videodev2.h
deleted file mode 120000
index 9127b40..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/videodev2.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/videodev2.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/videodev2.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/videodev2.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/videodev2.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/videodev2.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vmalloc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vmalloc.h
deleted file mode 120000
index 90410fc..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vmalloc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/vmalloc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/vmalloc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vmalloc.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/vmalloc.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/vmalloc.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vt.h
deleted file mode 120000
index 5f1333a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/vt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/vt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vt.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/vt.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/vt.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vt_buffer.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vt_buffer.h
deleted file mode 120000
index babe241..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vt_buffer.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/vt_buffer.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/vt_buffer.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/vt_buffer.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/vt_buffer.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/vt_buffer.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/wait.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/wait.h
deleted file mode 120000
index ee2730b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/wait.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/wait.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/wait.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/wait.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/wait.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/wait.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/wanrouter.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/wanrouter.h
deleted file mode 120000
index 1d1b8f1..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/wanrouter.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/wanrouter.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/wanrouter.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/wanrouter.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/wanrouter.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/wanrouter.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/wireless.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/wireless.h
deleted file mode 120000
index 43983b5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/wireless.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/wireless.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/wireless.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/wireless.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/wireless.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/wireless.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/workqueue.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/workqueue.h
deleted file mode 120000
index 3ce0512..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/workqueue.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/workqueue.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/workqueue.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/workqueue.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/workqueue.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/workqueue.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/xattr.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/xattr.h
deleted file mode 120000
index 8cf8b0b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/xattr.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/xattr.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/xattr.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/xattr.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/xattr.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/xattr.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/zconf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/zconf.h
deleted file mode 120000
index 4dc29e6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/zconf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/zconf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/zconf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/zconf.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/zconf.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/zconf.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/zlib.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/zlib.h
deleted file mode 120000
index 9d45319..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/zlib.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/zlib.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/zlib.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/zlib.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/zlib.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/zlib.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/zorro_ids.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/zorro_ids.h
deleted file mode 120000
index f2220c0..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/linux/zorro_ids.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/zorro_ids.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/linux/zorro_ids.h b/ndk/build/platforms/android-3/arch-arm/usr/include/linux/zorro_ids.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/linux/zorro_ids.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/linux/zorro_ids.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/locale.h b/ndk/build/platforms/android-3/arch-arm/usr/include/locale.h
deleted file mode 120000
index 26247fd..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/locale.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/locale.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/locale.h b/ndk/build/platforms/android-3/arch-arm/usr/include/locale.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/locale.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/locale.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/malloc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/malloc.h
deleted file mode 120000
index 78a8006..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/malloc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/malloc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/malloc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/malloc.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/malloc.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/malloc.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/math.h b/ndk/build/platforms/android-3/arch-arm/usr/include/math.h
deleted file mode 120000
index 0d4bdcd..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/math.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/math.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/math.h b/ndk/build/platforms/android-3/arch-arm/usr/include/math.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/math.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/math.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/memory.h b/ndk/build/platforms/android-3/arch-arm/usr/include/memory.h
deleted file mode 120000
index 08375e2..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/memory.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/memory.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/memory.h b/ndk/build/platforms/android-3/arch-arm/usr/include/memory.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/memory.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/memory.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/mntent.h b/ndk/build/platforms/android-3/arch-arm/usr/include/mntent.h
deleted file mode 120000
index 43186c4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/mntent.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/mntent.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/mntent.h b/ndk/build/platforms/android-3/arch-arm/usr/include/mntent.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/mntent.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/mntent.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/mtd/mtd-abi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/mtd/mtd-abi.h
deleted file mode 120000
index 19a9a51..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/mtd/mtd-abi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/mtd/mtd-abi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/mtd/mtd-abi.h b/ndk/build/platforms/android-3/arch-arm/usr/include/mtd/mtd-abi.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/mtd/mtd-abi.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/mtd/mtd-abi.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/mtd/mtd-user.h b/ndk/build/platforms/android-3/arch-arm/usr/include/mtd/mtd-user.h
deleted file mode 120000
index e22b96b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/mtd/mtd-user.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/mtd/mtd-user.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/mtd/mtd-user.h b/ndk/build/platforms/android-3/arch-arm/usr/include/mtd/mtd-user.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/mtd/mtd-user.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/mtd/mtd-user.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/net/ethertypes.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/ethertypes.h
deleted file mode 120000
index 621864d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/net/ethertypes.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/ethertypes.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/net/ethertypes.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/ethertypes.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/net/ethertypes.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/net/ethertypes.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/net/if.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/if.h
deleted file mode 120000
index c83fdb9..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/net/if.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/if.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/net/if.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/if.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/net/if.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/net/if.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_arp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_arp.h
deleted file mode 120000
index e8e84bb..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_arp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/if_arp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/net/if_arp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_arp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/net/if_arp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/net/if_arp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_dl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_dl.h
deleted file mode 120000
index 1a27df4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_dl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/if_dl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/net/if_dl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_dl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/net/if_dl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/net/if_dl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_ether.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_ether.h
deleted file mode 120000
index 591c1db..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_ether.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/if_ether.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/net/if_ether.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_ether.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/net/if_ether.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/net/if_ether.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_ieee1394.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_ieee1394.h
deleted file mode 120000
index f0b13ce..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_ieee1394.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/if_ieee1394.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/net/if_ieee1394.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_ieee1394.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/net/if_ieee1394.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/net/if_ieee1394.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_packet.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_packet.h
deleted file mode 120000
index 4c5bd8d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_packet.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/if_packet.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/net/if_packet.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_packet.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/net/if_packet.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/net/if_packet.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_types.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_types.h
deleted file mode 120000
index 410430f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_types.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/if_types.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/net/if_types.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/if_types.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/net/if_types.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/net/if_types.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/net/route.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/route.h
deleted file mode 120000
index ea03206..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/net/route.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/route.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/net/route.h b/ndk/build/platforms/android-3/arch-arm/usr/include/net/route.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/net/route.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/net/route.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/netdb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netdb.h
deleted file mode 120000
index 67f7a2f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/netdb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/netdb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/netdb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netdb.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/netdb.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/netdb.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/ether.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/ether.h
deleted file mode 120000
index e331c47..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/ether.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/ether.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/netinet/ether.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/ether.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/netinet/ether.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/netinet/ether.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/if_ether.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/if_ether.h
deleted file mode 120000
index 5354bb5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/if_ether.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/if_ether.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/netinet/if_ether.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/if_ether.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/netinet/if_ether.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/netinet/if_ether.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/in.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/in.h
deleted file mode 120000
index 8439fe5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/in.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/in.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/netinet/in.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/in.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/netinet/in.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/netinet/in.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/in6.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/in6.h
deleted file mode 120000
index fa5937f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/in6.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/in6.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/netinet/in6.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/in6.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/netinet/in6.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/netinet/in6.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/in_systm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/in_systm.h
deleted file mode 120000
index ea70a33..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/in_systm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/in_systm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/netinet/in_systm.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/in_systm.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/netinet/in_systm.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/netinet/in_systm.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/ip.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/ip.h
deleted file mode 120000
index 3eb2097..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/ip.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/ip.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/netinet/ip.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/ip.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/netinet/ip.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/netinet/ip.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/ip_icmp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/ip_icmp.h
deleted file mode 120000
index 2c9024f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/ip_icmp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/ip_icmp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/netinet/ip_icmp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/ip_icmp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/netinet/ip_icmp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/netinet/ip_icmp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/tcp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/tcp.h
deleted file mode 120000
index 6b0d829..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/tcp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/tcp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/netinet/tcp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/tcp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/netinet/tcp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/netinet/tcp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/udp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/udp.h
deleted file mode 120000
index d5e0f6b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/udp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/udp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/netinet/udp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netinet/udp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/netinet/udp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/netinet/udp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/netpacket/packet.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netpacket/packet.h
deleted file mode 120000
index 7473ba4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/netpacket/packet.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netpacket/packet.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/netpacket/packet.h b/ndk/build/platforms/android-3/arch-arm/usr/include/netpacket/packet.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/netpacket/packet.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/netpacket/packet.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/new b/ndk/build/platforms/android-3/arch-arm/usr/include/new
deleted file mode 120000
index b3e4225..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/new
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/new
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/new b/ndk/build/platforms/android-3/arch-arm/usr/include/new
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/new
rename to ndk/build/platforms/android-3/arch-arm/usr/include/new
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/nsswitch.h b/ndk/build/platforms/android-3/arch-arm/usr/include/nsswitch.h
deleted file mode 120000
index 361ce34..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/nsswitch.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/nsswitch.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/nsswitch.h b/ndk/build/platforms/android-3/arch-arm/usr/include/nsswitch.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/nsswitch.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/nsswitch.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/pathconf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/pathconf.h
deleted file mode 120000
index f1c45ca..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/pathconf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/pathconf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/pathconf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/pathconf.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/pathconf.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/pathconf.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/paths.h b/ndk/build/platforms/android-3/arch-arm/usr/include/paths.h
deleted file mode 120000
index 04b00c0..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/paths.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/paths.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/paths.h b/ndk/build/platforms/android-3/arch-arm/usr/include/paths.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/paths.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/paths.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/poll.h b/ndk/build/platforms/android-3/arch-arm/usr/include/poll.h
deleted file mode 120000
index e260aad..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/poll.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/poll.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/poll.h b/ndk/build/platforms/android-3/arch-arm/usr/include/poll.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/poll.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/poll.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/pthread.h b/ndk/build/platforms/android-3/arch-arm/usr/include/pthread.h
deleted file mode 120000
index e7240fe..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/pthread.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/pthread.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/pthread.h b/ndk/build/platforms/android-3/arch-arm/usr/include/pthread.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/pthread.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/pthread.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/pwd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/pwd.h
deleted file mode 120000
index deefc65..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/pwd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/pwd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/pwd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/pwd.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/pwd.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/pwd.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/resolv.h b/ndk/build/platforms/android-3/arch-arm/usr/include/resolv.h
deleted file mode 120000
index 645cec6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/resolv.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/resolv.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/resolv.h b/ndk/build/platforms/android-3/arch-arm/usr/include/resolv.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/resolv.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/resolv.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sched.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sched.h
deleted file mode 120000
index 7eb75bc..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sched.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/sched.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sched.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sched.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sched.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sched.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/semaphore.h b/ndk/build/platforms/android-3/arch-arm/usr/include/semaphore.h
deleted file mode 120000
index 5981819..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/semaphore.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/semaphore.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/semaphore.h b/ndk/build/platforms/android-3/arch-arm/usr/include/semaphore.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/semaphore.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/semaphore.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/setjmp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/setjmp.h
deleted file mode 120000
index 927b88e3..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/setjmp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/setjmp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/setjmp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/setjmp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/setjmp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/setjmp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sgtty.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sgtty.h
deleted file mode 120000
index fcfac52..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sgtty.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/sgtty.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sgtty.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sgtty.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sgtty.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sgtty.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sha1.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sha1.h
deleted file mode 120000
index f4aadd2..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sha1.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/sha1.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sha1.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sha1.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sha1.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sha1.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/signal.h b/ndk/build/platforms/android-3/arch-arm/usr/include/signal.h
deleted file mode 120000
index 83e2e8e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/signal.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/signal.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/signal.h b/ndk/build/platforms/android-3/arch-arm/usr/include/signal.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/signal.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/signal.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/stdint.h b/ndk/build/platforms/android-3/arch-arm/usr/include/stdint.h
deleted file mode 120000
index 8b0dfbf..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/stdint.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/stdint.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/stdint.h b/ndk/build/platforms/android-3/arch-arm/usr/include/stdint.h
new file mode 100644
index 0000000..237baa2
--- /dev/null
+++ b/ndk/build/platforms/android-3/arch-arm/usr/include/stdint.h
@@ -0,0 +1,266 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _STDINT_H
+#define _STDINT_H
+
+#include <stddef.h>
+#include <sys/_types.h>
+
+
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
+#  define __STDINT_LIMITS
+#endif
+
+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
+#  define  __STDINT_MACROS
+#endif
+
+/* the definitions of STDINT_LIMITS depend on those of STDINT_MACROS */
+#if defined __STDINT_LIMITS && !defined __STDINT_MACROS
+#  define  __STDINT_MACROS
+#endif
+
+#if !defined __STRICT_ANSI__ || __STDC_VERSION__ >= 199901L
+#  define __STDC_INT64__
+#endif
+
+typedef __int8_t      int8_t;
+typedef __uint8_t     uint8_t;
+typedef __int16_t     int16_t;
+typedef __uint16_t    uint16_t;
+typedef __int32_t     int32_t;
+typedef __uint32_t    uint32_t;
+#if defined(__STDC_INT64__)
+typedef __int64_t     int64_t;
+typedef __uint64_t    uint64_t;
+#endif
+
+/*
+ * int8_t & uint8_t
+ */
+
+typedef int8_t        int_least8_t;
+typedef int8_t        int_fast8_t;
+
+typedef uint8_t       uint_least8_t;
+typedef uint8_t       uint_fast8_t;
+
+#ifdef __STDINT_LIMITS
+#  define INT8_MIN         (-128)
+#  define INT8_MAX         (127)
+#  define INT_LEAST8_MIN   INT8_MIN
+#  define INT_LEAST8_MAX   INT8_MAX
+#  define INT_FAST8_MIN    INT8_MIN
+#  define INT_FAST8_MAX    INT8_MAX
+
+#  define UINT8_MAX           (255U)
+#  define UINT_LEAST8_MAX     UINT8_MAX
+#  define UINT_FAST8_MAX      UINT8_MAX
+#endif
+
+#ifdef __STDINT_MACROS
+#  define INT8_C(c)	c
+#  define INT_LEAST8_C(c)	 INT8_C(c)
+#  define INT_FAST8_C(c)	INT8_C(c)
+
+#  define UINT8_C(c)	c ## U
+#  define UINT_LEAST8_C(c)  UINT8_C(c)
+#  define UINT_FAST8_C(c)  UINT8_C(c)
+#endif
+
+/*
+ * int16_t & uint16_t
+ */
+
+
+typedef int16_t       int_least16_t;
+typedef int32_t       int_fast16_t;
+
+typedef uint16_t      uint_least16_t;
+typedef uint32_t      uint_fast16_t;
+
+#ifdef __STDINT_LIMITS
+#  define INT16_MIN	(-32768)
+#  define INT16_MAX	(32767)
+#  define INT_LEAST16_MIN	INT16_MIN
+#  define INT_LEAST16_MAX	INT16_MAX
+#  define INT_FAST16_MIN	INT32_MIN
+#  define INT_FAST16_MAX	INT32_MAX
+
+#  define UINT16_MAX	(65535U)
+#  define UINT_LEAST16_MAX UINT16_MAX
+#  define UINT_FAST16_MAX UINT32_MAX
+#endif
+
+#ifdef __STDINT_MACROS
+#  define INT16_C(c)	c
+#  define INT_LEAST16_C(c) INT16_C(c)
+#  define INT_FAST16_C(c)	 INT32_C(c)
+
+#  define UINT16_C(c)	c ## U
+#  define UINT_LEAST16_C(c) UINT16_C(c)
+#  define UINT_FAST16_C(c) UINT32_C(c)
+#endif
+
+/*
+ * int32_t & uint32_t
+ */
+
+typedef int32_t       int_least32_t;
+typedef int32_t       int_fast32_t;
+
+typedef uint32_t      uint_least32_t;
+typedef uint32_t      uint_fast32_t;
+
+#ifdef __STDINT_LIMITS
+#  define INT32_MIN	(-2147483647-1)
+#  define INT32_MAX	(2147483647)
+#  define INT_LEAST32_MIN	INT32_MIN
+#  define INT_LEAST32_MAX	INT32_MAX
+#  define INT_FAST32_MIN	INT32_MIN
+#  define INT_FAST32_MAX	INT32_MAX
+
+#  define UINT32_MAX	(4294967295U)
+#  define UINT_LEAST32_MAX UINT32_MAX
+#  define UINT_FAST32_MAX UINT32_MAX
+#endif
+
+#ifdef __STDINT_MACROS
+#  define INT32_C(c)	c
+#  define INT_LEAST32_C(c) INT32_C(c)
+#  define INT_FAST32_C(c)  INT32_C(c)
+
+#  define UINT32_C(c)	c ## U
+#  define UINT_LEAST32_C(c) UINT32_C(c)
+#  define UINT_FAST32_C(c) UINT32_C(c)
+#endif
+
+#if defined(__STDC_INT64__)
+/*
+ *  int64_t
+ */
+typedef int64_t       int_least64_t;
+typedef int64_t       int_fast64_t;
+
+typedef uint64_t      uint_least64_t;
+typedef uint64_t      uint_fast64_t;
+
+
+#ifdef __STDINT_LIMITS
+#  define INT64_MIN        (__INT64_C(-9223372036854775807)-1)
+#  define INT64_MAX        (__INT64_C(9223372036854775807))
+#  define INT_LEAST64_MIN  INT64_MIN
+#  define INT_LEAST64_MAX  INT64_MAX
+#  define INT_FAST64_MIN   INT64_MIN
+#  define INT_FAST64_MAX   INT64_MAX
+#  define UINT64_MAX       (__UINT64_C(18446744073709551615))
+
+#  define UINT_LEAST64_MAX UINT64_MAX
+#  define UINT_FAST64_MAX UINT64_MAX
+#endif
+
+#ifdef __STDINT_MACROS
+#  define __INT64_C(c)     c ## LL
+#  define INT64_C(c)       __INT64_C(c)
+#  define INT_LEAST64_C(c) INT64_C(c)
+#  define INT_FAST64_C(c)  INT64_C(c)
+
+#  define __UINT64_C(c)     c ## ULL
+#  define UINT64_C(c)       __UINT64_C(c)
+#  define UINT_LEAST64_C(c) UINT64_C(c)
+#  define UINT_FAST64_C(c)  UINT64_C(c)
+#endif
+
+
+#  define __PRI64_RANK   "ll"
+#  define __PRIFAST_RANK ""
+#  define __PRIPTR_RANK  ""
+
+#endif /* __STDC_INT64__ */
+
+/*
+ * intptr_t & uintptr_t
+ */
+
+typedef int           intptr_t;
+typedef unsigned int  uintptr_t;
+
+#  define INTPTR_MIN    INT32_MIN
+#  define INTPTR_MAX    INT32_MAX
+#  define UINTPTR_MAX   UINT32_MAX
+#  define INTPTR_C(c)   INT32_C(c)
+#  define UINTPTR_C(c)  UINT32_C(c)
+#  define PTRDIFF_C(c)  INT32_C(c)
+#  define PTRDIFF_MIN   INT32_MIN
+#  define PTRDIFF_MAX   INT32_MAX
+
+
+/*
+ *  intmax_t & uintmax_t
+ */
+
+#if defined(__STDC_INT64__)
+
+typedef uint64_t uintmax_t;
+typedef int64_t  intmax_t;
+
+#define INTMAX_MIN	INT64_MIN
+#define INTMAX_MAX	INT64_MAX
+#define UINTMAX_MAX	UINT64_MAX
+
+#define INTMAX_C(c)	INT64_C(c)
+#define UINTMAX_C(c)	UINT64_C(c)
+
+#else /* !__STDC_INT64__ */
+
+typedef uint32_t  uintmax_t;
+typedef int32_t   intmax_t;
+
+#define  INTMAX_MIN    INT32_MIN
+#define  INTMAX_MAX    INT32_MAX
+#define  UINTMAX_MAX   UINT32_MAX
+
+#define INTMAX_C(c)	INT32_C(c)
+#define UINTMAX_C(c)	UINT32_C(c)
+
+#endif /* !__STDC_INT64__ */
+
+
+/* size_t is defined by the GCC-specific <stddef.h> */
+#ifndef _SSIZE_T_DEFINED_
+#define _SSIZE_T_DEFINED_
+typedef long int  ssize_t;
+#endif
+
+#define _BITSIZE 32
+
+/* Keep the kernel from trying to define these types... */
+#define __BIT_TYPES_DEFINED__
+
+#endif /* _STDINT_H */
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/stdio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/stdio.h
deleted file mode 120000
index 41d7d04..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/stdio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/stdio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/stdio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/stdio.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/stdio.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/stdio.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/stdlib.h b/ndk/build/platforms/android-3/arch-arm/usr/include/stdlib.h
deleted file mode 120000
index de97694..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/stdlib.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/stdlib.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/stdlib.h b/ndk/build/platforms/android-3/arch-arm/usr/include/stdlib.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/stdlib.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/stdlib.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/stl_pair.h b/ndk/build/platforms/android-3/arch-arm/usr/include/stl_pair.h
deleted file mode 120000
index bfeaf5b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/stl_pair.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/stl_pair.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/stl_pair.h b/ndk/build/platforms/android-3/arch-arm/usr/include/stl_pair.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/stl_pair.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/stl_pair.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/string.h b/ndk/build/platforms/android-3/arch-arm/usr/include/string.h
deleted file mode 120000
index ee1c46a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/string.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/string.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/string.h b/ndk/build/platforms/android-3/arch-arm/usr/include/string.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/string.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/string.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/strings.h b/ndk/build/platforms/android-3/arch-arm/usr/include/strings.h
deleted file mode 120000
index e3c356d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/strings.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/strings.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/strings.h b/ndk/build/platforms/android-3/arch-arm/usr/include/strings.h
new file mode 100644
index 0000000..fee7dc4
--- /dev/null
+++ b/ndk/build/platforms/android-3/arch-arm/usr/include/strings.h
@@ -0,0 +1,56 @@
+/*	$NetBSD: strings.h,v 1.10 2005/02/03 04:39:32 perry Exp $	*/
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _STRINGS_H_
+#define _STRINGS_H_
+
+#include <sys/types.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	 bcmp(const void *, const void *, size_t);
+void	 bcopy(const void *, void *, size_t);
+void	 bzero(void *, size_t);
+int	 ffs(int);
+char	*index(const char *, int);
+char	*rindex(const char *, int);
+int	 strcasecmp(const char *, const char *);
+int	 strncasecmp(const char *, const char *, size_t);
+__END_DECLS
+
+#endif /* !defined(_STRINGS_H_) */
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_errdefs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_errdefs.h
deleted file mode 120000
index b2a299e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_errdefs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/_errdefs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/_errdefs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_errdefs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/_errdefs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/_errdefs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_sigdefs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_sigdefs.h
deleted file mode 120000
index ea48d37..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_sigdefs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/_sigdefs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/_sigdefs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_sigdefs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/_sigdefs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/_sigdefs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_system_properties.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_system_properties.h
deleted file mode 120000
index 6054cc4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_system_properties.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/_system_properties.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/_system_properties.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_system_properties.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/_system_properties.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/_system_properties.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_types.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_types.h
deleted file mode 120000
index 936b4d5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_types.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/_types.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/_types.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/_types.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/_types.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/_types.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/atomics.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/atomics.h
deleted file mode 120000
index 0304794..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/atomics.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/atomics.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/atomics.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/atomics.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/atomics.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/atomics.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/cdefs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/cdefs.h
deleted file mode 120000
index 36eede7..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/cdefs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/cdefs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/cdefs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/cdefs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/cdefs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/cdefs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/cdefs_elf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/cdefs_elf.h
deleted file mode 120000
index fa852bf..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/cdefs_elf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/cdefs_elf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/cdefs_elf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/cdefs_elf.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/cdefs_elf.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/cdefs_elf.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/dirent.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/dirent.h
deleted file mode 120000
index cac02ee..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/dirent.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/dirent.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/dirent.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/dirent.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/dirent.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/dirent.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/endian.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/endian.h
deleted file mode 120000
index 25109db..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/endian.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/endian.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/endian.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/endian.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/endian.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/endian.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/epoll.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/epoll.h
deleted file mode 120000
index bf93fc6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/epoll.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/epoll.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/epoll.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/epoll.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/epoll.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/epoll.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/errno.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/errno.h
deleted file mode 120000
index 199ad78..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/errno.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/errno.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/errno.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/errno.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/errno.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/errno.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/exec_elf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/exec_elf.h
deleted file mode 120000
index 24e01e6..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/exec_elf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/exec_elf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/exec_elf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/exec_elf.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/exec_elf.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/exec_elf.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/file.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/file.h
deleted file mode 120000
index 99ab5d3..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/file.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/file.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/file.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/file.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/file.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/file.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/fsuid.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/fsuid.h
deleted file mode 120000
index f5f9974..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/fsuid.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/fsuid.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/fsuid.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/fsuid.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/fsuid.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/fsuid.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/inotify.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/inotify.h
deleted file mode 120000
index a050653..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/inotify.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/inotify.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/inotify.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/inotify.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/inotify.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/inotify.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ioctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ioctl.h
deleted file mode 120000
index e228a66..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/ioctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/ioctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ioctl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/ioctl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/ioctl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ioctl_compat.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ioctl_compat.h
deleted file mode 120000
index dd004de..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ioctl_compat.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/ioctl_compat.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/ioctl_compat.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ioctl_compat.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/ioctl_compat.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/ioctl_compat.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ipc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ipc.h
deleted file mode 120000
index 5d275f2..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/ipc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/ipc.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ipc.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/ipc.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/ipc.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/klog.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/klog.h
deleted file mode 120000
index 4cad4c9..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/klog.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/klog.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/klog.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/klog.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/klog.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/klog.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/limits.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/limits.h
deleted file mode 120000
index 4f50214..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/limits.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/limits.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/limits.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/limits.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/limits.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/limits.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/linux-syscalls.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/linux-syscalls.h
deleted file mode 120000
index 754d7c49..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/linux-syscalls.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/linux-syscalls.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/linux-syscalls.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/linux-syscalls.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/linux-syscalls.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/linux-syscalls.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/linux-unistd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/linux-unistd.h
deleted file mode 120000
index 9496fde..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/linux-unistd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/linux-unistd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/linux-unistd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/linux-unistd.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/linux-unistd.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/linux-unistd.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/mman.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/mman.h
deleted file mode 120000
index bd6a6b8..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/mman.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/mman.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/mman.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/mman.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/mman.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/mman.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/mount.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/mount.h
deleted file mode 120000
index 0b0a916..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/mount.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/mount.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/mount.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/mount.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/mount.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/mount.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/param.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/param.h
deleted file mode 120000
index 16e5bcc..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/param.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/param.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/param.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/param.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/param.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/param.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/poll.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/poll.h
deleted file mode 120000
index a98ab69..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/poll.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/poll.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/poll.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/poll.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/poll.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/poll.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/prctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/prctl.h
deleted file mode 120000
index 950d2fb..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/prctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/prctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/prctl.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/prctl.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/prctl.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/prctl.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ptrace.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ptrace.h
deleted file mode 120000
index 3b2714f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ptrace.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/ptrace.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/ptrace.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ptrace.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/ptrace.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/ptrace.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/reboot.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/reboot.h
deleted file mode 120000
index 8295ffc..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/reboot.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/reboot.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/reboot.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/reboot.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/reboot.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/reboot.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/resource.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/resource.h
deleted file mode 120000
index 72a813f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/resource.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/resource.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/resource.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/resource.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/resource.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/resource.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/select.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/select.h
deleted file mode 120000
index 42f2037..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/select.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/select.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/select.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/select.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/select.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/select.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sendfile.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sendfile.h
deleted file mode 120000
index ac4d8a0..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sendfile.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/sendfile.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/sendfile.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sendfile.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/sendfile.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/sendfile.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/socket.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/socket.h
deleted file mode 120000
index 36a0331..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/socket.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/socket.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/socket.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/socket.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/socket.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/socket.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/socketcalls.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/socketcalls.h
deleted file mode 120000
index 5e94809..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/socketcalls.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/socketcalls.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/socketcalls.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/socketcalls.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/socketcalls.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/socketcalls.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/stat.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/stat.h
deleted file mode 120000
index fa00c54..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/stat.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/stat.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/stat.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/stat.h
new file mode 100644
index 0000000..091ee6d
--- /dev/null
+++ b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/stat.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _SYS_STAT_H_
+#define _SYS_STAT_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <linux/stat.h>
+
+#include <endian.h>
+
+__BEGIN_DECLS
+
+/* really matches stat64 in the kernel, hence the padding
+ * Note: The kernel zero's the padded region because glibc might read them
+ * in the hope that the kernel has stretched to using larger sizes.
+ */
+struct stat {
+    unsigned long long  st_dev;
+    unsigned char       __pad0[4];
+
+    unsigned long       __st_ino;
+    unsigned int        st_mode;
+    unsigned int        st_nlink;
+
+    unsigned long       st_uid;
+    unsigned long       st_gid;
+
+    unsigned long long  st_rdev;
+    unsigned char       __pad3[4];
+
+    long long           st_size;
+    unsigned long	st_blksize;
+    unsigned long long  st_blocks;
+
+    unsigned long       st_atime;
+    unsigned long       st_atime_nsec;
+
+    unsigned long       st_mtime;
+    unsigned long       st_mtime_nsec;
+
+    unsigned long       st_ctime;
+    unsigned long       st_ctime_nsec;
+
+    unsigned long long  st_ino;
+};
+
+/* For compatibility with GLibc, we provide macro aliases
+ * for the non-Posix nano-seconds accessors.
+ */
+#define  st_atimensec  st_atime_nsec
+#define  st_mtimensec  st_mtime_nsec
+#define  st_ctimensec  st_ctime_nsec
+
+extern int    chmod(const char *, mode_t);
+extern int    fchmod(int, mode_t);
+extern int    mkdir(const char *, mode_t);
+
+extern int    stat(const char *, struct stat *);
+extern int    fstat(int, struct stat *);
+extern int    lstat(const char *, struct stat *);
+extern int    mknod(const char *, mode_t, dev_t);
+extern mode_t umask(mode_t);
+
+#define  stat64    stat
+#define  fstat64   fstat
+#define  lstat64   lstat
+
+static __inline__ int mkfifo(const char *__p, mode_t __m)
+{
+  return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t)0);
+}
+
+extern int  fstatat(int dirfd, const char *path, struct stat *buf, int flags);
+extern int  mkdirat(int dirfd, const char *pathname, mode_t mode);
+extern int fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags);
+extern int fchmodat(int dirfd, const char *path, mode_t mode, int flags);
+extern int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
+
+__END_DECLS
+
+#endif /* _SYS_STAT_H_ */
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/statfs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/statfs.h
deleted file mode 120000
index d53806d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/statfs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/statfs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/statfs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/statfs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/statfs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/statfs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/syscall.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/syscall.h
deleted file mode 120000
index 4225c35..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/syscall.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/syscall.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/syscall.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/syscall.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/syscall.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/syscall.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sysconf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sysconf.h
deleted file mode 120000
index ed9cf1f..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sysconf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/sysconf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/sysconf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sysconf.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/sysconf.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/sysconf.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sysinfo.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sysinfo.h
deleted file mode 120000
index 1693d79..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sysinfo.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/sysinfo.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/sysinfo.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sysinfo.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/sysinfo.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/sysinfo.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/syslimits.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/syslimits.h
deleted file mode 120000
index 17efa78..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/syslimits.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/syslimits.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/syslimits.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/syslimits.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/syslimits.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/syslimits.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sysmacros.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sysmacros.h
deleted file mode 120000
index fa13eca..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sysmacros.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/sysmacros.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/sysmacros.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/sysmacros.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/sysmacros.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/sysmacros.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/system_properties.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/system_properties.h
deleted file mode 120000
index 286ba9d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/system_properties.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/system_properties.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/system_properties.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/system_properties.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/system_properties.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/system_properties.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/time.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/time.h
deleted file mode 120000
index b376430..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/time.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/time.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/time.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/time.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/time.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/time.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/timeb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/timeb.h
deleted file mode 120000
index fef113e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/timeb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/timeb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/timeb.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/timeb.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/timeb.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/timeb.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/times.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/times.h
deleted file mode 120000
index 53c3a1a..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/times.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/times.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/times.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/times.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/times.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/times.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ttychars.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ttychars.h
deleted file mode 120000
index 09c3352..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ttychars.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/ttychars.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/ttychars.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ttychars.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/ttychars.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/ttychars.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ttydev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ttydev.h
deleted file mode 120000
index 4735daa..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ttydev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/ttydev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/ttydev.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/ttydev.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/ttydev.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/ttydev.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/types.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/types.h
deleted file mode 120000
index 8829c6b..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/types.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/types.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/types.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/types.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/types.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/types.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/uio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/uio.h
deleted file mode 120000
index a111200..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/uio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/uio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/uio.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/uio.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/uio.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/uio.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/un.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/un.h
deleted file mode 120000
index 20d7c68..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/un.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/un.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/un.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/un.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/un.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/un.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/utime.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/utime.h
deleted file mode 120000
index 8494247..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/utime.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/utime.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/utime.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/utime.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/utime.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/utime.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/utsname.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/utsname.h
deleted file mode 120000
index cf985f0..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/utsname.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/utsname.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/utsname.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/utsname.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/utsname.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/utsname.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/vfs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/vfs.h
deleted file mode 120000
index c4873c3..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/vfs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/vfs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/vfs.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/vfs.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/vfs.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/vfs.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/vt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/vt.h
deleted file mode 120000
index 55b3ed4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/vt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/vt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/vt.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/vt.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/vt.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/vt.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/wait.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/wait.h
deleted file mode 120000
index 9f27986..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/sys/wait.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/wait.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/sys/wait.h b/ndk/build/platforms/android-3/arch-arm/usr/include/sys/wait.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/sys/wait.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/sys/wait.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/syslog.h b/ndk/build/platforms/android-3/arch-arm/usr/include/syslog.h
deleted file mode 120000
index 609c4e1..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/syslog.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/syslog.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/syslog.h b/ndk/build/platforms/android-3/arch-arm/usr/include/syslog.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/syslog.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/syslog.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/termios.h b/ndk/build/platforms/android-3/arch-arm/usr/include/termios.h
deleted file mode 120000
index 53740f5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/termios.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/termios.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/termios.h b/ndk/build/platforms/android-3/arch-arm/usr/include/termios.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/termios.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/termios.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/thread_db.h b/ndk/build/platforms/android-3/arch-arm/usr/include/thread_db.h
deleted file mode 120000
index e6b5ced..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/thread_db.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/thread_db.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/thread_db.h b/ndk/build/platforms/android-3/arch-arm/usr/include/thread_db.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/thread_db.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/thread_db.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/time.h b/ndk/build/platforms/android-3/arch-arm/usr/include/time.h
deleted file mode 120000
index 4ae3e06..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/time.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/time.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/time.h b/ndk/build/platforms/android-3/arch-arm/usr/include/time.h
new file mode 100644
index 0000000..6163c6d
--- /dev/null
+++ b/ndk/build/platforms/android-3/arch-arm/usr/include/time.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _TIME_H_
+#define _TIME_H_
+
+#include <sys/cdefs.h>
+#include <sys/time.h>
+
+#define __ARCH_SI_UID_T __kernel_uid32_t
+#include <asm/siginfo.h>
+#undef __ARCH_SI_UID_T
+
+__BEGIN_DECLS
+
+extern time_t   time(time_t *);
+extern int      nanosleep(const struct timespec *, struct timespec *);
+
+extern char *strtotimeval(const char *str, struct timeval *tv);
+
+struct tm {
+   int     tm_sec;         /* seconds */
+   int     tm_min;         /* minutes */
+   int     tm_hour;        /* hours */
+   int     tm_mday;        /* day of the month */
+   int     tm_mon;         /* month */
+   int     tm_year;        /* year */
+   int     tm_wday;        /* day of the week */
+   int     tm_yday;        /* day in the year */
+   int     tm_isdst;       /* daylight saving time */
+
+   long int tm_gmtoff;     /* Seconds east of UTC.  */
+   const char *tm_zone;    /* Timezone abbreviation.  */
+
+};
+
+/* defining TM_ZONE indicates that we have a "timezone abbreviation" field in
+ * struct tm, the value should be the field name
+ */
+#define   TM_ZONE   tm_zone
+
+extern char* asctime(const struct tm* a);
+extern char* asctime_r(const struct tm* a, char* buf);
+
+/* Return the difference between TIME1 and TIME0.  */
+extern double difftime (time_t __time1, time_t __time0);
+extern time_t mktime (struct tm *a);
+
+extern struct tm*  localtime(const time_t *t);
+extern struct tm*  localtime_r(const time_t *timep, struct tm *result);
+
+extern struct tm*  gmtime(const time_t *timep);
+extern struct tm*  gmtime_r(const time_t *timep, struct tm *result);
+
+extern char*       strptime(const char *buf, const char *fmt, struct tm *tm);
+extern size_t      strftime(char *s, size_t max, const char *format, const struct tm *tm);
+
+extern char *ctime(const time_t *timep);
+extern char *ctime_r(const time_t *timep, char *buf);
+
+extern void  tzset(void);
+
+/* global includes */
+extern char*     tzname[];
+extern int       daylight;
+extern long int  timezone;
+
+#define CLOCKS_PER_SEC     1000000
+
+extern clock_t   clock(void);
+
+/* BIONIC: extra linux clock goodies */
+extern int clock_getres(int, struct timespec *);
+extern int clock_gettime(int, struct timespec *);
+
+#define CLOCK_REALTIME             0
+#define CLOCK_MONOTONIC            1
+#define CLOCK_PROCESS_CPUTIME_ID   2
+#define CLOCK_THREAD_CPUTIME_ID    3
+#define CLOCK_REALTIME_HR          4
+#define CLOCK_MONOTONIC_HR         5
+
+extern int  timer_create(int, struct sigevent*, timer_t*);
+extern int  timer_delete(timer_t);
+extern int  timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue);
+extern int  timer_gettime(timer_t timerid, struct itimerspec *value);
+extern int  timer_getoverrun(timer_t  timerid);
+
+__END_DECLS
+
+#endif /* _TIME_H_ */
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/time64.h b/ndk/build/platforms/android-3/arch-arm/usr/include/time64.h
deleted file mode 120000
index 9e4ca23..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/time64.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/time64.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/time64.h b/ndk/build/platforms/android-3/arch-arm/usr/include/time64.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/time64.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/time64.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/typeinfo b/ndk/build/platforms/android-3/arch-arm/usr/include/typeinfo
deleted file mode 120000
index 35bacb5..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/typeinfo
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/typeinfo
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/typeinfo b/ndk/build/platforms/android-3/arch-arm/usr/include/typeinfo
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/typeinfo
rename to ndk/build/platforms/android-3/arch-arm/usr/include/typeinfo
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/unistd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/unistd.h
deleted file mode 120000
index 378e20d..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/unistd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/unistd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/unistd.h b/ndk/build/platforms/android-3/arch-arm/usr/include/unistd.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/unistd.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/unistd.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/util.h b/ndk/build/platforms/android-3/arch-arm/usr/include/util.h
deleted file mode 120000
index c8de0fe..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/util.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/util.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/util.h b/ndk/build/platforms/android-3/arch-arm/usr/include/util.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/util.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/util.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/utility b/ndk/build/platforms/android-3/arch-arm/usr/include/utility
deleted file mode 120000
index f670e68..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/utility
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/utility
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/utility b/ndk/build/platforms/android-3/arch-arm/usr/include/utility
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/utility
rename to ndk/build/platforms/android-3/arch-arm/usr/include/utility
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/utime.h b/ndk/build/platforms/android-3/arch-arm/usr/include/utime.h
deleted file mode 120000
index 520a474..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/utime.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/utime.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/utime.h b/ndk/build/platforms/android-3/arch-arm/usr/include/utime.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/utime.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/utime.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/utmp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/utmp.h
deleted file mode 120000
index 9fe8b95..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/utmp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/utmp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/utmp.h b/ndk/build/platforms/android-3/arch-arm/usr/include/utmp.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/utmp.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/utmp.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/wchar.h b/ndk/build/platforms/android-3/arch-arm/usr/include/wchar.h
deleted file mode 120000
index 5a35644..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/wchar.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/wchar.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/wchar.h b/ndk/build/platforms/android-3/arch-arm/usr/include/wchar.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/wchar.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/wchar.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/wctype.h b/ndk/build/platforms/android-3/arch-arm/usr/include/wctype.h
deleted file mode 120000
index 2a2a823..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/wctype.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/wctype.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/wctype.h b/ndk/build/platforms/android-3/arch-arm/usr/include/wctype.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/wctype.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/wctype.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/zconf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/zconf.h
deleted file mode 120000
index 10d4a1e..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/zconf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/zconf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/zconf.h b/ndk/build/platforms/android-3/arch-arm/usr/include/zconf.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/zconf.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/zconf.h
diff --git a/ndk/build/platforms/android-3/arch-arm/usr/include/zlib.h b/ndk/build/platforms/android-3/arch-arm/usr/include/zlib.h
deleted file mode 120000
index d9e63a4..0000000
--- a/ndk/build/platforms/android-3/arch-arm/usr/include/zlib.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/zlib.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/zlib.h b/ndk/build/platforms/android-3/arch-arm/usr/include/zlib.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/zlib.h
rename to ndk/build/platforms/android-3/arch-arm/usr/include/zlib.h
diff --git a/ndk/build/platforms/android-3/common/include/stdint.h b/ndk/build/platforms/android-3/common/include/stdint.h
deleted file mode 100644
index 39a8ab8..0000000
--- a/ndk/build/platforms/android-3/common/include/stdint.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef _STDINT_H
-#define _STDINT_H
-
-#include <stddef.h>
-#include <sys/_types.h>
-
-
-
-#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
-#  define __STDINT_LIMITS
-#endif
-
-#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
-#  define  __STDINT_MACROS
-#endif
-
-/* the definitions of STDINT_LIMITS depend on those of STDINT_MACROS */
-#if defined __STDINT_LIMITS && !defined __STDINT_MACROS
-#  define  __STDINT_MACROS
-#endif
-
-typedef __int8_t      int8_t;
-typedef __uint8_t     uint8_t;
-typedef __int16_t     int16_t;
-typedef __uint16_t    uint16_t;
-typedef __int32_t     int32_t;
-typedef __uint32_t    uint32_t;
-#if !defined(__STRICT_ANSI__)
-typedef __int64_t     int64_t;
-typedef __uint64_t    uint64_t;
-#endif
-
-/*
- * int8_t & uint8_t
- */
-
-typedef int8_t        int_least8_t;
-typedef int8_t        int_fast8_t;
-
-typedef uint8_t       uint_least8_t;
-typedef uint8_t       uint_fast8_t;
-
-#ifdef __STDINT_LIMITS
-#  define INT8_MIN         (-128)
-#  define INT8_MAX         (127)
-#  define INT_LEAST8_MIN   INT8_MIN
-#  define INT_LEAST8_MAX   INT8_MAX
-#  define INT_FAST8_MIN    INT8_MIN
-#  define INT_FAST8_MAX    INT8_MAX
-
-#  define UINT8_MAX           (255U)
-#  define UINT_LEAST8_MAX     UINT8_MAX
-#  define UINT_FAST8_MAX      UINT8_MAX
-#endif
-
-#ifdef __STDINT_MACROS
-#  define INT8_C(c)	c
-#  define INT_LEAST8_C(c)	 INT8_C(c)
-#  define INT_FAST8_C(c)	INT8_C(c)
-
-#  define UINT8_C(c)	c ## U
-#  define UINT_LEAST8_C(c)  UINT8_C(c)
-#  define UINT_FAST8_C(c)  UINT8_C(c)
-#endif
-
-/*
- * int16_t & uint16_t
- */
-
-
-typedef int16_t       int_least16_t;
-typedef int32_t       int_fast16_t;
-
-typedef uint16_t      uint_least16_t;
-typedef uint32_t      uint_fast16_t;
-
-#ifdef __STDINT_LIMITS
-#  define INT16_MIN	(-32768)
-#  define INT16_MAX	(32767)
-#  define INT_LEAST16_MIN	INT16_MIN
-#  define INT_LEAST16_MAX	INT16_MAX
-#  define INT_FAST16_MIN	INT32_MIN
-#  define INT_FAST16_MAX	INT32_MAX
-
-#  define UINT16_MAX	(65535U)
-#  define UINT_LEAST16_MAX UINT16_MAX
-#  define UINT_FAST16_MAX UINT32_MAX
-#endif
-
-#ifdef __STDINT_MACROS
-#  define INT16_C(c)	c
-#  define INT_LEAST16_C(c) INT16_C(c)
-#  define INT_FAST16_C(c)	 INT32_C(c)
-
-#  define UINT16_C(c)	c ## U
-#  define UINT_LEAST16_C(c) UINT16_C(c)
-#  define UINT_FAST16_C(c) UINT32_C(c)
-#endif
-
-/*
- * int32_t & uint32_t
- */
-
-typedef int32_t       int_least32_t;
-typedef int32_t       int_fast32_t;
-
-typedef uint32_t      uint_least32_t;
-typedef uint32_t      uint_fast32_t;
-
-#ifdef __STDINT_LIMITS
-#  define INT32_MIN	(-2147483647-1)
-#  define INT32_MAX	(2147483647)
-#  define INT_LEAST32_MIN	INT32_MIN
-#  define INT_LEAST32_MAX	INT32_MAX
-#  define INT_FAST32_MIN	INT32_MIN
-#  define INT_FAST32_MAX	INT32_MAX
-
-#  define UINT32_MAX	(4294967295U)
-#  define UINT_LEAST32_MAX UINT32_MAX
-#  define UINT_FAST32_MAX UINT32_MAX
-#endif
-
-#ifdef __STDINT_MACROS
-#  define INT32_C(c)	c
-#  define INT_LEAST32_C(c) INT32_C(c)
-#  define INT_FAST32_C(c)  INT32_C(c)
-
-#  define UINT32_C(c)	c ## U
-#  define UINT_LEAST32_C(c) UINT32_C(c)
-#  define UINT_FAST32_C(c) UINT32_C(c)
-#endif
-
-#if !defined(__STRICT_ANSI__)
-/*
- *  int64_t
- */
-typedef int64_t       int_least64_t;
-typedef int64_t       int_fast64_t;
-
-typedef uint64_t      uint_least64_t;
-typedef uint64_t      uint_fast64_t;
-
-
-#ifdef __STDINT_LIMITS
-#  define INT64_MIN        (__INT64_C(-9223372036854775807)-1)
-#  define INT64_MAX        (__INT64_C(9223372036854775807))
-#  define INT_LEAST64_MIN  INT64_MIN
-#  define INT_LEAST64_MAX  INT64_MAX
-#  define INT_FAST64_MIN   INT64_MIN
-#  define INT_FAST64_MAX   INT64_MAX
-#  define UINT64_MAX       (__UINT64_C(18446744073709551615))
-
-#  define UINT_LEAST64_MAX UINT64_MAX
-#  define UINT_FAST64_MAX UINT64_MAX
-#endif
-
-#ifdef __STDINT_MACROS
-#  define __INT64_C(c)     c ## LL
-#  define INT64_C(c)       __INT64_C(c)
-#  define INT_LEAST64_C(c) INT64_C(c)
-#  define INT_FAST64_C(c)  INT64_C(c)
-
-#  define __UINT64_C(c)     c ## ULL
-#  define UINT64_C(c)       __UINT64_C(c)
-#  define UINT_LEAST64_C(c) UINT64_C(c)
-#  define UINT_FAST64_C(c)  UINT64_C(c)
-#endif
-
-
-#  define __PRI64_RANK   "ll"
-#  define __PRIFAST_RANK ""
-#  define __PRIPTR_RANK  ""
-
-#endif /* !__STRICT_ANSI__ */
-
-/*
- * intptr_t & uintptr_t
- */
-
-typedef int           intptr_t;
-typedef unsigned int  uintptr_t;
-
-#  define INTPTR_MIN    INT32_MIN
-#  define INTPTR_MAX    INT32_MAX
-#  define UINTPTR_MAX   UINT32_MAX
-#  define INTPTR_C(c)   INT32_C(c)
-#  define UINTPTR_C(c)  UINT32_C(c)
-#  define PTRDIFF_C(c)  INT32_C(c)
-#  define PTRDIFF_MIN   INT32_MIN
-#  define PTRDIFF_MAX   INT32_MAX
-
-
-/*
- *  intmax_t & uintmax_t
- */
-
-#if !defined(__STRICT_ANSI__)
-
-typedef uint64_t uintmax_t;
-typedef int64_t  intmax_t;
-
-#define INTMAX_MIN	INT64_MIN
-#define INTMAX_MAX	INT64_MAX
-#define UINTMAX_MAX	UINT64_MAX
-
-#define INTMAX_C(c)	INT64_C(c)
-#define UINTMAX_C(c)	UINT64_C(c)
-
-#else /* __STRICT_ANSI__ */
-
-typedef uint32_t  uintmax_t;
-typedef int32_t   intmax_t;
-
-#define  INTMAX_MIN    INT32_MIN
-#define  INTMAX_MAX    INT32_MAX
-#define  UINTMAX_MAX   UINT32_MAX
-
-#define INTMAX_C(c)	INT32_C(c)
-#define UINTMAX_C(c)	UINT32_C(c)
-
-#endif /* __STRICT_ANSI__ */
-
-
-/* size_t is defined by the GCC-specific <stddef.h> */
-#ifndef _SSIZE_T_DEFINED_
-#define _SSIZE_T_DEFINED_
-typedef long int  ssize_t;
-#endif
-
-#define _BITSIZE 32
-
-/* Keep the kernel from trying to define these types... */
-#define __BIT_TYPES_DEFINED__
-
-#endif /* _STDINT_H */
diff --git a/ndk/build/platforms/android-3/common/include/strings.h b/ndk/build/platforms/android-3/common/include/strings.h
deleted file mode 100644
index 1f73e21..0000000
--- a/ndk/build/platforms/android-3/common/include/strings.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*	$NetBSD: strings.h,v 1.10 2005/02/03 04:39:32 perry Exp $	*/
-
-/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Klaus Klein.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _STRINGS_H_
-#define _STRINGS_H_
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int	 bcmp(const void *, const void *, size_t);
-void	 bcopy(const void *, void *, size_t);
-void	 bzero(void *, size_t);
-int	 ffs(int);
-char	*index(const char *, int);
-char	*rindex(const char *, int);
-int	 strcasecmp(const char *, const char *);
-int	 strncasecmp(const char *, const char *, size_t);
-__END_DECLS
-
-#endif /* !defined(_STRINGS_H_) */
diff --git a/ndk/build/platforms/android-3/common/include/sys/stat.h b/ndk/build/platforms/android-3/common/include/sys/stat.h
deleted file mode 100644
index 23ab5ae..0000000
--- a/ndk/build/platforms/android-3/common/include/sys/stat.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef _SYS_STAT_H_
-#define _SYS_STAT_H_
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <linux/stat.h>
-
-#include <endian.h>
-
-__BEGIN_DECLS
-
-/* really matches stat64 in the kernel, hence the padding
- * Note: The kernel zero's the padded region because glibc might read them
- * in the hope that the kernel has stretched to using larger sizes.
- */
-struct stat {
-    unsigned long long  st_dev;
-    unsigned char       __pad0[4];
-
-    unsigned long       __st_ino;
-    unsigned int        st_mode;
-    unsigned int        st_nlink;
-
-    unsigned long       st_uid;
-    unsigned long       st_gid;
-
-    unsigned long long  st_rdev;
-    unsigned char       __pad3[4];
-
-    long long           st_size;
-    unsigned long	st_blksize;
-    unsigned long long  st_blocks;
-
-    unsigned long       st_atime;
-    unsigned long       st_atime_nsec;
-
-    unsigned long       st_mtime;
-    unsigned long       st_mtime_nsec;
-
-    unsigned long       st_ctime;
-    unsigned long       st_ctime_nsec;
-
-    unsigned long long  st_ino;
-};
-
-extern int    chmod(const char *, mode_t);
-extern int    fchmod(int, mode_t);
-extern int    mkdir(const char *, mode_t);
-
-extern int    stat(const char *, struct stat *);
-extern int    fstat(int, struct stat *);
-extern int    lstat(const char *, struct stat *);
-extern int    mknod(const char *, mode_t, dev_t);
-extern mode_t umask(mode_t);
-
-#define  stat64    stat
-#define  fstat64   fstat
-#define  lstat64   lstat
-
-static __inline__ int mkfifo(const char *__p, mode_t __m)
-{
-  return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t)0);
-}
-
-extern int  fstatat(int dirfd, const char *path, struct stat *buf, int flags);
-extern int  mkdirat(int dirfd, const char *pathname, mode_t mode);
-extern int fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags);
-extern int fchmodat(int dirfd, const char *path, mode_t mode, int flags);
-extern int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
-
-__END_DECLS
-
-#endif /* _SYS_STAT_H_ */
diff --git a/ndk/build/platforms/android-3/common/include/time.h b/ndk/build/platforms/android-3/common/include/time.h
deleted file mode 100644
index 35c2358..0000000
--- a/ndk/build/platforms/android-3/common/include/time.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef _TIME_H_
-#define _TIME_H_
-
-#include <sys/cdefs.h>
-#include <sys/time.h>
-
-#define __ARCH_SI_UID_T __kernel_uid32_t
-#include <asm/siginfo.h>
-#undef __ARCH_SI_UID_T
-
-__BEGIN_DECLS
-
-extern time_t   time(time_t *);
-extern int      nanosleep(const struct timespec *, struct timespec *);
-
-extern char *strtotimeval(const char *str, struct timeval *tv);
-
-struct tm {
-   int     tm_sec;         /* seconds */
-   int     tm_min;         /* minutes */
-   int     tm_hour;        /* hours */
-   int     tm_mday;        /* day of the month */
-   int     tm_mon;         /* month */
-   int     tm_year;        /* year */
-   int     tm_wday;        /* day of the week */
-   int     tm_yday;        /* day in the year */
-   int     tm_isdst;       /* daylight saving time */
-
-   long int tm_gmtoff;     /* Seconds east of UTC.  */
-   const char *tm_zone;    /* Timezone abbreviation.  */
-
-};
-
-/* defining TM_ZONE indicates that we have a "timezone abbreviation" field in
- * struct tm, the value should be the field name
- */
-#define   TM_ZONE   tm_zone
-
-extern char* asctime(const struct tm* a);
-extern char* asctime_r(const struct tm* a, char* buf);
-
-/* Return the difference between TIME1 and TIME0.  */
-extern double difftime (time_t __time1, time_t __time0);
-extern time_t mktime (struct tm *a);
-
-extern struct tm*  localtime(const time_t *t);
-extern struct tm*  localtime_r(const time_t *timep, struct tm *result);
-
-extern struct tm*  gmtime(const time_t *timep);
-extern struct tm*  gmtime_r(const time_t *timep, struct tm *result);
-
-extern char*       strptime(const char *buf, const char *fmt, struct tm *tm);
-extern size_t      strftime(char *s, size_t max, const char *format, const struct tm *tm);
-
-extern char *ctime(const time_t *timep);
-extern char *ctime_r(const time_t *timep, char *buf);
-
-/* global includes */
-extern char*     tzname[];
-extern int       daylight;
-extern long int  timezone;
-
-#define CLOCKS_PER_SEC     1000000
-
-extern clock_t   clock();
-
-/* BIONIC: extra linux clock goodies */
-extern int clock_getres(int, struct timespec *);
-extern int clock_gettime(int, struct timespec *);
-
-#define CLOCK_REALTIME             0
-#define CLOCK_MONOTONIC            1
-#define CLOCK_PROCESS_CPUTIME_ID   2
-#define CLOCK_THREAD_CPUTIME_ID    3
-#define CLOCK_REALTIME_HR          4
-#define CLOCK_MONOTONIC_HR         5
-
-extern int  timer_create(int, struct sigevent*, timer_t*);
-extern int  timer_delete(timer_t);
-extern int  timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue);
-extern int  timer_gettime(timer_t timerid, struct itimerspec *value);
-extern int  timer_getoverrun(timer_t  timerid);
-
-__END_DECLS
-
-#endif /* _TIME_H_ */
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/GLES b/ndk/build/platforms/android-4/arch-arm/usr/include/GLES
deleted file mode 120000
index ce7d570..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/GLES
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/GLES
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/GLES/gl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/GLES/gl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/GLES/gl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/GLES/gl.h
diff --git a/ndk/build/platforms/android-4/common/include/GLES/glext.h b/ndk/build/platforms/android-4/arch-arm/usr/include/GLES/glext.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/GLES/glext.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/GLES/glext.h
diff --git a/ndk/build/platforms/android-4/common/include/GLES/glplatform.h b/ndk/build/platforms/android-4/arch-arm/usr/include/GLES/glplatform.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/GLES/glplatform.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/GLES/glplatform.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/KHR b/ndk/build/platforms/android-4/arch-arm/usr/include/KHR
deleted file mode 120000
index dd088fc..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/KHR
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/KHR
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/KHR/khrplatform.h b/ndk/build/platforms/android-4/arch-arm/usr/include/KHR/khrplatform.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/KHR/khrplatform.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/KHR/khrplatform.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/alloca.h b/ndk/build/platforms/android-4/arch-arm/usr/include/alloca.h
deleted file mode 120000
index ac859df..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/alloca.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/alloca.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/alloca.h b/ndk/build/platforms/android-4/arch-arm/usr/include/alloca.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/alloca.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/alloca.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/android/log.h b/ndk/build/platforms/android-4/arch-arm/usr/include/android/log.h
deleted file mode 120000
index da91a66..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/android/log.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/android/log.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/android/log.h b/ndk/build/platforms/android-4/arch-arm/usr/include/android/log.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/android/log.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/android/log.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/arpa/inet.h b/ndk/build/platforms/android-4/arch-arm/usr/include/arpa/inet.h
deleted file mode 120000
index 760a19d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/arpa/inet.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/arpa/inet.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/arpa/inet.h b/ndk/build/platforms/android-4/arch-arm/usr/include/arpa/inet.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/arpa/inet.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/arpa/inet.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/arpa/nameser.h b/ndk/build/platforms/android-4/arch-arm/usr/include/arpa/nameser.h
deleted file mode 120000
index 73f9311..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/arpa/nameser.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/arpa/nameser.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/arpa/nameser.h b/ndk/build/platforms/android-4/arch-arm/usr/include/arpa/nameser.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/arpa/nameser.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/arpa/nameser.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/4level-fixup.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/4level-fixup.h
deleted file mode 120000
index 4493a92..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/4level-fixup.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/4level-fixup.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/4level-fixup.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/4level-fixup.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/4level-fixup.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/4level-fixup.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/audit_dir_write.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/audit_dir_write.h
deleted file mode 120000
index 6576f52..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/audit_dir_write.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/audit_dir_write.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/audit_dir_write.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/audit_dir_write.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/audit_dir_write.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/audit_dir_write.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/__ffs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/__ffs.h
deleted file mode 120000
index 9a68edc..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/__ffs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/__ffs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/__ffs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/__ffs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/__ffs.h
copy to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/__ffs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/atomic.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/atomic.h
deleted file mode 120000
index 32afeb4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/atomic.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/atomic.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/atomic.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/atomic.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/atomic.h
copy to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/atomic.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/ffz.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/ffz.h
deleted file mode 120000
index 50c5214..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/ffz.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/ffz.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/ffz.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/ffz.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/ffz.h
copy to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/ffz.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/find.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/find.h
deleted file mode 120000
index 9b40acd..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/find.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/find.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/find.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/find.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/find.h
copy to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/find.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/fls.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/fls.h
deleted file mode 120000
index 5171887..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/fls.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/fls.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/fls.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/fls.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/fls.h
copy to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/fls.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/fls64.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/fls64.h
deleted file mode 120000
index 8728e6a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/fls64.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/fls64.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/fls64.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/fls64.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/fls64.h
copy to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/fls64.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/le.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/le.h
deleted file mode 120000
index 91b46c7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/le.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/le.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/le.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/le.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/le.h
copy to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/le.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/non-atomic.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/non-atomic.h
deleted file mode 120000
index 177973e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/non-atomic.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/asm-generic/bitops/non-atomic.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/non-atomic.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/non-atomic.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/non-atomic.h
copy to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bitops/non-atomic.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bug.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bug.h
deleted file mode 120000
index d898f3a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bug.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/bug.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/bug.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bug.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/bug.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/bug.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/cputime.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/cputime.h
deleted file mode 120000
index 7892fb4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/cputime.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/cputime.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/cputime.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/cputime.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/cputime.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/cputime.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/emergency-restart.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/emergency-restart.h
deleted file mode 120000
index 3005c74..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/emergency-restart.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/emergency-restart.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/emergency-restart.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/emergency-restart.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/emergency-restart.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/emergency-restart.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/errno-base.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/errno-base.h
deleted file mode 120000
index 7b7d9bd..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/errno-base.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/errno-base.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/errno-base.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/errno-base.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/errno-base.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/errno-base.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/errno.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/errno.h
deleted file mode 120000
index bdd6dd4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/errno.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/errno.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/errno.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/errno.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/errno.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/errno.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/fcntl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/fcntl.h
deleted file mode 120000
index 3506aa8..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/fcntl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/fcntl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/fcntl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/fcntl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/fcntl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/fcntl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/futex.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/futex.h
deleted file mode 120000
index cbd47bf..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/futex.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/futex.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/futex.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/futex.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/futex.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/futex.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/ioctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/ioctl.h
deleted file mode 120000
index 7a11623..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/ioctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/ioctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/ioctl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/ioctl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/ioctl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/ipc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/ipc.h
deleted file mode 120000
index 339894e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/ipc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/ipc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/ipc.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/ipc.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/ipc.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/local.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/local.h
deleted file mode 120000
index 0e9344d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/local.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/local.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/local.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/local.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/local.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/local.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/memory_model.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/memory_model.h
deleted file mode 120000
index 3bbc82b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/memory_model.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/memory_model.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/memory_model.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/memory_model.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/memory_model.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/memory_model.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/mman.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/mman.h
deleted file mode 120000
index fbab125..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/mman.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/mman.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/mman.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/mman.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/mman.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/mman.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/mutex-xchg.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/mutex-xchg.h
deleted file mode 120000
index c7bc238..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/mutex-xchg.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/mutex-xchg.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/mutex-xchg.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/mutex-xchg.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/mutex-xchg.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/mutex-xchg.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/percpu.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/percpu.h
deleted file mode 120000
index 2d899db..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/percpu.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/percpu.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/percpu.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/percpu.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/percpu.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/percpu.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/pgtable-nopud.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/pgtable-nopud.h
deleted file mode 120000
index ac2157e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/pgtable-nopud.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/pgtable-nopud.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/pgtable-nopud.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/pgtable-nopud.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/pgtable-nopud.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/pgtable-nopud.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/pgtable.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/pgtable.h
deleted file mode 120000
index 4c70646..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/pgtable.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/pgtable.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/pgtable.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/pgtable.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/pgtable.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/pgtable.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/poll.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/poll.h
deleted file mode 120000
index 2bd359a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/poll.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/poll.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/poll.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/poll.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/poll.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/poll.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/resource.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/resource.h
deleted file mode 120000
index 28f331a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/resource.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/resource.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/resource.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/resource.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/resource.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/resource.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/sections.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/sections.h
deleted file mode 120000
index c6885f3..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/sections.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/sections.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/sections.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/sections.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/sections.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/sections.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/siginfo.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/siginfo.h
deleted file mode 120000
index d38f211..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/siginfo.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/siginfo.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/siginfo.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/siginfo.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/siginfo.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/siginfo.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/signal.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/signal.h
deleted file mode 120000
index 05ca352..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/signal.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/signal.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/signal.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/signal.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/signal.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/signal.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/tlb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/tlb.h
deleted file mode 120000
index 94baa95..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/tlb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/tlb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/tlb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/tlb.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/tlb.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/tlb.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/topology.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/topology.h
deleted file mode 120000
index e85b48f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/topology.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/topology.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/topology.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/topology.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/topology.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/topology.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/xor.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/xor.h
deleted file mode 120000
index baf2118..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/xor.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/asm-generic/xor.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/xor.h b/ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/xor.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/asm-generic/xor.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/asm-generic/xor.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/assert.h b/ndk/build/platforms/android-4/arch-arm/usr/include/assert.h
deleted file mode 120000
index 1572c5b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/assert.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/assert.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/assert.h b/ndk/build/platforms/android-4/arch-arm/usr/include/assert.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/assert.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/assert.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/byteswap.h b/ndk/build/platforms/android-4/arch-arm/usr/include/byteswap.h
deleted file mode 120000
index 153ee73..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/byteswap.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/byteswap.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/byteswap.h b/ndk/build/platforms/android-4/arch-arm/usr/include/byteswap.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/byteswap.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/byteswap.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/cstddef b/ndk/build/platforms/android-4/arch-arm/usr/include/cstddef
deleted file mode 120000
index cec20fd..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/cstddef
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/cstddef
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/cstddef b/ndk/build/platforms/android-4/arch-arm/usr/include/cstddef
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/cstddef
rename to ndk/build/platforms/android-4/arch-arm/usr/include/cstddef
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/ctype.h b/ndk/build/platforms/android-4/arch-arm/usr/include/ctype.h
deleted file mode 120000
index f1b315c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/ctype.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/ctype.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/ctype.h b/ndk/build/platforms/android-4/arch-arm/usr/include/ctype.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/ctype.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/ctype.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/dirent.h b/ndk/build/platforms/android-4/arch-arm/usr/include/dirent.h
deleted file mode 120000
index 315be03..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/dirent.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/dirent.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/dirent.h b/ndk/build/platforms/android-4/arch-arm/usr/include/dirent.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/dirent.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/dirent.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/dlfcn.h b/ndk/build/platforms/android-4/arch-arm/usr/include/dlfcn.h
deleted file mode 120000
index 5748e5a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/dlfcn.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/dlfcn.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/dlfcn.h b/ndk/build/platforms/android-4/arch-arm/usr/include/dlfcn.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/dlfcn.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/dlfcn.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/elf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/elf.h
deleted file mode 120000
index f4e2f5e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/elf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/elf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/elf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/elf.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/elf.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/elf.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/endian.h b/ndk/build/platforms/android-4/arch-arm/usr/include/endian.h
index 04204ed..475b48c 100644
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/endian.h
+++ b/ndk/build/platforms/android-4/arch-arm/usr/include/endian.h
@@ -1,10 +1,33 @@
-/*	$OpenBSD: endian.h,v 1.3 2005/12/13 00:35:23 millert Exp $	*/
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _ENDIAN_H_
+#define _ENDIAN_H_
 
-#ifdef __ARMEB__
-#define _BYTE_ORDER _BIG_ENDIAN
-#else
-#define _BYTE_ORDER _LITTLE_ENDIAN
-#endif
-#define	__STRICT_ALIGNMENT
-#include <sys/types.h>
 #include <sys/endian.h>
+
+#endif /* _ENDIAN_H_ */
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/err.h b/ndk/build/platforms/android-4/arch-arm/usr/include/err.h
deleted file mode 120000
index de81816..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/err.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/err.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/err.h b/ndk/build/platforms/android-4/arch-arm/usr/include/err.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/err.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/err.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/errno.h b/ndk/build/platforms/android-4/arch-arm/usr/include/errno.h
deleted file mode 120000
index 2e638ba..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/errno.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/errno.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/errno.h b/ndk/build/platforms/android-4/arch-arm/usr/include/errno.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/errno.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/errno.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/fcntl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/fcntl.h
deleted file mode 120000
index cb8c1df..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/fcntl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/fcntl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/fcntl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/fcntl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/fcntl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/fcntl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/features.h b/ndk/build/platforms/android-4/arch-arm/usr/include/features.h
deleted file mode 120000
index 6587ebd..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/features.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/features.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/features.h b/ndk/build/platforms/android-4/arch-arm/usr/include/features.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/features.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/features.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/fnmatch.h b/ndk/build/platforms/android-4/arch-arm/usr/include/fnmatch.h
deleted file mode 120000
index 52c0687..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/fnmatch.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/fnmatch.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/fnmatch.h b/ndk/build/platforms/android-4/arch-arm/usr/include/fnmatch.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/fnmatch.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/fnmatch.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/getopt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/getopt.h
deleted file mode 120000
index 857cf27..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/getopt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/getopt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/getopt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/getopt.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/getopt.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/getopt.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/grp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/grp.h
deleted file mode 120000
index c599451..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/grp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/grp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/grp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/grp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/grp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/grp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/inttypes.h b/ndk/build/platforms/android-4/arch-arm/usr/include/inttypes.h
deleted file mode 120000
index 5283d60..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/inttypes.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/inttypes.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/inttypes.h b/ndk/build/platforms/android-4/arch-arm/usr/include/inttypes.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/inttypes.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/inttypes.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/jni.h b/ndk/build/platforms/android-4/arch-arm/usr/include/jni.h
deleted file mode 120000
index e49af21..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/jni.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/jni.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/jni.h b/ndk/build/platforms/android-4/arch-arm/usr/include/jni.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/jni.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/jni.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/lastlog.h b/ndk/build/platforms/android-4/arch-arm/usr/include/lastlog.h
deleted file mode 120000
index fe63cd3..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/lastlog.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/lastlog.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/lastlog.h b/ndk/build/platforms/android-4/arch-arm/usr/include/lastlog.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/lastlog.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/lastlog.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/libgen.h b/ndk/build/platforms/android-4/arch-arm/usr/include/libgen.h
deleted file mode 120000
index 0f626b6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/libgen.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/libgen.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/libgen.h b/ndk/build/platforms/android-4/arch-arm/usr/include/libgen.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/libgen.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/libgen.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/limits.h b/ndk/build/platforms/android-4/arch-arm/usr/include/limits.h
deleted file mode 120000
index 60f67bf..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/limits.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/limits.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/limits.h b/ndk/build/platforms/android-4/arch-arm/usr/include/limits.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/limits.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/limits.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/a.out.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/a.out.h
deleted file mode 120000
index e1bffda..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/a.out.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/a.out.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/a.out.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/a.out.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/a.out.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/a.out.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/aio_abi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/aio_abi.h
deleted file mode 120000
index cd94485..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/aio_abi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/aio_abi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/aio_abi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/aio_abi.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/aio_abi.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/aio_abi.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/akm8976.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/akm8976.h
deleted file mode 120000
index 1d8b858..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/akm8976.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/akm8976.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/akm8976.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/akm8976.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/akm8976.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/akm8976.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/android_alarm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/android_alarm.h
deleted file mode 120000
index 383aabd..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/android_alarm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/android_alarm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/android_alarm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/android_alarm.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/android_alarm.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/android_alarm.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/android_pmem.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/android_pmem.h
deleted file mode 120000
index 2485ad8..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/android_pmem.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/android_pmem.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/android_pmem.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/android_pmem.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/android_pmem.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/android_pmem.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/android_power.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/android_power.h
deleted file mode 120000
index 05f970a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/android_power.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/android_power.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/android_power.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/android_power.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/android_power.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/android_power.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/apm_bios.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/apm_bios.h
deleted file mode 120000
index cbcfb5a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/apm_bios.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/apm_bios.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/apm_bios.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/apm_bios.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/apm_bios.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/apm_bios.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ashmem.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ashmem.h
deleted file mode 120000
index 3cc1881..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ashmem.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ashmem.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ashmem.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ashmem.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ashmem.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ashmem.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ata.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ata.h
deleted file mode 120000
index 4640b5f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ata.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ata.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ata.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ata.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ata.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ata.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atm.h
deleted file mode 120000
index 377242f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/atm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/atm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atm.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/atm.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/atm.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmapi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmapi.h
deleted file mode 120000
index 0d7f085..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmapi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/atmapi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/atmapi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmapi.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/atmapi.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmapi.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmdev.h
deleted file mode 120000
index f1f9a5f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/atmdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/atmdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmdev.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/atmdev.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmdev.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmioc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmioc.h
deleted file mode 120000
index 3b1e711..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmioc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/atmioc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/atmioc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmioc.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/atmioc.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmioc.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmppp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmppp.h
deleted file mode 120000
index 785c8fb..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmppp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/atmppp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/atmppp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmppp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/atmppp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmppp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmsap.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmsap.h
deleted file mode 120000
index bc0f5a8..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmsap.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/atmsap.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/atmsap.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmsap.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/atmsap.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/atmsap.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/attribute_container.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/attribute_container.h
deleted file mode 120000
index 3834481..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/attribute_container.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/attribute_container.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/attribute_container.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/attribute_container.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/attribute_container.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/attribute_container.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/auto_fs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/auto_fs.h
deleted file mode 120000
index 8d3e7b9..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/auto_fs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/auto_fs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/auto_fs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/auto_fs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/auto_fs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/auto_fs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/autoconf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/autoconf.h
deleted file mode 120000
index 41a58f5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/autoconf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/autoconf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/autoconf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/autoconf.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/autoconf.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/autoconf.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/auxvec.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/auxvec.h
deleted file mode 120000
index 5602220..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/auxvec.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/auxvec.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/auxvec.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/auxvec.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/auxvec.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/auxvec.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/backing-dev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/backing-dev.h
deleted file mode 120000
index 427296e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/backing-dev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/backing-dev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/backing-dev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/backing-dev.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/backing-dev.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/backing-dev.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/binder.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/binder.h
deleted file mode 120000
index 39fcca7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/binder.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/binder.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/binder.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/binder.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/binder.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/binder.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/binfmts.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/binfmts.h
deleted file mode 120000
index d938c2f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/binfmts.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/binfmts.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/binfmts.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/binfmts.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/binfmts.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/binfmts.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/bio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/bio.h
deleted file mode 120000
index 9a8ee71..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/bio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/bio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/bio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/bio.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/bio.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/bio.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/bitmap.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/bitmap.h
deleted file mode 120000
index 5db6297..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/bitmap.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/bitmap.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/bitmap.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/bitmap.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/bitmap.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/bitmap.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/bitops.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/bitops.h
deleted file mode 120000
index 5d0fcbb..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/bitops.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/bitops.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/bitops.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/bitops.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/bitops.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/bitops.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/blkdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/blkdev.h
deleted file mode 120000
index fb45957..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/blkdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/blkdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/blkdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/blkdev.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/blkdev.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/blkdev.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/blkpg.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/blkpg.h
deleted file mode 120000
index bc5f38f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/blkpg.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/blkpg.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/blkpg.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/blkpg.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/blkpg.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/blkpg.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/blockgroup_lock.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/blockgroup_lock.h
deleted file mode 120000
index 587f7f1..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/blockgroup_lock.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/blockgroup_lock.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/blockgroup_lock.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/blockgroup_lock.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/blockgroup_lock.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/blockgroup_lock.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/big_endian.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/big_endian.h
deleted file mode 120000
index ce97246..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/big_endian.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/byteorder/big_endian.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/byteorder/big_endian.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/big_endian.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/byteorder/big_endian.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/big_endian.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/generic.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/generic.h
deleted file mode 120000
index d865701..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/generic.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/byteorder/generic.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/byteorder/generic.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/generic.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/byteorder/generic.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/generic.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/little_endian.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/little_endian.h
deleted file mode 120000
index 9b117fa..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/little_endian.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/byteorder/little_endian.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/byteorder/little_endian.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/little_endian.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/byteorder/little_endian.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/little_endian.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/swab.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/swab.h
deleted file mode 120000
index b3da56e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/swab.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/byteorder/swab.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/byteorder/swab.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/swab.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/byteorder/swab.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/swab.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/swabb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/swabb.h
deleted file mode 120000
index d6d7ade..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/swabb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/byteorder/swabb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/byteorder/swabb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/swabb.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/byteorder/swabb.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/byteorder/swabb.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cache.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cache.h
deleted file mode 120000
index 74ed7c9..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cache.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/cache.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/cache.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cache.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/cache.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/cache.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/calc64.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/calc64.h
deleted file mode 120000
index e12ad54..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/calc64.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/calc64.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/calc64.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/calc64.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/calc64.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/calc64.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/capability.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/capability.h
deleted file mode 120000
index 9674918..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/capability.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/capability.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/capability.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/capability.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/capability.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/capability.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/capi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/capi.h
deleted file mode 120000
index e937bc1..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/capi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/capi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/capi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/capi.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/capi.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/capi.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cdev.h
deleted file mode 120000
index aa3f937..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/cdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/cdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cdev.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/cdev.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/cdev.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cdrom.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cdrom.h
deleted file mode 120000
index f8a7cfe..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cdrom.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/cdrom.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/cdrom.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cdrom.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/cdrom.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/cdrom.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/circ_buf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/circ_buf.h
deleted file mode 120000
index ada0bca..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/circ_buf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/circ_buf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/circ_buf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/circ_buf.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/circ_buf.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/circ_buf.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/clk.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/clk.h
deleted file mode 120000
index 246f4ad..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/clk.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/clk.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/clk.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/clk.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/clk.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/clk.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/coda.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/coda.h
deleted file mode 120000
index e577be5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/coda.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/coda.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/coda.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/coda.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/coda.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/coda.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/coda_fs_i.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/coda_fs_i.h
deleted file mode 120000
index bd7a507..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/coda_fs_i.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/coda_fs_i.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/coda_fs_i.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/coda_fs_i.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/coda_fs_i.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/coda_fs_i.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/compat.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/compat.h
deleted file mode 120000
index c323a32..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/compat.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/compat.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/compat.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/compat.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/compat.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/compat.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/compiler-gcc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/compiler-gcc.h
deleted file mode 120000
index 6609cf6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/compiler-gcc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/compiler-gcc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/compiler-gcc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/compiler-gcc.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/compiler-gcc.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/compiler-gcc.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/compiler.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/compiler.h
deleted file mode 120000
index c3c0a7c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/compiler.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/compiler.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/compiler.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/compiler.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/compiler.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/compiler.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/completion.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/completion.h
deleted file mode 120000
index af28044..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/completion.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/completion.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/completion.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/completion.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/completion.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/completion.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/config.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/config.h
deleted file mode 120000
index 71028f6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/config.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/config.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/config.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/config.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/config.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/config.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/console_struct.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/console_struct.h
deleted file mode 120000
index 7aa8514..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/console_struct.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/console_struct.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/console_struct.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/console_struct.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/console_struct.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/console_struct.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cpu.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cpu.h
deleted file mode 120000
index 2608247..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cpu.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/cpu.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/cpu.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cpu.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/cpu.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/cpu.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cpumask.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cpumask.h
deleted file mode 120000
index c8f6de0..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cpumask.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/cpumask.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/cpumask.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/cpumask.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/cpumask.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/cpumask.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ctype.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ctype.h
deleted file mode 120000
index e008d1e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ctype.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ctype.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ctype.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ctype.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ctype.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ctype.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dccp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dccp.h
deleted file mode 120000
index bc11d40..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dccp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/dccp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/dccp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dccp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/dccp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/dccp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/debug_locks.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/debug_locks.h
deleted file mode 120000
index 561a5bc..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/debug_locks.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/debug_locks.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/debug_locks.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/debug_locks.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/debug_locks.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/debug_locks.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/delay.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/delay.h
deleted file mode 120000
index d934a13..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/delay.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/delay.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/delay.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/delay.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/delay.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/delay.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/device.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/device.h
deleted file mode 120000
index 2440aba..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/device.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/device.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/device.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/device.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/device.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/device.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dirent.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dirent.h
deleted file mode 120000
index f16f4a4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dirent.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/dirent.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/dirent.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dirent.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/dirent.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/dirent.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dm-ioctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dm-ioctl.h
deleted file mode 120000
index d7305d2..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dm-ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/dm-ioctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/dm-ioctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dm-ioctl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/dm-ioctl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/dm-ioctl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dma-mapping.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dma-mapping.h
deleted file mode 120000
index d8f5664..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dma-mapping.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/dma-mapping.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/dma-mapping.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dma-mapping.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/dma-mapping.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/dma-mapping.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dmaengine.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dmaengine.h
deleted file mode 120000
index 31efa05..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dmaengine.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/dmaengine.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/dmaengine.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/dmaengine.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/dmaengine.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/dmaengine.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/efs_dir.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/efs_dir.h
deleted file mode 120000
index 5aae574..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/efs_dir.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/efs_dir.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/efs_dir.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/efs_dir.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/efs_dir.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/efs_dir.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/efs_fs_i.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/efs_fs_i.h
deleted file mode 120000
index 1ea12f6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/efs_fs_i.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/efs_fs_i.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/efs_fs_i.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/efs_fs_i.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/efs_fs_i.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/efs_fs_i.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/efs_fs_sb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/efs_fs_sb.h
deleted file mode 120000
index 9ece7e1..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/efs_fs_sb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/efs_fs_sb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/efs_fs_sb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/efs_fs_sb.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/efs_fs_sb.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/efs_fs_sb.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/elevator.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/elevator.h
deleted file mode 120000
index a15375f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/elevator.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/elevator.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/elevator.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/elevator.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/elevator.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/elevator.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/elf-em.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/elf-em.h
deleted file mode 120000
index a70534c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/elf-em.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/elf-em.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/elf-em.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/elf-em.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/elf-em.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/elf-em.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/elf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/elf.h
deleted file mode 120000
index 4455674..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/elf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/elf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/elf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/elf.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/elf.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/elf.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/err.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/err.h
deleted file mode 120000
index 7bc3976..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/err.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/err.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/err.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/err.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/err.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/err.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/errno.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/errno.h
deleted file mode 120000
index 17901cf..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/errno.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/errno.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/errno.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/errno.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/errno.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/errno.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/errqueue.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/errqueue.h
deleted file mode 120000
index f857679..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/errqueue.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/errqueue.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/errqueue.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/errqueue.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/errqueue.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/errqueue.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/etherdevice.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/etherdevice.h
deleted file mode 120000
index c6fc657..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/etherdevice.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/etherdevice.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/etherdevice.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/etherdevice.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/etherdevice.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/etherdevice.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ext2_fs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ext2_fs.h
deleted file mode 120000
index 6d1ef48..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ext2_fs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ext2_fs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ext2_fs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ext2_fs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ext2_fs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ext2_fs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ext3_fs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ext3_fs.h
deleted file mode 120000
index 401d884..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ext3_fs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ext3_fs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ext3_fs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ext3_fs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ext3_fs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ext3_fs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fadvise.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fadvise.h
deleted file mode 120000
index 28391d0..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fadvise.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/fadvise.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/fadvise.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fadvise.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/fadvise.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/fadvise.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fb.h
deleted file mode 120000
index 678e85b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/fb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/fb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fb.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/fb.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/fb.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fcntl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fcntl.h
deleted file mode 120000
index 628a481..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fcntl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/fcntl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/fcntl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fcntl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/fcntl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/fcntl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fd.h
deleted file mode 120000
index 27d6d08..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/fd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/fd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fd.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/fd.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/fd.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/file.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/file.h
deleted file mode 120000
index d063b5e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/file.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/file.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/file.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/file.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/file.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/file.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/filter.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/filter.h
deleted file mode 120000
index 54c78a3..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/filter.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/filter.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/filter.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/filter.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/filter.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/filter.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fs.h
deleted file mode 120000
index c72717d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/fs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/fs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/fs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/fs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/fs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ftape.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ftape.h
deleted file mode 120000
index 59efd2b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ftape.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ftape.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ftape.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ftape.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ftape.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ftape.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/futex.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/futex.h
deleted file mode 120000
index cbfdedb..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/futex.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/futex.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/futex.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/futex.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/futex.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/futex.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/genhd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/genhd.h
deleted file mode 120000
index 4182ac6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/genhd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/genhd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/genhd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/genhd.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/genhd.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/genhd.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/gfp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/gfp.h
deleted file mode 120000
index 955489e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/gfp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/gfp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/gfp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/gfp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/gfp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/gfp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hardirq.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hardirq.h
deleted file mode 120000
index 01128bd..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hardirq.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/hardirq.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/hardirq.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hardirq.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/hardirq.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/hardirq.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hdlc/ioctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hdlc/ioctl.h
deleted file mode 120000
index 7679e36..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hdlc/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/hdlc/ioctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/hdlc/ioctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hdlc/ioctl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/hdlc/ioctl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/hdlc/ioctl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hdreg.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hdreg.h
deleted file mode 120000
index 35aea04..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hdreg.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/hdreg.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/hdreg.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hdreg.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/hdreg.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/hdreg.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hdsmart.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hdsmart.h
deleted file mode 120000
index 383f58c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hdsmart.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/hdsmart.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/hdsmart.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hdsmart.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/hdsmart.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/hdsmart.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/highmem.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/highmem.h
deleted file mode 120000
index 0f41fc7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/highmem.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/highmem.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/highmem.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/highmem.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/highmem.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/highmem.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hil.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hil.h
deleted file mode 120000
index 2bee8bb..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hil.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/hil.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/hil.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/hil.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/hil.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/hil.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/i2c.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/i2c.h
deleted file mode 120000
index 514ff43..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/i2c.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/i2c.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/i2c.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/i2c.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/i2c.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/i2c.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/icmp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/icmp.h
deleted file mode 120000
index 87771a7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/icmp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/icmp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/icmp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/icmp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/icmp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/icmp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if.h
deleted file mode 120000
index 176aae6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/if.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/if.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/if.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_arcnet.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_arcnet.h
deleted file mode 120000
index 0d04ae3..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_arcnet.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_arcnet.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/if_arcnet.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_arcnet.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/if_arcnet.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_arcnet.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_arp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_arp.h
deleted file mode 120000
index 536a142..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_arp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_arp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/if_arp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_arp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/if_arp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_arp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_bridge.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_bridge.h
deleted file mode 120000
index ad36ad5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_bridge.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_bridge.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/if_bridge.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_bridge.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/if_bridge.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_bridge.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_ether.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_ether.h
deleted file mode 120000
index 4dc3348..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_ether.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_ether.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/if_ether.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_ether.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/if_ether.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_ether.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_fc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_fc.h
deleted file mode 120000
index 087ec19..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_fc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_fc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/if_fc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_fc.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/if_fc.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_fc.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_fddi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_fddi.h
deleted file mode 120000
index 6c439ad..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_fddi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_fddi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/if_fddi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_fddi.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/if_fddi.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_fddi.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_hippi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_hippi.h
deleted file mode 120000
index f4febf9..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_hippi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_hippi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/if_hippi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_hippi.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/if_hippi.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_hippi.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_packet.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_packet.h
deleted file mode 120000
index d48d404..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_packet.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_packet.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/if_packet.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_packet.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/if_packet.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_packet.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_ppp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_ppp.h
deleted file mode 120000
index 1c0292e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_ppp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_ppp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/if_ppp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_ppp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/if_ppp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_ppp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_tr.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_tr.h
deleted file mode 120000
index 115cd17..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_tr.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_tr.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/if_tr.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_tr.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/if_tr.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_tr.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_tun.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_tun.h
deleted file mode 120000
index f127941..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_tun.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_tun.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/if_tun.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_tun.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/if_tun.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_tun.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_vlan.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_vlan.h
deleted file mode 120000
index f20fce0..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_vlan.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/if_vlan.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/if_vlan.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_vlan.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/if_vlan.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/if_vlan.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/in.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/in.h
deleted file mode 120000
index 0e127e0..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/in.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/in.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/in.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/in.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/in.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/in.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/in6.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/in6.h
deleted file mode 120000
index 18c3130..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/in6.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/in6.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/in6.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/in6.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/in6.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/in6.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/init.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/init.h
deleted file mode 120000
index 488bb0a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/init.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/init.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/init.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/init.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/init.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/init.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/inotify.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/inotify.h
deleted file mode 120000
index 41670ad..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/inotify.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/inotify.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/inotify.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/inotify.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/inotify.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/inotify.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/input.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/input.h
deleted file mode 120000
index 423edd7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/input.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/input.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/input.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/input.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/input.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/input.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/interrupt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/interrupt.h
deleted file mode 120000
index b5cd63c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/interrupt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/interrupt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/interrupt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/interrupt.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/interrupt.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/interrupt.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ioctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ioctl.h
deleted file mode 120000
index b30e479..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ioctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ioctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ioctl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ioctl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ioctl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ioport.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ioport.h
deleted file mode 120000
index d90526d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ioport.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ioport.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ioport.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ioport.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ioport.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ioport.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ioprio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ioprio.h
deleted file mode 120000
index 1634241..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ioprio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ioprio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ioprio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ioprio.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ioprio.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ioprio.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ip.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ip.h
deleted file mode 120000
index e89967b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ip.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ip.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ip.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ip.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ip.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ip.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipc.h
deleted file mode 120000
index 60f3881..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ipc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ipc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipc.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ipc.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipc.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipmi_msgdefs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipmi_msgdefs.h
deleted file mode 120000
index 2cfe5ac..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipmi_msgdefs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ipmi_msgdefs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ipmi_msgdefs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipmi_msgdefs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ipmi_msgdefs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipmi_msgdefs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipmi_smi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipmi_smi.h
deleted file mode 120000
index 9a796a2..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipmi_smi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ipmi_smi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ipmi_smi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipmi_smi.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ipmi_smi.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipmi_smi.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipx.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipx.h
deleted file mode 120000
index dd5d4b9..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipx.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ipx.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ipx.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipx.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ipx.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ipx.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irq.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irq.h
deleted file mode 120000
index aa6cf1a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irq.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/irq.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/irq.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irq.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/irq.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/irq.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irq_cpustat.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irq_cpustat.h
deleted file mode 120000
index 4a329b4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irq_cpustat.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/irq_cpustat.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/irq_cpustat.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irq_cpustat.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/irq_cpustat.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/irq_cpustat.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irqflags.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irqflags.h
deleted file mode 120000
index fa80886..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irqflags.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/irqflags.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/irqflags.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irqflags.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/irqflags.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/irqflags.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irqreturn.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irqreturn.h
deleted file mode 120000
index 739fa62..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irqreturn.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/irqreturn.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/irqreturn.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/irqreturn.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/irqreturn.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/irqreturn.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/jbd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/jbd.h
deleted file mode 120000
index 9594286..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/jbd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/jbd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/jbd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/jbd.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/jbd.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/jbd.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/jiffies.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/jiffies.h
deleted file mode 120000
index 5accf6a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/jiffies.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/jiffies.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/jiffies.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/jiffies.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/jiffies.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/jiffies.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kd.h
deleted file mode 120000
index e7005fa..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/kd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kd.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/kd.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/kd.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kdev_t.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kdev_t.h
deleted file mode 120000
index fffcdac..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kdev_t.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kdev_t.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/kdev_t.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kdev_t.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/kdev_t.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/kdev_t.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kernel.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kernel.h
deleted file mode 120000
index 4b3447c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kernel.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kernel.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/kernel.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kernel.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/kernel.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/kernel.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kernel_stat.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kernel_stat.h
deleted file mode 120000
index 2f1598b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kernel_stat.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kernel_stat.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/kernel_stat.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kernel_stat.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/kernel_stat.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/kernel_stat.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kernelcapi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kernelcapi.h
deleted file mode 120000
index 78f09ac..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kernelcapi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kernelcapi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/kernelcapi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kernelcapi.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/kernelcapi.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/kernelcapi.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kexec.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kexec.h
deleted file mode 120000
index 883b34f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kexec.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kexec.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/kexec.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kexec.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/kexec.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/kexec.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/key.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/key.h
deleted file mode 120000
index a43f262..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/key.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/key.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/key.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/key.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/key.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/key.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/keyboard.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/keyboard.h
deleted file mode 120000
index f1e952c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/keyboard.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/keyboard.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/keyboard.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/keyboard.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/keyboard.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/keyboard.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/keychord.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/keychord.h
deleted file mode 120000
index 4af7a30..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/keychord.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/keychord.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/keychord.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/keychord.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/keychord.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/keychord.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/klist.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/klist.h
deleted file mode 120000
index 6c121e7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/klist.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/klist.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/klist.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/klist.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/klist.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/klist.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kmod.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kmod.h
deleted file mode 120000
index 0fc11ce..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kmod.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kmod.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/kmod.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kmod.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/kmod.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/kmod.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kobject.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kobject.h
deleted file mode 120000
index 1e2eb82..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kobject.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kobject.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/kobject.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kobject.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/kobject.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/kobject.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kref.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kref.h
deleted file mode 120000
index 84f0760..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kref.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/kref.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/kref.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/kref.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/kref.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/kref.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ktime.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ktime.h
deleted file mode 120000
index bd9e539..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ktime.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ktime.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ktime.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ktime.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ktime.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ktime.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/limits.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/limits.h
deleted file mode 120000
index 998a2f3..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/limits.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/limits.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/limits.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/limits.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/limits.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/limits.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/linkage.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/linkage.h
deleted file mode 120000
index 9981e49..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/linkage.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/linkage.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/linkage.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/linkage.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/linkage.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/linkage.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/list.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/list.h
deleted file mode 120000
index 8b5214f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/list.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/list.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/list.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/list.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/list.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/list.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/lockd/nlm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/lockd/nlm.h
deleted file mode 120000
index 1f70297..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/lockd/nlm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/lockd/nlm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/lockd/nlm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/lockd/nlm.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/lockd/nlm.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/lockd/nlm.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/lockd/xdr.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/lockd/xdr.h
deleted file mode 120000
index 59987cf..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/lockd/xdr.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/lockd/xdr.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/lockd/xdr.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/lockd/xdr.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/lockd/xdr.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/lockd/xdr.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/lockdep.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/lockdep.h
deleted file mode 120000
index 6a6ae87..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/lockdep.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/lockdep.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/lockdep.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/lockdep.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/lockdep.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/lockdep.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/loop.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/loop.h
deleted file mode 120000
index 6c91215..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/loop.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/loop.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/loop.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/loop.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/loop.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/loop.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/magic.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/magic.h
deleted file mode 120000
index afafcfd..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/magic.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/magic.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/magic.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/magic.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/magic.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/magic.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/major.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/major.h
deleted file mode 120000
index f08b244..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/major.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/major.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/major.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/major.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/major.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/major.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mc146818rtc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mc146818rtc.h
deleted file mode 120000
index 4286741..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mc146818rtc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mc146818rtc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mc146818rtc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mc146818rtc.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mc146818rtc.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mc146818rtc.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mca.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mca.h
deleted file mode 120000
index 1f34bde..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mca.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mca.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mca.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mca.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mca.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mca.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mempolicy.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mempolicy.h
deleted file mode 120000
index 2690b14..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mempolicy.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mempolicy.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mempolicy.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mempolicy.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mempolicy.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mempolicy.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mempool.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mempool.h
deleted file mode 120000
index eaed026..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mempool.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mempool.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mempool.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mempool.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mempool.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mempool.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/miscdevice.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/miscdevice.h
deleted file mode 120000
index 7de3342..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/miscdevice.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/miscdevice.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/miscdevice.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/miscdevice.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/miscdevice.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/miscdevice.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mm.h
deleted file mode 120000
index 111cc15..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mm.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mm.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mm.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmc/card.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmc/card.h
deleted file mode 120000
index 0a25330..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmc/card.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mmc/card.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mmc/card.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmc/card.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mmc/card.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmc/card.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmc/host.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmc/host.h
deleted file mode 120000
index 61ab0f6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmc/host.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mmc/host.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mmc/host.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmc/host.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mmc/host.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmc/host.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmc/mmc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmc/mmc.h
deleted file mode 120000
index ca8b23e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmc/mmc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mmc/mmc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mmc/mmc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmc/mmc.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mmc/mmc.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmc/mmc.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmzone.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmzone.h
deleted file mode 120000
index 6bd8d97..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmzone.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mmzone.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mmzone.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmzone.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mmzone.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mmzone.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mod_devicetable.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mod_devicetable.h
deleted file mode 120000
index 1104eb5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mod_devicetable.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mod_devicetable.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mod_devicetable.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mod_devicetable.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mod_devicetable.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mod_devicetable.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/module.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/module.h
deleted file mode 120000
index 93b3b19..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/module.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/module.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/module.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/module.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/module.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/module.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/moduleparam.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/moduleparam.h
deleted file mode 120000
index 1f544b7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/moduleparam.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/moduleparam.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/moduleparam.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/moduleparam.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/moduleparam.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/moduleparam.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mount.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mount.h
deleted file mode 120000
index 5ac8a42..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mount.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mount.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mount.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mount.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mount.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mount.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msdos_fs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msdos_fs.h
deleted file mode 120000
index de01ab3..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msdos_fs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/msdos_fs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/msdos_fs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msdos_fs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/msdos_fs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/msdos_fs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msg.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msg.h
deleted file mode 120000
index 4b5c4f9..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msg.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/msg.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/msg.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msg.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/msg.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/msg.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msm_adsp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msm_adsp.h
deleted file mode 120000
index 620ab8d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msm_adsp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/msm_adsp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/msm_adsp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msm_adsp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/msm_adsp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/msm_adsp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msm_audio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msm_audio.h
deleted file mode 120000
index 730a831..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msm_audio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/msm_audio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/msm_audio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msm_audio.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/msm_audio.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/msm_audio.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msm_mdp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msm_mdp.h
deleted file mode 120000
index d4ff409..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msm_mdp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/msm_mdp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/msm_mdp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/msm_mdp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/msm_mdp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/msm_mdp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mt9t013.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mt9t013.h
deleted file mode 120000
index 8a2b5c0..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mt9t013.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mt9t013.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mt9t013.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mt9t013.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mt9t013.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mt9t013.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/bbm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/bbm.h
deleted file mode 120000
index d2d24c5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/bbm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/bbm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mtd/bbm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/bbm.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mtd/bbm.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/bbm.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/blktrans.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/blktrans.h
deleted file mode 120000
index f16b497..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/blktrans.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/blktrans.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mtd/blktrans.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/blktrans.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mtd/blktrans.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/blktrans.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/cfi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/cfi.h
deleted file mode 120000
index 468e5e8..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/cfi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/cfi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mtd/cfi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/cfi.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mtd/cfi.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/cfi.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/cfi_endian.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/cfi_endian.h
deleted file mode 120000
index 3f9e287..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/cfi_endian.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/cfi_endian.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mtd/cfi_endian.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/cfi_endian.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mtd/cfi_endian.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/cfi_endian.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/compatmac.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/compatmac.h
deleted file mode 120000
index ed02458..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/compatmac.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/compatmac.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mtd/compatmac.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/compatmac.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mtd/compatmac.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/compatmac.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/flashchip.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/flashchip.h
deleted file mode 120000
index 96a349d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/flashchip.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/flashchip.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mtd/flashchip.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/flashchip.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mtd/flashchip.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/flashchip.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/map.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/map.h
deleted file mode 120000
index fee2465..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/map.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/map.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mtd/map.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/map.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mtd/map.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/map.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/mtd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/mtd.h
deleted file mode 120000
index 7821ca4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/mtd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/mtd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mtd/mtd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/mtd.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mtd/mtd.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/mtd.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/nand.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/nand.h
deleted file mode 120000
index 00fe26e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/nand.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/nand.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mtd/nand.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/nand.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mtd/nand.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/nand.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/nand_ecc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/nand_ecc.h
deleted file mode 120000
index 3c780f2..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/nand_ecc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/nand_ecc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mtd/nand_ecc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/nand_ecc.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mtd/nand_ecc.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/nand_ecc.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/nftl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/nftl.h
deleted file mode 120000
index b68add4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/nftl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/nftl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mtd/nftl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/nftl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mtd/nftl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/nftl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/onenand_regs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/onenand_regs.h
deleted file mode 120000
index cf98f5e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/onenand_regs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/onenand_regs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mtd/onenand_regs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/onenand_regs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mtd/onenand_regs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/onenand_regs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/partitions.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/partitions.h
deleted file mode 120000
index 1943ac4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/partitions.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/mtd/partitions.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mtd/partitions.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/partitions.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mtd/partitions.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtd/partitions.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtio.h
deleted file mode 120000
index e4a665b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mtio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mtio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtio.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mtio.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mtio.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mutex-debug.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mutex-debug.h
deleted file mode 120000
index b03b89e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mutex-debug.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mutex-debug.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mutex-debug.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mutex-debug.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mutex-debug.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mutex-debug.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mutex.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mutex.h
deleted file mode 120000
index adaf51c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mutex.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/mutex.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/mutex.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/mutex.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/mutex.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/mutex.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ncp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ncp.h
deleted file mode 120000
index 36de989..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ncp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ncp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ncp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ncp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ncp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ncp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ncp_mount.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ncp_mount.h
deleted file mode 120000
index d8e6b48..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ncp_mount.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ncp_mount.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ncp_mount.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ncp_mount.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ncp_mount.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ncp_mount.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ncp_no.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ncp_no.h
deleted file mode 120000
index 4e59a2b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ncp_no.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ncp_no.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ncp_no.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ncp_no.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ncp_no.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ncp_no.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/net.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/net.h
deleted file mode 120000
index 9ff68ce..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/net.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/net.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/net.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/net.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/net.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/net.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netdevice.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netdevice.h
deleted file mode 120000
index 103b2df..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netdevice.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/netdevice.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netdevice.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netdevice.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netdevice.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netdevice.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter.h
deleted file mode 120000
index 81c9328..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/netfilter.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_common.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_common.h
deleted file mode 120000
index 840faca..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_common.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/nf_conntrack_common.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/nf_conntrack_common.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_common.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/nf_conntrack_common.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_common.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_ftp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_ftp.h
deleted file mode 120000
index 3a8e544..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_ftp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/nf_conntrack_ftp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/nf_conntrack_ftp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_ftp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/nf_conntrack_ftp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_ftp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_sctp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_sctp.h
deleted file mode 120000
index 17c5b25..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_sctp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/nf_conntrack_sctp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/nf_conntrack_sctp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_sctp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/nf_conntrack_sctp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_sctp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_tcp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_tcp.h
deleted file mode 120000
index 483187d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_tcp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/nf_conntrack_tcp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/nf_conntrack_tcp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_tcp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/nf_conntrack_tcp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_tcp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_tuple_common.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_tuple_common.h
deleted file mode 120000
index 2335e58..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_tuple_common.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/nf_conntrack_tuple_common.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/nf_conntrack_tuple_common.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_tuple_common.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/nf_conntrack_tuple_common.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nf_conntrack_tuple_common.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nfnetlink.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nfnetlink.h
deleted file mode 120000
index 434215d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nfnetlink.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/nfnetlink.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/nfnetlink.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nfnetlink.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/nfnetlink.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nfnetlink.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nfnetlink_conntrack.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nfnetlink_conntrack.h
deleted file mode 120000
index 87cc812..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nfnetlink_conntrack.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/nfnetlink_conntrack.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/nfnetlink_conntrack.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nfnetlink_conntrack.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/nfnetlink_conntrack.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/nfnetlink_conntrack.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/x_tables.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/x_tables.h
deleted file mode 120000
index d2b9746..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/x_tables.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/x_tables.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/x_tables.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/x_tables.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/x_tables.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/x_tables.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_CLASSIFY.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_CLASSIFY.h
deleted file mode 120000
index a3b868a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_CLASSIFY.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_CLASSIFY.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_CLASSIFY.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_CLASSIFY.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_CLASSIFY.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_CLASSIFY.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_CONNSECMARK.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_CONNSECMARK.h
deleted file mode 120000
index 725dafb..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_CONNSECMARK.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_CONNSECMARK.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_CONNSECMARK.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_CONNSECMARK.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_CONNSECMARK.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_CONNSECMARK.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_NFQUEUE.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_NFQUEUE.h
deleted file mode 120000
index 851f571..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_NFQUEUE.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_NFQUEUE.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_NFQUEUE.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_NFQUEUE.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_NFQUEUE.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_NFQUEUE.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_SECMARK.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_SECMARK.h
deleted file mode 120000
index 02dfc1b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_SECMARK.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_SECMARK.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_SECMARK.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_SECMARK.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_SECMARK.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_SECMARK.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_comment.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_comment.h
deleted file mode 120000
index 141f426..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_comment.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_comment.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_comment.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_comment.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_comment.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_comment.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_connbytes.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_connbytes.h
deleted file mode 120000
index 7e67ee9..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_connbytes.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_connbytes.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_connbytes.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_connbytes.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_connbytes.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_connbytes.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_conntrack.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_conntrack.h
deleted file mode 120000
index 04a1729..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_conntrack.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_conntrack.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_conntrack.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_conntrack.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_conntrack.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_conntrack.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_dccp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_dccp.h
deleted file mode 120000
index 6bdc874..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_dccp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_dccp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_dccp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_dccp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_dccp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_dccp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_esp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_esp.h
deleted file mode 120000
index a27d0cc..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_esp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_esp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_esp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_esp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_esp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_esp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_helper.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_helper.h
deleted file mode 120000
index 6b958db..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_helper.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_helper.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_helper.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_helper.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_helper.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_helper.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_length.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_length.h
deleted file mode 120000
index 680ef6b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_length.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_length.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_length.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_length.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_length.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_length.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_limit.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_limit.h
deleted file mode 120000
index 24bce98..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_limit.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_limit.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_limit.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_limit.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_limit.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_limit.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_mac.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_mac.h
deleted file mode 120000
index 24af1fc..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_mac.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_mac.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_mac.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_mac.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_mac.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_mac.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_multiport.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_multiport.h
deleted file mode 120000
index 80b337d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_multiport.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_multiport.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_multiport.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_multiport.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_multiport.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_multiport.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_physdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_physdev.h
deleted file mode 120000
index c6ad18c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_physdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_physdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_physdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_physdev.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_physdev.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_physdev.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_pkttype.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_pkttype.h
deleted file mode 120000
index 3551c0d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_pkttype.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_pkttype.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_pkttype.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_pkttype.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_pkttype.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_pkttype.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_quota.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_quota.h
deleted file mode 120000
index fc9f8b0..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_quota.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_quota.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_quota.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_quota.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_quota.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_quota.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_realm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_realm.h
deleted file mode 120000
index 7c0e5f6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_realm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_realm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_realm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_realm.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_realm.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_realm.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_sctp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_sctp.h
deleted file mode 120000
index cede7c7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_sctp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_sctp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_sctp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_sctp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_sctp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_sctp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_state.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_state.h
deleted file mode 120000
index 3f2ee91..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_state.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_state.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_state.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_state.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_state.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_state.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_statistic.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_statistic.h
deleted file mode 120000
index dc1fe25..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_statistic.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_statistic.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_statistic.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_statistic.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_statistic.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_statistic.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_string.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_string.h
deleted file mode 120000
index c19bebe..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_string.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_string.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_string.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_string.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_string.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_string.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_tcpmss.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_tcpmss.h
deleted file mode 120000
index 90cf9d5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_tcpmss.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_tcpmss.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_tcpmss.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_tcpmss.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_tcpmss.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_tcpmss.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_tcpudp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_tcpudp.h
deleted file mode 120000
index 4e3f6b5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_tcpudp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter/xt_tcpudp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter/xt_tcpudp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_tcpudp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter/xt_tcpudp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter/xt_tcpudp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_arp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_arp.h
deleted file mode 120000
index e6172ef..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_arp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/netfilter_arp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_arp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_arp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_arp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_arp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_arp/arp_tables.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_arp/arp_tables.h
deleted file mode 120000
index b31b8c2..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_arp/arp_tables.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_arp/arp_tables.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_arp/arp_tables.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_arp/arp_tables.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_arp/arp_tables.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_arp/arp_tables.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_bridge.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_bridge.h
deleted file mode 120000
index f582040..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_bridge.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/netfilter_bridge.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_bridge.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_bridge.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_bridge.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_bridge.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4.h
deleted file mode 120000
index 1daca65..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/netfilter_ipv4.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack.h
deleted file mode 120000
index 841b2e9..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ip_conntrack.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ip_conntrack.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ip_conntrack.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
deleted file mode 120000
index 109ccef..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat.h
deleted file mode 120000
index 9b17b22..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ip_nat.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ip_nat.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ip_nat.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat_rule.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat_rule.h
deleted file mode 120000
index fe78e7f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat_rule.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ip_nat_rule.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ip_nat_rule.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat_rule.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ip_nat_rule.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat_rule.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_queue.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_queue.h
deleted file mode 120000
index 3ea52ca..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_queue.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ip_queue.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ip_queue.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_queue.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ip_queue.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_queue.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_tables.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_tables.h
deleted file mode 120000
index 0f8460d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_tables.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ip_tables.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ip_tables.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_tables.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ip_tables.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ip_tables.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
deleted file mode 120000
index f908438..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_CLASSIFY.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_DSCP.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_DSCP.h
deleted file mode 120000
index 29058d2..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_DSCP.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_DSCP.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_DSCP.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_DSCP.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_DSCP.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_DSCP.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ECN.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ECN.h
deleted file mode 120000
index fc1128c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ECN.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_ECN.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_ECN.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ECN.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_ECN.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ECN.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_LOG.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_LOG.h
deleted file mode 120000
index b5dbb55..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_LOG.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_LOG.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_LOG.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_LOG.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_LOG.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_LOG.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
deleted file mode 120000
index 3686206..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_NFQUEUE.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_REJECT.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_REJECT.h
deleted file mode 120000
index b3f1023..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_REJECT.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_REJECT.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_REJECT.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_REJECT.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_REJECT.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_REJECT.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h
deleted file mode 120000
index fd24f6a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_TCPMSS.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_TCPMSS.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_TCPMSS.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TOS.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TOS.h
deleted file mode 120000
index bb1a243..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TOS.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_TOS.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_TOS.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TOS.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_TOS.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TOS.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TTL.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TTL.h
deleted file mode 120000
index 0ad1303..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TTL.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_TTL.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_TTL.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TTL.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_TTL.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TTL.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ULOG.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ULOG.h
deleted file mode 120000
index 9cc45e5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ULOG.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_ULOG.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_ULOG.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ULOG.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_ULOG.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ULOG.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_addrtype.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_addrtype.h
deleted file mode 120000
index 3b37d0b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_addrtype.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_addrtype.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_addrtype.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_addrtype.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_addrtype.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_addrtype.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ah.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ah.h
deleted file mode 120000
index 4b846fa..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ah.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_ah.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_ah.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ah.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_ah.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ah.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_comment.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_comment.h
deleted file mode 120000
index 96a07ea..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_comment.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_comment.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_comment.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_comment.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_comment.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_comment.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_connbytes.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_connbytes.h
deleted file mode 120000
index 76120e8..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_connbytes.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_connbytes.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_connbytes.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_connbytes.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_connbytes.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_connbytes.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dccp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dccp.h
deleted file mode 120000
index 9be071c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dccp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_dccp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_dccp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dccp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_dccp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dccp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dscp_.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dscp_.h
deleted file mode 120000
index 75879c3..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dscp_.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_dscp_.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_dscp_.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dscp_.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_dscp_.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dscp_.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_esp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_esp.h
deleted file mode 120000
index 9830294..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_esp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_esp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_esp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_esp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_esp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_esp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h
deleted file mode 120000
index 67cbcc1..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_hashlimit.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_hashlimit.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_hashlimit.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_helper.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_helper.h
deleted file mode 120000
index b7039dc..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_helper.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_helper.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_helper.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_helper.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_helper.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_helper.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_iprange.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_iprange.h
deleted file mode 120000
index d225d28..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_iprange.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_iprange.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_iprange.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_iprange.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_iprange.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_iprange.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_length.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_length.h
deleted file mode 120000
index 268a39e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_length.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_length.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_length.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_length.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_length.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_length.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_mac.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_mac.h
deleted file mode 120000
index f3cae5b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_mac.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_mac.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_mac.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_mac.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_mac.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_mac.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_owner.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_owner.h
deleted file mode 120000
index b082109..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_owner.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_owner.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_owner.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_owner.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_owner.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_owner.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_physdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_physdev.h
deleted file mode 120000
index 47258d4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_physdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_physdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_physdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_physdev.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_physdev.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_physdev.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_pkttype.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_pkttype.h
deleted file mode 120000
index dc938c1..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_pkttype.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_pkttype.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_pkttype.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_pkttype.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_pkttype.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_pkttype.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_realm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_realm.h
deleted file mode 120000
index c07b56d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_realm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_realm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_realm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_realm.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_realm.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_realm.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_recent.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_recent.h
deleted file mode 120000
index 531cb56..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_recent.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_recent.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_recent.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_recent.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_recent.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_recent.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_sctp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_sctp.h
deleted file mode 120000
index 341f347..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_sctp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_sctp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_sctp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_sctp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_sctp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_sctp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_state.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_state.h
deleted file mode 120000
index da5187b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_state.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_state.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_state.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_state.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_state.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_state.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_string.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_string.h
deleted file mode 120000
index 12d23d4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_string.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_string.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_string.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_string.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_string.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_string.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_tos_.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_tos_.h
deleted file mode 120000
index 35348cc..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_tos_.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv4/ipt_tos_.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_tos_.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_tos_.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv4/ipt_tos_.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv4/ipt_tos_.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6.h
deleted file mode 120000
index 0a37d5b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/netfilter_ipv6.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6_tables.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6_tables.h
deleted file mode 120000
index dbabff2..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6_tables.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6_tables.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6_tables.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6_tables.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6_tables.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6_tables.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_LOG.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_LOG.h
deleted file mode 120000
index c7b27c9..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_LOG.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_LOG.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_LOG.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_LOG.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_LOG.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_LOG.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h
deleted file mode 120000
index fcee66d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_REJECT.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_REJECT.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_REJECT.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ah.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ah.h
deleted file mode 120000
index 79151b0..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ah.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_ah.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_ah.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ah.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_ah.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ah.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_esp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_esp.h
deleted file mode 120000
index 4f116b7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_esp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_esp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_esp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_esp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_esp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_esp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_frag.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_frag.h
deleted file mode 120000
index 7375205..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_frag.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_frag.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_frag.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_frag.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_frag.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_frag.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h
deleted file mode 120000
index d3bc0ae..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_ipv6header.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_ipv6header.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_ipv6header.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_length.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_length.h
deleted file mode 120000
index cc583e5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_length.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_length.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_length.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_length.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_length.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_length.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_mac.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_mac.h
deleted file mode 120000
index edb21e3..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_mac.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_mac.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_mac.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_mac.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_mac.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_mac.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_opts.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_opts.h
deleted file mode 120000
index 7dd0aec..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_opts.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_opts.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_opts.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_opts.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_opts.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_opts.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_owner.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_owner.h
deleted file mode 120000
index cd6bbca..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_owner.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_owner.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_owner.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_owner.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_owner.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_owner.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_physdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_physdev.h
deleted file mode 120000
index 72d42c8..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_physdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_physdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_physdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_physdev.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_physdev.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_physdev.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_rt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_rt.h
deleted file mode 120000
index 0ade394..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_rt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/netfilter_ipv6/ip6t_rt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_rt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_rt.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netfilter_ipv6/ip6t_rt.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_rt.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netlink.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netlink.h
deleted file mode 120000
index 91610b8..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netlink.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/netlink.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/netlink.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/netlink.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/netlink.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/netlink.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs.h
deleted file mode 120000
index a055478..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nfs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nfs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nfs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs2.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs2.h
deleted file mode 120000
index c3a9509..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs2.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nfs2.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nfs2.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs2.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nfs2.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs2.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs3.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs3.h
deleted file mode 120000
index 4cd8d7a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs3.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nfs3.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nfs3.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs3.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nfs3.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs3.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs4.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs4.h
deleted file mode 120000
index 4649859..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs4.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nfs4.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nfs4.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs4.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nfs4.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs4.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs_xdr.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs_xdr.h
deleted file mode 120000
index 2f6de25..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs_xdr.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nfs_xdr.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nfs_xdr.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs_xdr.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nfs_xdr.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfs_xdr.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsacl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsacl.h
deleted file mode 120000
index c44aa13..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsacl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nfsacl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nfsacl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsacl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nfsacl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsacl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/auth.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/auth.h
deleted file mode 120000
index f68aa51..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/auth.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/auth.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nfsd/auth.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/auth.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nfsd/auth.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/auth.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/const.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/const.h
deleted file mode 120000
index fe65cf4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/const.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/const.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nfsd/const.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/const.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nfsd/const.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/const.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/debug.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/debug.h
deleted file mode 120000
index 789ca95..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/debug.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/debug.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nfsd/debug.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/debug.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nfsd/debug.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/debug.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/export.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/export.h
deleted file mode 120000
index 811763b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/export.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/export.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nfsd/export.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/export.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nfsd/export.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/export.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/interface.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/interface.h
deleted file mode 120000
index b19512d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/interface.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/interface.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nfsd/interface.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/interface.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nfsd/interface.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/interface.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/nfsfh.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/nfsfh.h
deleted file mode 120000
index 9f3e60d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/nfsfh.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/nfsfh.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nfsd/nfsfh.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/nfsfh.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nfsd/nfsfh.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/nfsfh.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/stats.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/stats.h
deleted file mode 120000
index 744e2fb..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/stats.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/stats.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nfsd/stats.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/stats.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nfsd/stats.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/stats.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/xdr.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/xdr.h
deleted file mode 120000
index 46d7928..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/xdr.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/nfsd/xdr.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nfsd/xdr.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/xdr.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nfsd/xdr.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nfsd/xdr.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/node.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/node.h
deleted file mode 120000
index e67c59f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/node.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/node.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/node.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/node.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/node.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/node.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nodemask.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nodemask.h
deleted file mode 120000
index 356c720..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nodemask.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nodemask.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nodemask.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nodemask.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nodemask.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nodemask.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/notifier.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/notifier.h
deleted file mode 120000
index a0dfdcf..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/notifier.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/notifier.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/notifier.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/notifier.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/notifier.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/notifier.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/numa.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/numa.h
deleted file mode 120000
index f0549f0..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/numa.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/numa.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/numa.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/numa.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/numa.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/numa.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nvram.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nvram.h
deleted file mode 120000
index e2bce31..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nvram.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/nvram.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/nvram.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/nvram.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/nvram.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/nvram.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/omap_csmi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/omap_csmi.h
deleted file mode 120000
index 0d2c516..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/omap_csmi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/omap_csmi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/omap_csmi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/omap_csmi.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/omap_csmi.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/omap_csmi.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pagemap.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pagemap.h
deleted file mode 120000
index 3545504..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pagemap.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pagemap.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/pagemap.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pagemap.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/pagemap.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/pagemap.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/param.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/param.h
deleted file mode 120000
index edd8f98..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/param.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/param.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/param.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/param.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/param.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/param.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/patchkey.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/patchkey.h
deleted file mode 120000
index 628a75c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/patchkey.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/patchkey.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/patchkey.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/patchkey.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/patchkey.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/patchkey.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pci.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pci.h
deleted file mode 120000
index 22b0ec7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pci.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pci.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/pci.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pci.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/pci.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/pci.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pci_ids.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pci_ids.h
deleted file mode 120000
index c3475fb..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pci_ids.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pci_ids.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/pci_ids.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pci_ids.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/pci_ids.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/pci_ids.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pci_regs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pci_regs.h
deleted file mode 120000
index 853c226..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pci_regs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pci_regs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/pci_regs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pci_regs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/pci_regs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/pci_regs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/percpu.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/percpu.h
deleted file mode 120000
index 93d6b27..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/percpu.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/percpu.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/percpu.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/percpu.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/percpu.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/percpu.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/percpu_counter.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/percpu_counter.h
deleted file mode 120000
index 6c839d4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/percpu_counter.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/percpu_counter.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/percpu_counter.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/percpu_counter.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/percpu_counter.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/percpu_counter.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/personality.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/personality.h
deleted file mode 120000
index 0d6b659..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/personality.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/personality.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/personality.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/personality.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/personality.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/personality.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pfkeyv2.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pfkeyv2.h
deleted file mode 120000
index 321bbb6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pfkeyv2.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pfkeyv2.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/pfkeyv2.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pfkeyv2.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/pfkeyv2.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/pfkeyv2.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pkt_cls.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pkt_cls.h
deleted file mode 120000
index 58e8899..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pkt_cls.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pkt_cls.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/pkt_cls.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pkt_cls.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/pkt_cls.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/pkt_cls.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pkt_sched.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pkt_sched.h
deleted file mode 120000
index 77b5a47..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pkt_sched.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pkt_sched.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/pkt_sched.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pkt_sched.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/pkt_sched.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/pkt_sched.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/platform_device.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/platform_device.h
deleted file mode 120000
index baa7b55..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/platform_device.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/platform_device.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/platform_device.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/platform_device.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/platform_device.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/platform_device.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/plist.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/plist.h
deleted file mode 120000
index 4d4e542..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/plist.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/plist.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/plist.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/plist.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/plist.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/plist.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pm.h
deleted file mode 120000
index 1a4339e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/pm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pm.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/pm.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/pm.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pnp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pnp.h
deleted file mode 120000
index d7e1bb9..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pnp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/pnp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/pnp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/pnp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/pnp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/pnp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/poll.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/poll.h
deleted file mode 120000
index 23c4b3f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/poll.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/poll.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/poll.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/poll.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/poll.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/poll.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/posix_acl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/posix_acl.h
deleted file mode 120000
index 29ae7cd..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/posix_acl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/posix_acl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/posix_acl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/posix_acl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/posix_acl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/posix_acl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/posix_types.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/posix_types.h
deleted file mode 120000
index bcbcf00..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/posix_types.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/posix_types.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/posix_types.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/posix_types.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/posix_types.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/posix_types.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ppdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ppdev.h
deleted file mode 120000
index 3b386a6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ppdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ppdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ppdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ppdev.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ppdev.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ppdev.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ppp_defs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ppp_defs.h
deleted file mode 120000
index 309a3d0..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ppp_defs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ppp_defs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ppp_defs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ppp_defs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ppp_defs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ppp_defs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/prctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/prctl.h
deleted file mode 120000
index 8bbe96c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/prctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/prctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/prctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/prctl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/prctl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/prctl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/preempt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/preempt.h
deleted file mode 120000
index 9b59fe3..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/preempt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/preempt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/preempt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/preempt.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/preempt.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/preempt.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/proc_fs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/proc_fs.h
deleted file mode 120000
index 6d310c4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/proc_fs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/proc_fs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/proc_fs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/proc_fs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/proc_fs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/proc_fs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ptrace.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ptrace.h
deleted file mode 120000
index 2617a6c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ptrace.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ptrace.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ptrace.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ptrace.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ptrace.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ptrace.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/qic117.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/qic117.h
deleted file mode 120000
index 7223064..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/qic117.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/qic117.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/qic117.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/qic117.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/qic117.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/qic117.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/qnxtypes.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/qnxtypes.h
deleted file mode 120000
index 5c767a3..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/qnxtypes.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/qnxtypes.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/qnxtypes.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/qnxtypes.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/qnxtypes.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/qnxtypes.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/quota.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/quota.h
deleted file mode 120000
index ed68365..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/quota.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/quota.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/quota.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/quota.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/quota.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/quota.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md.h
deleted file mode 120000
index e8599ef..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/raid/md.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/raid/md.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/raid/md.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md_k.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md_k.h
deleted file mode 120000
index 20f8ca6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md_k.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/raid/md_k.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/raid/md_k.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md_k.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/raid/md_k.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md_k.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md_p.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md_p.h
deleted file mode 120000
index f631a38..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md_p.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/raid/md_p.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/raid/md_p.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md_p.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/raid/md_p.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md_p.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md_u.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md_u.h
deleted file mode 120000
index 931271c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md_u.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/raid/md_u.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/raid/md_u.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md_u.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/raid/md_u.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/md_u.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/xor.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/xor.h
deleted file mode 120000
index b02a69a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/xor.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/raid/xor.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/raid/xor.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/xor.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/raid/xor.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/raid/xor.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/random.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/random.h
deleted file mode 120000
index 0088784..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/random.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/random.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/random.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/random.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/random.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/random.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rbtree.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rbtree.h
deleted file mode 120000
index f606d94..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rbtree.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/rbtree.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/rbtree.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rbtree.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/rbtree.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/rbtree.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rcupdate.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rcupdate.h
deleted file mode 120000
index e93235d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rcupdate.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/rcupdate.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/rcupdate.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rcupdate.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/rcupdate.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/rcupdate.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/reboot.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/reboot.h
deleted file mode 120000
index c3b86f4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/reboot.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/reboot.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/reboot.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/reboot.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/reboot.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/reboot.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/relay.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/relay.h
deleted file mode 120000
index c354e19..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/relay.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/relay.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/relay.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/relay.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/relay.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/relay.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/resource.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/resource.h
deleted file mode 120000
index 80a9f86..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/resource.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/resource.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/resource.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/resource.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/resource.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/resource.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/route.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/route.h
deleted file mode 120000
index c81b220..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/route.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/route.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/route.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/route.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/route.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/route.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rtc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rtc.h
deleted file mode 120000
index eaeecd3..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rtc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/rtc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/rtc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rtc.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/rtc.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/rtc.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rtnetlink.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rtnetlink.h
deleted file mode 120000
index 064a3d2..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rtnetlink.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/rtnetlink.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/rtnetlink.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rtnetlink.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/rtnetlink.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/rtnetlink.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rwsem.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rwsem.h
deleted file mode 120000
index 68eab47..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rwsem.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/rwsem.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/rwsem.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/rwsem.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/rwsem.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/rwsem.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sched.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sched.h
deleted file mode 120000
index e8ff88b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sched.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/sched.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sched.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sched.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sched.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sched.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sem.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sem.h
deleted file mode 120000
index 5348418..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sem.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/sem.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sem.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sem.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sem.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sem.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/seq_file.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/seq_file.h
deleted file mode 120000
index 2c25e6c..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/seq_file.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/seq_file.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/seq_file.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/seq_file.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/seq_file.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/seq_file.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/seqlock.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/seqlock.h
deleted file mode 120000
index 345108e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/seqlock.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/seqlock.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/seqlock.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/seqlock.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/seqlock.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/seqlock.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/serial_core.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/serial_core.h
deleted file mode 120000
index be40c9a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/serial_core.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/serial_core.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/serial_core.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/serial_core.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/serial_core.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/serial_core.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/serial_reg.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/serial_reg.h
deleted file mode 120000
index 60bd137..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/serial_reg.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/serial_reg.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/serial_reg.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/serial_reg.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/serial_reg.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/serial_reg.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/serio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/serio.h
deleted file mode 120000
index 4d3b062..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/serio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/serio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/serio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/serio.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/serio.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/serio.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/shm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/shm.h
deleted file mode 120000
index 4cd2df0..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/shm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/shm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/shm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/shm.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/shm.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/shm.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/signal.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/signal.h
deleted file mode 120000
index 10e9b01..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/signal.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/signal.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/signal.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/signal.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/signal.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/signal.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/skbuff.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/skbuff.h
deleted file mode 120000
index 5ff4983..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/skbuff.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/skbuff.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/skbuff.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/skbuff.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/skbuff.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/skbuff.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/slab.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/slab.h
deleted file mode 120000
index 04f089d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/slab.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/slab.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/slab.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/slab.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/slab.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/slab.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/smb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/smb.h
deleted file mode 120000
index 3f1cf22..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/smb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/smb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/smb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/smb.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/smb.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/smb.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/smp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/smp.h
deleted file mode 120000
index bfa5942..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/smp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/smp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/smp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/smp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/smp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/smp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/smp_lock.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/smp_lock.h
deleted file mode 120000
index 76d4cb0..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/smp_lock.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/smp_lock.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/smp_lock.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/smp_lock.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/smp_lock.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/smp_lock.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/socket.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/socket.h
deleted file mode 120000
index edc366f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/socket.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/socket.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/socket.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/socket.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/socket.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/socket.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sockios.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sockios.h
deleted file mode 120000
index 793adfb..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sockios.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/sockios.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sockios.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sockios.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sockios.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sockios.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/soundcard.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/soundcard.h
deleted file mode 120000
index ca37579..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/soundcard.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/soundcard.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/soundcard.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/soundcard.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/soundcard.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/soundcard.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock.h
deleted file mode 120000
index 305c46d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/spinlock.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/spinlock.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/spinlock.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_api_smp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_api_smp.h
deleted file mode 120000
index 45bfb4e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_api_smp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/spinlock_api_smp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/spinlock_api_smp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_api_smp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/spinlock_api_smp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_api_smp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_api_up.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_api_up.h
deleted file mode 120000
index b54532e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_api_up.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/spinlock_api_up.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/spinlock_api_up.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_api_up.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/spinlock_api_up.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_api_up.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_types.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_types.h
deleted file mode 120000
index 39611b7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_types.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/spinlock_types.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/spinlock_types.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_types.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/spinlock_types.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_types.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_types_up.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_types_up.h
deleted file mode 120000
index d5384d7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_types_up.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/spinlock_types_up.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/spinlock_types_up.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_types_up.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/spinlock_types_up.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_types_up.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_up.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_up.h
deleted file mode 120000
index 46b3c0e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_up.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/spinlock_up.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/spinlock_up.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_up.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/spinlock_up.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/spinlock_up.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stacktrace.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stacktrace.h
deleted file mode 120000
index 4c18232..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stacktrace.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/stacktrace.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/stacktrace.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stacktrace.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/stacktrace.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/stacktrace.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stat.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stat.h
deleted file mode 120000
index 842159b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stat.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/stat.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/stat.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stat.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/stat.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/stat.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/statfs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/statfs.h
deleted file mode 120000
index 4ac3b01..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/statfs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/statfs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/statfs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/statfs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/statfs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/statfs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stddef.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stddef.h
deleted file mode 120000
index 9b398f1..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stddef.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/stddef.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/stddef.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stddef.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/stddef.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/stddef.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/string.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/string.h
deleted file mode 120000
index 414748f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/string.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/string.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/string.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/string.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/string.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/string.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stringify.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stringify.h
deleted file mode 120000
index 44dd7ed..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stringify.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/stringify.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/stringify.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/stringify.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/stringify.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/stringify.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/auth.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/auth.h
deleted file mode 120000
index 1fbe34f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/auth.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/auth.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/auth.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/auth.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/auth.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/auth.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/auth_gss.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/auth_gss.h
deleted file mode 120000
index 7bc8ad1..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/auth_gss.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/auth_gss.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/auth_gss.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/auth_gss.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/auth_gss.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/auth_gss.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/clnt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/clnt.h
deleted file mode 120000
index 7f11a93..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/clnt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/clnt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/clnt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/clnt.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/clnt.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/clnt.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/debug.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/debug.h
deleted file mode 120000
index c95a429..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/debug.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/debug.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/debug.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/debug.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/debug.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/debug.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/gss_api.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/gss_api.h
deleted file mode 120000
index e10eba6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/gss_api.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/gss_api.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/gss_api.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/gss_api.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/gss_api.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/gss_api.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/gss_asn1.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/gss_asn1.h
deleted file mode 120000
index e860f8e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/gss_asn1.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/gss_asn1.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/gss_asn1.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/gss_asn1.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/gss_asn1.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/gss_asn1.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/gss_err.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/gss_err.h
deleted file mode 120000
index 72c7141..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/gss_err.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/gss_err.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/gss_err.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/gss_err.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/gss_err.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/gss_err.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/msg_prot.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/msg_prot.h
deleted file mode 120000
index d9cb9ae..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/msg_prot.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/msg_prot.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/msg_prot.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/msg_prot.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/msg_prot.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/msg_prot.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/sched.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/sched.h
deleted file mode 120000
index 84791a7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/sched.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/sched.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/sched.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/sched.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/sched.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/sched.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/stats.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/stats.h
deleted file mode 120000
index b115bd5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/stats.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/stats.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/stats.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/stats.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/stats.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/stats.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/svc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/svc.h
deleted file mode 120000
index 658a81e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/svc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/svc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/svc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/svc.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/svc.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/svc.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/svcauth.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/svcauth.h
deleted file mode 120000
index 8c3e841..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/svcauth.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/svcauth.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/svcauth.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/svcauth.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/svcauth.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/svcauth.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/timer.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/timer.h
deleted file mode 120000
index ce8709d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/timer.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/timer.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/timer.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/timer.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/timer.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/timer.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/types.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/types.h
deleted file mode 120000
index e7f7656..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/types.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/types.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/types.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/types.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/types.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/types.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/xdr.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/xdr.h
deleted file mode 120000
index 163e618..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/xdr.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/xdr.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/xdr.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/xdr.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/xdr.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/xdr.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/xprt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/xprt.h
deleted file mode 120000
index 6d29148..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/xprt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../common/include/linux/sunrpc/xprt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sunrpc/xprt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/xprt.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sunrpc/xprt.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sunrpc/xprt.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/swap.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/swap.h
deleted file mode 120000
index 47db73a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/swap.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/swap.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/swap.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/swap.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/swap.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/swap.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sysctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sysctl.h
deleted file mode 120000
index 1252a53..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sysctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/sysctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sysctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sysctl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sysctl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sysctl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sysdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sysdev.h
deleted file mode 120000
index 6691343..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sysdev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/sysdev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sysdev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sysdev.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sysdev.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sysdev.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sysfs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sysfs.h
deleted file mode 120000
index 0cbaad8..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sysfs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/sysfs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/sysfs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/sysfs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/sysfs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/sysfs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/taskstats.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/taskstats.h
deleted file mode 120000
index 24a178e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/taskstats.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/taskstats.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/taskstats.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/taskstats.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/taskstats.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/taskstats.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/taskstats_kern.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/taskstats_kern.h
deleted file mode 120000
index 20b2c64..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/taskstats_kern.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/taskstats_kern.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/taskstats_kern.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/taskstats_kern.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/taskstats_kern.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/taskstats_kern.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/tcp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/tcp.h
deleted file mode 120000
index 417237a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/tcp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/tcp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/tcp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/tcp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/tcp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/tcp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/telephony.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/telephony.h
deleted file mode 120000
index 44b4c18..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/telephony.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/telephony.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/telephony.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/telephony.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/telephony.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/telephony.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/termios.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/termios.h
deleted file mode 120000
index 968db97..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/termios.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/termios.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/termios.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/termios.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/termios.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/termios.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/textsearch.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/textsearch.h
deleted file mode 120000
index e033273..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/textsearch.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/textsearch.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/textsearch.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/textsearch.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/textsearch.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/textsearch.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/thread_info.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/thread_info.h
deleted file mode 120000
index 11a1011..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/thread_info.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/thread_info.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/thread_info.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/thread_info.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/thread_info.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/thread_info.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/threads.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/threads.h
deleted file mode 120000
index ef3237e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/threads.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/threads.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/threads.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/threads.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/threads.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/threads.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/time.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/time.h
deleted file mode 120000
index 2060843..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/time.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/time.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/time.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/time.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/time.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/time.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/timer.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/timer.h
deleted file mode 120000
index f81d907..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/timer.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/timer.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/timer.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/timer.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/timer.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/timer.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/times.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/times.h
deleted file mode 120000
index 8757201..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/times.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/times.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/times.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/times.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/times.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/times.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/timex.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/timex.h
deleted file mode 120000
index 49e520b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/timex.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/timex.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/timex.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/timex.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/timex.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/timex.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/tiocl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/tiocl.h
deleted file mode 120000
index ae6102b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/tiocl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/tiocl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/tiocl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/tiocl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/tiocl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/tiocl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/transport_class.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/transport_class.h
deleted file mode 120000
index 735b69b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/transport_class.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/transport_class.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/transport_class.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/transport_class.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/transport_class.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/transport_class.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/tty.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/tty.h
deleted file mode 120000
index 4e874bf..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/tty.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/tty.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/tty.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/tty.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/tty.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/tty.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/types.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/types.h
deleted file mode 120000
index 76b2511..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/types.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/types.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/types.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/types.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/types.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/types.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/udp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/udp.h
deleted file mode 120000
index 14ee4b2..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/udp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/udp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/udp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/udp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/udp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/udp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ufs_fs_i.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ufs_fs_i.h
deleted file mode 120000
index de767a7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ufs_fs_i.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ufs_fs_i.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ufs_fs_i.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ufs_fs_i.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ufs_fs_i.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ufs_fs_i.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ufs_fs_sb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ufs_fs_sb.h
deleted file mode 120000
index a78b9d3..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ufs_fs_sb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/ufs_fs_sb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/ufs_fs_sb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/ufs_fs_sb.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/ufs_fs_sb.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/ufs_fs_sb.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/uio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/uio.h
deleted file mode 120000
index 95a105d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/uio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/uio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/uio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/uio.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/uio.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/uio.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/un.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/un.h
deleted file mode 120000
index 6d51e94..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/un.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/un.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/un.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/un.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/un.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/un.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/unistd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/unistd.h
deleted file mode 120000
index 7ef4a0d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/unistd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/unistd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/unistd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/unistd.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/unistd.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/unistd.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/usb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/usb.h
deleted file mode 120000
index 7da27d7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/usb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/usb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/usb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/usb.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/usb.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/usb.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/usb_ch9.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/usb_ch9.h
deleted file mode 120000
index d8a2655..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/usb_ch9.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/usb_ch9.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/usb_ch9.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/usb_ch9.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/usb_ch9.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/usb_ch9.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/usbdevice_fs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/usbdevice_fs.h
deleted file mode 120000
index b4c8de8..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/usbdevice_fs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/usbdevice_fs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/usbdevice_fs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/usbdevice_fs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/usbdevice_fs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/usbdevice_fs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/user.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/user.h
deleted file mode 120000
index 2bb072e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/user.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/user.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/user.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/user.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/user.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/user.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/utime.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/utime.h
deleted file mode 120000
index c483c28..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/utime.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/utime.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/utime.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/utime.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/utime.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/utime.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/utsname.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/utsname.h
deleted file mode 120000
index 8b0a098..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/utsname.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/utsname.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/utsname.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/utsname.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/utsname.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/utsname.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/version.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/version.h
deleted file mode 120000
index cb2ac62..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/version.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/version.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/version.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/version.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/version.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/version.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vfs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vfs.h
deleted file mode 120000
index b815962..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vfs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/vfs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/vfs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vfs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/vfs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/vfs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/videodev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/videodev.h
deleted file mode 120000
index 33e8651..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/videodev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/videodev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/videodev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/videodev.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/videodev.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/videodev.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/videodev2.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/videodev2.h
deleted file mode 120000
index 9127b40..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/videodev2.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/videodev2.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/videodev2.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/videodev2.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/videodev2.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/videodev2.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vmalloc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vmalloc.h
deleted file mode 120000
index 90410fc..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vmalloc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/vmalloc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/vmalloc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vmalloc.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/vmalloc.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/vmalloc.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vt.h
deleted file mode 120000
index 5f1333a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/vt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/vt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vt.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/vt.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/vt.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vt_buffer.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vt_buffer.h
deleted file mode 120000
index babe241..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vt_buffer.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/vt_buffer.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/vt_buffer.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/vt_buffer.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/vt_buffer.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/vt_buffer.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/wait.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/wait.h
deleted file mode 120000
index ee2730b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/wait.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/wait.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/wait.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/wait.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/wait.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/wait.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/wanrouter.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/wanrouter.h
deleted file mode 120000
index 1d1b8f1..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/wanrouter.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/wanrouter.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/wanrouter.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/wanrouter.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/wanrouter.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/wanrouter.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/wireless.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/wireless.h
deleted file mode 120000
index 43983b5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/wireless.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/wireless.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/wireless.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/wireless.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/wireless.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/wireless.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/workqueue.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/workqueue.h
deleted file mode 120000
index 3ce0512..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/workqueue.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/workqueue.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/workqueue.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/workqueue.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/workqueue.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/workqueue.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/xattr.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/xattr.h
deleted file mode 120000
index 8cf8b0b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/xattr.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/xattr.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/xattr.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/xattr.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/xattr.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/xattr.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/zconf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/zconf.h
deleted file mode 120000
index 4dc29e6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/zconf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/zconf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/zconf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/zconf.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/zconf.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/zconf.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/zlib.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/zlib.h
deleted file mode 120000
index 9d45319..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/zlib.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/zlib.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/zlib.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/zlib.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/zlib.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/zlib.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/zorro_ids.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/zorro_ids.h
deleted file mode 120000
index f2220c0..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/linux/zorro_ids.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/linux/zorro_ids.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/linux/zorro_ids.h b/ndk/build/platforms/android-4/arch-arm/usr/include/linux/zorro_ids.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/linux/zorro_ids.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/linux/zorro_ids.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/locale.h b/ndk/build/platforms/android-4/arch-arm/usr/include/locale.h
deleted file mode 120000
index 26247fd..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/locale.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/locale.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/locale.h b/ndk/build/platforms/android-4/arch-arm/usr/include/locale.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/locale.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/locale.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/malloc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/malloc.h
deleted file mode 120000
index 78a8006..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/malloc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/malloc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/malloc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/malloc.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/malloc.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/malloc.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/math.h b/ndk/build/platforms/android-4/arch-arm/usr/include/math.h
deleted file mode 120000
index 0d4bdcd..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/math.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/math.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/math.h b/ndk/build/platforms/android-4/arch-arm/usr/include/math.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/math.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/math.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/memory.h b/ndk/build/platforms/android-4/arch-arm/usr/include/memory.h
deleted file mode 120000
index 08375e2..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/memory.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/memory.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/memory.h b/ndk/build/platforms/android-4/arch-arm/usr/include/memory.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/memory.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/memory.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/mntent.h b/ndk/build/platforms/android-4/arch-arm/usr/include/mntent.h
deleted file mode 120000
index 43186c4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/mntent.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/mntent.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/mntent.h b/ndk/build/platforms/android-4/arch-arm/usr/include/mntent.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/mntent.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/mntent.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/mtd/mtd-abi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/mtd/mtd-abi.h
deleted file mode 120000
index 19a9a51..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/mtd/mtd-abi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/mtd/mtd-abi.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/mtd/mtd-abi.h b/ndk/build/platforms/android-4/arch-arm/usr/include/mtd/mtd-abi.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/mtd/mtd-abi.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/mtd/mtd-abi.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/mtd/mtd-user.h b/ndk/build/platforms/android-4/arch-arm/usr/include/mtd/mtd-user.h
deleted file mode 120000
index e22b96b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/mtd/mtd-user.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/mtd/mtd-user.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/mtd/mtd-user.h b/ndk/build/platforms/android-4/arch-arm/usr/include/mtd/mtd-user.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/mtd/mtd-user.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/mtd/mtd-user.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/net/ethertypes.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/ethertypes.h
deleted file mode 120000
index 621864d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/net/ethertypes.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/ethertypes.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/net/ethertypes.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/ethertypes.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/net/ethertypes.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/net/ethertypes.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/net/if.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/if.h
deleted file mode 120000
index c83fdb9..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/net/if.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/if.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/net/if.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/if.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/net/if.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/net/if.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_arp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_arp.h
deleted file mode 120000
index e8e84bb..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_arp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/if_arp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/net/if_arp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_arp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/net/if_arp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/net/if_arp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_dl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_dl.h
deleted file mode 120000
index 1a27df4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_dl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/if_dl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/net/if_dl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_dl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/net/if_dl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/net/if_dl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_ether.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_ether.h
deleted file mode 120000
index 591c1db..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_ether.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/if_ether.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/net/if_ether.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_ether.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/net/if_ether.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/net/if_ether.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_ieee1394.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_ieee1394.h
deleted file mode 120000
index f0b13ce..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_ieee1394.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/if_ieee1394.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/net/if_ieee1394.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_ieee1394.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/net/if_ieee1394.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/net/if_ieee1394.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_packet.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_packet.h
deleted file mode 120000
index 4c5bd8d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_packet.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/if_packet.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/net/if_packet.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_packet.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/net/if_packet.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/net/if_packet.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_types.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_types.h
deleted file mode 120000
index 410430f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_types.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/if_types.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/net/if_types.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/if_types.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/net/if_types.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/net/if_types.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/net/route.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/route.h
deleted file mode 120000
index ea03206..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/net/route.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/net/route.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/net/route.h b/ndk/build/platforms/android-4/arch-arm/usr/include/net/route.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/net/route.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/net/route.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/netdb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netdb.h
deleted file mode 120000
index 67f7a2f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/netdb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/netdb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/netdb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netdb.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/netdb.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/netdb.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/ether.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/ether.h
deleted file mode 120000
index e331c47..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/ether.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/ether.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/netinet/ether.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/ether.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/netinet/ether.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/netinet/ether.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/if_ether.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/if_ether.h
deleted file mode 120000
index 5354bb5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/if_ether.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/if_ether.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/netinet/if_ether.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/if_ether.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/netinet/if_ether.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/netinet/if_ether.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/in.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/in.h
deleted file mode 120000
index 8439fe5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/in.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/in.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/netinet/in.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/in.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/netinet/in.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/netinet/in.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/in6.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/in6.h
deleted file mode 120000
index fa5937f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/in6.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/in6.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/netinet/in6.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/in6.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/netinet/in6.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/netinet/in6.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/in_systm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/in_systm.h
deleted file mode 120000
index ea70a33..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/in_systm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/in_systm.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/netinet/in_systm.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/in_systm.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/netinet/in_systm.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/netinet/in_systm.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/ip.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/ip.h
deleted file mode 120000
index 3eb2097..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/ip.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/ip.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/netinet/ip.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/ip.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/netinet/ip.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/netinet/ip.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/ip_icmp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/ip_icmp.h
deleted file mode 120000
index 2c9024f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/ip_icmp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/ip_icmp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/netinet/ip_icmp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/ip_icmp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/netinet/ip_icmp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/netinet/ip_icmp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/tcp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/tcp.h
deleted file mode 120000
index 6b0d829..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/tcp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/tcp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/netinet/tcp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/tcp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/netinet/tcp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/netinet/tcp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/udp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/udp.h
deleted file mode 120000
index d5e0f6b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/udp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netinet/udp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/netinet/udp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netinet/udp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/netinet/udp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/netinet/udp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/netpacket/packet.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netpacket/packet.h
deleted file mode 120000
index 7473ba4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/netpacket/packet.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/netpacket/packet.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/netpacket/packet.h b/ndk/build/platforms/android-4/arch-arm/usr/include/netpacket/packet.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/netpacket/packet.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/netpacket/packet.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/new b/ndk/build/platforms/android-4/arch-arm/usr/include/new
deleted file mode 120000
index b3e4225..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/new
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/new
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/new b/ndk/build/platforms/android-4/arch-arm/usr/include/new
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/new
rename to ndk/build/platforms/android-4/arch-arm/usr/include/new
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/nsswitch.h b/ndk/build/platforms/android-4/arch-arm/usr/include/nsswitch.h
deleted file mode 120000
index 361ce34..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/nsswitch.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/nsswitch.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/nsswitch.h b/ndk/build/platforms/android-4/arch-arm/usr/include/nsswitch.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/nsswitch.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/nsswitch.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/pathconf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/pathconf.h
deleted file mode 120000
index f1c45ca..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/pathconf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/pathconf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/pathconf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/pathconf.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/pathconf.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/pathconf.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/paths.h b/ndk/build/platforms/android-4/arch-arm/usr/include/paths.h
deleted file mode 120000
index 04b00c0..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/paths.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/paths.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/paths.h b/ndk/build/platforms/android-4/arch-arm/usr/include/paths.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/paths.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/paths.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/poll.h b/ndk/build/platforms/android-4/arch-arm/usr/include/poll.h
deleted file mode 120000
index e260aad..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/poll.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/poll.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/poll.h b/ndk/build/platforms/android-4/arch-arm/usr/include/poll.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/poll.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/poll.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/pthread.h b/ndk/build/platforms/android-4/arch-arm/usr/include/pthread.h
deleted file mode 120000
index e7240fe..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/pthread.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/pthread.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/pthread.h b/ndk/build/platforms/android-4/arch-arm/usr/include/pthread.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/pthread.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/pthread.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/pwd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/pwd.h
deleted file mode 120000
index deefc65..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/pwd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/pwd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/pwd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/pwd.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/pwd.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/pwd.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/resolv.h b/ndk/build/platforms/android-4/arch-arm/usr/include/resolv.h
deleted file mode 120000
index 645cec6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/resolv.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/resolv.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/resolv.h b/ndk/build/platforms/android-4/arch-arm/usr/include/resolv.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/resolv.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/resolv.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sched.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sched.h
deleted file mode 120000
index 7eb75bc..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sched.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/sched.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sched.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sched.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sched.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sched.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/semaphore.h b/ndk/build/platforms/android-4/arch-arm/usr/include/semaphore.h
deleted file mode 120000
index 5981819..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/semaphore.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/semaphore.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/semaphore.h b/ndk/build/platforms/android-4/arch-arm/usr/include/semaphore.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/semaphore.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/semaphore.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/setjmp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/setjmp.h
deleted file mode 120000
index 927b88e3..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/setjmp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/setjmp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/setjmp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/setjmp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/setjmp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/setjmp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sgtty.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sgtty.h
deleted file mode 120000
index fcfac52..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sgtty.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/sgtty.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sgtty.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sgtty.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sgtty.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sgtty.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sha1.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sha1.h
deleted file mode 120000
index f4aadd2..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sha1.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/sha1.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sha1.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sha1.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sha1.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sha1.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/signal.h b/ndk/build/platforms/android-4/arch-arm/usr/include/signal.h
deleted file mode 120000
index 83e2e8e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/signal.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/signal.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/signal.h b/ndk/build/platforms/android-4/arch-arm/usr/include/signal.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/signal.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/signal.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/stdint.h b/ndk/build/platforms/android-4/arch-arm/usr/include/stdint.h
deleted file mode 120000
index 8b0dfbf..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/stdint.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/stdint.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/stdint.h b/ndk/build/platforms/android-4/arch-arm/usr/include/stdint.h
new file mode 100644
index 0000000..237baa2
--- /dev/null
+++ b/ndk/build/platforms/android-4/arch-arm/usr/include/stdint.h
@@ -0,0 +1,266 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _STDINT_H
+#define _STDINT_H
+
+#include <stddef.h>
+#include <sys/_types.h>
+
+
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
+#  define __STDINT_LIMITS
+#endif
+
+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
+#  define  __STDINT_MACROS
+#endif
+
+/* the definitions of STDINT_LIMITS depend on those of STDINT_MACROS */
+#if defined __STDINT_LIMITS && !defined __STDINT_MACROS
+#  define  __STDINT_MACROS
+#endif
+
+#if !defined __STRICT_ANSI__ || __STDC_VERSION__ >= 199901L
+#  define __STDC_INT64__
+#endif
+
+typedef __int8_t      int8_t;
+typedef __uint8_t     uint8_t;
+typedef __int16_t     int16_t;
+typedef __uint16_t    uint16_t;
+typedef __int32_t     int32_t;
+typedef __uint32_t    uint32_t;
+#if defined(__STDC_INT64__)
+typedef __int64_t     int64_t;
+typedef __uint64_t    uint64_t;
+#endif
+
+/*
+ * int8_t & uint8_t
+ */
+
+typedef int8_t        int_least8_t;
+typedef int8_t        int_fast8_t;
+
+typedef uint8_t       uint_least8_t;
+typedef uint8_t       uint_fast8_t;
+
+#ifdef __STDINT_LIMITS
+#  define INT8_MIN         (-128)
+#  define INT8_MAX         (127)
+#  define INT_LEAST8_MIN   INT8_MIN
+#  define INT_LEAST8_MAX   INT8_MAX
+#  define INT_FAST8_MIN    INT8_MIN
+#  define INT_FAST8_MAX    INT8_MAX
+
+#  define UINT8_MAX           (255U)
+#  define UINT_LEAST8_MAX     UINT8_MAX
+#  define UINT_FAST8_MAX      UINT8_MAX
+#endif
+
+#ifdef __STDINT_MACROS
+#  define INT8_C(c)	c
+#  define INT_LEAST8_C(c)	 INT8_C(c)
+#  define INT_FAST8_C(c)	INT8_C(c)
+
+#  define UINT8_C(c)	c ## U
+#  define UINT_LEAST8_C(c)  UINT8_C(c)
+#  define UINT_FAST8_C(c)  UINT8_C(c)
+#endif
+
+/*
+ * int16_t & uint16_t
+ */
+
+
+typedef int16_t       int_least16_t;
+typedef int32_t       int_fast16_t;
+
+typedef uint16_t      uint_least16_t;
+typedef uint32_t      uint_fast16_t;
+
+#ifdef __STDINT_LIMITS
+#  define INT16_MIN	(-32768)
+#  define INT16_MAX	(32767)
+#  define INT_LEAST16_MIN	INT16_MIN
+#  define INT_LEAST16_MAX	INT16_MAX
+#  define INT_FAST16_MIN	INT32_MIN
+#  define INT_FAST16_MAX	INT32_MAX
+
+#  define UINT16_MAX	(65535U)
+#  define UINT_LEAST16_MAX UINT16_MAX
+#  define UINT_FAST16_MAX UINT32_MAX
+#endif
+
+#ifdef __STDINT_MACROS
+#  define INT16_C(c)	c
+#  define INT_LEAST16_C(c) INT16_C(c)
+#  define INT_FAST16_C(c)	 INT32_C(c)
+
+#  define UINT16_C(c)	c ## U
+#  define UINT_LEAST16_C(c) UINT16_C(c)
+#  define UINT_FAST16_C(c) UINT32_C(c)
+#endif
+
+/*
+ * int32_t & uint32_t
+ */
+
+typedef int32_t       int_least32_t;
+typedef int32_t       int_fast32_t;
+
+typedef uint32_t      uint_least32_t;
+typedef uint32_t      uint_fast32_t;
+
+#ifdef __STDINT_LIMITS
+#  define INT32_MIN	(-2147483647-1)
+#  define INT32_MAX	(2147483647)
+#  define INT_LEAST32_MIN	INT32_MIN
+#  define INT_LEAST32_MAX	INT32_MAX
+#  define INT_FAST32_MIN	INT32_MIN
+#  define INT_FAST32_MAX	INT32_MAX
+
+#  define UINT32_MAX	(4294967295U)
+#  define UINT_LEAST32_MAX UINT32_MAX
+#  define UINT_FAST32_MAX UINT32_MAX
+#endif
+
+#ifdef __STDINT_MACROS
+#  define INT32_C(c)	c
+#  define INT_LEAST32_C(c) INT32_C(c)
+#  define INT_FAST32_C(c)  INT32_C(c)
+
+#  define UINT32_C(c)	c ## U
+#  define UINT_LEAST32_C(c) UINT32_C(c)
+#  define UINT_FAST32_C(c) UINT32_C(c)
+#endif
+
+#if defined(__STDC_INT64__)
+/*
+ *  int64_t
+ */
+typedef int64_t       int_least64_t;
+typedef int64_t       int_fast64_t;
+
+typedef uint64_t      uint_least64_t;
+typedef uint64_t      uint_fast64_t;
+
+
+#ifdef __STDINT_LIMITS
+#  define INT64_MIN        (__INT64_C(-9223372036854775807)-1)
+#  define INT64_MAX        (__INT64_C(9223372036854775807))
+#  define INT_LEAST64_MIN  INT64_MIN
+#  define INT_LEAST64_MAX  INT64_MAX
+#  define INT_FAST64_MIN   INT64_MIN
+#  define INT_FAST64_MAX   INT64_MAX
+#  define UINT64_MAX       (__UINT64_C(18446744073709551615))
+
+#  define UINT_LEAST64_MAX UINT64_MAX
+#  define UINT_FAST64_MAX UINT64_MAX
+#endif
+
+#ifdef __STDINT_MACROS
+#  define __INT64_C(c)     c ## LL
+#  define INT64_C(c)       __INT64_C(c)
+#  define INT_LEAST64_C(c) INT64_C(c)
+#  define INT_FAST64_C(c)  INT64_C(c)
+
+#  define __UINT64_C(c)     c ## ULL
+#  define UINT64_C(c)       __UINT64_C(c)
+#  define UINT_LEAST64_C(c) UINT64_C(c)
+#  define UINT_FAST64_C(c)  UINT64_C(c)
+#endif
+
+
+#  define __PRI64_RANK   "ll"
+#  define __PRIFAST_RANK ""
+#  define __PRIPTR_RANK  ""
+
+#endif /* __STDC_INT64__ */
+
+/*
+ * intptr_t & uintptr_t
+ */
+
+typedef int           intptr_t;
+typedef unsigned int  uintptr_t;
+
+#  define INTPTR_MIN    INT32_MIN
+#  define INTPTR_MAX    INT32_MAX
+#  define UINTPTR_MAX   UINT32_MAX
+#  define INTPTR_C(c)   INT32_C(c)
+#  define UINTPTR_C(c)  UINT32_C(c)
+#  define PTRDIFF_C(c)  INT32_C(c)
+#  define PTRDIFF_MIN   INT32_MIN
+#  define PTRDIFF_MAX   INT32_MAX
+
+
+/*
+ *  intmax_t & uintmax_t
+ */
+
+#if defined(__STDC_INT64__)
+
+typedef uint64_t uintmax_t;
+typedef int64_t  intmax_t;
+
+#define INTMAX_MIN	INT64_MIN
+#define INTMAX_MAX	INT64_MAX
+#define UINTMAX_MAX	UINT64_MAX
+
+#define INTMAX_C(c)	INT64_C(c)
+#define UINTMAX_C(c)	UINT64_C(c)
+
+#else /* !__STDC_INT64__ */
+
+typedef uint32_t  uintmax_t;
+typedef int32_t   intmax_t;
+
+#define  INTMAX_MIN    INT32_MIN
+#define  INTMAX_MAX    INT32_MAX
+#define  UINTMAX_MAX   UINT32_MAX
+
+#define INTMAX_C(c)	INT32_C(c)
+#define UINTMAX_C(c)	UINT32_C(c)
+
+#endif /* !__STDC_INT64__ */
+
+
+/* size_t is defined by the GCC-specific <stddef.h> */
+#ifndef _SSIZE_T_DEFINED_
+#define _SSIZE_T_DEFINED_
+typedef long int  ssize_t;
+#endif
+
+#define _BITSIZE 32
+
+/* Keep the kernel from trying to define these types... */
+#define __BIT_TYPES_DEFINED__
+
+#endif /* _STDINT_H */
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/stdio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/stdio.h
deleted file mode 120000
index 41d7d04..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/stdio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/stdio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/stdio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/stdio.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/stdio.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/stdio.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/stdlib.h b/ndk/build/platforms/android-4/arch-arm/usr/include/stdlib.h
deleted file mode 120000
index de97694..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/stdlib.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/stdlib.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/stdlib.h b/ndk/build/platforms/android-4/arch-arm/usr/include/stdlib.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/stdlib.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/stdlib.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/stl_pair.h b/ndk/build/platforms/android-4/arch-arm/usr/include/stl_pair.h
deleted file mode 120000
index bfeaf5b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/stl_pair.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/stl_pair.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/stl_pair.h b/ndk/build/platforms/android-4/arch-arm/usr/include/stl_pair.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/stl_pair.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/stl_pair.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/string.h b/ndk/build/platforms/android-4/arch-arm/usr/include/string.h
deleted file mode 120000
index ee1c46a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/string.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/string.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/string.h b/ndk/build/platforms/android-4/arch-arm/usr/include/string.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/string.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/string.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/strings.h b/ndk/build/platforms/android-4/arch-arm/usr/include/strings.h
deleted file mode 120000
index e3c356d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/strings.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/strings.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/strings.h b/ndk/build/platforms/android-4/arch-arm/usr/include/strings.h
new file mode 100644
index 0000000..fee7dc4
--- /dev/null
+++ b/ndk/build/platforms/android-4/arch-arm/usr/include/strings.h
@@ -0,0 +1,56 @@
+/*	$NetBSD: strings.h,v 1.10 2005/02/03 04:39:32 perry Exp $	*/
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _STRINGS_H_
+#define _STRINGS_H_
+
+#include <sys/types.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	 bcmp(const void *, const void *, size_t);
+void	 bcopy(const void *, void *, size_t);
+void	 bzero(void *, size_t);
+int	 ffs(int);
+char	*index(const char *, int);
+char	*rindex(const char *, int);
+int	 strcasecmp(const char *, const char *);
+int	 strncasecmp(const char *, const char *, size_t);
+__END_DECLS
+
+#endif /* !defined(_STRINGS_H_) */
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_errdefs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_errdefs.h
deleted file mode 120000
index b2a299e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_errdefs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/_errdefs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/_errdefs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_errdefs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/_errdefs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/_errdefs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_sigdefs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_sigdefs.h
deleted file mode 120000
index ea48d37..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_sigdefs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/_sigdefs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/_sigdefs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_sigdefs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/_sigdefs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/_sigdefs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_system_properties.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_system_properties.h
deleted file mode 120000
index 6054cc4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_system_properties.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/_system_properties.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/_system_properties.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_system_properties.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/_system_properties.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/_system_properties.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_types.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_types.h
deleted file mode 120000
index 936b4d5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_types.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/_types.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/_types.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/_types.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/_types.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/_types.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/atomics.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/atomics.h
deleted file mode 120000
index 0304794..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/atomics.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/atomics.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/atomics.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/atomics.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/atomics.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/atomics.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/cdefs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/cdefs.h
deleted file mode 120000
index 36eede7..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/cdefs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/cdefs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/cdefs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/cdefs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/cdefs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/cdefs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/cdefs_elf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/cdefs_elf.h
deleted file mode 120000
index fa852bf..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/cdefs_elf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/cdefs_elf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/cdefs_elf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/cdefs_elf.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/cdefs_elf.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/cdefs_elf.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/dirent.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/dirent.h
deleted file mode 120000
index cac02ee..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/dirent.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/dirent.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/dirent.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/dirent.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/dirent.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/dirent.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/endian.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/endian.h
deleted file mode 120000
index 25109db..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/endian.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/endian.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/endian.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/endian.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/endian.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/endian.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/epoll.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/epoll.h
deleted file mode 120000
index bf93fc6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/epoll.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/epoll.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/epoll.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/epoll.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/epoll.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/epoll.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/errno.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/errno.h
deleted file mode 120000
index 199ad78..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/errno.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/errno.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/errno.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/errno.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/errno.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/errno.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/exec_elf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/exec_elf.h
deleted file mode 120000
index 24e01e6..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/exec_elf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/exec_elf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/exec_elf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/exec_elf.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/exec_elf.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/exec_elf.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/file.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/file.h
deleted file mode 120000
index 99ab5d3..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/file.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/file.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/file.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/file.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/file.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/file.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/fsuid.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/fsuid.h
deleted file mode 120000
index f5f9974..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/fsuid.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/fsuid.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/fsuid.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/fsuid.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/fsuid.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/fsuid.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/inotify.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/inotify.h
deleted file mode 120000
index a050653..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/inotify.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/inotify.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/inotify.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/inotify.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/inotify.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/inotify.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ioctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ioctl.h
deleted file mode 120000
index e228a66..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/ioctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/ioctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ioctl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/ioctl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/ioctl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ioctl_compat.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ioctl_compat.h
deleted file mode 120000
index dd004de..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ioctl_compat.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/ioctl_compat.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/ioctl_compat.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ioctl_compat.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/ioctl_compat.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/ioctl_compat.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ipc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ipc.h
deleted file mode 120000
index 5d275f2..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ipc.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/ipc.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/ipc.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ipc.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/ipc.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/ipc.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/klog.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/klog.h
deleted file mode 120000
index 4cad4c9..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/klog.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/klog.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/klog.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/klog.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/klog.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/klog.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/limits.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/limits.h
deleted file mode 120000
index 4f50214..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/limits.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/limits.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/limits.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/limits.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/limits.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/limits.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/linux-syscalls.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/linux-syscalls.h
deleted file mode 120000
index 754d7c49..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/linux-syscalls.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/linux-syscalls.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/linux-syscalls.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/linux-syscalls.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/linux-syscalls.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/linux-syscalls.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/linux-unistd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/linux-unistd.h
deleted file mode 120000
index 9496fde..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/linux-unistd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/linux-unistd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/linux-unistd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/linux-unistd.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/linux-unistd.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/linux-unistd.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/mman.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/mman.h
deleted file mode 120000
index bd6a6b8..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/mman.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/mman.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/mman.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/mman.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/mman.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/mman.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/mount.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/mount.h
deleted file mode 120000
index 0b0a916..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/mount.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/mount.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/mount.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/mount.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/mount.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/mount.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/param.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/param.h
deleted file mode 120000
index 16e5bcc..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/param.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/param.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/param.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/param.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/param.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/param.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/poll.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/poll.h
deleted file mode 120000
index a98ab69..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/poll.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/poll.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/poll.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/poll.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/poll.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/poll.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/prctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/prctl.h
deleted file mode 120000
index 950d2fb..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/prctl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/prctl.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/prctl.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/prctl.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/prctl.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/prctl.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ptrace.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ptrace.h
deleted file mode 120000
index 3b2714f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ptrace.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/ptrace.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/ptrace.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ptrace.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/ptrace.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/ptrace.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/reboot.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/reboot.h
deleted file mode 120000
index 8295ffc..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/reboot.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/reboot.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/reboot.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/reboot.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/reboot.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/reboot.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/resource.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/resource.h
deleted file mode 120000
index 72a813f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/resource.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/resource.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/resource.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/resource.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/resource.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/resource.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/select.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/select.h
deleted file mode 120000
index 42f2037..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/select.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/select.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/select.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/select.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/select.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/select.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sendfile.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sendfile.h
deleted file mode 120000
index ac4d8a0..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sendfile.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/sendfile.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/sendfile.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sendfile.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/sendfile.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/sendfile.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/socket.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/socket.h
deleted file mode 120000
index 36a0331..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/socket.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/socket.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/socket.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/socket.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/socket.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/socket.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/socketcalls.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/socketcalls.h
deleted file mode 120000
index 5e94809..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/socketcalls.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/socketcalls.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/socketcalls.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/socketcalls.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/socketcalls.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/socketcalls.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/stat.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/stat.h
deleted file mode 120000
index fa00c54..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/stat.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/stat.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/stat.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/stat.h
new file mode 100644
index 0000000..091ee6d
--- /dev/null
+++ b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/stat.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _SYS_STAT_H_
+#define _SYS_STAT_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <linux/stat.h>
+
+#include <endian.h>
+
+__BEGIN_DECLS
+
+/* really matches stat64 in the kernel, hence the padding
+ * Note: The kernel zero's the padded region because glibc might read them
+ * in the hope that the kernel has stretched to using larger sizes.
+ */
+struct stat {
+    unsigned long long  st_dev;
+    unsigned char       __pad0[4];
+
+    unsigned long       __st_ino;
+    unsigned int        st_mode;
+    unsigned int        st_nlink;
+
+    unsigned long       st_uid;
+    unsigned long       st_gid;
+
+    unsigned long long  st_rdev;
+    unsigned char       __pad3[4];
+
+    long long           st_size;
+    unsigned long	st_blksize;
+    unsigned long long  st_blocks;
+
+    unsigned long       st_atime;
+    unsigned long       st_atime_nsec;
+
+    unsigned long       st_mtime;
+    unsigned long       st_mtime_nsec;
+
+    unsigned long       st_ctime;
+    unsigned long       st_ctime_nsec;
+
+    unsigned long long  st_ino;
+};
+
+/* For compatibility with GLibc, we provide macro aliases
+ * for the non-Posix nano-seconds accessors.
+ */
+#define  st_atimensec  st_atime_nsec
+#define  st_mtimensec  st_mtime_nsec
+#define  st_ctimensec  st_ctime_nsec
+
+extern int    chmod(const char *, mode_t);
+extern int    fchmod(int, mode_t);
+extern int    mkdir(const char *, mode_t);
+
+extern int    stat(const char *, struct stat *);
+extern int    fstat(int, struct stat *);
+extern int    lstat(const char *, struct stat *);
+extern int    mknod(const char *, mode_t, dev_t);
+extern mode_t umask(mode_t);
+
+#define  stat64    stat
+#define  fstat64   fstat
+#define  lstat64   lstat
+
+static __inline__ int mkfifo(const char *__p, mode_t __m)
+{
+  return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t)0);
+}
+
+extern int  fstatat(int dirfd, const char *path, struct stat *buf, int flags);
+extern int  mkdirat(int dirfd, const char *pathname, mode_t mode);
+extern int fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags);
+extern int fchmodat(int dirfd, const char *path, mode_t mode, int flags);
+extern int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
+
+__END_DECLS
+
+#endif /* _SYS_STAT_H_ */
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/statfs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/statfs.h
deleted file mode 120000
index d53806d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/statfs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/statfs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/statfs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/statfs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/statfs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/statfs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/syscall.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/syscall.h
deleted file mode 120000
index 4225c35..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/syscall.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/syscall.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/syscall.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/syscall.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/syscall.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/syscall.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sysconf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sysconf.h
deleted file mode 120000
index ed9cf1f..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sysconf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/sysconf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/sysconf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sysconf.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/sysconf.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/sysconf.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sysinfo.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sysinfo.h
deleted file mode 120000
index 1693d79..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sysinfo.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/sysinfo.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/sysinfo.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sysinfo.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/sysinfo.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/sysinfo.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/syslimits.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/syslimits.h
deleted file mode 120000
index 17efa78..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/syslimits.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/syslimits.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/syslimits.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/syslimits.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/syslimits.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/syslimits.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sysmacros.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sysmacros.h
deleted file mode 120000
index fa13eca..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sysmacros.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/sysmacros.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/sysmacros.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/sysmacros.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/sysmacros.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/sysmacros.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/system_properties.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/system_properties.h
deleted file mode 120000
index 286ba9d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/system_properties.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/system_properties.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/system_properties.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/system_properties.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/system_properties.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/system_properties.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/time.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/time.h
deleted file mode 120000
index b376430..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/time.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/time.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/time.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/time.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/time.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/time.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/timeb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/timeb.h
deleted file mode 120000
index fef113e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/timeb.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/timeb.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/timeb.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/timeb.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/timeb.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/timeb.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/times.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/times.h
deleted file mode 120000
index 53c3a1a..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/times.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/times.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/times.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/times.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/times.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/times.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ttychars.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ttychars.h
deleted file mode 120000
index 09c3352..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ttychars.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/ttychars.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/ttychars.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ttychars.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/ttychars.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/ttychars.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ttydev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ttydev.h
deleted file mode 120000
index 4735daa..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ttydev.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/ttydev.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/ttydev.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/ttydev.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/ttydev.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/ttydev.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/types.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/types.h
deleted file mode 120000
index 8829c6b..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/types.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/types.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/types.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/types.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/types.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/types.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/uio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/uio.h
deleted file mode 120000
index a111200..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/uio.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/uio.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/uio.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/uio.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/uio.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/uio.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/un.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/un.h
deleted file mode 120000
index 20d7c68..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/un.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/un.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/un.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/un.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/un.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/un.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/utime.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/utime.h
deleted file mode 120000
index 8494247..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/utime.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/utime.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/utime.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/utime.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/utime.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/utime.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/utsname.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/utsname.h
deleted file mode 120000
index cf985f0..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/utsname.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/utsname.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/utsname.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/utsname.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/utsname.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/utsname.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/vfs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/vfs.h
deleted file mode 120000
index c4873c3..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/vfs.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/vfs.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/vfs.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/vfs.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/vfs.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/vfs.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/vt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/vt.h
deleted file mode 120000
index 55b3ed4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/vt.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/vt.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/vt.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/vt.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/vt.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/vt.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/wait.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/wait.h
deleted file mode 120000
index 9f27986..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/sys/wait.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../common/include/sys/wait.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/sys/wait.h b/ndk/build/platforms/android-4/arch-arm/usr/include/sys/wait.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/sys/wait.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/sys/wait.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/syslog.h b/ndk/build/platforms/android-4/arch-arm/usr/include/syslog.h
deleted file mode 120000
index 609c4e1..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/syslog.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/syslog.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/syslog.h b/ndk/build/platforms/android-4/arch-arm/usr/include/syslog.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/syslog.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/syslog.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/termios.h b/ndk/build/platforms/android-4/arch-arm/usr/include/termios.h
deleted file mode 120000
index 53740f5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/termios.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/termios.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/termios.h b/ndk/build/platforms/android-4/arch-arm/usr/include/termios.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/termios.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/termios.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/thread_db.h b/ndk/build/platforms/android-4/arch-arm/usr/include/thread_db.h
deleted file mode 120000
index e6b5ced..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/thread_db.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/thread_db.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/thread_db.h b/ndk/build/platforms/android-4/arch-arm/usr/include/thread_db.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/thread_db.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/thread_db.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/time.h b/ndk/build/platforms/android-4/arch-arm/usr/include/time.h
deleted file mode 120000
index 4ae3e06..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/time.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/time.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/time.h b/ndk/build/platforms/android-4/arch-arm/usr/include/time.h
new file mode 100644
index 0000000..6163c6d
--- /dev/null
+++ b/ndk/build/platforms/android-4/arch-arm/usr/include/time.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _TIME_H_
+#define _TIME_H_
+
+#include <sys/cdefs.h>
+#include <sys/time.h>
+
+#define __ARCH_SI_UID_T __kernel_uid32_t
+#include <asm/siginfo.h>
+#undef __ARCH_SI_UID_T
+
+__BEGIN_DECLS
+
+extern time_t   time(time_t *);
+extern int      nanosleep(const struct timespec *, struct timespec *);
+
+extern char *strtotimeval(const char *str, struct timeval *tv);
+
+struct tm {
+   int     tm_sec;         /* seconds */
+   int     tm_min;         /* minutes */
+   int     tm_hour;        /* hours */
+   int     tm_mday;        /* day of the month */
+   int     tm_mon;         /* month */
+   int     tm_year;        /* year */
+   int     tm_wday;        /* day of the week */
+   int     tm_yday;        /* day in the year */
+   int     tm_isdst;       /* daylight saving time */
+
+   long int tm_gmtoff;     /* Seconds east of UTC.  */
+   const char *tm_zone;    /* Timezone abbreviation.  */
+
+};
+
+/* defining TM_ZONE indicates that we have a "timezone abbreviation" field in
+ * struct tm, the value should be the field name
+ */
+#define   TM_ZONE   tm_zone
+
+extern char* asctime(const struct tm* a);
+extern char* asctime_r(const struct tm* a, char* buf);
+
+/* Return the difference between TIME1 and TIME0.  */
+extern double difftime (time_t __time1, time_t __time0);
+extern time_t mktime (struct tm *a);
+
+extern struct tm*  localtime(const time_t *t);
+extern struct tm*  localtime_r(const time_t *timep, struct tm *result);
+
+extern struct tm*  gmtime(const time_t *timep);
+extern struct tm*  gmtime_r(const time_t *timep, struct tm *result);
+
+extern char*       strptime(const char *buf, const char *fmt, struct tm *tm);
+extern size_t      strftime(char *s, size_t max, const char *format, const struct tm *tm);
+
+extern char *ctime(const time_t *timep);
+extern char *ctime_r(const time_t *timep, char *buf);
+
+extern void  tzset(void);
+
+/* global includes */
+extern char*     tzname[];
+extern int       daylight;
+extern long int  timezone;
+
+#define CLOCKS_PER_SEC     1000000
+
+extern clock_t   clock(void);
+
+/* BIONIC: extra linux clock goodies */
+extern int clock_getres(int, struct timespec *);
+extern int clock_gettime(int, struct timespec *);
+
+#define CLOCK_REALTIME             0
+#define CLOCK_MONOTONIC            1
+#define CLOCK_PROCESS_CPUTIME_ID   2
+#define CLOCK_THREAD_CPUTIME_ID    3
+#define CLOCK_REALTIME_HR          4
+#define CLOCK_MONOTONIC_HR         5
+
+extern int  timer_create(int, struct sigevent*, timer_t*);
+extern int  timer_delete(timer_t);
+extern int  timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue);
+extern int  timer_gettime(timer_t timerid, struct itimerspec *value);
+extern int  timer_getoverrun(timer_t  timerid);
+
+__END_DECLS
+
+#endif /* _TIME_H_ */
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/time64.h b/ndk/build/platforms/android-4/arch-arm/usr/include/time64.h
deleted file mode 120000
index 9e4ca23..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/time64.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/time64.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/time64.h b/ndk/build/platforms/android-4/arch-arm/usr/include/time64.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/time64.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/time64.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/typeinfo b/ndk/build/platforms/android-4/arch-arm/usr/include/typeinfo
deleted file mode 120000
index 35bacb5..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/typeinfo
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/typeinfo
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/typeinfo b/ndk/build/platforms/android-4/arch-arm/usr/include/typeinfo
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/typeinfo
rename to ndk/build/platforms/android-4/arch-arm/usr/include/typeinfo
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/unistd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/unistd.h
deleted file mode 120000
index 378e20d..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/unistd.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/unistd.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/unistd.h b/ndk/build/platforms/android-4/arch-arm/usr/include/unistd.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/unistd.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/unistd.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/util.h b/ndk/build/platforms/android-4/arch-arm/usr/include/util.h
deleted file mode 120000
index c8de0fe..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/util.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/util.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/util.h b/ndk/build/platforms/android-4/arch-arm/usr/include/util.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/util.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/util.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/utility b/ndk/build/platforms/android-4/arch-arm/usr/include/utility
deleted file mode 120000
index f670e68..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/utility
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/utility
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/utility b/ndk/build/platforms/android-4/arch-arm/usr/include/utility
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/utility
rename to ndk/build/platforms/android-4/arch-arm/usr/include/utility
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/utime.h b/ndk/build/platforms/android-4/arch-arm/usr/include/utime.h
deleted file mode 120000
index 520a474..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/utime.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/utime.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/utime.h b/ndk/build/platforms/android-4/arch-arm/usr/include/utime.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/utime.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/utime.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/utmp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/utmp.h
deleted file mode 120000
index 9fe8b95..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/utmp.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/utmp.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/utmp.h b/ndk/build/platforms/android-4/arch-arm/usr/include/utmp.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/utmp.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/utmp.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/wchar.h b/ndk/build/platforms/android-4/arch-arm/usr/include/wchar.h
deleted file mode 120000
index 5a35644..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/wchar.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/wchar.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/wchar.h b/ndk/build/platforms/android-4/arch-arm/usr/include/wchar.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/wchar.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/wchar.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/wctype.h b/ndk/build/platforms/android-4/arch-arm/usr/include/wctype.h
deleted file mode 120000
index 2a2a823..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/wctype.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/wctype.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/wctype.h b/ndk/build/platforms/android-4/arch-arm/usr/include/wctype.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/wctype.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/wctype.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/zconf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/zconf.h
deleted file mode 120000
index 10d4a1e..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/zconf.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/zconf.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/zconf.h b/ndk/build/platforms/android-4/arch-arm/usr/include/zconf.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/zconf.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/zconf.h
diff --git a/ndk/build/platforms/android-4/arch-arm/usr/include/zlib.h b/ndk/build/platforms/android-4/arch-arm/usr/include/zlib.h
deleted file mode 120000
index d9e63a4..0000000
--- a/ndk/build/platforms/android-4/arch-arm/usr/include/zlib.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../common/include/zlib.h
\ No newline at end of file
diff --git a/ndk/build/platforms/android-4/common/include/zlib.h b/ndk/build/platforms/android-4/arch-arm/usr/include/zlib.h
similarity index 100%
rename from ndk/build/platforms/android-4/common/include/zlib.h
rename to ndk/build/platforms/android-4/arch-arm/usr/include/zlib.h
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/__ffs.h b/ndk/build/platforms/android-4/common/include/asm-generic/bitops/__ffs.h
deleted file mode 100644
index 3d135bd..0000000
--- a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/__ffs.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_GENERIC_BITOPS___FFS_H_
-#define _ASM_GENERIC_BITOPS___FFS_H_
-
-#include <asm/types.h>
-
-#if BITS_PER_LONG == 64
-#endif
-#endif
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/atomic.h b/ndk/build/platforms/android-4/common/include/asm-generic/bitops/atomic.h
deleted file mode 100644
index 5f53ba9..0000000
--- a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/atomic.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_GENERIC_BITOPS_ATOMIC_H_
-#define _ASM_GENERIC_BITOPS_ATOMIC_H_
-
-#include <asm/types.h>
-
-#define BITOP_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
-#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
-
-#define _atomic_spin_lock_irqsave(l,f) do { local_irq_save(f); } while (0)
-#define _atomic_spin_unlock_irqrestore(l,f) do { local_irq_restore(f); } while (0)
-
-#endif
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/ffz.h b/ndk/build/platforms/android-4/common/include/asm-generic/bitops/ffz.h
deleted file mode 100644
index 18da271..0000000
--- a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/ffz.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_GENERIC_BITOPS_FFZ_H_
-#define _ASM_GENERIC_BITOPS_FFZ_H_
-
-#define ffz(x) __ffs(~(x))
-
-#endif
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/find.h b/ndk/build/platforms/android-4/common/include/asm-generic/bitops/find.h
deleted file mode 100644
index 8361cfe..0000000
--- a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/find.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_GENERIC_BITOPS_FIND_H_
-#define _ASM_GENERIC_BITOPS_FIND_H_
-
-#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
-#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
-
-#endif
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/fls.h b/ndk/build/platforms/android-4/common/include/asm-generic/bitops/fls.h
deleted file mode 100644
index 8adbf31..0000000
--- a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/fls.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_GENERIC_BITOPS_FLS_H_
-#define _ASM_GENERIC_BITOPS_FLS_H_
-
-#endif
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/fls64.h b/ndk/build/platforms/android-4/common/include/asm-generic/bitops/fls64.h
deleted file mode 100644
index af77098..0000000
--- a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/fls64.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_GENERIC_BITOPS_FLS64_H_
-#define _ASM_GENERIC_BITOPS_FLS64_H_
-
-#include <asm/types.h>
-
-#endif
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/le.h b/ndk/build/platforms/android-4/common/include/asm-generic/bitops/le.h
deleted file mode 100644
index 97ca973..0000000
--- a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/le.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_GENERIC_BITOPS_LE_H_
-#define _ASM_GENERIC_BITOPS_LE_H_
-
-#include <asm/types.h>
-#include <asm/byteorder.h>
-
-#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
-#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
-
-#ifdef __LITTLE_ENDIAN
-
-#define generic_test_le_bit(nr, addr) test_bit(nr, addr)
-#define generic___set_le_bit(nr, addr) __set_bit(nr, addr)
-#define generic___clear_le_bit(nr, addr) __clear_bit(nr, addr)
-
-#define generic_test_and_set_le_bit(nr, addr) test_and_set_bit(nr, addr)
-#define generic_test_and_clear_le_bit(nr, addr) test_and_clear_bit(nr, addr)
-
-#define generic___test_and_set_le_bit(nr, addr) __test_and_set_bit(nr, addr)
-#define generic___test_and_clear_le_bit(nr, addr) __test_and_clear_bit(nr, addr)
-
-#define generic_find_next_zero_le_bit(addr, size, offset) find_next_zero_bit(addr, size, offset)
-
-#elif defined(__BIG_ENDIAN)
-
-#define generic_test_le_bit(nr, addr)   test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
-#define generic___set_le_bit(nr, addr)   __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
-#define generic___clear_le_bit(nr, addr)   __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
-
-#define generic_test_and_set_le_bit(nr, addr)   test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
-#define generic_test_and_clear_le_bit(nr, addr)   test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
-
-#define generic___test_and_set_le_bit(nr, addr)   __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
-#define generic___test_and_clear_le_bit(nr, addr)   __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
-
-#else
-#error "Please fix <asm/byteorder.h>"
-#endif
-
-#define generic_find_first_zero_le_bit(addr, size)   generic_find_next_zero_le_bit((addr), (size), 0)
-
-#endif
diff --git a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/non-atomic.h b/ndk/build/platforms/android-4/common/include/asm-generic/bitops/non-atomic.h
deleted file mode 100644
index 727f736..0000000
--- a/ndk/build/platforms/android-4/common/include/asm-generic/bitops/non-atomic.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- ***   This header was automatically generated from a Linux kernel header
- ***   of the same name, to make information necessary for userspace to
- ***   call into the kernel available to libc.  It contains only constants,
- ***   structures, and macros generated from the original header, and thus,
- ***   contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _ASM_GENERIC_BITOPS_NON_ATOMIC_H_
-#define _ASM_GENERIC_BITOPS_NON_ATOMIC_H_
-
-#include <asm/types.h>
-
-#define BITOP_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
-#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
-
-#endif
diff --git a/ndk/build/platforms/android-4/common/include/endian.h b/ndk/build/platforms/android-4/common/include/endian.h
deleted file mode 100644
index 475b48c..0000000
--- a/ndk/build/platforms/android-4/common/include/endian.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef _ENDIAN_H_
-#define _ENDIAN_H_
-
-#include <sys/endian.h>
-
-#endif /* _ENDIAN_H_ */
diff --git a/ndk/build/platforms/android-4/common/include/stdint.h b/ndk/build/platforms/android-4/common/include/stdint.h
deleted file mode 100644
index 39a8ab8..0000000
--- a/ndk/build/platforms/android-4/common/include/stdint.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef _STDINT_H
-#define _STDINT_H
-
-#include <stddef.h>
-#include <sys/_types.h>
-
-
-
-#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
-#  define __STDINT_LIMITS
-#endif
-
-#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
-#  define  __STDINT_MACROS
-#endif
-
-/* the definitions of STDINT_LIMITS depend on those of STDINT_MACROS */
-#if defined __STDINT_LIMITS && !defined __STDINT_MACROS
-#  define  __STDINT_MACROS
-#endif
-
-typedef __int8_t      int8_t;
-typedef __uint8_t     uint8_t;
-typedef __int16_t     int16_t;
-typedef __uint16_t    uint16_t;
-typedef __int32_t     int32_t;
-typedef __uint32_t    uint32_t;
-#if !defined(__STRICT_ANSI__)
-typedef __int64_t     int64_t;
-typedef __uint64_t    uint64_t;
-#endif
-
-/*
- * int8_t & uint8_t
- */
-
-typedef int8_t        int_least8_t;
-typedef int8_t        int_fast8_t;
-
-typedef uint8_t       uint_least8_t;
-typedef uint8_t       uint_fast8_t;
-
-#ifdef __STDINT_LIMITS
-#  define INT8_MIN         (-128)
-#  define INT8_MAX         (127)
-#  define INT_LEAST8_MIN   INT8_MIN
-#  define INT_LEAST8_MAX   INT8_MAX
-#  define INT_FAST8_MIN    INT8_MIN
-#  define INT_FAST8_MAX    INT8_MAX
-
-#  define UINT8_MAX           (255U)
-#  define UINT_LEAST8_MAX     UINT8_MAX
-#  define UINT_FAST8_MAX      UINT8_MAX
-#endif
-
-#ifdef __STDINT_MACROS
-#  define INT8_C(c)	c
-#  define INT_LEAST8_C(c)	 INT8_C(c)
-#  define INT_FAST8_C(c)	INT8_C(c)
-
-#  define UINT8_C(c)	c ## U
-#  define UINT_LEAST8_C(c)  UINT8_C(c)
-#  define UINT_FAST8_C(c)  UINT8_C(c)
-#endif
-
-/*
- * int16_t & uint16_t
- */
-
-
-typedef int16_t       int_least16_t;
-typedef int32_t       int_fast16_t;
-
-typedef uint16_t      uint_least16_t;
-typedef uint32_t      uint_fast16_t;
-
-#ifdef __STDINT_LIMITS
-#  define INT16_MIN	(-32768)
-#  define INT16_MAX	(32767)
-#  define INT_LEAST16_MIN	INT16_MIN
-#  define INT_LEAST16_MAX	INT16_MAX
-#  define INT_FAST16_MIN	INT32_MIN
-#  define INT_FAST16_MAX	INT32_MAX
-
-#  define UINT16_MAX	(65535U)
-#  define UINT_LEAST16_MAX UINT16_MAX
-#  define UINT_FAST16_MAX UINT32_MAX
-#endif
-
-#ifdef __STDINT_MACROS
-#  define INT16_C(c)	c
-#  define INT_LEAST16_C(c) INT16_C(c)
-#  define INT_FAST16_C(c)	 INT32_C(c)
-
-#  define UINT16_C(c)	c ## U
-#  define UINT_LEAST16_C(c) UINT16_C(c)
-#  define UINT_FAST16_C(c) UINT32_C(c)
-#endif
-
-/*
- * int32_t & uint32_t
- */
-
-typedef int32_t       int_least32_t;
-typedef int32_t       int_fast32_t;
-
-typedef uint32_t      uint_least32_t;
-typedef uint32_t      uint_fast32_t;
-
-#ifdef __STDINT_LIMITS
-#  define INT32_MIN	(-2147483647-1)
-#  define INT32_MAX	(2147483647)
-#  define INT_LEAST32_MIN	INT32_MIN
-#  define INT_LEAST32_MAX	INT32_MAX
-#  define INT_FAST32_MIN	INT32_MIN
-#  define INT_FAST32_MAX	INT32_MAX
-
-#  define UINT32_MAX	(4294967295U)
-#  define UINT_LEAST32_MAX UINT32_MAX
-#  define UINT_FAST32_MAX UINT32_MAX
-#endif
-
-#ifdef __STDINT_MACROS
-#  define INT32_C(c)	c
-#  define INT_LEAST32_C(c) INT32_C(c)
-#  define INT_FAST32_C(c)  INT32_C(c)
-
-#  define UINT32_C(c)	c ## U
-#  define UINT_LEAST32_C(c) UINT32_C(c)
-#  define UINT_FAST32_C(c) UINT32_C(c)
-#endif
-
-#if !defined(__STRICT_ANSI__)
-/*
- *  int64_t
- */
-typedef int64_t       int_least64_t;
-typedef int64_t       int_fast64_t;
-
-typedef uint64_t      uint_least64_t;
-typedef uint64_t      uint_fast64_t;
-
-
-#ifdef __STDINT_LIMITS
-#  define INT64_MIN        (__INT64_C(-9223372036854775807)-1)
-#  define INT64_MAX        (__INT64_C(9223372036854775807))
-#  define INT_LEAST64_MIN  INT64_MIN
-#  define INT_LEAST64_MAX  INT64_MAX
-#  define INT_FAST64_MIN   INT64_MIN
-#  define INT_FAST64_MAX   INT64_MAX
-#  define UINT64_MAX       (__UINT64_C(18446744073709551615))
-
-#  define UINT_LEAST64_MAX UINT64_MAX
-#  define UINT_FAST64_MAX UINT64_MAX
-#endif
-
-#ifdef __STDINT_MACROS
-#  define __INT64_C(c)     c ## LL
-#  define INT64_C(c)       __INT64_C(c)
-#  define INT_LEAST64_C(c) INT64_C(c)
-#  define INT_FAST64_C(c)  INT64_C(c)
-
-#  define __UINT64_C(c)     c ## ULL
-#  define UINT64_C(c)       __UINT64_C(c)
-#  define UINT_LEAST64_C(c) UINT64_C(c)
-#  define UINT_FAST64_C(c)  UINT64_C(c)
-#endif
-
-
-#  define __PRI64_RANK   "ll"
-#  define __PRIFAST_RANK ""
-#  define __PRIPTR_RANK  ""
-
-#endif /* !__STRICT_ANSI__ */
-
-/*
- * intptr_t & uintptr_t
- */
-
-typedef int           intptr_t;
-typedef unsigned int  uintptr_t;
-
-#  define INTPTR_MIN    INT32_MIN
-#  define INTPTR_MAX    INT32_MAX
-#  define UINTPTR_MAX   UINT32_MAX
-#  define INTPTR_C(c)   INT32_C(c)
-#  define UINTPTR_C(c)  UINT32_C(c)
-#  define PTRDIFF_C(c)  INT32_C(c)
-#  define PTRDIFF_MIN   INT32_MIN
-#  define PTRDIFF_MAX   INT32_MAX
-
-
-/*
- *  intmax_t & uintmax_t
- */
-
-#if !defined(__STRICT_ANSI__)
-
-typedef uint64_t uintmax_t;
-typedef int64_t  intmax_t;
-
-#define INTMAX_MIN	INT64_MIN
-#define INTMAX_MAX	INT64_MAX
-#define UINTMAX_MAX	UINT64_MAX
-
-#define INTMAX_C(c)	INT64_C(c)
-#define UINTMAX_C(c)	UINT64_C(c)
-
-#else /* __STRICT_ANSI__ */
-
-typedef uint32_t  uintmax_t;
-typedef int32_t   intmax_t;
-
-#define  INTMAX_MIN    INT32_MIN
-#define  INTMAX_MAX    INT32_MAX
-#define  UINTMAX_MAX   UINT32_MAX
-
-#define INTMAX_C(c)	INT32_C(c)
-#define UINTMAX_C(c)	UINT32_C(c)
-
-#endif /* __STRICT_ANSI__ */
-
-
-/* size_t is defined by the GCC-specific <stddef.h> */
-#ifndef _SSIZE_T_DEFINED_
-#define _SSIZE_T_DEFINED_
-typedef long int  ssize_t;
-#endif
-
-#define _BITSIZE 32
-
-/* Keep the kernel from trying to define these types... */
-#define __BIT_TYPES_DEFINED__
-
-#endif /* _STDINT_H */
diff --git a/ndk/build/platforms/android-4/common/include/strings.h b/ndk/build/platforms/android-4/common/include/strings.h
deleted file mode 100644
index 1f73e21..0000000
--- a/ndk/build/platforms/android-4/common/include/strings.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*	$NetBSD: strings.h,v 1.10 2005/02/03 04:39:32 perry Exp $	*/
-
-/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Klaus Klein.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _STRINGS_H_
-#define _STRINGS_H_
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int	 bcmp(const void *, const void *, size_t);
-void	 bcopy(const void *, void *, size_t);
-void	 bzero(void *, size_t);
-int	 ffs(int);
-char	*index(const char *, int);
-char	*rindex(const char *, int);
-int	 strcasecmp(const char *, const char *);
-int	 strncasecmp(const char *, const char *, size_t);
-__END_DECLS
-
-#endif /* !defined(_STRINGS_H_) */
diff --git a/ndk/build/platforms/android-4/common/include/sys/stat.h b/ndk/build/platforms/android-4/common/include/sys/stat.h
deleted file mode 100644
index 23ab5ae..0000000
--- a/ndk/build/platforms/android-4/common/include/sys/stat.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef _SYS_STAT_H_
-#define _SYS_STAT_H_
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <linux/stat.h>
-
-#include <endian.h>
-
-__BEGIN_DECLS
-
-/* really matches stat64 in the kernel, hence the padding
- * Note: The kernel zero's the padded region because glibc might read them
- * in the hope that the kernel has stretched to using larger sizes.
- */
-struct stat {
-    unsigned long long  st_dev;
-    unsigned char       __pad0[4];
-
-    unsigned long       __st_ino;
-    unsigned int        st_mode;
-    unsigned int        st_nlink;
-
-    unsigned long       st_uid;
-    unsigned long       st_gid;
-
-    unsigned long long  st_rdev;
-    unsigned char       __pad3[4];
-
-    long long           st_size;
-    unsigned long	st_blksize;
-    unsigned long long  st_blocks;
-
-    unsigned long       st_atime;
-    unsigned long       st_atime_nsec;
-
-    unsigned long       st_mtime;
-    unsigned long       st_mtime_nsec;
-
-    unsigned long       st_ctime;
-    unsigned long       st_ctime_nsec;
-
-    unsigned long long  st_ino;
-};
-
-extern int    chmod(const char *, mode_t);
-extern int    fchmod(int, mode_t);
-extern int    mkdir(const char *, mode_t);
-
-extern int    stat(const char *, struct stat *);
-extern int    fstat(int, struct stat *);
-extern int    lstat(const char *, struct stat *);
-extern int    mknod(const char *, mode_t, dev_t);
-extern mode_t umask(mode_t);
-
-#define  stat64    stat
-#define  fstat64   fstat
-#define  lstat64   lstat
-
-static __inline__ int mkfifo(const char *__p, mode_t __m)
-{
-  return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t)0);
-}
-
-extern int  fstatat(int dirfd, const char *path, struct stat *buf, int flags);
-extern int  mkdirat(int dirfd, const char *pathname, mode_t mode);
-extern int fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags);
-extern int fchmodat(int dirfd, const char *path, mode_t mode, int flags);
-extern int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
-
-__END_DECLS
-
-#endif /* _SYS_STAT_H_ */
diff --git a/ndk/build/platforms/android-4/common/include/time.h b/ndk/build/platforms/android-4/common/include/time.h
deleted file mode 100644
index 35c2358..0000000
--- a/ndk/build/platforms/android-4/common/include/time.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef _TIME_H_
-#define _TIME_H_
-
-#include <sys/cdefs.h>
-#include <sys/time.h>
-
-#define __ARCH_SI_UID_T __kernel_uid32_t
-#include <asm/siginfo.h>
-#undef __ARCH_SI_UID_T
-
-__BEGIN_DECLS
-
-extern time_t   time(time_t *);
-extern int      nanosleep(const struct timespec *, struct timespec *);
-
-extern char *strtotimeval(const char *str, struct timeval *tv);
-
-struct tm {
-   int     tm_sec;         /* seconds */
-   int     tm_min;         /* minutes */
-   int     tm_hour;        /* hours */
-   int     tm_mday;        /* day of the month */
-   int     tm_mon;         /* month */
-   int     tm_year;        /* year */
-   int     tm_wday;        /* day of the week */
-   int     tm_yday;        /* day in the year */
-   int     tm_isdst;       /* daylight saving time */
-
-   long int tm_gmtoff;     /* Seconds east of UTC.  */
-   const char *tm_zone;    /* Timezone abbreviation.  */
-
-};
-
-/* defining TM_ZONE indicates that we have a "timezone abbreviation" field in
- * struct tm, the value should be the field name
- */
-#define   TM_ZONE   tm_zone
-
-extern char* asctime(const struct tm* a);
-extern char* asctime_r(const struct tm* a, char* buf);
-
-/* Return the difference between TIME1 and TIME0.  */
-extern double difftime (time_t __time1, time_t __time0);
-extern time_t mktime (struct tm *a);
-
-extern struct tm*  localtime(const time_t *t);
-extern struct tm*  localtime_r(const time_t *timep, struct tm *result);
-
-extern struct tm*  gmtime(const time_t *timep);
-extern struct tm*  gmtime_r(const time_t *timep, struct tm *result);
-
-extern char*       strptime(const char *buf, const char *fmt, struct tm *tm);
-extern size_t      strftime(char *s, size_t max, const char *format, const struct tm *tm);
-
-extern char *ctime(const time_t *timep);
-extern char *ctime_r(const time_t *timep, char *buf);
-
-/* global includes */
-extern char*     tzname[];
-extern int       daylight;
-extern long int  timezone;
-
-#define CLOCKS_PER_SEC     1000000
-
-extern clock_t   clock();
-
-/* BIONIC: extra linux clock goodies */
-extern int clock_getres(int, struct timespec *);
-extern int clock_gettime(int, struct timespec *);
-
-#define CLOCK_REALTIME             0
-#define CLOCK_MONOTONIC            1
-#define CLOCK_PROCESS_CPUTIME_ID   2
-#define CLOCK_THREAD_CPUTIME_ID    3
-#define CLOCK_REALTIME_HR          4
-#define CLOCK_MONOTONIC_HR         5
-
-extern int  timer_create(int, struct sigevent*, timer_t*);
-extern int  timer_delete(timer_t);
-extern int  timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue);
-extern int  timer_gettime(timer_t timerid, struct itimerspec *value);
-extern int  timer_getoverrun(timer_t  timerid);
-
-__END_DECLS
-
-#endif /* _TIME_H_ */
diff --git a/ndk/build/platforms/android-4/common/include/GLES/gl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/GLES/gl.h
similarity index 100%
copy from ndk/build/platforms/android-4/common/include/GLES/gl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/GLES/gl.h
diff --git a/ndk/build/platforms/android-4/common/include/GLES/glext.h b/ndk/build/platforms/android-5/arch-arm/usr/include/GLES/glext.h
similarity index 100%
copy from ndk/build/platforms/android-4/common/include/GLES/glext.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/GLES/glext.h
diff --git a/ndk/build/platforms/android-4/common/include/GLES/glplatform.h b/ndk/build/platforms/android-5/arch-arm/usr/include/GLES/glplatform.h
similarity index 100%
copy from ndk/build/platforms/android-4/common/include/GLES/glplatform.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/GLES/glplatform.h
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/GLES2/gl2.h b/ndk/build/platforms/android-5/arch-arm/usr/include/GLES2/gl2.h
new file mode 100644
index 0000000..0182a67
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/GLES2/gl2.h
@@ -0,0 +1,620 @@
+#ifndef __gl2_h_
+#define __gl2_h_
+
+/* $Revision: 7173 $ on $Date:: 2009-01-09 11:18:21 -0800 #$ */
+
+#include <GLES2/gl2platform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/*-------------------------------------------------------------------------
+ * Data type definitions
+ *-----------------------------------------------------------------------*/
+
+typedef void             GLvoid;
+typedef unsigned int     GLenum;
+typedef unsigned char    GLboolean;
+typedef unsigned int     GLbitfield;
+typedef khronos_int8_t   GLbyte;
+typedef short            GLshort;
+typedef int              GLint;
+typedef int              GLsizei;
+typedef khronos_uint8_t  GLubyte;
+typedef unsigned short   GLushort;
+typedef unsigned int     GLuint;
+typedef khronos_float_t  GLfloat;
+typedef khronos_float_t  GLclampf;
+typedef khronos_int32_t  GLfixed;
+
+/* GL types for handling large vertex buffer objects */
+typedef khronos_intptr_t GLintptr;
+typedef khronos_ssize_t  GLsizeiptr;
+
+/* OpenGL ES core versions */
+#define GL_ES_VERSION_2_0                 1
+
+/* ClearBufferMask */
+#define GL_DEPTH_BUFFER_BIT               0x00000100
+#define GL_STENCIL_BUFFER_BIT             0x00000400
+#define GL_COLOR_BUFFER_BIT               0x00004000
+
+/* Boolean */
+#define GL_FALSE                          0
+#define GL_TRUE                           1
+
+/* BeginMode */
+#define GL_POINTS                         0x0000
+#define GL_LINES                          0x0001
+#define GL_LINE_LOOP                      0x0002
+#define GL_LINE_STRIP                     0x0003
+#define GL_TRIANGLES                      0x0004
+#define GL_TRIANGLE_STRIP                 0x0005
+#define GL_TRIANGLE_FAN                   0x0006
+
+/* AlphaFunction (not supported in ES20) */
+/*      GL_NEVER */
+/*      GL_LESS */
+/*      GL_EQUAL */
+/*      GL_LEQUAL */
+/*      GL_GREATER */
+/*      GL_NOTEQUAL */
+/*      GL_GEQUAL */
+/*      GL_ALWAYS */
+
+/* BlendingFactorDest */
+#define GL_ZERO                           0
+#define GL_ONE                            1
+#define GL_SRC_COLOR                      0x0300
+#define GL_ONE_MINUS_SRC_COLOR            0x0301
+#define GL_SRC_ALPHA                      0x0302
+#define GL_ONE_MINUS_SRC_ALPHA            0x0303
+#define GL_DST_ALPHA                      0x0304
+#define GL_ONE_MINUS_DST_ALPHA            0x0305
+
+/* BlendingFactorSrc */
+/*      GL_ZERO */
+/*      GL_ONE */
+#define GL_DST_COLOR                      0x0306
+#define GL_ONE_MINUS_DST_COLOR            0x0307
+#define GL_SRC_ALPHA_SATURATE             0x0308
+/*      GL_SRC_ALPHA */
+/*      GL_ONE_MINUS_SRC_ALPHA */
+/*      GL_DST_ALPHA */
+/*      GL_ONE_MINUS_DST_ALPHA */
+
+/* BlendEquationSeparate */
+#define GL_FUNC_ADD                       0x8006
+#define GL_BLEND_EQUATION                 0x8009
+#define GL_BLEND_EQUATION_RGB             0x8009    /* same as BLEND_EQUATION */
+#define GL_BLEND_EQUATION_ALPHA           0x883D
+
+/* BlendSubtract */
+#define GL_FUNC_SUBTRACT                  0x800A
+#define GL_FUNC_REVERSE_SUBTRACT          0x800B
+
+/* Separate Blend Functions */
+#define GL_BLEND_DST_RGB                  0x80C8
+#define GL_BLEND_SRC_RGB                  0x80C9
+#define GL_BLEND_DST_ALPHA                0x80CA
+#define GL_BLEND_SRC_ALPHA                0x80CB
+#define GL_CONSTANT_COLOR                 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR       0x8002
+#define GL_CONSTANT_ALPHA                 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA       0x8004
+#define GL_BLEND_COLOR                    0x8005
+
+/* Buffer Objects */
+#define GL_ARRAY_BUFFER                   0x8892
+#define GL_ELEMENT_ARRAY_BUFFER           0x8893
+#define GL_ARRAY_BUFFER_BINDING           0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING   0x8895
+
+#define GL_STREAM_DRAW                    0x88E0
+#define GL_STATIC_DRAW                    0x88E4
+#define GL_DYNAMIC_DRAW                   0x88E8
+
+#define GL_BUFFER_SIZE                    0x8764
+#define GL_BUFFER_USAGE                   0x8765
+
+#define GL_CURRENT_VERTEX_ATTRIB          0x8626
+
+/* CullFaceMode */
+#define GL_FRONT                          0x0404
+#define GL_BACK                           0x0405
+#define GL_FRONT_AND_BACK                 0x0408
+
+/* DepthFunction */
+/*      GL_NEVER */
+/*      GL_LESS */
+/*      GL_EQUAL */
+/*      GL_LEQUAL */
+/*      GL_GREATER */
+/*      GL_NOTEQUAL */
+/*      GL_GEQUAL */
+/*      GL_ALWAYS */
+
+/* EnableCap */
+#define GL_TEXTURE_2D                     0x0DE1
+#define GL_CULL_FACE                      0x0B44
+#define GL_BLEND                          0x0BE2
+#define GL_DITHER                         0x0BD0
+#define GL_STENCIL_TEST                   0x0B90
+#define GL_DEPTH_TEST                     0x0B71
+#define GL_SCISSOR_TEST                   0x0C11
+#define GL_POLYGON_OFFSET_FILL            0x8037
+#define GL_SAMPLE_ALPHA_TO_COVERAGE       0x809E
+#define GL_SAMPLE_COVERAGE                0x80A0
+
+/* ErrorCode */
+#define GL_NO_ERROR                       0
+#define GL_INVALID_ENUM                   0x0500
+#define GL_INVALID_VALUE                  0x0501
+#define GL_INVALID_OPERATION              0x0502
+#define GL_OUT_OF_MEMORY                  0x0505
+
+/* FrontFaceDirection */
+#define GL_CW                             0x0900
+#define GL_CCW                            0x0901
+
+/* GetPName */
+#define GL_LINE_WIDTH                     0x0B21
+#define GL_ALIASED_POINT_SIZE_RANGE       0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE       0x846E
+#define GL_CULL_FACE_MODE                 0x0B45
+#define GL_FRONT_FACE                     0x0B46
+#define GL_DEPTH_RANGE                    0x0B70
+#define GL_DEPTH_WRITEMASK                0x0B72
+#define GL_DEPTH_CLEAR_VALUE              0x0B73
+#define GL_DEPTH_FUNC                     0x0B74
+#define GL_STENCIL_CLEAR_VALUE            0x0B91
+#define GL_STENCIL_FUNC                   0x0B92
+#define GL_STENCIL_FAIL                   0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL        0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS        0x0B96
+#define GL_STENCIL_REF                    0x0B97
+#define GL_STENCIL_VALUE_MASK             0x0B93
+#define GL_STENCIL_WRITEMASK              0x0B98
+#define GL_STENCIL_BACK_FUNC              0x8800
+#define GL_STENCIL_BACK_FAIL              0x8801
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL   0x8802
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS   0x8803
+#define GL_STENCIL_BACK_REF               0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK        0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK         0x8CA5
+#define GL_VIEWPORT                       0x0BA2
+#define GL_SCISSOR_BOX                    0x0C10
+/*      GL_SCISSOR_TEST */
+#define GL_COLOR_CLEAR_VALUE              0x0C22
+#define GL_COLOR_WRITEMASK                0x0C23
+#define GL_UNPACK_ALIGNMENT               0x0CF5
+#define GL_PACK_ALIGNMENT                 0x0D05
+#define GL_MAX_TEXTURE_SIZE               0x0D33
+#define GL_MAX_VIEWPORT_DIMS              0x0D3A
+#define GL_SUBPIXEL_BITS                  0x0D50
+#define GL_RED_BITS                       0x0D52
+#define GL_GREEN_BITS                     0x0D53
+#define GL_BLUE_BITS                      0x0D54
+#define GL_ALPHA_BITS                     0x0D55
+#define GL_DEPTH_BITS                     0x0D56
+#define GL_STENCIL_BITS                   0x0D57
+#define GL_POLYGON_OFFSET_UNITS           0x2A00
+/*      GL_POLYGON_OFFSET_FILL */
+#define GL_POLYGON_OFFSET_FACTOR          0x8038
+#define GL_TEXTURE_BINDING_2D             0x8069
+#define GL_SAMPLE_BUFFERS                 0x80A8
+#define GL_SAMPLES                        0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE          0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT         0x80AB
+
+/* GetTextureParameter */
+/*      GL_TEXTURE_MAG_FILTER */
+/*      GL_TEXTURE_MIN_FILTER */
+/*      GL_TEXTURE_WRAP_S */
+/*      GL_TEXTURE_WRAP_T */
+
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS     0x86A3
+
+/* HintMode */
+#define GL_DONT_CARE                      0x1100
+#define GL_FASTEST                        0x1101
+#define GL_NICEST                         0x1102
+
+/* HintTarget */
+#define GL_GENERATE_MIPMAP_HINT            0x8192
+
+/* DataType */
+#define GL_BYTE                           0x1400
+#define GL_UNSIGNED_BYTE                  0x1401
+#define GL_SHORT                          0x1402
+#define GL_UNSIGNED_SHORT                 0x1403
+#define GL_INT                            0x1404
+#define GL_UNSIGNED_INT                   0x1405
+#define GL_FLOAT                          0x1406
+#define GL_FIXED                          0x140C
+
+/* PixelFormat */
+#define GL_DEPTH_COMPONENT                0x1902
+#define GL_ALPHA                          0x1906
+#define GL_RGB                            0x1907
+#define GL_RGBA                           0x1908
+#define GL_LUMINANCE                      0x1909
+#define GL_LUMINANCE_ALPHA                0x190A
+
+/* PixelType */
+/*      GL_UNSIGNED_BYTE */
+#define GL_UNSIGNED_SHORT_4_4_4_4         0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1         0x8034
+#define GL_UNSIGNED_SHORT_5_6_5           0x8363
+
+/* Shaders */
+#define GL_FRAGMENT_SHADER                  0x8B30
+#define GL_VERTEX_SHADER                    0x8B31
+#define GL_MAX_VERTEX_ATTRIBS               0x8869
+#define GL_MAX_VERTEX_UNIFORM_VECTORS       0x8DFB
+#define GL_MAX_VARYING_VECTORS              0x8DFC
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS   0x8B4C
+#define GL_MAX_TEXTURE_IMAGE_UNITS          0x8872
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS     0x8DFD
+#define GL_SHADER_TYPE                      0x8B4F
+#define GL_DELETE_STATUS                    0x8B80
+#define GL_LINK_STATUS                      0x8B82
+#define GL_VALIDATE_STATUS                  0x8B83
+#define GL_ATTACHED_SHADERS                 0x8B85
+#define GL_ACTIVE_UNIFORMS                  0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH        0x8B87
+#define GL_ACTIVE_ATTRIBUTES                0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH      0x8B8A
+#define GL_SHADING_LANGUAGE_VERSION         0x8B8C
+#define GL_CURRENT_PROGRAM                  0x8B8D
+
+/* StencilFunction */
+#define GL_NEVER                          0x0200
+#define GL_LESS                           0x0201
+#define GL_EQUAL                          0x0202
+#define GL_LEQUAL                         0x0203
+#define GL_GREATER                        0x0204
+#define GL_NOTEQUAL                       0x0205
+#define GL_GEQUAL                         0x0206
+#define GL_ALWAYS                         0x0207
+
+/* StencilOp */
+/*      GL_ZERO */
+#define GL_KEEP                           0x1E00
+#define GL_REPLACE                        0x1E01
+#define GL_INCR                           0x1E02
+#define GL_DECR                           0x1E03
+#define GL_INVERT                         0x150A
+#define GL_INCR_WRAP                      0x8507
+#define GL_DECR_WRAP                      0x8508
+
+/* StringName */
+#define GL_VENDOR                         0x1F00
+#define GL_RENDERER                       0x1F01
+#define GL_VERSION                        0x1F02
+#define GL_EXTENSIONS                     0x1F03
+
+/* TextureMagFilter */
+#define GL_NEAREST                        0x2600
+#define GL_LINEAR                         0x2601
+
+/* TextureMinFilter */
+/*      GL_NEAREST */
+/*      GL_LINEAR */
+#define GL_NEAREST_MIPMAP_NEAREST         0x2700
+#define GL_LINEAR_MIPMAP_NEAREST          0x2701
+#define GL_NEAREST_MIPMAP_LINEAR          0x2702
+#define GL_LINEAR_MIPMAP_LINEAR           0x2703
+
+/* TextureParameterName */
+#define GL_TEXTURE_MAG_FILTER             0x2800
+#define GL_TEXTURE_MIN_FILTER             0x2801
+#define GL_TEXTURE_WRAP_S                 0x2802
+#define GL_TEXTURE_WRAP_T                 0x2803
+
+/* TextureTarget */
+/*      GL_TEXTURE_2D */
+#define GL_TEXTURE                        0x1702
+
+#define GL_TEXTURE_CUBE_MAP               0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP       0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X    0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X    0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y    0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y    0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z    0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z    0x851A
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE      0x851C
+
+/* TextureUnit */
+#define GL_TEXTURE0                       0x84C0
+#define GL_TEXTURE1                       0x84C1
+#define GL_TEXTURE2                       0x84C2
+#define GL_TEXTURE3                       0x84C3
+#define GL_TEXTURE4                       0x84C4
+#define GL_TEXTURE5                       0x84C5
+#define GL_TEXTURE6                       0x84C6
+#define GL_TEXTURE7                       0x84C7
+#define GL_TEXTURE8                       0x84C8
+#define GL_TEXTURE9                       0x84C9
+#define GL_TEXTURE10                      0x84CA
+#define GL_TEXTURE11                      0x84CB
+#define GL_TEXTURE12                      0x84CC
+#define GL_TEXTURE13                      0x84CD
+#define GL_TEXTURE14                      0x84CE
+#define GL_TEXTURE15                      0x84CF
+#define GL_TEXTURE16                      0x84D0
+#define GL_TEXTURE17                      0x84D1
+#define GL_TEXTURE18                      0x84D2
+#define GL_TEXTURE19                      0x84D3
+#define GL_TEXTURE20                      0x84D4
+#define GL_TEXTURE21                      0x84D5
+#define GL_TEXTURE22                      0x84D6
+#define GL_TEXTURE23                      0x84D7
+#define GL_TEXTURE24                      0x84D8
+#define GL_TEXTURE25                      0x84D9
+#define GL_TEXTURE26                      0x84DA
+#define GL_TEXTURE27                      0x84DB
+#define GL_TEXTURE28                      0x84DC
+#define GL_TEXTURE29                      0x84DD
+#define GL_TEXTURE30                      0x84DE
+#define GL_TEXTURE31                      0x84DF
+#define GL_ACTIVE_TEXTURE                 0x84E0
+
+/* TextureWrapMode */
+#define GL_REPEAT                         0x2901
+#define GL_CLAMP_TO_EDGE                  0x812F
+#define GL_MIRRORED_REPEAT                0x8370
+
+/* Uniform Types */
+#define GL_FLOAT_VEC2                     0x8B50
+#define GL_FLOAT_VEC3                     0x8B51
+#define GL_FLOAT_VEC4                     0x8B52
+#define GL_INT_VEC2                       0x8B53
+#define GL_INT_VEC3                       0x8B54
+#define GL_INT_VEC4                       0x8B55
+#define GL_BOOL                           0x8B56
+#define GL_BOOL_VEC2                      0x8B57
+#define GL_BOOL_VEC3                      0x8B58
+#define GL_BOOL_VEC4                      0x8B59
+#define GL_FLOAT_MAT2                     0x8B5A
+#define GL_FLOAT_MAT3                     0x8B5B
+#define GL_FLOAT_MAT4                     0x8B5C
+#define GL_SAMPLER_2D                     0x8B5E
+#define GL_SAMPLER_CUBE                   0x8B60
+
+/* Vertex Arrays */
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED        0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE           0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE         0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE           0x8625
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED     0x886A
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER        0x8645
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+
+/* Read Format */
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE   0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+
+/* Shader Source */
+#define GL_COMPILE_STATUS                 0x8B81
+#define GL_INFO_LOG_LENGTH                0x8B84
+#define GL_SHADER_SOURCE_LENGTH           0x8B88
+#define GL_SHADER_COMPILER                0x8DFA
+
+/* Shader Binary */
+#define GL_SHADER_BINARY_FORMATS          0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS      0x8DF9
+
+/* Shader Precision-Specified Types */
+#define GL_LOW_FLOAT                      0x8DF0
+#define GL_MEDIUM_FLOAT                   0x8DF1
+#define GL_HIGH_FLOAT                     0x8DF2
+#define GL_LOW_INT                        0x8DF3
+#define GL_MEDIUM_INT                     0x8DF4
+#define GL_HIGH_INT                       0x8DF5
+
+/* Framebuffer Object. */
+#define GL_FRAMEBUFFER                    0x8D40
+#define GL_RENDERBUFFER                   0x8D41
+
+#define GL_RGBA4                          0x8056
+#define GL_RGB5_A1                        0x8057
+#define GL_RGB565                         0x8D62
+#define GL_DEPTH_COMPONENT16              0x81A5
+#define GL_STENCIL_INDEX                  0x1901
+#define GL_STENCIL_INDEX8                 0x8D48
+
+#define GL_RENDERBUFFER_WIDTH             0x8D42
+#define GL_RENDERBUFFER_HEIGHT            0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT   0x8D44
+#define GL_RENDERBUFFER_RED_SIZE          0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE        0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE         0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE        0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE        0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE      0x8D55
+
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE           0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME           0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL         0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+
+#define GL_COLOR_ATTACHMENT0              0x8CE0
+#define GL_DEPTH_ATTACHMENT               0x8D00
+#define GL_STENCIL_ATTACHMENT             0x8D20
+
+#define GL_NONE                           0
+
+#define GL_FRAMEBUFFER_COMPLETE                      0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT         0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS         0x8CD9
+#define GL_FRAMEBUFFER_UNSUPPORTED                   0x8CDD
+
+#define GL_FRAMEBUFFER_BINDING            0x8CA6
+#define GL_RENDERBUFFER_BINDING           0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE          0x84E8
+
+#define GL_INVALID_FRAMEBUFFER_OPERATION  0x0506
+
+/*-------------------------------------------------------------------------
+ * GL core functions.
+ *-----------------------------------------------------------------------*/
+
+GL_APICALL void         GL_APIENTRY glActiveTexture (GLenum texture);
+GL_APICALL void         GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
+GL_APICALL void         GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const char* name);
+GL_APICALL void         GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_APICALL void         GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GL_APICALL void         GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GL_APICALL void         GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_APICALL void         GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+GL_APICALL void         GL_APIENTRY glBlendEquation ( GLenum mode );
+GL_APICALL void         GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void         GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
+GL_APICALL void         GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GL_APICALL void         GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void* data, GLenum usage);
+GL_APICALL void         GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void* data);
+GL_APICALL GLenum       GL_APIENTRY glCheckFramebufferStatus (GLenum target);
+GL_APICALL void         GL_APIENTRY glClear (GLbitfield mask);
+GL_APICALL void         GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+GL_APICALL void         GL_APIENTRY glClearDepthf (GLclampf depth);
+GL_APICALL void         GL_APIENTRY glClearStencil (GLint s);
+GL_APICALL void         GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+GL_APICALL void         GL_APIENTRY glCompileShader (GLuint shader);
+GL_APICALL void         GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
+GL_APICALL void         GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
+GL_APICALL void         GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GL_APICALL void         GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL GLuint       GL_APIENTRY glCreateProgram (void);
+GL_APICALL GLuint       GL_APIENTRY glCreateShader (GLenum type);
+GL_APICALL void         GL_APIENTRY glCullFace (GLenum mode);
+GL_APICALL void         GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
+GL_APICALL void         GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
+GL_APICALL void         GL_APIENTRY glDeleteProgram (GLuint program);
+GL_APICALL void         GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
+GL_APICALL void         GL_APIENTRY glDeleteShader (GLuint shader);
+GL_APICALL void         GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
+GL_APICALL void         GL_APIENTRY glDepthFunc (GLenum func);
+GL_APICALL void         GL_APIENTRY glDepthMask (GLboolean flag);
+GL_APICALL void         GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
+GL_APICALL void         GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
+GL_APICALL void         GL_APIENTRY glDisable (GLenum cap);
+GL_APICALL void         GL_APIENTRY glDisableVertexAttribArray (GLuint index);
+GL_APICALL void         GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
+GL_APICALL void         GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void* indices);
+GL_APICALL void         GL_APIENTRY glEnable (GLenum cap);
+GL_APICALL void         GL_APIENTRY glEnableVertexAttribArray (GLuint index);
+GL_APICALL void         GL_APIENTRY glFinish (void);
+GL_APICALL void         GL_APIENTRY glFlush (void);
+GL_APICALL void         GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GL_APICALL void         GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GL_APICALL void         GL_APIENTRY glFrontFace (GLenum mode);
+GL_APICALL void         GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
+GL_APICALL void         GL_APIENTRY glGenerateMipmap (GLenum target);
+GL_APICALL void         GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
+GL_APICALL void         GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
+GL_APICALL void         GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
+GL_APICALL void         GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
+GL_APICALL void         GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
+GL_APICALL void         GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
+GL_APICALL int          GL_APIENTRY glGetAttribLocation (GLuint program, const char* name);
+GL_APICALL void         GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
+GL_APICALL void         GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL GLenum       GL_APIENTRY glGetError (void);
+GL_APICALL void         GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
+GL_APICALL void         GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
+GL_APICALL void         GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
+GL_APICALL void         GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
+GL_APICALL void         GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, char* infolog);
+GL_APICALL void         GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void         GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
+GL_APICALL void         GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog);
+GL_APICALL void         GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+GL_APICALL void         GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, char* source);
+GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void         GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
+GL_APICALL void         GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void         GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
+GL_APICALL void         GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
+GL_APICALL int          GL_APIENTRY glGetUniformLocation (GLuint program, const char* name);
+GL_APICALL void         GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
+GL_APICALL void         GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
+GL_APICALL void         GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void** pointer);
+GL_APICALL void         GL_APIENTRY glHint (GLenum target, GLenum mode);
+GL_APICALL GLboolean    GL_APIENTRY glIsBuffer (GLuint buffer);
+GL_APICALL GLboolean    GL_APIENTRY glIsEnabled (GLenum cap);
+GL_APICALL GLboolean    GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
+GL_APICALL GLboolean    GL_APIENTRY glIsProgram (GLuint program);
+GL_APICALL GLboolean    GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
+GL_APICALL GLboolean    GL_APIENTRY glIsShader (GLuint shader);
+GL_APICALL GLboolean    GL_APIENTRY glIsTexture (GLuint texture);
+GL_APICALL void         GL_APIENTRY glLineWidth (GLfloat width);
+GL_APICALL void         GL_APIENTRY glLinkProgram (GLuint program);
+GL_APICALL void         GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
+GL_APICALL void         GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
+GL_APICALL void         GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels);
+GL_APICALL void         GL_APIENTRY glReleaseShaderCompiler (void);
+GL_APICALL void         GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void         GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
+GL_APICALL void         GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void         GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length);
+GL_APICALL void         GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const char** string, const GLint* length);
+GL_APICALL void         GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void         GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void         GL_APIENTRY glStencilMask (GLuint mask);
+GL_APICALL void         GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GL_APICALL void         GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void         GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void         GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat,  GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void         GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
+GL_APICALL void         GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
+GL_APICALL void         GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
+GL_APICALL void         GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
+GL_APICALL void         GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);
+GL_APICALL void         GL_APIENTRY glUniform1f (GLint location, GLfloat x);
+GL_APICALL void         GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void         GL_APIENTRY glUniform1i (GLint location, GLint x);
+GL_APICALL void         GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void         GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
+GL_APICALL void         GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void         GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
+GL_APICALL void         GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void         GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void         GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void         GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
+GL_APICALL void         GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void         GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void         GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void         GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void         GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void         GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void         GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void         GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void         GL_APIENTRY glUseProgram (GLuint program);
+GL_APICALL void         GL_APIENTRY glValidateProgram (GLuint program);
+GL_APICALL void         GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
+GL_APICALL void         GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
+GL_APICALL void         GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
+GL_APICALL void         GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
+GL_APICALL void         GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void         GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
+GL_APICALL void         GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void         GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
+GL_APICALL void         GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
+GL_APICALL void         GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gl2_h_ */
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/GLES2/gl2ext.h b/ndk/build/platforms/android-5/arch-arm/usr/include/GLES2/gl2ext.h
new file mode 100644
index 0000000..72f1ae7
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/GLES2/gl2ext.h
@@ -0,0 +1,518 @@
+#ifndef __gl2ext_h_
+#define __gl2ext_h_
+
+/* $Revision: 8271 $ on $Date:: 2009-05-21 09:33:40 -0700 #$ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+#ifndef GL_APIENTRYP
+#   define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+/*------------------------------------------------------------------------*
+ * OES extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_OES_compressed_ETC1_RGB8_texture */
+#ifndef GL_OES_compressed_ETC1_RGB8_texture
+#define GL_ETC1_RGB8_OES                                        0x8D64
+#endif
+
+/* GL_OES_compressed_paletted_texture */
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_PALETTE4_RGB8_OES                                    0x8B90
+#define GL_PALETTE4_RGBA8_OES                                   0x8B91
+#define GL_PALETTE4_R5_G6_B5_OES                                0x8B92
+#define GL_PALETTE4_RGBA4_OES                                   0x8B93
+#define GL_PALETTE4_RGB5_A1_OES                                 0x8B94
+#define GL_PALETTE8_RGB8_OES                                    0x8B95
+#define GL_PALETTE8_RGBA8_OES                                   0x8B96
+#define GL_PALETTE8_R5_G6_B5_OES                                0x8B97
+#define GL_PALETTE8_RGBA4_OES                                   0x8B98
+#define GL_PALETTE8_RGB5_A1_OES                                 0x8B99
+#endif
+
+/* GL_OES_depth24 */
+#ifndef GL_OES_depth24
+#define GL_DEPTH_COMPONENT24_OES                                0x81A6
+#endif
+
+/* GL_OES_depth32 */
+#ifndef GL_OES_depth32
+#define GL_DEPTH_COMPONENT32_OES                                0x81A7
+#endif
+
+/* GL_OES_depth_texture */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_EGL_image */
+#ifndef GL_OES_EGL_image
+typedef void* GLeglImageOES;
+#endif
+
+/* GL_OES_get_program_binary */
+#ifndef GL_OES_get_program_binary
+#define GL_PROGRAM_BINARY_LENGTH_OES                            0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS_OES                       0x87FE
+#define GL_PROGRAM_BINARY_FORMATS_OES                           0x87FF
+#endif
+
+/* GL_OES_mapbuffer */
+#ifndef GL_OES_mapbuffer
+#define GL_WRITE_ONLY_OES                                       0x88B9
+#define GL_BUFFER_ACCESS_OES                                    0x88BB
+#define GL_BUFFER_MAPPED_OES                                    0x88BC
+#define GL_BUFFER_MAP_POINTER_OES                               0x88BD
+#endif
+
+/* GL_OES_packed_depth_stencil */
+#ifndef GL_OES_packed_depth_stencil
+#define GL_DEPTH_STENCIL_OES                                    0x84F9
+#define GL_UNSIGNED_INT_24_8_OES                                0x84FA
+#define GL_DEPTH24_STENCIL8_OES                                 0x88F0
+#endif
+
+/* GL_OES_rgb8_rgba8 */
+#ifndef GL_OES_rgb8_rgba8
+#define GL_RGB8_OES                                             0x8051
+#define GL_RGBA8_OES                                            0x8058
+#endif
+
+/* GL_OES_standard_derivatives */
+#ifndef GL_OES_standard_derivatives
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES                  0x8B8B
+#endif
+
+/* GL_OES_stencil1 */
+#ifndef GL_OES_stencil1
+#define GL_STENCIL_INDEX1_OES                                   0x8D46
+#endif
+
+/* GL_OES_stencil4 */
+#ifndef GL_OES_stencil4
+#define GL_STENCIL_INDEX4_OES                                   0x8D47
+#endif
+
+/* GL_OES_texture3D */
+#ifndef GL_OES_texture3D
+#define GL_TEXTURE_WRAP_R_OES                                   0x8072
+#define GL_TEXTURE_3D_OES                                       0x806F
+#define GL_TEXTURE_BINDING_3D_OES                               0x806A
+#define GL_MAX_3D_TEXTURE_SIZE_OES                              0x8073
+#define GL_SAMPLER_3D_OES                                       0x8B5F
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES        0x8CD4
+#endif
+
+/* GL_OES_texture_half_float */
+#ifndef GL_OES_texture_half_float
+#define GL_HALF_FLOAT_OES                                       0x8D61
+#endif
+
+/* GL_OES_vertex_half_float */
+/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */
+
+/* GL_OES_vertex_type_10_10_10_2 */
+#ifndef GL_OES_vertex_type_10_10_10_2
+#define GL_UNSIGNED_INT_10_10_10_2_OES                          0x8DF6
+#define GL_INT_10_10_10_2_OES                                   0x8DF7
+#endif
+
+/*------------------------------------------------------------------------*
+ * AMD extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_AMD_compressed_3DC_texture */
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_3DC_X_AMD                                            0x87F9
+#define GL_3DC_XY_AMD                                           0x87FA
+#endif
+
+/* GL_AMD_compressed_ATC_texture */
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_ATC_RGB_AMD                                          0x8C92
+#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD                          0x8C93
+#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD                      0x87EE
+#endif
+
+/* GL_AMD_program_binary_Z400 */
+#ifndef GL_AMD_program_binary_Z400
+#define GL_Z400_BINARY_AMD                                      0x8740
+#endif
+
+/* GL_AMD_performance_monitor */
+#ifndef GL_AMD_performance_monitor
+#define GL_COUNTER_TYPE_AMD                                     0x8BC0
+#define GL_COUNTER_RANGE_AMD                                    0x8BC1
+#define GL_UNSIGNED_INT64_AMD                                   0x8BC2
+#define GL_PERCENTAGE_AMD                                       0x8BC3
+#define GL_PERFMON_RESULT_AVAILABLE_AMD                         0x8BC4
+#define GL_PERFMON_RESULT_SIZE_AMD                              0x8BC5
+#define GL_PERFMON_RESULT_AMD                                   0x8BC6
+#endif
+
+/*------------------------------------------------------------------------*
+ * EXT extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT                           0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT                       0x84FF
+#endif
+
+/* GL_EXT_texture_type_2_10_10_10_REV */
+#ifndef GL_EXT_texture_type_2_10_10_10_REV
+#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT                      0x8368
+#endif
+
+/* GL_EXT_texture_format_BGRA8888 */
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_BGRA                                                 0x80E1
+#endif
+
+/*------------------------------------------------------------------------*
+ * IMG extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_IMG_read_format */
+#ifndef GL_IMG_read_format
+#define GL_BGRA                                                 0x80E1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV                           0x8365
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV                           0x8366
+#endif
+
+/* GL_IMG_texture_compression_pvrtc */
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG                      0x8C00
+#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG                      0x8C01
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG                     0x8C02
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG                     0x8C03
+#endif
+
+/*------------------------------------------------------------------------*
+ * NV extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_NV_fence */
+#ifndef GL_NV_fence
+#define GL_ALL_COMPLETED_NV                                     0x84F2
+#define GL_FENCE_STATUS_NV                                      0x84F3
+#define GL_FENCE_CONDITION_NV                                   0x84F4
+#endif
+
+/*------------------------------------------------------------------------*
+ * QCOM extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_QCOM_driver_control */
+/* No new tokens introduced by this extension. */
+
+/* GL_QCOM_perfmon_global_mode */
+#ifndef GL_QCOM_perfmon_global_mode
+#define GL_PERFMON_GLOBAL_MODE_QCOM                             0x8FA0
+#endif
+
+/*------------------------------------------------------------------------*
+ * End of extension tokens, start of corresponding extension functions
+ *------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------*
+ * OES extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_OES_compressed_ETC1_RGB8_texture */
+#ifndef GL_OES_compressed_ETC1_RGB8_texture
+#define GL_OES_compressed_ETC1_RGB8_texture 1
+#endif
+
+/* GL_OES_compressed_paletted_texture */
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_OES_compressed_paletted_texture 1
+#endif
+
+/* GL_OES_EGL_image */
+#ifndef GL_OES_EGL_image
+#define GL_OES_EGL_image 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
+GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
+#endif
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
+#endif
+
+/* GL_OES_depth24 */
+#ifndef GL_OES_depth24
+#define GL_OES_depth24 1
+#endif
+
+/* GL_OES_depth32 */
+#ifndef GL_OES_depth32
+#define GL_OES_depth32 1
+#endif
+
+/* GL_OES_depth_texture */
+#ifndef GL_OES_depth_texture
+#define GL_OES_depth_texture 1
+#endif
+
+/* GL_OES_element_index_uint */
+#ifndef GL_OES_element_index_uint
+#define GL_OES_element_index_uint 1
+#endif
+
+/* GL_OES_fbo_render_mipmap */
+#ifndef GL_OES_fbo_render_mipmap
+#define GL_OES_fbo_render_mipmap 1
+#endif
+
+/* GL_OES_fragment_precision_high */
+#ifndef GL_OES_fragment_precision_high
+#define GL_OES_fragment_precision_high 1
+#endif
+
+/* GL_OES_get_program_binary */
+#ifndef GL_OES_get_program_binary
+#define GL_OES_get_program_binary 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
+#endif
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
+#endif
+
+/* GL_OES_mapbuffer */
+#ifndef GL_OES_mapbuffer
+#define GL_OES_mapbuffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
+GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void** params);
+#endif
+typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void** params);
+#endif
+
+/* GL_OES_packed_depth_stencil */
+#ifndef GL_OES_packed_depth_stencil
+#define GL_OES_packed_depth_stencil 1
+#endif
+
+/* GL_OES_rgb8_rgba8 */
+#ifndef GL_OES_rgb8_rgba8
+#define GL_OES_rgb8_rgba8 1
+#endif
+
+/* GL_OES_standard_derivatives */
+#ifndef GL_OES_standard_derivatives
+#define GL_OES_standard_derivatives 1
+#endif
+
+/* GL_OES_stencil1 */
+#ifndef GL_OES_stencil1
+#define GL_OES_stencil1 1
+#endif
+
+/* GL_OES_stencil4 */
+#ifndef GL_OES_stencil4
+#define GL_OES_stencil4 1
+#endif
+
+/* GL_OES_texture_3D */
+#ifndef GL_OES_texture_3D
+#define GL_OES_texture_3D 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels);
+GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);
+GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+#endif
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+#endif
+
+/* GL_OES_texture_float_linear */
+#ifndef GL_OES_texture_float_linear
+#define GL_OES_texture_float_linear 1
+#endif
+
+/* GL_OES_texture_half_float_linear */
+#ifndef GL_OES_texture_half_float_linear
+#define GL_OES_texture_half_float_linear 1
+#endif
+
+/* GL_OES_texture_float */
+#ifndef GL_OES_texture_float
+#define GL_OES_texture_float 1
+#endif
+
+/* GL_OES_texture_half_float */
+#ifndef GL_OES_texture_half_float
+#define GL_OES_texture_half_float 1
+#endif
+
+/* GL_OES_texture_npot */
+#ifndef GL_OES_texture_npot
+#define GL_OES_texture_npot 1
+#endif
+
+/* GL_OES_vertex_half_float */
+#ifndef GL_OES_vertex_half_float
+#define GL_OES_vertex_half_float 1
+#endif
+
+/* GL_OES_vertex_type_10_10_10_2 */
+#ifndef GL_OES_vertex_type_10_10_10_2
+#define GL_OES_vertex_type_10_10_10_2 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * AMD extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_AMD_compressed_3DC_texture */
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_AMD_compressed_3DC_texture 1
+#endif
+
+/* GL_AMD_compressed_ATC_texture */
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_AMD_compressed_ATC_texture 1
+#endif
+
+/* GL_AMD_program_binary_Z400 */
+#ifndef GL_AMD_program_binary_Z400
+#define GL_AMD_program_binary_Z400 1
+#endif
+
+/* AMD_performance_monitor */
+#ifndef GL_AMD_performance_monitor
+#define GL_AMD_performance_monitor 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, char *groupString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, char *counterString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data);
+GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
+GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
+GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#endif
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, char *groupString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, char *counterString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data);
+typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
+typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#endif
+
+/*------------------------------------------------------------------------*
+ * EXT extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#endif
+
+/* GL_EXT_texture_type_2_10_10_10_REV */
+#ifndef GL_EXT_texture_type_2_10_10_10_REV
+#define GL_EXT_texture_type_2_10_10_10_REV 1
+#endif
+
+/* GL_EXT_texture_format_BGRA8888 */
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_EXT_texture_format_BGRA8888 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * IMG extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_IMG_read_format */
+#ifndef GL_IMG_read_format
+#define GL_IMG_read_format 1
+#endif
+
+/* GL_IMG_texture_compression_pvrtc */
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_IMG_texture_compression_pvrtc 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * NV extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_NV_fence */
+#ifndef GL_NV_fence
+#define GL_NV_fence 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
+GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
+GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint fence);
+GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint fence);
+GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint fence);
+GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
+#endif
+typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
+typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
+typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
+typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
+#endif
+
+/*------------------------------------------------------------------------*
+ * QCOM extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_QCOM_driver_control */
+#ifndef GL_QCOM_driver_control
+#define GL_QCOM_driver_control 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
+GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, char *driverControlString);
+GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
+GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
+#endif
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, char *driverControlString);
+typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+#endif
+
+/* GL_QCOM_perfmon_global_mode */
+#ifndef GL_QCOM_perfmon_global_mode
+#define GL_QCOM_perfmon_global_mode 1
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gl2ext_h_ */
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/GLES2/gl2platform.h b/ndk/build/platforms/android-5/arch-arm/usr/include/GLES2/gl2platform.h
new file mode 100644
index 0000000..3e9036c
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/GLES2/gl2platform.h
@@ -0,0 +1,29 @@
+#ifndef __gl2platform_h_
+#define __gl2platform_h_
+
+/* $Revision: 7173 $ on $Date:: 2009-01-09 11:18:21 -0800 #$ */
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/* Platform-specific types and definitions for OpenGL ES 2.X  gl2.h
+ * Last modified on 2008/12/19
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * You are encouraged to submit all modifications to the Khronos group so that
+ * they can be included in future versions of this file.  Please submit changes
+ * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+ * by filing a bug against product "OpenGL-ES" component "Registry".
+ */
+
+#include <KHR/khrplatform.h>
+
+#ifndef GL_APICALL
+#define GL_APICALL  KHRONOS_APICALL
+#endif
+
+#define GL_APIENTRY KHRONOS_APIENTRY
+
+#endif /* __gl2platform_h_ */
diff --git a/ndk/build/platforms/android-4/common/include/KHR/khrplatform.h b/ndk/build/platforms/android-5/arch-arm/usr/include/KHR/khrplatform.h
similarity index 100%
copy from ndk/build/platforms/android-4/common/include/KHR/khrplatform.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/KHR/khrplatform.h
diff --git a/ndk/build/platforms/android-3/common/include/alloca.h b/ndk/build/platforms/android-5/arch-arm/usr/include/alloca.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/alloca.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/alloca.h
diff --git a/ndk/build/platforms/android-3/common/include/android/log.h b/ndk/build/platforms/android-5/arch-arm/usr/include/android/log.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/android/log.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/android/log.h
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/arm/fenv.h b/ndk/build/platforms/android-5/arch-arm/usr/include/arm/fenv.h
new file mode 100644
index 0000000..e7a8860
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/arm/fenv.h
@@ -0,0 +1,217 @@
+/*-
+ * Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/lib/msun/arm/fenv.h,v 1.5 2005/03/16 19:03:45 das Exp $
+ */
+
+#ifndef	_FENV_H_
+#define	_FENV_H_
+
+#include <sys/_types.h>
+
+typedef	__uint32_t	fenv_t;
+typedef	__uint32_t	fexcept_t;
+
+/* Exception flags */
+#define	FE_INVALID	0x0001
+#define	FE_DIVBYZERO	0x0002
+#define	FE_OVERFLOW	0x0004
+#define	FE_UNDERFLOW	0x0008
+#define	FE_INEXACT	0x0010
+#define	FE_ALL_EXCEPT	(FE_DIVBYZERO | FE_INEXACT | \
+			 FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
+
+/* Rounding modes */
+#define	FE_TONEAREST	0x0000
+#define	FE_TOWARDZERO	0x0001
+#define	FE_UPWARD	0x0002
+#define	FE_DOWNWARD	0x0003
+#define	_ROUND_MASK	(FE_TONEAREST | FE_DOWNWARD | \
+			 FE_UPWARD | FE_TOWARDZERO)
+__BEGIN_DECLS
+
+/* Default floating-point environment */
+extern const fenv_t	__fe_dfl_env;
+#define	FE_DFL_ENV	(&__fe_dfl_env)
+
+/* We need to be able to map status flag positions to mask flag positions */
+#define _FPUSW_SHIFT	16
+#define	_ENABLE_MASK	(FE_ALL_EXCEPT << _FPUSW_SHIFT)
+
+#ifdef	ARM_HARD_FLOAT
+#define	__rfs(__fpsr)	__asm __volatile("rfs %0" : "=r" (*(__fpsr)))
+#define	__wfs(__fpsr)	__asm __volatile("wfs %0" : : "r" (__fpsr))
+#else
+#define __rfs(__fpsr)
+#define __wfs(__fpsr)
+#endif
+
+static __inline int
+feclearexcept(int __excepts)
+{
+	fexcept_t __fpsr;
+
+	__rfs(&__fpsr);
+	__fpsr &= ~__excepts;
+	__wfs(__fpsr);
+	return (0);
+}
+
+static __inline int
+fegetexceptflag(fexcept_t *__flagp, int __excepts)
+{
+	fexcept_t __fpsr;
+
+	__rfs(&__fpsr);
+	*__flagp = __fpsr & __excepts;
+	return (0);
+}
+
+static __inline int
+fesetexceptflag(const fexcept_t *__flagp, int __excepts)
+{
+	fexcept_t __fpsr;
+
+	__rfs(&__fpsr);
+	__fpsr &= ~__excepts;
+	__fpsr |= *__flagp & __excepts;
+	__wfs(__fpsr);
+	return (0);
+}
+
+static __inline int
+feraiseexcept(int __excepts)
+{
+	fexcept_t __ex = __excepts;
+
+	fesetexceptflag(&__ex, __excepts);	/* XXX */
+	return (0);
+}
+
+static __inline int
+fetestexcept(int __excepts)
+{
+	fexcept_t __fpsr;
+
+	__rfs(&__fpsr);
+	return (__fpsr & __excepts);
+}
+
+static __inline int
+fegetround(void)
+{
+
+	/*
+	 * Apparently, the rounding mode is specified as part of the
+	 * instruction format on ARM, so the dynamic rounding mode is
+	 * indeterminate.  Some FPUs may differ.
+	 */
+	return (-1);
+}
+
+static __inline int
+fesetround(int __round)
+{
+
+	return (-1);
+}
+
+static __inline int
+fegetenv(fenv_t *__envp)
+{
+
+	__rfs(__envp);
+	return (0);
+}
+
+static __inline int
+feholdexcept(fenv_t *__envp)
+{
+	fenv_t __env;
+
+	__rfs(&__env);
+	*__envp = __env;
+	__env &= ~(FE_ALL_EXCEPT | _ENABLE_MASK);
+	__wfs(__env);
+	return (0);
+}
+
+static __inline int
+fesetenv(const fenv_t *__envp)
+{
+
+	__wfs(*__envp);
+	return (0);
+}
+
+static __inline int
+feupdateenv(const fenv_t *__envp)
+{
+	fexcept_t __fpsr;
+
+	__rfs(&__fpsr);
+	__wfs(*__envp);
+	feraiseexcept(__fpsr & FE_ALL_EXCEPT);
+	return (0);
+}
+
+#if __BSD_VISIBLE
+
+static __inline int
+feenableexcept(int __mask)
+{
+	fenv_t __old_fpsr, __new_fpsr;
+
+	__rfs(&__old_fpsr);
+	__new_fpsr = __old_fpsr | (__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT;
+	__wfs(__new_fpsr);
+	return ((__old_fpsr >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
+}
+
+static __inline int
+fedisableexcept(int __mask)
+{
+	fenv_t __old_fpsr, __new_fpsr;
+
+	__rfs(&__old_fpsr);
+	__new_fpsr = __old_fpsr & ~((__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT);
+	__wfs(__new_fpsr);
+	return ((__old_fpsr >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
+}
+
+static __inline int
+fegetexcept(void)
+{
+	fenv_t __fpsr;
+
+	__rfs(&__fpsr);
+	return ((__fpsr & _ENABLE_MASK) >> _FPUSW_SHIFT);
+}
+
+#endif /* __BSD_VISIBLE */
+
+__END_DECLS
+
+#endif	/* !_FENV_H_ */
diff --git a/ndk/build/platforms/android-3/common/include/arpa/inet.h b/ndk/build/platforms/android-5/arch-arm/usr/include/arpa/inet.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/arpa/inet.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/arpa/inet.h
diff --git a/ndk/build/platforms/android-3/common/include/arpa/nameser.h b/ndk/build/platforms/android-5/arch-arm/usr/include/arpa/nameser.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/arpa/nameser.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/arpa/nameser.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/4level-fixup.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/4level-fixup.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/4level-fixup.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/4level-fixup.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/audit_dir_write.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/audit_dir_write.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/audit_dir_write.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/audit_dir_write.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/__ffs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/__ffs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/__ffs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/__ffs.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/atomic.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/atomic.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/atomic.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/atomic.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/ffz.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/ffz.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/ffz.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/ffz.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/find.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/find.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/find.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/find.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/fls.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/fls.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/fls.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/fls.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/fls64.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/fls64.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/fls64.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/fls64.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/le.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/le.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/le.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/le.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bitops/non-atomic.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/non-atomic.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bitops/non-atomic.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bitops/non-atomic.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/bug.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bug.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/bug.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/bug.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/cputime.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/cputime.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/cputime.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/cputime.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/emergency-restart.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/emergency-restart.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/emergency-restart.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/emergency-restart.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/errno-base.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/errno-base.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/errno-base.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/errno-base.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/errno.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/errno.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/errno.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/errno.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/fcntl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/fcntl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/fcntl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/fcntl.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/futex.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/futex.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/futex.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/futex.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/ioctl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/ioctl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/ioctl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/ioctl.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/ipc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/ipc.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/ipc.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/ipc.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/local.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/local.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/local.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/local.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/memory_model.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/memory_model.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/memory_model.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/memory_model.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/mman.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/mman.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/mman.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/mman.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/mutex-xchg.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/mutex-xchg.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/mutex-xchg.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/mutex-xchg.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/percpu.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/percpu.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/percpu.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/percpu.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/pgtable-nopud.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/pgtable-nopud.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/pgtable-nopud.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/pgtable-nopud.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/pgtable.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/pgtable.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/pgtable.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/pgtable.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/poll.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/poll.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/poll.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/poll.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/resource.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/resource.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/resource.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/resource.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/sections.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/sections.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/sections.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/sections.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/siginfo.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/siginfo.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/siginfo.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/siginfo.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/signal.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/signal.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/signal.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/signal.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/tlb.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/tlb.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/tlb.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/tlb.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/topology.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/topology.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/topology.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/topology.h
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/xor.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/xor.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/xor.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm-generic/xor.h
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/a.out.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/a.out.h
new file mode 100644
index 0000000..e8f17dc
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/a.out.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ARM_A_OUT_H__
+#define __ARM_A_OUT_H__
+
+#include <linux/personality.h>
+#include <asm/types.h>
+
+struct exec
+{
+ __u32 a_info;
+ __u32 a_text;
+ __u32 a_data;
+ __u32 a_bss;
+ __u32 a_syms;
+ __u32 a_entry;
+ __u32 a_trsize;
+ __u32 a_drsize;
+};
+
+#define N_TXTADDR(a) (0x00008000)
+
+#define N_TRSIZE(a) ((a).a_trsize)
+#define N_DRSIZE(a) ((a).a_drsize)
+#define N_SYMSIZE(a) ((a).a_syms)
+
+#define M_ARM 103
+
+#ifndef LIBRARY_START_TEXT
+#define LIBRARY_START_TEXT (0x00c00000)
+#endif
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/board-perseus2.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/board-perseus2.h
new file mode 100644
index 0000000..c6c5413
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/board-perseus2.h
@@ -0,0 +1,27 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARCH_OMAP_PERSEUS2_H
+#define __ASM_ARCH_OMAP_PERSEUS2_H
+
+#include <asm/arch/fpga.h>
+
+#ifndef OMAP_SDRAM_DEVICE
+#define OMAP_SDRAM_DEVICE D256M_1X16_4B
+#endif
+
+#define MAXIRQNUM IH_BOARD_BASE
+#define MAXFIQNUM MAXIRQNUM
+#define MAXSWINUM MAXIRQNUM
+
+#define NR_IRQS (MAXIRQNUM + 1)
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/board.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/board.h
new file mode 100644
index 0000000..a7a4c66
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/board.h
@@ -0,0 +1,163 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _OMAP_BOARD_H
+#define _OMAP_BOARD_H
+
+#include <linux/types.h>
+
+#include <asm/arch/gpio-switch.h>
+
+#define OMAP_TAG_CLOCK 0x4f01
+#define OMAP_TAG_MMC 0x4f02
+#define OMAP_TAG_SERIAL_CONSOLE 0x4f03
+#define OMAP_TAG_USB 0x4f04
+#define OMAP_TAG_LCD 0x4f05
+#define OMAP_TAG_GPIO_SWITCH 0x4f06
+#define OMAP_TAG_UART 0x4f07
+#define OMAP_TAG_FBMEM 0x4f08
+#define OMAP_TAG_STI_CONSOLE 0x4f09
+#define OMAP_TAG_CAMERA_SENSOR 0x4f0a
+#define OMAP_TAG_BT 0x4f0b
+
+#define OMAP_TAG_BOOT_REASON 0x4f80
+#define OMAP_TAG_FLASH_PART 0x4f81
+#define OMAP_TAG_VERSION_STR 0x4f82
+
+struct omap_clock_config {
+
+ u8 system_clock_type;
+};
+
+struct omap_mmc_conf {
+ unsigned enabled:1;
+
+ unsigned nomux:1;
+
+ unsigned cover:1;
+
+ unsigned wire4:1;
+ s16 power_pin;
+ s16 switch_pin;
+ s16 wp_pin;
+};
+
+struct omap_mmc_config {
+ struct omap_mmc_conf mmc[2];
+};
+
+struct omap_serial_console_config {
+ u8 console_uart;
+ u32 console_speed;
+};
+
+struct omap_sti_console_config {
+ unsigned enable:1;
+ u8 channel;
+};
+
+struct omap_camera_sensor_config {
+ u16 reset_gpio;
+ int (*power_on)(void * data);
+ int (*power_off)(void * data);
+};
+
+struct omap_usb_config {
+
+ unsigned register_host:1;
+ unsigned register_dev:1;
+ u8 otg;
+
+ u8 hmc_mode;
+
+ u8 rwc;
+
+ u8 pins[3];
+};
+
+struct omap_lcd_config {
+ char panel_name[16];
+ char ctrl_name[16];
+ s16 nreset_gpio;
+ u8 data_lines;
+};
+
+struct device;
+struct fb_info;
+struct omap_backlight_config {
+ int default_intensity;
+ int (*set_power)(struct device *dev, int state);
+ int (*check_fb)(struct fb_info *fb);
+};
+
+struct omap_fbmem_config {
+ u32 start;
+ u32 size;
+};
+
+struct omap_pwm_led_platform_data {
+ const char *name;
+ int intensity_timer;
+ int blink_timer;
+ void (*set_power)(struct omap_pwm_led_platform_data *self, int on_off);
+};
+
+struct omap_gpio_switch_config {
+ char name[12];
+ u16 gpio;
+ int flags:4;
+ int type:4;
+ int key_code:24;
+};
+
+struct omap_uart_config {
+
+ unsigned int enabled_uarts;
+};
+
+struct omap_flash_part_config {
+ char part_table[0];
+};
+
+struct omap_boot_reason_config {
+ char reason_str[12];
+};
+
+struct omap_version_config {
+ char component[12];
+ char version[12];
+};
+
+struct omap_board_config_entry {
+ u16 tag;
+ u16 len;
+ u8 data[0];
+};
+
+struct omap_board_config_kernel {
+ u16 tag;
+ const void *data;
+};
+
+struct omap_bluetooth_config {
+ u8 chip_type;
+ u8 bt_uart;
+ u8 bd_addr[6];
+ u8 bt_sysclk;
+ int bt_wakeup_gpio;
+ int host_wakeup_gpio;
+ int reset_gpio;
+};
+
+#define omap_get_config(tag, type)   ((const type *) __omap_get_config((tag), sizeof(type), 0))
+#define omap_get_nr_config(tag, type, nr)   ((const type *) __omap_get_config((tag), sizeof(type), (nr)))
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/cpu.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/cpu.h
new file mode 100644
index 0000000..fa7a408
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/cpu.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARCH_OMAP_CPU_H
+#define __ASM_ARCH_OMAP_CPU_H
+
+#define omap2_cpu_rev() ((system_rev >> 8) & 0x0f)
+
+#undef MULTI_OMAP1
+#undef MULTI_OMAP2
+#undef OMAP_NAME
+
+#define GET_OMAP_CLASS (system_rev & 0xff)
+
+#define IS_OMAP_CLASS(class, id)  static inline int is_omap ##class (void)  {   return (GET_OMAP_CLASS == (id)) ? 1 : 0;  }
+
+#define GET_OMAP_SUBCLASS ((system_rev >> 20) & 0x0fff)
+
+#define IS_OMAP_SUBCLASS(subclass, id)  static inline int is_omap ##subclass (void)  {   return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0;  }
+
+#define cpu_is_omap7xx() 0
+#define cpu_is_omap15xx() 0
+#define cpu_is_omap16xx() 0
+#define cpu_is_omap24xx() 0
+#define cpu_is_omap242x() 0
+#define cpu_is_omap243x() 0
+#ifdef MULTI_OMAP1
+#else
+#endif
+#define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff)
+#define IS_OMAP_TYPE(type, id)  static inline int is_omap ##type (void)  {   return (GET_OMAP_TYPE == (id)) ? 1 : 0;  }
+#define cpu_is_omap310() 0
+#define cpu_is_omap730() 0
+#define cpu_is_omap1510() 0
+#define cpu_is_omap1610() 0
+#define cpu_is_omap5912() 0
+#define cpu_is_omap1611() 0
+#define cpu_is_omap1621() 0
+#define cpu_is_omap1710() 0
+#define cpu_is_omap2420() 0
+#define cpu_is_omap2422() 0
+#define cpu_is_omap2423() 0
+#define cpu_is_omap2430() 0
+#ifdef MULTI_OMAP1
+#else
+#endif
+#define cpu_class_is_omap1() (cpu_is_omap730() || cpu_is_omap15xx() ||   cpu_is_omap16xx())
+#define cpu_class_is_omap2() cpu_is_omap24xx()
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/dma.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/dma.h
new file mode 100644
index 0000000..5e5be76
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/dma.h
@@ -0,0 +1,318 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARCH_DMA_H
+#define __ASM_ARCH_DMA_H
+
+#define OMAP_DMA_BASE (0xfffed800)
+#define OMAP_DMA_GCR (OMAP_DMA_BASE + 0x400)
+#define OMAP_DMA_GSCR (OMAP_DMA_BASE + 0x404)
+#define OMAP_DMA_GRST (OMAP_DMA_BASE + 0x408)
+#define OMAP_DMA_HW_ID (OMAP_DMA_BASE + 0x442)
+#define OMAP_DMA_PCH2_ID (OMAP_DMA_BASE + 0x444)
+#define OMAP_DMA_PCH0_ID (OMAP_DMA_BASE + 0x446)
+#define OMAP_DMA_PCH1_ID (OMAP_DMA_BASE + 0x448)
+#define OMAP_DMA_PCHG_ID (OMAP_DMA_BASE + 0x44a)
+#define OMAP_DMA_PCHD_ID (OMAP_DMA_BASE + 0x44c)
+#define OMAP_DMA_CAPS_0_U (OMAP_DMA_BASE + 0x44e)
+#define OMAP_DMA_CAPS_0_L (OMAP_DMA_BASE + 0x450)
+#define OMAP_DMA_CAPS_1_U (OMAP_DMA_BASE + 0x452)
+#define OMAP_DMA_CAPS_1_L (OMAP_DMA_BASE + 0x454)
+#define OMAP_DMA_CAPS_2 (OMAP_DMA_BASE + 0x456)
+#define OMAP_DMA_CAPS_3 (OMAP_DMA_BASE + 0x458)
+#define OMAP_DMA_CAPS_4 (OMAP_DMA_BASE + 0x45a)
+#define OMAP_DMA_PCH2_SR (OMAP_DMA_BASE + 0x460)
+#define OMAP_DMA_PCH0_SR (OMAP_DMA_BASE + 0x480)
+#define OMAP_DMA_PCH1_SR (OMAP_DMA_BASE + 0x482)
+#define OMAP_DMA_PCHD_SR (OMAP_DMA_BASE + 0x4c0)
+
+#define OMAP24XX_DMA_BASE (L4_24XX_BASE + 0x56000)
+#define OMAP_DMA4_REVISION (OMAP24XX_DMA_BASE + 0x00)
+#define OMAP_DMA4_GCR_REG (OMAP24XX_DMA_BASE + 0x78)
+#define OMAP_DMA4_IRQSTATUS_L0 (OMAP24XX_DMA_BASE + 0x08)
+#define OMAP_DMA4_IRQSTATUS_L1 (OMAP24XX_DMA_BASE + 0x0c)
+#define OMAP_DMA4_IRQSTATUS_L2 (OMAP24XX_DMA_BASE + 0x10)
+#define OMAP_DMA4_IRQSTATUS_L3 (OMAP24XX_DMA_BASE + 0x14)
+#define OMAP_DMA4_IRQENABLE_L0 (OMAP24XX_DMA_BASE + 0x18)
+#define OMAP_DMA4_IRQENABLE_L1 (OMAP24XX_DMA_BASE + 0x1c)
+#define OMAP_DMA4_IRQENABLE_L2 (OMAP24XX_DMA_BASE + 0x20)
+#define OMAP_DMA4_IRQENABLE_L3 (OMAP24XX_DMA_BASE + 0x24)
+#define OMAP_DMA4_SYSSTATUS (OMAP24XX_DMA_BASE + 0x28)
+#define OMAP_DMA4_CAPS_0 (OMAP24XX_DMA_BASE + 0x64)
+#define OMAP_DMA4_CAPS_2 (OMAP24XX_DMA_BASE + 0x6c)
+#define OMAP_DMA4_CAPS_3 (OMAP24XX_DMA_BASE + 0x70)
+#define OMAP_DMA4_CAPS_4 (OMAP24XX_DMA_BASE + 0x74)
+
+#define OMAP_LOGICAL_DMA_CH_COUNT 32  
+
+#define OMAP_DMA_CCR_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x80)
+#define OMAP_DMA_CLNK_CTRL_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x84)
+#define OMAP_DMA_CICR_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x88)
+#define OMAP_DMA_CSR_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x8c)
+#define OMAP_DMA_CSDP_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x90)
+#define OMAP_DMA_CEN_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x94)
+#define OMAP_DMA_CFN_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x98)
+#define OMAP_DMA_CSEI_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xa4)
+#define OMAP_DMA_CSFI_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xa8)
+#define OMAP_DMA_CDEI_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xac)
+#define OMAP_DMA_CDFI_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xb0)
+#define OMAP_DMA_CSAC_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xb4)
+#define OMAP_DMA_CDAC_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xb8)
+
+#define OMAP1_DMA_CSSA_L_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x08)
+#define OMAP1_DMA_CSSA_U_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x0a)
+#define OMAP1_DMA_CDSA_L_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x0c)
+#define OMAP1_DMA_CDSA_U_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x0e)
+#define OMAP1_DMA_COLOR_L_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x20)
+#define OMAP1_DMA_CCR2_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x24)
+#define OMAP1_DMA_COLOR_U_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x22)
+#define OMAP1_DMA_LCH_CTRL_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x2a)
+
+#define OMAP2_DMA_CSSA_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x9c)
+#define OMAP2_DMA_CDSA_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xa0)
+#define OMAP2_DMA_CCEN_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xbc)
+#define OMAP2_DMA_CCFN_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xc0)
+#define OMAP2_DMA_COLOR_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xc4)
+
+#define OMAP_DMA_NO_DEVICE 0
+#define OMAP_DMA_MCSI1_TX 1
+#define OMAP_DMA_MCSI1_RX 2
+#define OMAP_DMA_I2C_RX 3
+#define OMAP_DMA_I2C_TX 4
+#define OMAP_DMA_EXT_NDMA_REQ 5
+#define OMAP_DMA_EXT_NDMA_REQ2 6
+#define OMAP_DMA_UWIRE_TX 7
+#define OMAP_DMA_MCBSP1_TX 8
+#define OMAP_DMA_MCBSP1_RX 9
+#define OMAP_DMA_MCBSP3_TX 10
+#define OMAP_DMA_MCBSP3_RX 11
+#define OMAP_DMA_UART1_TX 12
+#define OMAP_DMA_UART1_RX 13
+#define OMAP_DMA_UART2_TX 14
+#define OMAP_DMA_UART2_RX 15
+#define OMAP_DMA_MCBSP2_TX 16
+#define OMAP_DMA_MCBSP2_RX 17
+#define OMAP_DMA_UART3_TX 18
+#define OMAP_DMA_UART3_RX 19
+#define OMAP_DMA_CAMERA_IF_RX 20
+#define OMAP_DMA_MMC_TX 21
+#define OMAP_DMA_MMC_RX 22
+#define OMAP_DMA_NAND 23
+#define OMAP_DMA_IRQ_LCD_LINE 24
+#define OMAP_DMA_MEMORY_STICK 25
+#define OMAP_DMA_USB_W2FC_RX0 26
+#define OMAP_DMA_USB_W2FC_RX1 27
+#define OMAP_DMA_USB_W2FC_RX2 28
+#define OMAP_DMA_USB_W2FC_TX0 29
+#define OMAP_DMA_USB_W2FC_TX1 30
+#define OMAP_DMA_USB_W2FC_TX2 31
+
+#define OMAP_DMA_CRYPTO_DES_IN 32
+#define OMAP_DMA_SPI_TX 33
+#define OMAP_DMA_SPI_RX 34
+#define OMAP_DMA_CRYPTO_HASH 35
+#define OMAP_DMA_CCP_ATTN 36
+#define OMAP_DMA_CCP_FIFO_NOT_EMPTY 37
+#define OMAP_DMA_CMT_APE_TX_CHAN_0 38
+#define OMAP_DMA_CMT_APE_RV_CHAN_0 39
+#define OMAP_DMA_CMT_APE_TX_CHAN_1 40
+#define OMAP_DMA_CMT_APE_RV_CHAN_1 41
+#define OMAP_DMA_CMT_APE_TX_CHAN_2 42
+#define OMAP_DMA_CMT_APE_RV_CHAN_2 43
+#define OMAP_DMA_CMT_APE_TX_CHAN_3 44
+#define OMAP_DMA_CMT_APE_RV_CHAN_3 45
+#define OMAP_DMA_CMT_APE_TX_CHAN_4 46
+#define OMAP_DMA_CMT_APE_RV_CHAN_4 47
+#define OMAP_DMA_CMT_APE_TX_CHAN_5 48
+#define OMAP_DMA_CMT_APE_RV_CHAN_5 49
+#define OMAP_DMA_CMT_APE_TX_CHAN_6 50
+#define OMAP_DMA_CMT_APE_RV_CHAN_6 51
+#define OMAP_DMA_CMT_APE_TX_CHAN_7 52
+#define OMAP_DMA_CMT_APE_RV_CHAN_7 53
+#define OMAP_DMA_MMC2_TX 54
+#define OMAP_DMA_MMC2_RX 55
+#define OMAP_DMA_CRYPTO_DES_OUT 56
+
+#define OMAP24XX_DMA_NO_DEVICE 0
+#define OMAP24XX_DMA_XTI_DMA 1  
+#define OMAP24XX_DMA_EXT_DMAREQ0 2  
+#define OMAP24XX_DMA_EXT_DMAREQ1 3  
+#define OMAP24XX_DMA_GPMC 4  
+#define OMAP24XX_DMA_GFX 5  
+#define OMAP24XX_DMA_DSS 6  
+#define OMAP24XX_DMA_VLYNQ_TX 7  
+#define OMAP24XX_DMA_CWT 8  
+#define OMAP24XX_DMA_AES_TX 9  
+#define OMAP24XX_DMA_AES_RX 10  
+#define OMAP24XX_DMA_DES_TX 11  
+#define OMAP24XX_DMA_DES_RX 12  
+#define OMAP24XX_DMA_SHA1MD5_RX 13  
+#define OMAP24XX_DMA_EXT_DMAREQ2 14  
+#define OMAP24XX_DMA_EXT_DMAREQ3 15  
+#define OMAP24XX_DMA_EXT_DMAREQ4 16  
+#define OMAP24XX_DMA_EAC_AC_RD 17  
+#define OMAP24XX_DMA_EAC_AC_WR 18  
+#define OMAP24XX_DMA_EAC_MD_UL_RD 19  
+#define OMAP24XX_DMA_EAC_MD_UL_WR 20  
+#define OMAP24XX_DMA_EAC_MD_DL_RD 21  
+#define OMAP24XX_DMA_EAC_MD_DL_WR 22  
+#define OMAP24XX_DMA_EAC_BT_UL_RD 23  
+#define OMAP24XX_DMA_EAC_BT_UL_WR 24  
+#define OMAP24XX_DMA_EAC_BT_DL_RD 25  
+#define OMAP24XX_DMA_EAC_BT_DL_WR 26  
+#define OMAP24XX_DMA_I2C1_TX 27  
+#define OMAP24XX_DMA_I2C1_RX 28  
+#define OMAP24XX_DMA_I2C2_TX 29  
+#define OMAP24XX_DMA_I2C2_RX 30  
+#define OMAP24XX_DMA_MCBSP1_TX 31  
+#define OMAP24XX_DMA_MCBSP1_RX 32  
+#define OMAP24XX_DMA_MCBSP2_TX 33  
+#define OMAP24XX_DMA_MCBSP2_RX 34  
+#define OMAP24XX_DMA_SPI1_TX0 35  
+#define OMAP24XX_DMA_SPI1_RX0 36  
+#define OMAP24XX_DMA_SPI1_TX1 37  
+#define OMAP24XX_DMA_SPI1_RX1 38  
+#define OMAP24XX_DMA_SPI1_TX2 39  
+#define OMAP24XX_DMA_SPI1_RX2 40  
+#define OMAP24XX_DMA_SPI1_TX3 41  
+#define OMAP24XX_DMA_SPI1_RX3 42  
+#define OMAP24XX_DMA_SPI2_TX0 43  
+#define OMAP24XX_DMA_SPI2_RX0 44  
+#define OMAP24XX_DMA_SPI2_TX1 45  
+#define OMAP24XX_DMA_SPI2_RX1 46  
+
+#define OMAP24XX_DMA_UART1_TX 49  
+#define OMAP24XX_DMA_UART1_RX 50  
+#define OMAP24XX_DMA_UART2_TX 51  
+#define OMAP24XX_DMA_UART2_RX 52  
+#define OMAP24XX_DMA_UART3_TX 53  
+#define OMAP24XX_DMA_UART3_RX 54  
+#define OMAP24XX_DMA_USB_W2FC_TX0 55  
+#define OMAP24XX_DMA_USB_W2FC_RX0 56  
+#define OMAP24XX_DMA_USB_W2FC_TX1 57  
+#define OMAP24XX_DMA_USB_W2FC_RX1 58  
+#define OMAP24XX_DMA_USB_W2FC_TX2 59  
+#define OMAP24XX_DMA_USB_W2FC_RX2 60  
+#define OMAP24XX_DMA_MMC1_TX 61  
+#define OMAP24XX_DMA_MMC1_RX 62  
+#define OMAP24XX_DMA_MS 63  
+#define OMAP24XX_DMA_EXT_DMAREQ5 64  
+
+#define OMAP1510_DMA_LCD_BASE (0xfffedb00)
+#define OMAP1510_DMA_LCD_CTRL (OMAP1510_DMA_LCD_BASE + 0x00)
+#define OMAP1510_DMA_LCD_TOP_F1_L (OMAP1510_DMA_LCD_BASE + 0x02)
+#define OMAP1510_DMA_LCD_TOP_F1_U (OMAP1510_DMA_LCD_BASE + 0x04)
+#define OMAP1510_DMA_LCD_BOT_F1_L (OMAP1510_DMA_LCD_BASE + 0x06)
+#define OMAP1510_DMA_LCD_BOT_F1_U (OMAP1510_DMA_LCD_BASE + 0x08)
+
+#define OMAP1610_DMA_LCD_BASE (0xfffee300)
+#define OMAP1610_DMA_LCD_CSDP (OMAP1610_DMA_LCD_BASE + 0xc0)
+#define OMAP1610_DMA_LCD_CCR (OMAP1610_DMA_LCD_BASE + 0xc2)
+#define OMAP1610_DMA_LCD_CTRL (OMAP1610_DMA_LCD_BASE + 0xc4)
+#define OMAP1610_DMA_LCD_TOP_B1_L (OMAP1610_DMA_LCD_BASE + 0xc8)
+#define OMAP1610_DMA_LCD_TOP_B1_U (OMAP1610_DMA_LCD_BASE + 0xca)
+#define OMAP1610_DMA_LCD_BOT_B1_L (OMAP1610_DMA_LCD_BASE + 0xcc)
+#define OMAP1610_DMA_LCD_BOT_B1_U (OMAP1610_DMA_LCD_BASE + 0xce)
+#define OMAP1610_DMA_LCD_TOP_B2_L (OMAP1610_DMA_LCD_BASE + 0xd0)
+#define OMAP1610_DMA_LCD_TOP_B2_U (OMAP1610_DMA_LCD_BASE + 0xd2)
+#define OMAP1610_DMA_LCD_BOT_B2_L (OMAP1610_DMA_LCD_BASE + 0xd4)
+#define OMAP1610_DMA_LCD_BOT_B2_U (OMAP1610_DMA_LCD_BASE + 0xd6)
+#define OMAP1610_DMA_LCD_SRC_EI_B1 (OMAP1610_DMA_LCD_BASE + 0xd8)
+#define OMAP1610_DMA_LCD_SRC_FI_B1_L (OMAP1610_DMA_LCD_BASE + 0xda)
+#define OMAP1610_DMA_LCD_SRC_EN_B1 (OMAP1610_DMA_LCD_BASE + 0xe0)
+#define OMAP1610_DMA_LCD_SRC_FN_B1 (OMAP1610_DMA_LCD_BASE + 0xe4)
+#define OMAP1610_DMA_LCD_LCH_CTRL (OMAP1610_DMA_LCD_BASE + 0xea)
+#define OMAP1610_DMA_LCD_SRC_FI_B1_U (OMAP1610_DMA_LCD_BASE + 0xf4)
+
+#define OMAP1_DMA_TOUT_IRQ (1 << 0)
+#define OMAP_DMA_DROP_IRQ (1 << 1)
+#define OMAP_DMA_HALF_IRQ (1 << 2)
+#define OMAP_DMA_FRAME_IRQ (1 << 3)
+#define OMAP_DMA_LAST_IRQ (1 << 4)
+#define OMAP_DMA_BLOCK_IRQ (1 << 5)
+#define OMAP1_DMA_SYNC_IRQ (1 << 6)
+#define OMAP2_DMA_PKT_IRQ (1 << 7)
+#define OMAP2_DMA_TRANS_ERR_IRQ (1 << 8)
+#define OMAP2_DMA_SECURE_ERR_IRQ (1 << 9)
+#define OMAP2_DMA_SUPERVISOR_ERR_IRQ (1 << 10)
+#define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11)
+
+#define OMAP_DMA_DATA_TYPE_S8 0x00
+#define OMAP_DMA_DATA_TYPE_S16 0x01
+#define OMAP_DMA_DATA_TYPE_S32 0x02
+
+#define OMAP_DMA_SYNC_ELEMENT 0x00
+#define OMAP_DMA_SYNC_FRAME 0x01
+#define OMAP_DMA_SYNC_BLOCK 0x02
+
+#define OMAP_DMA_PORT_EMIFF 0x00
+#define OMAP_DMA_PORT_EMIFS 0x01
+#define OMAP_DMA_PORT_OCP_T1 0x02
+#define OMAP_DMA_PORT_TIPB 0x03
+#define OMAP_DMA_PORT_OCP_T2 0x04
+#define OMAP_DMA_PORT_MPUI 0x05
+
+#define OMAP_DMA_AMODE_CONSTANT 0x00
+#define OMAP_DMA_AMODE_POST_INC 0x01
+#define OMAP_DMA_AMODE_SINGLE_IDX 0x02
+#define OMAP_DMA_AMODE_DOUBLE_IDX 0x03
+
+enum {
+ OMAP_LCD_DMA_B1_TOP,
+ OMAP_LCD_DMA_B1_BOTTOM,
+ OMAP_LCD_DMA_B2_TOP,
+ OMAP_LCD_DMA_B2_BOTTOM
+};
+
+enum omap_dma_burst_mode {
+ OMAP_DMA_DATA_BURST_DIS = 0,
+ OMAP_DMA_DATA_BURST_4,
+ OMAP_DMA_DATA_BURST_8,
+ OMAP_DMA_DATA_BURST_16,
+};
+
+enum omap_dma_color_mode {
+ OMAP_DMA_COLOR_DIS = 0,
+ OMAP_DMA_CONSTANT_FILL,
+ OMAP_DMA_TRANSPARENT_COPY
+};
+
+enum omap_dma_write_mode {
+ OMAP_DMA_WRITE_NON_POSTED = 0,
+ OMAP_DMA_WRITE_POSTED,
+ OMAP_DMA_WRITE_LAST_NON_POSTED
+};
+
+struct omap_dma_channel_params {
+ int data_type;
+ int elem_count;
+ int frame_count;
+
+ int src_port;
+ int src_amode;
+ unsigned long src_start;
+ int src_ei;
+ int src_fi;
+
+ int dst_port;
+ int dst_amode;
+ unsigned long dst_start;
+ int dst_ei;
+ int dst_fi;
+
+ int trigger;
+ int sync_mode;
+ int src_or_dst_synch;
+
+ int ie;
+};
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/fpga.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/fpga.h
new file mode 100644
index 0000000..a1b210d
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/fpga.h
@@ -0,0 +1,160 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARCH_OMAP_FPGA_H
+#define __ASM_ARCH_OMAP_FPGA_H
+
+#define omap1510_fpga_init_irq() (0)
+
+#define fpga_read(reg) __raw_readb(reg)
+#define fpga_write(val, reg) __raw_writeb(val, reg)
+
+#define H2P2_DBG_FPGA_BASE 0xE8000000  
+#define H2P2_DBG_FPGA_SIZE SZ_4K  
+#define H2P2_DBG_FPGA_START 0x04000000  
+
+#define H2P2_DBG_FPGA_ETHR_START (H2P2_DBG_FPGA_START + 0x300)
+#define H2P2_DBG_FPGA_FPGA_REV (H2P2_DBG_FPGA_BASE + 0x10)  
+#define H2P2_DBG_FPGA_BOARD_REV (H2P2_DBG_FPGA_BASE + 0x12)  
+#define H2P2_DBG_FPGA_GPIO (H2P2_DBG_FPGA_BASE + 0x14)  
+#define H2P2_DBG_FPGA_LEDS (H2P2_DBG_FPGA_BASE + 0x16)  
+#define H2P2_DBG_FPGA_MISC_INPUTS (H2P2_DBG_FPGA_BASE + 0x18)  
+#define H2P2_DBG_FPGA_LAN_STATUS (H2P2_DBG_FPGA_BASE + 0x1A)  
+#define H2P2_DBG_FPGA_LAN_RESET (H2P2_DBG_FPGA_BASE + 0x1C)  
+
+struct h2p2_dbg_fpga {
+
+ u16 smc91x[8];
+
+ u16 fpga_rev;
+ u16 board_rev;
+ u16 gpio_outputs;
+ u16 leds;
+
+ u16 misc_inputs;
+ u16 lan_status;
+ u16 lan_reset;
+ u16 reserved0;
+
+ u16 ps2_data;
+ u16 ps2_ctrl;
+
+};
+
+#define H2P2_DBG_FPGA_LED_GREEN (1 << 15)
+#define H2P2_DBG_FPGA_LED_AMBER (1 << 14)
+#define H2P2_DBG_FPGA_LED_RED (1 << 13)
+#define H2P2_DBG_FPGA_LED_BLUE (1 << 12)
+
+#define H2P2_DBG_FPGA_LOAD_METER (1 << 0) 
+#define H2P2_DBG_FPGA_LOAD_METER_SIZE 11
+#define H2P2_DBG_FPGA_LOAD_METER_MASK ((1 << H2P2_DBG_FPGA_LOAD_METER_SIZE) - 1)
+
+#define H2P2_DBG_FPGA_P2_LED_TIMER (1 << 0)
+#define H2P2_DBG_FPGA_P2_LED_IDLE (1 << 1)
+
+#define OMAP1510_FPGA_BASE 0xE8000000  
+#define OMAP1510_FPGA_SIZE SZ_4K
+#define OMAP1510_FPGA_START 0x08000000  
+
+#define OMAP1510_FPGA_REV_LOW (OMAP1510_FPGA_BASE + 0x0)
+#define OMAP1510_FPGA_REV_HIGH (OMAP1510_FPGA_BASE + 0x1)
+
+#define OMAP1510_FPGA_LCD_PANEL_CONTROL (OMAP1510_FPGA_BASE + 0x2)
+#define OMAP1510_FPGA_LED_DIGIT (OMAP1510_FPGA_BASE + 0x3)
+#define INNOVATOR_FPGA_HID_SPI (OMAP1510_FPGA_BASE + 0x4)
+#define OMAP1510_FPGA_POWER (OMAP1510_FPGA_BASE + 0x5)
+
+#define OMAP1510_FPGA_ISR_LO (OMAP1510_FPGA_BASE + 0x6)
+#define OMAP1510_FPGA_ISR_HI (OMAP1510_FPGA_BASE + 0x7)
+
+#define OMAP1510_FPGA_IMR_LO (OMAP1510_FPGA_BASE + 0x8)
+#define OMAP1510_FPGA_IMR_HI (OMAP1510_FPGA_BASE + 0x9)
+
+#define OMAP1510_FPGA_HOST_RESET (OMAP1510_FPGA_BASE + 0xa)
+#define OMAP1510_FPGA_RST (OMAP1510_FPGA_BASE + 0xb)
+
+#define OMAP1510_FPGA_AUDIO (OMAP1510_FPGA_BASE + 0xc)
+#define OMAP1510_FPGA_DIP (OMAP1510_FPGA_BASE + 0xe)
+#define OMAP1510_FPGA_FPGA_IO (OMAP1510_FPGA_BASE + 0xf)
+#define OMAP1510_FPGA_UART1 (OMAP1510_FPGA_BASE + 0x14)
+#define OMAP1510_FPGA_UART2 (OMAP1510_FPGA_BASE + 0x15)
+#define OMAP1510_FPGA_OMAP1510_STATUS (OMAP1510_FPGA_BASE + 0x16)
+#define OMAP1510_FPGA_BOARD_REV (OMAP1510_FPGA_BASE + 0x18)
+#define OMAP1510P1_PPT_DATA (OMAP1510_FPGA_BASE + 0x100)
+#define OMAP1510P1_PPT_STATUS (OMAP1510_FPGA_BASE + 0x101)
+#define OMAP1510P1_PPT_CONTROL (OMAP1510_FPGA_BASE + 0x102)
+
+#define OMAP1510_FPGA_TOUCHSCREEN (OMAP1510_FPGA_BASE + 0x204)
+
+#define INNOVATOR_FPGA_INFO (OMAP1510_FPGA_BASE + 0x205)
+#define INNOVATOR_FPGA_LCD_BRIGHT_LO (OMAP1510_FPGA_BASE + 0x206)
+#define INNOVATOR_FPGA_LCD_BRIGHT_HI (OMAP1510_FPGA_BASE + 0x207)
+#define INNOVATOR_FPGA_LED_GRN_LO (OMAP1510_FPGA_BASE + 0x208)
+#define INNOVATOR_FPGA_LED_GRN_HI (OMAP1510_FPGA_BASE + 0x209)
+#define INNOVATOR_FPGA_LED_RED_LO (OMAP1510_FPGA_BASE + 0x20a)
+#define INNOVATOR_FPGA_LED_RED_HI (OMAP1510_FPGA_BASE + 0x20b)
+#define INNOVATOR_FPGA_CAM_USB_CONTROL (OMAP1510_FPGA_BASE + 0x20c)
+#define INNOVATOR_FPGA_EXP_CONTROL (OMAP1510_FPGA_BASE + 0x20d)
+#define INNOVATOR_FPGA_ISR2 (OMAP1510_FPGA_BASE + 0x20e)
+#define INNOVATOR_FPGA_IMR2 (OMAP1510_FPGA_BASE + 0x210)
+
+#define OMAP1510_FPGA_ETHR_START (OMAP1510_FPGA_START + 0x300)
+
+#define OMAP1510_FPGA_RESET_VALUE 0x42
+
+#define OMAP1510_FPGA_PCR_IF_PD0 (1 << 7)
+#define OMAP1510_FPGA_PCR_COM2_EN (1 << 6)
+#define OMAP1510_FPGA_PCR_COM1_EN (1 << 5)
+#define OMAP1510_FPGA_PCR_EXP_PD0 (1 << 4)
+#define OMAP1510_FPGA_PCR_EXP_PD1 (1 << 3)
+#define OMAP1510_FPGA_PCR_48MHZ_CLK (1 << 2)
+#define OMAP1510_FPGA_PCR_4MHZ_CLK (1 << 1)
+#define OMAP1510_FPGA_PCR_RSRVD_BIT0 (1 << 0)
+
+#define OMAP1510_FPGA_HID_SCLK (1<<0)  
+#define OMAP1510_FPGA_HID_MOSI (1<<1)  
+#define OMAP1510_FPGA_HID_nSS (1<<2)  
+#define OMAP1510_FPGA_HID_nHSUS (1<<3)  
+#define OMAP1510_FPGA_HID_MISO (1<<4)  
+#define OMAP1510_FPGA_HID_ATN (1<<5)  
+#define OMAP1510_FPGA_HID_rsrvd (1<<6)
+#define OMAP1510_FPGA_HID_RESETn (1<<7)  
+
+#define OMAP1510_INT_FPGA (IH_GPIO_BASE + 13)
+
+#define OMAP1510_IH_FPGA_BASE IH_BOARD_BASE
+#define OMAP1510_INT_FPGA_ATN (OMAP1510_IH_FPGA_BASE + 0)
+#define OMAP1510_INT_FPGA_ACK (OMAP1510_IH_FPGA_BASE + 1)
+#define OMAP1510_INT_FPGA2 (OMAP1510_IH_FPGA_BASE + 2)
+#define OMAP1510_INT_FPGA3 (OMAP1510_IH_FPGA_BASE + 3)
+#define OMAP1510_INT_FPGA4 (OMAP1510_IH_FPGA_BASE + 4)
+#define OMAP1510_INT_FPGA5 (OMAP1510_IH_FPGA_BASE + 5)
+#define OMAP1510_INT_FPGA6 (OMAP1510_IH_FPGA_BASE + 6)
+#define OMAP1510_INT_FPGA7 (OMAP1510_IH_FPGA_BASE + 7)
+#define OMAP1510_INT_FPGA8 (OMAP1510_IH_FPGA_BASE + 8)
+#define OMAP1510_INT_FPGA9 (OMAP1510_IH_FPGA_BASE + 9)
+#define OMAP1510_INT_FPGA10 (OMAP1510_IH_FPGA_BASE + 10)
+#define OMAP1510_INT_FPGA11 (OMAP1510_IH_FPGA_BASE + 11)
+#define OMAP1510_INT_FPGA12 (OMAP1510_IH_FPGA_BASE + 12)
+#define OMAP1510_INT_ETHER (OMAP1510_IH_FPGA_BASE + 13)
+#define OMAP1510_INT_FPGAUART1 (OMAP1510_IH_FPGA_BASE + 14)
+#define OMAP1510_INT_FPGAUART2 (OMAP1510_IH_FPGA_BASE + 15)
+#define OMAP1510_INT_FPGA_TS (OMAP1510_IH_FPGA_BASE + 16)
+#define OMAP1510_INT_FPGA17 (OMAP1510_IH_FPGA_BASE + 17)
+#define OMAP1510_INT_FPGA_CAM (OMAP1510_IH_FPGA_BASE + 18)
+#define OMAP1510_INT_FPGA_RTC_A (OMAP1510_IH_FPGA_BASE + 19)
+#define OMAP1510_INT_FPGA_RTC_B (OMAP1510_IH_FPGA_BASE + 20)
+#define OMAP1510_INT_FPGA_CD (OMAP1510_IH_FPGA_BASE + 21)
+#define OMAP1510_INT_FPGA22 (OMAP1510_IH_FPGA_BASE + 22)
+#define OMAP1510_INT_FPGA23 (OMAP1510_IH_FPGA_BASE + 23)
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/gpio-switch.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/gpio-switch.h
new file mode 100644
index 0000000..20ea3f2
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/gpio-switch.h
@@ -0,0 +1,37 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARCH_OMAP_GPIO_SWITCH_H
+#define __ASM_ARCH_OMAP_GPIO_SWITCH_H
+
+#include <linux/types.h>
+
+#define OMAP_GPIO_SWITCH_TYPE_COVER 0x0000
+#define OMAP_GPIO_SWITCH_TYPE_CONNECTION 0x0001
+#define OMAP_GPIO_SWITCH_TYPE_ACTIVITY 0x0002
+#define OMAP_GPIO_SWITCH_FLAG_INVERTED 0x0001
+#define OMAP_GPIO_SWITCH_FLAG_OUTPUT 0x0002
+
+struct omap_gpio_switch {
+ const char *name;
+ s16 gpio;
+ unsigned flags:4;
+ unsigned type:4;
+
+ u16 debounce_rising;
+
+ u16 debounce_falling;
+
+ void (* notify)(void *data, int state);
+ void *notify_data;
+};
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/gpio.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/gpio.h
new file mode 100644
index 0000000..332246d
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/gpio.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARCH_OMAP_GPIO_H
+#define __ASM_ARCH_OMAP_GPIO_H
+
+#include <asm/hardware.h>
+#include <asm/arch/irqs.h>
+#include <asm/io.h>
+
+#define OMAP_MPUIO_BASE (void __iomem *)0xfffb5000
+
+#define OMAP_MPUIO_INPUT_LATCH 0x00
+#define OMAP_MPUIO_OUTPUT 0x04
+#define OMAP_MPUIO_IO_CNTL 0x08
+#define OMAP_MPUIO_KBR_LATCH 0x10
+#define OMAP_MPUIO_KBC 0x14
+#define OMAP_MPUIO_GPIO_EVENT_MODE 0x18
+#define OMAP_MPUIO_GPIO_INT_EDGE 0x1c
+#define OMAP_MPUIO_KBD_INT 0x20
+#define OMAP_MPUIO_GPIO_INT 0x24
+#define OMAP_MPUIO_KBD_MASKIT 0x28
+#define OMAP_MPUIO_GPIO_MASKIT 0x2c
+#define OMAP_MPUIO_GPIO_DEBOUNCING 0x30
+#define OMAP_MPUIO_LATCH 0x34
+
+#define OMAP_MPUIO(nr) (OMAP_MAX_GPIO_LINES + (nr))
+#define OMAP_GPIO_IS_MPUIO(nr) ((nr) >= OMAP_MAX_GPIO_LINES)
+
+#define OMAP_GPIO_IRQ(nr) (OMAP_GPIO_IS_MPUIO(nr) ?   IH_MPUIO_BASE + ((nr) & 0x0f) :   IH_GPIO_BASE + (nr))
+
+struct omap_machine_gpio_bank {
+ int start;
+ int end;
+
+ void (*set_gpio_direction)(int gpio, int is_input);
+ void (*set_gpio_dataout)(int gpio, int enable);
+ int (*get_gpio_datain)(int gpio);
+};
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/hardware.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/hardware.h
new file mode 100644
index 0000000..e515ee8
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/hardware.h
@@ -0,0 +1,157 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARCH_OMAP_HARDWARE_H
+#define __ASM_ARCH_OMAP_HARDWARE_H
+
+#include <asm/sizes.h>
+#ifndef __ASSEMBLER__
+#include <asm/types.h>
+#include <asm/arch/cpu.h>
+#endif
+#include <asm/arch/io.h>
+#include <asm/arch/serial.h>
+
+#define OMAP_MPU_TIMER1_BASE (0xfffec500)
+#define OMAP_MPU_TIMER2_BASE (0xfffec600)
+#define OMAP_MPU_TIMER3_BASE (0xfffec700)
+#define MPU_TIMER_FREE (1 << 6)
+#define MPU_TIMER_CLOCK_ENABLE (1 << 5)
+#define MPU_TIMER_AR (1 << 1)
+#define MPU_TIMER_ST (1 << 0)
+
+#define CLKGEN_REG_BASE (0xfffece00)
+#define ARM_CKCTL (CLKGEN_REG_BASE + 0x0)
+#define ARM_IDLECT1 (CLKGEN_REG_BASE + 0x4)
+#define ARM_IDLECT2 (CLKGEN_REG_BASE + 0x8)
+#define ARM_EWUPCT (CLKGEN_REG_BASE + 0xC)
+#define ARM_RSTCT1 (CLKGEN_REG_BASE + 0x10)
+#define ARM_RSTCT2 (CLKGEN_REG_BASE + 0x14)
+#define ARM_SYSST (CLKGEN_REG_BASE + 0x18)
+#define ARM_IDLECT3 (CLKGEN_REG_BASE + 0x24)
+
+#define CK_RATEF 1
+#define CK_IDLEF 2
+#define CK_ENABLEF 4
+#define CK_SELECTF 8
+#define SETARM_IDLE_SHIFT
+
+#define DPLL_CTL (0xfffecf00)
+
+#define DSP_CONFIG_REG_BASE (0xe1008000)
+#define DSP_CKCTL (DSP_CONFIG_REG_BASE + 0x0)
+#define DSP_IDLECT1 (DSP_CONFIG_REG_BASE + 0x4)
+#define DSP_IDLECT2 (DSP_CONFIG_REG_BASE + 0x8)
+#define DSP_RSTCT2 (DSP_CONFIG_REG_BASE + 0x14)
+
+#define ULPD_REG_BASE (0xfffe0800)
+#define ULPD_IT_STATUS (ULPD_REG_BASE + 0x14)
+#define ULPD_SETUP_ANALOG_CELL_3 (ULPD_REG_BASE + 0x24)
+#define ULPD_CLOCK_CTRL (ULPD_REG_BASE + 0x30)
+#define DIS_USB_PVCI_CLK (1 << 5)  
+#define USB_MCLK_EN (1 << 4)  
+#define ULPD_SOFT_REQ (ULPD_REG_BASE + 0x34)
+#define SOFT_UDC_REQ (1 << 4)
+#define SOFT_USB_CLK_REQ (1 << 3)
+#define SOFT_DPLL_REQ (1 << 0)
+#define ULPD_DPLL_CTRL (ULPD_REG_BASE + 0x3c)
+#define ULPD_STATUS_REQ (ULPD_REG_BASE + 0x40)
+#define ULPD_APLL_CTRL (ULPD_REG_BASE + 0x4c)
+#define ULPD_POWER_CTRL (ULPD_REG_BASE + 0x50)
+#define ULPD_SOFT_DISABLE_REQ_REG (ULPD_REG_BASE + 0x68)
+#define DIS_MMC2_DPLL_REQ (1 << 11)
+#define DIS_MMC1_DPLL_REQ (1 << 10)
+#define DIS_UART3_DPLL_REQ (1 << 9)
+#define DIS_UART2_DPLL_REQ (1 << 8)
+#define DIS_UART1_DPLL_REQ (1 << 7)
+#define DIS_USB_HOST_DPLL_REQ (1 << 6)
+#define ULPD_SDW_CLK_DIV_CTRL_SEL (ULPD_REG_BASE + 0x74)
+#define ULPD_CAM_CLK_CTRL (ULPD_REG_BASE + 0x7c)
+
+#define OMAP_MPU_WATCHDOG_BASE (0xfffec800)
+#define OMAP_WDT_TIMER (OMAP_MPU_WATCHDOG_BASE + 0x0)
+#define OMAP_WDT_LOAD_TIM (OMAP_MPU_WATCHDOG_BASE + 0x4)
+#define OMAP_WDT_READ_TIM (OMAP_MPU_WATCHDOG_BASE + 0x4)
+#define OMAP_WDT_TIMER_MODE (OMAP_MPU_WATCHDOG_BASE + 0x8)
+
+#define MOD_CONF_CTRL_0 0xfffe1080
+#define MOD_CONF_CTRL_1 0xfffe1110
+
+#define FUNC_MUX_CTRL_0 0xfffe1000
+#define FUNC_MUX_CTRL_1 0xfffe1004
+#define FUNC_MUX_CTRL_2 0xfffe1008
+#define COMP_MODE_CTRL_0 0xfffe100c
+#define FUNC_MUX_CTRL_3 0xfffe1010
+#define FUNC_MUX_CTRL_4 0xfffe1014
+#define FUNC_MUX_CTRL_5 0xfffe1018
+#define FUNC_MUX_CTRL_6 0xfffe101C
+#define FUNC_MUX_CTRL_7 0xfffe1020
+#define FUNC_MUX_CTRL_8 0xfffe1024
+#define FUNC_MUX_CTRL_9 0xfffe1028
+#define FUNC_MUX_CTRL_A 0xfffe102C
+#define FUNC_MUX_CTRL_B 0xfffe1030
+#define FUNC_MUX_CTRL_C 0xfffe1034
+#define FUNC_MUX_CTRL_D 0xfffe1038
+#define PULL_DWN_CTRL_0 0xfffe1040
+#define PULL_DWN_CTRL_1 0xfffe1044
+#define PULL_DWN_CTRL_2 0xfffe1048
+#define PULL_DWN_CTRL_3 0xfffe104c
+#define PULL_DWN_CTRL_4 0xfffe10ac
+
+#define FUNC_MUX_CTRL_E 0xfffe1090
+#define FUNC_MUX_CTRL_F 0xfffe1094
+#define FUNC_MUX_CTRL_10 0xfffe1098
+#define FUNC_MUX_CTRL_11 0xfffe109c
+#define FUNC_MUX_CTRL_12 0xfffe10a0
+#define PU_PD_SEL_0 0xfffe10b4
+#define PU_PD_SEL_1 0xfffe10b8
+#define PU_PD_SEL_2 0xfffe10bc
+#define PU_PD_SEL_3 0xfffe10c0
+#define PU_PD_SEL_4 0xfffe10c4
+
+#define OMAP_TIMER32K_BASE 0xFFFBC400
+
+#define TIPB_PUBLIC_CNTL_BASE 0xfffed300
+#define MPU_PUBLIC_TIPB_CNTL (TIPB_PUBLIC_CNTL_BASE + 0x8)
+#define TIPB_PRIVATE_CNTL_BASE 0xfffeca00
+#define MPU_PRIVATE_TIPB_CNTL (TIPB_PRIVATE_CNTL_BASE + 0x8)
+
+#define MPUI_BASE (0xfffec900)
+#define MPUI_CTRL (MPUI_BASE + 0x0)
+#define MPUI_DEBUG_ADDR (MPUI_BASE + 0x4)
+#define MPUI_DEBUG_DATA (MPUI_BASE + 0x8)
+#define MPUI_DEBUG_FLAG (MPUI_BASE + 0xc)
+#define MPUI_STATUS_REG (MPUI_BASE + 0x10)
+#define MPUI_DSP_STATUS (MPUI_BASE + 0x14)
+#define MPUI_DSP_BOOT_CONFIG (MPUI_BASE + 0x18)
+#define MPUI_DSP_API_CONFIG (MPUI_BASE + 0x1c)
+
+#define OMAP_LPG1_BASE 0xfffbd000
+#define OMAP_LPG2_BASE 0xfffbd800
+#define OMAP_LPG1_LCR (OMAP_LPG1_BASE + 0x00)
+#define OMAP_LPG1_PMR (OMAP_LPG1_BASE + 0x04)
+#define OMAP_LPG2_LCR (OMAP_LPG2_BASE + 0x00)
+#define OMAP_LPG2_PMR (OMAP_LPG2_BASE + 0x04)
+
+#define OMAP_PWL_BASE 0xfffb5800
+#define OMAP_PWL_ENABLE (OMAP_PWL_BASE + 0x00)
+#define OMAP_PWL_CLK_ENABLE (OMAP_PWL_BASE + 0x04)
+
+#include "omap730.h"
+#include "omap1510.h"
+#include "omap24xx.h"
+#include "omap16xx.h"
+
+#ifndef __ASSEMBLER__
+
+#endif
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/io.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/io.h
new file mode 100644
index 0000000..12ac3d4
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/io.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_ARCH_IO_H
+#define __ASM_ARM_ARCH_IO_H
+
+#include <asm/hardware.h>
+
+#define IO_SPACE_LIMIT 0xffffffff
+
+#define __io(a) ((void __iomem *)(PCIO_BASE + (a)))
+#define __mem_pci(a) (a)
+
+#define PCIO_BASE 0
+
+#ifndef __ASSEMBLER__
+
+#define omap_readb(a) (*(volatile unsigned char *)IO_ADDRESS(a))
+#define omap_readw(a) (*(volatile unsigned short *)IO_ADDRESS(a))
+#define omap_readl(a) (*(volatile unsigned int *)IO_ADDRESS(a))
+
+#define omap_writeb(v,a) (*(volatile unsigned char *)IO_ADDRESS(a) = (v))
+#define omap_writew(v,a) (*(volatile unsigned short *)IO_ADDRESS(a) = (v))
+#define omap_writel(v,a) (*(volatile unsigned int *)IO_ADDRESS(a) = (v))
+
+typedef struct { volatile u16 offset[256]; } __regbase16;
+#define __REGV16(vaddr) ((__regbase16 *)((vaddr)&~0xff))   ->offset[((vaddr)&0xff)>>1]
+#define __REG16(paddr) __REGV16(io_p2v(paddr))
+
+typedef struct { volatile u8 offset[4096]; } __regbase8;
+#define __REGV8(vaddr) ((__regbase8 *)((vaddr)&~4095))   ->offset[((vaddr)&4095)>>0]
+#define __REG8(paddr) __REGV8(io_p2v(paddr))
+
+typedef struct { volatile u32 offset[4096]; } __regbase32;
+#define __REGV32(vaddr) ((__regbase32 *)((vaddr)&~4095))   ->offset[((vaddr)&4095)>>2]
+#define __REG32(paddr) __REGV32(io_p2v(paddr))
+
+#else
+
+#define __REG8(paddr) io_p2v(paddr)
+#define __REG16(paddr) io_p2v(paddr)
+#define __REG32(paddr) io_p2v(paddr)
+
+#endif
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/irqs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/irqs.h
new file mode 100644
index 0000000..3e94487
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/irqs.h
@@ -0,0 +1,242 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARCH_OMAP15XX_IRQS_H
+#define __ASM_ARCH_OMAP15XX_IRQS_H
+
+#define INT_CAMERA 1
+#define INT_FIQ 3
+#define INT_RTDX 6
+#define INT_DSP_MMU_ABORT 7
+#define INT_HOST 8
+#define INT_ABORT 9
+#define INT_DSP_MAILBOX1 10
+#define INT_DSP_MAILBOX2 11
+#define INT_BRIDGE_PRIV 13
+#define INT_GPIO_BANK1 14
+#define INT_UART3 15
+#define INT_TIMER3 16
+#define INT_DMA_CH0_6 19
+#define INT_DMA_CH1_7 20
+#define INT_DMA_CH2_8 21
+#define INT_DMA_CH3 22
+#define INT_DMA_CH4 23
+#define INT_DMA_CH5 24
+#define INT_DMA_LCD 25
+#define INT_TIMER1 26
+#define INT_WD_TIMER 27
+#define INT_BRIDGE_PUB 28
+#define INT_TIMER2 30
+#define INT_LCD_CTRL 31
+
+#define INT_1510_IH2_IRQ 0
+#define INT_1510_RES2 2
+#define INT_1510_SPI_TX 4
+#define INT_1510_SPI_RX 5
+#define INT_1510_RES12 12
+#define INT_1510_LB_MMU 17
+#define INT_1510_RES18 18
+#define INT_1510_LOCAL_BUS 29
+
+#define INT_1610_IH2_IRQ 0
+#define INT_1610_IH2_FIQ 2
+#define INT_1610_McBSP2_TX 4
+#define INT_1610_McBSP2_RX 5
+#define INT_1610_LCD_LINE 12
+#define INT_1610_GPTIMER1 17
+#define INT_1610_GPTIMER2 18
+#define INT_1610_SSR_FIFO_0 29
+
+#define INT_730_IH2_FIQ 0
+#define INT_730_IH2_IRQ 1
+#define INT_730_USB_NON_ISO 2
+#define INT_730_USB_ISO 3
+#define INT_730_ICR 4
+#define INT_730_EAC 5
+#define INT_730_GPIO_BANK1 6
+#define INT_730_GPIO_BANK2 7
+#define INT_730_GPIO_BANK3 8
+#define INT_730_McBSP2TX 10
+#define INT_730_McBSP2RX 11
+#define INT_730_McBSP2RX_OVF 12
+#define INT_730_LCD_LINE 14
+#define INT_730_GSM_PROTECT 15
+#define INT_730_TIMER3 16
+#define INT_730_GPIO_BANK5 17
+#define INT_730_GPIO_BANK6 18
+#define INT_730_SPGIO_WR 29
+
+#define IH2_BASE 32
+
+#define INT_KEYBOARD (1 + IH2_BASE)
+#define INT_uWireTX (2 + IH2_BASE)
+#define INT_uWireRX (3 + IH2_BASE)
+#define INT_I2C (4 + IH2_BASE)
+#define INT_MPUIO (5 + IH2_BASE)
+#define INT_USB_HHC_1 (6 + IH2_BASE)
+#define INT_McBSP3TX (10 + IH2_BASE)
+#define INT_McBSP3RX (11 + IH2_BASE)
+#define INT_McBSP1TX (12 + IH2_BASE)
+#define INT_McBSP1RX (13 + IH2_BASE)
+#define INT_UART2 (14 + IH2_BASE)
+#define INT_UART1 (15 + IH2_BASE)
+#define INT_BT_MCSI1TX (16 + IH2_BASE)
+#define INT_BT_MCSI1RX (17 + IH2_BASE)
+#define INT_USB_W2FC (20 + IH2_BASE)
+#define INT_1WIRE (21 + IH2_BASE)
+#define INT_OS_TIMER (22 + IH2_BASE)
+#define INT_MMC (23 + IH2_BASE)
+#define INT_GAUGE_32K (24 + IH2_BASE)
+#define INT_RTC_TIMER (25 + IH2_BASE)
+#define INT_RTC_ALARM (26 + IH2_BASE)
+#define INT_MEM_STICK (27 + IH2_BASE)
+#define INT_DSP_MMU (28 + IH2_BASE)
+
+#define INT_1510_COM_SPI_RO (31 + IH2_BASE)
+
+#define INT_1610_FAC (0 + IH2_BASE)
+#define INT_1610_USB_HHC_2 (7 + IH2_BASE)
+#define INT_1610_USB_OTG (8 + IH2_BASE)
+#define INT_1610_SoSSI (9 + IH2_BASE)
+#define INT_1610_SoSSI_MATCH (19 + IH2_BASE)
+#define INT_1610_McBSP2RX_OF (31 + IH2_BASE)
+#define INT_1610_STI (32 + IH2_BASE)
+#define INT_1610_STI_WAKEUP (33 + IH2_BASE)
+#define INT_1610_GPTIMER3 (34 + IH2_BASE)
+#define INT_1610_GPTIMER4 (35 + IH2_BASE)
+#define INT_1610_GPTIMER5 (36 + IH2_BASE)
+#define INT_1610_GPTIMER6 (37 + IH2_BASE)
+#define INT_1610_GPTIMER7 (38 + IH2_BASE)
+#define INT_1610_GPTIMER8 (39 + IH2_BASE)
+#define INT_1610_GPIO_BANK2 (40 + IH2_BASE)
+#define INT_1610_GPIO_BANK3 (41 + IH2_BASE)
+#define INT_1610_MMC2 (42 + IH2_BASE)
+#define INT_1610_CF (43 + IH2_BASE)
+#define INT_1610_WAKE_UP_REQ (46 + IH2_BASE)
+#define INT_1610_GPIO_BANK4 (48 + IH2_BASE)
+#define INT_1610_SPI (49 + IH2_BASE)
+#define INT_1610_DMA_CH6 (53 + IH2_BASE)
+#define INT_1610_DMA_CH7 (54 + IH2_BASE)
+#define INT_1610_DMA_CH8 (55 + IH2_BASE)
+#define INT_1610_DMA_CH9 (56 + IH2_BASE)
+#define INT_1610_DMA_CH10 (57 + IH2_BASE)
+#define INT_1610_DMA_CH11 (58 + IH2_BASE)
+#define INT_1610_DMA_CH12 (59 + IH2_BASE)
+#define INT_1610_DMA_CH13 (60 + IH2_BASE)
+#define INT_1610_DMA_CH14 (61 + IH2_BASE)
+#define INT_1610_DMA_CH15 (62 + IH2_BASE)
+#define INT_1610_NAND (63 + IH2_BASE)
+
+#define INT_730_HW_ERRORS (0 + IH2_BASE)
+#define INT_730_NFIQ_PWR_FAIL (1 + IH2_BASE)
+#define INT_730_CFCD (2 + IH2_BASE)
+#define INT_730_CFIREQ (3 + IH2_BASE)
+#define INT_730_I2C (4 + IH2_BASE)
+#define INT_730_PCC (5 + IH2_BASE)
+#define INT_730_MPU_EXT_NIRQ (6 + IH2_BASE)
+#define INT_730_SPI_100K_1 (7 + IH2_BASE)
+#define INT_730_SYREN_SPI (8 + IH2_BASE)
+#define INT_730_VLYNQ (9 + IH2_BASE)
+#define INT_730_GPIO_BANK4 (10 + IH2_BASE)
+#define INT_730_McBSP1TX (11 + IH2_BASE)
+#define INT_730_McBSP1RX (12 + IH2_BASE)
+#define INT_730_McBSP1RX_OF (13 + IH2_BASE)
+#define INT_730_UART_MODEM_IRDA_2 (14 + IH2_BASE)
+#define INT_730_UART_MODEM_1 (15 + IH2_BASE)
+#define INT_730_MCSI (16 + IH2_BASE)
+#define INT_730_uWireTX (17 + IH2_BASE)
+#define INT_730_uWireRX (18 + IH2_BASE)
+#define INT_730_SMC_CD (19 + IH2_BASE)
+#define INT_730_SMC_IREQ (20 + IH2_BASE)
+#define INT_730_HDQ_1WIRE (21 + IH2_BASE)
+#define INT_730_TIMER32K (22 + IH2_BASE)
+#define INT_730_MMC_SDIO (23 + IH2_BASE)
+#define INT_730_UPLD (24 + IH2_BASE)
+#define INT_730_USB_HHC_1 (27 + IH2_BASE)
+#define INT_730_USB_HHC_2 (28 + IH2_BASE)
+#define INT_730_USB_GENI (29 + IH2_BASE)
+#define INT_730_USB_OTG (30 + IH2_BASE)
+#define INT_730_CAMERA_IF (31 + IH2_BASE)
+#define INT_730_RNG (32 + IH2_BASE)
+#define INT_730_DUAL_MODE_TIMER (33 + IH2_BASE)
+#define INT_730_DBB_RF_EN (34 + IH2_BASE)
+#define INT_730_MPUIO_KEYPAD (35 + IH2_BASE)
+#define INT_730_SHA1_MD5 (36 + IH2_BASE)
+#define INT_730_SPI_100K_2 (37 + IH2_BASE)
+#define INT_730_RNG_IDLE (38 + IH2_BASE)
+#define INT_730_MPUIO (39 + IH2_BASE)
+#define INT_730_LLPC_LCD_CTRL_CAN_BE_OFF (40 + IH2_BASE)
+#define INT_730_LLPC_OE_FALLING (41 + IH2_BASE)
+#define INT_730_LLPC_OE_RISING (42 + IH2_BASE)
+#define INT_730_LLPC_VSYNC (43 + IH2_BASE)
+#define INT_730_WAKE_UP_REQ (46 + IH2_BASE)
+#define INT_730_DMA_CH6 (53 + IH2_BASE)
+#define INT_730_DMA_CH7 (54 + IH2_BASE)
+#define INT_730_DMA_CH8 (55 + IH2_BASE)
+#define INT_730_DMA_CH9 (56 + IH2_BASE)
+#define INT_730_DMA_CH10 (57 + IH2_BASE)
+#define INT_730_DMA_CH11 (58 + IH2_BASE)
+#define INT_730_DMA_CH12 (59 + IH2_BASE)
+#define INT_730_DMA_CH13 (60 + IH2_BASE)
+#define INT_730_DMA_CH14 (61 + IH2_BASE)
+#define INT_730_DMA_CH15 (62 + IH2_BASE)
+#define INT_730_NAND (63 + IH2_BASE)
+
+#define INT_24XX_SYS_NIRQ 7
+#define INT_24XX_SDMA_IRQ0 12
+#define INT_24XX_SDMA_IRQ1 13
+#define INT_24XX_SDMA_IRQ2 14
+#define INT_24XX_SDMA_IRQ3 15
+#define INT_24XX_CAM_IRQ 24
+#define INT_24XX_DSS_IRQ 25
+#define INT_24XX_GPIO_BANK1 29
+#define INT_24XX_GPIO_BANK2 30
+#define INT_24XX_GPIO_BANK3 31
+#define INT_24XX_GPIO_BANK4 32
+#define INT_24XX_GPTIMER1 37
+#define INT_24XX_GPTIMER2 38
+#define INT_24XX_GPTIMER3 39
+#define INT_24XX_GPTIMER4 40
+#define INT_24XX_GPTIMER5 41
+#define INT_24XX_GPTIMER6 42
+#define INT_24XX_GPTIMER7 43
+#define INT_24XX_GPTIMER8 44
+#define INT_24XX_GPTIMER9 45
+#define INT_24XX_GPTIMER10 46
+#define INT_24XX_GPTIMER11 47
+#define INT_24XX_GPTIMER12 48
+#define INT_24XX_MCBSP1_IRQ_TX 59
+#define INT_24XX_MCBSP1_IRQ_RX 60
+#define INT_24XX_MCBSP2_IRQ_TX 62
+#define INT_24XX_MCBSP2_IRQ_RX 63
+#define INT_24XX_UART1_IRQ 72
+#define INT_24XX_UART2_IRQ 73
+#define INT_24XX_UART3_IRQ 74
+#define INT_24XX_MMC_IRQ 83
+
+#define OMAP_MAX_GPIO_LINES 192
+#define IH_GPIO_BASE (128 + IH2_BASE)
+#define IH_MPUIO_BASE (OMAP_MAX_GPIO_LINES + IH_GPIO_BASE)
+#define IH_BOARD_BASE (16 + IH_MPUIO_BASE)
+
+#define OMAP_IRQ_BIT(irq) (1 << ((irq) % 32))
+
+#ifndef __ASSEMBLY__
+
+#endif
+
+#include <asm/hardware.h>
+
+#ifndef NR_IRQS
+#define NR_IRQS IH_BOARD_BASE
+#endif
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/mcbsp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/mcbsp.h
new file mode 100644
index 0000000..cae5e3b
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/mcbsp.h
@@ -0,0 +1,185 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARCH_OMAP_MCBSP_H
+#define __ASM_ARCH_OMAP_MCBSP_H
+
+#include <asm/hardware.h>
+
+#define OMAP730_MCBSP1_BASE 0xfffb1000
+#define OMAP730_MCBSP2_BASE 0xfffb1800
+
+#define OMAP1510_MCBSP1_BASE 0xe1011800
+#define OMAP1510_MCBSP2_BASE 0xfffb1000
+#define OMAP1510_MCBSP3_BASE 0xe1017000
+
+#define OMAP1610_MCBSP1_BASE 0xe1011800
+#define OMAP1610_MCBSP2_BASE 0xfffb1000
+#define OMAP1610_MCBSP3_BASE 0xe1017000
+
+#define OMAP24XX_MCBSP1_BASE 0x48074000
+#define OMAP24XX_MCBSP2_BASE 0x48076000
+
+#define OMAP_MCBSP_READ(base, reg) __raw_readw((base) + OMAP_MCBSP_REG_##reg)
+#define OMAP_MCBSP_WRITE(base, reg, val) __raw_writew((val), (base) + OMAP_MCBSP_REG_##reg)
+
+#define RRST 0x0001
+#define RRDY 0x0002
+#define RFULL 0x0004
+#define RSYNC_ERR 0x0008
+#define RINTM(value) ((value)<<4)  
+#define ABIS 0x0040
+#define DXENA 0x0080
+#define CLKSTP(value) ((value)<<11)  
+#define RJUST(value) ((value)<<13)  
+#define DLB 0x8000
+
+#define XRST 0x0001
+#define XRDY 0x0002
+#define XEMPTY 0x0004
+#define XSYNC_ERR 0x0008
+#define XINTM(value) ((value)<<4)  
+#define GRST 0x0040
+#define FRST 0x0080
+#define SOFT 0x0100
+#define FREE 0x0200
+
+#define CLKRP 0x0001
+#define CLKXP 0x0002
+#define FSRP 0x0004
+#define FSXP 0x0008
+#define DR_STAT 0x0010
+#define DX_STAT 0x0020
+#define CLKS_STAT 0x0040
+#define SCLKME 0x0080
+#define CLKRM 0x0100
+#define CLKXM 0x0200
+#define FSRM 0x0400
+#define FSXM 0x0800
+#define RIOEN 0x1000
+#define XIOEN 0x2000
+#define IDLE_EN 0x4000
+
+#define RWDLEN1(value) ((value)<<5)  
+#define RFRLEN1(value) ((value)<<8)  
+
+#define XWDLEN1(value) ((value)<<5)  
+#define XFRLEN1(value) ((value)<<8)  
+
+#define RDATDLY(value) (value)  
+#define RFIG 0x0004
+#define RCOMPAND(value) ((value)<<3)  
+#define RWDLEN2(value) ((value)<<5)  
+#define RFRLEN2(value) ((value)<<8)  
+#define RPHASE 0x8000
+
+#define XDATDLY(value) (value)  
+#define XFIG 0x0004
+#define XCOMPAND(value) ((value)<<3)  
+#define XWDLEN2(value) ((value)<<5)  
+#define XFRLEN2(value) ((value)<<8)  
+#define XPHASE 0x8000
+
+#define CLKGDV(value) (value)  
+#define FWID(value) ((value)<<8)  
+
+#define FPER(value) (value)  
+#define FSGM 0x1000
+#define CLKSM 0x2000
+#define CLKSP 0x4000
+#define GSYNC 0x8000
+
+#define RMCM 0x0001
+#define RCBLK(value) ((value)<<2)  
+#define RPABLK(value) ((value)<<5)  
+#define RPBBLK(value) ((value)<<7)  
+
+#define XMCM(value) (value)  
+#define XCBLK(value) ((value)<<2)  
+#define XPABLK(value) ((value)<<5)  
+#define XPBBLK(value) ((value)<<7)  
+
+struct omap_mcbsp_reg_cfg {
+ u16 spcr2;
+ u16 spcr1;
+ u16 rcr2;
+ u16 rcr1;
+ u16 xcr2;
+ u16 xcr1;
+ u16 srgr2;
+ u16 srgr1;
+ u16 mcr2;
+ u16 mcr1;
+ u16 pcr0;
+ u16 rcerc;
+ u16 rcerd;
+ u16 xcerc;
+ u16 xcerd;
+ u16 rcere;
+ u16 rcerf;
+ u16 xcere;
+ u16 xcerf;
+ u16 rcerg;
+ u16 rcerh;
+ u16 xcerg;
+ u16 xcerh;
+};
+
+typedef enum {
+ OMAP_MCBSP1 = 0,
+ OMAP_MCBSP2,
+ OMAP_MCBSP3,
+} omap_mcbsp_id;
+
+typedef int __bitwise omap_mcbsp_io_type_t;
+#define OMAP_MCBSP_IRQ_IO ((__force omap_mcbsp_io_type_t) 1)
+#define OMAP_MCBSP_POLL_IO ((__force omap_mcbsp_io_type_t) 2)
+
+typedef enum {
+ OMAP_MCBSP_WORD_8 = 0,
+ OMAP_MCBSP_WORD_12,
+ OMAP_MCBSP_WORD_16,
+ OMAP_MCBSP_WORD_20,
+ OMAP_MCBSP_WORD_24,
+ OMAP_MCBSP_WORD_32,
+} omap_mcbsp_word_length;
+
+typedef enum {
+ OMAP_MCBSP_CLK_RISING = 0,
+ OMAP_MCBSP_CLK_FALLING,
+} omap_mcbsp_clk_polarity;
+
+typedef enum {
+ OMAP_MCBSP_FS_ACTIVE_HIGH = 0,
+ OMAP_MCBSP_FS_ACTIVE_LOW,
+} omap_mcbsp_fs_polarity;
+
+typedef enum {
+ OMAP_MCBSP_CLK_STP_MODE_NO_DELAY = 0,
+ OMAP_MCBSP_CLK_STP_MODE_DELAY,
+} omap_mcbsp_clk_stp_mode;
+
+typedef enum {
+ OMAP_MCBSP_SPI_MASTER = 0,
+ OMAP_MCBSP_SPI_SLAVE,
+} omap_mcbsp_spi_mode;
+
+struct omap_mcbsp_spi_cfg {
+ omap_mcbsp_spi_mode spi_mode;
+ omap_mcbsp_clk_polarity rx_clock_polarity;
+ omap_mcbsp_clk_polarity tx_clock_polarity;
+ omap_mcbsp_fs_polarity fsx_polarity;
+ u8 clk_div;
+ omap_mcbsp_clk_stp_mode clk_stp_mode;
+ omap_mcbsp_word_length word_length;
+};
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/memory.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/memory.h
new file mode 100644
index 0000000..8b064b8
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/memory.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
+
+#define __virt_to_bus(x) __virt_to_phys(x)
+#define __bus_to_virt(x) __phys_to_virt(x)
+
+#endif
+
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/mtd-xip.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/mtd-xip.h
new file mode 100644
index 0000000..9b60aef
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/mtd-xip.h
@@ -0,0 +1,31 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ARCH_OMAP_MTD_XIP_H__
+#define __ARCH_OMAP_MTD_XIP_H__
+
+#include <asm/hardware.h>
+#define OMAP_MPU_TIMER_BASE (0xfffec500)
+#define OMAP_MPU_TIMER_OFFSET 0x100
+
+typedef struct {
+ u32 cntl;
+ u32 load_tim;
+ u32 read_tim;
+} xip_omap_mpu_timer_regs_t;
+
+#define xip_omap_mpu_timer_base(n)  ((volatile xip_omap_mpu_timer_regs_t*)IO_ADDRESS(OMAP_MPU_TIMER_BASE +   (n)*OMAP_MPU_TIMER_OFFSET))
+
+#define xip_irqpending()   (omap_readl(OMAP_IH1_ITR) & ~omap_readl(OMAP_IH1_MIR))
+#define xip_currtime() (~xip_omap_mpu_timer_read(0))
+#define xip_elapsed_since(x) (signed)((~xip_omap_mpu_timer_read(0) - (x)) / 6)
+#define xip_cpu_idle() asm volatile ("mcr p15, 0, %0, c7, c0, 4" :: "r" (1))
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/mux.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/mux.h
new file mode 100644
index 0000000..72da54e
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/mux.h
@@ -0,0 +1,391 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARCH_MUX_H
+#define __ASM_ARCH_MUX_H
+
+#define PU_PD_SEL_NA 0  
+#define PULL_DWN_CTRL_NA 0  
+
+#define MUX_REG(reg, mode_offset, mode) .mux_reg = FUNC_MUX_CTRL_##reg,   .mask_offset = mode_offset,   .mask = mode,
+
+#define PULL_REG(reg, bit, status) .pull_reg = PULL_DWN_CTRL_##reg,   .pull_bit = bit,   .pull_val = status,
+
+#define PU_PD_REG(reg, status) .pu_pd_reg = PU_PD_SEL_##reg,   .pu_pd_val = status,
+
+#define MUX_REG_730(reg, mode_offset, mode)   .mux_reg = OMAP730_IO_CONF_##reg,   .mask_offset = mode_offset,   .mask = mode,
+
+#define PULL_REG_730(reg, bit, status) .pull_reg = OMAP730_IO_CONF_##reg,   .pull_bit = bit,   .pull_val = status,
+
+#define MUX_CFG(desc, mux_reg, mode_offset, mode,   pull_reg, pull_bit, pull_status,   pu_pd_reg, pu_pd_status, debug_status)  {   .name = desc,   .debug = debug_status,   MUX_REG(mux_reg, mode_offset, mode)   PULL_REG(pull_reg, pull_bit, !pull_status)   PU_PD_REG(pu_pd_reg, pu_pd_status)  },
+
+#define MUX_CFG_730(desc, mux_reg, mode_offset, mode,   pull_bit, pull_status, debug_status) {   .name = desc,   .debug = debug_status,   MUX_REG_730(mux_reg, mode_offset, mode)   PULL_REG_730(mux_reg, pull_bit, pull_status)   PU_PD_REG(NA, 0)  },
+
+#define MUX_CFG_24XX(desc, reg_offset, mode,   pull_en, pull_mode, dbg)  {   .name = desc,   .debug = dbg,   .mux_reg = reg_offset,   .mask = mode,   .pull_val = pull_en,   .pu_pd_val = pull_mode,  },
+
+#define PULL_DISABLED 0
+#define PULL_ENABLED 1
+
+#define PULL_DOWN 0
+#define PULL_UP 1
+
+struct pin_config {
+ char *name;
+ unsigned char busy;
+ unsigned char debug;
+
+ const char *mux_reg_name;
+ const unsigned int mux_reg;
+ const unsigned char mask_offset;
+ const unsigned char mask;
+
+ const char *pull_name;
+ const unsigned int pull_reg;
+ const unsigned char pull_val;
+ const unsigned char pull_bit;
+
+ const char *pu_pd_name;
+ const unsigned int pu_pd_reg;
+ const unsigned char pu_pd_val;
+};
+
+enum omap730_index {
+
+ E2_730_KBR0,
+ J7_730_KBR1,
+ E1_730_KBR2,
+ F3_730_KBR3,
+ D2_730_KBR4,
+ AA20_730_KBR5,
+ V17_730_KBR6,
+ C2_730_KBC0,
+ D3_730_KBC1,
+ E4_730_KBC2,
+ F4_730_KBC3,
+ E3_730_KBC4,
+
+ AA17_730_USB_DM,
+ W16_730_USB_PU_EN,
+ W17_730_USB_VBUSI,
+
+ V19_730_GPIO_15,
+ M19_730_GPIO_77,
+ C21_730_GPIO_121_122,
+ K19_730_GPIO_126,
+ K15_730_GPIO_127,
+
+ P15_730_GPIO_16_17,
+
+ M15_730_GPIO_83,
+ N20_730_GPIO_82,
+ N18_730_GPIO_81,
+ N19_730_GPIO_80,
+ L15_730_GPIO_76,
+
+ UART1_CTS_RTS,
+ OMAP_730_GPIOS_42_43,
+ UART1_TX_RX,
+ OMAP_730_GPIOS_40_41,
+ UART1_USB_RX_TX,
+ UART1_USB_RTS,
+ UART1_USB_CTS
+};
+
+enum omap1xxx_index {
+
+ UART1_TX = 0,
+ UART1_RTS,
+
+ UART2_TX,
+ UART2_RX,
+ UART2_CTS,
+ UART2_RTS,
+
+ UART3_TX,
+ UART3_RX,
+ UART3_CTS,
+ UART3_RTS,
+ UART3_CLKREQ,
+ UART3_BCLK,
+ Y15_1610_UART3_RTS,
+
+ PWT,
+ PWL,
+
+ R18_USB_VBUS,
+ R18_1510_USB_GPIO0,
+ W4_USB_PUEN,
+ W4_USB_CLKO,
+ W4_USB_HIGHZ,
+ W4_GPIO58,
+
+ USB1_SUSP,
+ USB1_SEO,
+ W13_1610_USB1_SE0,
+ USB1_TXEN,
+ USB1_TXD,
+ USB1_VP,
+ USB1_VM,
+ USB1_RCV,
+ USB1_SPEED,
+ R13_1610_USB1_SPEED,
+ R13_1710_USB1_SE0,
+
+ USB2_SUSP,
+ USB2_VP,
+ USB2_TXEN,
+ USB2_VM,
+ USB2_RCV,
+ USB2_SEO,
+ USB2_TXD,
+
+ R18_1510_GPIO0,
+ R19_1510_GPIO1,
+ M14_1510_GPIO2,
+
+ P18_1610_GPIO3,
+ Y15_1610_GPIO17,
+
+ R18_1710_GPIO0,
+ V2_1710_GPIO10,
+ N21_1710_GPIO14,
+ W15_1710_GPIO40,
+
+ MPUIO2,
+ N15_1610_MPUIO2,
+ MPUIO4,
+ MPUIO5,
+ T20_1610_MPUIO5,
+ W11_1610_MPUIO6,
+ V10_1610_MPUIO7,
+ W11_1610_MPUIO9,
+ V10_1610_MPUIO10,
+ W10_1610_MPUIO11,
+ E20_1610_MPUIO13,
+ U20_1610_MPUIO14,
+ E19_1610_MPUIO15,
+
+ MCBSP2_CLKR,
+ MCBSP2_CLKX,
+ MCBSP2_DR,
+ MCBSP2_DX,
+ MCBSP2_FSR,
+ MCBSP2_FSX,
+
+ MCBSP3_CLKX,
+
+ BALLOUT_V8_ARMIO3,
+ N20_HDQ,
+
+ W8_1610_MMC2_DAT0,
+ V8_1610_MMC2_DAT1,
+ W15_1610_MMC2_DAT2,
+ R10_1610_MMC2_DAT3,
+ Y10_1610_MMC2_CLK,
+ Y8_1610_MMC2_CMD,
+ V9_1610_MMC2_CMDDIR,
+ V5_1610_MMC2_DATDIR0,
+ W19_1610_MMC2_DATDIR1,
+ R18_1610_MMC2_CLKIN,
+
+ M19_1610_ETM_PSTAT0,
+ L15_1610_ETM_PSTAT1,
+ L18_1610_ETM_PSTAT2,
+ L19_1610_ETM_D0,
+ J19_1610_ETM_D6,
+ J18_1610_ETM_D7,
+
+ P20_1610_GPIO4,
+ V9_1610_GPIO7,
+ W8_1610_GPIO9,
+ N20_1610_GPIO11,
+ N19_1610_GPIO13,
+ P10_1610_GPIO22,
+ V5_1610_GPIO24,
+ AA20_1610_GPIO_41,
+ W19_1610_GPIO48,
+ M7_1610_GPIO62,
+ V14_16XX_GPIO37,
+ R9_16XX_GPIO18,
+ L14_16XX_GPIO49,
+
+ V19_1610_UWIRE_SCLK,
+ U18_1610_UWIRE_SDI,
+ W21_1610_UWIRE_SDO,
+ N14_1610_UWIRE_CS0,
+ P15_1610_UWIRE_CS3,
+ N15_1610_UWIRE_CS1,
+
+ U19_1610_SPIF_SCK,
+ U18_1610_SPIF_DIN,
+ P20_1610_SPIF_DIN,
+ W21_1610_SPIF_DOUT,
+ R18_1610_SPIF_DOUT,
+ N14_1610_SPIF_CS0,
+ N15_1610_SPIF_CS1,
+ T19_1610_SPIF_CS2,
+ P15_1610_SPIF_CS3,
+
+ L3_1610_FLASH_CS2B_OE,
+ M8_1610_FLASH_CS2B_WE,
+
+ MMC_CMD,
+ MMC_DAT1,
+ MMC_DAT2,
+ MMC_DAT0,
+ MMC_CLK,
+ MMC_DAT3,
+
+ M15_1710_MMC_CLKI,
+ P19_1710_MMC_CMDDIR,
+ P20_1710_MMC_DATDIR0,
+
+ W9_USB0_TXEN,
+ AA9_USB0_VP,
+ Y5_USB0_RCV,
+ R9_USB0_VM,
+ V6_USB0_TXD,
+ W5_USB0_SE0,
+ V9_USB0_SPEED,
+ V9_USB0_SUSP,
+
+ W9_USB2_TXEN,
+ AA9_USB2_VP,
+ Y5_USB2_RCV,
+ R9_USB2_VM,
+ V6_USB2_TXD,
+ W5_USB2_SE0,
+
+ R13_1610_UART1_TX,
+ V14_16XX_UART1_RX,
+ R14_1610_UART1_CTS,
+ AA15_1610_UART1_RTS,
+ R9_16XX_UART2_RX,
+ L14_16XX_UART3_RX,
+
+ I2C_SCL,
+ I2C_SDA,
+
+ F18_1610_KBC0,
+ D20_1610_KBC1,
+ D19_1610_KBC2,
+ E18_1610_KBC3,
+ C21_1610_KBC4,
+ G18_1610_KBR0,
+ F19_1610_KBR1,
+ H14_1610_KBR2,
+ E20_1610_KBR3,
+ E19_1610_KBR4,
+ N19_1610_KBR5,
+
+ T20_1610_LOW_PWR,
+
+ V5_1710_MCLK_ON,
+ V5_1710_MCLK_OFF,
+ R10_1610_MCLK_ON,
+ R10_1610_MCLK_OFF,
+
+ P11_1610_CF_CD2,
+ R11_1610_CF_IOIS16,
+ V10_1610_CF_IREQ,
+ W10_1610_CF_RESET,
+ W11_1610_CF_CD1,
+};
+
+enum omap24xx_index {
+
+ M19_24XX_I2C1_SCL,
+ L15_24XX_I2C1_SDA,
+ J15_24XX_I2C2_SCL,
+ H19_24XX_I2C2_SDA,
+
+ W19_24XX_SYS_NIRQ,
+
+ W14_24XX_SYS_CLKOUT,
+
+ L3_GPMC_WAIT0,
+ N7_GPMC_WAIT1,
+ M1_GPMC_WAIT2,
+ P1_GPMC_WAIT3,
+
+ Y15_24XX_MCBSP2_CLKX,
+ R14_24XX_MCBSP2_FSX,
+ W15_24XX_MCBSP2_DR,
+ V15_24XX_MCBSP2_DX,
+
+ M21_242X_GPIO11,
+ AA10_242X_GPIO13,
+ AA6_242X_GPIO14,
+ AA4_242X_GPIO15,
+ Y11_242X_GPIO16,
+ AA12_242X_GPIO17,
+ AA8_242X_GPIO58,
+ Y20_24XX_GPIO60,
+ W4__24XX_GPIO74,
+ M15_24XX_GPIO92,
+ V14_24XX_GPIO117,
+
+ V4_242X_GPIO49,
+ W2_242X_GPIO50,
+ U4_242X_GPIO51,
+ V3_242X_GPIO52,
+ V2_242X_GPIO53,
+ V6_242X_GPIO53,
+ T4_242X_GPIO54,
+ Y4_242X_GPIO54,
+ T3_242X_GPIO55,
+ U2_242X_GPIO56,
+
+ AA10_242X_DMAREQ0,
+ AA6_242X_DMAREQ1,
+ E4_242X_DMAREQ2,
+ G4_242X_DMAREQ3,
+ D3_242X_DMAREQ4,
+ E3_242X_DMAREQ5,
+
+ P20_24XX_TSC_IRQ,
+
+ K15_24XX_UART3_TX,
+ K14_24XX_UART3_RX,
+
+ G19_24XX_MMC_CLKO,
+ H18_24XX_MMC_CMD,
+ F20_24XX_MMC_DAT0,
+ H14_24XX_MMC_DAT1,
+ E19_24XX_MMC_DAT2,
+ D19_24XX_MMC_DAT3,
+ F19_24XX_MMC_DAT_DIR0,
+ E20_24XX_MMC_DAT_DIR1,
+ F18_24XX_MMC_DAT_DIR2,
+ E18_24XX_MMC_DAT_DIR3,
+ G18_24XX_MMC_CMD_DIR,
+ H15_24XX_MMC_CLKI,
+
+ T19_24XX_KBR0,
+ R19_24XX_KBR1,
+ V18_24XX_KBR2,
+ M21_24XX_KBR3,
+ E5__24XX_KBR4,
+ M18_24XX_KBR5,
+ R20_24XX_KBC0,
+ M14_24XX_KBC1,
+ H19_24XX_KBC2,
+ V17_24XX_KBC3,
+ P21_24XX_KBC4,
+ L14_24XX_KBC5,
+ N19_24XX_KBC6,
+
+ B3__24XX_KBR5,
+ AA4_24XX_KBC2,
+ B13_24XX_KBC6,
+};
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/omap24xx.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/omap24xx.h
new file mode 100644
index 0000000..37def2f
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/omap24xx.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARCH_OMAP24XX_H
+#define __ASM_ARCH_OMAP24XX_H
+
+#define L4_24XX_BASE 0x48000000
+#define L3_24XX_BASE 0x68000000
+
+#define OMAP24XX_IC_BASE (L4_24XX_BASE + 0xfe000)
+#define VA_IC_BASE IO_ADDRESS(OMAP24XX_IC_BASE)
+#define OMAP24XX_IVA_INTC_BASE 0x40000000
+#define IRQ_SIR_IRQ 0x0040
+
+#define OMAP24XX_32KSYNCT_BASE (L4_24XX_BASE + 0x4000)
+#define OMAP24XX_PRCM_BASE (L4_24XX_BASE + 0x8000)
+#define OMAP24XX_SDRC_BASE (L3_24XX_BASE + 0x9000)
+
+#define OMAP242X_CONTROL_STATUS (L4_24XX_BASE + 0x2f8)
+
+#endif
+
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/serial.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/serial.h
new file mode 100644
index 0000000..6ab8613
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/serial.h
@@ -0,0 +1,21 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARCH_SERIAL_H
+#define __ASM_ARCH_SERIAL_H
+
+#define OMAP_MAX_NR_PORTS 3
+#define OMAP1510_BASE_BAUD (12000000/16)
+#define OMAP16XX_BASE_BAUD (48000000/16)
+
+#define is_omap_port(p) ({int __ret = 0;   if (p == IO_ADDRESS(OMAP_UART1_BASE) ||   p == IO_ADDRESS(OMAP_UART2_BASE) ||   p == IO_ADDRESS(OMAP_UART3_BASE))   __ret = 1;   __ret;   })
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/timex.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/timex.h
new file mode 100644
index 0000000..2c9234c
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/timex.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARCH_OMAP_TIMEX_H
+#define __ASM_ARCH_OMAP_TIMEX_H
+
+#define CLOCK_TICK_RATE (HZ * 100000UL)
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/vmalloc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/vmalloc.h
new file mode 100644
index 0000000..f2b5b44
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/arch/vmalloc.h
@@ -0,0 +1,13 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
+
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/atomic.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/atomic.h
new file mode 100644
index 0000000..6f1921a
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/atomic.h
@@ -0,0 +1,21 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_ATOMIC_H
+#define __ASM_ARM_ATOMIC_H
+
+#include <linux/compiler.h>
+
+typedef struct { volatile int counter; } atomic_t;
+
+#define ATOMIC_INIT(i) { (i) }
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/auxvec.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/auxvec.h
new file mode 100644
index 0000000..c7e839c
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/auxvec.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASMARM_AUXVEC_H
+#define __ASMARM_AUXVEC_H
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/bitops.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/bitops.h
new file mode 100644
index 0000000..ff76a68
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/bitops.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_BITOPS_H
+#define __ASM_ARM_BITOPS_H
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/byteorder.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/byteorder.h
new file mode 100644
index 0000000..4da37bf
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/byteorder.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_BYTEORDER_H
+#define __ASM_ARM_BYTEORDER_H
+
+#include <linux/compiler.h>
+#include <asm/types.h>
+
+static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
+{
+ __u32 t;
+
+#ifndef __thumb__
+ if (!__builtin_constant_p(x)) {
+
+ asm ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x));
+ } else
+#endif
+ t = x ^ ((x << 16) | (x >> 16));
+
+ x = (x << 24) | (x >> 8);
+ t &= ~0x00FF0000;
+ x ^= (t >> 8);
+
+ return x;
+}
+
+#define __arch__swab32(x) ___arch__swab32(x)
+
+#ifndef __STRICT_ANSI__
+#define __BYTEORDER_HAS_U64__
+#define __SWAB_64_THRU_32__
+#endif
+
+#ifdef __ARMEB__
+#include <linux/byteorder/big_endian.h>
+#else
+#include <linux/byteorder/little_endian.h>
+#endif
+
+#endif
+
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/cache.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/cache.h
new file mode 100644
index 0000000..be26423
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/cache.h
@@ -0,0 +1,18 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASMARM_CACHE_H
+#define __ASMARM_CACHE_H
+
+#define L1_CACHE_SHIFT 5
+#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/cacheflush.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/cacheflush.h
new file mode 100644
index 0000000..3ffa87a
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/cacheflush.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_CACHEFLUSH_H
+#define _ASMARM_CACHEFLUSH_H
+
+#include <linux/sched.h>
+#include <linux/mm.h>
+
+#include <asm/glue.h>
+#include <asm/shmparam.h>
+
+#define CACHE_COLOUR(vaddr) ((vaddr & (SHMLBA - 1)) >> PAGE_SHIFT)
+
+#undef _CACHE
+#undef MULTI_CACHE
+
+#if !defined(_CACHE) && !defined(MULTI_CACHE)
+#error Unknown cache maintainence model
+#endif
+
+#define PG_dcache_dirty PG_arch_1
+
+struct cpu_cache_fns {
+ void (*flush_kern_all)(void);
+ void (*flush_user_all)(void);
+ void (*flush_user_range)(unsigned long, unsigned long, unsigned int);
+
+ void (*coherent_kern_range)(unsigned long, unsigned long);
+ void (*coherent_user_range)(unsigned long, unsigned long);
+ void (*flush_kern_dcache_page)(void *);
+
+ void (*dma_inv_range)(unsigned long, unsigned long);
+ void (*dma_clean_range)(unsigned long, unsigned long);
+ void (*dma_flush_range)(unsigned long, unsigned long);
+};
+
+#ifdef MULTI_CACHE
+
+#define __cpuc_flush_kern_all cpu_cache.flush_kern_all
+#define __cpuc_flush_user_all cpu_cache.flush_user_all
+#define __cpuc_flush_user_range cpu_cache.flush_user_range
+#define __cpuc_coherent_kern_range cpu_cache.coherent_kern_range
+#define __cpuc_coherent_user_range cpu_cache.coherent_user_range
+#define __cpuc_flush_dcache_page cpu_cache.flush_kern_dcache_page
+
+#define dmac_inv_range cpu_cache.dma_inv_range
+#define dmac_clean_range cpu_cache.dma_clean_range
+#define dmac_flush_range cpu_cache.dma_flush_range
+
+#else
+
+#define __cpuc_flush_kern_all __glue(_CACHE,_flush_kern_cache_all)
+#define __cpuc_flush_user_all __glue(_CACHE,_flush_user_cache_all)
+#define __cpuc_flush_user_range __glue(_CACHE,_flush_user_cache_range)
+#define __cpuc_coherent_kern_range __glue(_CACHE,_coherent_kern_range)
+#define __cpuc_coherent_user_range __glue(_CACHE,_coherent_user_range)
+#define __cpuc_flush_dcache_page __glue(_CACHE,_flush_kern_dcache_page)
+
+#define dmac_inv_range __glue(_CACHE,_dma_inv_range)
+#define dmac_clean_range __glue(_CACHE,_dma_clean_range)
+#define dmac_flush_range __glue(_CACHE,_dma_flush_range)
+
+#endif
+
+#define flush_cache_vmap(start, end) flush_cache_all()
+#define flush_cache_vunmap(start, end) flush_cache_all()
+
+#define copy_to_user_page(vma, page, vaddr, dst, src, len)   do {   memcpy(dst, src, len);   flush_ptrace_access(vma, page, vaddr, dst, len, 1);  } while (0)
+
+#define copy_from_user_page(vma, page, vaddr, dst, src, len)   do {   memcpy(dst, src, len);   } while (0)
+
+#define flush_cache_all() __cpuc_flush_kern_all()
+#define flush_cache_user_range(vma,start,end)   __cpuc_coherent_user_range((start) & PAGE_MASK, PAGE_ALIGN(end))
+#define flush_icache_range(s,e) __cpuc_coherent_kern_range(s,e)
+#define clean_dcache_area(start,size) cpu_dcache_clean_area(start, size)
+
+#define flush_dcache_mmap_lock(mapping)   write_lock_irq(&(mapping)->tree_lock)
+#define flush_dcache_mmap_unlock(mapping)   write_unlock_irq(&(mapping)->tree_lock)
+
+#define flush_icache_user_range(vma,page,addr,len)   flush_dcache_page(page)
+
+#define flush_icache_page(vma,page) do { } while (0)
+
+#define __cacheid_present(val) (val != read_cpuid(CPUID_ID))
+#define __cacheid_vivt(val) ((val & (15 << 25)) != (14 << 25))
+#define __cacheid_vipt(val) ((val & (15 << 25)) == (14 << 25))
+#define __cacheid_vipt_nonaliasing(val) ((val & (15 << 25 | 1 << 23)) == (14 << 25))
+#define __cacheid_vipt_aliasing(val) ((val & (15 << 25 | 1 << 23)) == (14 << 25 | 1 << 23))
+
+#define cache_is_vivt()   ({   unsigned int __val = read_cpuid(CPUID_CACHETYPE);   (!__cacheid_present(__val)) || __cacheid_vivt(__val);   })
+
+#define cache_is_vipt()   ({   unsigned int __val = read_cpuid(CPUID_CACHETYPE);   __cacheid_present(__val) && __cacheid_vipt(__val);   })
+
+#define cache_is_vipt_nonaliasing()   ({   unsigned int __val = read_cpuid(CPUID_CACHETYPE);   __cacheid_present(__val) &&   __cacheid_vipt_nonaliasing(__val);   })
+
+#define cache_is_vipt_aliasing()   ({   unsigned int __val = read_cpuid(CPUID_CACHETYPE);   __cacheid_present(__val) &&   __cacheid_vipt_aliasing(__val);   })
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/cputime.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/cputime.h
new file mode 100644
index 0000000..4a4097f
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/cputime.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ARM_CPUTIME_H
+#define __ARM_CPUTIME_H
+
+#include <asm-generic/cputime.h>
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/delay.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/delay.h
new file mode 100644
index 0000000..631fd9b
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/delay.h
@@ -0,0 +1,22 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_DELAY_H
+#define __ASM_ARM_DELAY_H
+
+#include <asm/param.h>  
+
+#define MAX_UDELAY_MS 2
+
+#define udelay(n)   (__builtin_constant_p(n) ?   ((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() :   __const_udelay((n) * ((2199023U*HZ)>>11))) :   __udelay(n))
+
+#endif
+
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/div64.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/div64.h
new file mode 100644
index 0000000..c03a0e4
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/div64.h
@@ -0,0 +1,27 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_DIV64
+#define __ASM_ARM_DIV64
+
+#include <asm/system.h>
+
+#ifdef __ARMEB__
+#define __xh "r0"
+#define __xl "r1"
+#else
+#define __xl "r0"
+#define __xh "r1"
+#endif
+
+#define do_div(n,base)  ({   register unsigned int __base asm("r4") = base;   register unsigned long long __n asm("r0") = n;   register unsigned long long __res asm("r2");   register unsigned int __rem asm(__xh);   asm( __asmeq("%0", __xh)   __asmeq("%1", "r2")   __asmeq("%2", "r0")   __asmeq("%3", "r4")   "bl	__do_div64"   : "=r" (__rem), "=r" (__res)   : "r" (__n), "r" (__base)   : "ip", "lr", "cc");   n = __res;   __rem;  })
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/dma-mapping.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/dma-mapping.h
new file mode 100644
index 0000000..7e65009
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/dma-mapping.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef ASMARM_DMA_MAPPING_H
+#define ASMARM_DMA_MAPPING_H
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/dma.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/dma.h
new file mode 100644
index 0000000..7eeeb78
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/dma.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_DMA_H
+#define __ASM_ARM_DMA_H
+
+typedef unsigned int dmach_t;
+
+#include <linux/spinlock.h>
+#include <asm/system.h>
+#include <asm/scatterlist.h>
+#include <asm/arch/dma.h>
+
+#ifndef MAX_DMA_ADDRESS
+#define MAX_DMA_ADDRESS 0xffffffff
+#endif
+
+typedef unsigned int dmamode_t;
+
+#define DMA_MODE_MASK 3
+
+#define DMA_MODE_READ 0
+#define DMA_MODE_WRITE 1
+#define DMA_MODE_CASCADE 2
+#define DMA_AUTOINIT 4
+
+#define clear_dma_ff(channel)
+
+#define set_dma_addr(channel, addr)   __set_dma_addr(channel, bus_to_virt(addr))
+
+#ifndef NO_DMA
+#define NO_DMA 255
+#endif
+
+#define isa_dma_bridge_buggy (0)
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/domain.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/domain.h
new file mode 100644
index 0000000..973109e
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/domain.h
@@ -0,0 +1,32 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_PROC_DOMAIN_H
+#define __ASM_PROC_DOMAIN_H
+
+#define DOMAIN_KERNEL 0
+#define DOMAIN_TABLE 0
+#define DOMAIN_USER 1
+#define DOMAIN_IO 2
+
+#define DOMAIN_NOACCESS 0
+#define DOMAIN_CLIENT 1
+#define DOMAIN_MANAGER 3
+
+#define domain_val(dom,type) ((type) << (2*(dom)))
+
+#ifndef __ASSEMBLY__
+
+#define set_domain(x) do { } while (0)
+#define modify_domain(dom,type) do { } while (0)
+
+#endif
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/dyntick.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/dyntick.h
new file mode 100644
index 0000000..1f323f2
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/dyntick.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_DYNTICK_H
+#define _ASMARM_DYNTICK_H
+
+#include <asm/mach/time.h>
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/elf.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/elf.h
new file mode 100644
index 0000000..e9d095e
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/elf.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASMARM_ELF_H
+#define __ASMARM_ELF_H
+
+#include <asm/ptrace.h>
+#include <asm/user.h>
+#ifdef __KERNEL
+#include <asm/procinfo.h>
+#endif
+
+typedef unsigned long elf_greg_t;
+typedef unsigned long elf_freg_t[3];
+
+#define EM_ARM 40
+#define EF_ARM_APCS26 0x08
+#define EF_ARM_SOFT_FLOAT 0x200
+#define EF_ARM_EABI_MASK 0xFF000000
+
+#define R_ARM_NONE 0
+#define R_ARM_PC24 1
+#define R_ARM_ABS32 2
+#define R_ARM_CALL 28
+#define R_ARM_JUMP24 29
+
+#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+typedef struct user_fp elf_fpregset_t;
+
+#define elf_check_arch(x) ( ((x)->e_machine == EM_ARM) && (ELF_PROC_OK((x))) )
+
+#define ELF_CLASS ELFCLASS32
+#ifdef __ARMEB__
+#define ELF_DATA ELFDATA2MSB
+#else
+#define ELF_DATA ELFDATA2LSB
+#endif
+#define ELF_ARCH EM_ARM
+
+#define USE_ELF_CORE_DUMP
+#define ELF_EXEC_PAGESIZE 4096
+
+#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
+
+#define ELF_PLAT_INIT(_r, load_addr) (_r)->ARM_r0 = 0
+
+#define ELF_HWCAP (elf_hwcap)
+
+#define ELF_PLATFORM_SIZE 8
+
+#define ELF_PLATFORM (elf_platform)
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/errno.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/errno.h
new file mode 100644
index 0000000..6be7048
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/errno.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ARM_ERRNO_H
+#define _ARM_ERRNO_H
+
+#include <asm-generic/errno.h>
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/fcntl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/fcntl.h
new file mode 100644
index 0000000..42351ea
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/fcntl.h
@@ -0,0 +1,22 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ARM_FCNTL_H
+#define _ARM_FCNTL_H
+
+#define O_DIRECTORY 040000  
+#define O_NOFOLLOW 0100000  
+#define O_DIRECT 0200000  
+#define O_LARGEFILE 0400000
+
+#include <asm-generic/fcntl.h>
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/fpstate.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/fpstate.h
new file mode 100644
index 0000000..b362b14
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/fpstate.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_FPSTATE_H
+#define __ASM_ARM_FPSTATE_H
+
+#ifndef __ASSEMBLY__
+
+struct vfp_hard_struct {
+ __u64 fpregs[16];
+#if __LINUX_ARM_ARCH__ < 6
+ __u32 fpmx_state;
+#endif
+ __u32 fpexc;
+ __u32 fpscr;
+
+ __u32 fpinst;
+ __u32 fpinst2;
+};
+
+union vfp_state {
+ struct vfp_hard_struct hard;
+};
+
+#define FP_HARD_SIZE 35
+
+struct fp_hard_struct {
+ unsigned int save[FP_HARD_SIZE];
+};
+
+#define FP_SOFT_SIZE 35
+
+struct fp_soft_struct {
+ unsigned int save[FP_SOFT_SIZE];
+};
+
+#define IWMMXT_SIZE 0x98
+
+struct iwmmxt_struct {
+ unsigned int save[IWMMXT_SIZE / sizeof(unsigned int)];
+};
+
+union fp_state {
+ struct fp_hard_struct hard;
+ struct fp_soft_struct soft;
+};
+
+#define FP_SIZE (sizeof(union fp_state) / sizeof(int))
+
+struct crunch_state {
+ unsigned int mvdx[16][2];
+ unsigned int mvax[4][3];
+ unsigned int dspsc[2];
+};
+
+#define CRUNCH_SIZE sizeof(struct crunch_state)
+
+#endif
+
+#endif
diff --git a/ndk/build/platforms/android-3/common/include/asm-generic/audit_dir_write.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/glue.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/asm-generic/audit_dir_write.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/asm/glue.h
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/hardirq.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/hardirq.h
new file mode 100644
index 0000000..54207e3
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/hardirq.h
@@ -0,0 +1,38 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_HARDIRQ_H
+#define __ASM_HARDIRQ_H
+
+#include <linux/cache.h>
+#include <linux/threads.h>
+#include <asm/irq.h>
+
+typedef struct {
+ unsigned int __softirq_pending;
+ unsigned int local_timer_irqs;
+} ____cacheline_aligned irq_cpustat_t;
+
+#include <linux/irq_cpustat.h>  
+
+#if NR_IRQS > 256
+#define HARDIRQ_BITS 9
+#else
+#define HARDIRQ_BITS 8
+#endif
+
+#if 1 << HARDIRQ_BITS < NR_IRQS
+#error HARDIRQ_BITS is too low!
+#endif
+
+#define __ARCH_IRQ_EXIT_IRQS_DISABLED 1
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/hardware.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/hardware.h
new file mode 100644
index 0000000..0b381d1
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/hardware.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_HARDWARE_H
+#define __ASM_HARDWARE_H
+
+#include <asm/arch/hardware.h>
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/hw_irq.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/hw_irq.h
new file mode 100644
index 0000000..a34b390
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/hw_irq.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ARCH_ARM_HW_IRQ_H
+#define _ARCH_ARM_HW_IRQ_H
+
+#include <asm/mach/irq.h>
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/ide.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/ide.h
new file mode 100644
index 0000000..f52d5ca
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/ide.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASMARM_IDE_H
+#define __ASMARM_IDE_H
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/io.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/io.h
new file mode 100644
index 0000000..6794022
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/io.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_IO_H
+#define __ASM_ARM_IO_H
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/ioctl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/ioctl.h
new file mode 100644
index 0000000..6e446b6
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/ioctl.h
@@ -0,0 +1,12 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/ioctl.h>
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/ioctls.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/ioctls.h
new file mode 100644
index 0000000..9df82bc
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/ioctls.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_IOCTLS_H
+#define __ASM_ARM_IOCTLS_H
+
+#include <asm/ioctl.h>
+
+#define TCGETS 0x5401
+#define TCSETS 0x5402
+#define TCSETSW 0x5403
+#define TCSETSF 0x5404
+#define TCGETA 0x5405
+#define TCSETA 0x5406
+#define TCSETAW 0x5407
+#define TCSETAF 0x5408
+#define TCSBRK 0x5409
+#define TCXONC 0x540A
+#define TCFLSH 0x540B
+#define TIOCEXCL 0x540C
+#define TIOCNXCL 0x540D
+#define TIOCSCTTY 0x540E
+#define TIOCGPGRP 0x540F
+#define TIOCSPGRP 0x5410
+#define TIOCOUTQ 0x5411
+#define TIOCSTI 0x5412
+#define TIOCGWINSZ 0x5413
+#define TIOCSWINSZ 0x5414
+#define TIOCMGET 0x5415
+#define TIOCMBIS 0x5416
+#define TIOCMBIC 0x5417
+#define TIOCMSET 0x5418
+#define TIOCGSOFTCAR 0x5419
+#define TIOCSSOFTCAR 0x541A
+#define FIONREAD 0x541B
+#define TIOCINQ FIONREAD
+#define TIOCLINUX 0x541C
+#define TIOCCONS 0x541D
+#define TIOCGSERIAL 0x541E
+#define TIOCSSERIAL 0x541F
+#define TIOCPKT 0x5420
+#define FIONBIO 0x5421
+#define TIOCNOTTY 0x5422
+#define TIOCSETD 0x5423
+#define TIOCGETD 0x5424
+#define TCSBRKP 0x5425  
+#define TIOCSBRK 0x5427  
+#define TIOCCBRK 0x5428  
+#define TIOCGSID 0x5429  
+#define TIOCGPTN _IOR('T',0x30, unsigned int)  
+#define TIOCSPTLCK _IOW('T',0x31, int)  
+
+#define FIONCLEX 0x5450  
+#define FIOCLEX 0x5451
+#define FIOASYNC 0x5452
+#define TIOCSERCONFIG 0x5453
+#define TIOCSERGWILD 0x5454
+#define TIOCSERSWILD 0x5455
+#define TIOCGLCKTRMIOS 0x5456
+#define TIOCSLCKTRMIOS 0x5457
+#define TIOCSERGSTRUCT 0x5458  
+#define TIOCSERGETLSR 0x5459  
+#define TIOCSERGETMULTI 0x545A  
+#define TIOCSERSETMULTI 0x545B  
+
+#define TIOCMIWAIT 0x545C  
+#define TIOCGICOUNT 0x545D  
+#define FIOQSIZE 0x545E
+
+#define TIOCPKT_DATA 0
+#define TIOCPKT_FLUSHREAD 1
+#define TIOCPKT_FLUSHWRITE 2
+#define TIOCPKT_STOP 4
+#define TIOCPKT_START 8
+#define TIOCPKT_NOSTOP 16
+#define TIOCPKT_DOSTOP 32
+
+#define TIOCSER_TEMT 0x01  
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/ipcbuf.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/ipcbuf.h
new file mode 100644
index 0000000..0e47507
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/ipcbuf.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASMARM_IPCBUF_H
+#define __ASMARM_IPCBUF_H
+
+struct ipc64_perm
+{
+ __kernel_key_t key;
+ __kernel_uid32_t uid;
+ __kernel_gid32_t gid;
+ __kernel_uid32_t cuid;
+ __kernel_gid32_t cgid;
+ __kernel_mode_t mode;
+ unsigned short __pad1;
+ unsigned short seq;
+ unsigned short __pad2;
+ unsigned long __unused1;
+ unsigned long __unused2;
+};
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/irq.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/irq.h
new file mode 100644
index 0000000..2085a21
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/irq.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_IRQ_H
+#define __ASM_ARM_IRQ_H
+
+#include <asm/arch/irqs.h>
+
+#ifndef irq_canonicalize
+#define irq_canonicalize(i) (i)
+#endif
+
+#ifndef NR_IRQS
+#define NR_IRQS 128
+#endif
+
+#ifndef NO_IRQ
+#define NO_IRQ ((unsigned int)(-1))
+#endif
+
+struct irqaction;
+
+#define __IRQT_FALEDGE IRQ_TYPE_EDGE_FALLING
+#define __IRQT_RISEDGE IRQ_TYPE_EDGE_RISING
+#define __IRQT_LOWLVL IRQ_TYPE_LEVEL_LOW
+#define __IRQT_HIGHLVL IRQ_TYPE_LEVEL_HIGH
+
+#define IRQT_NOEDGE (0)
+#define IRQT_RISING (__IRQT_RISEDGE)
+#define IRQT_FALLING (__IRQT_FALEDGE)
+#define IRQT_BOTHEDGE (__IRQT_RISEDGE|__IRQT_FALEDGE)
+#define IRQT_LOW (__IRQT_LOWLVL)
+#define IRQT_HIGH (__IRQT_HIGHLVL)
+#define IRQT_PROBE IRQ_TYPE_PROBE
+
+#endif
+
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/linkage.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/linkage.h
new file mode 100644
index 0000000..1fb628e
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/linkage.h
@@ -0,0 +1,18 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_LINKAGE_H
+#define __ASM_LINKAGE_H
+
+#define __ALIGN .align 0
+#define __ALIGN_STR ".align 0"
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/local.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/local.h
new file mode 100644
index 0000000..10d6a60
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/local.h
@@ -0,0 +1,12 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#include <asm-generic/local.h>
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/locks.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/locks.h
new file mode 100644
index 0000000..f48485c
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/locks.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_PROC_LOCKS_H
+#define __ASM_PROC_LOCKS_H
+
+#if __LINUX_ARM_ARCH__ >= 6
+
+#define __down_op(ptr,fail)   ({   __asm__ __volatile__(   "@ down_op\n"  "1:	ldrex	lr, [%0]\n"  "	sub	lr, lr, %1\n"  "	strex	ip, lr, [%0]\n"  "	teq	ip, #0\n"  "	bne	1b\n"  "	teq	lr, #0\n"  "	movmi	ip, %0\n"  "	blmi	" #fail   :   : "r" (ptr), "I" (1)   : "ip", "lr", "cc");   smp_mb();   })
+
+#define __down_op_ret(ptr,fail)   ({   unsigned int ret;   __asm__ __volatile__(   "@ down_op_ret\n"  "1:	ldrex	lr, [%1]\n"  "	sub	lr, lr, %2\n"  "	strex	ip, lr, [%1]\n"  "	teq	ip, #0\n"  "	bne	1b\n"  "	teq	lr, #0\n"  "	movmi	ip, %1\n"  "	movpl	ip, #0\n"  "	blmi	" #fail "\n"  "	mov	%0, ip"   : "=&r" (ret)   : "r" (ptr), "I" (1)   : "ip", "lr", "cc");   smp_mb();   ret;   })
+
+#define __up_op(ptr,wake)   ({   smp_mb();   __asm__ __volatile__(   "@ up_op\n"  "1:	ldrex	lr, [%0]\n"  "	add	lr, lr, %1\n"  "	strex	ip, lr, [%0]\n"  "	teq	ip, #0\n"  "	bne	1b\n"  "	cmp	lr, #0\n"  "	movle	ip, %0\n"  "	blle	" #wake   :   : "r" (ptr), "I" (1)   : "ip", "lr", "cc");   })
+
+#define RW_LOCK_BIAS 0x01000000
+#define RW_LOCK_BIAS_STR "0x01000000"
+
+#define __down_op_write(ptr,fail)   ({   __asm__ __volatile__(   "@ down_op_write\n"  "1:	ldrex	lr, [%0]\n"  "	sub	lr, lr, %1\n"  "	strex	ip, lr, [%0]\n"  "	teq	ip, #0\n"  "	bne	1b\n"  "	teq	lr, #0\n"  "	movne	ip, %0\n"  "	blne	" #fail   :   : "r" (ptr), "I" (RW_LOCK_BIAS)   : "ip", "lr", "cc");   smp_mb();   })
+
+#define __up_op_write(ptr,wake)   ({   smp_mb();   __asm__ __volatile__(   "@ up_op_write\n"  "1:	ldrex	lr, [%0]\n"  "	adds	lr, lr, %1\n"  "	strex	ip, lr, [%0]\n"  "	teq	ip, #0\n"  "	bne	1b\n"  "	movcs	ip, %0\n"  "	blcs	" #wake   :   : "r" (ptr), "I" (RW_LOCK_BIAS)   : "ip", "lr", "cc");   })
+
+#define __down_op_read(ptr,fail)   __down_op(ptr, fail)
+
+#define __up_op_read(ptr,wake)   ({   smp_mb();   __asm__ __volatile__(   "@ up_op_read\n"  "1:	ldrex	lr, [%0]\n"  "	add	lr, lr, %1\n"  "	strex	ip, lr, [%0]\n"  "	teq	ip, #0\n"  "	bne	1b\n"  "	teq	lr, #0\n"  "	moveq	ip, %0\n"  "	bleq	" #wake   :   : "r" (ptr), "I" (1)   : "ip", "lr", "cc");   })
+
+#else
+
+#define __down_op(ptr,fail)   ({   __asm__ __volatile__(   "@ down_op\n"  "	mrs	ip, cpsr\n"  "	orr	lr, ip, #128\n"  "	msr	cpsr_c, lr\n"  "	ldr	lr, [%0]\n"  "	subs	lr, lr, %1\n"  "	str	lr, [%0]\n"  "	msr	cpsr_c, ip\n"  "	movmi	ip, %0\n"  "	blmi	" #fail   :   : "r" (ptr), "I" (1)   : "ip", "lr", "cc");   smp_mb();   })
+
+#define __down_op_ret(ptr,fail)   ({   unsigned int ret;   __asm__ __volatile__(   "@ down_op_ret\n"  "	mrs	ip, cpsr\n"  "	orr	lr, ip, #128\n"  "	msr	cpsr_c, lr\n"  "	ldr	lr, [%1]\n"  "	subs	lr, lr, %2\n"  "	str	lr, [%1]\n"  "	msr	cpsr_c, ip\n"  "	movmi	ip, %1\n"  "	movpl	ip, #0\n"  "	blmi	" #fail "\n"  "	mov	%0, ip"   : "=&r" (ret)   : "r" (ptr), "I" (1)   : "ip", "lr", "cc");   smp_mb();   ret;   })
+
+#define __up_op(ptr,wake)   ({   smp_mb();   __asm__ __volatile__(   "@ up_op\n"  "	mrs	ip, cpsr\n"  "	orr	lr, ip, #128\n"  "	msr	cpsr_c, lr\n"  "	ldr	lr, [%0]\n"  "	adds	lr, lr, %1\n"  "	str	lr, [%0]\n"  "	msr	cpsr_c, ip\n"  "	movle	ip, %0\n"  "	blle	" #wake   :   : "r" (ptr), "I" (1)   : "ip", "lr", "cc");   })
+
+#define RW_LOCK_BIAS 0x01000000
+#define RW_LOCK_BIAS_STR "0x01000000"
+
+#define __down_op_write(ptr,fail)   ({   __asm__ __volatile__(   "@ down_op_write\n"  "	mrs	ip, cpsr\n"  "	orr	lr, ip, #128\n"  "	msr	cpsr_c, lr\n"  "	ldr	lr, [%0]\n"  "	subs	lr, lr, %1\n"  "	str	lr, [%0]\n"  "	msr	cpsr_c, ip\n"  "	movne	ip, %0\n"  "	blne	" #fail   :   : "r" (ptr), "I" (RW_LOCK_BIAS)   : "ip", "lr", "cc");   smp_mb();   })
+
+#define __up_op_write(ptr,wake)   ({   __asm__ __volatile__(   "@ up_op_write\n"  "	mrs	ip, cpsr\n"  "	orr	lr, ip, #128\n"  "	msr	cpsr_c, lr\n"  "	ldr	lr, [%0]\n"  "	adds	lr, lr, %1\n"  "	str	lr, [%0]\n"  "	msr	cpsr_c, ip\n"  "	movcs	ip, %0\n"  "	blcs	" #wake   :   : "r" (ptr), "I" (RW_LOCK_BIAS)   : "ip", "lr", "cc");   smp_mb();   })
+
+#define __down_op_read(ptr,fail)   __down_op(ptr, fail)
+
+#define __up_op_read(ptr,wake)   ({   smp_mb();   __asm__ __volatile__(   "@ up_op_read\n"  "	mrs	ip, cpsr\n"  "	orr	lr, ip, #128\n"  "	msr	cpsr_c, lr\n"  "	ldr	lr, [%0]\n"  "	adds	lr, lr, %1\n"  "	str	lr, [%0]\n"  "	msr	cpsr_c, ip\n"  "	moveq	ip, %0\n"  "	bleq	" #wake   :   : "r" (ptr), "I" (1)   : "ip", "lr", "cc");   })
+
+#endif
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/mc146818rtc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/mc146818rtc.h
new file mode 100644
index 0000000..5a86724
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/mc146818rtc.h
@@ -0,0 +1,26 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_MC146818RTC_H
+#define _ASM_MC146818RTC_H
+
+#include <asm/arch/irqs.h>
+#include <asm/io.h>
+
+#ifndef RTC_PORT
+#define RTC_PORT(x) (0x70 + (x))
+#define RTC_ALWAYS_BCD 1  
+#endif
+
+#define CMOS_READ(addr) ({  outb_p((addr),RTC_PORT(0));  inb_p(RTC_PORT(1));  })
+#define CMOS_WRITE(val, addr) ({  outb_p((addr),RTC_PORT(0));  outb_p((val),RTC_PORT(1));  })
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/memory.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/memory.h
new file mode 100644
index 0000000..c1137a7
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/memory.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_MEMORY_H
+#define __ASM_ARM_MEMORY_H
+
+#ifndef __ASSEMBLY__
+#define UL(x) (x##UL)
+#else
+#define UL(x) (x)
+#endif
+
+#include <linux/compiler.h>
+#include <asm/arch/memory.h>
+#include <asm/sizes.h>
+
+#ifndef TASK_SIZE
+#define TASK_SIZE (CONFIG_DRAM_SIZE)
+#endif
+
+#ifndef TASK_UNMAPPED_BASE
+#define TASK_UNMAPPED_BASE UL(0x00000000)
+#endif
+
+#ifndef PHYS_OFFSET
+#define PHYS_OFFSET (CONFIG_DRAM_BASE)
+#endif
+
+#ifndef END_MEM
+#define END_MEM (CONFIG_DRAM_BASE + CONFIG_DRAM_SIZE)
+#endif
+
+#ifndef PAGE_OFFSET
+#define PAGE_OFFSET (PHYS_OFFSET)
+#endif
+
+#define MODULE_END (END_MEM)
+#define MODULE_START (PHYS_OFFSET)
+
+#ifndef CONSISTENT_DMA_SIZE
+#define CONSISTENT_DMA_SIZE SZ_2M
+#endif
+
+#ifndef __virt_to_phys
+#define __virt_to_phys(x) ((x) - PAGE_OFFSET + PHYS_OFFSET)
+#define __phys_to_virt(x) ((x) - PHYS_OFFSET + PAGE_OFFSET)
+#endif
+
+#define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT)
+#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
+
+#ifndef __ASSEMBLY__
+
+#ifndef ISA_DMA_THRESHOLD
+#define ISA_DMA_THRESHOLD (0xffffffffULL)
+#endif
+
+#ifndef arch_adjust_zones
+#define arch_adjust_zones(node,size,holes) do { } while (0)
+#endif
+
+#define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT)
+
+#define __pa(x) __virt_to_phys((unsigned long)(x))
+#define __va(x) ((void *)__phys_to_virt((unsigned long)(x)))
+#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
+#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
+#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
+#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
+#define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory)
+#define PHYS_TO_NID(addr) (0)
+#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
+#ifndef __arch_page_to_dma
+#define page_to_dma(dev, page) ((dma_addr_t)__virt_to_bus((unsigned long)page_address(page)))
+#define dma_to_virt(dev, addr) ((void *)__bus_to_virt(addr))
+#define virt_to_dma(dev, addr) ((dma_addr_t)__virt_to_bus((unsigned long)(addr)))
+#else
+#define page_to_dma(dev, page) (__arch_page_to_dma(dev, page))
+#define dma_to_virt(dev, addr) (__arch_dma_to_virt(dev, addr))
+#define virt_to_dma(dev, addr) (__arch_virt_to_dma(dev, addr))
+#endif
+#ifndef arch_is_coherent
+#define arch_is_coherent() 0
+#endif
+#endif
+#include <asm-generic/memory_model.h>
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/mman.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/mman.h
new file mode 100644
index 0000000..8f71d1b
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/mman.h
@@ -0,0 +1,28 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ARM_MMAN_H__
+#define __ARM_MMAN_H__
+
+#include <asm-generic/mman.h>
+
+#define MAP_GROWSDOWN 0x0100  
+#define MAP_DENYWRITE 0x0800  
+#define MAP_EXECUTABLE 0x1000  
+#define MAP_LOCKED 0x2000  
+#define MAP_NORESERVE 0x4000  
+#define MAP_POPULATE 0x8000  
+#define MAP_NONBLOCK 0x10000  
+
+#define MCL_CURRENT 1  
+#define MCL_FUTURE 2  
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/module.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/module.h
new file mode 100644
index 0000000..68b806a
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/module.h
@@ -0,0 +1,26 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_ARM_MODULE_H
+#define _ASM_ARM_MODULE_H
+
+struct mod_arch_specific
+{
+ int foo;
+};
+
+#define Elf_Shdr Elf32_Shdr
+#define Elf_Sym Elf32_Sym
+#define Elf_Ehdr Elf32_Ehdr
+
+#define MODULE_ARCH_VERMAGIC "ARMv" __stringify(__LINUX_ARM_ARCH__) " "
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/msgbuf.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/msgbuf.h
new file mode 100644
index 0000000..84d614c
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/msgbuf.h
@@ -0,0 +1,32 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_MSGBUF_H
+#define _ASMARM_MSGBUF_H
+
+struct msqid64_ds {
+ struct ipc64_perm msg_perm;
+ __kernel_time_t msg_stime;
+ unsigned long __unused1;
+ __kernel_time_t msg_rtime;
+ unsigned long __unused2;
+ __kernel_time_t msg_ctime;
+ unsigned long __unused3;
+ unsigned long msg_cbytes;
+ unsigned long msg_qnum;
+ unsigned long msg_qbytes;
+ __kernel_pid_t msg_lspid;
+ __kernel_pid_t msg_lrpid;
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/mtd-xip.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/mtd-xip.h
new file mode 100644
index 0000000..6c53f6f
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/mtd-xip.h
@@ -0,0 +1,20 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ARM_MTD_XIP_H__
+#define __ARM_MTD_XIP_H__
+
+#include <asm/hardware.h>
+#include <asm/arch/mtd-xip.h>
+
+#define xip_iprefetch() do { asm volatile (".rep 8; nop; .endr"); } while (0)
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/page.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/page.h
new file mode 100644
index 0000000..f980343
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/page.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_PAGE_H
+#define _ASMARM_PAGE_H
+
+#define PAGE_SHIFT 12
+#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#define PAGE_MASK (~(PAGE_SIZE-1))
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/param.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/param.h
new file mode 100644
index 0000000..6814fe3
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/param.h
@@ -0,0 +1,25 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_PARAM_H
+#define __ASM_PARAM_H
+
+#define HZ 100
+
+#define EXEC_PAGESIZE 4096
+
+#ifndef NOGROUP
+#define NOGROUP (-1)
+#endif
+
+
+#endif
+
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/percpu.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/percpu.h
new file mode 100644
index 0000000..2500345
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/percpu.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ARM_PERCPU
+#define __ARM_PERCPU
+
+#include <asm-generic/percpu.h>
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/pgalloc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/pgalloc.h
new file mode 100644
index 0000000..5d45e65
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/pgalloc.h
@@ -0,0 +1,23 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_PGALLOC_H
+#define _ASMARM_PGALLOC_H
+
+#include <asm/domain.h>
+#include <asm/pgtable-hwdef.h>
+#include <asm/processor.h>
+#include <asm/cacheflush.h>
+#include <asm/tlbflush.h>
+
+#define check_pgt_cache() do { } while (0)
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/pgtable-hwdef.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/pgtable-hwdef.h
new file mode 100644
index 0000000..47e8675
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/pgtable-hwdef.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_PGTABLE_HWDEF_H
+#define _ASMARM_PGTABLE_HWDEF_H
+
+#define PMD_TYPE_MASK (3 << 0)
+#define PMD_TYPE_FAULT (0 << 0)
+#define PMD_TYPE_TABLE (1 << 0)
+#define PMD_TYPE_SECT (2 << 0)
+#define PMD_BIT4 (1 << 4)
+#define PMD_DOMAIN(x) ((x) << 5)
+#define PMD_PROTECTION (1 << 9)  
+
+#define PMD_SECT_BUFFERABLE (1 << 2)
+#define PMD_SECT_CACHEABLE (1 << 3)
+#define PMD_SECT_XN (1 << 4)  
+#define PMD_SECT_AP_WRITE (1 << 10)
+#define PMD_SECT_AP_READ (1 << 11)
+#define PMD_SECT_TEX(x) ((x) << 12)  
+#define PMD_SECT_APX (1 << 15)  
+#define PMD_SECT_S (1 << 16)  
+#define PMD_SECT_nG (1 << 17)  
+#define PMD_SECT_SUPER (1 << 18)  
+
+#define PMD_SECT_UNCACHED (0)
+#define PMD_SECT_BUFFERED (PMD_SECT_BUFFERABLE)
+#define PMD_SECT_WT (PMD_SECT_CACHEABLE)
+#define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
+#define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE)
+#define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
+#define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2))
+
+#define PTE_TYPE_MASK (3 << 0)
+#define PTE_TYPE_FAULT (0 << 0)
+#define PTE_TYPE_LARGE (1 << 0)
+#define PTE_TYPE_SMALL (2 << 0)
+#define PTE_TYPE_EXT (3 << 0)  
+#define PTE_BUFFERABLE (1 << 2)
+#define PTE_CACHEABLE (1 << 3)
+
+#define PTE_EXT_XN (1 << 0)  
+#define PTE_EXT_AP_MASK (3 << 4)
+#define PTE_EXT_AP0 (1 << 4)
+#define PTE_EXT_AP1 (2 << 4)
+#define PTE_EXT_AP_UNO_SRO (0 << 4)
+#define PTE_EXT_AP_UNO_SRW (PTE_EXT_AP0)
+#define PTE_EXT_AP_URO_SRW (PTE_EXT_AP1)
+#define PTE_EXT_AP_URW_SRW (PTE_EXT_AP1|PTE_EXT_AP0)
+#define PTE_EXT_TEX(x) ((x) << 6)  
+#define PTE_EXT_APX (1 << 9)  
+#define PTE_EXT_COHERENT (1 << 9)  
+#define PTE_EXT_SHARED (1 << 10)  
+#define PTE_EXT_NG (1 << 11)  
+
+#define PTE_SMALL_AP_MASK (0xff << 4)
+#define PTE_SMALL_AP_UNO_SRO (0x00 << 4)
+#define PTE_SMALL_AP_UNO_SRW (0x55 << 4)
+#define PTE_SMALL_AP_URO_SRW (0xaa << 4)
+#define PTE_SMALL_AP_URW_SRW (0xff << 4)
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/pgtable.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/pgtable.h
new file mode 100644
index 0000000..cbac611
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/pgtable.h
@@ -0,0 +1,20 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_PGTABLE_H
+#define _ASMARM_PGTABLE_H
+
+#include <asm-generic/4level-fixup.h>
+#include <asm/proc-fns.h>
+
+#include "pgtable-nommu.h"
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/poll.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/poll.h
new file mode 100644
index 0000000..c5b80a5
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/poll.h
@@ -0,0 +1,36 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASMARM_POLL_H
+#define __ASMARM_POLL_H
+
+#define POLLIN 0x0001
+#define POLLPRI 0x0002
+#define POLLOUT 0x0004
+#define POLLERR 0x0008
+#define POLLHUP 0x0010
+#define POLLNVAL 0x0020
+
+#define POLLRDNORM 0x0040
+#define POLLRDBAND 0x0080
+#define POLLWRNORM 0x0100
+#define POLLWRBAND 0x0200
+#define POLLMSG 0x0400
+#define POLLREMOVE 0x1000
+#define POLLRDHUP 0x2000
+
+struct pollfd {
+ int fd;
+ short events;
+ short revents;
+};
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/posix_types.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/posix_types.h
new file mode 100644
index 0000000..bc85217
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/posix_types.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ARCH_ARM_POSIX_TYPES_H
+#define __ARCH_ARM_POSIX_TYPES_H
+
+typedef unsigned long __kernel_ino_t;
+typedef unsigned short __kernel_mode_t;
+typedef unsigned short __kernel_nlink_t;
+typedef long __kernel_off_t;
+typedef int __kernel_pid_t;
+typedef unsigned short __kernel_ipc_pid_t;
+typedef unsigned short __kernel_uid_t;
+typedef unsigned short __kernel_gid_t;
+typedef unsigned int __kernel_size_t;
+typedef int __kernel_ssize_t;
+typedef int __kernel_ptrdiff_t;
+typedef long __kernel_time_t;
+typedef long __kernel_suseconds_t;
+typedef long __kernel_clock_t;
+typedef int __kernel_timer_t;
+typedef int __kernel_clockid_t;
+typedef int __kernel_daddr_t;
+typedef char * __kernel_caddr_t;
+typedef unsigned short __kernel_uid16_t;
+typedef unsigned short __kernel_gid16_t;
+typedef unsigned int __kernel_uid32_t;
+typedef unsigned int __kernel_gid32_t;
+
+typedef unsigned short __kernel_old_uid_t;
+typedef unsigned short __kernel_old_gid_t;
+typedef unsigned short __kernel_old_dev_t;
+
+#ifdef __GNUC__
+typedef long long __kernel_loff_t;
+#endif
+
+typedef struct {
+#ifdef __USE_ALL
+ int val[2];
+#else
+ int __val[2];
+#endif
+} __kernel_fsid_t;
+
+#if !defined(__GLIBC__) || __GLIBC__ < 2
+
+#undef __FD_SET
+#define __FD_SET(fd, fdsetp)   (((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] |= (1<<((fd) & 31)))
+
+#undef __FD_CLR
+#define __FD_CLR(fd, fdsetp)   (((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] &= ~(1<<((fd) & 31)))
+
+#undef __FD_ISSET
+#define __FD_ISSET(fd, fdsetp)   ((((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] & (1<<((fd) & 31))) != 0)
+
+#undef __FD_ZERO
+#define __FD_ZERO(fdsetp)   (memset (fdsetp, 0, sizeof (*(fd_set *)(fdsetp))))
+
+#endif
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/proc-fns.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/proc-fns.h
new file mode 100644
index 0000000..4a560d0
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/proc-fns.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_PROCFNS_H
+#define __ASM_PROCFNS_H
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/processor.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/processor.h
new file mode 100644
index 0000000..f93cbc1
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/processor.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_PROCESSOR_H
+#define __ASM_ARM_PROCESSOR_H
+
+#define current_text_addr() ({ __label__ _l; _l: &&_l;})
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/procinfo.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/procinfo.h
new file mode 100644
index 0000000..d774e0b
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/procinfo.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_PROCINFO_H
+#define __ASM_PROCINFO_H
+
+#ifndef __ASSEMBLY__
+
+struct cpu_tlb_fns;
+struct cpu_user_fns;
+struct cpu_cache_fns;
+struct processor;
+
+struct proc_info_list {
+ unsigned int cpu_val;
+ unsigned int cpu_mask;
+ unsigned long __cpu_mm_mmu_flags;
+ unsigned long __cpu_io_mmu_flags;
+ unsigned long __cpu_flush;
+ const char *arch_name;
+ const char *elf_name;
+ unsigned int elf_hwcap;
+ const char *cpu_name;
+ struct processor *proc;
+ struct cpu_tlb_fns *tlb;
+ struct cpu_user_fns *user;
+ struct cpu_cache_fns *cache;
+};
+
+#endif
+
+#define HWCAP_SWP 1
+#define HWCAP_HALF 2
+#define HWCAP_THUMB 4
+#define HWCAP_26BIT 8  
+#define HWCAP_FAST_MULT 16
+#define HWCAP_FPA 32
+#define HWCAP_VFP 64
+#define HWCAP_EDSP 128
+#define HWCAP_JAVA 256
+#define HWCAP_IWMMXT 512
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/ptrace.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/ptrace.h
new file mode 100644
index 0000000..c6dfea1
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/ptrace.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_PTRACE_H
+#define __ASM_ARM_PTRACE_H
+
+#define PTRACE_GETREGS 12
+#define PTRACE_SETREGS 13
+#define PTRACE_GETFPREGS 14
+#define PTRACE_SETFPREGS 15
+
+#define PTRACE_GETWMMXREGS 18
+#define PTRACE_SETWMMXREGS 19
+
+#define PTRACE_OLDSETOPTIONS 21
+
+#define PTRACE_GET_THREAD_AREA 22
+
+#define PTRACE_SET_SYSCALL 23
+
+#define PTRACE_GETCRUNCHREGS 25
+#define PTRACE_SETCRUNCHREGS 26
+
+#define USR26_MODE 0x00000000
+#define FIQ26_MODE 0x00000001
+#define IRQ26_MODE 0x00000002
+#define SVC26_MODE 0x00000003
+#define USR_MODE 0x00000010
+#define FIQ_MODE 0x00000011
+#define IRQ_MODE 0x00000012
+#define SVC_MODE 0x00000013
+#define ABT_MODE 0x00000017
+#define UND_MODE 0x0000001b
+#define SYSTEM_MODE 0x0000001f
+#define MODE32_BIT 0x00000010
+#define MODE_MASK 0x0000001f
+#define PSR_T_BIT 0x00000020
+#define PSR_F_BIT 0x00000040
+#define PSR_I_BIT 0x00000080
+#define PSR_J_BIT 0x01000000
+#define PSR_Q_BIT 0x08000000
+#define PSR_V_BIT 0x10000000
+#define PSR_C_BIT 0x20000000
+#define PSR_Z_BIT 0x40000000
+#define PSR_N_BIT 0x80000000
+#define PCMASK 0
+
+#define PSR_f 0xff000000  
+#define PSR_s 0x00ff0000  
+#define PSR_x 0x0000ff00  
+#define PSR_c 0x000000ff  
+
+#ifndef __ASSEMBLY__
+
+struct pt_regs {
+ long uregs[18];
+};
+
+#define ARM_cpsr uregs[16]
+#define ARM_pc uregs[15]
+#define ARM_lr uregs[14]
+#define ARM_sp uregs[13]
+#define ARM_ip uregs[12]
+#define ARM_fp uregs[11]
+#define ARM_r10 uregs[10]
+#define ARM_r9 uregs[9]
+#define ARM_r8 uregs[8]
+#define ARM_r7 uregs[7]
+#define ARM_r6 uregs[6]
+#define ARM_r5 uregs[5]
+#define ARM_r4 uregs[4]
+#define ARM_r3 uregs[3]
+#define ARM_r2 uregs[2]
+#define ARM_r1 uregs[1]
+#define ARM_r0 uregs[0]
+#define ARM_ORIG_r0 uregs[17]
+
+#define pc_pointer(v)   ((v) & ~PCMASK)
+
+#define instruction_pointer(regs)   (pc_pointer((regs)->ARM_pc))
+
+#define profile_pc(regs) instruction_pointer(regs)
+
+#endif
+
+#endif
+
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/resource.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/resource.h
new file mode 100644
index 0000000..7546dd4
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/resource.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ARM_RESOURCE_H
+#define _ARM_RESOURCE_H
+
+#include <asm-generic/resource.h>
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/scatterlist.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/scatterlist.h
new file mode 100644
index 0000000..a2c06ca
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/scatterlist.h
@@ -0,0 +1,28 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_SCATTERLIST_H
+#define _ASMARM_SCATTERLIST_H
+
+#include <asm/memory.h>
+#include <asm/types.h>
+
+struct scatterlist {
+ struct page *page;
+ unsigned int offset;
+ dma_addr_t dma_address;
+ unsigned int length;
+};
+
+#define sg_dma_address(sg) ((sg)->dma_address)
+#define sg_dma_len(sg) ((sg)->length)
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/semaphore.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/semaphore.h
new file mode 100644
index 0000000..7c5618a
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/semaphore.h
@@ -0,0 +1,36 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_SEMAPHORE_H
+#define __ASM_ARM_SEMAPHORE_H
+
+#include <linux/linkage.h>
+#include <linux/spinlock.h>
+#include <linux/wait.h>
+#include <linux/rwsem.h>
+
+#include <asm/atomic.h>
+#include <asm/locks.h>
+
+struct semaphore {
+ atomic_t count;
+ int sleepers;
+ wait_queue_head_t wait;
+};
+
+#define __SEMAPHORE_INIT(name, cnt)  {   .count = ATOMIC_INIT(cnt),   .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait),  }
+
+#define __DECLARE_SEMAPHORE_GENERIC(name,count)   struct semaphore name = __SEMAPHORE_INIT(name,count)
+
+#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
+#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/sembuf.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/sembuf.h
new file mode 100644
index 0000000..a2f5dd0
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/sembuf.h
@@ -0,0 +1,26 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_SEMBUF_H
+#define _ASMARM_SEMBUF_H
+
+struct semid64_ds {
+ struct ipc64_perm sem_perm;
+ __kernel_time_t sem_otime;
+ unsigned long __unused1;
+ __kernel_time_t sem_ctime;
+ unsigned long __unused2;
+ unsigned long sem_nsems;
+ unsigned long __unused3;
+ unsigned long __unused4;
+};
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/shmbuf.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/shmbuf.h
new file mode 100644
index 0000000..1d4d78c
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/shmbuf.h
@@ -0,0 +1,43 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_SHMBUF_H
+#define _ASMARM_SHMBUF_H
+
+struct shmid64_ds {
+ struct ipc64_perm shm_perm;
+ size_t shm_segsz;
+ __kernel_time_t shm_atime;
+ unsigned long __unused1;
+ __kernel_time_t shm_dtime;
+ unsigned long __unused2;
+ __kernel_time_t shm_ctime;
+ unsigned long __unused3;
+ __kernel_pid_t shm_cpid;
+ __kernel_pid_t shm_lpid;
+ unsigned long shm_nattch;
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+
+struct shminfo64 {
+ unsigned long shmmax;
+ unsigned long shmmin;
+ unsigned long shmmni;
+ unsigned long shmseg;
+ unsigned long shmall;
+ unsigned long __unused1;
+ unsigned long __unused2;
+ unsigned long __unused3;
+ unsigned long __unused4;
+};
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/shmparam.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/shmparam.h
new file mode 100644
index 0000000..ea53a8d
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/shmparam.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_SHMPARAM_H
+#define _ASMARM_SHMPARAM_H
+
+#define SHMLBA (4 * PAGE_SIZE)  
+
+#define __ARCH_FORCE_SHMLBA
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/sigcontext.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/sigcontext.h
new file mode 100644
index 0000000..3c4fcf3
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/sigcontext.h
@@ -0,0 +1,39 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_SIGCONTEXT_H
+#define _ASMARM_SIGCONTEXT_H
+
+struct sigcontext {
+ unsigned long trap_no;
+ unsigned long error_code;
+ unsigned long oldmask;
+ unsigned long arm_r0;
+ unsigned long arm_r1;
+ unsigned long arm_r2;
+ unsigned long arm_r3;
+ unsigned long arm_r4;
+ unsigned long arm_r5;
+ unsigned long arm_r6;
+ unsigned long arm_r7;
+ unsigned long arm_r8;
+ unsigned long arm_r9;
+ unsigned long arm_r10;
+ unsigned long arm_fp;
+ unsigned long arm_ip;
+ unsigned long arm_sp;
+ unsigned long arm_lr;
+ unsigned long arm_pc;
+ unsigned long arm_cpsr;
+ unsigned long fault_address;
+};
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/siginfo.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/siginfo.h
new file mode 100644
index 0000000..225685e
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/siginfo.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_SIGINFO_H
+#define _ASMARM_SIGINFO_H
+
+#include <asm-generic/siginfo.h>
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/signal.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/signal.h
new file mode 100644
index 0000000..212d9f1
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/signal.h
@@ -0,0 +1,103 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_SIGNAL_H
+#define _ASMARM_SIGNAL_H
+
+#include <linux/types.h>
+
+struct siginfo;
+
+#define NSIG 32
+typedef unsigned long sigset_t;
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT 6
+#define SIGBUS 7
+#define SIGFPE 8
+#define SIGKILL 9
+#define SIGUSR1 10
+#define SIGSEGV 11
+#define SIGUSR2 12
+#define SIGPIPE 13
+#define SIGALRM 14
+#define SIGTERM 15
+#define SIGSTKFLT 16
+#define SIGCHLD 17
+#define SIGCONT 18
+#define SIGSTOP 19
+#define SIGTSTP 20
+#define SIGTTIN 21
+#define SIGTTOU 22
+#define SIGURG 23
+#define SIGXCPU 24
+#define SIGXFSZ 25
+#define SIGVTALRM 26
+#define SIGPROF 27
+#define SIGWINCH 28
+#define SIGIO 29
+#define SIGPOLL SIGIO
+
+#define SIGPWR 30
+#define SIGSYS 31
+#define SIGUNUSED 31
+
+#define SIGRTMIN 32
+#define SIGRTMAX _NSIG
+
+#define SIGSWI 32
+
+#define SA_NOCLDSTOP 0x00000001
+#define SA_NOCLDWAIT 0x00000002
+#define SA_SIGINFO 0x00000004
+#define SA_THIRTYTWO 0x02000000
+#define SA_RESTORER 0x04000000
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+
+#define SA_NOMASK SA_NODEFER
+#define SA_ONESHOT SA_RESETHAND
+
+#define SS_ONSTACK 1
+#define SS_DISABLE 2
+
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+
+#include <asm-generic/signal.h>
+
+struct sigaction {
+ union {
+ __sighandler_t _sa_handler;
+ void (*_sa_sigaction)(int, struct siginfo *, void *);
+ } _u;
+ sigset_t sa_mask;
+ unsigned long sa_flags;
+ void (*sa_restorer)(void);
+};
+
+#define sa_handler _u._sa_handler
+#define sa_sigaction _u._sa_sigaction
+
+typedef struct sigaltstack {
+ void __user *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+} stack_t;
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/sizes.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/sizes.h
new file mode 100644
index 0000000..90c1c71
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/sizes.h
@@ -0,0 +1,39 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __sizes_h
+#define __sizes_h 1
+
+#define SZ_1K 0x00000400
+#define SZ_4K 0x00001000
+#define SZ_8K 0x00002000
+#define SZ_16K 0x00004000
+#define SZ_64K 0x00010000
+#define SZ_128K 0x00020000
+#define SZ_256K 0x00040000
+#define SZ_512K 0x00080000
+
+#define SZ_1M 0x00100000
+#define SZ_2M 0x00200000
+#define SZ_4M 0x00400000
+#define SZ_8M 0x00800000
+#define SZ_16M 0x01000000
+#define SZ_32M 0x02000000
+#define SZ_64M 0x04000000
+#define SZ_128M 0x08000000
+#define SZ_256M 0x10000000
+#define SZ_512M 0x20000000
+
+#define SZ_1G 0x40000000
+#define SZ_2G 0x80000000
+
+#endif
+
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/smp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/smp.h
new file mode 100644
index 0000000..e6c1e41
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/smp.h
@@ -0,0 +1,34 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_SMP_H
+#define __ASM_ARM_SMP_H
+
+#include <linux/threads.h>
+#include <linux/cpumask.h>
+#include <linux/thread_info.h>
+
+#include <asm/arch/smp.h>
+
+#error "<asm-arm/smp.h> included in non-SMP build"
+
+#define raw_smp_processor_id() (current_thread_info()->cpu)
+
+#define PROC_CHANGE_PENALTY 15
+
+struct seq_file;
+
+struct secondary_data {
+ unsigned long pgdir;
+ void *stack;
+};
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/socket.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/socket.h
new file mode 100644
index 0000000..1f0050a
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/socket.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_SOCKET_H
+#define _ASMARM_SOCKET_H
+
+#include <asm/sockios.h>
+
+#define SOL_SOCKET 1
+
+#define SO_DEBUG 1
+#define SO_REUSEADDR 2
+#define SO_TYPE 3
+#define SO_ERROR 4
+#define SO_DONTROUTE 5
+#define SO_BROADCAST 6
+#define SO_SNDBUF 7
+#define SO_RCVBUF 8
+#define SO_SNDBUFFORCE 32
+#define SO_RCVBUFFORCE 33
+#define SO_KEEPALIVE 9
+#define SO_OOBINLINE 10
+#define SO_NO_CHECK 11
+#define SO_PRIORITY 12
+#define SO_LINGER 13
+#define SO_BSDCOMPAT 14
+
+#define SO_PASSCRED 16
+#define SO_PEERCRED 17
+#define SO_RCVLOWAT 18
+#define SO_SNDLOWAT 19
+#define SO_RCVTIMEO 20
+#define SO_SNDTIMEO 21
+
+#define SO_SECURITY_AUTHENTICATION 22
+#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
+#define SO_SECURITY_ENCRYPTION_NETWORK 24
+
+#define SO_BINDTODEVICE 25
+
+#define SO_ATTACH_FILTER 26
+#define SO_DETACH_FILTER 27
+
+#define SO_PEERNAME 28
+#define SO_TIMESTAMP 29
+#define SCM_TIMESTAMP SO_TIMESTAMP
+
+#define SO_ACCEPTCONN 30
+
+#define SO_PEERSEC 31
+#define SO_PASSSEC 34
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/sockios.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/sockios.h
new file mode 100644
index 0000000..cab86b8
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/sockios.h
@@ -0,0 +1,22 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ARCH_ARM_SOCKIOS_H
+#define __ARCH_ARM_SOCKIOS_H
+
+#define FIOSETOWN 0x8901
+#define SIOCSPGRP 0x8902
+#define FIOGETOWN 0x8903
+#define SIOCGPGRP 0x8904
+#define SIOCATMARK 0x8905
+#define SIOCGSTAMP 0x8906  
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/spinlock.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/spinlock.h
new file mode 100644
index 0000000..3ae2173
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/spinlock.h
@@ -0,0 +1,27 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_SPINLOCK_H
+#define __ASM_SPINLOCK_H
+
+#if __LINUX_ARM_ARCH__ < 6
+#error SMP not supported on pre-ARMv6 CPUs
+#endif
+
+#define __raw_spin_is_locked(x) ((x)->lock != 0)
+#define __raw_spin_unlock_wait(lock)   do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0)
+
+#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
+
+#define rwlock_is_locked(x) (*((volatile unsigned int *)(x)) != 0)
+#define __raw_write_can_lock(x) ((x)->lock == 0x80000000)
+#define __raw_read_can_lock(x) ((x)->lock < 0x80000000)
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/spinlock_types.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/spinlock_types.h
new file mode 100644
index 0000000..ee77f20
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/spinlock_types.h
@@ -0,0 +1,31 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_SPINLOCK_TYPES_H
+#define __ASM_SPINLOCK_TYPES_H
+
+#ifndef __LINUX_SPINLOCK_TYPES_H
+#error "please don't include this file directly"
+#endif
+
+typedef struct {
+ volatile unsigned int lock;
+} raw_spinlock_t;
+
+#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
+
+typedef struct {
+ volatile unsigned int lock;
+} raw_rwlock_t;
+
+#define __RAW_RW_LOCK_UNLOCKED { 0 }
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/stat.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/stat.h
new file mode 100644
index 0000000..49b85f9
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/stat.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_STAT_H
+#define _ASMARM_STAT_H
+
+struct __old_kernel_stat {
+ unsigned short st_dev;
+ unsigned short st_ino;
+ unsigned short st_mode;
+ unsigned short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+ unsigned short st_rdev;
+ unsigned long st_size;
+ unsigned long st_atime;
+ unsigned long st_mtime;
+ unsigned long st_ctime;
+};
+
+#define STAT_HAVE_NSEC 
+
+struct stat {
+#ifdef __ARMEB__
+ unsigned short st_dev;
+ unsigned short __pad1;
+#else
+ unsigned long st_dev;
+#endif
+ unsigned long st_ino;
+ unsigned short st_mode;
+ unsigned short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+#ifdef __ARMEB__
+ unsigned short st_rdev;
+ unsigned short __pad2;
+#else
+ unsigned long st_rdev;
+#endif
+ unsigned long st_size;
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ unsigned long st_atime;
+ unsigned long st_atime_nsec;
+ unsigned long st_mtime;
+ unsigned long st_mtime_nsec;
+ unsigned long st_ctime;
+ unsigned long st_ctime_nsec;
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+
+struct stat64 {
+ unsigned long long st_dev;
+ unsigned char __pad0[4];
+
+#define STAT64_HAS_BROKEN_ST_INO 1
+ unsigned long __st_ino;
+ unsigned int st_mode;
+ unsigned int st_nlink;
+
+ unsigned long st_uid;
+ unsigned long st_gid;
+
+ unsigned long long st_rdev;
+ unsigned char __pad3[4];
+
+ long long st_size;
+ unsigned long st_blksize;
+ unsigned long long st_blocks;
+
+ unsigned long st_atime;
+ unsigned long st_atime_nsec;
+
+ unsigned long st_mtime;
+ unsigned long st_mtime_nsec;
+
+ unsigned long st_ctime;
+ unsigned long st_ctime_nsec;
+
+ unsigned long long st_ino;
+};
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/statfs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/statfs.h
new file mode 100644
index 0000000..7963eab
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/statfs.h
@@ -0,0 +1,43 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_STATFS_H
+#define _ASMARM_STATFS_H
+
+struct statfs {
+ __u32 f_type;
+ __u32 f_bsize;
+ __u32 f_blocks;
+ __u32 f_bfree;
+ __u32 f_bavail;
+ __u32 f_files;
+ __u32 f_ffree;
+ __kernel_fsid_t f_fsid;
+ __u32 f_namelen;
+ __u32 f_frsize;
+ __u32 f_spare[5];
+};
+
+struct statfs64 {
+ __u32 f_type;
+ __u32 f_bsize;
+ __u64 f_blocks;
+ __u64 f_bfree;
+ __u64 f_bavail;
+ __u64 f_files;
+ __u64 f_ffree;
+ __kernel_fsid_t f_fsid;
+ __u32 f_namelen;
+ __u32 f_frsize;
+ __u32 f_spare[5];
+} __attribute__ ((packed,aligned(4)));
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/suspend.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/suspend.h
new file mode 100644
index 0000000..156c171
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/suspend.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_SUSPEND_H
+#define _ASMARM_SUSPEND_H
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/system.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/system.h
new file mode 100644
index 0000000..8e85039
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/system.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_SYSTEM_H
+#define __ASM_ARM_SYSTEM_H
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/termbits.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/termbits.h
new file mode 100644
index 0000000..640bd27
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/termbits.h
@@ -0,0 +1,174 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_TERMBITS_H
+#define __ASM_ARM_TERMBITS_H
+
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+
+#define NCCS 19
+struct termios {
+ tcflag_t c_iflag;
+ tcflag_t c_oflag;
+ tcflag_t c_cflag;
+ tcflag_t c_lflag;
+ cc_t c_line;
+ cc_t c_cc[NCCS];
+};
+
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VEOF 4
+#define VTIME 5
+#define VMIN 6
+#define VSWTC 7
+#define VSTART 8
+#define VSTOP 9
+#define VSUSP 10
+#define VEOL 11
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE 14
+#define VLNEXT 15
+#define VEOL2 16
+
+#define IGNBRK 0000001
+#define BRKINT 0000002
+#define IGNPAR 0000004
+#define PARMRK 0000010
+#define INPCK 0000020
+#define ISTRIP 0000040
+#define INLCR 0000100
+#define IGNCR 0000200
+#define ICRNL 0000400
+#define IUCLC 0001000
+#define IXON 0002000
+#define IXANY 0004000
+#define IXOFF 0010000
+#define IMAXBEL 0020000
+#define IUTF8 0040000
+
+#define OPOST 0000001
+#define OLCUC 0000002
+#define ONLCR 0000004
+#define OCRNL 0000010
+#define ONOCR 0000020
+#define ONLRET 0000040
+#define OFILL 0000100
+#define OFDEL 0000200
+#define NLDLY 0000400
+#define NL0 0000000
+#define NL1 0000400
+#define CRDLY 0003000
+#define CR0 0000000
+#define CR1 0001000
+#define CR2 0002000
+#define CR3 0003000
+#define TABDLY 0014000
+#define TAB0 0000000
+#define TAB1 0004000
+#define TAB2 0010000
+#define TAB3 0014000
+#define XTABS 0014000
+#define BSDLY 0020000
+#define BS0 0000000
+#define BS1 0020000
+#define VTDLY 0040000
+#define VT0 0000000
+#define VT1 0040000
+#define FFDLY 0100000
+#define FF0 0000000
+#define FF1 0100000
+
+#define CBAUD 0010017
+#define B0 0000000  
+#define B50 0000001
+#define B75 0000002
+#define B110 0000003
+#define B134 0000004
+#define B150 0000005
+#define B200 0000006
+#define B300 0000007
+#define B600 0000010
+#define B1200 0000011
+#define B1800 0000012
+#define B2400 0000013
+#define B4800 0000014
+#define B9600 0000015
+#define B19200 0000016
+#define B38400 0000017
+#define EXTA B19200
+#define EXTB B38400
+#define CSIZE 0000060
+#define CS5 0000000
+#define CS6 0000020
+#define CS7 0000040
+#define CS8 0000060
+#define CSTOPB 0000100
+#define CREAD 0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL 0002000
+#define CLOCAL 0004000
+#define CBAUDEX 0010000
+#define B57600 0010001
+#define B115200 0010002
+#define B230400 0010003
+#define B460800 0010004
+#define B500000 0010005
+#define B576000 0010006
+#define B921600 0010007
+#define B1000000 0010010
+#define B1152000 0010011
+#define B1500000 0010012
+#define B2000000 0010013
+#define B2500000 0010014
+#define B3000000 0010015
+#define B3500000 0010016
+#define B4000000 0010017
+#define CIBAUD 002003600000  
+#define CMSPAR 010000000000  
+#define CRTSCTS 020000000000  
+
+#define ISIG 0000001
+#define ICANON 0000002
+#define XCASE 0000004
+#define ECHO 0000010
+#define ECHOE 0000020
+#define ECHOK 0000040
+#define ECHONL 0000100
+#define NOFLSH 0000200
+#define TOSTOP 0000400
+#define ECHOCTL 0001000
+#define ECHOPRT 0002000
+#define ECHOKE 0004000
+#define FLUSHO 0010000
+#define PENDIN 0040000
+#define IEXTEN 0100000
+
+#define TCOOFF 0
+#define TCOON 1
+#define TCIOFF 2
+#define TCION 3
+
+#define TCIFLUSH 0
+#define TCOFLUSH 1
+#define TCIOFLUSH 2
+
+#define TCSANOW 0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/termios.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/termios.h
new file mode 100644
index 0000000..ba43ac2
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/termios.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_TERMIOS_H
+#define __ASM_ARM_TERMIOS_H
+
+#include <asm/termbits.h>
+#include <asm/ioctls.h>
+
+struct winsize {
+ unsigned short ws_row;
+ unsigned short ws_col;
+ unsigned short ws_xpixel;
+ unsigned short ws_ypixel;
+};
+
+#define NCC 8
+struct termio {
+ unsigned short c_iflag;
+ unsigned short c_oflag;
+ unsigned short c_cflag;
+ unsigned short c_lflag;
+ unsigned char c_line;
+ unsigned char c_cc[NCC];
+};
+
+#define TIOCM_LE 0x001
+#define TIOCM_DTR 0x002
+#define TIOCM_RTS 0x004
+#define TIOCM_ST 0x008
+#define TIOCM_SR 0x010
+#define TIOCM_CTS 0x020
+#define TIOCM_CAR 0x040
+#define TIOCM_RNG 0x080
+#define TIOCM_DSR 0x100
+#define TIOCM_CD TIOCM_CAR
+#define TIOCM_RI TIOCM_RNG
+#define TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
+
+#define N_TTY 0
+#define N_SLIP 1
+#define N_MOUSE 2
+#define N_PPP 3
+#define N_STRIP 4
+#define N_AX25 5
+#define N_X25 6  
+#define N_6PACK 7
+#define N_MASC 8  
+#define N_R3964 9  
+#define N_PROFIBUS_FDL 10  
+#define N_IRDA 11  
+#define N_SMSBLOCK 12  
+#define N_HDLC 13  
+#define N_SYNC_PPP 14
+#define N_HCI 15  
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/thread_info.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/thread_info.h
new file mode 100644
index 0000000..a30d2dc
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/thread_info.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_THREAD_INFO_H
+#define __ASM_ARM_THREAD_INFO_H
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/timex.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/timex.h
new file mode 100644
index 0000000..110c471
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/timex.h
@@ -0,0 +1,19 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_TIMEX_H
+#define _ASMARM_TIMEX_H
+
+#include <asm/arch/timex.h>
+
+typedef unsigned long cycles_t;
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/tlbflush.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/tlbflush.h
new file mode 100644
index 0000000..70a23dc
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/tlbflush.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_TLBFLUSH_H
+#define _ASMARM_TLBFLUSH_H
+
+#define tlb_flush(tlb) ((void) tlb)
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/topology.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/topology.h
new file mode 100644
index 0000000..9eccfd4
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/topology.h
@@ -0,0 +1,17 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASM_ARM_TOPOLOGY_H
+#define _ASM_ARM_TOPOLOGY_H
+
+#include <asm-generic/topology.h>
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/types.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/types.h
new file mode 100644
index 0000000..ec60f10
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/types.h
@@ -0,0 +1,36 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_TYPES_H
+#define __ASM_ARM_TYPES_H
+
+#ifndef __ASSEMBLY__
+
+typedef unsigned short umode_t;
+
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+typedef __signed__ long long __s64;
+typedef unsigned long long __u64;
+#endif
+
+#endif
+
+#endif
+
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/uaccess.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/uaccess.h
new file mode 100644
index 0000000..21fc3f2
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/uaccess.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ASMARM_UACCESS_H
+#define _ASMARM_UACCESS_H
+
+#include <linux/sched.h>
+#include <asm/errno.h>
+#include <asm/memory.h>
+#include <asm/domain.h>
+#include <asm/system.h>
+
+#define VERIFY_READ 0
+#define VERIFY_WRITE 1
+
+struct exception_table_entry
+{
+ unsigned long insn, fixup;
+};
+
+#define KERNEL_DS 0x00000000
+#define get_ds() (KERNEL_DS)
+
+#define USER_DS KERNEL_DS
+
+#define segment_eq(a,b) (1)
+#define __addr_ok(addr) (1)
+#define __range_ok(addr,size) (0)
+#define get_fs() (KERNEL_DS)
+
+#define get_user(x,p) __get_user(x,p)
+#define put_user(x,p) __put_user(x,p)
+#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
+#define __get_user(x,ptr)  ({   long __gu_err = 0;   __get_user_err((x),(ptr),__gu_err);   __gu_err;  })
+#define __get_user_error(x,ptr,err)  ({   __get_user_err((x),(ptr),err);   (void) 0;  })
+#define __get_user_err(x,ptr,err)  do {   unsigned long __gu_addr = (unsigned long)(ptr);   unsigned long __gu_val;   __chk_user_ptr(ptr);   switch (sizeof(*(ptr))) {   case 1: __get_user_asm_byte(__gu_val,__gu_addr,err); break;   case 2: __get_user_asm_half(__gu_val,__gu_addr,err); break;   case 4: __get_user_asm_word(__gu_val,__gu_addr,err); break;   default: (__gu_val) = __get_user_bad();   }   (x) = (__typeof__(*(ptr)))__gu_val;  } while (0)
+#define __get_user_asm_byte(x,addr,err)   __asm__ __volatile__(   "1:	ldrbt	%1,[%2],#0\n"   "2:\n"   "	.section .fixup,\"ax\"\n"   "	.align	2\n"   "3:	mov	%0, %3\n"   "	mov	%1, #0\n"   "	b	2b\n"   "	.previous\n"   "	.section __ex_table,\"a\"\n"   "	.align	3\n"   "	.long	1b, 3b\n"   "	.previous"   : "+r" (err), "=&r" (x)   : "r" (addr), "i" (-EFAULT)   : "cc")
+#ifndef __ARMEB__
+#define __get_user_asm_half(x,__gu_addr,err)  ({   unsigned long __b1, __b2;   __get_user_asm_byte(__b1, __gu_addr, err);   __get_user_asm_byte(__b2, __gu_addr + 1, err);   (x) = __b1 | (__b2 << 8);  })
+#else
+#define __get_user_asm_half(x,__gu_addr,err)  ({   unsigned long __b1, __b2;   __get_user_asm_byte(__b1, __gu_addr, err);   __get_user_asm_byte(__b2, __gu_addr + 1, err);   (x) = (__b1 << 8) | __b2;  })
+#endif
+#define __get_user_asm_word(x,addr,err)   __asm__ __volatile__(   "1:	ldrt	%1,[%2],#0\n"   "2:\n"   "	.section .fixup,\"ax\"\n"   "	.align	2\n"   "3:	mov	%0, %3\n"   "	mov	%1, #0\n"   "	b	2b\n"   "	.previous\n"   "	.section __ex_table,\"a\"\n"   "	.align	3\n"   "	.long	1b, 3b\n"   "	.previous"   : "+r" (err), "=&r" (x)   : "r" (addr), "i" (-EFAULT)   : "cc")
+#define __put_user(x,ptr)  ({   long __pu_err = 0;   __put_user_err((x),(ptr),__pu_err);   __pu_err;  })
+#define __put_user_error(x,ptr,err)  ({   __put_user_err((x),(ptr),err);   (void) 0;  })
+#define __put_user_err(x,ptr,err)  do {   unsigned long __pu_addr = (unsigned long)(ptr);   __typeof__(*(ptr)) __pu_val = (x);   __chk_user_ptr(ptr);   switch (sizeof(*(ptr))) {   case 1: __put_user_asm_byte(__pu_val,__pu_addr,err); break;   case 2: __put_user_asm_half(__pu_val,__pu_addr,err); break;   case 4: __put_user_asm_word(__pu_val,__pu_addr,err); break;   case 8: __put_user_asm_dword(__pu_val,__pu_addr,err); break;   default: __put_user_bad();   }  } while (0)
+#define __put_user_asm_byte(x,__pu_addr,err)   __asm__ __volatile__(   "1:	strbt	%1,[%2],#0\n"   "2:\n"   "	.section .fixup,\"ax\"\n"   "	.align	2\n"   "3:	mov	%0, %3\n"   "	b	2b\n"   "	.previous\n"   "	.section __ex_table,\"a\"\n"   "	.align	3\n"   "	.long	1b, 3b\n"   "	.previous"   : "+r" (err)   : "r" (x), "r" (__pu_addr), "i" (-EFAULT)   : "cc")
+#ifndef __ARMEB__
+#define __put_user_asm_half(x,__pu_addr,err)  ({   unsigned long __temp = (unsigned long)(x);   __put_user_asm_byte(__temp, __pu_addr, err);   __put_user_asm_byte(__temp >> 8, __pu_addr + 1, err);  })
+#else
+#define __put_user_asm_half(x,__pu_addr,err)  ({   unsigned long __temp = (unsigned long)(x);   __put_user_asm_byte(__temp >> 8, __pu_addr, err);   __put_user_asm_byte(__temp, __pu_addr + 1, err);  })
+#endif
+#define __put_user_asm_word(x,__pu_addr,err)   __asm__ __volatile__(   "1:	strt	%1,[%2],#0\n"   "2:\n"   "	.section .fixup,\"ax\"\n"   "	.align	2\n"   "3:	mov	%0, %3\n"   "	b	2b\n"   "	.previous\n"   "	.section __ex_table,\"a\"\n"   "	.align	3\n"   "	.long	1b, 3b\n"   "	.previous"   : "+r" (err)   : "r" (x), "r" (__pu_addr), "i" (-EFAULT)   : "cc")
+#ifndef __ARMEB__
+#define __reg_oper0 "%R2"
+#define __reg_oper1 "%Q2"
+#else
+#define __reg_oper0 "%Q2"
+#define __reg_oper1 "%R2"
+#endif
+#define __put_user_asm_dword(x,__pu_addr,err)   __asm__ __volatile__(   "1:	strt	" __reg_oper1 ", [%1], #4\n"   "2:	strt	" __reg_oper0 ", [%1], #0\n"   "3:\n"   "	.section .fixup,\"ax\"\n"   "	.align	2\n"   "4:	mov	%0, %3\n"   "	b	3b\n"   "	.previous\n"   "	.section __ex_table,\"a\"\n"   "	.align	3\n"   "	.long	1b, 4b\n"   "	.long	2b, 4b\n"   "	.previous"   : "+r" (err), "+r" (__pu_addr)   : "r" (x), "i" (-EFAULT)   : "cc")
+#define __copy_from_user(to,from,n) (memcpy(to, (void __force *)from, n), 0)
+#define __copy_to_user(to,from,n) (memcpy((void __force *)to, from, n), 0)
+#define __clear_user(addr,n) (memset((void __force *)addr, 0, n), 0)
+
+#define __copy_to_user_inatomic __copy_to_user
+#define __copy_from_user_inatomic __copy_from_user
+#define strlen_user(s) strnlen_user(s, ~0UL >> 1)
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/unaligned.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/unaligned.h
new file mode 100644
index 0000000..8b9b096
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/unaligned.h
@@ -0,0 +1,38 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_UNALIGNED_H
+#define __ASM_ARM_UNALIGNED_H
+
+#include <asm/types.h>
+
+#define __get_unaligned_2_le(__p)   (__p[0] | __p[1] << 8)
+
+#define __get_unaligned_2_be(__p)   (__p[0] << 8 | __p[1])
+
+#define __get_unaligned_4_le(__p)   (__p[0] | __p[1] << 8 | __p[2] << 16 | __p[3] << 24)
+
+#define __get_unaligned_4_be(__p)   (__p[0] << 24 | __p[1] << 16 | __p[2] << 8 | __p[3])
+
+#define __get_unaligned_le(ptr)   ({   __typeof__(*(ptr)) __v;   __u8 *__p = (__u8 *)(ptr);   switch (sizeof(*(ptr))) {   case 1: __v = *(ptr); break;   case 2: __v = __get_unaligned_2_le(__p); break;   case 4: __v = __get_unaligned_4_le(__p); break;   case 8: {   unsigned int __v1, __v2;   __v2 = __get_unaligned_4_le((__p+4));   __v1 = __get_unaligned_4_le(__p);   __v = ((unsigned long long)__v2 << 32 | __v1);   }   break;   default: __v = __bug_unaligned_x(__p); break;   }   __v;   })
+
+#define __get_unaligned_be(ptr)   ({   __typeof__(*(ptr)) __v;   __u8 *__p = (__u8 *)(ptr);   switch (sizeof(*(ptr))) {   case 1: __v = *(ptr); break;   case 2: __v = __get_unaligned_2_be(__p); break;   case 4: __v = __get_unaligned_4_be(__p); break;   case 8: {   unsigned int __v1, __v2;   __v2 = __get_unaligned_4_be(__p);   __v1 = __get_unaligned_4_be((__p+4));   __v = ((unsigned long long)__v2 << 32 | __v1);   }   break;   default: __v = __bug_unaligned_x(__p); break;   }   __v;   })
+
+#define __put_unaligned_le(val,ptr)   ({   switch (sizeof(*(ptr))) {   case 1:   *(ptr) = (val);   break;   case 2: __put_unaligned_2_le((val),(__u8 *)(ptr));   break;   case 4: __put_unaligned_4_le((val),(__u8 *)(ptr));   break;   case 8: __put_unaligned_8_le((val),(__u8 *)(ptr));   break;   default: __bug_unaligned_x(ptr);   break;   }   (void) 0;   })
+#define __put_unaligned_be(val,ptr)   ({   switch (sizeof(*(ptr))) {   case 1:   *(ptr) = (val);   break;   case 2: __put_unaligned_2_be((val),(__u8 *)(ptr));   break;   case 4: __put_unaligned_4_be((val),(__u8 *)(ptr));   break;   case 8: __put_unaligned_8_be((val),(__u8 *)(ptr));   break;   default: __bug_unaligned_x(ptr);   break;   }   (void) 0;   })
+#ifndef __ARMEB__
+#define get_unaligned __get_unaligned_le
+#define put_unaligned __put_unaligned_le
+#else
+#define get_unaligned __get_unaligned_be
+#define put_unaligned __put_unaligned_be
+#endif
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/unistd.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/unistd.h
new file mode 100644
index 0000000..9a30ddc
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/unistd.h
@@ -0,0 +1,359 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_ARM_UNISTD_H
+#define __ASM_ARM_UNISTD_H
+
+#define __NR_OABI_SYSCALL_BASE 0x900000
+
+#if defined(__thumb__) || defined(__ARM_EABI__)
+#define __NR_SYSCALL_BASE 0
+#else
+#define __NR_SYSCALL_BASE __NR_OABI_SYSCALL_BASE
+#endif
+
+#define __NR_restart_syscall (__NR_SYSCALL_BASE+ 0)
+#define __NR_exit (__NR_SYSCALL_BASE+ 1)
+#define __NR_fork (__NR_SYSCALL_BASE+ 2)
+#define __NR_read (__NR_SYSCALL_BASE+ 3)
+#define __NR_write (__NR_SYSCALL_BASE+ 4)
+#define __NR_open (__NR_SYSCALL_BASE+ 5)
+#define __NR_close (__NR_SYSCALL_BASE+ 6)
+
+#define __NR_creat (__NR_SYSCALL_BASE+ 8)
+#define __NR_link (__NR_SYSCALL_BASE+ 9)
+#define __NR_unlink (__NR_SYSCALL_BASE+ 10)
+#define __NR_execve (__NR_SYSCALL_BASE+ 11)
+#define __NR_chdir (__NR_SYSCALL_BASE+ 12)
+#define __NR_time (__NR_SYSCALL_BASE+ 13)
+#define __NR_mknod (__NR_SYSCALL_BASE+ 14)
+#define __NR_chmod (__NR_SYSCALL_BASE+ 15)
+#define __NR_lchown (__NR_SYSCALL_BASE+ 16)
+
+#define __NR_lseek (__NR_SYSCALL_BASE+ 19)
+#define __NR_getpid (__NR_SYSCALL_BASE+ 20)
+#define __NR_mount (__NR_SYSCALL_BASE+ 21)
+#define __NR_umount (__NR_SYSCALL_BASE+ 22)
+#define __NR_setuid (__NR_SYSCALL_BASE+ 23)
+#define __NR_getuid (__NR_SYSCALL_BASE+ 24)
+#define __NR_stime (__NR_SYSCALL_BASE+ 25)
+#define __NR_ptrace (__NR_SYSCALL_BASE+ 26)
+#define __NR_alarm (__NR_SYSCALL_BASE+ 27)
+
+#define __NR_pause (__NR_SYSCALL_BASE+ 29)
+#define __NR_utime (__NR_SYSCALL_BASE+ 30)
+
+#define __NR_access (__NR_SYSCALL_BASE+ 33)
+#define __NR_nice (__NR_SYSCALL_BASE+ 34)
+
+#define __NR_sync (__NR_SYSCALL_BASE+ 36)
+#define __NR_kill (__NR_SYSCALL_BASE+ 37)
+#define __NR_rename (__NR_SYSCALL_BASE+ 38)
+#define __NR_mkdir (__NR_SYSCALL_BASE+ 39)
+#define __NR_rmdir (__NR_SYSCALL_BASE+ 40)
+#define __NR_dup (__NR_SYSCALL_BASE+ 41)
+#define __NR_pipe (__NR_SYSCALL_BASE+ 42)
+#define __NR_times (__NR_SYSCALL_BASE+ 43)
+
+#define __NR_brk (__NR_SYSCALL_BASE+ 45)
+#define __NR_setgid (__NR_SYSCALL_BASE+ 46)
+#define __NR_getgid (__NR_SYSCALL_BASE+ 47)
+
+#define __NR_geteuid (__NR_SYSCALL_BASE+ 49)
+#define __NR_getegid (__NR_SYSCALL_BASE+ 50)
+#define __NR_acct (__NR_SYSCALL_BASE+ 51)
+#define __NR_umount2 (__NR_SYSCALL_BASE+ 52)
+
+#define __NR_ioctl (__NR_SYSCALL_BASE+ 54)
+#define __NR_fcntl (__NR_SYSCALL_BASE+ 55)
+
+#define __NR_setpgid (__NR_SYSCALL_BASE+ 57)
+
+#define __NR_umask (__NR_SYSCALL_BASE+ 60)
+#define __NR_chroot (__NR_SYSCALL_BASE+ 61)
+#define __NR_ustat (__NR_SYSCALL_BASE+ 62)
+#define __NR_dup2 (__NR_SYSCALL_BASE+ 63)
+#define __NR_getppid (__NR_SYSCALL_BASE+ 64)
+#define __NR_getpgrp (__NR_SYSCALL_BASE+ 65)
+#define __NR_setsid (__NR_SYSCALL_BASE+ 66)
+#define __NR_sigaction (__NR_SYSCALL_BASE+ 67)
+
+#define __NR_setreuid (__NR_SYSCALL_BASE+ 70)
+#define __NR_setregid (__NR_SYSCALL_BASE+ 71)
+#define __NR_sigsuspend (__NR_SYSCALL_BASE+ 72)
+#define __NR_sigpending (__NR_SYSCALL_BASE+ 73)
+#define __NR_sethostname (__NR_SYSCALL_BASE+ 74)
+#define __NR_setrlimit (__NR_SYSCALL_BASE+ 75)
+#define __NR_getrlimit (__NR_SYSCALL_BASE+ 76)  
+#define __NR_getrusage (__NR_SYSCALL_BASE+ 77)
+#define __NR_gettimeofday (__NR_SYSCALL_BASE+ 78)
+#define __NR_settimeofday (__NR_SYSCALL_BASE+ 79)
+#define __NR_getgroups (__NR_SYSCALL_BASE+ 80)
+#define __NR_setgroups (__NR_SYSCALL_BASE+ 81)
+#define __NR_select (__NR_SYSCALL_BASE+ 82)
+#define __NR_symlink (__NR_SYSCALL_BASE+ 83)
+
+#define __NR_readlink (__NR_SYSCALL_BASE+ 85)
+#define __NR_uselib (__NR_SYSCALL_BASE+ 86)
+#define __NR_swapon (__NR_SYSCALL_BASE+ 87)
+#define __NR_reboot (__NR_SYSCALL_BASE+ 88)
+#define __NR_readdir (__NR_SYSCALL_BASE+ 89)
+#define __NR_mmap (__NR_SYSCALL_BASE+ 90)
+#define __NR_munmap (__NR_SYSCALL_BASE+ 91)
+#define __NR_truncate (__NR_SYSCALL_BASE+ 92)
+#define __NR_ftruncate (__NR_SYSCALL_BASE+ 93)
+#define __NR_fchmod (__NR_SYSCALL_BASE+ 94)
+#define __NR_fchown (__NR_SYSCALL_BASE+ 95)
+#define __NR_getpriority (__NR_SYSCALL_BASE+ 96)
+#define __NR_setpriority (__NR_SYSCALL_BASE+ 97)
+
+#define __NR_statfs (__NR_SYSCALL_BASE+ 99)
+#define __NR_fstatfs (__NR_SYSCALL_BASE+100)
+
+#define __NR_socketcall (__NR_SYSCALL_BASE+102)
+#define __NR_syslog (__NR_SYSCALL_BASE+103)
+#define __NR_setitimer (__NR_SYSCALL_BASE+104)
+#define __NR_getitimer (__NR_SYSCALL_BASE+105)
+#define __NR_stat (__NR_SYSCALL_BASE+106)
+#define __NR_lstat (__NR_SYSCALL_BASE+107)
+#define __NR_fstat (__NR_SYSCALL_BASE+108)
+
+#define __NR_vhangup (__NR_SYSCALL_BASE+111)
+
+#define __NR_syscall (__NR_SYSCALL_BASE+113)  
+#define __NR_wait4 (__NR_SYSCALL_BASE+114)
+#define __NR_swapoff (__NR_SYSCALL_BASE+115)
+#define __NR_sysinfo (__NR_SYSCALL_BASE+116)
+#define __NR_ipc (__NR_SYSCALL_BASE+117)
+#define __NR_fsync (__NR_SYSCALL_BASE+118)
+#define __NR_sigreturn (__NR_SYSCALL_BASE+119)
+#define __NR_clone (__NR_SYSCALL_BASE+120)
+#define __NR_setdomainname (__NR_SYSCALL_BASE+121)
+#define __NR_uname (__NR_SYSCALL_BASE+122)
+
+#define __NR_adjtimex (__NR_SYSCALL_BASE+124)
+#define __NR_mprotect (__NR_SYSCALL_BASE+125)
+#define __NR_sigprocmask (__NR_SYSCALL_BASE+126)
+
+#define __NR_init_module (__NR_SYSCALL_BASE+128)
+#define __NR_delete_module (__NR_SYSCALL_BASE+129)
+
+#define __NR_quotactl (__NR_SYSCALL_BASE+131)
+#define __NR_getpgid (__NR_SYSCALL_BASE+132)
+#define __NR_fchdir (__NR_SYSCALL_BASE+133)
+#define __NR_bdflush (__NR_SYSCALL_BASE+134)
+#define __NR_sysfs (__NR_SYSCALL_BASE+135)
+#define __NR_personality (__NR_SYSCALL_BASE+136)
+
+#define __NR_setfsuid (__NR_SYSCALL_BASE+138)
+#define __NR_setfsgid (__NR_SYSCALL_BASE+139)
+#define __NR__llseek (__NR_SYSCALL_BASE+140)
+#define __NR_getdents (__NR_SYSCALL_BASE+141)
+#define __NR__newselect (__NR_SYSCALL_BASE+142)
+#define __NR_flock (__NR_SYSCALL_BASE+143)
+#define __NR_msync (__NR_SYSCALL_BASE+144)
+#define __NR_readv (__NR_SYSCALL_BASE+145)
+#define __NR_writev (__NR_SYSCALL_BASE+146)
+#define __NR_getsid (__NR_SYSCALL_BASE+147)
+#define __NR_fdatasync (__NR_SYSCALL_BASE+148)
+#define __NR__sysctl (__NR_SYSCALL_BASE+149)
+#define __NR_mlock (__NR_SYSCALL_BASE+150)
+#define __NR_munlock (__NR_SYSCALL_BASE+151)
+#define __NR_mlockall (__NR_SYSCALL_BASE+152)
+#define __NR_munlockall (__NR_SYSCALL_BASE+153)
+#define __NR_sched_setparam (__NR_SYSCALL_BASE+154)
+#define __NR_sched_getparam (__NR_SYSCALL_BASE+155)
+#define __NR_sched_setscheduler (__NR_SYSCALL_BASE+156)
+#define __NR_sched_getscheduler (__NR_SYSCALL_BASE+157)
+#define __NR_sched_yield (__NR_SYSCALL_BASE+158)
+#define __NR_sched_get_priority_max (__NR_SYSCALL_BASE+159)
+#define __NR_sched_get_priority_min (__NR_SYSCALL_BASE+160)
+#define __NR_sched_rr_get_interval (__NR_SYSCALL_BASE+161)
+#define __NR_nanosleep (__NR_SYSCALL_BASE+162)
+#define __NR_mremap (__NR_SYSCALL_BASE+163)
+#define __NR_setresuid (__NR_SYSCALL_BASE+164)
+#define __NR_getresuid (__NR_SYSCALL_BASE+165)
+
+#define __NR_poll (__NR_SYSCALL_BASE+168)
+#define __NR_nfsservctl (__NR_SYSCALL_BASE+169)
+#define __NR_setresgid (__NR_SYSCALL_BASE+170)
+#define __NR_getresgid (__NR_SYSCALL_BASE+171)
+#define __NR_prctl (__NR_SYSCALL_BASE+172)
+#define __NR_rt_sigreturn (__NR_SYSCALL_BASE+173)
+#define __NR_rt_sigaction (__NR_SYSCALL_BASE+174)
+#define __NR_rt_sigprocmask (__NR_SYSCALL_BASE+175)
+#define __NR_rt_sigpending (__NR_SYSCALL_BASE+176)
+#define __NR_rt_sigtimedwait (__NR_SYSCALL_BASE+177)
+#define __NR_rt_sigqueueinfo (__NR_SYSCALL_BASE+178)
+#define __NR_rt_sigsuspend (__NR_SYSCALL_BASE+179)
+#define __NR_pread64 (__NR_SYSCALL_BASE+180)
+#define __NR_pwrite64 (__NR_SYSCALL_BASE+181)
+#define __NR_chown (__NR_SYSCALL_BASE+182)
+#define __NR_getcwd (__NR_SYSCALL_BASE+183)
+#define __NR_capget (__NR_SYSCALL_BASE+184)
+#define __NR_capset (__NR_SYSCALL_BASE+185)
+#define __NR_sigaltstack (__NR_SYSCALL_BASE+186)
+#define __NR_sendfile (__NR_SYSCALL_BASE+187)
+
+#define __NR_vfork (__NR_SYSCALL_BASE+190)
+#define __NR_ugetrlimit (__NR_SYSCALL_BASE+191)  
+#define __NR_mmap2 (__NR_SYSCALL_BASE+192)
+#define __NR_truncate64 (__NR_SYSCALL_BASE+193)
+#define __NR_ftruncate64 (__NR_SYSCALL_BASE+194)
+#define __NR_stat64 (__NR_SYSCALL_BASE+195)
+#define __NR_lstat64 (__NR_SYSCALL_BASE+196)
+#define __NR_fstat64 (__NR_SYSCALL_BASE+197)
+#define __NR_lchown32 (__NR_SYSCALL_BASE+198)
+#define __NR_getuid32 (__NR_SYSCALL_BASE+199)
+#define __NR_getgid32 (__NR_SYSCALL_BASE+200)
+#define __NR_geteuid32 (__NR_SYSCALL_BASE+201)
+#define __NR_getegid32 (__NR_SYSCALL_BASE+202)
+#define __NR_setreuid32 (__NR_SYSCALL_BASE+203)
+#define __NR_setregid32 (__NR_SYSCALL_BASE+204)
+#define __NR_getgroups32 (__NR_SYSCALL_BASE+205)
+#define __NR_setgroups32 (__NR_SYSCALL_BASE+206)
+#define __NR_fchown32 (__NR_SYSCALL_BASE+207)
+#define __NR_setresuid32 (__NR_SYSCALL_BASE+208)
+#define __NR_getresuid32 (__NR_SYSCALL_BASE+209)
+#define __NR_setresgid32 (__NR_SYSCALL_BASE+210)
+#define __NR_getresgid32 (__NR_SYSCALL_BASE+211)
+#define __NR_chown32 (__NR_SYSCALL_BASE+212)
+#define __NR_setuid32 (__NR_SYSCALL_BASE+213)
+#define __NR_setgid32 (__NR_SYSCALL_BASE+214)
+#define __NR_setfsuid32 (__NR_SYSCALL_BASE+215)
+#define __NR_setfsgid32 (__NR_SYSCALL_BASE+216)
+#define __NR_getdents64 (__NR_SYSCALL_BASE+217)
+#define __NR_pivot_root (__NR_SYSCALL_BASE+218)
+#define __NR_mincore (__NR_SYSCALL_BASE+219)
+#define __NR_madvise (__NR_SYSCALL_BASE+220)
+#define __NR_fcntl64 (__NR_SYSCALL_BASE+221)
+
+#define __NR_gettid (__NR_SYSCALL_BASE+224)
+#define __NR_readahead (__NR_SYSCALL_BASE+225)
+#define __NR_setxattr (__NR_SYSCALL_BASE+226)
+#define __NR_lsetxattr (__NR_SYSCALL_BASE+227)
+#define __NR_fsetxattr (__NR_SYSCALL_BASE+228)
+#define __NR_getxattr (__NR_SYSCALL_BASE+229)
+#define __NR_lgetxattr (__NR_SYSCALL_BASE+230)
+#define __NR_fgetxattr (__NR_SYSCALL_BASE+231)
+#define __NR_listxattr (__NR_SYSCALL_BASE+232)
+#define __NR_llistxattr (__NR_SYSCALL_BASE+233)
+#define __NR_flistxattr (__NR_SYSCALL_BASE+234)
+#define __NR_removexattr (__NR_SYSCALL_BASE+235)
+#define __NR_lremovexattr (__NR_SYSCALL_BASE+236)
+#define __NR_fremovexattr (__NR_SYSCALL_BASE+237)
+#define __NR_tkill (__NR_SYSCALL_BASE+238)
+#define __NR_sendfile64 (__NR_SYSCALL_BASE+239)
+#define __NR_futex (__NR_SYSCALL_BASE+240)
+#define __NR_sched_setaffinity (__NR_SYSCALL_BASE+241)
+#define __NR_sched_getaffinity (__NR_SYSCALL_BASE+242)
+#define __NR_io_setup (__NR_SYSCALL_BASE+243)
+#define __NR_io_destroy (__NR_SYSCALL_BASE+244)
+#define __NR_io_getevents (__NR_SYSCALL_BASE+245)
+#define __NR_io_submit (__NR_SYSCALL_BASE+246)
+#define __NR_io_cancel (__NR_SYSCALL_BASE+247)
+#define __NR_exit_group (__NR_SYSCALL_BASE+248)
+#define __NR_lookup_dcookie (__NR_SYSCALL_BASE+249)
+#define __NR_epoll_create (__NR_SYSCALL_BASE+250)
+#define __NR_epoll_ctl (__NR_SYSCALL_BASE+251)
+#define __NR_epoll_wait (__NR_SYSCALL_BASE+252)
+#define __NR_remap_file_pages (__NR_SYSCALL_BASE+253)
+
+#define __NR_set_tid_address (__NR_SYSCALL_BASE+256)
+#define __NR_timer_create (__NR_SYSCALL_BASE+257)
+#define __NR_timer_settime (__NR_SYSCALL_BASE+258)
+#define __NR_timer_gettime (__NR_SYSCALL_BASE+259)
+#define __NR_timer_getoverrun (__NR_SYSCALL_BASE+260)
+#define __NR_timer_delete (__NR_SYSCALL_BASE+261)
+#define __NR_clock_settime (__NR_SYSCALL_BASE+262)
+#define __NR_clock_gettime (__NR_SYSCALL_BASE+263)
+#define __NR_clock_getres (__NR_SYSCALL_BASE+264)
+#define __NR_clock_nanosleep (__NR_SYSCALL_BASE+265)
+#define __NR_statfs64 (__NR_SYSCALL_BASE+266)
+#define __NR_fstatfs64 (__NR_SYSCALL_BASE+267)
+#define __NR_tgkill (__NR_SYSCALL_BASE+268)
+#define __NR_utimes (__NR_SYSCALL_BASE+269)
+#define __NR_arm_fadvise64_64 (__NR_SYSCALL_BASE+270)
+#define __NR_pciconfig_iobase (__NR_SYSCALL_BASE+271)
+#define __NR_pciconfig_read (__NR_SYSCALL_BASE+272)
+#define __NR_pciconfig_write (__NR_SYSCALL_BASE+273)
+#define __NR_mq_open (__NR_SYSCALL_BASE+274)
+#define __NR_mq_unlink (__NR_SYSCALL_BASE+275)
+#define __NR_mq_timedsend (__NR_SYSCALL_BASE+276)
+#define __NR_mq_timedreceive (__NR_SYSCALL_BASE+277)
+#define __NR_mq_notify (__NR_SYSCALL_BASE+278)
+#define __NR_mq_getsetattr (__NR_SYSCALL_BASE+279)
+#define __NR_waitid (__NR_SYSCALL_BASE+280)
+#define __NR_socket (__NR_SYSCALL_BASE+281)
+#define __NR_bind (__NR_SYSCALL_BASE+282)
+#define __NR_connect (__NR_SYSCALL_BASE+283)
+#define __NR_listen (__NR_SYSCALL_BASE+284)
+#define __NR_accept (__NR_SYSCALL_BASE+285)
+#define __NR_getsockname (__NR_SYSCALL_BASE+286)
+#define __NR_getpeername (__NR_SYSCALL_BASE+287)
+#define __NR_socketpair (__NR_SYSCALL_BASE+288)
+#define __NR_send (__NR_SYSCALL_BASE+289)
+#define __NR_sendto (__NR_SYSCALL_BASE+290)
+#define __NR_recv (__NR_SYSCALL_BASE+291)
+#define __NR_recvfrom (__NR_SYSCALL_BASE+292)
+#define __NR_shutdown (__NR_SYSCALL_BASE+293)
+#define __NR_setsockopt (__NR_SYSCALL_BASE+294)
+#define __NR_getsockopt (__NR_SYSCALL_BASE+295)
+#define __NR_sendmsg (__NR_SYSCALL_BASE+296)
+#define __NR_recvmsg (__NR_SYSCALL_BASE+297)
+#define __NR_semop (__NR_SYSCALL_BASE+298)
+#define __NR_semget (__NR_SYSCALL_BASE+299)
+#define __NR_semctl (__NR_SYSCALL_BASE+300)
+#define __NR_msgsnd (__NR_SYSCALL_BASE+301)
+#define __NR_msgrcv (__NR_SYSCALL_BASE+302)
+#define __NR_msgget (__NR_SYSCALL_BASE+303)
+#define __NR_msgctl (__NR_SYSCALL_BASE+304)
+#define __NR_shmat (__NR_SYSCALL_BASE+305)
+#define __NR_shmdt (__NR_SYSCALL_BASE+306)
+#define __NR_shmget (__NR_SYSCALL_BASE+307)
+#define __NR_shmctl (__NR_SYSCALL_BASE+308)
+#define __NR_add_key (__NR_SYSCALL_BASE+309)
+#define __NR_request_key (__NR_SYSCALL_BASE+310)
+#define __NR_keyctl (__NR_SYSCALL_BASE+311)
+#define __NR_semtimedop (__NR_SYSCALL_BASE+312)
+#define __NR_vserver (__NR_SYSCALL_BASE+313)
+#define __NR_ioprio_set (__NR_SYSCALL_BASE+314)
+#define __NR_ioprio_get (__NR_SYSCALL_BASE+315)
+#define __NR_inotify_init (__NR_SYSCALL_BASE+316)
+#define __NR_inotify_add_watch (__NR_SYSCALL_BASE+317)
+#define __NR_inotify_rm_watch (__NR_SYSCALL_BASE+318)
+#define __NR_mbind (__NR_SYSCALL_BASE+319)
+#define __NR_get_mempolicy (__NR_SYSCALL_BASE+320)
+#define __NR_set_mempolicy (__NR_SYSCALL_BASE+321)
+
+#define __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000)
+#define __ARM_NR_breakpoint (__ARM_NR_BASE+1)
+#define __ARM_NR_cacheflush (__ARM_NR_BASE+2)
+#define __ARM_NR_usr26 (__ARM_NR_BASE+3)
+#define __ARM_NR_usr32 (__ARM_NR_BASE+4)
+#define __ARM_NR_set_tls (__ARM_NR_BASE+5)
+
+#if defined(__ARM_EABI__) && !defined(__KERNEL__)
+#undef __NR_time
+#undef __NR_umount
+#undef __NR_stime
+#undef __NR_alarm
+#undef __NR_utime
+#undef __NR_getrlimit
+#undef __NR_select
+#undef __NR_readdir
+#undef __NR_mmap
+#undef __NR_socketcall
+#undef __NR_syscall
+#undef __NR_ipc
+#endif
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/user.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/user.h
new file mode 100644
index 0000000..5f25850
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/user.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _ARM_USER_H
+#define _ARM_USER_H
+
+#include <asm/page.h>
+#include <asm/ptrace.h>
+
+struct user_fp {
+ struct fp_reg {
+ unsigned int sign1:1;
+ unsigned int unused:15;
+ unsigned int sign2:1;
+ unsigned int exponent:14;
+ unsigned int j:1;
+ unsigned int mantissa1:31;
+ unsigned int mantissa0:32;
+ } fpregs[8];
+ unsigned int fpsr:32;
+ unsigned int fpcr:32;
+ unsigned char ftype[8];
+ unsigned int init_flag;
+};
+
+struct user{
+
+ struct pt_regs regs;
+
+ int u_fpvalid;
+
+ unsigned long int u_tsize;
+ unsigned long int u_dsize;
+ unsigned long int u_ssize;
+ unsigned long start_code;
+ unsigned long start_stack;
+ long int signal;
+ int reserved;
+ struct pt_regs * u_ar0;
+
+ unsigned long magic;
+ char u_comm[32];
+ int u_debugreg[8];
+ struct user_fp u_fp;
+ struct user_fp_struct * u_fp0;
+
+};
+#define NBPG PAGE_SIZE
+#define UPAGES 1
+#define HOST_TEXT_START_ADDR (u.start_code)
+#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/asm/vga.h b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/vga.h
new file mode 100644
index 0000000..7875dbf
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/asm/vga.h
@@ -0,0 +1,23 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef ASMARM_VGA_H
+#define ASMARM_VGA_H
+
+#include <asm/hardware.h>
+#include <asm/io.h>
+
+#define VGA_MAP_MEM(x,s) (PCIMEM_BASE + (x))
+
+#define vga_readb(x) (*((volatile unsigned char *)x))
+#define vga_writeb(x,y) (*((volatile unsigned char *)y) = (x))
+
+#endif
diff --git a/ndk/build/platforms/android-3/common/include/assert.h b/ndk/build/platforms/android-5/arch-arm/usr/include/assert.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/assert.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/assert.h
diff --git a/ndk/build/platforms/android-3/common/include/byteswap.h b/ndk/build/platforms/android-5/arch-arm/usr/include/byteswap.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/byteswap.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/byteswap.h
diff --git a/ndk/build/platforms/android-3/common/include/cstddef b/ndk/build/platforms/android-5/arch-arm/usr/include/cstddef
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/cstddef
copy to ndk/build/platforms/android-5/arch-arm/usr/include/cstddef
diff --git a/ndk/build/platforms/android-3/common/include/ctype.h b/ndk/build/platforms/android-5/arch-arm/usr/include/ctype.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/ctype.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/ctype.h
diff --git a/ndk/build/platforms/android-3/common/include/dirent.h b/ndk/build/platforms/android-5/arch-arm/usr/include/dirent.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/dirent.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/dirent.h
diff --git a/ndk/build/platforms/android-3/common/include/dlfcn.h b/ndk/build/platforms/android-5/arch-arm/usr/include/dlfcn.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/dlfcn.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/dlfcn.h
diff --git a/ndk/build/platforms/android-3/common/include/elf.h b/ndk/build/platforms/android-5/arch-arm/usr/include/elf.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/elf.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/elf.h
diff --git a/ndk/build/platforms/android-3/common/include/endian.h b/ndk/build/platforms/android-5/arch-arm/usr/include/endian.h
similarity index 100%
rename from ndk/build/platforms/android-3/common/include/endian.h
rename to ndk/build/platforms/android-5/arch-arm/usr/include/endian.h
diff --git a/ndk/build/platforms/android-3/common/include/err.h b/ndk/build/platforms/android-5/arch-arm/usr/include/err.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/err.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/err.h
diff --git a/ndk/build/platforms/android-3/common/include/errno.h b/ndk/build/platforms/android-5/arch-arm/usr/include/errno.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/errno.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/errno.h
diff --git a/ndk/build/platforms/android-3/common/include/fcntl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/fcntl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/fcntl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/fcntl.h
diff --git a/ndk/build/platforms/android-3/common/include/features.h b/ndk/build/platforms/android-5/arch-arm/usr/include/features.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/features.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/features.h
diff --git a/ndk/build/platforms/android-3/common/include/fnmatch.h b/ndk/build/platforms/android-5/arch-arm/usr/include/fnmatch.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/fnmatch.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/fnmatch.h
diff --git a/ndk/build/platforms/android-3/common/include/getopt.h b/ndk/build/platforms/android-5/arch-arm/usr/include/getopt.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/getopt.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/getopt.h
diff --git a/ndk/build/platforms/android-3/common/include/grp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/grp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/grp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/grp.h
diff --git a/ndk/build/platforms/android-3/common/include/inttypes.h b/ndk/build/platforms/android-5/arch-arm/usr/include/inttypes.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/inttypes.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/inttypes.h
diff --git a/ndk/build/platforms/android-3/common/include/jni.h b/ndk/build/platforms/android-5/arch-arm/usr/include/jni.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/jni.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/jni.h
diff --git a/ndk/build/platforms/android-3/common/include/lastlog.h b/ndk/build/platforms/android-5/arch-arm/usr/include/lastlog.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/lastlog.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/lastlog.h
diff --git a/ndk/build/platforms/android-3/common/include/libgen.h b/ndk/build/platforms/android-5/arch-arm/usr/include/libgen.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/libgen.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/libgen.h
diff --git a/ndk/build/platforms/android-3/common/include/limits.h b/ndk/build/platforms/android-5/arch-arm/usr/include/limits.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/limits.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/limits.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/a.out.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/a.out.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/a.out.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/a.out.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/aio_abi.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/aio_abi.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/aio_abi.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/aio_abi.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/akm8976.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/akm8976.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/akm8976.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/akm8976.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/android_alarm.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/android_alarm.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/android_alarm.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/android_alarm.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/android_pmem.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/android_pmem.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/android_pmem.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/android_pmem.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/android_power.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/android_power.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/android_power.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/android_power.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/apm_bios.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/apm_bios.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/apm_bios.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/apm_bios.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ashmem.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ashmem.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ashmem.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ashmem.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ata.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ata.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ata.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ata.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/atm.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/atm.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/atm.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/atm.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/atmapi.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/atmapi.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/atmapi.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/atmapi.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/atmdev.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/atmdev.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/atmdev.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/atmdev.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/atmioc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/atmioc.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/atmioc.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/atmioc.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/atmppp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/atmppp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/atmppp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/atmppp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/atmsap.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/atmsap.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/atmsap.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/atmsap.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/attribute_container.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/attribute_container.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/attribute_container.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/attribute_container.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/auto_fs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/auto_fs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/auto_fs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/auto_fs.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/autoconf.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/autoconf.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/autoconf.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/autoconf.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/auxvec.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/auxvec.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/auxvec.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/auxvec.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/backing-dev.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/backing-dev.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/backing-dev.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/backing-dev.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/binder.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/binder.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/binder.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/binder.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/binfmts.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/binfmts.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/binfmts.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/binfmts.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/bio.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/bio.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/bio.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/bio.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/bitmap.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/bitmap.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/bitmap.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/bitmap.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/bitops.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/bitops.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/bitops.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/bitops.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/blkdev.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/blkdev.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/blkdev.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/blkdev.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/blkpg.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/blkpg.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/blkpg.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/blkpg.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/blockgroup_lock.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/blockgroup_lock.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/blockgroup_lock.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/blockgroup_lock.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/byteorder/big_endian.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/byteorder/big_endian.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/byteorder/big_endian.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/byteorder/big_endian.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/byteorder/generic.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/byteorder/generic.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/byteorder/generic.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/byteorder/generic.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/byteorder/little_endian.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/byteorder/little_endian.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/byteorder/little_endian.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/byteorder/little_endian.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/byteorder/swab.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/byteorder/swab.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/byteorder/swab.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/byteorder/swab.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/byteorder/swabb.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/byteorder/swabb.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/byteorder/swabb.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/byteorder/swabb.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/cache.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/cache.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/cache.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/cache.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/calc64.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/calc64.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/calc64.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/calc64.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/capability.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/capability.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/capability.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/capability.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/capi.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/capi.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/capi.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/capi.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/cdev.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/cdev.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/cdev.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/cdev.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/cdrom.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/cdrom.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/cdrom.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/cdrom.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/circ_buf.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/circ_buf.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/circ_buf.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/circ_buf.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/clk.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/clk.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/clk.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/clk.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/coda.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/coda.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/coda.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/coda.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/coda_fs_i.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/coda_fs_i.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/coda_fs_i.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/coda_fs_i.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/compat.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/compat.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/compat.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/compat.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/compiler-gcc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/compiler-gcc.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/compiler-gcc.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/compiler-gcc.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/compiler.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/compiler.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/compiler.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/compiler.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/completion.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/completion.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/completion.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/completion.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/config.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/config.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/config.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/config.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/console_struct.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/console_struct.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/console_struct.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/console_struct.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/cpu.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/cpu.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/cpu.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/cpu.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/cpumask.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/cpumask.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/cpumask.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/cpumask.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ctype.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ctype.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ctype.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ctype.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/dccp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/dccp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/dccp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/dccp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/debug_locks.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/debug_locks.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/debug_locks.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/debug_locks.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/delay.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/delay.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/delay.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/delay.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/device.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/device.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/device.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/device.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/dirent.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/dirent.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/dirent.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/dirent.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/dm-ioctl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/dm-ioctl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/dm-ioctl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/dm-ioctl.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/dma-mapping.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/dma-mapping.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/dma-mapping.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/dma-mapping.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/dmaengine.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/dmaengine.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/dmaengine.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/dmaengine.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/efs_dir.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/efs_dir.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/efs_dir.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/efs_dir.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/efs_fs_i.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/efs_fs_i.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/efs_fs_i.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/efs_fs_i.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/efs_fs_sb.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/efs_fs_sb.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/efs_fs_sb.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/efs_fs_sb.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/elevator.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/elevator.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/elevator.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/elevator.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/elf-em.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/elf-em.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/elf-em.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/elf-em.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/elf.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/elf.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/elf.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/elf.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/err.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/err.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/err.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/err.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/errno.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/errno.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/errno.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/errno.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/errqueue.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/errqueue.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/errqueue.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/errqueue.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/etherdevice.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/etherdevice.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/etherdevice.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/etherdevice.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ext2_fs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ext2_fs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ext2_fs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ext2_fs.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ext3_fs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ext3_fs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ext3_fs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ext3_fs.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/fadvise.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/fadvise.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/fadvise.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/fadvise.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/fb.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/fb.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/fb.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/fb.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/fcntl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/fcntl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/fcntl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/fcntl.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/fd.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/fd.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/fd.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/fd.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/file.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/file.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/file.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/file.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/filter.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/filter.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/filter.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/filter.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/fs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/fs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/fs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/fs.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ftape.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ftape.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ftape.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ftape.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/futex.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/futex.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/futex.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/futex.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/genhd.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/genhd.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/genhd.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/genhd.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/gfp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/gfp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/gfp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/gfp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/hardirq.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/hardirq.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/hardirq.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/hardirq.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/hdlc/ioctl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/hdlc/ioctl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/hdlc/ioctl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/hdlc/ioctl.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/hdreg.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/hdreg.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/hdreg.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/hdreg.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/hdsmart.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/hdsmart.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/hdsmart.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/hdsmart.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/highmem.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/highmem.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/highmem.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/highmem.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/hil.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/hil.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/hil.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/hil.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/i2c.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/i2c.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/i2c.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/i2c.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/icmp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/icmp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/icmp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/icmp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/if.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/if.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/if.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/if.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_arcnet.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_arcnet.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/if_arcnet.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_arcnet.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_arp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_arp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/if_arp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_arp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_bridge.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_bridge.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/if_bridge.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_bridge.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_ether.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_ether.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/if_ether.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_ether.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_fc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_fc.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/if_fc.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_fc.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_fddi.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_fddi.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/if_fddi.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_fddi.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_hippi.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_hippi.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/if_hippi.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_hippi.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_packet.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_packet.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/if_packet.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_packet.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_ppp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_ppp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/if_ppp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_ppp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_tr.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_tr.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/if_tr.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_tr.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_tun.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_tun.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/if_tun.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_tun.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/if_vlan.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_vlan.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/if_vlan.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/if_vlan.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/in.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/in.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/in.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/in.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/in6.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/in6.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/in6.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/in6.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/init.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/init.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/init.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/init.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/inotify.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/inotify.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/inotify.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/inotify.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/input.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/input.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/input.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/input.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/interrupt.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/interrupt.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/interrupt.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/interrupt.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ioctl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ioctl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ioctl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ioctl.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ioport.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ioport.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ioport.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ioport.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ioprio.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ioprio.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ioprio.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ioprio.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ip.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ip.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ip.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ip.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ipc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ipc.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ipc.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ipc.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ipmi_msgdefs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ipmi_msgdefs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ipmi_msgdefs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ipmi_msgdefs.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ipmi_smi.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ipmi_smi.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ipmi_smi.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ipmi_smi.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ipx.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ipx.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ipx.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ipx.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/irq.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/irq.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/irq.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/irq.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/irq_cpustat.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/irq_cpustat.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/irq_cpustat.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/irq_cpustat.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/irqflags.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/irqflags.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/irqflags.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/irqflags.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/irqreturn.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/irqreturn.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/irqreturn.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/irqreturn.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/jbd.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/jbd.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/jbd.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/jbd.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/jiffies.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/jiffies.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/jiffies.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/jiffies.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/kd.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/kd.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/kd.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/kd.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/kdev_t.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/kdev_t.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/kdev_t.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/kdev_t.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/kernel.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/kernel.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/kernel.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/kernel.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/kernel_stat.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/kernel_stat.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/kernel_stat.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/kernel_stat.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/kernelcapi.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/kernelcapi.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/kernelcapi.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/kernelcapi.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/kexec.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/kexec.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/kexec.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/kexec.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/key.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/key.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/key.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/key.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/keyboard.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/keyboard.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/keyboard.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/keyboard.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/keychord.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/keychord.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/keychord.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/keychord.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/klist.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/klist.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/klist.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/klist.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/kmod.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/kmod.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/kmod.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/kmod.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/kobject.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/kobject.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/kobject.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/kobject.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/kref.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/kref.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/kref.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/kref.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ktime.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ktime.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ktime.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ktime.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/limits.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/limits.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/limits.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/limits.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/linkage.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/linkage.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/linkage.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/linkage.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/list.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/list.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/list.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/list.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/lockd/nlm.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/lockd/nlm.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/lockd/nlm.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/lockd/nlm.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/lockd/xdr.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/lockd/xdr.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/lockd/xdr.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/lockd/xdr.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/lockdep.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/lockdep.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/lockdep.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/lockdep.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/loop.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/loop.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/loop.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/loop.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/magic.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/magic.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/magic.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/magic.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/major.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/major.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/major.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/major.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mc146818rtc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mc146818rtc.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mc146818rtc.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mc146818rtc.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mca.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mca.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mca.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mca.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mempolicy.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mempolicy.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mempolicy.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mempolicy.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mempool.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mempool.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mempool.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mempool.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/miscdevice.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/miscdevice.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/miscdevice.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/miscdevice.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mm.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mm.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mm.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mm.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mmc/card.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mmc/card.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mmc/card.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mmc/card.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mmc/host.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mmc/host.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mmc/host.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mmc/host.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mmc/mmc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mmc/mmc.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mmc/mmc.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mmc/mmc.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mmzone.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mmzone.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mmzone.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mmzone.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mod_devicetable.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mod_devicetable.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mod_devicetable.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mod_devicetable.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/module.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/module.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/module.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/module.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/moduleparam.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/moduleparam.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/moduleparam.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/moduleparam.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mount.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mount.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mount.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mount.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/msdos_fs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/msdos_fs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/msdos_fs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/msdos_fs.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/msg.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/msg.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/msg.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/msg.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/msm_adsp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/msm_adsp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/msm_adsp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/msm_adsp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/msm_audio.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/msm_audio.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/msm_audio.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/msm_audio.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/msm_mdp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/msm_mdp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/msm_mdp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/msm_mdp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mt9t013.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mt9t013.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mt9t013.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mt9t013.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/bbm.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/bbm.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mtd/bbm.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/bbm.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/blktrans.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/blktrans.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mtd/blktrans.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/blktrans.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/cfi.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/cfi.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mtd/cfi.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/cfi.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/cfi_endian.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/cfi_endian.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mtd/cfi_endian.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/cfi_endian.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/compatmac.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/compatmac.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mtd/compatmac.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/compatmac.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/flashchip.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/flashchip.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mtd/flashchip.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/flashchip.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/map.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/map.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mtd/map.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/map.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/mtd.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/mtd.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mtd/mtd.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/mtd.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/nand.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/nand.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mtd/nand.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/nand.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/nand_ecc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/nand_ecc.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mtd/nand_ecc.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/nand_ecc.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/nftl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/nftl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mtd/nftl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/nftl.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/onenand_regs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/onenand_regs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mtd/onenand_regs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/onenand_regs.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtd/partitions.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/partitions.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mtd/partitions.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtd/partitions.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mtio.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtio.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mtio.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mtio.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mutex-debug.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mutex-debug.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mutex-debug.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mutex-debug.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/mutex.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/mutex.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/mutex.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/mutex.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ncp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ncp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ncp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ncp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ncp_mount.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ncp_mount.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ncp_mount.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ncp_mount.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ncp_no.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ncp_no.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ncp_no.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ncp_no.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/net.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/net.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/net.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/net.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netdevice.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netdevice.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netdevice.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netdevice.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_common.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/nf_conntrack_common.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_common.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/nf_conntrack_common.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_ftp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/nf_conntrack_ftp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_ftp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/nf_conntrack_ftp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_sctp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/nf_conntrack_sctp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_sctp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/nf_conntrack_sctp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_tcp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/nf_conntrack_tcp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_tcp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/nf_conntrack_tcp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_tuple_common.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/nf_conntrack_tuple_common.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/nf_conntrack_tuple_common.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/nf_conntrack_tuple_common.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/nfnetlink.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/nfnetlink.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/nfnetlink.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/nfnetlink.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/nfnetlink_conntrack.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/nfnetlink_conntrack.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/nfnetlink_conntrack.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/nfnetlink_conntrack.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/x_tables.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/x_tables.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/x_tables.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/x_tables.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_CLASSIFY.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_CLASSIFY.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_CLASSIFY.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_CLASSIFY.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_CONNSECMARK.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_CONNSECMARK.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_CONNSECMARK.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_CONNSECMARK.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_NFQUEUE.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_NFQUEUE.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_NFQUEUE.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_NFQUEUE.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_SECMARK.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_SECMARK.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_SECMARK.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_SECMARK.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_comment.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_comment.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_comment.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_comment.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_connbytes.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_connbytes.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_connbytes.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_connbytes.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_conntrack.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_conntrack.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_conntrack.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_conntrack.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_dccp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_dccp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_dccp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_dccp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_esp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_esp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_esp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_esp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_helper.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_helper.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_helper.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_helper.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_length.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_length.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_length.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_length.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_limit.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_limit.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_limit.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_limit.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_mac.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_mac.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_mac.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_mac.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_multiport.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_multiport.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_multiport.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_multiport.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_physdev.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_physdev.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_physdev.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_physdev.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_pkttype.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_pkttype.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_pkttype.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_pkttype.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_quota.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_quota.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_quota.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_quota.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_realm.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_realm.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_realm.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_realm.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_sctp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_sctp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_sctp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_sctp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_state.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_state.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_state.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_state.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_statistic.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_statistic.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_statistic.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_statistic.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_string.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_string.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_string.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_string.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_tcpmss.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_tcpmss.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_tcpmss.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_tcpmss.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter/xt_tcpudp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_tcpudp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter/xt_tcpudp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter/xt_tcpudp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_arp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_arp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_arp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_arp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_arp/arp_tables.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_arp/arp_tables.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_arp/arp_tables.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_arp/arp_tables.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_bridge.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_bridge.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_bridge.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_bridge.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_conntrack.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_conntrack.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_nat.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_nat.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_nat_rule.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat_rule.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_nat_rule.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ip_nat_rule.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_queue.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ip_queue.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_queue.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ip_queue.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_tables.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ip_tables.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ip_tables.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ip_tables.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_CLASSIFY.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_DSCP.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_DSCP.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_DSCP.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_DSCP.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_ECN.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ECN.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_ECN.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ECN.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_LOG.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_LOG.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_LOG.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_LOG.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_NFQUEUE.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_REJECT.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_REJECT.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_REJECT.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_REJECT.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_TCPMSS.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_TCPMSS.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_TOS.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TOS.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_TOS.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TOS.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_TTL.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TTL.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_TTL.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_TTL.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_ULOG.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ULOG.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_ULOG.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ULOG.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_addrtype.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_addrtype.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_addrtype.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_addrtype.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_ah.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ah.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_ah.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_ah.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_comment.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_comment.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_comment.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_comment.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_connbytes.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_connbytes.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_connbytes.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_connbytes.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_dccp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dccp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_dccp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dccp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_dscp_.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dscp_.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_dscp_.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_dscp_.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_esp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_esp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_esp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_esp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_hashlimit.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_hashlimit.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_helper.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_helper.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_helper.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_helper.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_iprange.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_iprange.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_iprange.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_iprange.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_length.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_length.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_length.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_length.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_mac.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_mac.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_mac.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_mac.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_owner.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_owner.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_owner.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_owner.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_physdev.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_physdev.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_physdev.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_physdev.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_pkttype.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_pkttype.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_pkttype.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_pkttype.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_realm.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_realm.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_realm.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_realm.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_recent.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_recent.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_recent.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_recent.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_sctp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_sctp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_sctp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_sctp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_state.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_state.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_state.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_state.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_string.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_string.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_string.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_string.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_tos_.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_tos_.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv4/ipt_tos_.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv4/ipt_tos_.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6_tables.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6_tables.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6_tables.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6_tables.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_LOG.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_LOG.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_LOG.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_LOG.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_REJECT.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_REJECT.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_ah.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ah.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_ah.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ah.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_esp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_esp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_esp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_esp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_frag.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_frag.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_frag.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_frag.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_ipv6header.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_ipv6header.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_length.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_length.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_length.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_length.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_mac.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_mac.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_mac.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_mac.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_opts.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_opts.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_opts.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_opts.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_owner.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_owner.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_owner.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_owner.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_physdev.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_physdev.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_physdev.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_physdev.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_rt.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_rt.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netfilter_ipv6/ip6t_rt.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netfilter_ipv6/ip6t_rt.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/netlink.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/netlink.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/netlink.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/netlink.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nfs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfs.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfs2.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfs2.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nfs2.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfs2.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfs3.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfs3.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nfs3.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfs3.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfs4.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfs4.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nfs4.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfs4.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfs_xdr.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfs_xdr.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nfs_xdr.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfs_xdr.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsacl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsacl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nfsacl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsacl.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/auth.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/auth.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nfsd/auth.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/auth.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/const.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/const.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nfsd/const.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/const.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/debug.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/debug.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nfsd/debug.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/debug.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/export.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/export.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nfsd/export.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/export.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/interface.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/interface.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nfsd/interface.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/interface.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/nfsfh.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/nfsfh.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nfsd/nfsfh.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/nfsfh.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/stats.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/stats.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nfsd/stats.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/stats.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nfsd/xdr.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/xdr.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nfsd/xdr.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nfsd/xdr.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/node.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/node.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/node.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/node.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nodemask.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nodemask.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nodemask.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nodemask.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/notifier.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/notifier.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/notifier.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/notifier.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/numa.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/numa.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/numa.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/numa.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/nvram.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/nvram.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/nvram.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/nvram.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/omap_csmi.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/omap_csmi.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/omap_csmi.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/omap_csmi.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/pagemap.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/pagemap.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/pagemap.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/pagemap.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/param.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/param.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/param.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/param.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/patchkey.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/patchkey.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/patchkey.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/patchkey.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/pci.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/pci.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/pci.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/pci.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/pci_ids.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/pci_ids.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/pci_ids.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/pci_ids.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/pci_regs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/pci_regs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/pci_regs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/pci_regs.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/percpu.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/percpu.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/percpu.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/percpu.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/percpu_counter.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/percpu_counter.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/percpu_counter.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/percpu_counter.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/personality.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/personality.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/personality.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/personality.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/pfkeyv2.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/pfkeyv2.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/pfkeyv2.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/pfkeyv2.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/pkt_cls.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/pkt_cls.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/pkt_cls.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/pkt_cls.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/pkt_sched.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/pkt_sched.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/pkt_sched.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/pkt_sched.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/platform_device.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/platform_device.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/platform_device.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/platform_device.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/plist.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/plist.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/plist.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/plist.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/pm.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/pm.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/pm.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/pm.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/pnp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/pnp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/pnp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/pnp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/poll.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/poll.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/poll.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/poll.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/posix_acl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/posix_acl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/posix_acl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/posix_acl.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/posix_types.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/posix_types.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/posix_types.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/posix_types.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ppdev.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ppdev.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ppdev.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ppdev.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ppp_defs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ppp_defs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ppp_defs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ppp_defs.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/prctl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/prctl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/prctl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/prctl.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/preempt.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/preempt.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/preempt.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/preempt.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/proc_fs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/proc_fs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/proc_fs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/proc_fs.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ptrace.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ptrace.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ptrace.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ptrace.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/qic117.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/qic117.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/qic117.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/qic117.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/qnxtypes.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/qnxtypes.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/qnxtypes.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/qnxtypes.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/quota.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/quota.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/quota.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/quota.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/raid/md.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/raid/md.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/raid/md.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/raid/md.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/raid/md_k.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/raid/md_k.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/raid/md_k.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/raid/md_k.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/raid/md_p.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/raid/md_p.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/raid/md_p.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/raid/md_p.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/raid/md_u.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/raid/md_u.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/raid/md_u.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/raid/md_u.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/raid/xor.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/raid/xor.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/raid/xor.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/raid/xor.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/random.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/random.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/random.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/random.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/rbtree.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/rbtree.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/rbtree.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/rbtree.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/rcupdate.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/rcupdate.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/rcupdate.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/rcupdate.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/reboot.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/reboot.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/reboot.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/reboot.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/relay.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/relay.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/relay.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/relay.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/resource.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/resource.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/resource.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/resource.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/route.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/route.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/route.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/route.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/rtc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/rtc.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/rtc.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/rtc.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/rtnetlink.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/rtnetlink.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/rtnetlink.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/rtnetlink.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/rwsem.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/rwsem.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/rwsem.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/rwsem.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sched.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sched.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sched.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sched.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sem.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sem.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sem.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sem.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/seq_file.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/seq_file.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/seq_file.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/seq_file.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/seqlock.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/seqlock.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/seqlock.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/seqlock.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/serial_core.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/serial_core.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/serial_core.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/serial_core.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/serial_reg.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/serial_reg.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/serial_reg.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/serial_reg.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/serio.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/serio.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/serio.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/serio.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/shm.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/shm.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/shm.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/shm.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/signal.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/signal.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/signal.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/signal.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/skbuff.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/skbuff.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/skbuff.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/skbuff.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/slab.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/slab.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/slab.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/slab.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/smb.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/smb.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/smb.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/smb.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/smp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/smp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/smp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/smp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/smp_lock.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/smp_lock.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/smp_lock.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/smp_lock.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/socket.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/socket.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/socket.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/socket.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sockios.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sockios.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sockios.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sockios.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/soundcard.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/soundcard.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/soundcard.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/soundcard.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/spinlock.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/spinlock.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/spinlock.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/spinlock.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/spinlock_api_smp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/spinlock_api_smp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/spinlock_api_smp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/spinlock_api_smp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/spinlock_api_up.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/spinlock_api_up.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/spinlock_api_up.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/spinlock_api_up.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/spinlock_types.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/spinlock_types.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/spinlock_types.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/spinlock_types.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/spinlock_types_up.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/spinlock_types_up.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/spinlock_types_up.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/spinlock_types_up.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/spinlock_up.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/spinlock_up.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/spinlock_up.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/spinlock_up.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/stacktrace.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/stacktrace.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/stacktrace.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/stacktrace.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/stat.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/stat.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/stat.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/stat.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/statfs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/statfs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/statfs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/statfs.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/stddef.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/stddef.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/stddef.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/stddef.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/string.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/string.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/string.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/string.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/stringify.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/stringify.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/stringify.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/stringify.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/auth.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/auth.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/auth.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/auth.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/auth_gss.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/auth_gss.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/auth_gss.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/auth_gss.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/clnt.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/clnt.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/clnt.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/clnt.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/debug.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/debug.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/debug.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/debug.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/gss_api.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/gss_api.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/gss_api.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/gss_api.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/gss_asn1.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/gss_asn1.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/gss_asn1.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/gss_asn1.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/gss_err.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/gss_err.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/gss_err.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/gss_err.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/msg_prot.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/msg_prot.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/msg_prot.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/msg_prot.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/sched.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/sched.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/sched.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/sched.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/stats.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/stats.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/stats.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/stats.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/svc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/svc.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/svc.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/svc.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/svcauth.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/svcauth.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/svcauth.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/svcauth.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/timer.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/timer.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/timer.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/timer.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/types.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/types.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/types.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/types.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/xdr.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/xdr.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/xdr.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/xdr.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sunrpc/xprt.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/xprt.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sunrpc/xprt.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sunrpc/xprt.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/swap.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/swap.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/swap.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/swap.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sysctl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sysctl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sysctl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sysctl.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sysdev.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sysdev.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sysdev.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sysdev.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/sysfs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/sysfs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/sysfs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/sysfs.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/taskstats.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/taskstats.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/taskstats.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/taskstats.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/taskstats_kern.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/taskstats_kern.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/taskstats_kern.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/taskstats_kern.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/tcp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/tcp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/tcp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/tcp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/telephony.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/telephony.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/telephony.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/telephony.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/termios.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/termios.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/termios.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/termios.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/textsearch.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/textsearch.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/textsearch.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/textsearch.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/thread_info.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/thread_info.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/thread_info.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/thread_info.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/threads.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/threads.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/threads.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/threads.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/time.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/time.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/time.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/time.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/timer.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/timer.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/timer.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/timer.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/times.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/times.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/times.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/times.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/timex.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/timex.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/timex.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/timex.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/tiocl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/tiocl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/tiocl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/tiocl.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/transport_class.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/transport_class.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/transport_class.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/transport_class.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/tty.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/tty.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/tty.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/tty.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/types.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/types.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/types.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/types.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/udp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/udp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/udp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/udp.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ufs_fs_i.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ufs_fs_i.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ufs_fs_i.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ufs_fs_i.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/ufs_fs_sb.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/ufs_fs_sb.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/ufs_fs_sb.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/ufs_fs_sb.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/uio.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/uio.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/uio.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/uio.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/un.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/un.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/un.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/un.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/unistd.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/unistd.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/unistd.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/unistd.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/usb.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/usb.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/usb.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/usb.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/usb_ch9.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/usb_ch9.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/usb_ch9.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/usb_ch9.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/usbdevice_fs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/usbdevice_fs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/usbdevice_fs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/usbdevice_fs.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/user.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/user.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/user.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/user.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/utime.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/utime.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/utime.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/utime.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/utsname.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/utsname.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/utsname.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/utsname.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/version.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/version.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/version.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/version.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/vfs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/vfs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/vfs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/vfs.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/videodev.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/videodev.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/videodev.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/videodev.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/videodev2.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/videodev2.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/videodev2.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/videodev2.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/vmalloc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/vmalloc.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/vmalloc.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/vmalloc.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/vt.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/vt.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/vt.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/vt.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/vt_buffer.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/vt_buffer.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/vt_buffer.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/vt_buffer.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/wait.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/wait.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/wait.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/wait.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/wanrouter.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/wanrouter.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/wanrouter.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/wanrouter.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/wireless.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/wireless.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/wireless.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/wireless.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/workqueue.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/workqueue.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/workqueue.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/workqueue.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/xattr.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/xattr.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/xattr.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/xattr.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/zconf.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/zconf.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/zconf.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/zconf.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/zlib.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/zlib.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/zlib.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/zlib.h
diff --git a/ndk/build/platforms/android-3/common/include/linux/zorro_ids.h b/ndk/build/platforms/android-5/arch-arm/usr/include/linux/zorro_ids.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/linux/zorro_ids.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/linux/zorro_ids.h
diff --git a/ndk/build/platforms/android-3/common/include/locale.h b/ndk/build/platforms/android-5/arch-arm/usr/include/locale.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/locale.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/locale.h
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/machine/_types.h b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/_types.h
new file mode 100644
index 0000000..6d10e12
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/_types.h
@@ -0,0 +1,127 @@
+/*	$OpenBSD: _types.h,v 1.3 2006/02/14 18:12:58 miod Exp $	*/
+
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)types.h	8.3 (Berkeley) 1/5/94
+ *	@(#)ansi.h	8.2 (Berkeley) 1/4/94
+ */
+
+#ifndef _ARM__TYPES_H_
+#define _ARM__TYPES_H_
+
+
+#if !defined(__ARM_EABI__)
+/* the kernel defines size_t as unsigned int, but g++ wants it to be unsigned long */
+#define _SIZE_T
+#define _SSIZE_T
+#define _PTRDIFF_T
+typedef unsigned long  size_t;
+typedef long           ssize_t;
+typedef long           ptrdiff_t;
+#endif
+
+//#include <linux/types.h>
+
+/* 7.18.1.1 Exact-width integer types */
+typedef	__signed char		__int8_t;
+typedef	unsigned char		__uint8_t;
+typedef	short			__int16_t;
+typedef	unsigned short		__uint16_t;
+typedef	int			__int32_t;
+typedef	unsigned int		__uint32_t;
+/* LONGLONG */
+typedef	long long		__int64_t;
+/* LONGLONG */
+typedef	unsigned long long	__uint64_t;
+
+/* 7.18.1.2 Minimum-width integer types */
+typedef	__int8_t		__int_least8_t;
+typedef	__uint8_t		__uint_least8_t;
+typedef	__int16_t		__int_least16_t;
+typedef	__uint16_t		__uint_least16_t;
+typedef	__int32_t		__int_least32_t;
+typedef	__uint32_t		__uint_least32_t;
+typedef	__int64_t		__int_least64_t;
+typedef	__uint64_t		__uint_least64_t;
+
+/* 7.18.1.3 Fastest minimum-width integer types */
+typedef	__int32_t		__int_fast8_t;
+typedef	__uint32_t		__uint_fast8_t;
+typedef	__int32_t		__int_fast16_t;
+typedef	__uint32_t		__uint_fast16_t;
+typedef	__int32_t		__int_fast32_t;
+typedef	__uint32_t		__uint_fast32_t;
+typedef	__int64_t		__int_fast64_t;
+typedef	__uint64_t		__uint_fast64_t;
+
+/* 7.18.1.4 Integer types capable of holding object pointers */
+typedef	int 			__intptr_t;
+typedef	unsigned int 		__uintptr_t;
+
+/* 7.18.1.5 Greatest-width integer types */
+typedef	__int64_t		__intmax_t;
+typedef	__uint64_t		__uintmax_t;
+
+/* Register size */
+typedef __int32_t		__register_t;
+
+/* VM system types */
+typedef unsigned long		__vaddr_t;
+typedef unsigned long		__paddr_t;
+typedef unsigned long		__vsize_t;
+typedef unsigned long		__psize_t;
+
+/* Standard system types */
+typedef int			__clock_t;
+typedef int			__clockid_t;
+typedef long			__ptrdiff_t;
+typedef	int			__time_t;
+typedef int			__timer_t;
+#if defined(__GNUC__) && __GNUC__ >= 3
+typedef	__builtin_va_list	__va_list;
+#else
+typedef	char *			__va_list;
+#endif
+
+/* Wide character support types */
+#ifndef __cplusplus
+typedef	int			__wchar_t;
+#endif
+typedef int			__wint_t;
+typedef	int			__rune_t;
+typedef	void *			__wctrans_t;
+typedef	void *			__wctype_t;
+
+#ifdef __ARMEB__
+#define _BYTE_ORDER _BIG_ENDIAN
+#else
+#define _BYTE_ORDER _LITTLE_ENDIAN
+#endif
+
+#endif	/* _ARM__TYPES_H_ */
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/machine/asm.h b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/asm.h
new file mode 100644
index 0000000..c7bd017
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/asm.h
@@ -0,0 +1,130 @@
+/*	$OpenBSD: asm.h,v 1.1 2004/02/01 05:09:49 drahn Exp $	*/
+/*	$NetBSD: asm.h,v 1.4 2001/07/16 05:43:32 matt Exp $	*/
+
+/*
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	from: @(#)asm.h	5.5 (Berkeley) 5/7/91
+ */
+
+#ifndef _ARM32_ASM_H_
+#define _ARM32_ASM_H_
+
+#ifdef __ELF__
+# define _C_LABEL(x)	x
+#else
+# ifdef __STDC__
+#  define _C_LABEL(x)	_ ## x
+# else
+#  define _C_LABEL(x)	_/**/x
+# endif
+#endif
+#define	_ASM_LABEL(x)	x
+
+#ifdef __STDC__
+# define __CONCAT(x,y)	x ## y
+# define __STRING(x)	#x
+#else
+# define __CONCAT(x,y)	x/**/y
+# define __STRING(x)	"x"
+#endif
+
+#ifndef _ALIGN_TEXT
+# define _ALIGN_TEXT .align 0
+#endif
+
+/*
+ * gas/arm uses @ as a single comment character and thus cannot be used here
+ * Instead it recognised the # instead of an @ symbols in .type directives
+ * We define a couple of macros so that assembly code will not be dependant
+ * on one or the other.
+ */
+#define _ASM_TYPE_FUNCTION	#function
+#define _ASM_TYPE_OBJECT	#object
+#define _ENTRY(x) \
+	.text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x:
+
+#ifdef GPROF
+# ifdef __ELF__
+#  define _PROF_PROLOGUE	\
+	mov ip, lr; bl __mcount
+# else
+#  define _PROF_PROLOGUE	\
+	mov ip,lr; bl mcount
+# endif
+#else
+# define _PROF_PROLOGUE
+#endif
+
+#define	ENTRY(y)	_ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
+#define	ENTRY_NP(y)	_ENTRY(_C_LABEL(y))
+#define	ASENTRY(y)	_ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
+#define	ASENTRY_NP(y)	_ENTRY(_ASM_LABEL(y))
+
+#define	ASMSTR		.asciz
+
+#if defined(__ELF__) && defined(PIC)
+#ifdef __STDC__
+#define	PIC_SYM(x,y)	x ## ( ## y ## )
+#else
+#define	PIC_SYM(x,y)	x/**/(/**/y/**/)
+#endif
+#else
+#define	PIC_SYM(x,y)	x
+#endif
+
+#ifdef __ELF__
+#define RCSID(x)	.section ".ident"; .asciz x
+#else
+#define RCSID(x)	.text; .asciz x
+#endif
+
+#ifdef __ELF__
+#define	WEAK_ALIAS(alias,sym)						\
+	.weak alias;							\
+	alias = sym
+#endif
+
+#ifdef __STDC__
+#define	WARN_REFERENCES(sym,msg)					\
+	.stabs msg ## ,30,0,0,0 ;					\
+	.stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0
+#elif defined(__ELF__)
+#define	WARN_REFERENCES(sym,msg)					\
+	.stabs msg,30,0,0,0 ;						\
+	.stabs __STRING(sym),1,0,0,0
+#else
+#define	WARN_REFERENCES(sym,msg)					\
+	.stabs msg,30,0,0,0 ;						\
+	.stabs __STRING(_/**/sym),1,0,0,0
+#endif /* __STDC__ */
+
+#endif /* !_ARM_ASM_H_ */
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/machine/cdefs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/cdefs.h
new file mode 100644
index 0000000..44f1542
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/cdefs.h
@@ -0,0 +1,19 @@
+/*	$OpenBSD: cdefs.h,v 1.2 2005/11/24 20:46:44 deraadt Exp $	*/
+
+#ifndef	_MACHINE_CDEFS_H_
+#define	_MACHINE_CDEFS_H_
+
+#if defined(lint)
+#define __indr_reference(sym,alias)	__lint_equal__(sym,alias)
+#define __warn_references(sym,msg)
+#define __weak_alias(alias,sym)		__lint_equal__(sym,alias)
+#elif defined(__GNUC__) && defined(__STDC__)
+#define __weak_alias(alias,sym)					\
+	__asm__(".weak " __STRING(alias) " ; " __STRING(alias)	\
+	    " = " __STRING(sym));
+#define	__warn_references(sym,msg)				\
+	__asm__(".section .gnu.warning." __STRING(sym)		\
+	    " ; .ascii \"" msg "\" ; .text");
+#endif
+
+#endif /* !_MACHINE_CDEFS_H_ */
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/machine/cpu-features.h b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/cpu-features.h
new file mode 100644
index 0000000..f836006
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/cpu-features.h
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _ARM_MACHINE_CPU_FEATURES_H
+#define _ARM_MACHINE_CPU_FEATURES_H
+
+/* The purpose of this file is to define several macros corresponding
+ * to CPU features that may or may not be available at build time on
+ * on the target CPU.
+ *
+ * This is done to abstract us from the various ARM Architecture
+ * quirks and alphabet soup.
+ *
+ * IMPORTANT: We have no intention to support anything below an ARMv4T !
+ */
+
+/* _ARM_ARCH_REVISION is a number corresponding to the ARM revision
+ * we're going to support
+ *
+ * it looks like our toolchain doesn't define __ARM_ARCH__
+ * so try to guess it.
+ *
+ *
+ *
+ */
+#ifndef __ARM_ARCH__
+
+#  if defined __ARM_ARCH_7__   || defined __ARM_ARCH_7A__ || \
+      defined __ARM_ARCH_7R__  || defined __ARM_ARCH_7M__
+
+#    define __ARM_ARCH__ 7
+
+#  elif defined __ARM_ARCH_6__   || defined __ARM_ARCH_6J__ || \
+      defined __ARM_ARCH_6K__  || defined __ARM_ARCH_6Z__ || \
+      defined __ARM_ARCH_6KZ__ || defined __ARM_ARCH_6T2__
+#
+#    define __ARM_ARCH__ 6
+#
+#  elif defined __ARM_ARCH_5__ || defined __ARM_ARCH_5T__ || \
+        defined __ARM_ARCH_5TE__ || defined __ARM_ARCH_5TEJ__
+#
+#    define __ARM_ARCH__ 5
+#
+#  elif defined __ARM_ARCH_4T__
+#
+#    define __ARM_ARCH__ 4
+#
+#  elif defined __ARM_ARCH_4__
+#    error ARMv4 is not supported, please use ARMv4T at a minimum
+#  else
+#    error Unknown or unsupported ARM architecture
+#  endif
+#endif
+
+/* experimental feature used to check that our ARMv4 workarounds
+ * work correctly without a real ARMv4 machine */
+#ifdef BIONIC_EXPERIMENTAL_FORCE_ARMV4
+#  undef  __ARM_ARCH__
+#  define __ARM_ARCH__  4
+#endif
+
+/* define __ARM_HAVE_5TE if we have the ARMv5TE instructions */
+#if __ARM_ARCH__ > 5
+#  define  __ARM_HAVE_5TE  1
+#elif __ARM_ARCH__ == 5
+#  if defined __ARM_ARCH_5TE__ || defined __ARM_ARCH_5TEJ__
+#    define __ARM_HAVE_5TE  1
+#  endif
+#endif
+
+/* instructions introduced in ARMv5 */
+#if __ARM_ARCH__ >= 5
+#  define  __ARM_HAVE_BLX  1
+#  define  __ARM_HAVE_CLZ  1
+#  define  __ARM_HAVE_LDC2 1
+#  define  __ARM_HAVE_MCR2 1
+#  define  __ARM_HAVE_MRC2 1
+#  define  __ARM_HAVE_STC2 1
+#endif
+
+/* ARMv5TE introduces a few instructions */
+#if __ARM_HAVE_5TE
+#  define  __ARM_HAVE_PLD   1
+#  define  __ARM_HAVE_MCRR  1
+#  define  __ARM_HAVE_MRRC  1
+#endif
+
+/* define __ARM_HAVE_HALFWORD_MULTIPLY when half-word multiply instructions
+ * this means variants of: smul, smulw, smla, smlaw, smlal
+ */
+#if __ARM_HAVE_5TE
+#  define  __ARM_HAVE_HALFWORD_MULTIPLY  1
+#endif
+
+/* define __ARM_HAVE_PAIR_LOAD_STORE when 64-bit memory loads and stored
+ * into/from a pair of 32-bit registers is supported throuhg 'ldrd' and 'strd'
+ */
+#if __ARM_HAVE_5TE
+#  define  __ARM_HAVE_PAIR_LOAD_STORE 1
+#endif
+
+/* define __ARM_HAVE_SATURATED_ARITHMETIC is you have the saturated integer
+ * arithmetic instructions: qdd, qdadd, qsub, qdsub
+ */
+#if __ARM_HAVE_5TE
+#  define  __ARM_HAVE_SATURATED_ARITHMETIC 1
+#endif
+
+/* define __ARM_HAVE_PC_INTERWORK when a direct assignment to the
+ * pc register will switch into thumb/ARM mode depending on bit 0
+ * of the new instruction address. Before ARMv5, this was not the
+ * case, and you have to write:
+ *
+ *     mov  r0, [<some address>]
+ *     bx   r0
+ *
+ * instead of:
+ *
+ *     ldr  pc, [<some address>]
+ *
+ * note that this affects any instruction that explicitely changes the
+ * value of the pc register, including ldm { ...,pc } or 'add pc, #offset'
+ */
+#if __ARM_ARCH__ >= 5
+#  define __ARM_HAVE_PC_INTERWORK
+#endif
+
+
+/* Assembly-only macros */
+
+/* define a handy PLD(address) macro since the cache preload
+ * is an optional opcode
+ */
+#if __ARM_HAVE_PLD
+#  define  PLD(reg,offset)    pld    [reg, offset]
+#else
+#  define  PLD(reg,offset)    /* nothing */
+#endif
+
+#endif /* _ARM_MACHINE_CPU_FEATURES_H */
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/machine/exec.h b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/exec.h
new file mode 100644
index 0000000..227b207
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/exec.h
@@ -0,0 +1,50 @@
+/*	$OpenBSD: exec.h,v 1.9 2003/04/17 03:42:14 drahn Exp $	*/
+/*	$NetBSD: exec.h,v 1.6 1994/10/27 04:16:05 cgd Exp $	*/
+
+/*
+ * Copyright (c) 1993 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _ARM_EXEC_H_
+#define _ARM_EXEC_H_
+
+#define __LDPGSZ	4096
+
+#define NATIVE_EXEC_ELF
+
+#define ARCH_ELFSIZE		32
+
+#define ELF_TARG_CLASS		ELFCLASS32
+#define ELF_TARG_DATA		ELFDATA2LSB
+#define ELF_TARG_MACH		EM_ARM
+
+#define _NLIST_DO_AOUT
+#define _NLIST_DO_ELF
+
+#define _KERN_DO_AOUT
+#define _KERN_DO_ELF
+
+#endif  /* _ARM_EXEC_H_ */
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/machine/ieee.h b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/ieee.h
new file mode 100644
index 0000000..5f9b89e
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/ieee.h
@@ -0,0 +1,191 @@
+/*	$OpenBSD: ieee.h,v 1.1 2004/02/01 05:09:49 drahn Exp $	*/
+/*	$NetBSD: ieee.h,v 1.2 2001/02/21 17:43:50 bjh21 Exp $	*/
+
+/*
+ * Copyright (c) 1992, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ieee.h	8.1 (Berkeley) 6/11/93
+ */
+
+/*
+ * ieee.h defines the machine-dependent layout of the machine's IEEE
+ * floating point.
+ */
+
+/*
+ * Define the number of bits in each fraction and exponent.
+ *
+ *		     k	         k+1
+ * Note that  1.0 x 2  == 0.1 x 2      and that denorms are represented
+ *
+ *					  (-exp_bias+1)
+ * as fractions that look like 0.fffff x 2             .  This means that
+ *
+ *			 -126
+ * the number 0.10000 x 2    , for instance, is the same as the normalized
+ *
+ *		-127			   -128
+ * float 1.0 x 2    .  Thus, to represent 2    , we need one leading zero
+ *
+ *				  -129
+ * in the fraction; to represent 2    , we need two, and so on.  This
+ *
+ *						     (-exp_bias-fracbits+1)
+ * implies that the smallest denormalized number is 2
+ *
+ * for whichever format we are talking about: for single precision, for
+ *
+ *						-126		-149
+ * instance, we get .00000000000000000000001 x 2    , or 1.0 x 2    , and
+ *
+ * -149 == -127 - 23 + 1.
+ */
+
+/*
+ * The ARM has two sets of FP data formats.  The FPA supports 32-bit, 64-bit
+ * and 96-bit IEEE formats, with the words in big-endian order.  VFP supports
+ * 32-bin and 64-bit IEEE formats with the words in the CPU's native byte
+ * order.
+ *
+ * The FPA also has two packed decimal formats, but we ignore them here.
+ */
+
+#define	SNG_EXPBITS	8
+#define	SNG_FRACBITS	23
+
+#define	DBL_EXPBITS	11
+#define	DBL_FRACBITS	52
+
+#ifndef __VFP_FP__
+#define	E80_EXPBITS	15
+#define	E80_FRACBITS	64
+
+#define	EXT_EXPBITS	15
+#define	EXT_FRACBITS	112
+#endif
+
+struct ieee_single {
+	u_int	sng_frac:23;
+	u_int	sng_exponent:8;
+	u_int	sng_sign:1;
+};
+
+#ifdef __VFP_FP__
+struct ieee_double {
+#ifdef __ARMEB__
+	u_int	dbl_sign:1;
+	u_int	dbl_exp:11;
+	u_int	dbl_frach:20;
+	u_int	dbl_fracl;
+#else /* !__ARMEB__ */
+	u_int	dbl_fracl;
+	u_int	dbl_frach:20;
+	u_int	dbl_exp:11;
+	u_int	dbl_sign:1;
+#endif /* !__ARMEB__ */
+};
+#else /* !__VFP_FP__ */
+struct ieee_double {
+	u_int	dbl_frach:20;
+	u_int	dbl_exp:11;
+	u_int	dbl_sign:1;
+	u_int	dbl_fracl;
+};
+
+union ieee_double_u {
+	double                  dblu_d;
+	struct ieee_double      dblu_dbl;
+};
+
+
+struct ieee_e80 {
+	u_int	e80_exp:15;
+	u_int	e80_zero:16;
+	u_int	e80_sign:1;
+	u_int	e80_frach:31;
+	u_int	e80_j:1;
+	u_int	e80_fracl;
+};
+
+struct ieee_ext {
+	u_int	ext_frach:16;
+	u_int	ext_exp:15;
+	u_int	ext_sign:1;
+	u_int	ext_frachm;
+	u_int	ext_fraclm;
+	u_int	ext_fracl;
+};
+#endif /* !__VFP_FP__ */
+
+/*
+ * Floats whose exponent is in [1..INFNAN) (of whatever type) are
+ * `normal'.  Floats whose exponent is INFNAN are either Inf or NaN.
+ * Floats whose exponent is zero are either zero (iff all fraction
+ * bits are zero) or subnormal values.
+ *
+ * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
+ * high fraction; if the bit is set, it is a `quiet NaN'.
+ */
+#define	SNG_EXP_INFNAN	255
+#define	DBL_EXP_INFNAN	2047
+#ifndef __VFP_FP__
+#define	E80_EXP_INFNAN	32767
+#define	EXT_EXP_INFNAN	32767
+#endif /* !__VFP_FP__ */
+
+#if 0
+#define	SNG_QUIETNAN	(1 << 22)
+#define	DBL_QUIETNAN	(1 << 19)
+#ifndef __VFP_FP__
+#define	E80_QUIETNAN	(1 << 15)
+#define	EXT_QUIETNAN	(1 << 15)
+#endif /* !__VFP_FP__ */
+#endif
+
+/*
+ * Exponent biases.
+ */
+#define	SNG_EXP_BIAS	127
+#define	DBL_EXP_BIAS	1023
+#ifndef __VFP_FP__
+#define	E80_EXP_BIAS	16383
+#define	EXT_EXP_BIAS	16383
+#endif /* !__VFP_FP__ */
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/machine/internal_types.h b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/internal_types.h
new file mode 100644
index 0000000..7e610b0
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/internal_types.h
@@ -0,0 +1,10 @@
+/* $OpenBSD: internal_types.h,v 1.2 2004/05/06 15:53:39 drahn Exp $ */
+/* Public domain */
+#ifndef _ARM_INTERNAL_TYPES_H_
+#define _ARM_INTERNAL_TYPES_H_
+
+#ifdef __CHAR_UNSIGNED__
+#define __machine_has_unsigned_chars
+#endif
+
+#endif
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/machine/kernel.h b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/kernel.h
new file mode 100644
index 0000000..462b8e3
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/kernel.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _ARCH_ARM_KERNEL_H
+#define _ARCH_ARM_KERNEL_H
+
+/* this file contains kernel-specific definitions that were optimized out of
+   our processed kernel headers, but still useful nonetheless... */
+
+typedef unsigned long   __kernel_blkcnt_t;
+typedef unsigned long   __kernel_blksize_t;
+
+/* these aren't really defined by the kernel headers though... */
+typedef unsigned long   __kernel_fsblkcnt_t;
+typedef unsigned long   __kernel_fsfilcnt_t;
+typedef unsigned int    __kernel_id_t;
+
+#endif /* _ARCH_ARM_KERNEL_H */
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/machine/limits.h b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/limits.h
new file mode 100644
index 0000000..f9c04fa
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/limits.h
@@ -0,0 +1,63 @@
+/*	$OpenBSD: limits.h,v 1.3 2006/01/06 22:48:46 millert Exp $	*/
+/*	$NetBSD: limits.h,v 1.4 2003/04/28 23:16:18 bjh21 Exp $	*/
+
+/*
+ * Copyright (c) 1988 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	from: @(#)limits.h	7.2 (Berkeley) 6/28/90
+ */
+
+#ifndef	_ARM32_LIMITS_H_
+#define	_ARM32_LIMITS_H_
+
+#include <sys/cdefs.h>
+
+#define	MB_LEN_MAX	1		/* no multibyte characters */
+
+#ifndef	SIZE_MAX
+#define	SIZE_MAX	UINT_MAX	/* max value for a size_t */
+#endif
+#ifndef SSIZE_MAX
+#define	SSIZE_MAX	INT_MAX		/* max value for a ssize_t */
+#endif
+
+#if __BSD_VISIBLE
+#define	SIZE_T_MAX	UINT_MAX	/* max value for a size_t (historic) */
+
+#define	UQUAD_MAX	0xffffffffffffffffULL		/* max unsigned quad */
+#define	QUAD_MAX	0x7fffffffffffffffLL		/* max signed quad */
+#define	QUAD_MIN	(-0x7fffffffffffffffLL-1)	/* min signed quad */
+
+#endif /* __BSD_VISIBLE */
+
+#define LONGLONG_BIT    64
+#define LONGLONG_MIN    (-9223372036854775807LL-1)
+#define LONGLONG_MAX    9223372036854775807LL
+#define ULONGLONG_MAX   18446744073709551615ULL
+
+#endif	/* _ARM32_LIMITS_H_ */
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/machine/setjmp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/setjmp.h
new file mode 100644
index 0000000..f20cab2
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/machine/setjmp.h
@@ -0,0 +1,87 @@
+/*	$OpenBSD: setjmp.h,v 1.1 2004/02/01 05:09:49 drahn Exp $	*/
+/*	$NetBSD: setjmp.h,v 1.2 2001/08/25 14:45:59 bjh21 Exp $	*/
+
+/*
+ * machine/setjmp.h: machine dependent setjmp-related information.
+ */
+
+#ifdef __ELF__
+#define	_JBLEN	64		/* size, in longs, of a jmp_buf */
+#else
+#define	_JBLEN	29		/* size, in longs, of a jmp_buf */
+#endif
+
+/*
+ * NOTE: The internal structure of a jmp_buf is *PRIVATE*
+ *       This information is provided as there is software
+ *       that fiddles with this with obtain the stack pointer
+ *	 (yes really ! and its commercial !).
+ *
+ * Description of the setjmp buffer
+ *
+ * word  0	magic number	(dependant on creator)
+ *       1 -  3	f4		fp register 4
+ *	 4 -  6	f5		fp register 5
+ *	 7 -  9 f6		fp register 6
+ *	10 - 12	f7		fp register 7
+ *	13	fpsr		fp status register
+ *	14	r4		register 4
+ *	15	r5		register 5
+ *	16	r6		register 6
+ *	17	r7		register 7
+ *	18	r8		register 8
+ *	19	r9		register 9
+ *	20	r10		register 10 (sl)
+ *	21	r11		register 11 (fp)
+ *	22	r12		register 12 (ip)
+ *	23	r13		register 13 (sp)
+ *	24	r14		register 14 (lr)
+ *	25	signal mask	(dependant on magic)
+ *	26	(con't)
+ *	27	(con't)
+ *	28	(con't)
+ *
+ * The magic number number identifies the jmp_buf and
+ * how the buffer was created as well as providing
+ * a sanity check
+ *
+ * A side note I should mention - Please do not tamper
+ * with the floating point fields. While they are
+ * always saved and restored at the moment this cannot
+ * be garenteed especially if the compiler happens
+ * to be generating soft-float code so no fp
+ * registers will be used.
+ *
+ * Whilst this can be seen an encouraging people to
+ * use the setjmp buffer in this way I think that it
+ * is for the best then if changes occur compiles will
+ * break rather than just having new builds falling over
+ * mysteriously.
+ */
+
+#define _JB_MAGIC__SETJMP	0x4278f500
+#define _JB_MAGIC_SETJMP	0x4278f501
+
+/* Valid for all jmp_buf's */
+
+#define _JB_MAGIC		 0
+#define _JB_REG_F4		 1
+#define _JB_REG_F5		 4
+#define _JB_REG_F6		 7
+#define _JB_REG_F7		10
+#define _JB_REG_FPSR		13
+#define _JB_REG_R4		14
+#define _JB_REG_R5		15
+#define _JB_REG_R6		16
+#define _JB_REG_R7		17
+#define _JB_REG_R8		18
+#define _JB_REG_R9		19
+#define _JB_REG_R10		20
+#define _JB_REG_R11		21
+#define _JB_REG_R12		22
+#define _JB_REG_R13		23
+#define _JB_REG_R14		24
+
+/* Only valid with the _JB_MAGIC_SETJMP magic */
+
+#define _JB_SIGMASK		25
diff --git a/ndk/build/platforms/android-3/common/include/malloc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/malloc.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/malloc.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/malloc.h
diff --git a/ndk/build/platforms/android-3/common/include/math.h b/ndk/build/platforms/android-5/arch-arm/usr/include/math.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/math.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/math.h
diff --git a/ndk/build/platforms/android-3/common/include/memory.h b/ndk/build/platforms/android-5/arch-arm/usr/include/memory.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/memory.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/memory.h
diff --git a/ndk/build/platforms/android-3/common/include/mntent.h b/ndk/build/platforms/android-5/arch-arm/usr/include/mntent.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/mntent.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/mntent.h
diff --git a/ndk/build/platforms/android-3/common/include/mtd/mtd-abi.h b/ndk/build/platforms/android-5/arch-arm/usr/include/mtd/mtd-abi.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/mtd/mtd-abi.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/mtd/mtd-abi.h
diff --git a/ndk/build/platforms/android-3/common/include/mtd/mtd-user.h b/ndk/build/platforms/android-5/arch-arm/usr/include/mtd/mtd-user.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/mtd/mtd-user.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/mtd/mtd-user.h
diff --git a/ndk/build/platforms/android-3/common/include/net/ethertypes.h b/ndk/build/platforms/android-5/arch-arm/usr/include/net/ethertypes.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/net/ethertypes.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/net/ethertypes.h
diff --git a/ndk/build/platforms/android-3/common/include/net/if.h b/ndk/build/platforms/android-5/arch-arm/usr/include/net/if.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/net/if.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/net/if.h
diff --git a/ndk/build/platforms/android-3/common/include/net/if_arp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/net/if_arp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/net/if_arp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/net/if_arp.h
diff --git a/ndk/build/platforms/android-3/common/include/net/if_dl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/net/if_dl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/net/if_dl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/net/if_dl.h
diff --git a/ndk/build/platforms/android-3/common/include/net/if_ether.h b/ndk/build/platforms/android-5/arch-arm/usr/include/net/if_ether.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/net/if_ether.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/net/if_ether.h
diff --git a/ndk/build/platforms/android-3/common/include/net/if_ieee1394.h b/ndk/build/platforms/android-5/arch-arm/usr/include/net/if_ieee1394.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/net/if_ieee1394.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/net/if_ieee1394.h
diff --git a/ndk/build/platforms/android-3/common/include/net/if_packet.h b/ndk/build/platforms/android-5/arch-arm/usr/include/net/if_packet.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/net/if_packet.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/net/if_packet.h
diff --git a/ndk/build/platforms/android-3/common/include/net/if_types.h b/ndk/build/platforms/android-5/arch-arm/usr/include/net/if_types.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/net/if_types.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/net/if_types.h
diff --git a/ndk/build/platforms/android-3/common/include/net/route.h b/ndk/build/platforms/android-5/arch-arm/usr/include/net/route.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/net/route.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/net/route.h
diff --git a/ndk/build/platforms/android-3/common/include/netdb.h b/ndk/build/platforms/android-5/arch-arm/usr/include/netdb.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/netdb.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/netdb.h
diff --git a/ndk/build/platforms/android-3/common/include/netinet/ether.h b/ndk/build/platforms/android-5/arch-arm/usr/include/netinet/ether.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/netinet/ether.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/netinet/ether.h
diff --git a/ndk/build/platforms/android-3/common/include/netinet/if_ether.h b/ndk/build/platforms/android-5/arch-arm/usr/include/netinet/if_ether.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/netinet/if_ether.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/netinet/if_ether.h
diff --git a/ndk/build/platforms/android-3/common/include/netinet/in.h b/ndk/build/platforms/android-5/arch-arm/usr/include/netinet/in.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/netinet/in.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/netinet/in.h
diff --git a/ndk/build/platforms/android-3/common/include/netinet/in6.h b/ndk/build/platforms/android-5/arch-arm/usr/include/netinet/in6.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/netinet/in6.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/netinet/in6.h
diff --git a/ndk/build/platforms/android-3/common/include/netinet/in_systm.h b/ndk/build/platforms/android-5/arch-arm/usr/include/netinet/in_systm.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/netinet/in_systm.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/netinet/in_systm.h
diff --git a/ndk/build/platforms/android-3/common/include/netinet/ip.h b/ndk/build/platforms/android-5/arch-arm/usr/include/netinet/ip.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/netinet/ip.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/netinet/ip.h
diff --git a/ndk/build/platforms/android-3/common/include/netinet/ip_icmp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/netinet/ip_icmp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/netinet/ip_icmp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/netinet/ip_icmp.h
diff --git a/ndk/build/platforms/android-3/common/include/netinet/tcp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/netinet/tcp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/netinet/tcp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/netinet/tcp.h
diff --git a/ndk/build/platforms/android-3/common/include/netinet/udp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/netinet/udp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/netinet/udp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/netinet/udp.h
diff --git a/ndk/build/platforms/android-3/common/include/netpacket/packet.h b/ndk/build/platforms/android-5/arch-arm/usr/include/netpacket/packet.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/netpacket/packet.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/netpacket/packet.h
diff --git a/ndk/build/platforms/android-3/common/include/new b/ndk/build/platforms/android-5/arch-arm/usr/include/new
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/new
copy to ndk/build/platforms/android-5/arch-arm/usr/include/new
diff --git a/ndk/build/platforms/android-3/common/include/nsswitch.h b/ndk/build/platforms/android-5/arch-arm/usr/include/nsswitch.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/nsswitch.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/nsswitch.h
diff --git a/ndk/build/platforms/android-3/common/include/pathconf.h b/ndk/build/platforms/android-5/arch-arm/usr/include/pathconf.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/pathconf.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/pathconf.h
diff --git a/ndk/build/platforms/android-3/common/include/paths.h b/ndk/build/platforms/android-5/arch-arm/usr/include/paths.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/paths.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/paths.h
diff --git a/ndk/build/platforms/android-3/common/include/poll.h b/ndk/build/platforms/android-5/arch-arm/usr/include/poll.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/poll.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/poll.h
diff --git a/ndk/build/platforms/android-3/common/include/pthread.h b/ndk/build/platforms/android-5/arch-arm/usr/include/pthread.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/pthread.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/pthread.h
diff --git a/ndk/build/platforms/android-3/common/include/pwd.h b/ndk/build/platforms/android-5/arch-arm/usr/include/pwd.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/pwd.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/pwd.h
diff --git a/ndk/build/platforms/android-3/common/include/resolv.h b/ndk/build/platforms/android-5/arch-arm/usr/include/resolv.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/resolv.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/resolv.h
diff --git a/ndk/build/platforms/android-3/common/include/sched.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sched.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sched.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sched.h
diff --git a/ndk/build/platforms/android-3/common/include/semaphore.h b/ndk/build/platforms/android-5/arch-arm/usr/include/semaphore.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/semaphore.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/semaphore.h
diff --git a/ndk/build/platforms/android-3/common/include/setjmp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/setjmp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/setjmp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/setjmp.h
diff --git a/ndk/build/platforms/android-3/common/include/sgtty.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sgtty.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sgtty.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sgtty.h
diff --git a/ndk/build/platforms/android-3/common/include/sha1.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sha1.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sha1.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sha1.h
diff --git a/ndk/build/platforms/android-3/common/include/signal.h b/ndk/build/platforms/android-5/arch-arm/usr/include/signal.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/signal.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/signal.h
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/stdint.h b/ndk/build/platforms/android-5/arch-arm/usr/include/stdint.h
new file mode 100644
index 0000000..237baa2
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/stdint.h
@@ -0,0 +1,266 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _STDINT_H
+#define _STDINT_H
+
+#include <stddef.h>
+#include <sys/_types.h>
+
+
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
+#  define __STDINT_LIMITS
+#endif
+
+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
+#  define  __STDINT_MACROS
+#endif
+
+/* the definitions of STDINT_LIMITS depend on those of STDINT_MACROS */
+#if defined __STDINT_LIMITS && !defined __STDINT_MACROS
+#  define  __STDINT_MACROS
+#endif
+
+#if !defined __STRICT_ANSI__ || __STDC_VERSION__ >= 199901L
+#  define __STDC_INT64__
+#endif
+
+typedef __int8_t      int8_t;
+typedef __uint8_t     uint8_t;
+typedef __int16_t     int16_t;
+typedef __uint16_t    uint16_t;
+typedef __int32_t     int32_t;
+typedef __uint32_t    uint32_t;
+#if defined(__STDC_INT64__)
+typedef __int64_t     int64_t;
+typedef __uint64_t    uint64_t;
+#endif
+
+/*
+ * int8_t & uint8_t
+ */
+
+typedef int8_t        int_least8_t;
+typedef int8_t        int_fast8_t;
+
+typedef uint8_t       uint_least8_t;
+typedef uint8_t       uint_fast8_t;
+
+#ifdef __STDINT_LIMITS
+#  define INT8_MIN         (-128)
+#  define INT8_MAX         (127)
+#  define INT_LEAST8_MIN   INT8_MIN
+#  define INT_LEAST8_MAX   INT8_MAX
+#  define INT_FAST8_MIN    INT8_MIN
+#  define INT_FAST8_MAX    INT8_MAX
+
+#  define UINT8_MAX           (255U)
+#  define UINT_LEAST8_MAX     UINT8_MAX
+#  define UINT_FAST8_MAX      UINT8_MAX
+#endif
+
+#ifdef __STDINT_MACROS
+#  define INT8_C(c)	c
+#  define INT_LEAST8_C(c)	 INT8_C(c)
+#  define INT_FAST8_C(c)	INT8_C(c)
+
+#  define UINT8_C(c)	c ## U
+#  define UINT_LEAST8_C(c)  UINT8_C(c)
+#  define UINT_FAST8_C(c)  UINT8_C(c)
+#endif
+
+/*
+ * int16_t & uint16_t
+ */
+
+
+typedef int16_t       int_least16_t;
+typedef int32_t       int_fast16_t;
+
+typedef uint16_t      uint_least16_t;
+typedef uint32_t      uint_fast16_t;
+
+#ifdef __STDINT_LIMITS
+#  define INT16_MIN	(-32768)
+#  define INT16_MAX	(32767)
+#  define INT_LEAST16_MIN	INT16_MIN
+#  define INT_LEAST16_MAX	INT16_MAX
+#  define INT_FAST16_MIN	INT32_MIN
+#  define INT_FAST16_MAX	INT32_MAX
+
+#  define UINT16_MAX	(65535U)
+#  define UINT_LEAST16_MAX UINT16_MAX
+#  define UINT_FAST16_MAX UINT32_MAX
+#endif
+
+#ifdef __STDINT_MACROS
+#  define INT16_C(c)	c
+#  define INT_LEAST16_C(c) INT16_C(c)
+#  define INT_FAST16_C(c)	 INT32_C(c)
+
+#  define UINT16_C(c)	c ## U
+#  define UINT_LEAST16_C(c) UINT16_C(c)
+#  define UINT_FAST16_C(c) UINT32_C(c)
+#endif
+
+/*
+ * int32_t & uint32_t
+ */
+
+typedef int32_t       int_least32_t;
+typedef int32_t       int_fast32_t;
+
+typedef uint32_t      uint_least32_t;
+typedef uint32_t      uint_fast32_t;
+
+#ifdef __STDINT_LIMITS
+#  define INT32_MIN	(-2147483647-1)
+#  define INT32_MAX	(2147483647)
+#  define INT_LEAST32_MIN	INT32_MIN
+#  define INT_LEAST32_MAX	INT32_MAX
+#  define INT_FAST32_MIN	INT32_MIN
+#  define INT_FAST32_MAX	INT32_MAX
+
+#  define UINT32_MAX	(4294967295U)
+#  define UINT_LEAST32_MAX UINT32_MAX
+#  define UINT_FAST32_MAX UINT32_MAX
+#endif
+
+#ifdef __STDINT_MACROS
+#  define INT32_C(c)	c
+#  define INT_LEAST32_C(c) INT32_C(c)
+#  define INT_FAST32_C(c)  INT32_C(c)
+
+#  define UINT32_C(c)	c ## U
+#  define UINT_LEAST32_C(c) UINT32_C(c)
+#  define UINT_FAST32_C(c) UINT32_C(c)
+#endif
+
+#if defined(__STDC_INT64__)
+/*
+ *  int64_t
+ */
+typedef int64_t       int_least64_t;
+typedef int64_t       int_fast64_t;
+
+typedef uint64_t      uint_least64_t;
+typedef uint64_t      uint_fast64_t;
+
+
+#ifdef __STDINT_LIMITS
+#  define INT64_MIN        (__INT64_C(-9223372036854775807)-1)
+#  define INT64_MAX        (__INT64_C(9223372036854775807))
+#  define INT_LEAST64_MIN  INT64_MIN
+#  define INT_LEAST64_MAX  INT64_MAX
+#  define INT_FAST64_MIN   INT64_MIN
+#  define INT_FAST64_MAX   INT64_MAX
+#  define UINT64_MAX       (__UINT64_C(18446744073709551615))
+
+#  define UINT_LEAST64_MAX UINT64_MAX
+#  define UINT_FAST64_MAX UINT64_MAX
+#endif
+
+#ifdef __STDINT_MACROS
+#  define __INT64_C(c)     c ## LL
+#  define INT64_C(c)       __INT64_C(c)
+#  define INT_LEAST64_C(c) INT64_C(c)
+#  define INT_FAST64_C(c)  INT64_C(c)
+
+#  define __UINT64_C(c)     c ## ULL
+#  define UINT64_C(c)       __UINT64_C(c)
+#  define UINT_LEAST64_C(c) UINT64_C(c)
+#  define UINT_FAST64_C(c)  UINT64_C(c)
+#endif
+
+
+#  define __PRI64_RANK   "ll"
+#  define __PRIFAST_RANK ""
+#  define __PRIPTR_RANK  ""
+
+#endif /* __STDC_INT64__ */
+
+/*
+ * intptr_t & uintptr_t
+ */
+
+typedef int           intptr_t;
+typedef unsigned int  uintptr_t;
+
+#  define INTPTR_MIN    INT32_MIN
+#  define INTPTR_MAX    INT32_MAX
+#  define UINTPTR_MAX   UINT32_MAX
+#  define INTPTR_C(c)   INT32_C(c)
+#  define UINTPTR_C(c)  UINT32_C(c)
+#  define PTRDIFF_C(c)  INT32_C(c)
+#  define PTRDIFF_MIN   INT32_MIN
+#  define PTRDIFF_MAX   INT32_MAX
+
+
+/*
+ *  intmax_t & uintmax_t
+ */
+
+#if defined(__STDC_INT64__)
+
+typedef uint64_t uintmax_t;
+typedef int64_t  intmax_t;
+
+#define INTMAX_MIN	INT64_MIN
+#define INTMAX_MAX	INT64_MAX
+#define UINTMAX_MAX	UINT64_MAX
+
+#define INTMAX_C(c)	INT64_C(c)
+#define UINTMAX_C(c)	UINT64_C(c)
+
+#else /* !__STDC_INT64__ */
+
+typedef uint32_t  uintmax_t;
+typedef int32_t   intmax_t;
+
+#define  INTMAX_MIN    INT32_MIN
+#define  INTMAX_MAX    INT32_MAX
+#define  UINTMAX_MAX   UINT32_MAX
+
+#define INTMAX_C(c)	INT32_C(c)
+#define UINTMAX_C(c)	UINT32_C(c)
+
+#endif /* !__STDC_INT64__ */
+
+
+/* size_t is defined by the GCC-specific <stddef.h> */
+#ifndef _SSIZE_T_DEFINED_
+#define _SSIZE_T_DEFINED_
+typedef long int  ssize_t;
+#endif
+
+#define _BITSIZE 32
+
+/* Keep the kernel from trying to define these types... */
+#define __BIT_TYPES_DEFINED__
+
+#endif /* _STDINT_H */
diff --git a/ndk/build/platforms/android-3/common/include/stdio.h b/ndk/build/platforms/android-5/arch-arm/usr/include/stdio.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/stdio.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/stdio.h
diff --git a/ndk/build/platforms/android-3/common/include/stdlib.h b/ndk/build/platforms/android-5/arch-arm/usr/include/stdlib.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/stdlib.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/stdlib.h
diff --git a/ndk/build/platforms/android-3/common/include/stl_pair.h b/ndk/build/platforms/android-5/arch-arm/usr/include/stl_pair.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/stl_pair.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/stl_pair.h
diff --git a/ndk/build/platforms/android-3/common/include/string.h b/ndk/build/platforms/android-5/arch-arm/usr/include/string.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/string.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/string.h
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/strings.h b/ndk/build/platforms/android-5/arch-arm/usr/include/strings.h
new file mode 100644
index 0000000..fee7dc4
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/strings.h
@@ -0,0 +1,56 @@
+/*	$NetBSD: strings.h,v 1.10 2005/02/03 04:39:32 perry Exp $	*/
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _STRINGS_H_
+#define _STRINGS_H_
+
+#include <sys/types.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int	 bcmp(const void *, const void *, size_t);
+void	 bcopy(const void *, void *, size_t);
+void	 bzero(void *, size_t);
+int	 ffs(int);
+char	*index(const char *, int);
+char	*rindex(const char *, int);
+int	 strcasecmp(const char *, const char *);
+int	 strncasecmp(const char *, const char *, size_t);
+__END_DECLS
+
+#endif /* !defined(_STRINGS_H_) */
diff --git a/ndk/build/platforms/android-3/common/include/sys/_errdefs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/_errdefs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/_errdefs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/_errdefs.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/_sigdefs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/_sigdefs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/_sigdefs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/_sigdefs.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/_system_properties.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/_system_properties.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/_system_properties.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/_system_properties.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/_types.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/_types.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/_types.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/_types.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/atomics.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/atomics.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/atomics.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/atomics.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/cdefs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/cdefs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/cdefs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/cdefs.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/cdefs_elf.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/cdefs_elf.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/cdefs_elf.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/cdefs_elf.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/dirent.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/dirent.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/dirent.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/dirent.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/endian.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/endian.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/endian.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/endian.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/epoll.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/epoll.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/epoll.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/epoll.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/errno.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/errno.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/errno.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/errno.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/exec_elf.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/exec_elf.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/exec_elf.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/exec_elf.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/file.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/file.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/file.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/file.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/fsuid.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/fsuid.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/fsuid.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/fsuid.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/inotify.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/inotify.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/inotify.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/inotify.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/ioctl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/ioctl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/ioctl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/ioctl.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/ioctl_compat.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/ioctl_compat.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/ioctl_compat.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/ioctl_compat.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/ipc.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/ipc.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/ipc.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/ipc.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/klog.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/klog.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/klog.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/klog.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/limits.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/limits.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/limits.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/limits.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/linux-syscalls.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/linux-syscalls.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/linux-syscalls.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/linux-syscalls.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/linux-unistd.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/linux-unistd.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/linux-unistd.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/linux-unistd.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/mman.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/mman.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/mman.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/mman.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/mount.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/mount.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/mount.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/mount.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/param.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/param.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/param.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/param.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/poll.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/poll.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/poll.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/poll.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/prctl.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/prctl.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/prctl.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/prctl.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/ptrace.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/ptrace.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/ptrace.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/ptrace.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/reboot.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/reboot.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/reboot.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/reboot.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/resource.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/resource.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/resource.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/resource.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/select.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/select.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/select.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/select.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/sendfile.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/sendfile.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/sendfile.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/sendfile.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/socket.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/socket.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/socket.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/socket.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/socketcalls.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/socketcalls.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/socketcalls.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/socketcalls.h
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/sys/stat.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/stat.h
new file mode 100644
index 0000000..091ee6d
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/stat.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _SYS_STAT_H_
+#define _SYS_STAT_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <linux/stat.h>
+
+#include <endian.h>
+
+__BEGIN_DECLS
+
+/* really matches stat64 in the kernel, hence the padding
+ * Note: The kernel zero's the padded region because glibc might read them
+ * in the hope that the kernel has stretched to using larger sizes.
+ */
+struct stat {
+    unsigned long long  st_dev;
+    unsigned char       __pad0[4];
+
+    unsigned long       __st_ino;
+    unsigned int        st_mode;
+    unsigned int        st_nlink;
+
+    unsigned long       st_uid;
+    unsigned long       st_gid;
+
+    unsigned long long  st_rdev;
+    unsigned char       __pad3[4];
+
+    long long           st_size;
+    unsigned long	st_blksize;
+    unsigned long long  st_blocks;
+
+    unsigned long       st_atime;
+    unsigned long       st_atime_nsec;
+
+    unsigned long       st_mtime;
+    unsigned long       st_mtime_nsec;
+
+    unsigned long       st_ctime;
+    unsigned long       st_ctime_nsec;
+
+    unsigned long long  st_ino;
+};
+
+/* For compatibility with GLibc, we provide macro aliases
+ * for the non-Posix nano-seconds accessors.
+ */
+#define  st_atimensec  st_atime_nsec
+#define  st_mtimensec  st_mtime_nsec
+#define  st_ctimensec  st_ctime_nsec
+
+extern int    chmod(const char *, mode_t);
+extern int    fchmod(int, mode_t);
+extern int    mkdir(const char *, mode_t);
+
+extern int    stat(const char *, struct stat *);
+extern int    fstat(int, struct stat *);
+extern int    lstat(const char *, struct stat *);
+extern int    mknod(const char *, mode_t, dev_t);
+extern mode_t umask(mode_t);
+
+#define  stat64    stat
+#define  fstat64   fstat
+#define  lstat64   lstat
+
+static __inline__ int mkfifo(const char *__p, mode_t __m)
+{
+  return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t)0);
+}
+
+extern int  fstatat(int dirfd, const char *path, struct stat *buf, int flags);
+extern int  mkdirat(int dirfd, const char *pathname, mode_t mode);
+extern int fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags);
+extern int fchmodat(int dirfd, const char *path, mode_t mode, int flags);
+extern int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
+
+__END_DECLS
+
+#endif /* _SYS_STAT_H_ */
diff --git a/ndk/build/platforms/android-3/common/include/sys/statfs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/statfs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/statfs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/statfs.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/syscall.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/syscall.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/syscall.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/syscall.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/sysconf.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/sysconf.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/sysconf.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/sysconf.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/sysinfo.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/sysinfo.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/sysinfo.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/sysinfo.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/syslimits.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/syslimits.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/syslimits.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/syslimits.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/sysmacros.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/sysmacros.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/sysmacros.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/sysmacros.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/system_properties.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/system_properties.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/system_properties.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/system_properties.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/time.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/time.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/time.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/time.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/timeb.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/timeb.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/timeb.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/timeb.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/times.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/times.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/times.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/times.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/ttychars.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/ttychars.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/ttychars.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/ttychars.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/ttydev.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/ttydev.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/ttydev.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/ttydev.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/types.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/types.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/types.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/types.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/uio.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/uio.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/uio.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/uio.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/un.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/un.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/un.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/un.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/utime.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/utime.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/utime.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/utime.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/utsname.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/utsname.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/utsname.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/utsname.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/vfs.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/vfs.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/vfs.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/vfs.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/vt.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/vt.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/vt.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/vt.h
diff --git a/ndk/build/platforms/android-3/common/include/sys/wait.h b/ndk/build/platforms/android-5/arch-arm/usr/include/sys/wait.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/sys/wait.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/sys/wait.h
diff --git a/ndk/build/platforms/android-3/common/include/syslog.h b/ndk/build/platforms/android-5/arch-arm/usr/include/syslog.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/syslog.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/syslog.h
diff --git a/ndk/build/platforms/android-3/common/include/termios.h b/ndk/build/platforms/android-5/arch-arm/usr/include/termios.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/termios.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/termios.h
diff --git a/ndk/build/platforms/android-3/common/include/thread_db.h b/ndk/build/platforms/android-5/arch-arm/usr/include/thread_db.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/thread_db.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/thread_db.h
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/include/time.h b/ndk/build/platforms/android-5/arch-arm/usr/include/time.h
new file mode 100644
index 0000000..6163c6d
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/include/time.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _TIME_H_
+#define _TIME_H_
+
+#include <sys/cdefs.h>
+#include <sys/time.h>
+
+#define __ARCH_SI_UID_T __kernel_uid32_t
+#include <asm/siginfo.h>
+#undef __ARCH_SI_UID_T
+
+__BEGIN_DECLS
+
+extern time_t   time(time_t *);
+extern int      nanosleep(const struct timespec *, struct timespec *);
+
+extern char *strtotimeval(const char *str, struct timeval *tv);
+
+struct tm {
+   int     tm_sec;         /* seconds */
+   int     tm_min;         /* minutes */
+   int     tm_hour;        /* hours */
+   int     tm_mday;        /* day of the month */
+   int     tm_mon;         /* month */
+   int     tm_year;        /* year */
+   int     tm_wday;        /* day of the week */
+   int     tm_yday;        /* day in the year */
+   int     tm_isdst;       /* daylight saving time */
+
+   long int tm_gmtoff;     /* Seconds east of UTC.  */
+   const char *tm_zone;    /* Timezone abbreviation.  */
+
+};
+
+/* defining TM_ZONE indicates that we have a "timezone abbreviation" field in
+ * struct tm, the value should be the field name
+ */
+#define   TM_ZONE   tm_zone
+
+extern char* asctime(const struct tm* a);
+extern char* asctime_r(const struct tm* a, char* buf);
+
+/* Return the difference between TIME1 and TIME0.  */
+extern double difftime (time_t __time1, time_t __time0);
+extern time_t mktime (struct tm *a);
+
+extern struct tm*  localtime(const time_t *t);
+extern struct tm*  localtime_r(const time_t *timep, struct tm *result);
+
+extern struct tm*  gmtime(const time_t *timep);
+extern struct tm*  gmtime_r(const time_t *timep, struct tm *result);
+
+extern char*       strptime(const char *buf, const char *fmt, struct tm *tm);
+extern size_t      strftime(char *s, size_t max, const char *format, const struct tm *tm);
+
+extern char *ctime(const time_t *timep);
+extern char *ctime_r(const time_t *timep, char *buf);
+
+extern void  tzset(void);
+
+/* global includes */
+extern char*     tzname[];
+extern int       daylight;
+extern long int  timezone;
+
+#define CLOCKS_PER_SEC     1000000
+
+extern clock_t   clock(void);
+
+/* BIONIC: extra linux clock goodies */
+extern int clock_getres(int, struct timespec *);
+extern int clock_gettime(int, struct timespec *);
+
+#define CLOCK_REALTIME             0
+#define CLOCK_MONOTONIC            1
+#define CLOCK_PROCESS_CPUTIME_ID   2
+#define CLOCK_THREAD_CPUTIME_ID    3
+#define CLOCK_REALTIME_HR          4
+#define CLOCK_MONOTONIC_HR         5
+
+extern int  timer_create(int, struct sigevent*, timer_t*);
+extern int  timer_delete(timer_t);
+extern int  timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue);
+extern int  timer_gettime(timer_t timerid, struct itimerspec *value);
+extern int  timer_getoverrun(timer_t  timerid);
+
+__END_DECLS
+
+#endif /* _TIME_H_ */
diff --git a/ndk/build/platforms/android-3/common/include/time64.h b/ndk/build/platforms/android-5/arch-arm/usr/include/time64.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/time64.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/time64.h
diff --git a/ndk/build/platforms/android-3/common/include/typeinfo b/ndk/build/platforms/android-5/arch-arm/usr/include/typeinfo
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/typeinfo
copy to ndk/build/platforms/android-5/arch-arm/usr/include/typeinfo
diff --git a/ndk/build/platforms/android-3/common/include/unistd.h b/ndk/build/platforms/android-5/arch-arm/usr/include/unistd.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/unistd.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/unistd.h
diff --git a/ndk/build/platforms/android-3/common/include/util.h b/ndk/build/platforms/android-5/arch-arm/usr/include/util.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/util.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/util.h
diff --git a/ndk/build/platforms/android-3/common/include/utility b/ndk/build/platforms/android-5/arch-arm/usr/include/utility
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/utility
copy to ndk/build/platforms/android-5/arch-arm/usr/include/utility
diff --git a/ndk/build/platforms/android-3/common/include/utime.h b/ndk/build/platforms/android-5/arch-arm/usr/include/utime.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/utime.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/utime.h
diff --git a/ndk/build/platforms/android-3/common/include/utmp.h b/ndk/build/platforms/android-5/arch-arm/usr/include/utmp.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/utmp.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/utmp.h
diff --git a/ndk/build/platforms/android-3/common/include/wchar.h b/ndk/build/platforms/android-5/arch-arm/usr/include/wchar.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/wchar.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/wchar.h
diff --git a/ndk/build/platforms/android-3/common/include/wctype.h b/ndk/build/platforms/android-5/arch-arm/usr/include/wctype.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/wctype.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/wctype.h
diff --git a/ndk/build/platforms/android-3/common/include/zconf.h b/ndk/build/platforms/android-5/arch-arm/usr/include/zconf.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/zconf.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/zconf.h
diff --git a/ndk/build/platforms/android-3/common/include/zlib.h b/ndk/build/platforms/android-5/arch-arm/usr/include/zlib.h
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/zlib.h
copy to ndk/build/platforms/android-5/arch-arm/usr/include/zlib.h
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/crtbegin_dynamic.o b/ndk/build/platforms/android-5/arch-arm/usr/lib/crtbegin_dynamic.o
new file mode 100644
index 0000000..63d4efa
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/crtbegin_dynamic.o
Binary files differ
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/crtbegin_static.o b/ndk/build/platforms/android-5/arch-arm/usr/lib/crtbegin_static.o
new file mode 100644
index 0000000..d11c79e
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/crtbegin_static.o
Binary files differ
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/crtend_android.o b/ndk/build/platforms/android-5/arch-arm/usr/lib/crtend_android.o
new file mode 100644
index 0000000..5b76af8
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/crtend_android.o
Binary files differ
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/libGLESv1_CM.so b/ndk/build/platforms/android-5/arch-arm/usr/lib/libGLESv1_CM.so
new file mode 100644
index 0000000..f61f631
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/libGLESv1_CM.so
Binary files differ
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/libGLESv2.so b/ndk/build/platforms/android-5/arch-arm/usr/lib/libGLESv2.so
new file mode 100644
index 0000000..fa6557b
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/libGLESv2.so
Binary files differ
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/libc.a b/ndk/build/platforms/android-5/arch-arm/usr/lib/libc.a
new file mode 100644
index 0000000..4fdcafc
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/libc.a
Binary files differ
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/libc.so b/ndk/build/platforms/android-5/arch-arm/usr/lib/libc.so
new file mode 100644
index 0000000..9714e97
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/libc.so
Binary files differ
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/libdl.so b/ndk/build/platforms/android-5/arch-arm/usr/lib/libdl.so
new file mode 100644
index 0000000..e2a589c
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/libdl.so
Binary files differ
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/liblog.so b/ndk/build/platforms/android-5/arch-arm/usr/lib/liblog.so
new file mode 100644
index 0000000..92bf1a7
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/liblog.so
Binary files differ
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/libm.a b/ndk/build/platforms/android-5/arch-arm/usr/lib/libm.a
new file mode 100644
index 0000000..3e1ccb0
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/libm.a
Binary files differ
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/libm.so b/ndk/build/platforms/android-5/arch-arm/usr/lib/libm.so
new file mode 100644
index 0000000..87f4446
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/libm.so
Binary files differ
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/libstdc++.a b/ndk/build/platforms/android-5/arch-arm/usr/lib/libstdc++.a
new file mode 100644
index 0000000..8f495a5
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/libstdc++.a
Binary files differ
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/libstdc++.so b/ndk/build/platforms/android-5/arch-arm/usr/lib/libstdc++.so
new file mode 100644
index 0000000..d3d103f
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/libstdc++.so
Binary files differ
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/libthread_db.a b/ndk/build/platforms/android-5/arch-arm/usr/lib/libthread_db.a
new file mode 100644
index 0000000..9d634be
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/libthread_db.a
Binary files differ
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/libthread_db.so b/ndk/build/platforms/android-5/arch-arm/usr/lib/libthread_db.so
new file mode 100644
index 0000000..ea603f0
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/libthread_db.so
Binary files differ
diff --git a/ndk/build/platforms/android-5/arch-arm/usr/lib/libz.so b/ndk/build/platforms/android-5/arch-arm/usr/lib/libz.so
new file mode 100644
index 0000000..f50a0ff
--- /dev/null
+++ b/ndk/build/platforms/android-5/arch-arm/usr/lib/libz.so
Binary files differ
diff --git a/ndk/build/toolchains/arm-eabi-4.2.1/setup.mk b/ndk/build/toolchains/arm-eabi-4.2.1/setup.mk
index 4c10c07..f5ca8b4 100644
--- a/ndk/build/toolchains/arm-eabi-4.2.1/setup.mk
+++ b/ndk/build/toolchains/arm-eabi-4.2.1/setup.mk
@@ -74,7 +74,7 @@
 TARGET_ARFLAGS := crs
 
 TARGET_LIBGCC := $(shell $(TARGET_CC) -mthumb-interwork -print-libgcc-file-name)
-TARGET_LDLIBS := -Wl,-rpath-link=$(SYSROOT)/usr/lib $(TARGET_LIBGCC)
+TARGET_LDLIBS := -Wl,-rpath-link=$(SYSROOT)/usr/lib
 
 # These flags are used to ensure that a binary doesn't reference undefined
 # flags.
@@ -84,6 +84,15 @@
 # this toolchain's generated binaries
 TARGET_ABI_SUBDIR := armeabi
 
+# NOTE: Ensure that TARGET_LIBGCC is placed after all private objects
+#       and static libraries, but before any other library in the link
+#       command line when generating shared libraries and executables.
+#
+#       This ensures that all libgcc.a functions required by the target
+#       will be included into it, instead of relying on what's available
+#       on other libraries like libc.so, which may change between system
+#       releases due to toolchain or library changes.
+#
 define cmd-build-shared-library
 $(TARGET_CC) \
     -nostdlib -Wl,-soname,$(notdir $@) \
@@ -93,6 +102,7 @@
     $(PRIVATE_WHOLE_STATIC_LIBRARIES) \
     -Wl,--no-whole-archive \
     $(PRIVATE_STATIC_LIBRARIES) \
+    $(TARGET_LIBGCC) \
     $(PRIVATE_SHARED_LIBRARIES) \
     $(PRIVATE_LDFLAGS) \
     $(PRIVATE_LDLIBS) \
@@ -105,10 +115,11 @@
     -Wl,-dynamic-linker,/system/bin/linker \
     -Wl,--gc-sections \
     -Wl,-z,nocopyreloc \
-    $(PRIVATE_SHARED_LIBRARIES) \
     $(TARGET_CRTBEGIN_DYNAMIC_O) \
     $(PRIVATE_OBJECTS) \
     $(PRIVATE_STATIC_LIBRARIES) \
+    $(TARGET_LIBGCC) \
+    $(PRIVATE_SHARED_LIBRARIES) \
     $(PRIVATE_LDFLAGS) \
     $(PRIVATE_LDLIBS) \
     $(TARGET_CRTEND_O) \
diff --git a/ndk/build/tools/build-ndk-sysroot.sh b/ndk/build/tools/build-ndk-sysroot.sh
index 8741220..c9f3285 100755
--- a/ndk/build/tools/build-ndk-sysroot.sh
+++ b/ndk/build/tools/build-ndk-sysroot.sh
@@ -28,7 +28,7 @@
 # WARNING: For now, only a single target ABI/Architecture us supported
 #
 
-source `dirname $0`/../core/ndk-common.sh
+. `dirname $0`/../core/ndk-common.sh
 
 # PLATFORM is the name of the current Android system platform
 PLATFORM=android-3
diff --git a/ndk/build/tools/build-toolchain.sh b/ndk/build/tools/build-toolchain.sh
index 95bf100..1c6b398 100755
--- a/ndk/build/tools/build-toolchain.sh
+++ b/ndk/build/tools/build-toolchain.sh
@@ -21,7 +21,7 @@
 #
 
 # include common function and variable definitions
-source `dirname $0`/../core/ndk-common.sh
+. `dirname $0`/../core/ndk-common.sh
 
 # number of jobs to run in parallel when running make
 JOBS=$HOST_NUM_CPUS
@@ -424,9 +424,9 @@
     echo "Configure: gdbserver build."
     mkdir -p $GDBSERVER_BUILD
     cd $GDBSERVER_BUILD &&
-    CFLAGS="-g -O2 -static -mandroid -I$ANDROID_SYSROOT/usr/include" \
-    LDFLAGS= \
-    CC="$TOOLCHAIN_PREFIX/bin/arm-eabi-gcc" \
+    export CC="$TOOLCHAIN_PREFIX/bin/arm-eabi-gcc" &&
+    export CFLAGS="-g -O2 -static -mandroid -I$ANDROID_SYSROOT/usr/include"  &&
+    export LDFLAGS= &&
     run $TOOLCHAIN_SRC/gdb-6.6/gdb/gdbserver/configure \
     --host=arm-eabi-linux \
     --with-sysroot=$ANDROID_SYSROOT
diff --git a/ndk/build/tools/make-release.sh b/ndk/build/tools/make-release.sh
index 002150a..1ca188b 100755
--- a/ndk/build/tools/make-release.sh
+++ b/ndk/build/tools/make-release.sh
@@ -22,8 +22,11 @@
 NDK_ROOT_DIR=`dirname $0`/../..
 NDK_ROOT_DIR=`cd $NDK_ROOT_DIR && pwd`
 
-# the release name
-RELEASE=1.6_r1
+. $NDK_ROOT_DIR/build/core/ndk-common.sh
+force_32bit_binaries
+
+# the default release name (use today's date)
+RELEASE=`date +%Y%m%d`
 
 # the package prefix
 PREFIX=android-ndk
@@ -37,6 +40,13 @@
 # the list of supported host development systems
 PREBUILT_SYSTEMS="linux-x86 darwin-x86 windows"
 
+# a prebuilt NDK archive (.zip file). empty means don't use any
+PREBUILT_NDK=
+
+# set to 'yes' if we should use 'git ls-files' to list the files to
+# be copied into the archive.
+USE_GIT_FILES=yes
+
 OPTION_HELP=no
 
 for opt do
@@ -55,12 +65,16 @@
   ;;
   --prefix=*) PREFIX=$optarg
   ;;
+  --prebuilt-ndk=*) PREBUILT_NDK=$optarg
+  ;;
   --prebuilt-prefix=*) PREBUILT_PREFIX=$optarg
   ;;
   --prebuilt-path=*) PREBUILT_DIR=$optarg
   ;;
   --systems=*) PREBUILT_SYSTEMS=$optarg
   ;;
+  --no-git) USE_GIT_FILES=no
+  ;;
   *)
     echo "unknown option '$opt', use --help"
     exit 1
@@ -74,52 +88,87 @@
     echo "You will need to specify the path of a directory containing"
     echo "prebuilt toolchain tarballs with the --prebuilt-path option."
     echo ""
+    echo "Alternatively, you can specify an existing NDK release package"
+    echo "with the --prebuilt-ndk option."
+    echo ""
     echo "Options: [defaults in brackets after descriptions]"
     echo ""
     echo "  --help                    Print this help message"
     echo "  --prefix=PREFIX           Package prefix name [$PREFIX]"
     echo "  --release=NAME            Specify release name [$RELEASE]"
     echo "  --systems=SYSTEMS         List of host system packages [$PREBUILT_SYSTEMS]"
+    echo "  --prebuilt-ndk=FILE       Specify a previous NDK package [$PREBUILT_NDK]"
     echo "  --prebuilt-path=PATH      Location of prebuilt binary tarballs [$PREBUILT_DIR]"
     echo "  --prebuilt-prefix=PREFIX  Prefix of prebuilt binary tarballs [$PREBUILT_PREFIX]"
+    echo "  --no-git                  Don't use git to list input files, take all of them."
     echo ""
     exit 1
 fi
 
 # Check the prebuilt path
 #
-if [ -z "$PREBUILT_DIR" ] ; then
+if [ -n "$PREBUILD_NDK" -a -n "$PREBUILT_DIR" ] ; then
+    echo "ERROR: You cannot use both --prebuilt-ndk and --prebuilt-path at the same time."
+    exit 1
+fi
+
+if [ -z "$PREBUILT_DIR" -a -z "$PREBUILT_NDK" ] ; then
     echo "ERROR: You must use --prebuilt-path=PATH to specify the path of prebuilt binary tarballs."
+    echo "       Or --prebuilt-ndk=FILE to specify an existing NDK release archive."
     exit 1
 fi
 
-if [ ! -d "$PREBUILT_DIR" ] ; then
-    echo "ERROR: the --prebuilt-path argument is not a directory path: $PREBUILT_DIR"
-    exit 1
-fi
-
-# Check the systems
-#
-if [ -z "$PREBUILT_SYSTEMS" ] ; then
-    echo "ERROR: Your systems list is empty, use --system=LIST to specify a different one."
-    exit 1
-fi
-
-if [ -z "$PREBUILT_PREFIX" ] ; then
-    echo "ERROR: Your prebuilt prefix is empty; use --prebuilt-prefix=PREFIX."
-    exit 1
-fi
-
-for SYS in $PREBUILT_SYSTEMS; do
-    if [ ! -f $PREBUILT_DIR/$PREBUILT_PREFIX-$SYS.tar.bz2 ] ; then
-        echo "ERROR: It seems there is no prebuilt binary tarball for the '$SYS' system"
-        echo "Please check the content of $PREBUILT_DIR for a file named $PREBUILT_PREFIX-$SYS.tar.bz2."
+if [ -n "$PREBUILT_DIR" ] ; then
+    if [ ! -d "$PREBUILT_DIR" ] ; then
+        echo "ERROR: the --prebuilt-path argument is not a directory path: $PREBUILT_DIR"
         exit 1
     fi
-done
+    if [ -z "$PREBUILT_PREFIX" ] ; then
+        echo "ERROR: Your prebuilt prefix is empty; use --prebuilt-prefix=PREFIX."
+        exit 1
+    fi
+    if [ -z "$PREBUILT_SYSTEMS" ] ; then
+        echo "ERROR: Your systems list is empty, use --system=LIST to specify a different one."
+        exit 1
+    fi
+    # Check the systems
+    #
+    for SYS in $PREBUILT_SYSTEMS; do
+        if [ ! -f $PREBUILT_DIR/$PREBUILT_PREFIX-$SYS.tar.bz2 ] ; then
+            echo "ERROR: It seems there is no prebuilt binary tarball for the '$SYS' system"
+            echo "Please check the content of $PREBUILT_DIR for a file named $PREBUILT_PREFIX-$SYS.tar.bz2."
+            exit 1
+        fi
+    done
+else
+    if [ ! -f "$PREBUILT_NDK" ] ; then
+        echo "ERROR: the --prebuilt-ndk argument is not a file: $PREBUILT_NDK"
+        exit 1
+    fi
+    # Check that the name ends with the proper host tag
+    HOST_NDK_SUFFIX="$HOST_TAG.zip"
+    echo "$PREBUILT_NDK" | grep -q "$HOST_NDK_SUFFIX"
+    if [ $? != 0 ] ; then
+        echo "ERROR: the name of the prebuilt NDK must end in $HOST_NDK_SUFFIX"
+        exit 1
+    fi
+    PREBUILT_SYSTEMS=$HOST_TAG
+fi
 
 # The list of git files to copy into the archives
-GIT_FILES=`cd $NDK_ROOT_DIR && git ls-files`
+if [ "$USE_GIT_FILES" = "yes" ] ; then
+    echo "Collecting sources from git (use --no-git to copy all files instead)."
+    GIT_FILES=`cd $NDK_ROOT_DIR && git ls-files`
+else
+    echo "Collecting all sources files under tree."
+    # Cleanup everything that is likely to not be part of the final NDK
+    # i.e. generated files...
+    rm -rf $NDK_ROOT_DIR/out
+    rm -rf $NDK_ROOT_DIR/apps/*/project/libs/armeabi
+    # Get all files under the NDK root
+    GIT_FILES=`cd $NDK_ROOT_DIR && find .`
+    GIT_FILES=`echo $GIT_FILES | sed -e "s!\./!!g"`
+fi
 
 # temporary directory used for packaging
 TMPDIR=/tmp/ndk-release
@@ -129,17 +178,17 @@
 rm -rf $TMPDIR && mkdir -p $TMPDIR
 
 # first create the reference ndk directory from the git reference
-echo "Creating reference from git files"
+echo "Creating reference from source files"
 REFERENCE=$TMPDIR/reference &&
 mkdir -p $REFERENCE &&
 (cd $NDK_ROOT_DIR && tar cf - $GIT_FILES) | (cd $REFERENCE && tar xf -) &&
 rm -f $REFERENCE/Android.mk
 if [ $? != 0 ] ; then
-    echo "Could not create git reference. Aborting."
+    echo "Could not create reference. Aborting."
     exit 2
 fi
 
-# now, for each system, create a preview package
+# now, for each system, create a package
 #
 for SYSTEM in $PREBUILT_SYSTEMS; do
     echo "Preparing package for system $SYSTEM."
@@ -153,11 +202,27 @@
         exit 2
     fi
 
-    echo "Unpacking $PREBUILT.tar.bz2"
-    (cd $DSTDIR && tar xjf $PREBUILT.tar.bz2) 2>/dev/null 1>&2
-    if [ $? != 0 ] ; then
-        echo "Could not unpack prebuilt for system $SYSTEM. Aborting."
-        exit 1
+    if [ -n "$PREBUILT_NDK" ] ; then
+        echo "Unpacking prebuilt toolchain from $PREBUILT_NDK"
+        UNZIP_DIR=$TMPDIR/prev-ndk
+        rm -rf $UNZIP_DIR && mkdir -p $UNZIP_DIR
+        if [ $? != 0 ] ; then
+            echo "Could not create temporary directory: $UNZIP_DIR"
+            exit 1
+        fi
+        cd $UNZIP_DIR && unzip -q $PREBUILT_NDK 1>/dev/null 2>&1
+        if [ $? != 0 ] ; then
+            echo "ERROR: Could not unzip NDK package $PREBUILT_NDK"
+            exit 1
+        fi
+        cd android-ndk-* && cp -rP build/prebuilt $DSTDIR/build
+    else
+        echo "Unpacking $PREBUILT.tar.bz2"
+        (cd $DSTDIR && tar xjf $PREBUILT.tar.bz2) 2>/dev/null 1>&2
+        if [ $? != 0 ] ; then
+            echo "Could not unpack prebuilt for system $SYSTEM. Aborting."
+            exit 1
+        fi
     fi
 
     ARCHIVE=$BIN_RELEASE.zip
@@ -173,6 +238,7 @@
 
 echo "Cleaning up."
 rm -rf $TMPDIR/reference
+rm -rf $TMPDIR/prev-ndk
 
 echo "Done, please see packages in $TMPDIR:"
 ls -l $TMPDIR
diff --git a/ndk/docs/CHANGES.TXT b/ndk/docs/CHANGES.TXT
index faad11d..c162886 100644
--- a/ndk/docs/CHANGES.TXT
+++ b/ndk/docs/CHANGES.TXT
@@ -1,6 +1,64 @@
 Android NDK ChangeLog:
 
 -------------------------------------------------------------------------------
+current version
+
+IMPORTANT BUG FIXES:
+
+- Fix build/host-setup.sh to execute as a Bourne shell script (again)
+
+- Make target shared libraries portable to systems that don't use the exact same
+  toolchain (GCC 4.2.1) .
+
+- Actually use the awk version detected by host-setup.sh during the build.
+
+
+IMPORTANT CHANGES:
+
+- Added platform eclair-5 to reflect the Eclair branch. This is merely a copy
+  of android-4 that also includes headers and libraries for OpenGL ES 2.0.
+
+  See the sample named "hello-gl2" for a *very* basic demonstration. Note that
+  OpenGL ES 2.0 is currently *not* available from Java, and must be used through
+  native code exclusively.
+
+
+OTHER FIXES & CHANGES:
+
+- Added --prebuilt-ndk=FILE option to build/tools/make-release.sh script to
+  package a new experimental NDK package archive from the current source tree
+  plus the toolchain binaries of an existing NDK release package. E.g.:
+
+    build/tools/make-release.sh \
+       --prebuilt-ndk=/path/to/android-ndk-1.6_r1-linux-x86.zip
+
+  will generate a new NDK package in /tmp/ndk-release that contains the most
+  up-to-date build scripts, plus the toolchain binaries from 1.6_r1 (which
+  are not in the git repository).
+
+  Also added the --no-git option to collect all sources from the current
+  NDK root directory, instead of the list given by 'git ls-files'. This can
+  be useful if you don't want to checkout the whole 'platform/development'
+  project from repo and still work on the NDK.
+
+  This change is to help people easily package experimental NDK releases to
+  test and distribute fixes and improvements.
+
+- Remove bash-isms from build/tools/build-toolchain.sh. Now it's possible to
+  build it with the 'dash' shell on Debian-based systems (tested on Ubuntu 8.04)
+
+- Remove bash-ism from build/tools/build-ndk-sysroot.sh
+
+- Refresh C library headers for all platforms:
+
+    - make <endian.h> simply include <sys/endian.h>
+    - make <stdint.h> properly declare 64-bit integer types with a C99 compiler
+    - add missing <sys/types.h> to <strings.h>
+    - add GLibc-compatible macro aliases (st_atimensec, st_mtimensec and
+      st_ctimensec) to <stat.h>
+    - add missing declaration for tzset() in <time.h>
+
+-------------------------------------------------------------------------------
 android-ndk-1.6_r1
 
 IMPORTANT BUG FIXES:
@@ -24,7 +82,7 @@
   in $(CLEAR_VARS) script.
 
 
-IMPORTANT CHANGES
+IMPORTANT CHANGES:
 
 - The 'sources' directory is gone. The NDK build system now looks for
   $(APP_PROJECT_PATH)/jni/Android.mk by default. You can override this with
diff --git a/ndk/docs/STABLE-APIS.TXT b/ndk/docs/STABLE-APIS.TXT
index b78bf83..7d5d175 100644
--- a/ndk/docs/STABLE-APIS.TXT
+++ b/ndk/docs/STABLE-APIS.TXT
@@ -26,7 +26,8 @@
 currently supported:
 
     android-3      -> Official Android 1.5 system images
-    android-4      -> Experimental Donut system images
+    android-4      -> Official Android 1.6 system images
+    android-5      -> Experimental Eclair system images
 
 II. Android-3 Stable Native APIs:
 ---------------------------------
@@ -122,8 +123,7 @@
 ----------------------------------
 
 All the APIs listed below are available for developing native code that runs
-on the Donut experimental branch, which will be used to make the next official
-platform system images.
+on Android 1.6 system images and above,
 
 
 The OpenGL ES 1.x Library:
@@ -151,3 +151,35 @@
 it, see:
 
     http://jet.ro/visuals/san-angeles-observation/
+
+
+IV. Android-5 Stable Native APIs:
+----------------------------------
+
+All the APIs listed below are available for developing native code that runs
+on the Eclair experimental branch, which will be used to make the next official
+platform system images.
+
+
+The OpenGL ES 2.0 Library:
+--------------------------
+
+The standard OpenGL ES 2.0 headers <GLES2/gl2.h> and <GLES2/gl2ext.h> contain the
+declarations needed to perform OpenGL ES 2.0 rendering calls from native code.
+This includes the ability to define and use vertex and fragment shaders using the
+GLSL language.
+
+If you use them, your native module should link to /system/lib/libGLESv2.so
+as in:
+
+  LOCAL_LDLIBS := -lGLESv2.so
+
+Please note that, at the moment, native headers and libraries for the EGL APIs
+are *not* available. EGL is used to perform surface creation and flipping
+(instead of rendering). The corresponding operations must be performed in your
+VM application instead, for example with a GLSurfaceView, as described here:
+
+http://android-developers.blogspot.com/2009/04/introducing-glsurfaceview.html
+
+The "hello-gl2" sample application demonstrate this. It is used to draw a very
+simple triangle with the help of a vertex and fragment shaders.
diff --git a/pdk/Pdk.mk b/pdk/Pdk.mk
deleted file mode 100644
index 5268384..0000000
--- a/pdk/Pdk.mk
+++ /dev/null
@@ -1,249 +0,0 @@
-#
-# Copyright (C) 2008 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Assemble the Platform Development Kit (PDK)
-# (TODO) Figure out why $(ACP) builds with target pndk but not pdk_docs
-
-pdk:
-	@echo "Package: $@ has targets pndk, pdk_docs and pdk_all"
-
-pdk_all: pndk pdk_docs
-	@echo "Package: $^"
-
-LOCAL_PATH := $(call my-dir)
-
-#-------------------------------------------------------------------------------
-# Make the Native Development Kit (Code examples)
-#   Allows vendors to build shared libraries without entire source tree.
-# This include adds /pndk to LOCAL_PATH, so can't use it afterwards...
-include $(LOCAL_PATH)/pndk/Pndk.mk
-
-
-#-------------------------------------------------------------------------------
-# Make the Plaftorm Development Kit Documentation.
-#   Doxygenize the header files to create html docs in the generatedDocs dir.
-#   Copy the appengine files, the template files and the generated html 
-#   to the docs dir and zip everything up to the distribution directory.
-#   Run javadocs/droiddocs/clearsilver on the generatedDocs dir to get the right
-#   styles added to the html.
-
-
-# Workspace directory
-pdk_docs_intermediates := $(call intermediates-dir-for,PACKAGING,pdkdocs)
-
-# Source directories for appengine, templates, config & header files
-pdk_hosting_dir := development/pdk/hosting
-pdk_templates_dir := development/pdk/docs
-pdk_config_dir := development/pdk/doxygen_config
-pdk_docsfile_dir := $(pdk_config_dir)/docsfiles
-pdk_legacy_hardware_dir := hardware/libhardware_legacy/include/hardware_legacy
-pdk_hardware_dir := hardware/libhardware/include/hardware
-pdk_camera_dir := frameworks/base/include/ui
-
-# Destination directory for docs (templates + doxygenated headers)
-pdk_docs_dest_dir := $(pdk_docs_intermediates)/docs/guide
-pdk_app_eng_root := $(pdk_docs_intermediates)/docs
-
-# Working directory for source to be doxygenated
-pdk_doxy_source_dir := $(pdk_docs_intermediates)/sources
-
-# Working directory for html, et al. after doxygination
-pdk_generated_source_dir := $(pdk_docs_intermediates)/generatedDocs/html
-
-# Working directory for .dox files
-pdk_doxy_docsfiles_dir := $(pdk_docs_intermediates)/docsfiles
-
-# Doxygen version to use, so we can override it on the command line
-# doxygen 1.5.6 working, the latest version get-apt installable on ghardy.
-# with bug fix for </div> error.
-doxygen_version = doxygen
-
-#------------------------------------------------------------------------------- 
-# Header files to doxygenize. 
-#   Add new header files to document here, also adjust the templates to have 
-#   descriptions for the new headers and point to the new doxygen created html.
-pdk_headers := \
-    $(pdk_legacy_hardware_dir)/AudioHardwareInterface.h \
-    $(pdk_legacy_hardware_dir)/gps.h \
-    $(pdk_legacy_hardware_dir)/wifi.h \
-    $(pdk_camera_dir)/CameraHardwareInterface.h \
-    $(pdk_hardware_dir)/sensors.h \
-    $(pdk_hardware_dir)/lights.h
-
-# Create a rule to copy the list of PDK headers to be doxyginated.
-# copy-one-header defines the actual rule.
-$(foreach header,$(pdk_headers), \
-  $(eval _chFrom := $(header)) \
-  $(eval _chTo :=  $(pdk_doxy_source_dir)/$(notdir $(header))) \
-  $(eval $(call copy-one-header,$(_chFrom),$(_chTo))) \
-  $(eval all_copied_pdk_headers: $(_chTo)) \
- )
-_chFrom :=
-_chTo :=
-
-
-#-------------------------------------------------------------------------------
-# Assemble all the necessary doxygen config files and the sources into the
-#   working directories
-
-pdk_templates := $(shell find $(pdk_templates_dir) -type f)
-
-# Create a rule to copy the list of PDK doc templates.
-# copy-one-file defines the actual rule.
-$(foreach template,$(pdk_templates), \
-  $(eval _chFrom := $(template)) \
-  $(eval _chTo :=  $(pdk_app_eng_root)/$(patsubst $(pdk_templates_dir)/%,%,$(template))) \
-  $(eval $(call copy-one-header,$(_chFrom),$(_chTo))) \
-  $(eval all_copied_pdk_templates: $(_chTo)) \
- )
-_chFrom :=
-_chTo :=
-
-# Copy newer doxygen config file (basic configs, should not change very often.)
-pdk_doxygen_config_file := $(pdk_docs_intermediates)/pdk_config.conf
-$(pdk_doxygen_config_file): $(pdk_config_dir)/pdk_config.conf
-	@echo "PDK: $@"
-	$(copy-file-to-target-with-cp)
-
-# Copy newer doxygen override config file (may change these more often.)
-pdk_doxygen_config_override_file := $(pdk_docs_intermediates)/overrideconfig.conf
-$(pdk_doxygen_config_override_file): $(pdk_config_dir)/overrideconfig.conf
-	@echo "PDK: $@"
-	$(copy-file-to-target-with-cp)
-
-# (TODO) Get the latest templates
-# Copy newer doxygen html files.
-$(pdk_docs_intermediates)/header.html: $(pdk_config_dir)/header.html
-	@echo "PDK: $@"
-	$(copy-file-to-target-with-cp)
-
-$(pdk_docs_intermediates)/footer.html: $(pdk_config_dir)/footer.html
-	@echo "PDK: $@"
-	$(copy-file-to-target-with-cp)
-
-# Copy newer doxygen .dox files
-$(pdk_doxy_docsfiles_dir)/groups.dox: $(pdk_docsfile_dir)/groups.dox
-	@echo "PDK: $@"
-	$(copy-file-to-target-with-cp)
-
-$(pdk_doxy_docsfiles_dir)/main.dox: $(pdk_docsfile_dir)/main.dox
-	@echo "PDK: $@"
-	$(copy-file-to-target-with-cp)
-
-# All the files that we depend upon
-all_pdk_docs_files := $(pdk_doxygen_config_override_file) \
-    $(pdk_doxygen_config_file) $(pdk_docs_intermediates)/header.html \
-    $(pdk_docs_intermediates)/footer.html $(pdk_doxy_docsfiles_dir)/groups.dox \
-    $(pdk_doxy_docsfiles_dir)/main.dox all_copied_pdk_templates  \
-    all_copied_pdk_headers
-
-# Run doxygen and copy all output and templates to the final destination
-# We replace index.html with a template file so don't use the generated one
-pdk_doxygen: all_copied_pdk_headers $(pdk_doxygen_config_override_file) \
-    $(pdk_doxygen_config_file) $(pdk_docs_intermediates)/header.html \
-    $(pdk_docs_intermediates)/footer.html $(pdk_doxy_docsfiles_dir)/groups.dox \
-    $(pdk_doxy_docsfiles_dir)/main.dox 
-	@echo "Files for Doxygination: $^"
-	@mkdir -p $(pdk_generated_source_dir)
-	@rm -f $(pdk_generated_source_dir)/*
-	@cd $(pdk_docs_intermediates) && $(doxygen_version) pdk_config.conf
-	@mkdir -p $(pdk_docs_dest_dir)
-	@cd $(pdk_generated_source_dir) && chmod ug+rx *
-	@rm -f $(pdk_generated_source_dir)/index.html
-	# Fix a doxygen bug: in *-source.html file insert '</div>\n' after line 25
-	# @$(pdk_hosting_dir)/edoxfix.sh $(pdk_generated_source_dir)
-	@cp -fp $(pdk_generated_source_dir)/* $(pdk_docs_dest_dir)
-	@rm $(pdk_generated_source_dir)/*
-
-
-# ==== docs for the web (on the google app engine server) =======================
-# Run javadoc/droiddoc/clearsilver to get the formatting right
-
-# make droiddocs run after we make our doxygen docs
-$(pdk_docs_intermediates)/pdk-timestamp: pdk_doxygen all_copied_pdk_templates
-	@touch $(pdk_docs_intermediates)/pdk-timestamp
-
-$(LOCAL_PATH)/pdk-timestamp: $(pdk_docs_intermediates)/pdk-timestamp
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := pdk-timestamp samples/samplejni/src/com/example/jniexample/JNIExample.java  
-LOCAL_MODULE_CLASS := development/pdk/pndk/samples/samplejni/src/com/example/jniexample
-LOCAL_DROIDDOC_SOURCE_PATH := $(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH)
-LOCAL_DROIDDOC_HTML_DIR := ../../../$(pdk_app_eng_root)
-
-LOCAL_MODULE := online-pdk
-
-LOCAL_DROIDDOC_OPTIONS:= \
-		-toroot /online-pdk/ \
-		-hdf android.whichdoc online \
-		-hdf android.whichmodule $(LOCAL_MODULE)
-
-LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := build/tools/droiddoc/templates-pdk
-LOCAL_DROIDDOC_CUSTOM_ASSET_DIR := assets-pdk
-
-include $(BUILD_DROIDDOC)
-
-# The docs output dir is:  out/target/common/docs/online-pdk
-DOCS_OUT_DIR  := $(OUT_DOCS)/$(LOCAL_MODULE)
-
-# Copy appengine server files for new system
-$(OUT_DOCS)/app.yaml: $(pdk_hosting_dir)/app.yaml
-	@echo "PDK: $@"
-	$(copy-file-to-target-with-cp)
-
-$(OUT_DOCS)/pdk.py: $(pdk_hosting_dir)/pdk.py
-	@echo "PDK: $@"
-	$(copy-file-to-target-with-cp)
-
-# Name the tar files
-name := android_pdk_docs-$(REQUESTED_PRODUCT)
-ifeq ($(TARGET_BUILD_TYPE),debug)
-  name := $(name)_debug
-endif
-name := $(name)-$(BUILD_NUMBER)
-pdk_docs_tarfile := $(pdk_docs_intermediates)/$(name).tar
-pdk_docs_tarfile_zipped := $(pdk_docs_tarfile).gz
-
-.PHONY: pdk pdk_docs pdk_doxygen all_copied_pdk_headers all_copied_pdk_templates pdk-timestamp
-
-pdk_docs: $(pdk_docs_tarfile_zipped) $(pdk_docs_tarfile)
-	@echo "PDK: Docs tarred and zipped"
-
-# Put the pdk_docs zip files in the distribution directory
-$(call dist-for-goals,pdk_docs,$(pdk_docs_tarfile_zipped))
-
-# zip up tar files
-%.tar.gz: %.tar
-	@echo "PDK docs: zipped $<"
-	$(hide) gzip -cf $< > $@
-
-# tar up all the files to make the pdk docs.
-$(pdk_docs_tarfile): $(DOCS_OUT_DIR)-timestamp $(OUT_DOCS)/app.yaml $(OUT_DOCS)/pdk.py
-	@echo "PDK docs: $@"
-	@mkdir -p $(dir $@)
-	@rm -f $@
-	$(hide) tar rf $@ -C $(OUT_DOCS) $(LOCAL_MODULE) pdk.py  app.yaml
-
-# Debugging reporting can go here, add it as a target to get output.
-pdk_debug:
-	@echo "You are here: $@"
-	@echo "pdk headers copied: $(all_copied_pdk_headers)"
-	@echo "pdk headers: $(pdk_headers)"
-	@echo "pdk docs dest: $(pdk_docs_dest_dir)"
-	@echo "config dest: $(pdk_doxygen_config_file)"
-	@echo "config src: $(pdk_config_dir)/pdk_config.conf"
-	@echo "pdk templates: $(pdk_templates_dir)"
diff --git a/pdk/README b/pdk/README
deleted file mode 100644
index d9f8996..0000000
--- a/pdk/README
+++ /dev/null
@@ -1,103 +0,0 @@
-Building the pdk (platform development kit)
-
-1) get a cupcake source tree with all the normal tools... and add doxygen 
-(We currently support version 1.4.6)
-
-  sudo apt-get install doxygen
-  
-Make sure that you are using the right version of java
-  
-  sudo update-java-alternatives -s java-1.5.0-sun
-
-If that doesn't work, go through the instructions on
-
-  http://source.android.com/download again.
-
-
-2) from the root
-  . build/envsetup.sh
-
-
-4) mkdir dist
-   mkdir logs
-   
-then build everything:
-
-   time make -j8 pdk pdk_all dist DIST_DIR=dist 2>&1 | tee logs/`date +%y%m%d-%H%M%S`
-
-so you can have a record of the build commands in the logs directory.
-
-
-5) the pdk and pndk tar file is put in the dist directory.
-
-6) the pdk-docs are in 
-
-  out/target/common/docs/online-pdk
-
-
---------------------------------------------------------------------------------
-# Build Notes
-
-The build target 'pdk' brings in the pdk/pndk make files into the build system.
-  Then there are three targets:
-    pdk_docs - which builds just the pdk documentation
-    pndk - which builds the platform's native development kit (native compiler, linker, etc.)
-    pdk_all - which builds the above two targets
-
-To change which version of doxygen runs you can pass in the variable:
-  doxygen_version='<path/name_of_doxygen_executable>'
-on the make line.
-
-
---------------------------------------------------------------------------------
-# Testing
-
-You must install google appengine.  See: http://code.google.com/appengine/downloads.html
-
-Here's the command to run the pdk-docs server locally:
-  python <path_to_appengine_installation>/dev_appserver.py --address 0.0.0.0 \
-    <path_to_cupcake_code>/android/out/target/common/docs
-
-To verify it is working, you can access it with a browser locally on port 8080:
-
-http://localhost:8080/online-pdk/guide/index.html
-
-NOTE: If you are trying to get to the appengine local testing instance remotely
-you will have to ssh tunnel into your linux box as appengine only serves the web
-host locally.  
-
-On a Windows machine to check your current port forwarding settings:
-
-1. Start putty.
-2. Click on your session in the list and hit load (this loads the settings so you can edit them)
-3. Go to SSH -> tunnels and look at the Forwarded ports box
-
-L8080   localhost:8080
-
-Means that you can point your webbrowser on your laptop to http://localhost:8080/ and it will show you the same thing as on your workstation for http://localhost:8080/
-
-To add port forwarding
-
-1. Start putty.
-2. Click on your session in the list and hit load (this loads the settings so you can edit them)
-3. Go to SSH -> tunnels.
-4. Pick an unused port on your laptop (8080, 8888, something like that) and put it in the "source port box"
-5. In the destination box, put localhost:8888 (replace with the actual port number the service is running on)
-6. Hit add.
-7. Go back to "Session" and save your new settings so this configuration will happen every time you login.
- 
-
---------------------------------------------------------------------------------
-# Deployment
-
-To host the pdk docs on the internal appengine run:
-/home/build/static/projects/apphosting/devtools/appcfg.py update <path_to_cupcake_src>/out/target/common/docs
-where the docs directory contains: pdk.py, app.yaml, and the online-pdk directory,
-all of which are tarred up by the Pdk.mk file when using the target pdk_docs. 
-
-To host the pdk docs on the external appengine run:
-/home/build/static/projects/apphosting/devtools/appcfg.py -s pdk-docs.appspot.com update <path_to_cupcake_src>/out/target/common/docs
-where the docs directory contains: pdk.py, app.yaml, and the online-pdk directory,
-all of which are tarred up by the Pdk.mk file when using the target pdk_docs. 
-
-
diff --git a/pdk/docs/CHANGE_HISTORY.TXT b/pdk/docs/CHANGE_HISTORY.TXT
deleted file mode 100755
index 379aade..0000000
--- a/pdk/docs/CHANGE_HISTORY.TXT
+++ /dev/null
@@ -1,23 +0,0 @@
-V 0.9 MWR Apr 6, 2009
-#####################
-
-* New files for new css files using droiddoc/clearsilver
-
-V 0.3 - June 9, 2008

-####################

-

-* Architectural diagrams now include a legend that describes the difference 

-  between solid and dashed elements

-

-* Removed Puppetmaster document

-

-* Removed external link to Android Architecture from the left navigation bar

-

-* small changes to Radio Layer Interface

-

-* Updated Host System Setup (source_setup_guide.html) to include mention of Linux 8.04 and Cygwin.

-

-* Updated Build System (build_system.html): Switched Device code options 1 & 2 to emphasize that 

-  the new first option yields more consistent results. 

-

-* Updated Bring Up (bring_up.html): removed "hotplugd" from step 7.
diff --git a/pdk/docs/community/index.jd b/pdk/docs/community/index.jd
deleted file mode 100644
index bc04eee..0000000
--- a/pdk/docs/community/index.jd
+++ /dev/null
@@ -1,6 +0,0 @@
-home=true
-@jd:body
-
-<p>
-  Some community information here
-</p>
diff --git a/pdk/docs/guide/audio.jd b/pdk/docs/guide/audio.jd
deleted file mode 100755
index 66c05f7..0000000
--- a/pdk/docs/guide/audio.jd
+++ /dev/null
@@ -1,61 +0,0 @@
-page.title=Audio
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#androidAudioBuildingDriver">Building an Audio Library</a></li>
-<li><a href="#androidAudioInterface">Interface</a></li>
-</ul>
-</div>
-</div>
-
-
-<p>AudioHardwareInterface serves as the glue between proprietary audio drivers and the Android AudioFlinger service, the core audio service that handles all audio-related requests from applications.</p>
-<p><img src="images/android_audio_architecture.gif"></p>
-
-Solid elements represent Android blocks and dashed elements represent partner-specific blocks.
-
-
-
-<a name="androidAudioBuildingDriver"></a><h3>Building an Audio Library</h3>
-
-<p>To implement an audio driver, create a shared library that implements the interface defined in <code>AudioHardwareInterface.h</code>. You must name your shared library <code>libaudio.so</code> so that it will get loaded from <code>/system/lib</code> at runtime.  Place libaudio sources and <code>Android.mk</code> in <code>vendor/acme/chipset_or_board/libaudio/</code>.</p>
-<p>The following stub <code>Android.mk</code> file ensures that <code>libaudio</code> compiles and links to the appropriate libraries:</p>
-
-<pre class="prettify">
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libaudio
-
-LOCAL_SHARED_LIBRARIES := \
-    libcutils \
-    libutils \
-    libmedia \
-    libhardware
-
-LOCAL_SRC_FILES += MyAudioHardware.cpp
-
-LOCAL_CFLAGS +=
-
-LOCAL_C_INCLUDES +=
-
-LOCAL_STATIC_LIBRARIES += libaudiointerface
-
-include $(BUILD_SHARED_LIBRARY)
-</pre>
-
-
-<a name="androidAudioInterface"></a><h3>Interface</h3>
-
-
-
-<p class="note"><strong>Note</strong>: This document relies on some Doxygen-generated content that appears in an iFrame below. To return to the Doxygen default content for this page, <a href="audio_sub_system.html">click here</a>.</p>
-
-
-<iframe onLoad="resizeDoxFrameHeight();" src="AudioHardwareInterface_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe>
diff --git a/pdk/docs/guide/bluetooth.jd b/pdk/docs/guide/bluetooth.jd
deleted file mode 100755
index bcf88db..0000000
--- a/pdk/docs/guide/bluetooth.jd
+++ /dev/null
@@ -1,193 +0,0 @@
-page.title=Bluetooth
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#androidBluetoothPorting">Porting</a></li>
-<li><a href="#androidBluetoothCompiling">Compiling</a></li>
-<li><a href="#androidBluetoothTroubleshooting">Troubleshooting</a></li>
-<li><a href="#androidBluetoothTools">Tools</a></li>
-<li><a href="#androidBluetoothFeatures">Feature Support</a></li>
-</ul>
-</div>
-</div>
-
-<p>Android's Bluetooth stack uses BlueZ version 3.36 for GAP, SDP, and RFCOMM profiles, and is a SIG-qualified Bluetooth 2.0 + EDR host stack.</p>
-
-<p>Bluez is GPL licensed, so the Android framework interacts with userspace bluez code through D-BUS IPC to avoid proprietary code.</p>
-
-<p>Headset and Handsfree (v1.5) profiles are implemented in the Android framework and are both tightly coupled with the Phone App. These profiles are also SIG qualified.</p>
-
-<p>The diagram below offers a library-oriented view of the Bluetooth stack. Click <a href="bluetooth/bluetooth_process.html">Bluetooth Process Diagram</a> for a process-oriented view.</p>
-
-<p><img src="images/androidBluetooth.gif"></p>
-
-Solid elements represent Android blocks and dashed elements represent partner-specific blocks.
-
-
-
-<a name="androidBluetoothPorting"></a><h3>Porting</h3>
-
-<p>BlueZ is Bluetooth 2.0 compatible and should work with any 2.0 chipset. There are two integration points:</p>
-<p><ul>
-<li>UART driver</li>
-<li>Bluetooth Power On / Off</li>
-</ul>
-</p>
-
-
-<a name="androidBluetoothPortingDriver"></a><h4>UART Driver</h4>
-
-<p>The BlueZ kernel sub-system attaches to your hardware-specific UART driver using the <code>hciattach</code> daemon.</p>
-<p>For example, for MSM7201A, this is <code>drivers/serial/msm_serial.c</code>. You may also need to edit command line options to <code>hciattach</code> via <code>init.rc</code>.</p>
-
-
-<a name="androidBluetoothPortingPowerOnOff"></a><h4>Bluetooth Power On / Off</h4>
-
-<p>The method for powering on and off your bluetooth chip varies from Android V 1.0 to post 1.0.</p>
-
-<p><ul>
-<li><b>1.0</b>: Android framework writes a 0 or 1 to <code>/sys/modules/board_[PLATFORM]/parameters/bluetooth_power_on</code>.</li>
-
-<li><b>Post 1.0</b>: Android framework uses the linux <code>rfkill</code> API. See <code>arch/arm/mach-msm/board-trout-rfkill.c</code> for an example.</li>
-</ul>
-</p>
-
-<a name="androidBluetoothCompiling"></a><h4>Compiling</h4>
-
-<p>To compile Android with Bluetooth support enabled, add the following line to <code>BoardConfig.mk</code>.
-<pre>
-BOARD_HAVE_BLUETOOTH := true
-</pre>
-
-<a name="androidBluetoothTroubleshooting"></a><h3>Troubleshooting</h3>
-<p><strong>Debugging</strong></p>
-<p>To debug your bluetooth implementation, start by reading the logs (<code>adb logcat</code>) and look for ERRROR and WARNING messages regarding Bluetooth. 
-  Andoird uses Bluez, which comes with some useful debugging tools. The snippet below provides examples in a suggested order:</p>
-<pre>
-hciconfig -a  			# print BT chipset address and features. Useful to check if you can communicate with your BT chipset.
-hcidump -XVt  			# print live HCI UART traffic.
-hcitool scan  			# scan for local devices. Useful to check if RX/TX works.
-l2ping ADDRESS  		# ping another BT device. Useful to check if RX/TX works.
-sdptool records ADDRESS # request the SDP records of another BT device.
-</pre>
-
-<p><strong>Deamon Logs</strong></p>
-<p>Deamon logs for <code>hcid</code> (<code>STDOUT</code>) and <code>hciattach</code> (<code>STDERR</code>) are sent to <code>/dev/null</code> by default. Edit <code>init.rc</code></span> and <code>init.PLATFORM.rc</code></span> to run these daemons under <code>logwrapper</code>, which redirects output to <code>logcat</code>.</p>
-<p><strong>hciconfig -a and hcitool</strong></p>
-<p>If you compile your own system.img for Android, and <code>hciconfig -a</code> works but <code>hcitool</code> scan doesn't, try installing the firmware for the Bluetooth chipset. This firmware isn't yet available in the open source codebase, but you can <code>adb pull</code> and then <code>adb push</code>it from a stock T-Mobile G1 (located in <code>/etc/firmware/brf6300.bin</code>).<br />
-  <a name="androidBluetoothTools"></a></p>
-<h3>Tools</h3>
-
-<p>BlueZ provides a rich set of command line tools for debugging and interacting with the Bluetooth sub-system, including:</p>
-<p><ul>
-<li><code>hciconfig</code></li>
-<li><code>hcitool</code></li>
-<li><code>hcidump</code></li>
-<li><code>sdptool</code></li>
-<li><code>dbus-send</code></li>
-<li><code>dbus-monitor</code></li>
-</ul>
-</p>
-
-<a name="androidBluetoothFeatures"></a>
-<h3>Feature Support</h3>
-<p>This section provides a change history of Bluetooth features added in each Android release and provides some rough guidance as to future features. </p>
-<h4>Android 1.0 release</h4>
-<h5>Platform features</h5>
-<ul>
-  <li>Based on Bluez 3.36 and Linux Kernel 2.6.25</li>
-  <li>Bluetooth 2.0+EDR host stack</li>
-  <li>Headset Profile 1.0 in Audio Gateway role</li>
-  <li>Handsfree Profile 1.5 in Audio Gateway role</li>
-  <ul>
-    <li>Three-way calling</li>
-    <li>Phonebook over AT commands
-    </li>
-  </ul>
-</ul>
-<h5>Qualifications</h5>
-<ul>
-  <li>QDID B014524: Host stack (SDP, L2CAP, GAP, RFCOMM, SPP)</li>
-  <li>QDID B014624: EPL for HTC Dream (HSP, HFP)</li>
-</ul>
-<h5>Example products</h5>
-<ul>
-  <li>HTC Dream / T-Mobile G1</li>
-</ul>
-<h4>&nbsp;</h4>
-<h4>Android 1.1 release</h4>
-<p>No Bluetooth changes since 1.0</p>
-<h4>&nbsp;</h4>
-<h4>Android 1.5 release (cupcake)</h4>
-<h4>Platform features</h4>
-<ul>
-  <li>Based on Bluez 3.36 with Linux Kernel 2.6.27</li>
-  <li>Bluetooth 2.0+EDR host stack</li>
-  <ul>
-    <li>Support for auto-pairing with '0000' devices</li>
-  </ul>
-  <li>Headset Profile 1.1 in Audio Gateway role</li>
-  <li>Handsfree Profile 1.5 in Audio Gateway role</li>
-  <ul>
-    <li>Three-way calling    </li>
-    <li>Phonebook over AT commands    </li>
-    <li>Volume synchronization</li>
-    <li>eSCO</li>
-    <li>Extensive bug fixes and compatibility improvements</li>
-  </ul>
-  <li>Stereo Bluetooth (A2DP 1.2) in Source role</li>
-  <ul>
-    <li>AVDTP 1.2 in Acceptor and Initiator roles</li>
-    <li>GAVDTP 1.0 in Acceptor and Initiator roles</li>
-    <li>44.1 khz, stereo, software SBC codec</li>
-  </ul>
-  <li>Remote Control (AVRCP 1.0) in Target role</li>
-  <ul>
-    <li>AVCTP 1.3 in Target role</li>
-    <li>play/pause/stop/prev/next</li>
-  </ul>
-</ul>
-<h4>Qualifications</h4>
-<ul>
-  <li>QDID B015261: Host stack (SDP, L2CAP, GAP, RFCOMM, SPP, AVCTP, AVRCP, GAVDP, AVDTP, A2DP)</li>
-  <li>QDID B015262: EPL for HTC Sapphire (HSP, HFP)</li>
-</ul>
-<h5>&nbsp;</h5>
-<h4>Future releases</h4>
-<p>This section offers a rough guide of which features the team is developing for the next release. This feature list may change without notice. It isn't possible to post scheduling advice to the mailing lists.</p>
-<ul>
-  <li>Java Bluetooth API</li>
-  <li>Bluez 4.x with Linux Kernel 2.6.29</li>
-  <li>More profiles...</li>
-  <li>Bluetooth 2.1+EDR</li>
-</ul>
-
-<p><strong>Development Notes</strong></p>
-<ul>
-  <li><strong>HID Support<br />
-  </strong>Cupcake features some early work&#151;Bluez has an HID plugin, <code>external/bluez/utils/input/Android.mk</code>, which gets compiled. <br />
-    <br />
-You can interact directly with this plugin using <code>dbus-send</code></span> and <code>dbus-monitor</code>. While not officially supported, you should be able to connect and use a HID keyboard and mouse using the Bluez HID plugin API. Next steps include plumbing the plugin API in the Android Java framework and offering better support for HID input methods (new keymaps and mouse support).<br />
-  <br />
-  </li>
-  <li>  <strong>Tethering - DUN and PAN Support</strong><br />
-    Cupcake features some early work&#151;Bluez has has DUN and PAN daemons which get compiled and <code>external/bluez/utils/dun/Android.mk
-  external/bluez/utils/pan/Android.mk
-BNEP</code> support is compiled into the kernel with cupcake. <br />
-<br />
-While not officially supported, you should be able to run <code>dund</code> or <code>pand</code> daemons and, using <code>pppd</code> or <code>iptables</code>, test tethering support. Next steps include plubming the DBUS APIs to these daemons up into the Android Java framework and adding code to setup the network paths via <code>pppd</code> and / or <code>iptables</code>.<br />
-  <br />
-  </li>
-  <li><strong>Emulator Support</strong><br />
-  The Android emulator does not support Bluetooth at this time and there currently aren't any plans for its support.<br />
-    <br />
-  </li>
-  <li><strong>Bluetooth 2.1 and Simple Pairing Support</strong><br />
-  In order to support these features, Android needs to move to a Bluez 4.x version. This change is not scheduled at this time.</li>
-</ul>
diff --git a/pdk/docs/guide/bluetooth/bluetooth_process.jd b/pdk/docs/guide/bluetooth/bluetooth_process.jd
deleted file mode 100755
index ea46f23..0000000
--- a/pdk/docs/guide/bluetooth/bluetooth_process.jd
+++ /dev/null
@@ -1,7 +0,0 @@
-page.title=Bluetooth Process Diagram
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<p>The diagram below offers a process-oriented architectural overview of Android's Bluetooth stack. Click <a href="../bluetooth.html">Bluetooth</a> to return to the Bluetooth overview page.</p>
-<img src="images/androidBluetoothProcessDiagram.jpg">
diff --git a/pdk/docs/guide/bluetooth/images/androidBluetoothProcessDiagram.jpg b/pdk/docs/guide/bluetooth/images/androidBluetoothProcessDiagram.jpg
deleted file mode 100755
index 6872180..0000000
--- a/pdk/docs/guide/bluetooth/images/androidBluetoothProcessDiagram.jpg
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/bring_up.jd b/pdk/docs/guide/bring_up.jd
deleted file mode 100755
index a11fe00..0000000
--- a/pdk/docs/guide/bring_up.jd
+++ /dev/null
@@ -1,359 +0,0 @@
-page.title=Bring Up
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<p>Once your code is built and you have verified that all necessary directories exist, power on and test your device with basic bring up, as described below. Bring up tests are typically designed to stress certain aspects of your system and allow you to characterize the device's behavior. </p>
-<p>&nbsp;</p>
-<h3>1. Confirm a Clean Installation of a Basic Linux Kernel </h3>
-<p>Before considering Android-specific modifications to the Linux kernel, verify that you can build, deploy, and boot a core Linux kernel on your target hardware. </p>
-<p>&nbsp;</p>
-<h3>2. Modify Your Kernel Configuration to Accommodate Android Drivers</h3>
-<p>Your kernel configuration file should include the following:</p>
-<pre class="prettyprint">
-#
-# Android
-#
-# CONFIG_ANDROID_GADGET is not set
-# CONFIG_ANDROID_RAM_CONSOLE is not set
-CONFIG_ANDROID_POWER=y
-CONFIG_ANDROID_POWER_STAT=y
-CONFIG_ANDROID_LOGGER=y
-# CONFIG_ANDROID_TIMED_GPIO is not set
-CONFIG_ANDROID_BINDER_IPC=y
-</pre>
-<h3>3. Write Drivers</h3>
-<p>Android ships with default drivers for all basic functionality but you'll likely want to write your own drivers (or at least customize the default drivers) for your own device depending on your hardware configuration. See the following topics for examples of how to write your own drivers. </p>
-<ul>
-  <li><a href="audio_subsystem.html">Audio</a></li>
-  <li><a href="keymaps_keyboard_input.html">Keymaps and Keyboard</a></li>
-  <li><a href="display_drivers.html">Display</a></li>
-</ul>
-<p>&nbsp;</p>
-<h3>4. Burn Images to Flash</h3>
-<p>An image represents the state of a system or part of a system  stored in non-volatile memory. The build process should produce the following system images:</p>
-<ul>
-  <li><strong>bootloader</strong>: The bootloader is a small program responsible for initiating loading of the operating system. </li>
-  <li><strong>boot</strong>: </li>
-  <li><strong>recovery</strong>: </li>
-  <li><strong>system</strong>: The system image stores a snapshot of the Android operating system.</li>
-  <li><strong>data</strong>: The data image stores user data. Anything not saved to the <code>device/data</code> directory will be lost on reboot.</li>
-</ul>
-<ul>
-  <li><strong>kernel</strong>: The kernel represents the most basic element of an operating system. Android's Linux kernel is responsible for managing the system's resources and acts as an abstraction layer between hardware and a system's applications. </li>
-  <li><strong>ramdisk</strong>: RAMdisk defines a portion of Random Access Memory (RAM) that gets used as if it were a hard drive. </li>
-</ul>
-<p>&nbsp;</p>
-<p>Configure the bootloader to load the kernel 	and RAMdisk into RAM and pass the RAMdisk address to the kernel on 	startup. </p>
-<p>&nbsp;</p>
-<h3>5. Boot the kernel and mount the RAMdisk.</h3>
-<p>&nbsp;</p>
-<h3>6. Debug Android-specific init programs on RAMdisk</h3>
-<p>Android-specific init programs are found in <code>device/system/init</code>. Add LOG messages to help you debug potential problems with the LOG macro defined in <code>device/system/init/init.c</code>.</p>
-<p> The init program directly mounts all filesystems and devices using either hard-coded file names or device names generated by probing the sysfs filesystem (thereby eliminating the need for a <code>/etc/fstab</code> file in Android).  After <code>device/system</code> files are mounted, init  reads <code>/etc/init.rc</code> and invokes the programs listed there (one of the first of which is the 	console shell).</p>
-<p>&nbsp;</p>
-<h3>7. Verify that applications have started </h3>
-<p>Once the shell becomes available, execute <code>% ps</code> to confirm that the following applications are running:</p>
-<ul>
-    <li><code>/system/bin/logd</code></li>
-    <li><code>/sbin/adbd</code></li>
-    <li><code>/system/bin/usbd</code></li>
-    <li><code>/system/bin/debuggerd</code></li>
-    <li><code>/system/bin/rild</code></li>
-    <li><code>/system/bin/app_process</code></li>
-    <li><code>/system/bin/runtime</code></li>
-    <li><code>/system/bin/dbus-daemon</code></li>
-    <li><code>system_server</code></li>
-</ul>
-<p>Each of these applications is embedded Linux C/C++ and you can use any standard Linux debugging tool to troubleshoot applications that aren't running. Execute <code>% make showcommands</code> to determine precise build commands. <code>gdbserver</code> (the GNU debugger) is available in the <code>bin</code> directory of the system partition (please see <a href="http://sourceware.org/gdb/">http://sourceware.org/gdb/</a> for more information).  </p>
-<p>&nbsp;</p>
-<h3>8. Pulling it all together </h3>
-<p>If bring up was successful, you should see the following Java applications (with icons) visible on the LCD panel:</p>
-<ul>
-    <li>com.google.android.phone: The Android contact application. </li>
-    <li>com.google.android.home</li>
-    <li>android.process.google.content</li>
-</ul>
-<p>If they are not visible or unresponsive to keypad control, run the <code>framebuffer/keypad</code> tests.</p>
-
-
-<a name="androidInitLanguage"></a><h1>Android Init Language</h1>
-
-
-<p>The Android Init Language consists of four broad classes of statements:</p>
-<ul>
-  <li>Actionn</li>
-  <li>Commands</li>
-  <li>Services</li>
-  <li>Options</li>
-</ul>
-<p>The language syntax includes the following conventions: </p>
-<ul>
-  <li>All classes are line-oriented and consist of tokens separated by whitespace. c-style backslash escapes may be used to insert whitespace into a token. &nbsp;Double quotes may also be used to prevent whitespace from breaking text into multiple tokens. A backslash <br />
-  appearing as the last character on a line is used for line-folding.</li>
-  <li> Lines that start with a # (leading whitespace allowed) are comments.</li>
-  <li>Actions and Services implicitly declare new sections. All commands
-    or options belong to the section most recently declared. &nbsp;Commands
-    or options before the first section are ignored.  </li>
-  <li>Actions and Services have unique names. &nbsp;If a second Action or Service is declared with the same name as an existing one, it is ignored as an error.</li>
-</ul>
-<p>  Actions</p>
-<p> Actions are named sequences of commands. Actions have a trigger used to determine when the action should occur. When an event
-  occurs which matches an action's trigger, that action is added to
-  the tail of a to-be-executed queue (unless it is already on the
-  queue).<br />
-  <br />
-  Each action in the queue is dequeued in sequence. Each command in
-  an action is executed in sequence.&nbsp;Init handles other activities
-  (such as, device creation/destruction, property setting, process restarting) &quot;between&quot; the execution of the commands in activities.
-<p>Actions take the form of:</p>
-<pre class="prettify">
-on &lt;trigger&gt;
-&nbsp; &lt;command&gt;
-&nbsp; &lt;command&gt;
-&nbsp; &lt;command&gt;
-</pre>
-<p>Services</p>
-<p>Services are programs that init launches and (optionally) restarts
-when they exit. </p>
-<p>Services take the form of:</p>
-<pre class="prettify">
-  service &lt;name&gt; &lt;pathname&gt; [ &lt;argument&gt; ]*
-&nbsp; &lt;option&gt;
-&nbsp; &lt;option&gt;
-&nbsp; ...
-</pre>
-<p>Options</p>
-  <p> Options are modifiers to services that affect how and when init
-runs a service. Options are described in the table below:</p>
-<table>
-  <tr>
-    <th scope="col">Option</th><th scope="col">Description</th></tr>
-  <tr>
-    <td><code>disabled</code></td>
-    <td>This service will not automatically start with its class. It must be explicitly started by name.</td>
-  </tr>
-  <tr>
-    <td><code>socket &lt;type&gt; &lt;name&gt; &lt;perm&gt; [ &lt;user&gt; [ &lt;group&gt; ] ]</code></td>
-    <td> Create a unix domain socket named <code>/dev/socket/&lt;name&gt;</code> and pass its fd to the launched process. Valid <code>&lt;type&gt;</code> values include <code>dgram</code> and <code>stream</code>. <code>user</code> and <code>group</code> default to 0.</td>
-  </tr>
-  <tr>
-    <td><code>user &lt;username&gt;</code></td>
-    <td>Change to username before exec'ing this service. Currently defaults to root.</td>
-  </tr>
-  <tr>
-    <td><code>group &lt;groupname&gt; [ &lt;groupname&gt; ]*</code></td>
-    <td> Change to groupname before exec'ing this service. &nbsp;Additional&nbsp; groupnames beyond the first, which is required, are used to set additional groups of the process (with <code>setgroups()</code>). Currently defaults to root.</td>
-  </tr>
-  <tr>
-    <td><code>capability [ &lt;capability&gt; ]+</code></td>
-    <td>Set linux capability before exec'ing this service</td>
-  </tr>
-  <tr>
-    <td><code>oneshot</code></td>
-    <td>Do not restart the service when it exits.</td>
-  </tr>
-  <tr>
-    <td><code>class &lt;name&gt;</code></td>
-    <td>Specify a class name for the service. &nbsp;All services in a named class must start and stop together. A service is considered of class &quot;default&quot; if one is not specified via the class option.</td>
-  </tr>
-</table>
-  <p>  Triggers</p>
-  <p>Triggers are strings used to match certain kinds of events that cause an action to occur.  </p>
-  <table>
-    <tr>
-      <th scope="col">Trigger</th>
-      <th scope="col">Description</th>
-    </tr>
-    <tr>
-      <td><code>boot</code></td>
-      <td>This is the first trigger that occurs when init starts (after <code>/init.conf</code> is loaded).</td>
-    </tr>
-    <tr>
-      <td><code>&lt;name&gt;=&lt;value&gt;</code></td>
-      <td>Triggers of this form occur when the property <code>&lt;name&gt;</code> is set to the specific value <code>&lt;value&gt;</code>.</td>
-    </tr>
-    <tr>
-      <td><code>device-added-&lt;path&gt;<br />
-  device-removed-&lt;path&gt;</code></td>
-      <td>Triggers of these forms occur when a device node is added or removed.</td>
-    </tr>
-    <tr>
-      <td><code> service-exited-&lt;name&gt;</code></td>
-      <td>Triggers of this form occur when the specified service exits.</td>
-    </tr>
-  </table>
-  <p><br />
-  Commands</p>
-  <table>
-    <tr>
-      <th scope="col">Command</th>
-      <th scope="col">Description</th>
-    </tr>
-    <tr>
-      <td><code>exec &lt;path&gt; [ &lt;argument&gt; ]*</code></td>
-      <td>Fork and execute a program (<code>&lt;path&gt;</code>). This will block until the program completes execution. Try to avoid exec. Unlike the <code>builtin</code> commands, it runs the risk of getting init &quot;stuck&quot;.</td>
-    </tr>
-    <tr>
-      <td><code>export &lt;name&gt; &lt;value&gt;</code></td>
-      <td>Set the environment variable <code>&lt;name&gt;</code> equal to <code>&lt;value&gt;</code> in the global environment (which will be inherited by all processes started after this command is executed).</td>
-    </tr>
-    <tr>
-      <td><code>ifup &lt;interface&gt;</code></td>
-      <td>Bring the network interface <code>&lt;interface&gt;</code> online.</td>
-    </tr>
-    <tr>
-      <td><code>import &lt;filename&gt;</code></td>
-      <td> Parse an init config file, extending the current configuration.</td>
-    </tr>
-    <tr>
-      <td><code>hostname &lt;name&gt;</code></td>
-      <td>Set the host name.</td>
-    </tr>
-    <tr>
-      <td><code>class_start &lt;serviceclass&gt;</code></td>
-      <td>Start all services of the specified class if they are not already running.</td>
-    </tr>
-    <tr>
-      <td><code>class_stop &lt;serviceclass&gt;</code></td>
-      <td>Stop all services of the specified class if they are currently running.</td>
-    </tr>
-    <tr>
-      <td><code>domainname &lt;name&gt;</code></td>
-      <td>Set the domain name.</td>
-    </tr>
-    <tr>
-      <td><code>insmod &lt;path&gt;</code></td>
-      <td>Install the module at <code>&lt;path&gt;</code>.</td>
-    </tr>
-    <tr>
-      <td><code>mkdir &lt;path&gt;</code></td>
-      <td>Make a directory at <code>&lt;path&gt;</code>.</td>
-    </tr>
-    <tr>
-      <td><code>mount &lt;type&gt; &lt;device&gt; &lt;dir&gt; [ &lt;mountoption&gt; ]*</code></td>
-      <td>Attempt to mount the named device at the directory <code>&lt;dir&gt;</code>         <code>&lt;device&gt;</code>. This may be of the form mtd@name to specify a mtd block device by name.</td>
-    </tr>
-    <tr>
-      <td><code>setkey</code></td>
-      <td>- currenlty undefined - </td>
-    </tr>
-    <tr>
-      <td><code>setprop &lt;name&gt; &lt;value&gt;</code></td>
-      <td>Set system property <code>&lt;name&gt;</code> to <code>&lt;value&gt;</code>.</td>
-    </tr>
-    <tr>
-      <td><code> setrlimit &lt;resource&gt; &lt;cur&gt; &lt;max&gt;</code></td>
-      <td>Set the rlimit for a resource.</td>
-    </tr>
-    <tr>
-      <td><code>start &lt;service&gt;</code></td>
-      <td>Start a service running if it is not already running.</td>
-    </tr>
-    <tr>
-      <td><code> stop &lt;service&gt;</code></td>
-      <td>Stop a service from running if it is currently running.</td>
-    </tr>
-    <tr>
-      <td><code>symlink &lt;target&gt; &lt;path&gt;</code></td>
-      <td>Create a symbolic link at <code>&lt;path&gt;</code> with the value <code>&lt;target&gt;</code>.</td>
-    </tr>
-    <tr>
-      <td><code>write &lt;path&gt; &lt;string&gt; [ &lt;string&gt; ]*</code></td>
-      <td>Open the file at <code>&lt;path&gt;</code> and write one or more strings to it with write(2).</td>
-    </tr>
-  </table>
-  <p>    Properties</p>
-    Init updates some system properties to provide some insight into<br />
-    what it's doing:</p>
-  <table>
-    <tr>
-      <th scope="col">Property</th>
-      <th scope="col">Description</th>
-    </tr>
-    <tr>
-      <td><code>init.action</code></td>
-      <td>Equal to the name of the action currently being executed or &quot;&quot; if none.</td>
-    </tr>
-    <tr>
-      <td><code>init.command</code></td>
-      <td>Equal to the command being executed or &quot;&quot; if none.</td>
-    </tr>
-    <tr>
-      <td><code>init.svc.&lt;name&gt;</code></td>
-      <td>State of a named service (&quot;stopped&quot;, &quot;running&quot;, or &quot;restarting&quot;).</td>
-    </tr>
-  </table>
-  <p>Example init.conf</p>
-  <p>The following snippet is an incomplete example of the <code>init.conf</code> file, simply meant to give you an idea of what a proper configuration resembles.</p>
-  <pre class="prettify">
-on boot
-  export PATH /sbin:/system/sbin:/system/bin
-  export LD_LIBRARY_PATH /system/lib
-
-  mkdir /dev
-  mkdir /proc
-  mkdir /sys
-
-
-  mount tmpfs tmpfs /dev
-  mkdir /dev/pts
-  mkdir /dev/socket
-  mount devpts devpts /dev/pts
-  mount proc proc /proc
-  mount sysfs sysfs /sys
-
-
-  write /proc/cpu/alignment 4
-
-
-  ifup lo
-
-
-  hostname localhost
-  domainname localhost
-
-
-  mount yaffs2 mtd@system /system
-  mount yaffs2 mtd@userdata /data
-
-
-  import /system/etc/init.conf
-
-
-  class_start default
-
-
-service adbd /sbin/adbd
-  user adb
-  group adb
-
-
-service usbd /system/bin/usbd -r
-  user usbd
-  group usbd
-  socket usbd 666
-
-
-service zygote /system/bin/app_process -Xzygote /system/bin --zygote
-  socket zygote 666
-
-
-service runtime /system/bin/runtime
-  user system
-  group system
-
-
-on device-added-/dev/compass
-  start akmd
-
-
-on device-removed-/dev/compass
-  stop akmd
-
-
-service akmd /sbin/akmd
-  disabled
-  user akmd
-  group akmd
-</pre>
diff --git a/pdk/docs/guide/build_cookbook.jd b/pdk/docs/guide/build_cookbook.jd
deleted file mode 100755
index 4bed947..0000000
--- a/pdk/docs/guide/build_cookbook.jd
+++ /dev/null
@@ -1,556 +0,0 @@
-page.title=Build Cookbook
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#simpleAPK">Simple APK</a></li>
-<li><a href="#APKJar">APK Dependent on static .jar file</a></li>
-    <li><a href="#APKPlatform">APK signed with the platform key</a></li>
-    <li><a href="#APKVendor">APK that signed with vendor key</a></li>
-    <li><a href="#prebuiltAPK">Prebuilt APK</a></li>
-    <li><a href="#staticJava">Adding a Static Java Library</a></li>
-    <li><a href="#mkVars">Android.mk variables</a></li>
-</ul>
-</div>
-</div>
-
-
-<p>The Android Build Cookbook offers code snippets to help you quickly implement some common build tasks. For additional instruction, please see the other build documents in this section.</p>  
-<h3><a name="simpleAPK"></a>Building a simple APK</h3>
-<pre>
-  LOCAL_PATH := $(call my-dir)
-  include $(CLEAR_VARS)
-  &nbsp;
-  # Build all java files in the java subdirectory
-  LOCAL_SRC_FILES := $(call all-subdir-java-files)
-  &nbsp;
-  # Name of the APK to build
-  LOCAL_PACKAGE_NAME := LocalPackage
-  &nbsp;
-  # Tell it to build an APK
-  include $(BUILD_PACKAGE)
-</pre>
-<h3><a name="APKJar"></a>Building a APK that depends on a static .jar file</h3>
-<pre>
-  LOCAL_PATH := $(call my-dir)
-  include $(CLEAR_VARS)
-  &nbsp;
-  # List of static libraries to include in the package
-  LOCAL_STATIC_JAVA_LIBRARIES := static-library
-  &nbsp;
-  # Build all java files in the java subdirectory
-  LOCAL_SRC_FILES := $(call all-subdir-java-files)
-  &nbsp;
-  # Name of the APK to build
-  LOCAL_PACKAGE_NAME := LocalPackage
-  &nbsp;
-  # Tell it to build an APK
-  include $(BUILD_PACKAGE)
-</pre>
-<h3><a name="APKPlatform"></a>Building a APK that should be signed with the platform key</h3>
-<pre>
-  LOCAL_PATH := $(call my-dir)
-  include $(CLEAR_VARS)
-  &nbsp;
-  # Build all java files in the java subdirectory
-  LOCAL_SRC_FILES := $(call all-subdir-java-files)
-  &nbsp;
-  # Name of the APK to build
-  LOCAL_PACKAGE_NAME := LocalPackage
-  &nbsp;
-  LOCAL_CERTIFICATE := platform
-  &nbsp;
-  # Tell it to build an APK
-  include $(BUILD_PACKAGE)
-</pre>
-<h3><a name="APKVendor"></a>Building a APK that should be signed with a specific vendor key</h3>
-<pre>
-  LOCAL_PATH := $(call my-dir)
-  include $(CLEAR_VARS)
-  &nbsp;
-  # Build all java files in the java subdirectory
-  LOCAL_SRC_FILES := $(call all-subdir-java-files)
-  &nbsp;
-  # Name of the APK to build
-  LOCAL_PACKAGE_NAME := LocalPackage
-  &nbsp;
-  LOCAL_CERTIFICATE := vendor/example/certs/app
-  &nbsp;
-  # Tell it to build an APK
-  include $(BUILD_PACKAGE)
-</pre>
-<h3><a name="prebuiltAPK"></a>Adding a prebuilt APK</h3>
-<pre>
-  LOCAL_PATH := $(call my-dir)
-  include $(CLEAR_VARS)
-  &nbsp;
-  # Module name should match apk name to be installed.
-  LOCAL_MODULE := LocalModuleName
-  LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
-  LOCAL_MODULE_CLASS := APPS
-  LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
-  &nbsp;
-  include $(BUILD_PREBUILT)
-</pre>
-<h3><a name="staticJava"></a>Adding a Static Java Library</h3>
-<pre>
-  LOCAL_PATH := $(call my-dir)
-  include $(CLEAR_VARS)
-  &nbsp;
-  # Build all java files in the java subdirectory
-  LOCAL_SRC_FILES := $(call all-subdir-java-files)
-  &nbsp;
-  # Any libraries that this library depends on
-  LOCAL_JAVA_LIBRARIES := android.test.runner
-  &nbsp;
-  # The name of the jar file to create
-  LOCAL_MODULE := sample
-  &nbsp;
-  # Build a static jar file.
-  include $(BUILD_STATIC_JAVA_LIBRARY)
-</pre>
-<h3><a name="mkVars"></a>Android.mk Variables</h3>
-
-<p>These are the variables that you'll commonly see in Android.mk files, listed
-alphabetically. First, a note on the variable naming: </p> 
-
-<ul> 
-    <li><b>LOCAL_</b> - These variables are set per-module.  They are cleared
-    by the <code>include $(CLEAR_VARS)</code> line, so you can rely on them
-    being empty after including that file.  Most of the variables you'll use
-    in most modules are LOCAL_ variables.</li> 
-    <li><b>PRIVATE_</b> - These variables are make-target-specific variables.  That
-    means they're only usable within the commands for that module.  It also
-    means that they're unlikely to change behind your back from modules that
-    are included after yours.  This 
-    <a href="http://www.gnu.org/software/make/manual/make.html#Target_002dspecific">link to the make documentation</a> 
-    describes more about target-specific variables.
-    </li> 
-    <li><b>HOST_</b> and <b>TARGET_</b> - These contain the directories
-    and definitions that are specific to either the host or the target builds.
-    Do not set variables that start with HOST_ or TARGET_ in your makefiles.
-    </li> 
-    <li><b>BUILD_</b> and <b>CLEAR_VARS</b> - These contain the names of
-    well-defined template makefiles to include.  Some examples are CLEAR_VARS
-    and BUILD_HOST_PACKAGE.</li> 
-    <li>Any other name is fair-game for you to use in your Android.mk.  However,
-    remember that this is a non-recursive build system, so it is possible that
-    your variable will be changed by another Android.mk included later, and be
-    different when the commands for your rule / module are executed.</li> 
-</ul>
-
-<table border=1 cellpadding=2 cellspacing=0>
- <tbody><tr>
-  <th scope="col">Parameter</th>
-  <th scope="col">Description</th>
- </tr>
-<tr>
-<td valign="top">LOCAL_AAPT_FLAGS</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_ACP_UNAVAILABLE</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_ADDITIONAL_JAVA_DIR</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_AIDL_INCLUDES</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_ALLOW_UNDEFINED_SYMBOLS</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_ARM_MODE</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_ASFLAGS</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_ASSET_DIR</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_ASSET_FILES</td>
-<td valign="top">In Android.mk files that <code>include $(BUILD_PACKAGE)</code> set this
-to the set of files you want built into your app.  Usually:</p> 
-<p><code>LOCAL_ASSET_FILES += $(call find-subdir-assets)</code></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_BUILT_MODULE_STEM</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_C_INCLUDES</td>
-<td valign="top"><p>Additional directories to instruct the C/C++ compilers to look for header
-files in.  These paths are rooted at the top of the tree.  Use
-<code>LOCAL_PATH</code> if you have subdirectories of your own that you
-want in the include paths.  For example:</p> 
-<p><code> 
-LOCAL_C_INCLUDES += extlibs/zlib-1.2.3<br/> 
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/src
-</code></p> 
-<p>You should not add subdirectories of include to
-<code>LOCAL_C_INCLUDES</code>, instead you should reference those files
-in the <code>#include</code> statement with their subdirectories.  For
-example:</p> 
-<p><code>#include &lt;utils/KeyedVector.h&gt;</code><br/> 
-not <code><s>#include &lt;KeyedVector.h&gt;</s></code></p> </td>
-</tr>
-<tr>
-<td valign="top">LOCAL_CC</td>
-<td valign="top">If you want to use a different C compiler for this module, set LOCAL_CC
-to the path to the compiler.  If LOCAL_CC is blank, the appropriate default
-compiler is used.</td>
-</tr>
-<tr>
-<td valign="top">LOCAL_CERTIFICATE</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_CFLAGS</td>
-<td valign="top">If you have additional flags to pass into the C or C++ compiler, add
-them here.  For example:</p> 
-<p><code>LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1</code></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_CLASSPATH</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_COMPRESS_MODULE_SYMBOLS</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_COPY_HEADERS</td>
-<td valign="top"><p>The set of files to copy to the install include tree.  You must also
-supply <code>LOCAL_COPY_HEADERS_TO</code>.</p> 
-<p>This is going away because copying headers messes up the error messages, and
-may lead to people editing those headers instead of the correct ones.  It also
-makes it easier to do bad layering in the system, which we want to avoid.  We
-also aren't doing a C/C++ SDK, so there is no ultimate requirement to copy any
-headers.</p></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_COPY_HEADERS_TO</td>
-<td valign="top"><p>The directory within "include" to copy the headers listed in
-<code>LOCAL_COPY_HEADERS</code> to.</p> 
-<p>This is going away because copying headers messes up the error messages, and
-may lead to people editing those headers instead of the correct ones.  It also
-makes it easier to do bad layering in the system, which we want to avoid.  We
-also aren't doing a C/C++ SDK, so there is no ultimate requirement to copy any
-headers.</p></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_CPP_EXTENSION</td>
-<td valign="top">If your C++ files end in something other than "<code>.cpp</code>",
-you can specify the custom extension here.  For example:
-<p><code>LOCAL_CPP_EXTENSION := .cc</code></p> 
-Note that all C++ files for a given module must have the same
-extension; it is not currently possible to mix different extensions.</td>
-</tr>
-<tr>
-<td valign="top">LOCAL_CPPFLAGS</td>
-<td valign="top">If you have additional flags to pass into <i>only</i> the C++ compiler, add
-them here.  For example:</p> 
-<p><code>LOCAL_CPPFLAGS += -ffriend-injection</code></p> 
-<code>LOCAL_CPPFLAGS</code> is guaranteed to be after <code>LOCAL_CFLAGS</code> 
-on the compile line, so you can use it to override flags listed in
-<code>LOCAL_CFLAGS</code></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_CXX</td>
-<td valign="top">If you want to use a different C++ compiler for this module, set LOCAL_CXX
-to the path to the compiler.  If LOCAL_CXX is blank, the appropriate default
-compiler is used.</td>
-</tr>
-<tr>
-<td valign="top">LOCAL_DX_FLAGS</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_EXPORT_PACKAGE_RESOURCES</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_FORCE_STATIC_EXECUTABLE</td>
-<td valign="top"><p>If your executable should be linked statically, set 
-<code>LOCAL_FORCE_STATIC_EXECUTABLE:=true</code>.  There is a very short
-list of libraries that we have in static form (currently only libc).  This is
-really only used for executables in /sbin on the root filesystem.</p> </td>
-</tr>
-<tr>
-<td valign="top">LOCAL_GENERATED_SOURCES</td>
-<td valign="top"><p>Files that you add to <code>LOCAL_GENERATED_SOURCES</code> will be
-automatically generated and then linked in when your module is built.
-See the <a href="#custom-tools">Custom Tools</a> template makefile for an
-example.</p> </td>
-</tr>
-<tr>
-<td valign="top">LOCAL_INSTRUMENTATION_FOR</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_INSTRUMENTATION_FOR_PACKAGE_NAME</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_INTERMEDIATE_SOURCES</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_INTERMEDIATE_TARGETS</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_IS_HOST_MODULE</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_JAR_MANIFEST</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_JARJAR_RULES</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_JAVA_LIBRARIES</td>
-<td valign="top"><p>When linking Java apps and libraries, <code>LOCAL_JAVA_LIBRARIES</code> 
-specifies which sets of java classes to include.  Currently there are
-two of these: <code>core</code> and <code>framework</code>.
-In most cases, it will look like this:</p> 
-<p><code>LOCAL_JAVA_LIBRARIES := core framework</code></p> 
-<p>Note that setting <code>LOCAL_JAVA_LIBRARIES</code> is not necessary
-(and is not allowed) when building an APK with
-"<code>include $(BUILD_PACKAGE)</code>".  The appropriate libraries
-will be included automatically.</p> </td>
-</tr>
-<tr>
-<td valign="top">LOCAL_JAVA_RESOURCE_DIRS</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_JAVA_RESOURCE_FILES</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_JNI_SHARED_LIBRARIES</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_LDFLAGS</td>
-<td valign="top"><p>You can pass additional flags to the linker by setting
-<code>LOCAL_LDFLAGS</code>.  Keep in mind that the order of parameters is
-very important to ld, so test whatever you do on all platforms.</p> </td>
-</tr>
-<tr>
-<td valign="top">LOCAL_LDLIBS</td>
-<td valign="top"><p><code>LOCAL_LDLIBS</code> allows you to specify additional libraries
-that are not part of the build for your executable or library.  Specify
-the libraries you want in -lxxx format; they're passed directly to the 
-link line.  However, keep in mind that there will be no dependency generated
-for these libraries.  It's most useful in simulator builds where you want
-to use a library preinstalled on the host.  The linker (ld) is a particularly
-fussy beast, so it's sometimes necessary to pass other flags here if you're
-doing something sneaky. Some examples:</p> 
-<p><code>LOCAL_LDLIBS += -lcurses -lpthread<br/> 
-LOCAL_LDLIBS += -Wl,-z,origin
-</code></p> </td>
-</tr>
-<tr>
-<td valign="top">LOCAL_MODULE</td>
-<td valign="top"><code>LOCAL_MODULE</code> is the name of what's supposed to be generated
-from your Android.mk.  For exmample, for libkjs, the <code>LOCAL_MODULE</code> 
-is "libkjs" (the build system adds the appropriate suffix -- .so .dylib .dll).
-For app modules, use <code>LOCAL_PACKAGE_NAME</code> instead of 
-<code>LOCAL_MODULE</code>. </td>
-</tr>
-<tr>
-<td valign="top">LOCAL_MODULE_PATH</td>
-<td valign="top">Instructs the build system to put the module somewhere other than what's
-normal for its type.  If you override this, make sure you also set
-<code>LOCAL_UNSTRIPPED_PATH</code> if it's an executable or a shared library
-so the unstripped binary has somewhere to go.  An error will occur if you forget
-to.</p> 
-<p>See <a href="#moving-modules">Putting modules elsewhere</a> for more.</td>
-</tr>
-<tr>
-<td valign="top">LOCAL_MODULE_STEM</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_MODULE_TAGS</td>
-<td valign="top"><p>Set <code>LOCAL_MODULE_TAGS</code> to any number of whitespace-separated
-tags.  <p>This variable controls what build flavors the package gets included in. For example:</p>
-<ul type="disc">
-  <li><code>user</code>: include this in user/userdebug builds</li>
-  <li><code>eng</code>: include this in eng builds</li>
-  <li><code>tests</code>: the target is a testing target and makes it available for tests</li>
-  <li><code>optional</code>: don't include this</li>
-</ul></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_NO_DEFAULT_COMPILER_FLAGS</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_NO_EMMA_COMPILE</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_NO_EMMA_INSTRUMENT</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_NO_STANDARD_LIBRARIES</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_OVERRIDES_PACKAGES</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_PACKAGE_NAME</td>
-<td valign="top"><code>LOCAL_PACKAGE_NAME</code> is the name of an app.  For example,
-Dialer, Contacts, etc. </td>
-</tr>
-<tr>
-<td valign="top">LOCAL_POST_PROCESS_COMMAND</td>
-<td valign="top"><p>For host executables, you can specify a command to run on the module
-after it's been linked.  You might have to go through some contortions
-to get variables right because of early or late variable evaluation:</p> 
-<p><code>module := $(HOST_OUT_EXECUTABLES)/$(LOCAL_MODULE)<br/> 
-LOCAL_POST_PROCESS_COMMAND := /Developer/Tools/Rez -d __DARWIN__ -t APPL\<br/> 
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-d __WXMAC__ -o $(module) Carbon.r
-</code></p> 
- </td>
-</tr>
-<tr>
-<td valign="top">LOCAL_PREBUILT_EXECUTABLES</td>
-<td valign="top">When including $(BUILD_PREBUILT) or $(BUILD_HOST_PREBUILT), set these to
-executables that you want copied.  They're located automatically into the
-right bin directory.</td>
-</tr>
-<tr>
-<td valign="top">LOCAL_PREBUILT_JAVA_LIBRARIES</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_PREBUILT_LIBS</td>
-<td valign="top">When including $(BUILD_PREBUILT) or $(BUILD_HOST_PREBUILT), set these to
-libraries that you want copied.  They're located automatically into the
-right lib directory.</td>
-</tr>
-<tr>
-<td valign="top">LOCAL_PREBUILT_OBJ_FILES</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_PRELINK_MODULE</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_REQUIRED_MODULES</td>
-<td valign="top"><p>Set <code>LOCAL_REQUIRED_MODULES</code> to any number of whitespace-separated
-module names, like "libblah" or "Email".  If this module is installed, all
-of the modules that it requires will be installed as well.  This can be
-used to, e.g., ensure that necessary shared libraries or providers are
-installed when a given app is installed.</td>
-</tr>
-<tr>
-<td valign="top">LOCAL_RESOURCE_DIR</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_SDK_VERSION</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_SHARED_LIBRARIES</td>
-<td valign="top">These are the libraries you directly link against.  You don't need to
-pass transitively included libraries.  Specify the name without the suffix:</p> 
-<p><code>LOCAL_SHARED_LIBRARIES := \<br/> 
-	&nbsp;&nbsp;&nbsp;&nbsp;libutils \<br/> 
-	&nbsp;&nbsp;&nbsp;&nbsp;libui \<br/> 
-	&nbsp;&nbsp;&nbsp;&nbsp;libaudio \<br/> 
-	&nbsp;&nbsp;&nbsp;&nbsp;libexpat \<br/> 
-	&nbsp;&nbsp;&nbsp;&nbsp;libsgl
-</code></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_SRC_FILES</td>
-<td valign="top">The build system looks at <code>LOCAL_SRC_FILES</code> to know what source
-files to compile -- .cpp .c .y .l .java.  For lex and yacc files, it knows
-how to correctly do the intermediate .h and .c/.cpp files automatically.  If
-the files are in a subdirectory of the one containing the Android.mk, prefix
-them with the directory name:</p> 
-<p><code>LOCAL_SRC_FILES := \<br/> 
-	&nbsp;&nbsp;&nbsp;&nbsp;file1.cpp \<br/> 
-	&nbsp;&nbsp;&nbsp;&nbsp;dir/file2.cpp
-</code></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_STATIC_JAVA_LIBRARIES</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_STATIC_LIBRARIES</td>
-<td valign="top">These are the static libraries that you want to include in your module.
-Mostly, we use shared libraries, but there are a couple of places, like
-executables in sbin and host executables where we use static libraries instead.
-<p><code>LOCAL_STATIC_LIBRARIES := \<br/> 
-	&nbsp;&nbsp;&nbsp;&nbsp;libutils \<br/> 
-	&nbsp;&nbsp;&nbsp;&nbsp;libtinyxml
-</code></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_UNINSTALLABLE_MODULE</td>
-<td valign="top"></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_UNSTRIPPED_PATH</td>
-<td valign="top">Instructs the build system to put the unstripped version of the module
-somewhere other than what's normal for its type.  Usually, you override this
-because you overrode <code>LOCAL_MODULE_PATH</code> for an executable or a
-shared library.  If you overrode <code>LOCAL_MODULE_PATH</code>, but not 
-<code>LOCAL_UNSTRIPPED_PATH</code>, an error will occur.</p> 
-<p>See <a href="#moving-modules">Putting modules elsewhere</a> for more.</td>
-</tr>
-<tr>
-<td valign="top">LOCAL_WHOLE_STATIC_LIBRARIES</td>
-<td valign="top">These are the static libraries that you want to include in your module without allowing
-the linker to remove dead code from them. This is mostly useful if you want to add a static library
-to a shared library and have the static library's content exposed from the shared library.
-<p><code>LOCAL_WHOLE_STATIC_LIBRARIES := \<br/> 
-	&nbsp;&nbsp;&nbsp;&nbsp;libsqlite3_android<br/> 
-</code></td>
-</tr>
-<tr>
-<td valign="top">LOCAL_YACCFLAGS</td>
-<td valign="top">Any flags to pass to invocations of yacc for your module.  A known limitation
-here is that the flags will be the same for all invocations of YACC for your
-module.  This can be fixed.  If you ever need it to be, just ask.</p> 
-<p><code>LOCAL_YACCFLAGS := -p kjsyy</code></td>
-</tr>
-<tr>
-<td valign="top">OVERRIDE_BUILT_MODULE_PATH</td>
-<td valign="top"></td>
-</tr>
-
-</table>
diff --git a/pdk/docs/guide/build_new_device.jd b/pdk/docs/guide/build_new_device.jd
deleted file mode 100755
index 28e7c2e..0000000
--- a/pdk/docs/guide/build_new_device.jd
+++ /dev/null
@@ -1,242 +0,0 @@
-page.title=Configuring a New Product
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#androidOHDPortingDeviceBuildingProcess">Detailed Instructions</a></li>
-<li><a href="#androidBuildNewFileTree">New Product File Tree</a></li>
-<li><a href="#androidBuildSystemProductDefFiles">Product Definition Files</a></li>
-</ul>
-</div>
-</div>
-
-
-<a name="androidOHDPortingDeviceBuildingProcess"></a><h3>Detailed Instructions</h3>
-
-<p>The steps below describe how to configure makefiles for new mobile devices and products running Android.</p>
-<ol>
-  <li>Create a company directory in <code>//vendor/</code>.<br/>
-  <pre class="prettyprint">
-  mkdir vendor/&lt;company_name&gt;</pre></li>
-  <li>Create a <code>products</code> directory beneath the company directory you created in step 1.<BR>
-  <pre class="prettyprint">
-  mkdir vendor/&lt;company_name&gt;/products/</pre></li>
-  <li>Create a product-specific makefile, called <code>vendor/&lt;company_name&gt;/products/&lt;first_product_name&gt;.mk</code>, that includes at least the following code:<BR>
-    <pre class="prettyprint">
-  $(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
-  #
-  # Overrides
-  PRODUCT_NAME := &lt;first_product_name&gt;
-  PRODUCT_DEVICE := &lt;board_name&gt;</pre>
-  <li>
-  Additional product-specific variables can be added to this <a href="#androidBuildSystemProductDefFiles">Product Definition</a> 
-file.
-  </li>
-  <li>In the <code>products</code> directory, create an <code>AndroidProducts.mk</code> file that point to (and is responsible for finding) the individual product make files.<BR>
-  <pre class="prettyprint">
-  #
-  # This file should set PRODUCT_MAKEFILES to a list of product makefiles
-  # to expose to the build system.  LOCAL_DIR will already be set to
-  # the directory containing this file. 
-  #
-  # This file may not rely on the value of any variable other than
-  # LOCAL_DIR; do not use any conditionals, and do not look up the
-  # value of any variable that isn't set in this file or in a file that
-  # it includes.
-  #
-  
-  PRODUCT_MAKEFILES := \
-    $(LOCAL_DIR)/first_product_name.mk \</pre></li>
-  <li>Create a board-specific directory beneath your company directory that matches the <code>PRODUCT_DEVICE</code> variable <code>&lt;board_name&gt;</code> referenced in the product-specific make file above. This will include a make file that gets accessed by any product using this board.<BR>
-  <pre class="prettyprint">
-  mkdir vendor/&lt;company_name&gt;/&lt;board_name&gt;</pre></li>
-    <li>Create a <code>BoardConfig.mk</code> file in the directory created in the previous step (<code>vendor/&lt;company_name&gt;/&lt;board_name&gt;</code>). <BR>
-  <pre class="prettyprint">
-  # These definitions override the defaults in config/config.make for &lt;board_name&gt;
-  #
-  # TARGET_NO_BOOTLOADER := false
-  # TARGET_HARDWARE_3D := false 
-  #
-  TARGET_USE_GENERIC_AUDIO := true</pre></li>  
-  <li>If you wish to modify system properties, create a <code>system.prop</code> file in your <code>&lt;board_name&gt;</code> directory(<code>vendor/&lt;company_name&gt;/&lt;board_name&gt;</code>).<BR>
-  <pre class="prettyprint">
-  # system.prop for <board_name>
-  # This overrides settings in the products/generic/system.prop file
-  #
-  # rild.libpath=/system/lib/libreference-ril.so
-  # rild.libargs=-d /dev/ttyS0</pre></li>   
-  <li>Add a pointer to <code>&lt;second_product_name&gt;.mk</code> within <code>products/AndroidProducts.mk</code>.<BR>
-  <pre class="prettypring">
-  PRODUCT_MAKEFILES := \
-    $(LOCAL_DIR)/first_product_name.mk \
-    $(LOCAL_DIR)/second_product_name.mk</pre></li>
-  <li>An <code>Android.mk</code> file must be included in <code>vendor/&lt;company_name&gt;/&lt;board_name&gt;</code> with at least the following code:<BR>
-  <pre class="prettyprint">
-  # make file for new hardware <board_name> from <company_name>
-  #
-  LOCAL_PATH := $(call my-dir)
-  #
-  # this is here to use the pre-built kernel
-  ifeq ($(TARGET_PREBUILT_KERNEL),)
-  TARGET_PREBUILT_KERNEL := $(LOCAL_PATH)/kernel
-  endif
-  #
-  file := $(INSTALLED_KERNEL_TARGET)
-  ALL_PREBUILT += $(file)
-  $(file): $(TARGET_PREBUILT_KERNEL) | $(ACP)
-		$(transform-prebuilt-to-target)
-  #
-  # no boot loader, so we don't need any of that stuff..  
-  #
-  LOCAL_PATH := vendor/&lt;company_name&gt;/&lt;board_name&gt;
-  #
-  include $(CLEAR_VARS)
-  #
-  # include more board specific stuff here? Such as Audio parameters.      
-  #</pre>
-
-  </li>
-<li>To create a second product for the same board, create a second product-specific make file called <code>vendor/company_name/products/&lt;second_product_name&gt;.mk</code> that includes:<BR>
-<pre class="prettyprint">
-  $(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
-  #
-  # Overrides
-  PRODUCT_NAME := &lt;second_product_name&gt;
-  PRODUCT_DEVICE := &lt;board_name&gt;</pre></li>   	
-</ol>
-<p>By now, you should have two new products, called <code>&lt;first_product_name&gt;</code> and <code>&lt;second_product_name&gt;</code> associated with <code>&lt;company_name&gt;</code>. To verify that a product is properly configured (<code>&lt;first_product_name&gt;</code>, for example), execute the following:<BR>
-<pre class="prettyprint">
-  . build/envsetup.sh
-  make PRODUCT-&lt;first_product_name&gt;-user
-</pre>
-<p>You should find new build binaries located in <code>/out/target/product/&lt;board_name&gt;</code>.
-
-
-<a name="androidBuildNewFileTree"></a><h3>New Product File Tree</h3>
-
-<p>The file tree below illustrates what your own system should look like after completing the steps above.</p>
-<p>
-<ul>
-  <li><code>&lt;company_name&gt;</code></li>
-  <ul>
-    <li><code>&lt;board_name&gt;</code></li>
-    <ul>
-      <li><code>Android.mk</code></li>
-      <li><code>product_config.mk</code></li>
-      <li><code>system.prop</code></li>
-    </ul>
-    <li><code>products</code></li>
-    <ul>
-      <li><code>AndroidProducts.mk</code></li>
-      <li><code>&lt;first_product_name&gt;.mk</code></li>
-      <li><code>&lt;second_product_name&gt;.mk</code></li>
-    </ul>
-  </ul>
-</ul>
-</p>
-
-<a name="androidBuildSystemProductDefFiles"></a><h3>Product Definition Files</h3>
-
-<p>Product-specific variables are defined in product definition files. A product definition file can inherit from other product definition files, thus reducing the need to copy and simplifying maintenance.</p>
-<p>Variables maintained in a product definition files include:</p>
-<p>
-<table border=1 cellpadding=2 cellspacing=0>
- <tbody><tr>
-  <th scope="col">Parameter</th>
-  <th scope="col">Description</th>
-  <th scope="col">Example</th>
- </tr>
- <tr>
-   <td valign="top">PRODUCT_NAME</td>
-   <td valign="top">End-user-visible name for the overall product. Appears in the "About the phone" info.</td>
-   <td valign="top"></td>
- </tr>
- <tr>
-   <td valign="top">PRODUCT_MODEL</td>
-   <td valign="top">End-user-visible name for the end product</td>
-   <td valign="top"></td>
- </tr>
- <tr>
-   <td valign="top">PRODUCT_LOCALES</td>
-   <td valign="top">A space-separated list of two-letter language code, two-letter country code pairs that describe several settings for the user, such as the UI language and time, date and currency formatting. The first locale listed in PRODUCT_LOCALES is is used if the locale has never been set before.</td>
-   <td valign="top"><code>en_GB de_DE es_ES fr_CA</code></td>
- </tr>
- <tr>
-   <td valign="top">PRODUCT_PACKAGES</td>
-   <td valign="top">Lists the APKs to install.</td>
-   <td valign="top"><code>Calendar Contacts</code></td>
- </tr>
- <tr>
-   <td valign="top">PRODUCT_DEVICE</td>
-   <td valign="top">Name of the industrial design</td>
-   <td valign="top"><code>dream</code></td>
- </tr>
- <tr>
-   <td valign="top">PRODUCT_MANUFACTURER</td>
-   <td valign="top">Name of the manufacturer</td>
-   <td valign="top"><code>acme</code></td>
- </tr>
- <tr>
-   <td valign="top">PRODUCT_BRAND</td>
-   <td valign="top">The brand (e.g., carrier) the software is customized for, if any</td>
-   <td valign="top"></td>
- </tr>
- <tr>
-   <td valign="top">PRODUCT_PROPERTY_OVERRIDES</td>
-   <td valign="top">List of property assignments in the format "key=value"</td>
-   <td valign="top"></td>
- </tr>
- <tr>
-   <td valign="top">PRODUCT_COPY_FILES</td>
-   <td valign="top">List of words like <code>source_path:destination_path</code>. The file at the source path should be copied to the destination path when building this product. The rules for the copy steps are defined in config/Makefile</td>
-   <td valign="top"></td>
- </tr>
- <tr>
-   <td valign="top">PRODUCT_OTA_PUBLIC_KEYS</td>
-   <td valign="top">List of OTA public keys for the product</td>
-   <td valign="top"></td>
- </tr>
- <tr>
-   <td valign="top">PRODUCT_POLICY</td>
-   <td valign="top">Indicate which policy this product should use</td>
-   <td valign="top"></td>
- </tr>
- <tr>
-   <td valign="top">PRODUCT_PACKAGE_OVERLAYS</td>
-   <td valign="top">Indicate whether to use default resources or add any product specific overlays</td>
-   <td valign="top"><code>vendor/acme/overlay</code></td>
- </tr>
- <tr>
-   <td valign="top">PRODUCT_CONTRIBUTORS_FILE</td>
-   <td valign="top">HTML file containing the contributors to the project.</td>
-   <td valign="top"></td>
- </tr>
- <tr>
-   <td valign="top">PRODUCT_TAGS</td>
-   <td valign="top">list of space-separated words for a given product</td>
-   <td valign="top"></td>
- </tr>
-</table>
-
-</P>
-<p>The snippet below illustrates a typical product definition file.</p>
-<pre class="prettyprint">
-$(call inherit-product, build/target/product/generic.mk)
-
-#Overrides
-PRODUCT_NAME := MyDevice
-PRODUCT_MANUFACTURER := acme
-PRODUCT_BRAND := acme_us
-PRODUCT_LOCALES := en_GB es_ES fr_FR
-PRODUCT_PACKAGE_OVERLAYS := vendor/acme/overlay
-
-</pre>
-
-
diff --git a/pdk/docs/guide/build_system.jd b/pdk/docs/guide/build_system.jd
deleted file mode 100755
index fd0ff80..0000000
--- a/pdk/docs/guide/build_system.jd
+++ /dev/null
@@ -1,270 +0,0 @@
-page.title=Android Build System
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#androidBuildSystemOverview">Understanding the makefile</a></li>
-<li><a href="#androidBuildSystemLayers">Layers</a></li>
-<li><a href="#androidSourceSetupBuildingCodeBase">Building the Android Platform</a></li>
-<li><a href="#androidSourceSetupBuildingKernel">Building the Android Kernel</a></li>
-<li><a href="#androidBuildVariants">Build Variants</a></li>
-</ul>
-</div>
-</div>
-
-<p>Android uses a custom build system to generate tools, binaries, and documentation. This document provides an overview of Android's build system and instructions for doing a simple build. </p>
-<p>Android's build system is make based and requires a recent version of GNU Make (note that Android uses advanced features of GNU Make that may not yet appear on the GNU Make web site). Before continuing, check your version of make by running <code>% make -v</code>. If you don't have version 3.80 or greater, you need to <a href="http://www.gnu.org/software/make/">upgrade your version of make</a>. </p>
-
-
-
-
-<a name="androidBuildSystemOverview"></a><h4>Understanding the makefile</h4>
-
-<p>A makefile defines how to build a particular application. Makefiles typically include all of the following elements:</p>
-<ol>
-  <li>Name: Give your build a name (<code>LOCAL_MODULE := &lt;build_name&gt;</code>).</li>
-  <li>Local Variables: Clear local variables with CLEAR_VARS  (<code>include $(CLEAR_VARS)</code>).</li>
-  <li>Files: Determine which files your application depends upon (<code>LOCAL_SRC_FILES := main.c</code>).</li>
-  <li>Tags: Define tags, as necessary (<code>LOCAL_MODULE_TAGS := eng development</code>).</li>
-  <li>Libraries: Define whether your application links with other libraries (<code>LOCAL_SHARED_LIBRARIES := cutils</code>).</li>
-  <li>Template file: Include a template file to define underlining make tools for a particular target (<code>include $(BUILD_EXECUTABLE)</code>).</li>
-</ol>
-
-<p>The following snippet illustrates a typical makefile.</p>
-<pre class="prettyprint">
-LOCAL_PATH := $(my-dir)
-include $(CLEAR_VARS)
-LOCAL_MODULE := &lt;buil_name&gt;
-LOCAL_SRC_FILES := main.c
-LOCAL_MODULE_TAGS := eng development
-LOCAL_SHARED_LIBRARIES := cutils
-include $(BUILD_EXECUTABLE)
-(HOST_)EXECUTABLE, (HOST_)JAVA_LIBRARY, (HOST_)PREBUILT, (HOST_)SHARED_LIBRARY,
-  (HOST_)STATIC_LIBRARY, PACKAGE, JAVADOC, RAW_EXECUTABLE, RAW_STATIC_LIBRARY,
-  COPY_HEADERS, KEY_CHAR_MAP
-</pre>
-<p>The snippet above includes artificial line breaks to maintain a print-friendly document.</p>
-
-
-<a name="androidBuildSystemLayers"></a><h4>Layers</h4>
-
-<p>The build hierarchy includes the abstraction layers described in the table below.</p>
-
-<p>Each layer relates to the one above it in a one-to-many relationship. For example, an arch can have more than one board and each board can have more than one device. You may define an element in a given layer as a specialization of an element in the same layer, thus eliminating copying and simplifying maintenance.</p>
- 
-<table border=1 cellpadding=2 cellspacing=0>
- <tbody><tr>
-  <th scope="col">Layer</th>
-  <th  scope="col">Example</th>
-  <th  scope="col">Description</th>
- </tr>
-  <tr>
-    <td valign="top">Product</td>
-    <td valign="top">myProduct, myProduct_eu, myProduct_eu_fr, j2, sdk</td>
-    <td valign="top">The product layer defines a complete specification of a shipping product, defining which modules to build and how to configure them. You might offer a device in several different versions based on locale, for example, or on features such as a camera. </td>
-  </tr>
-  <tr>
-    <td valign="top">Device</td>
-    <td valign="top">myDevice, myDevice_eu, myDevice_eu_lite</td>
-    <td valign="top">The device layer represents the physical layer of plastic on the device. For example, North American devices probably include QWERTY keyboards whereas devices sold in France probably include AZERTY keyboards. Peripherals typically connect to the device layer. </td>
-  </tr>
-  <tr>
-    <td valign="top">Board</td>
-    <td valign="top">sardine, trout, goldfish </td>
-    <td valign="top">The board layer represents the bare schematics of a product. You may still connect peripherals to the board layer. </td>
-  </tr>
-  <tr>
-    <td valign="top">Arch</td>
-    <td valign="top">arm (arm5te) (arm6), x86, 68k </td>
-    <td valign="top">The arch layer describes the processor running on your board. </td>
-  </tr>
-</table>
-
-<a name="androidSourceSetupBuildingCodeBase"></a><h3>Building the Android Platform</h3>
-
-<p>This section describes how to build the default version of Android. Once you are comfortable with a generic build, then you can begin to modify Android for your own target device.</p>
-
-
-<a name="androidSourceSetupBuildingDeviceCodeBase"></a><h4>Device Code</h4>
-
-<p>To do a generic build of android, source <code>build/envsetup.sh</code>, which contains necessary variable and function definitions, as described below.</p>
-<pre class="prettyprint">
-% cd $TOP
-
-% . build/envsetup.sh
-
-# pick a configuration using choosecombo
-% choosecombo
-
-% make -j4 PRODUCT-generic-user
-</pre>
-<p>You can also replace user with eng for a debug engineering build:</p>
-
-<pre class="prettyprint">
-% make -j4 PRODUCT-generic-eng
-</pre>
-
-<p>These <a href="#androidBuildVariants">Build Variants</a> differ in terms of debug options and packages installed. 
- 
-
-<a name="androidBuildingCleaning"></a><h4>Cleaning Up</h4>
-
-<p>Execute <code>% m clean</code> to clean up the binaries you just created. You can also execute <code>% m clobber</code> to get rid of the binaries of all combos. <code>% m clobber</code> is equivalent to removing the <code>//out/</code> directory where all generated files are stored.</p>
-
-
-<a name="androidBuildingSpeeding"></a><h4>Speeding Up Rebuilds</h4>
-
-<p> The binaries of each combo are stored as distinct sub-directories of <code>//out/</code>, making it possible to quickly switch between combos without having to recompile all sources each time. </p>
-<p> However, performing a clean rebuild is necessary if the build system doesn't catch changes to environment variables or makefiles. If this happens often, you should define the <code>USE_CCACHE</code> environment variable as shown below: </p>
-<pre class="prettyprint">
-% export USE_CCACHE=1
-</pre>
-<p>Doing so will force the build system to use the ccache compiler cache tool, which reduces recompiling all sources.</p>
-
-<p><code>ccache</code> binaries are provided in <code>//prebuilt/...</code> and don't need to get installed on your system.</p>
-
-
-<a name="androidBuildingTroubleshooting"></a><h4>Troubleshooting</h4>
-
-<p>The following error is likely caused by running an outdated version of Java.</p>
-<pre class="prettyprint">
-device Dex: core  UNEXPECTED TOP-LEVEL ERROR:
-java.lang.NoSuchMethodError: method java.util.Arrays.hashCode with
-signature ([Ljava.lang.Object;)I was not found.
-  at com.google.util.FixedSizeList.hashCode(FixedSizeList.java:66)
-  at com.google.rop.code.Rop.hashCode(Rop.java:245)
-  at java.util.HashMap.hash(libgcj.so.7)
-[...]
-</pre>
-<p><code>dx</code> is a Java program that uses facilities first made available in Java version 1.5. Check your version of Java by executing <code>% java -version</code> in the shell you use to build. You should see something like:</p>
-<pre class="prettyprint">
-java version "1.5.0_07"
-Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-164)
-Java HotSpot(TM) Client VM (build 1.5.0_07-87, mixed mode, sharing)
-</pre>
-<p>If you do have Java 1.5 or later and your receive this error, verify that you have properly updated your <code>PATH</code> variable.</p>
-
-
-<a name="androidSourceSetupBuildingKernel"></a><h3>Building the Android Kernel</h3>
-
-<p>This section describes how to build Android's default kernel. Once you are comfortable with a generic build, then you can begin to modify Android drivers for your own target device.</p>
-
-
-<p>To build the kernel base, switch to the device directory (<code>/home/joe/android/device</code>) in order to establish variables and run:
-<pre class="prettyprint">
-% . build/envsetup.sh
-% partner_setup generic
-</pre>
-<p>Then switch to the kernel directory <code>/home/joe/android/kernel</code>.
-
-
-<a name="androidSourceSetupBuildingKernelCheckingBranch"></a><h4>Checking Out a Branch</h4>
-
-<p>The default branch is always <code>android</code>. To check out a different branch, execute the following:</p>
-
-<pre class="prettyprint">
-% git checkout --track -b android-mydevice origin/android-mydevice
-  //Branch android-mydevice set up to track remote branch
-% refs/remotes/origin/android-mydevice.
-  //Switched to a new branch "android-mydevice"
-</pre>
-
-<p>To simplify code management, give your local branch the same name as the remote branch it is tracking (as illustrated in the snippet above). Switch between branches by executing <code>% git checkout &lt;branchname&gt;</code>.</p>
-
-
-<a name="androidSourceSetupBuildingKernelBranchLocation"></a><h4>Verifying Location</h4>
-
-<p>Find out which branches exist (both locally and remotely) and which one is active (marked with an asterisk) by executing the following:</p>
-<pre class="prettyprint">
-% git branch -a
-  android
-* android-mydevice
-  origin/HEAD
-  origin/android
-  origin/android-mydevice
-  origin/android-mychipset
-</pre>
-<p>To only see local branches, omit the <code>-a</code> flag.</p> 
-
-
-<a name="androidSourceSetupBuildingKernelBuild"></a><h4>Building the Kernel</h4>
-
-<p>To build the kernel, execute:</p>
-<pre class="prettyprint">
-% make -j4
-</pre>
-
-<a name="androidBuildVariants"></a><h3>Build Variants</h3>
-
-<p> 
-When building for a particular product, it's often useful to have minor
-variations on what is ultimately the final release build.  These are the
-currently-defined build variants:
-</p> 
- 
-<table border=1> 
-<tr> 
-    <td> 
-        <code>eng<code> 
-    </td> 
-    <td> 
-        This is the default flavor. A plain <code>make</code> is the
-        same as <code>make eng</code>.
-        <ul> 
-        <li>Installs modules tagged with: <code>eng</code>, <code>debug</code>,
-            <code>user</code>, and/or <code>development</code>.
-        <li>Installs non-APK modules that have no tags specified.
-        <li>Installs APKs according to the product definition files, in
-            addition to tagged APKs.
-        <li><code>ro.secure=0</code> 
-        <li><code>ro.debuggable=1</code> 
-        <li><code>ro.kernel.android.checkjni=1</code> 
-        <li><code>adb</code> is enabled by default.
-    </td> 
-</tr> 
-<tr> 
-    <td> 
-        <code>user<code> 
-    </td> 
-    <td> 
-        <code>make user</code>
-        <p> 
-        This is the flavor intended to be the final release bits.
-        <ul> 
-        <li>Installs modules tagged with <code>user</code>.</li>
-        <li>Installs non-APK modules that have no tags specified.</li>
-        <li>Installs APKs according to the product definition files; tags
-            are ignored for APK modules.</li>
-        <li><code>ro.secure=1</code> </li>
-        <li><code>ro.debuggable=0</code> </li>
-        <li><code>adb</code> is disabled by default.</li>
-    </td> 
-</tr> 
-<tr> 
-    <td> 
-        <code>userdebug<code> 
-    </td> 
-    <td> 
-        <code>make userdebug</code>
-        <p> 
-        The same as <code>user</code>, except:
-        <ul> 
-        <li>Also installs modules tagged with <code>debug</code>.
-        <li><code>ro.debuggable=1</code> 
-        <li><code>adb</code> is enabled by default.
-    </td> 
-</tr> 
-</table> 
- 
-<p> 
-If you build one flavor and then want to build another, you should run
-<code>make installclean</code> between the two makes to guarantee that
-you don't pick up files installed by the previous flavor.  <code>make
-clean</code> will also suffice, but it takes a lot longer.
-</p> 
diff --git a/pdk/docs/guide/camera.jd b/pdk/docs/guide/camera.jd
deleted file mode 100755
index 98636d8..0000000
--- a/pdk/docs/guide/camera.jd
+++ /dev/null
@@ -1,76 +0,0 @@
-page.title=Camera
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#androidCameraBuildingDriver">Building a Camera Library</a></li>
-<li><a href="#androidCameraSequenceDiagrams">Sequence Diagrams</a></li>
-<li><a href="#androidCameraInterfaceIntro">Interface</a></li>
-</ul>
-</div>
-</div>
-
-<p>Android's camera subsystem connects the camera application to the application framework and user space libraries, which in turn communicate with the camera hardware layer that operates the physical camera.</p>
-<p>The diagram below illustrates the structure of the camera subsystem.</p>
-<p><img src="images/camera_video2.gif"></p>
-
-
-<a name="androidCameraBuildingDriver"></a><h3>Building a Camera Library</h3>
-
-<p>To implement a camera driver, create a shared library that implements the interface defined in <code>CameraHardwareInterface.h</code>. You must name your shared library <code>libcamera.so</code> so that it will get loaded from <code>/system/lib</code> at runtime.  Place libcamera sources and <code>Android.mk</code> in <code>vendor/acme/chipset_or_board/libcamera/</code>.</p>
-<p>The following stub <code>Android.mk</code> file ensures that <code>libcamera</code> compiles and links to the appropriate libraries:</p>
-<pre class="prettify">
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libcamera
-
-LOCAL_SHARED_LIBRARIES := \
-    libutils \
-    librpc \
-    liblog
-
-LOCAL_SRC_FILES += MyCameraHardware.cpp
-
-LOCAL_CFLAGS +=
-
-LOCAL_C_INCLUDES +=
-
-LOCAL_STATIC_LIBRARIES += \
-    libcamera-common \
-    libclock-rpc \
-    libcommondefs-rpc
-
-include $(BUILD_SHARED_LIBRARY)
-</pre>
-
-
-<a name="androidCameraSequenceDiagrams"></a><h3>Sequence Diagrams</h3>
-
-
-
-<a name="androidCameraSequenceDiagramsPreview"></a><h4>Preview</h4>
-
-<p>The following diagram illustrates the sequence of function calls and actions necessary for your camera to preview.</p>
-<img src="images/cameraPreview.jpg">
-
-
-<a name="androidCameraSequenceDiagramsTakePic"></a><h4>Taking a Picture</h4>
-
-<p>The following diagram illustrates the sequence of function calls and actions necessary for your camera to take a picture.</p>
-<img src="images/cameraTakePicture.jpg">
-
-
-<a name="androidCameraInterfaceIntro"></a><h3>Interface</h3>
-
-
-
-<p class="note"><strong>Note</strong>: This document relies on some Doxygen-generated content that appears in an iFrame below. To return to the Doxygen default content for this page, <a href="camera.html">click here</a>.</p>
-
-
-<iframe onLoad="resizeDoxFrameHeight();" src="CameraHardwareInterface_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe>
diff --git a/pdk/docs/guide/customization.jd b/pdk/docs/guide/customization.jd
deleted file mode 100755
index 9c56681..0000000
--- a/pdk/docs/guide/customization.jd
+++ /dev/null
@@ -1,321 +0,0 @@
-page.title=Customization
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#androidBootScreenCustomization">Boot Screen Customization</a></li>
-<li><a href="#androidNetCustPlat">Network Customization Platform</a></li>
-<li><a href="#androidCustomizingPre-LoadedApps">Customizing pre-loaded applications</a></li> 
-<li><a href="#androidBrowserBookmarks">Customizing browser bookmarks</a></li> 
-<li><a href="#androidEmailProviderCustomization">Email Provider Customization</a></li>
-<li><a href="#androidThemes">Platform Themes</a></li>
-</ul>
-</div>
-</div>
-
-
- 
-<a name="androidBootScreenCustomization"></a><h3>Boot Screen Customization</h3> 
- 
-<p>At startup, Android displays a splashscreen image while booting the device. Do the following if you wish to modify the default splash screen:</p> 
-<p> 
-<ol><li>Create a 320x480 image, <code>splashscreen.jpg</code> in this example.</li> 
-<li>Using ImageMagick, convert your .jpg file to .r format:
-<pre class="prettify"> 
-convert screen.jpg screen.r
-</pre> 
-</li> 
-<li>Use the rgb2565 application to convert the image to 565 format:
-<pre class="prettify"> 
-rgb2565 < screen.rgb > screen.565
-</pre> 
-</li> 
-<li>Use fastboot to flash the image to the device:
-<pre class="prettify"> 
-fastboot flash splash1 screen.565
-</pre> 
-</li> 
-</ol> 
- 
- 
-<a name="androidNetCustPlat"></a><h3>Network Customization Platform</h3> 
- 
- 
- 
-<a name="androidNetCustPlatNetworkConfig"></a><h4>Network Configuration</h4> 
- 
-<p>Android stores network configurations as a resource that gets compiled into binary at form at build time. The XML representation of this resource is located at <code>//android/frameworks/base/core/res/res/xml/apns.xml</code>. This file does not include any configured APNs. You should not modify this file, but instead configure APNs by product at build time (see Build-time APN Configuration below).</p> 
-<p>Each network configuration is stored in an XML element following this syntax:</p> 
-<pre class="prettify"> 
-&lt;apn carrier="T-Mobile US"
-         mcc="310"
-         mnc="260"
-         apn=" wap.voicestream.com"
-         user="none"
-         server="*"
-         password="none"
-         proxy=" 216.155.165.50"
-         port="8080"
-         mmsc="http://216.155.174.84/servlets/mms"
-/&gt;
-</pre> 
- 
- 
-<a name="androidNetCustPlatAPNConfig"></a><h4>Build-time APN configuration</h4> 
- 
-<p>To set the APN configuration for a particular product target, add an <code>apns-conf.xml</code> file to the product configuration (do not modify the default platform APNs). This allows multiple products, all with different APNs, to be built off the same code base.  </p> 
- 
-<p>To configure APNs at the product level, add a line to the product configuration file like the example below (<code>vendor/&lt;vendor_name&gt;/products/myphone-us.mk</code>): </p> 
- 
-<pre class="prettify"> 
-PRODUCT_COPY_FILES := vendor/acme/etc/apns-conf-us.xml:system/etc/apns-conf.xml
-</pre> 
- 
- 
- 
-<a name="androidNetCustPlatAPNRunTime"></a><h4>APN configuration at run time</h4> 
- 
-<p>At runtime, the Android reads APNs from the following file:</p> 
-<pre class="prettify"> 
-system/etc/apns-conf.xml
-</pre> 
- 
-<p>Android supports the following run-time network configuration methods to choose the appropriate APN from the list of configured APNs:</p> 
-<p><ul> 
-<li><b>Automatic Configuration</b>: At boot time, Android determines the correct network configuration based on the MCC and MNC from the SIM card and automatically configure all network settings.</li> 
-<li><b>Manual Configuration</b>: The platform will also support runtime (user) manual selection of network settings by name, for example, "Company Name US," and will support manual network configuration entry.</li> 
-<li><b>WAP / SMS Push Configuration</b>: The network configurations are standard Android resources. You can upgrade a resource at runtime by installing a new system resource APK package. It will be possible to develop a network configuration service which listens to a specific binary SMS port for binary SMS messages containing the network configurations.  NOTE: The implementation will likely be network operator dependent due to inconsistent SMS ports, binary SMS formats, etc.</li> 
-</ul> 
- 
- 
- 
- 
-<a name="androidCustomizingPre-LoadedApps"></a><h3>Customizing pre-loaded applications</h3> 
- 
-<p>To customize the list of Android packages for a particular product (applications, input methods, providers, services, etc.), set <code>PRODUCT_PACKAGES</code> property in the product configuration, as illustrated below:</p> 
- 
-<pre class="prettify"> 
-PRODUCT_PACKAGES := \
- &lt;company_name&gt;Mail \
-    &lt;company_name&gt;IM \
- &lt;company_name&gt;HomeScreen \
- &lt;company_name&gt;Maps \
- &lt;company_name&gt;SystemUpdater
-</pre> 
- 
-<p>Package names should correspond to the <code>LOCAL_PACKAGE_NAME</code> specified for each package's build target. For example, the <code>Android.mk</code> build target for &lt;company_name&gt;Mail, referenced above, could look like this:
- 
-<pre class="prettify"> 
-# Build the &lt;company_name&gt;Mail application
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
- 
-LOCAL_MODULE_TAGS := user development
- 
-LOCAL_SRC_FILES := $(call all-java-files-under,src,tests)
- 
-LOCAL_STATIC_JAVA_LIBRARIES := &lt;company_name&gt;login-client
- 
-# Specify the package name
-LOCAL_PACKAGE_NAME := &lt;company_name&gt;Mail
- 
-# Specify the certificate used to sign the application
-LOCAL_CERTIFICATE := vendor/&lt;company_name&gt;/certs/app
- 
-include $(BUILD_PACKAGE)
- 
-# Build the login client static library
-include $(LOCAL_PATH)/client/Android.mk
-</pre> 
- 
-<p>Note that the home screen is just an Android application that can be replaced entirely or customized by changing source code and application resources (Java source, layouts, etc.).</p> 
- 
- 
- 
-<a name="androidBrowserBookmarks"></a><h3>Customizing browser bookmarks</h3> 
- 
-<p>Browser bookmarks are stored as string resources in the Browser application: <code>//android/packages/apps/Browser/res/values/strings.xml</code>.  Bookmarks are defined as simple value string arrays called &quot;bookmarks&quot;.  Each bookmark entry is stored as a pair of array values; the first represents the bookmark name and the second the bookmark URL.  For example:</p> 
-<pre class="prettify"> 
-&lt;!-- Bookmarks --&gt;
-&lt;string-array name=&quot;bookmarks&quot;&gt;
-    &lt;item&gt;Google&lt;/item&gt;
-    &lt;item&gt;http://www.google.com/&lt;/item&gt;
-    &lt;item&gt;Yahoo!&lt;/item&gt;
-    &lt;item&gt;http://www.yahoo.com/&lt;/item&gt;
-    &lt;item&gt;MSN&lt;/item&gt;
-    &lt;item&gt;http://www.msn.com/&lt;/item&gt;
-    &lt;item&gt;MySpace&lt;/item&gt;
-    &lt;item&gt;http://www.myspace.com/&lt;/item&gt;
-    &lt;item&gt;Facebook&lt;/item&gt;
-    &lt;item&gt;http://www.facebook.com/&lt;/item&gt;
-    &lt;item&gt;Wikipedia&lt;/item&gt;
-    &lt;item&gt;http://www.wikipedia.org/&lt;/item&gt;
-    &lt;item&gt;eBay&lt;/item&gt;
-    &lt;item&gt;http://www.ebay.com/&lt;/item&gt;
-    &lt;item&gt;CNN&lt;/item&gt;
-    &lt;item&gt;http://www.cnn.com/&lt;/item&gt;
-    &lt;item&gt;New York Times&lt;/item&gt;
-    &lt;item&gt;http://www.nytimes.com/&lt;/item&gt;
-    &lt;item&gt;ESPN&lt;/item&gt;
-    &lt;item&gt;http://espn.go.com/&lt;/item&gt;
-    &lt;item&gt;Amazon&lt;/item&gt;
-    &lt;item&gt;http://www.amazon.com/&lt;/item&gt;
-    &lt;item&gt;Weather Channel&lt;/item&gt;
-    &lt;item&gt;http://www.weather.com/&lt;/item&gt;
-    &lt;item&gt;BBC&lt;/item&gt;
-    &lt;item&gt;http://www.bbc.co.uk/&lt;/item&gt;
-&lt;/string-array&gt;
-</pre> 
-<p>Like and Android application resource, the platform will load alternate resources based on the platform configuration values.  See <a href="http://developer.android.com/guide/topics/resources/resources-i18n.html">Resources and Internationalization</a> in the Android SDK for details.  To configure bookmarks for a specific mobile network operator, place your customized bookmarks in a separate <code>strings.xml</code> file and place it under a Mobile Network Code (MNO) specific resource folder.  For example, <code>Browser/res/values-mccXXX-mncYYY/strings.xml</code> where XXX and YYY represent the three-digit MCC and two to three digit MNC values.</p> 
-<p>Android loads any configuration-specific resources as override values for the default values, so it is only necessary to include the bookmarks string-array values in this file.</p> 
- 
- 
- 
-<a name="androidEmailProviderCustomization"></a>
-<h3>Email Provider Customization</h3> 
- 
-<p>The default email provider settings are stored as string resources in the Email application (<code>//android/packages/apps/Email/res/xml/providers.xml</code>) as illustrated below.</p> 
-<p>&lt;providers&gt;</p> 
-<pre class="prettify"> 
-&lt;!-- Gmail variants --&gt;
-    &lt;provider id=&quot;gmail&quot; label=&quot;Gmail&quot; domain=&quot;gmail.com&quot;&gt;
-        &lt;incoming uri=&quot;imap+ssl+://imap.gmail.com&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+ssl+://smtp.gmail.com&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;googlemail&quot; label=&quot;Google Mail&quot; domain=&quot;googlemail.com&quot;&gt;
-        &lt;incoming uri=&quot;imap+ssl+://imap.googlemail.com&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+ssl+://smtp.googlemail.com&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;google&quot; label=&quot;Google&quot; domain=&quot;google.com&quot;&gt;
-        &lt;incoming uri=&quot;imap+ssl+://imap.gmail.com&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+ssl+://smtp.gmail.com&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;android&quot; label=&quot;Android&quot; domain=&quot;android.com&quot;&gt;
-        &lt;incoming uri=&quot;imap+ssl+://imap.gmail.com&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+ssl+://smtp.gmail.com&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;</p> 
- 
-    &lt;!-- Common US providers --&gt;
-    
-    &lt;provider id=&quot;aim&quot; label=&quot;AIM&quot; domain=&quot;aim.com&quot;&gt;
-        &lt;incoming uri=&quot;imap://imap.aim.com&quot; label=&quot;IMAP&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp://smtp.aim.com:587&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;aol&quot; label=&quot;AOL&quot; domain=&quot;aol.com&quot;&gt;
-        &lt;incoming uri=&quot;imap://imap.aol.com&quot; label=&quot;IMAP&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp://smtp.aol.com:587&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;comcast&quot; label=&quot;Comcast&quot; domain=&quot;comcast.net&quot;&gt;
-        &lt;incoming uri=&quot;pop3+ssl+://mail.comcast.net&quot; username=&quot;$user&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+ssl+://smtp.comcast.net&quot; username=&quot;$user&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;compuserve&quot; label=&quot;CompuServe&quot; domain=&quot;cs.com&quot;&gt;
-        &lt;incoming uri=&quot;imap://imap.cs.com&quot; username=&quot;$user&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp://smtp.cs.com&quot; username=&quot;$user&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;dotmac&quot; label=&quot;.Mac&quot; domain=&quot;mac.com&quot;&gt;
-        &lt;incoming uri=&quot;imap+tls://mail.mac.com&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+tls://smtp.mac.com&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;earthlink&quot; label=&quot;Earthlink&quot; domain=&quot;earthlink.net&quot;&gt;
-        &lt;incoming uri=&quot;pop3://pop.earthlink.net&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp://smtpauth.earthlink.net:587&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;juno&quot; label=&quot;Juno&quot; domain=&quot;juno.com&quot;&gt;
-        &lt;incoming uri=&quot;pop3://pop.juno.com&quot; username=&quot;$user&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp://smtp.juno.com&quot; username=&quot;$user&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;live&quot; label=&quot;Windows Live Hotmail Plus&quot; domain=&quot;live.com&quot; note=&quot;@string/provider_note_live&quot;&gt;
-        &lt;incoming uri=&quot;pop3+ssl+://pop3.live.com&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+tls+://smtp.live.com&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;hotmail&quot; label=&quot;Windows Live Hotmail Plus&quot; domain=&quot;hotmail.com&quot; note=&quot;@string/provider_note_live&quot;&gt;
-        &lt;incoming uri=&quot;pop3+ssl+://pop3.live.com&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+tls+://smtp.live.com&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;msn&quot; label=&quot;Windows Live Hotmail Plus&quot; domain=&quot;msn.com&quot; note=&quot;@string/provider_note_live&quot;&gt;
-        &lt;incoming uri=&quot;pop3+ssl+://pop3.live.com&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+tls+://smtp.live.com&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;mobileme&quot; label=&quot;MobileMe&quot; domain=&quot;me.com&quot;&gt;
-        &lt;incoming uri=&quot;imap+tls://mail.me.com&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+tls://smtp.me.com&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;netzero&quot; label=&quot;NetZero&quot; domain=&quot;netzero.com&quot;&gt;
-        &lt;incoming uri=&quot;pop3://pop.netzero.com&quot; username=&quot;$user&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp://smtp.netzero.com&quot; username=&quot;$user&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;sbcglobal&quot; label=&quot;SBC Global&quot; domain=&quot;sbcglobal.net&quot;&gt;
-        &lt;incoming uri=&quot;pop3://pop.sbcglobal.yahoo.com&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp://smtp.sbcglobal.yahoo.com&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;verizon&quot; label=&quot;Verizon&quot; domain=&quot;verizon.net&quot;&gt;
-        &lt;incoming uri=&quot;pop3://incoming.verizon.net&quot; username=&quot;$user&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp://outgoing.verizon.net&quot; username=&quot;$user&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;yahoo&quot; label=&quot;Yahoo Plus&quot; domain=&quot;yahoo.com&quot; note=&quot;@string/provider_note_yahoo&quot;&gt;
-        &lt;incoming uri=&quot;pop3+ssl+://plus.pop.mail.yahoo.com&quot; username=&quot;$user&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+ssl+://plus.smtp.mail.yahoo.com&quot; username=&quot;$user&quot;/&gt;
-    &lt;/provider&gt;
-  
-    &lt;!-- Common UK providers --&gt;
-    
-    &lt;provider id=&quot;aol-uk&quot; label=&quot;AOL&quot; domain=&quot;aol.co.uk&quot;&gt;
-        &lt;incoming uri=&quot;imap+ssl+://imap.uk.aol.com&quot; label=&quot;IMAP&quot; username=&quot;$user&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+ssl+://smtp.uk.aol.com&quot; username=&quot;$user&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;bt&quot; label=&quot;BT Internet&quot; domain=&quot;btinternet.com&quot;&gt;
-        &lt;incoming uri=&quot;pop3://mail.btinternet.com&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp://mail.btinternet.com&quot; username=&quot;&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;tiscali&quot; label=&quot;Tiscali&quot; domain=&quot;tiscali.co.uk&quot;&gt;
-        &lt;incoming uri=&quot;pop3://pop.tiscali.co.uk&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp://smtp.tiscali.co.uk&quot; username=&quot;$email:wq&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;yahoo-uk&quot; label=&quot;Yahoo&quot; domain=&quot;yahoo.co.uk&quot; note=&quot;@string/provider_note_yahoo_uk&quot;&gt;
-        &lt;incoming uri=&quot;pop3+ssl+://pop.mail.yahoo.co.uk&quot; username=&quot;$user&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+ssl+://smtp.mail.yahoo.co.uk&quot; username=&quot;$user&quot;/&gt;
-    &lt;/provider&gt;
-    
-    &lt;!-- Common Germany providers --&gt;
-    
-    &lt;provider id=&quot;freenet&quot; label=&quot;Freenet&quot; domain=&quot;freenet.de&quot;&gt;
-        &lt;incoming uri=&quot;pop3://mx.freenet.de&quot; username=&quot;$user&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+ssl://mx.freenet.de&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;gmx&quot; label=&quot;GMX&quot; domain=&quot;gmx.de&quot;&gt;
-        &lt;incoming uri=&quot;pop3+tls://pop.gmx.net&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+tls://mail.gmx.net&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;T-Online&quot; label=&quot;T-Online&quot; domain=&quot;t-online.de&quot; note=&quot;@string/provider_note_t_online&quot;&gt;
-        &lt;incoming uri=&quot;pop3://popmail.t-online.de&quot; username=&quot;$email&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp://smtpmail.t-online.de&quot; username=&quot;$email&quot;/&gt;
-    &lt;/provider&gt;
-    &lt;provider id=&quot;web.de&quot; label=&quot;Web.de&quot; domain=&quot;web.de&quot;&gt;
-        &lt;incoming uri=&quot;pop3+tls://pop3.web.de&quot; username=&quot;$user&quot;/&gt;
-        &lt;outgoing uri=&quot;smtp+tls://smtp.web.de&quot; username=&quot;$user&quot;/&gt;
-    &lt;/provider&gt;
-&lt;/providers&gt;
-</pre> 
-<p>As with all Android application resources, the platform will load alternate resources based on the platform configuration values.  See <a href="http://developer.android.com/guide/topics/resources/resources-i18n.html">Resources and Internationalization</a> in the Android SDK for details.  To configure email providers for a specific mobile network operator, place the customized providers in a separate <code>providers.xml</code> file and place it under  a Mobile Network Code (MNO) specific resource folder.  For example, <code>Email/res/xml-mccXXX-mncYYY/providers.xml</code> where XXX and YYY represent the three-digit MCC and two to three digit MNC values.</p> 
- 
- 
- 
-<a name="androidThemes"></a><h3>Platform Themes</h3> 
- 
- 
- 
-<a name="androidThemesStyles"></a><h4>Themes and Styles</h4> 
- 
-<p>System level styles are defined in <code>//android/framework/base/core/res/res/values/styles.xml</code>.</p> 
- 
- 
-<a name="androidThemesAnimations"></a><h4>Animations</h4> 
- 
-<p>Android supports configurable animations for window and view transitions.  System-level animations are defined in XML in global resource files located in <code>//android/framework/base/core/res/res/anim/</code>.</p> 
- 
diff --git a/pdk/docs/guide/dalvik.jd b/pdk/docs/guide/dalvik.jd
deleted file mode 100755
index 6fa37da..0000000
--- a/pdk/docs/guide/dalvik.jd
+++ /dev/null
@@ -1,355 +0,0 @@
-page.title=Dalvik
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#dalvikCoreLibraries">Core Libraries</a></li>
-<li><a href="#dalvikJNICallBridge">JNI Call Bridge</a></li>
-<li><a href="#dalvikInterpreter">Interpreter</a></li>
-</ul>
-</div>
-</div>
-
-<p> 
-The Dalvik virtual machine is intended to run on a variety of platforms.
-The baseline system is expected to be a variant of UNIX (Linux, BSD, Mac
-OS X) running the GNU C compiler.  Little-endian CPUs have been exercised
-the most heavily, but big-endian systems are explicitly supported.
-</p><p> 
-There are two general categories of work: porting to a Linux system
-with a previously unseen CPU architecture, and porting to a different
-operating system.  This document covers the former.
-</p>
- 
- 
-<a name="dalvikCoreLibraries"></a><h3>Core Libraries</h3> 
- 
-<p> 
-The native code in the core libraries (chiefly <code>dalvik/libcore</code>,
-but also <code>dalvik/vm/native</code>) is written in C/C++ and is expected
-to work without modification in a Linux environment.  Much of the code
-comes directly from the Apache Harmony project.
-</p><p> 
-The core libraries pull in code from many other projects, including
-OpenSSL, zlib, and ICU.  These will also need to be ported before the VM
-can be used.
-</p> 
- 
- 
-<a name="dalvikJNICallBridge"></a><h3>JNI Call Bridge</h3> 
- 
-<p> 
-Most of the Dalvik VM runtime is written in portable C.  The one
-non-portable component of the runtime is the JNI call bridge.  Simply put,
-this converts an array of integers into function arguments of various
-types, and calls a function.  This must be done according to the C calling
-conventions for the platform.  The task could be as simple as pushing all
-of the arguments onto the stack, or involve complex rules for register
-assignment and stack alignment.
-</p><p> 
-To ease porting to new platforms, the <a href="http://sourceware.org/libffi/"> 
-open-source FFI library</a> (Foreign Function Interface) is used when a
-custom bridge is unavailable.  FFI is not as fast as a native implementation,
-and the optional performance improvements it does offer are not used, so
-writing a replacement is a good first step.
-</p><p> 
-The code lives in <code>dalvik/vm/arch/*</code>, with the FFI-based version
-in the "generic" directory.  There are two source files for each architecture.
-One defines the call bridge itself:
-</p><p><blockquote> 
-<code>void dvmPlatformInvoke(void* pEnv, ClassObject* clazz, int argInfo,
-int argc, const u4* argv, const char* signature, void* func,
-JValue* pReturn)</code> 
-</blockquote></p><p> 
-This will invoke a C/C++ function declared:
-</p><p><blockquote> 
-    <code>return_type func(JNIEnv* pEnv, Object* this [, <i>args</i>])<br></code> 
-</blockquote>or (for a "static" method):<blockquote> 
-    <code>return_type func(JNIEnv* pEnv, ClassObject* clazz [, <i>args</i>])</code> 
-</blockquote></p><p> 
-The role of <code>dvmPlatformInvoke</code> is to convert the values in
-<code>argv</code> into C-style calling conventions, call the method, and
-then place the return type into <code>pReturn</code> (a union that holds
-all of the basic JNI types).  The code may use the method signature
-(a DEX "shorty" signature, with one character for the return type and one
-per argument) to determine how to handle the values.
-</p><p> 
-The other source file involved here defines a 32-bit "hint".  The hint
-is computed when the method's class is loaded, and passed in as the
-"argInfo" argument.  The hint can be used to avoid scanning the ASCII
-method signature for things like the return value, total argument size,
-or inter-argument 64-bit alignment restrictions.
-</p> 
- 
-<a name="dalvikInterpreter"></a><h3>Interpreter</h3> 
- 
-<p> 
-The Dalvik runtime includes two interpreters, labeled "portable" and "fast".
-The portable interpreter is largely contained within a single C function,
-and should compile on any system that supports gcc.  (If you don't have gcc,
-you may need to disable the "threaded" execution model, which relies on
-gcc's "goto table" implementation; look for the THREADED_INTERP define.)
-</p><p> 
-The fast interpreter uses hand-coded assembly fragments.  If none are
-available for the current architecture, the build system will create an
-interpreter out of C "stubs".  The resulting "all stubs" interpreter is
-quite a bit slower than the portable interpreter, making "fast" something
-of a misnomer.
-</p><p> 
-The fast interpreter is enabled by default.  On platforms without native
-support, you may want to switch to the portable interpreter.  This can
-be controlled with the <code>dalvik.vm.execution-mode</code> system
-property.  For example, if you:
-</p><p><blockquote> 
-<code>adb shell "echo dalvik.vm.execution-mode = int:portable >> /data/local.prop"</code> 
-</blockquote></p><p> 
-and reboot, the Android app framework will start the VM with the portable
-interpreter enabled.
-</p> 
- 
- 
-<h3>Mterp Interpreter Structure</h3> 
- 
-<p> 
-There may be significant performance advantages to rewriting the
-interpreter core in assembly language, using architecture-specific
-optimizations.  In Dalvik this can be done one instruction at a time.
-</p><p> 
-The simplest way to implement an interpreter is to have a large "switch"
-statement.  After each instruction is handled, the interpreter returns to
-the top of the loop, fetches the next instruction, and jumps to the
-appropriate label.
-</p><p> 
-An improvement on this is called "threaded" execution.  The instruction
-fetch and dispatch are included at the end of every instruction handler.
-This makes the interpreter a little larger overall, but you get to avoid
-the (potentially expensive) branch back to the top of the switch statement.
-</p><p> 
-Dalvik mterp goes one step further, using a computed goto instead of a goto
-table.  Instead of looking up the address in a table, which requires an
-extra memory fetch on every instruction, mterp multiplies the opcode number
-by a fixed value.  By default, each handler is allowed 64 bytes of space.
-</p><p> 
-Not all handlers fit in 64 bytes.  Those that don't can have subroutines
-or simply continue on to additional code outside the basic space.  Some of
-this is handled automatically by Dalvik, but there's no portable way to detect
-overflow of a 64-byte handler until the VM starts executing.
-</p><p> 
-The choice of 64 bytes is somewhat arbitrary, but has worked out well for
-ARM and x86.
-</p><p> 
-In the course of development it's useful to have C and assembly
-implementations of each handler, and be able to flip back and forth
-between them when hunting problems down.  In mterp this is relatively
-straightforward.  You can always see the files being fed to the compiler
-and assembler for your platform by looking in the
-<code>dalvik/vm/mterp/out</code> directory.
-</p><p> 
-The interpreter sources live in <code>dalvik/vm/mterp</code>.  If you
-haven't yet, you should read <code>dalvik/vm/mterp/README.txt</code> now.
-</p> 
- 
- 
-<h3>Getting Started With Mterp</h3> 
- 
-</p><p> 
-Getting started:
-<ol> 
-<li>Decide on the name of your architecture.  For the sake of discussion,
-let's call it <code>myarch</code>.
-<li>Make a copy of <code>dalvik/vm/mterp/config-allstubs</code> to
-<code>dalvik/vm/mterp/config-myarch</code>.
-<li>Create a <code>dalvik/vm/mterp/myarch</code> directory to hold your
-source files.
-<li>Add <code>myarch</code> to the list in
-<code>dalvik/vm/mterp/rebuild.sh</code>.
-<li>Make sure <code>dalvik/vm/Android.mk</code> will find the files for
-your architecture.  If <code>$(TARGET_ARCH)</code> is configured this
-will happen automatically.
-</ol> 
-</p><p> 
-You now have the basic framework in place.  Whenever you make a change, you
-need to perform two steps: regenerate the mterp output, and build the
-core VM library.  (It's two steps because we didn't want the build system
-to require Python 2.5.  Which, incidentally, you need to have.)
-<ol> 
-<li>In the <code>dalvik/vm/mterp</code> directory, regenerate the contents
-of the files in <code>dalvik/vm/mterp/out</code> by executing
-<code>./rebuild.sh</code>.  Note there are two files, one in C and one
-in assembly.
-<li>In the <code>dalvik</code> directory, regenerate the
-<code>libdvm.so</code> library with <code>mm</code>.  You can also use
-<code>make libdvm</code> from the top of the tree.
-</ol> 
-</p><p> 
-This will leave you with an updated libdvm.so, which can be pushed out to
-a device with <code>adb sync</code> or <code>adb push</code>.  If you're
-using the emulator, you need to add <code>make snod</code> (System image,
-NO Dependency check) to rebuild the system image file.  You should not
-need to do a top-level "make" and rebuild the dependent binaries.
-</p><p> 
-At this point you have an "all stubs" interpreter.  You can see how it
-works by examining <code>dalvik/vm/mterp/cstubs/entry.c</code>.  The
-code runs in a loop, pulling out the next opcode, and invoking the
-handler through a function pointer.  Each handler takes a "glue" argument
-that contains all of the useful state.
-</p><p> 
-Your goal is to replace the entry method, exit method, and each individual
-instruction with custom implementations.  The first thing you need to do
-is create an entry function that calls the handler for the first instruction.
-After that, the instructions chain together, so you don't need a loop.
-(Look at the ARM or x86 implementation to see how they work.)
-</p><p> 
-Once you have that, you need something to jump to.  You can't branch
-directly to the C stub because it's expecting to be called with a "glue"
-argument and then return.  We need a C stub "wrapper" that does the
-setup and jumps directly to the next handler.  We write this in assembly
-and then add it to the config file definition.
-</p><p> 
-To see how this works, create a file called
-<code>dalvik/vm/mterp/myarch/stub.S</code> that contains one line:
-<pre> 
-/* stub for ${opcode} */
-</pre> 
-Then, in <code>dalvik/vm/mterp/config-myarch</code>, add this below the
-<code>handler-size</code> directive:
-<pre> 
-# source for the instruction table stub
-asm-stub myarch/stub.S
-</pre> 
-</p><p> 
-Regenerate the sources with <code>./rebuild.sh</code>, and take a look
-inside <code>dalvik/vm/mterp/out/InterpAsm-myarch.S</code>.  You should
-see 256 copies of the stub function in a single large block after the
-<code>dvmAsmInstructionStart</code> label.  The <code>stub.S</code> 
-code will be used anywhere you don't provide an assembly implementation.
-</p><p> 
-Note that each block begins with a <code>.balign 64</code> directive.
-This is what pads each handler out to 64 bytes.  Note also that the
-<code>${opcode}</code> text changed into an opcode name, which should
-be used to call the C implementation (<code>dvmMterp_${opcode}</code>).
-</p><p> 
-The actual contents of <code>stub.S</code> are up to you to define.
-See <code>entry.S</code> and <code>stub.S</code> in the <code>armv5te</code> 
-or <code>x86</code> directories for working examples.
-</p><p> 
-If you're working on a variation of an existing architecture, you may be
-able to use most of the existing code and just provide replacements for
-a few instructions.  Look at the <code>armv4t</code> implementation as
-an example.
-</p> 
- 
- 
-<h3>Replacing Stubs</h3> 
- 
-<p> 
-There are roughly 230 Dalvik opcodes, including some that are inserted by
-<a href="dexopt.html">dexopt</a> and aren't described in the
-<a href="dalvik-bytecode.html">Dalvik bytecode</a> documentation.  Each
-one must perform the appropriate actions, fetch the next opcode, and
-branch to the next handler.  The actions performed by the assembly version
-must exactly match those performed by the C version (in
-<code>dalvik/vm/mterp/c/OP_*</code>).
-</p><p> 
-It is possible to customize the set of "optimized" instructions for your
-platform.  This is possible because optimized DEX files are not expected
-to work on multiple devices.  Adding, removing, or redefining instructions
-is beyond the scope of this document, and for simplicity it's best to stick
-with the basic set defined by the portable interpreter.
-</p><p> 
-Once you have written a handler that looks like it should work, add
-it to the config file.  For example, suppose we have a working version
-of <code>OP_NOP</code>.  For demonstration purposes, fake it for now by
-putting this into <code>dalvik/vm/mterp/myarch/OP_NOP.S</code>:
-<pre> 
-/* This is my NOP handler */
-</pre> 
-</p><p> 
-Then, in the <code>op-start</code> section of <code>config-myarch</code>, add:
-<pre> 
-    op OP_NOP myarch
-</pre> 
-</p><p> 
-This tells the generation script to use the assembly version from the
-<code>myarch</code> directory instead of the C version from the <code>c</code> 
-directory.
-</p><p> 
-Execute <code>./rebuild.sh</code>.  Look at <code>InterpAsm-myarch.S</code> 
-and <code>InterpC-myarch.c</code> in the <code>out</code> directory.  You
-will see that the <code>OP_NOP</code> stub wrapper has been replaced with our
-new code in the assembly file, and the C stub implementation is no longer
-included.
-</p><p> 
-As you implement instructions, the C version and corresponding stub wrapper
-will disappear from the output files.  Eventually you will have a 100%
-assembly interpreter.
-</p> 
- 
- 
-<h3>Interpreter Switching</h3> 
- 
-<p> 
-The Dalvik VM actually includes a third interpreter implementation: the debug
-interpreter.  This is a variation of the portable interpreter that includes
-support for debugging and profiling.
-</p><p> 
-When a debugger attaches, or a profiling feature is enabled, the VM
-will switch interpreters at a convenient point.  This is done at the
-same time as the GC safe point check: on a backward branch, a method
-return, or an exception throw.  Similarly, when the debugger detaches
-or profiling is discontinued, execution transfers back to the "fast" or
-"portable" interpreter.
-</p><p> 
-Your entry function needs to test the "entryPoint" value in the "glue"
-pointer to determine where execution should begin.  Your exit function
-will need to return a boolean that indicates whether the interpreter is
-exiting (because we reached the "bottom" of a thread stack) or wants to
-switch to the other implementation.
-</p><p> 
-See the <code>entry.S</code> file in <code>x86</code> or <code>armv5te</code> 
-for examples.
-</p> 
- 
- 
-<h3>Testing</h3> 
- 
-<p> 
-A number of VM tests can be found in <code>dalvik/tests</code>.  The most
-useful during interpreter development is <code>003-omnibus-opcodes</code>,
-which tests many different instructions.
-</p><p> 
-The basic invocation is:
-<pre> 
-$ cd dalvik/tests
-$ ./run-test 003
-</pre> 
-</p><p> 
-This will run test 003 on an attached device or emulator.  You can run
-the test against your desktop VM by specifying <code>--reference</code> 
-if you suspect the test may be faulty.  You can also use
-<code>--portable</code> and <code>--fast</code> to explictly specify
-one Dalvik interpreter or the other.
-</p><p> 
-Some instructions are replaced by <code>dexopt</code>, notably when
-"quickening" field accesses and method invocations.  To ensure
-that you are testing the basic form of the instruction, add the
-<code>--no-optimize</code> option.
-</p><p> 
-There is no in-built instruction tracing mechanism.  If you want
-to know for sure that your implementation of an opcode handler
-is being used, the easiest approach is to insert a "printf"
-call.  For an example, look at <code>common_squeak</code> in
-<code>dalvik/vm/mterp/armv5te/footer.S</code>.
-</p><p> 
-At some point you need to ensure that debuggers and profiling work with
-your interpreter.  The easiest way to do this is to simply connect a
-debugger or toggle profiling.  (A future test suite may include some
-tests for this.)
-</p> 
-
-
diff --git a/pdk/docs/guide/debugging_gdb.jd b/pdk/docs/guide/debugging_gdb.jd
deleted file mode 100755
index f2a2db5..0000000
--- a/pdk/docs/guide/debugging_gdb.jd
+++ /dev/null
@@ -1,146 +0,0 @@
-page.title=Debugging with GDB
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#gdb">Debugging</a></li>
-  <li><a href="#justInTime">Just-In-Time Debug Feature</a></li>
-</ul>
-</div>
-</div>
-
-<p>The current version of <code>envsetup.sh</code> has a <code>gdbclient</code> command that handles much of the setup.  For example, to attach the
-  already-running <code>globaltime</code> application, execute the following, making sure that: 1) you do this from the same window used to build the software on the device you are debugging and 2) verify that the symbols in the object files in the build tree match up with what is installed on the device or emulator.</p>
-<pre class="prettify">
-gdbclient app_process :5039 globaltime
-</pre>
-<a name="gdb"></a><h3>Debugging</h3>
-<a name="gdbShort"></a>
-<h4>Short Instructions</h4>
-<p>Android runs <code>gdbserver</code> on the device and an ARM aware <code>gdb</code>, named <code>arm-eabi-gdb</code>, on the desktop machine.</p>
-<ol>
-  <li>First you need to
-    run <code>gdbserver</code> on the device:<BR>
-    <pre class="prettify">
-	gdbserver :5039 /system/bin/<i>executable</i>       
-  </pre>
-    <BR>
-    The <code>:5039</code> tells gdbserver to listen on port 5039 on the localhost, which adb bridges from the host to the device. <code>executable</code> represents the command to debug, a common one being runtime -s which starts the entire system all running in a single process. <br>
-    <br>
-  </li>
-  <li>Launch <code>gdb</code> on the desktop.
-    This can be
-    done easily with the following command in the shell from which you built:
-    <pre class="prettify">
-gdbclient <i>executable</i>
-</pre>
-  </li>
-</ol>
-<p>At this point <code>gdb</code> will connect with your device
-  and you should be
-  able to enter <code>c</code> to have the device start executing inside of the
-  desktop <code>gdb</code> session.</p>
-<a name="gdbDetailed"></a>
-<h4>Detailed Instructions</h4>
-<p>If the short instructions don't work, these detailed instructions should:
-<ol>
-  <li>On the device, launch a new command:
-    <pre class="prettify">gdbserver :5039 /system/bin/<i>executable</i></pre>
-    or attach to an existing process:
-    <pre class="prettify">gdbserver :5039 --attach <i>pid</i></pre>
-  </li>
-  <li>On your workstation, forward port 5039 to the device with adb:
-    <pre class="prettify">adb forward tcp:5039 tcp:5039</pre>
-  </li>
-  <li>Start a special version of <code>gdb</code> that lives in the "prebuilt" area of the source tree: <br>
-    <code>prebuilt/Linux/toolchain-eabi-4.2.1/bin/arm-eabi-gdb</code> (for Linux) <br>
-    <code>prebuilt/darwin-x86/toolchain-eabi-4.2.1/bin/arm-eabi-gdb</code> (for Darwin) </li>
-  <li>If you can't find either special version of <code>gdb</code>, run <code>find prebuilt -name arm-eabi-gdb</code> in your source tree to find and run the latest version:
-    <pre class="prettify">
-prebuilt/Linux/toolchain-eabi-4.2.1/bin/arm-eabi-gdb  out/target/product/<i>product-name</i>/symbols/system/bin/<i>executable</i>
-</pre>
-    <BR>
-    Where <i>product-name</i> is the name of the device product that you're building (for example, <code>sooner</code>),
-    and <i>executable</i> is the program to debug (usually <code>app_process</code> for an application).<br>
-    <br>
-    Make sure to use the copy of the executable in the symbols directory, not the
-    primary android directory, because the one in the primary directory has
-    been stripped of its debugging information.</li>
-  <li>In <code>gdb</code>, Tell <code>gdb</code> where to find the shared libraries that will get loaded:
-    <pre class="prettify">
-set solib-absolute-prefix /<i>absolute-source-path</i>/out/target/product/<i>product-name</i>/symbols
-set solib-search-path /<i>absolute-source-path</i>/out/target/product/<i>product-name</i>/symbols/system/lib
-</pre>
-    <BR>
-    <i>absolute-source-path</i> is the path to your source tree; for example, <code>/work/device</code> or <code>/Users/hoser/android/device</code>.<BR>
-    <i>product-name</i> is the same as above; for example, <code>sooner</code>. <BR>
-    <BR>
-    Make sure you specify the correct directories&#151;<code>gdb</code> may not tell you if you make a mistake.</li>
-  <li>Connect to the device by issuing the <code>gdb</code> command:<BR>
-    <pre class="prettify">
-target remote :5039
-</pre>
-    <BR>
-    <BR>
-    The <code>:5039</code> tells <code>gdb</code> to connect to the localhost port 5039, which is bridged to the device by <code>adb</code>.<BR>
-    <BR>
-    You may need to inspire gdb to load some symbols by typing:
-    <pre class="prettify">shared</pre>
-  </li>
-</ol>
-<p>You should be connected and able to debug as you normally would. You can ignore the error about not 
-  finding the location for the thread creation breakpoint. It will be found when
-  the linker loads <code>libc</code> into your process before hitting <code>main()</code>. Also note that
-  the <code>gdb</code> remote protocol doesn't have a way for the device to
-  tell the host about
-  newly created threads so you will not always see notifications about newly
-  created threads. Info about other threads will be queried from the
-  device when a
-  breakpoint is hit or you ask for it by running info thread. <a name="justInTime"></a>
-<h3>Just-In-Time Debug Feature</h3>
-If you see the red LED flashing it means a process is in that new
-state (crashed and waiting for GDB connection). If this happens to the
-system process, most likely your device will be frozen at this point. <strong>Do not press the home key</strong>. Bring the device to someone who can
-debug native crashes and ask for advice.
-If you're in the field and just want your device to continue as it
-would have without this feature (like cylonning), press home (a
-tombstone will be recorded as usual).
-
-To enable a process to be debugged this way, you need to set a property:
-<pre class="prettify">
-adb shell setprop debug.db.uid 10000
-</pre>
-and all processes with a <code>uid &lt;= 10000</code> will be trapped in this 
-manner.  When one of them crashes, the tombstone is processed as usual, an explicit message is printed into the log, and the red LED starts
-flashing waiting for the Home key to be depressed (in which case it
-continues execution as usual).
-<pre class="prettify">
-I/DEBUG   (   27): ********************************************************
-I/DEBUG   (   27): * process 82 crashed. debuggerd waiting for gdbserver
-I/DEBUG   (   27): *
-I/DEBUG   (   27): *     adb shell gdbserver :port --attach 82 &
-I/DEBUG   (   27): *
-I/DEBUG   (   27): * and press the HOME key.
-I/DEBUG   (   27): ********************************************************
-</pre>
-<p>When you see the entry above, make sure <code>adb</code> is forwarding port 5039 (you only need to do this once,
-  unless the ADB server dies) and execute:</p>
-<pre class="prettify">% adb forward tcp:5039 tcp:5039</pre>
-Execute the line shown in the debug output, substituting 5039  for the proper <code>port</code>:
-<pre class="prettify">
-% adb shell gdbserver :5039 --attach 82 &
-</pre>
-<p>If the crashing process is based off zygote (that is, system_server and all
-  applications), the default values for the <code>gdbclient</code> command, <code>app_process</code> binary and port <code>5039</code>, are correct, so you can execute:</p>
-<pre class="prettify">
-% cd &lt;top of device source tree&gt;
-% gdbclient
-</pre>
-<p>Otherwise you need to determine the path of the crashing binary and follow the
-  steps as mentioned above (for example, <code>gdbclient hoser :5039</code> if
-  the <code>hoser</code> command has failed).</p>
diff --git a/pdk/docs/guide/debugging_native.jd b/pdk/docs/guide/debugging_native.jd
deleted file mode 100755
index 0f8b397..0000000
--- a/pdk/docs/guide/debugging_native.jd
+++ /dev/null
@@ -1,305 +0,0 @@
-page.title=Debugging Native Code
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#Capturing_logs">Capturing logs</a></li>
-<li><a href="#Debug_Scenarios">Debug Scenarios</a></li>
-</ul>
-</div>
-</div>
-
-<a name="Capturing_logs"></a><h3>Capturing logs</h3>
-
-<p>To capture log output:</p>
-<ol>
-<li> Produce a process list with <code>ps</code>   (<code>ps -t</code> if you want verbose thread feedback).</li>
-<li> Dump kernel messages with <code>dmesg</code>.</li>
-<li> Get verbose log messages with <code>logcat '*:v' &amp;</code>   (running in bg with &amp; is important).</li>
-
-</ol>
-
-<a name="Debug_Scenarios"></a><h3>Debug Scenarios</h3>
-<pre class="prettify">
-  # command to device shell (via adb)
-  % command to host pc shell
-</pre>
-<p>
-</p>
-
-<a name="Crash_but_no_exit_stuck"></a><h4>Crash but no exit...stuck</h4>
-
-<p>In this scenario, the GTalk app crashed but did not actually exit or seems stuck. Check the debug logs to see if there is anything unusual: </p>
-
-<pre class="prettify">
-# logcat &amp;
-
-...
-E/WindowManager(  182): Window client android.util.BinderProxy@4089f948 has died!!  Removing window.
-W/WindowManager(  182): **** WINDOW CLIENT android.view.WindowProxy@40882248 DIED!
-W/ActivityManager(  182): **** APPLICATION com.google.android.gtalk DIED!
-I/ServiceManager(  257): Executing: /android/bin/app_process (link=/tmp/android-servicemanager/com.google.android.gtalk, wrapper=/tmp/android-servi
-cemanager/com.google.android.gtalk)
-I/appproc (  257): App process is starting with pid=257, class=android/activity/ActivityThread.
-I/        (  257): java.io.FileDescriptor: class initialization
-I/SurfaceFlinger.HW(  182): About to give-up screen
-I/SurfaceFlinger.HW(  182): screen given-up
-I/SurfaceFlinger.HW(  182): Screen about to return
-I/SurfaceFlinger.HW(  182): screen returned
-I/SurfaceFlinger.HW(  182): About to give-up screen
-I/SurfaceFlinger.HW(  182): screen given-up
-I/SurfaceFlinger.HW(  182): Screen about to return
-...
-</pre>
-
-<p>
-The logs indicate that the system launched a replacement GTalk process but that it got stuck somehow:
-</p>
-
-<pre class="prettify">
-# ps
-PID   PPID  VSIZE RSS   WCHAN    PC         NAME
-257   181   45780 5292  ffffffff 53030cb4 S com.google.andr
-</pre>
-
-<p>
-GTalk's PC is at 53030cb4. Look at the memory map to find out what lib is 0x53......
-</p>
-
-<pre class="prettify">
-# cat /proc/257/maps
-...
-51000000-5107c000 rwxp 00000000 1f:03 619        /android/lib/libutils.so
-52000000-52013000 rwxp 00000000 1f:03 639        /android/lib/libz.so
-53000000-53039000 rwxp 00000000 1f:03 668        /android/lib/libc.so
-53039000-53042000 rw-p 53039000 00:00 0
-54000000-54002000 rwxp 00000000 1f:03 658        /android/lib/libstdc++.so
-...
-</pre>
-
-<p>
-Disassemble <code>libc</code> to figure out what is going on:
-</p>
-
-<pre class="prettify">
-% prebuilt/Linux/toolchain-eabi-4.2.1/bin/arm-elf-objdump -d out/target/product/sooner/symbols/android/lib/libc.so
-
-00030ca4 &lt;__futex_wait&gt;:
-  30ca4:       e1a03002        mov     r3, r2
-  30ca8:       e1a02001        mov     r2, r1
-  30cac:       e3a01000        mov     r1, #0  ; 0x0
-  30cb0:       ef9000f0        swi     0x009000f0
-  30cb4:       e12fff1e        bx      lr
-</pre>
-
-<a name="Blocked_in_a_syscall"></a><h4>Blocked in a syscall</h4>
-
-<p>
-In this scenario, the system is blocked in a syscall. To debug using <code>gdb</code>, first tell <code>adb</code> to forward the <code>gdb</code> port:
-</p>
-
-<pre class="prettify">
-
-% adb forward tcp:5039 tcp:5039
-</pre>
-
-<p>
-Start the <code>gdb</code> server and attach to process 257 (as demonstrated in the previous example):
-</p>
-
-<pre class="prettify">
-# gdbserver :5039 --attach 257 &amp;
-Attached; pid = 257
-Listening on port 5039
-
-% prebuilt/Linux/toolchain-eabi-4.2.1/bin/arm-elf-gdb out/target/product/sooner/system/bin/app_process
-(gdb) set solib-absolute-prefix /work/android/device/out/target/product/sooner/symbols
-(gdb) set solib-search-path /work/android/device/out/target/product/sooner/symbols/android/lib
-(gdb) target remote :5039
-Remote debugging using :5039
-0x53030cb4 in ?? ()
-Current language:  auto; currently asm
-</pre>
-
-<p>
-Don't let other threads get scheduled while we're debugging.
-You should "set scheduler-locking off" before issuing a "continue", or else your thread may get stuck on a futex or other
-spinlock because no other thread can release it.
-</p>
-
-<pre class="prettify">
-(gdb) set scheduler-locking on
-</pre>
-
-<p>
-Ignore SIGUSR1 if you're using JamVM.  Shouldn't hurt if you're not.
-</p>
-
-<pre class="prettify">
-(gdb) handle SIGUSR1 noprint
-
-(gdb) where
-#0  __futex_wait () at system/klibc/android/atomics_arm.S:88
-#1  0x53010eb8 in pthread_cond_timedwait (cond=0x12081c, mutex=0x120818, abstime=0xffffffff)
-   at system/klibc/android/pthread.c:490
-#2  0x6b01c848 in monitorWait (mon=0x120818, self=0x6b039ba4, ms=0, ns=0) at extlibs/jamvm-1.4.1/src/lock.c:194
-#3  0x6b01d1d8 in objectWait (obj=0x408091c0, ms=0, ns=0) at extlibs/jamvm-1.4.1/src/lock.c:420
-#4  0x6b01d4c8 in jamWait (clazz=0xfffffffc, mb=0x0, ostack=0x2e188) at extlibs/jamvm-1.4.1/src/natives.c:91
-#5  0x6b013b2c in resolveNativeWrapper (clazz=0x408001d0, mb=0x41798, ostack=0x2e188) at extlibs/jamvm-1.4.1/src/dll.c:236
-#6  0x6b015c04 in executeJava () at extlibs/jamvm-1.4.1/src/interp.c:2614
-#7  0x6b01471c in executeMethodVaList (ob=0x0, clazz=0x40808f20, mb=0x12563c, jargs=0xbe9229f4)
-   at extlibs/jamvm-1.4.1/src/execute.c:91
-#8  0x6b01bcd0 in Jam_CallStaticVoidMethod (env=0xfffffffc, klass=0x0, methodID=0x12563c)
-   at extlibs/jamvm-1.4.1/src/jni.c:1063
-#9  0x58025b2c in android::AndroidRuntime::callStatic (this=0xfffffffc,
-   className=0xbe922f0a "android/activity/ActivityThread", methodName=0x57000b7c "main")
-   at libs/android_runtime/AndroidRuntime.cpp:215
-#10 0x57000504 in android::app_init (className=0xbe922f0a "android/activity/ActivityThread")
-   at servers/app/library/app_init.cpp:20
-#11 0x000089b0 in android::sp&lt;android::ProcessState&gt;::~sp ()
-#12 0x000089b0 in android::sp&lt;android::ProcessState&gt;::~sp ()
-Previous frame identical to this frame (corrupt stack?)
-
-(gdb) info threads
- 7 thread 263  __ioctl () at system/klibc/syscalls/__ioctl.S:12
- 6 thread 262  accept () at system/klibc/syscalls/accept.S:12
- 5 thread 261  __futex_wait () at system/klibc/android/atomics_arm.S:88
- 4 thread 260  __futex_wait () at system/klibc/android/atomics_arm.S:88
- 3 thread 259  __futex_wait () at system/klibc/android/atomics_arm.S:88
- 2 thread 258  __sigsuspend () at system/klibc/syscalls/__sigsuspend.S:12
- 1 thread 257  __futex_wait () at system/klibc/android/atomics_arm.S:88
-
-
-(gdb) thread 7
-[Switching to thread 7 (thread 263)]#0  __ioctl () at system/klibc/syscalls/__ioctl.S:12
-12          movs    r0, r0
-(gdb) bt
-#0  __ioctl () at system/klibc/syscalls/__ioctl.S:12
-#1  0x53010704 in ioctl (fd=-512, request=-1072143871) at system/klibc/android/ioctl.c:22
-#2  0x51040ac0 in android::IPCThreadState::talkWithDriver (this=0x1207b8, doReceive=true) at RefBase.h:83
-#3  0x510418a0 in android::IPCThreadState::joinThreadPool (this=0x1207b8, isMain=false)
-   at libs/utils/IPCThreadState.cpp:343
-#4  0x51046004 in android::PoolThread::threadLoop (this=0xfffffe00) at libs/utils/ProcessState.cpp:52
-#5  0x51036428 in android::Thread::_threadLoop (user=0xfffffe00) at libs/utils/Threads.cpp:1100
-#6  0x58025c68 in android::AndroidRuntime::javaThreadShell (args=0x105ffe28) at libs/android_runtime/AndroidRuntime.cpp:540
-
-(gdb) thread 6
-[Switching to thread 6 (thread 262)]#0  accept () at system/klibc/syscalls/accept.S:12
-12          movs    r0, r0
-(gdb) bt
-#0  accept () at system/klibc/syscalls/accept.S:12
-#1  0x6b0334e4 in jdwpAcceptConnection (state=0xfffffe00) at extlibs/jamvm-1.4.1/jdwp/JdwpNet.c:213
-#2  0x6b032660 in jdwpThreadEntry (self=0x4d020) at extlibs/jamvm-1.4.1/jdwp/JdwpMain.c:37
-#3  0x6b022c2c in shell (args=0x4d960) at extlibs/jamvm-1.4.1/src/thread.c:629
-
-(gdb) thread 5
-[Switching to thread 5 (thread 261)]#0  __futex_wait () at system/klibc/android/atomics_arm.S:88
-88              bx              lr
-(gdb) bt
-#0  __futex_wait () at system/klibc/android/atomics_arm.S:88
-#1  0x53010f48 in pthread_cond_timeout (cond=0x6b039b64, mutex=0x6b039b60, msecs=0) at system/klibc/android/pthread.c:513
-#2  0x6b01c8d0 in monitorWait (mon=0x6b039b60, self=0x4d400, ms=1000, ns=272629312) at extlibs/jamvm-1.4.1/src/lock.c:183
-#3  0x6b022084 in threadSleep (thread=0x4d400, ms=1000, ns=272629312) at extlibs/jamvm-1.4.1/src/thread.c:215
-#4  0x6b00d4fc in asyncGCThreadLoop (self=0x4d400) at extlibs/jamvm-1.4.1/src/alloc.c:1179
-#5  0x6b022c2c in shell (args=0x4d480) at extlibs/jamvm-1.4.1/src/thread.c:629
-
-(gdb) thread 4
-[Switching to thread 4 (thread 260)]#0  __futex_wait () at system/klibc/android/atomics_arm.S:88
-88              bx              lr
-(gdb) bt
-#0  __futex_wait () at system/klibc/android/atomics_arm.S:88
-#1  0x53010eb8 in pthread_cond_timedwait (cond=0x6b039934, mutex=0x6b039930, abstime=0x0)
-   at system/klibc/android/pthread.c:490
-#2  0x6b00b3ec in referenceHandlerThreadLoop (self=0x4d360) at extlibs/jamvm-1.4.1/src/alloc.c:1247
-#3  0x6b022c2c in shell (args=0x4d960) at extlibs/jamvm-1.4.1/src/thread.c:629
-
-(gdb) thread 3
-[Switching to thread 3 (thread 259)]#0  __futex_wait () at system/klibc/android/atomics_arm.S:88
-88              bx              lr
-(gdb) bt
-#0  __futex_wait () at system/klibc/android/atomics_arm.S:88
-#1  0x53010eb8 in pthread_cond_timedwait (cond=0x6b03992c, mutex=0x6b039928, abstime=0x0)
-   at system/klibc/android/pthread.c:490
-#2  0x6b00b1dc in finalizerThreadLoop (self=0x4d8e0) at extlibs/jamvm-1.4.1/src/alloc.c:1238
-#3  0x6b022c2c in shell (args=0x4d960) at extlibs/jamvm-1.4.1/src/thread.c:629
-
-(gdb) thread 2
-[Switching to thread 2 (thread 258)]#0  __sigsuspend () at system/klibc/syscalls/__sigsuspend.S:12
-12          movs    r0, r0
-(gdb) bt
-#0  __sigsuspend () at system/klibc/syscalls/__sigsuspend.S:12
-#1  0x6b023814 in dumpThreadsLoop (self=0x51b98) at extlibs/jamvm-1.4.1/src/thread.c:1107
-#2  0x6b022c2c in shell (args=0x51b58) at extlibs/jamvm-1.4.1/src/thread.c:629
-</pre>
-
-<a name="Crash_in_C_C_code"></a><h4>Crash in C / C++ code</h4>
-<p>If it crashes, connect with <code>aproto</code> and run <code>logcat</code> on the device. You should see output like this:</p>
-
-<pre class="prettify">
-I/ActivityManager(  188): Starting activity: Intent { component=com.android.calendar.MonthScreen }
-I/ActivityManager(  188): Starting application com.android.calendar to host activity com.android.calendar.MonthScree
-n
-I/ServiceManager(  417): Executing: /android/bin/app_process (link=/android/bin/app_process, wrapper=/android/bin/app_process)
-I/DEBUG: -- observer of pid 417 starting --
-I/appproc (  417): App process is starting with pid=417, class=android/activity/ActivityThread.
-I/DEBUG: -- observer of pid 417 exiting --
-I/DEBUG: -- observer of pid 420 starting --
-I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
-I/DEBUG: pid: 373, tid: 401  &gt;&gt;&gt; android.content.providers.pim &lt;&lt;&lt;
-I/DEBUG: signal 11 (SIGSEGV), fault addr 00000000
-I/DEBUG:  r0 ffffffff  r1 00000000  r2 00000454  r3 002136d4
-I/DEBUG:  r4 002136c0  r5 40804810  r6 0022dc70  r7 00000010
-I/DEBUG:  r8 0020a258  r9 00000014  10 6b039074  fp 109ffcf8
-I/DEBUG:  ip 6b039e90  sp 109ffc0c  lr 580239f0  pc 6b0156a0
-I/DEBUG:          #01  pc 6b0156a0  /android/lib/libjamvm.so
-I/DEBUG:          #01  lr 580239f0  /android/lib/libandroid_runtime.so
-I/DEBUG:          #02  pc 6b01481c  /android/lib/libjamvm.so
-I/DEBUG:          #03  pc 6b0148a4  /android/lib/libjamvm.so
-I/DEBUG:          #04  pc 6b00ebc0  /android/lib/libjamvm.so
-I/DEBUG:          #05  pc 6b02166c  /android/lib/libjamvm.so
-I/DEBUG:          #06  pc 6b01657c  /android/lib/libjamvm.so
-I/DEBUG:          #07  pc 6b01481c  /android/lib/libjamvm.so
-I/DEBUG:          #08  pc 6b0148a4  /android/lib/libjamvm.so
-I/DEBUG:          #09  pc 6b0235c0  /android/lib/libjamvm.so
-I/DEBUG:          #10  pc 5300fac4  /android/lib/libc.so
-I/DEBUG:          #11  pc 5300fc5c  /android/lib/libc.so
-I/DEBUG: -- observer of pid 373 exiting --
-I/DEBUG: -- observer of pid 423 starting --
-</pre>
-
-<p>If debugging output indicates an error in C or C++ code, the addresses aren't particularly useful, but the debugging symbols aren't present on the device.  Use the "stack" tool to convert these addresses to files and line numbers, for example:</p>
-
-<pre class="prettify"> 
-pid: 373, tid: 401  &gt;&gt;&gt; android.content.providers.pim &lt;&lt;&lt;
-
- signal 11 (SIGSEGV), fault addr 00000000
-  r0 ffffffff  r1 00000000  r2 00000454  r3 002136d4
-  r4 002136c0  r5 40804810  r6 0022dc70  r7 00000010
-  r8 0020a258  r9 00000014  10 6b039074  fp 109ffcf8
-  r8 0020a258  r9 00000014  10 6b039074  fp 109ffcf8
-
-  ADDR      FUNCTION                        FILE:LINE
-  6b0156a0  executeJava                     extlibs/jamvm-1.4.1/src/interp.c:2674
-  580239f0  android_util_Parcel_freeBuffer  libs/android_runtime/android_util_Binder.cpp:765
-  6b01481c  executeMethodVaList             extlibs/jamvm- 1.4.1/src/execute.c:91
-  6b0148a4  executeMethodArgs               extlibs/jamvm-1.4.1/src/execute.c:67
-  6b00ebc0  initClass                       extlibs/jamvm-1.4.1/src/class.c:1124
-  6b02166c  resolveMethod                   extlibs/jamvm- 1.4.1/src/resolve.c:197
-  6b01657c  executeJava                     extlibs/jamvm-1.4.1/src/interp.c:2237
-  6b01481c  executeMethodVaList             extlibs/jamvm-1.4.1/src/execute.c:91
-  6b0148a4  executeMethodArgs               extlibs/jamvm- 1.4.1/src/execute.c:67
-  6b0235c0  threadStart                     extlibs/jamvm-1.4.1/src/thread.c:355
-  5300fac4  __thread_entry                  system/klibc/android/pthread.c:59
-  5300fc5c  pthread_create                  system/klibc/android/pthread.c:182
-</pre>
-
-<p>Or you can run <code>logcat</code> without any parameters and it will read from <code>stdin</code>.  You can then paste output into the terminal or pipe it. Run <code>logcat</code> from the top of the tree in the environment in which you do builds so that the application can determine relative paths to the toolchain to use to decode the object files.
-</p>
-</body>
-</html>
diff --git a/pdk/docs/guide/display_drivers.jd b/pdk/docs/guide/display_drivers.jd
deleted file mode 100755
index 1eddd15..0000000
--- a/pdk/docs/guide/display_drivers.jd
+++ /dev/null
@@ -1,345 +0,0 @@
-page.title=Display Drivers
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#androidDisplayDriverFunctionality">Functionality</a></li>
-<li><a href="#androidDisplayDriversSourceTemplate">Implementing Your Own Driver (Driver Template)</a></li>
-<li><a href="#androidDisplayDriversTroubleshooting">Troubleshooting</a></li>
-</ul>
-</div>
-</div>
-
-<p>This section describes how the display driver functions and offers a functional template designed to help you build your own device-specific driver.</p>
-<p>Android relies on the standard frame buffer device (<code>/dev/fb0</code> or <code>/dev/graphics/fb0</code>) and driver as described in the <code>linux/fb.h</code> kernel header file. For more information regarding the standard Linux frame buffer, please see <a href="http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.24.y.git;a=blob;f=Documentation/fb/framebuffer.txt">The Frame Buffer Device</a> at <a href="http://kernel.org">http://kernel.org</a>.
-
-
-<a name="androidDisplayDriverFunctionality"></a><h3>Functionality</h3>
-
-<p>In Android, every window gets implemented with an underlying Surface object, an object that gets placed on the framebuffer by SurfaceFlinger, the system-wide screen composer. Each Surface is double-buffered. The back buffer is where drawing takes place and the front buffer is used for composition. </p>
-<p> When <code>unlockCanvas()</code> is called, the back buffer is posted, which 
-  means that it gets displayed and &nbsp;becomes available again. Android flips the front and back buffers, ensuring a minimal amount of buffer copying and that there is always a buffer for SurfaceFlinger to use for composition (which ensures that the screen never flickers or shows artifacts).</p>
-<p>Android makes two requirements of the driver: a linear address space of mappable memory that it can write to directly and support for the rgb_565 pixel format. A typical frame display includes:</p>
-<ul>
-  <li>accessing the driver by calling open on <code>/dev/fb0</code></li>
-  <li>using the <code>FBIOGET_FSCREENINFO</code> and <code>FBIOGET_VSCREENINFO</code> Input / Output Control (ioctl) calls to retrieve information about the screen</li>
-  <li>using <code>FBIOPUT_VSCREENINFO</code> ioctl to attempt to create a virtual display twice the size of the physical screen and to set the pixel format to rgb_565. If this succeeds, double buffering is accomplished with video memory. </li>
-</ul>
-<p>When a page flip is required, Android makes another <code>FBIOPUT_VSCREENINFO</code> ioctl call with a new y-offset pointing to the other buffer in video memory.  This ioctl, in turn, invokes the driver's <code>.fb_pan_display</code> function in order to do the actual flip. If there isn't sufficient video memory, regular memory is used and is just copied into the video memory when it is time do the flip. After allocating the video memory and setting the pixel format, Android  uses <code>mmap()</code> to map the memory into the process's address space.  All writes to the frame buffer are done through this mmaped memory.</p>
-<p>To maintain adequate performance, framebuffer memory should be cacheable. If you use write-back, flush the cache before the frame buffer is written from DMA to the LCD. If that isn't possible, you may use write-through. As a last resort, you can also use uncached memory with the write-bugger enabled, but performance will suffer.</p>
-
-
-<a name="androidDisplayDriversSourceTemplate"></a><h3>Implementing Your Own Driver (Driver Template)</h3>
-
-<p>The following sample driver offers a functional example to help you build your own display driver. Modify <code>PGUIDE_FB...</code> macros as desired to match the requirements of your own device hardware.</p>
-<pre class="prettyprint">
-/*
- *  pguidefb.c
- * 
- *  Copyright 2007, Google Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- */
-
-
-/*
- * ANDROID PORTING GUIDE: FRAME BUFFER DRIVER TEMPLATE
- *
- * This template is designed to provide the minimum frame buffer
- * functionality necessary for Android to display properly on a new
- * device.  The PGUIDE_FB macros are meant as pointers indicating
- * where to implement the hardware specific code necessary for the new
- * device.  The existence of the macros is not meant to trivialize the
- * work required, just as an indication of where the work needs to be
- * done.
- */
-
-#include &lt;linux/module.h&gt;
-#include &lt;linux/kernel.h&gt;
-#include &lt;linux/errno.h&gt;
-#include &lt;linux/string.h&gt;
-#include &lt;linux/slab.h&gt;
-#include &lt;linux/delay.h&gt;
-#include &lt;linux/mm.h&gt;
-#include &lt;linux/fb.h&gt;
-#include &lt;linux/init.h&gt;
-#include &lt;linux/platform_device.h&gt;
-
-
-/* Android currently only uses rgb565 in the hardware framebuffer */
-#define ANDROID_BYTES_PER_PIXEL 2
-
-/* Android will use double buffer in video if there is enough */
-#define ANDROID_NUMBER_OF_BUFFERS 2
-
-/* Modify these macros to suit the hardware */
-
-#define PGUIDE_FB_ROTATE 
-	/* Do what is necessary to cause the rotation */
-
-#define PGUIDE_FB_PAN 
-	/* Do what is necessary to cause the panning */
-
-#define PGUIDE_FB_PROBE_FIRST 
-	/* Do any early hardware initialization */
-
-#define PGUIDE_FB_PROBE_SECOND
-	/* Do any later hardware initialization */
-
-#define PGUIDE_FB_WIDTH 320
-	/* Return the width of the screen */
-
-#define PGUIDE_FB_HEIGHT 240
-	/* Return the heighth of the screen */
-
-#define PGUIDE_FB_SCREEN_BASE 0
-	/* Return the virtual address of the start of fb memory */
-
-#define PGUIDE_FB_SMEM_START PGUIDE_FB_SCREEN_BASE
-	/* Return the physical address of the start of fb memory */
-
-#define PGUIDE_FB_REMOVE 
-	/* Do any hardware shutdown */
-
-
-
-
-
-struct pguide_fb {
-	int rotation;
-	struct fb_info fb;
-	u32			cmap[16];
-};
-
-static inline u32 convert_bitfield(int val, struct fb_bitfield *bf)
-{
-	unsigned int mask = (1 << bf->length) - 1;
-
-	return (val >> (16 - bf->length) & mask) << bf->offset;
-}
-
-
-/* set the software color map.  Probably doesn't need modifying. */
-static int
-pguide_fb_setcolreg(unsigned int regno, unsigned int red, unsigned int green,
-		 unsigned int blue, unsigned int transp, struct fb_info *info)
-{
-        struct pguide_fb  *fb = container_of(info, struct pguide_fb, fb);
-
-	if (regno < 16) {
-		fb->cmap[regno] = convert_bitfield(transp, &fb->fb.var.transp) |
-				  convert_bitfield(blue, &fb->fb.var.blue) |
-				  convert_bitfield(green, &fb->fb.var.green) |
-				  convert_bitfield(red, &fb->fb.var.red);
-		return 0;
-	}
-	else {
-		return 1;
-	}
-}
-
-/* check var to see if supported by this device.  Probably doesn't
- * need modifying.
- */
-static int pguide_fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
-{
-	if((var->rotate & 1) != (info->var.rotate & 1)) {
-		if((var->xres != info->var.yres) ||
-		   (var->yres != info->var.xres) ||
-		   (var->xres_virtual != info->var.yres) ||
-		   (var->yres_virtual > 
-		    info->var.xres * ANDROID_NUMBER_OF_BUFFERS) ||
-		   (var->yres_virtual < info->var.xres )) {
-			return -EINVAL;
-		}
-	}
-	else {
-		if((var->xres != info->var.xres) ||
-		   (var->yres != info->var.yres) ||
-		   (var->xres_virtual != info->var.xres) ||
-		   (var->yres_virtual > 
-		    info->var.yres * ANDROID_NUMBER_OF_BUFFERS) ||
-		   (var->yres_virtual < info->var.yres )) {
-			return -EINVAL;
-		}
-	}
-	if((var->xoffset != info->var.xoffset) ||
-	   (var->bits_per_pixel != info->var.bits_per_pixel) ||
-	   (var->grayscale != info->var.grayscale)) {
-		return -EINVAL;
-	}
-	return 0;
-}
-
-
-/* Handles screen rotation if device supports it. */
-static int pguide_fb_set_par(struct fb_info *info)
-{
-	struct pguide_fb *fb = container_of(info, struct pguide_fb, fb);
-	if(fb->rotation != fb->fb.var.rotate) {
-		info->fix.line_length = 
-		  info->var.xres * ANDROID_BYTES_PER_PIXEL;
-		fb->rotation = fb->fb.var.rotate;
-		PGUIDE_FB_ROTATE;
-	}
-	return 0;
-}
-
-
-/* Pan the display if device supports it. */
-static int pguide_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
-{
-	struct pguide_fb *fb    __attribute__ ((unused)) 
-	    = container_of(info, struct pguide_fb, fb);
-
-	/* Set the frame buffer base to something like:
-	   fb->fb.fix.smem_start + fb->fb.var.xres * 
-	   ANDROID_BYTES_PER_PIXEL * var->yoffset
-	*/
-	PGUIDE_FB_PAN;
-
-	return 0;
-}
-
-
-static struct fb_ops pguide_fb_ops = {
-	.owner          = THIS_MODULE,
-	.fb_check_var   = pguide_fb_check_var,
-	.fb_set_par     = pguide_fb_set_par,
-	.fb_setcolreg   = pguide_fb_setcolreg,
-	.fb_pan_display = pguide_fb_pan_display,
-
-	/* These are generic software based fb functions */
-	.fb_fillrect    = cfb_fillrect,
-	.fb_copyarea    = cfb_copyarea,
-	.fb_imageblit   = cfb_imageblit,
-};
-
-
-static int pguide_fb_probe(struct platform_device *pdev)
-{
-	int ret;
-	struct pguide_fb *fb;
-	size_t framesize;
-	uint32_t width, height;
-
-	fb = kzalloc(sizeof(*fb), GFP_KERNEL);
-	if(fb == NULL) {
-		ret = -ENOMEM;
-		goto err_fb_alloc_failed;
-	}
-	platform_set_drvdata(pdev, fb);
-
-	PGUIDE_FB_PROBE_FIRST;
-	width = PGUIDE_FB_WIDTH;
-	height = PGUIDE_FB_HEIGHT;
-
-
-	fb->fb.fbops		= &pguide_fb_ops;
-
-	/* These modes are the ones currently required by Android */
-
-	fb->fb.flags		= FBINFO_FLAG_DEFAULT;
-	fb->fb.pseudo_palette	= fb->cmap;
-	fb->fb.fix.type		= FB_TYPE_PACKED_PIXELS;
-	fb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
-	fb->fb.fix.line_length = width * ANDROID_BYTES_PER_PIXEL;
-	fb->fb.fix.accel	= FB_ACCEL_NONE;
-	fb->fb.fix.ypanstep = 1;
-
-	fb->fb.var.xres		= width;
-	fb->fb.var.yres		= height;
-	fb->fb.var.xres_virtual	= width;
-	fb->fb.var.yres_virtual	= height * ANDROID_NUMBER_OF_BUFFERS;
-	fb->fb.var.bits_per_pixel = 16;
-	fb->fb.var.activate	= FB_ACTIVATE_NOW;
-	fb->fb.var.height	= height;
-	fb->fb.var.width	= width;
-
-	fb->fb.var.red.offset = 11;
-	fb->fb.var.red.length = 5;
-	fb->fb.var.green.offset = 5;
-	fb->fb.var.green.length = 6;
-	fb->fb.var.blue.offset = 0;
-	fb->fb.var.blue.length = 5;
-
-	framesize = width * height * 
-	  ANDROID_BYTES_PER_PIXEL * ANDROID_NUMBER_OF_BUFFERS;
-	fb->fb.screen_base = PGUIDE_FB_SCREEN_BASE;
-	fb->fb.fix.smem_start = PGUIDE_FB_SMEM_START;
-	fb->fb.fix.smem_len = framesize;
-
-	ret = fb_set_var(&fb->fb, &fb->fb.var);
-	if(ret)
-		goto err_fb_set_var_failed;
-
-	PGUIDE_FB_PROBE_SECOND;
-
-	ret = register_framebuffer(&fb->fb);
-	if(ret)
-		goto err_register_framebuffer_failed;
-
-	return 0;
-
-
-err_register_framebuffer_failed:
-err_fb_set_var_failed:
-	kfree(fb);
-err_fb_alloc_failed:
-	return ret;
-}
-
-static int pguide_fb_remove(struct platform_device *pdev)
-{
-	struct pguide_fb *fb = platform_get_drvdata(pdev);
-
-	PGUIDE_FB_REMOVE;
-
-	kfree(fb);
-	return 0;
-}
-
-
-static struct platform_driver pguide_fb_driver = {
-	.probe		= pguide_fb_probe,
-	.remove		= pguide_fb_remove,
-	.driver = {
-		.name = "pguide_fb"
-	}
-};
-
-static int __init pguide_fb_init(void)
-{
-	return platform_driver_register(&pguide_fb_driver);
-}
-
-static void __exit pguide_fb_exit(void)
-{
-	platform_driver_unregister(&pguide_fb_driver);
-}
-
-module_init(pguide_fb_init);
-module_exit(pguide_fb_exit);
-
-MODULE_LICENSE("GPL");
-</pre>
-
-
-<a name="androidDisplayDriversTroubleshooting"></a><h3>Troubleshooting</h3>
-
-<p>Both of the following problems have a similar cause:</p>
-<ul>
-  <li><strong>Number keys</strong>: In the dialer application, when a number key is pressed to dial a phone number, the number doesn't display on the screen until after the next number has been pressed. </li>
-  <li><strong>Arrow keys</strong>: When an arrow key is pressed, the desired icon doesn't get highlighted. For example, if you browse through icons in the Applications menu, you might notice that icons aren't highlighted as expected when you use the arrow key to navigate between options.</li>
-</ul>
-<p>Both problems are caused by an incorrect implementation of the frame buffer's page flipping. Key events are captured, but the graphical interface appears to drop every other frame. </p>
-<p>Android relies on a double buffer to smoothly render page flips (please see <a href="#androidDisplayDriverFunctionality">Functionality</a> for details).</p>
diff --git a/pdk/docs/guide/getting_source_code.jd b/pdk/docs/guide/getting_source_code.jd
deleted file mode 100755
index e735274..0000000
--- a/pdk/docs/guide/getting_source_code.jd
+++ /dev/null
@@ -1,128 +0,0 @@
-page.title=Getting Source Code
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<a name="toc"/>
-<div style="padding:10px">
-<a href="#androidSourceSetupBuildGitSetup">Introduction</a><br/>
-<a href="#androidSourceSetupBuildGitSetupInstall">Installing and Configuring Git</a><br/>
-<a href="#androidSourceSetupBuildGitSetupServer">Establishing Server Access</a><br/><div style="padding-left:40px">
-
-<a href="#androidSourceSetupBuildGitSetupServerRSAKeys">Generating RSA Keys</a><br/>
-<a href="#androidSourceSetupBuildGitSetupServerVerifyConnection">Verifying a Connection to the Git Server</a><br/></div>
-<a href="#androidSourceSetupGetCode">Downloading Code</a><br/>
-<a href="#androidSourceSetupExtractingPatch">Extracting an Android Patch</a><br/></div>
-
-<a name="androidSourceSetupBuildGitSetup"></a><h2>Introduction</h2>
-
-<p>Android relies on Git, a version control system, to install the Android platform. You will need to install Git 1.5.2 or greater in order to access the source tree. Please visit <a href="http://git.or.cz/">http://git.or.cz/</a> for more information regarding Git.</p>
-<p>Git permits you to control access to working directories, and we recommend that you use it to limit Android repository access to only a few people within your organization (please refer to your Google NDA for potential contractual restraints on sharing Android source access). </p>
-<p>You may clone Google's repository to a local copy for sharing internally (see Git documentation for details).</p>
-
-
-<a name="androidSourceSetupBuildGitSetupInstall"></a><h2>Installing and Configuring Git</h2>
-
-<p>To install the Git package, execute:</p>
-<pre class="prettyprint">
-% sudo apt-get install git-core
-</pre>
-
-
-<a name="androidSourceSetupBuildGitSetupServer"></a><h2>Establishing Server Access</h2>
-
-<p>Once Git is cleanly installed, you need to establish a connection with Google's Git server, a connection that requires an RSA key in order to authenticate requests.</p>
-
-
-<a name="androidSourceSetupBuildGitSetupServerRSAKeys"></a><h3>Generating RSA Keys</h3>
-
-<p>Each developer must have a unique RSA key in order to access Android source code. To generate an RSA key: </p>
-<p>
-<ol>
-<li>Type:<br/>
-<pre class="prettyprint">% ssh-keygen -t rsa -C  email@domain.com</pre><br/>
-You must use a valid email address to create your key.</li>
-<li>When prompted, indicate the file to which you wish to write your key (<code>id_rsa</code> in this example).</li>
-<li>When prompted, associate a passphrase with your key.</li>
-<li>Upon success, you should have two files saved to the designated directory:  </li>
-<ul>
-  <li><code>id_rsa</code>: This file contains the private half of your RSA key. You shouldn't share this file with anyone. </li>
-  <li><code>id_rsa.pub</code>: This is the public half or your RSA key and you should send it to your Google technical account manager.</li>
-  </ul>
-</ol>
-</p>
-<p>Send your Google Account Manager your public key file in order to establish Git server access. </p>
-
-
-<a name="androidSourceSetupBuildGitSetupServerVerifyConnection"></a><h3>Verifying a Connection to the Git Server</h3>
-
-<p>Once you have generated an RSA key and shared the public file with Google, you can test your connection with the Git server with the following command:</p>
-<pre class="prettyprint">
-% ssh  android-git.ext.google.com
-</pre>
-
-<p>You should receive one of the following results:</p>
-
-<table border=1 cellpadding=2 cellspacing=0>
- <tbody><tr>
-  <th scope="col">Result</th>
-  <th scope="col">Cause</th>
-  <th  scope="col">Action</th>
- </tr>
-  <tr>
-    <td>
-<code>fatal: What do you think I am? A shell?<BR>
-Connection to android-git closed.</code>
-</pre>	</td>
-    <td>Success</td>
-    <td>None. You successfully connected to the Git server. (You should not have shell access and it's expected to receive this error.)</td>
-  </tr>
-  <tr>
-    <td>ssh hangs and eventually times out. </td>
-    <td>Your setup is failing to locate and establish a basic connection. </td>
-    <td>Google needs to debug network settings. </td>
-  </tr>
-  <tr>
-    <td>Error: Permission denied &lt;public key&gt; </td>
-    <td>Either you are not using the matching username or the RSA private key does not match the public key. </td>
-    <td>Try executing:<BR> 
-	<code>
-% ssh $USER@android-
-  git.ext.google.com
-</code></td>
-  </tr>
-</table>
-
-
-<a name="androidSourceSetupGetCode"></a><h2>Downloading Code</h2>
-
-<p>Android source code is maintained in two repositories: <code>device</code> and <code>kernel</code>. The <code>device</code> repository includes the Android framework (things like the Activity Manager, Window Manager, Telephony Manager, View System, etc.). The <code>kernel</code> repository includes the core code necessary to run the operating system (things like the Display Driver, Camera Driver, Keypad Driver, Power Management, etc.). (Please see <a href="http://code.google.com/android/what-is-android.html">What is Android?</a> for details.)</p>
-
-<p>Save device and kernel code at the same directory level, for example:</p>
-<p>
-<ul><li><code>/home/joe/android/device</code></li>
-<li><code>/home/joe/android/kernel</code></li>
-</ul></p>
-<p><b>Device Code</b></p>
-<p>To download device code, you need your username and a unique <code>&lt;path&gt;</code> string supplied by Google to execute the following:</p>
-<pre class="prettyprint">
-% git-clone $USER@android-git.ext.google.com:&lt;path&gt;/device.git
-</pre>
-
-<p><b>Kernel Code</b></p>
-<p>To download kernel code, you need your username and a unique <code>&lt;path&gt;</code> string supplied by Google to execute the following:</p>
-<pre class="prettyprint">
-% git-clone $USER@android-git.ext.google.com:&lt;path&gt;/kernel.git
-</pre>
- 
-
-
-<a name="androidSourceSetupExtractingPatch"></a><h2>Extracting an Android Patch</h2>
-
-<p>You likely already have Linux running on your platform and only need to integrate Android-specific changes. The following directions describe how to extract an Android patch.</p>
-<ol>
-  <li>Download a generic version  of the Linux kernel that matches the Linux version downloaded with the Android Kernel code.</li>
-  <li>Run <code>diff</code> on the two kernel packages to get Android-specific changes.</li>
-  <li>Apply the patch to your target kernel and build.</li>
-</ol>
-
diff --git a/pdk/docs/guide/gps.jd b/pdk/docs/guide/gps.jd
deleted file mode 100755
index 2acad6d..0000000
--- a/pdk/docs/guide/gps.jd
+++ /dev/null
@@ -1,60 +0,0 @@
-page.title=GPS
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#androidGPSBuildingDriver">Building a GPS Library</a></li>
-<li><a href="#androidGPSInterface">Interface</a></li>
-</ul>
-</div>
-</div>
-
-<p>Android defines a user space C abstraction interface for GPS hardware. The interface header is defined in <code>include/hardware/gps.h</code>. In order to integate GPS with Android, you need to build a shared library that implements this interface. </p>
-
-
-<a name="androidGPSBuildingDriver"></a><h3>Building a GPS Library</h3>
-
-<p>To implement a GPS driver, create a shared library that implements the interface defined in <code>gps.h</code>. You must name your shared library <code>libgps.so</code> so that it will get loaded from <code>/system/lib</code> at runtime. Place GPS sources and Android.mk in <code>vendor/acme/chipset_or_board/gps/</code> (where "acme" is your organization name and "chipset_or_board" is your hardware target).</p>
-
-<p>The following stub <code>Android.mk</code> file ensures that <code>libgps</code> compiles and links to the appropriate libraries:</p>
-
-<pre class="prettify">
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libgps
-
-LOCAL_STATIC_LIBRARIES:= \
-# include any static library dependencies
-
-LOCAL_SHARED_LIBRARIES := \
-# include any shared library dependencies
-
-LOCAL_SRC_FILES += \
-# include your source files.  eg. MyGpsLibrary.cpp
-
-LOCAL_CFLAGS += \
-# include any needed compile flags
-
-LOCAL_C_INCLUDES:= \
-# include any needed local header files
-
-include $(BUILD_SHARED_LIBRARY)
-</pre>
-
-
-<a name="androidGPSInterface"></a><h3>Interface</h3>
-
-
-
-<p><span class="lh3"><a name="androidDoxygenNote"></a></span>
-
-<p class="note"><strong>Note</strong>: This document relies on some Doxygen-generated content that appears in an iFrame below. To return to the Doxygen default content for this page, <a href="gps.html">click here</a>.</p>
-
-
-<iframe onLoad="resizeDoxFrameHeight();" src="gps_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe>
diff --git a/pdk/docs/guide/group__memory.jd b/pdk/docs/guide/group__memory.jd
deleted file mode 100755
index 0423515..0000000
--- a/pdk/docs/guide/group__memory.jd
+++ /dev/null
@@ -1,24 +0,0 @@
-page.title=Providing Heap Memory
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div class="navigation" id="top">
-  <div class="tabs">
-    <ul>
-      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
-      <li><a href="modules.html"><span>Modules</span></a></li>
-      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
-      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
-      <li><a href="files.html"><span>Files</span></a></li>
-    </ul>
-  </div>
-</div>
-
-<small>
-[<a class="el" href="group__networking.html">Neworking Support</a>]</small>
-</h1><table border="0" cellpadding="0" cellspacing="0">
-<tr><td></td></tr>
-</table>
-This is the text in the "Providing Heap Memory" subgroup </div>
-
diff --git a/pdk/docs/guide/group__networking.jd b/pdk/docs/guide/group__networking.jd
deleted file mode 100755
index e1e942c..0000000
--- a/pdk/docs/guide/group__networking.jd
+++ /dev/null
@@ -1,26 +0,0 @@
-page.title=Networking Support
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div class="navigation" id="top">
-  <div class="tabs">
-    <ul>
-      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
-      <li><a href="modules.html"><span>Modules</span></a></li>
-      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
-      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
-      <li><a href="files.html"><span>Files</span></a></li>
-    </ul>
-  </div>
-</div>
-
-<table border="0" cellpadding="0" cellspacing="0">
-<tr><td></td></tr>
-<tr><td colspan="2"><br><h2>Modules</h2></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__memory.html">Porividng Heap Memory</a></td></tr>
-
-</table>
-<hr><a name="_details"></a><h2>Detailed Description</h2>
-This is a text for the Networking Support Group </div>
-
diff --git a/pdk/docs/guide/images/androidBluetooth.gif b/pdk/docs/guide/images/androidBluetooth.gif
deleted file mode 100755
index e62f5a8..0000000
--- a/pdk/docs/guide/images/androidBluetooth.gif
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/androidPMArchitecture.gif b/pdk/docs/guide/images/androidPMArchitecture.gif
deleted file mode 100755
index 1aa48db..0000000
--- a/pdk/docs/guide/images/androidPMArchitecture.gif
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/android_audio_architecture.gif b/pdk/docs/guide/images/android_audio_architecture.gif
deleted file mode 100755
index 79854a3..0000000
--- a/pdk/docs/guide/images/android_audio_architecture.gif
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/cameraPreview.jpg b/pdk/docs/guide/images/cameraPreview.jpg
deleted file mode 100755
index 3dea011..0000000
--- a/pdk/docs/guide/images/cameraPreview.jpg
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/cameraTakePicture.jpg b/pdk/docs/guide/images/cameraTakePicture.jpg
deleted file mode 100755
index 4ac6d95..0000000
--- a/pdk/docs/guide/images/cameraTakePicture.jpg
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/camera_video2.gif b/pdk/docs/guide/images/camera_video2.gif
deleted file mode 100755
index 8c46a83..0000000
--- a/pdk/docs/guide/images/camera_video2.gif
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/customLogo.gif.png b/pdk/docs/guide/images/customLogo.gif.png
deleted file mode 100755
index 3322fed..0000000
--- a/pdk/docs/guide/images/customLogo.gif.png
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/stk.gif b/pdk/docs/guide/images/stk.gif
deleted file mode 100755
index 9d6db69..0000000
--- a/pdk/docs/guide/images/stk.gif
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/stk_display_text.gif b/pdk/docs/guide/images/stk_display_text.gif
deleted file mode 100755
index b737c51..0000000
--- a/pdk/docs/guide/images/stk_display_text.gif
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/stk_display_text2.gif b/pdk/docs/guide/images/stk_display_text2.gif
deleted file mode 100755
index cac707b..0000000
--- a/pdk/docs/guide/images/stk_display_text2.gif
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/stk_refresh_init.gif b/pdk/docs/guide/images/stk_refresh_init.gif
deleted file mode 100755
index a79ccaa..0000000
--- a/pdk/docs/guide/images/stk_refresh_init.gif
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/stk_refresh_reset.gif b/pdk/docs/guide/images/stk_refresh_reset.gif
deleted file mode 100755
index dff8d4e..0000000
--- a/pdk/docs/guide/images/stk_refresh_reset.gif
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/stk_refresh_update.gif b/pdk/docs/guide/images/stk_refresh_update.gif
deleted file mode 100755
index 15614ed..0000000
--- a/pdk/docs/guide/images/stk_refresh_update.gif
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/stk_send_SMS.gif b/pdk/docs/guide/images/stk_send_SMS.gif
deleted file mode 100755
index 67fc1a0..0000000
--- a/pdk/docs/guide/images/stk_send_SMS.gif
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/telephony.gif b/pdk/docs/guide/images/telephony.gif
deleted file mode 100755
index 8515730..0000000
--- a/pdk/docs/guide/images/telephony.gif
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/telephony_solicted_example.gif b/pdk/docs/guide/images/telephony_solicted_example.gif
deleted file mode 100755
index 352ca98..0000000
--- a/pdk/docs/guide/images/telephony_solicted_example.gif
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/images/telephony_unsolicted_example.gif b/pdk/docs/guide/images/telephony_unsolicted_example.gif
deleted file mode 100755
index e51c4d6..0000000
--- a/pdk/docs/guide/images/telephony_unsolicted_example.gif
+++ /dev/null
Binary files differ
diff --git a/pdk/docs/guide/index.jd b/pdk/docs/guide/index.jd
deleted file mode 100644
index d22fae8..0000000
--- a/pdk/docs/guide/index.jd
+++ /dev/null
@@ -1,28 +0,0 @@
-page.title=Android Platform Developer's Guide
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-
-<p>Welcome to the <i>Android Platform Dev Guide</i>!  This guide provides an under-the-hood introduction to the Android platform, and is designed for platform developers and manufacturers building Android-powered devices.</p>
-
-<p>If you're a software developer interested in developing applications for Android, please visit the <a href="http://developer.android.com">Android Developers site</a>.</p>
-
-<a name="androidWelcomeAboutThisGuide"></a><h2>About this Guide</h2>
-
-<p>This guide is divided into sections by logical platform component (see the table of contents on the left).  Android is a complex project under constant development, and the level of detail, as well as the rate of change, may vary from section to section.  This guide will be updated regularly as more content becomes available.</p>
-
-<a name="androidWelcomeIntendedAudience"></a><h2>Intended Audience</h2>
-
-<p>This guide is intended for engineers who are proficient with building and running Linux on embedded devices.  It aims to provide explanation of the Android platform rather than Linux or embedded development in general.</p>
-
-<a name="androidWelcomeGettingStarted"></a><h2>Getting Started with Android</h2>
-
-<p>If you are new to Android, start with the platform documentation on the following sites:
-<ul>
-<li><a href="http://developer.android.com">Android Developers site</a>:  This site offers high-level platform documentation and architecture concepts.</li>
-<li><a href="http://source.android.com">Android Open Source Project site</a>:  This site provides instructions on how to get the source code, establish a development environment, and perform a simple build.</li>
-</ul>
-
-<p>When you are ready to start customizing the platform or porting to your target hardware, start in this guide with the <a href="build_system.html">Build System overview</a>.</p>
-
diff --git a/pdk/docs/guide/instrumentation_framework.jd b/pdk/docs/guide/instrumentation_framework.jd
deleted file mode 100755
index f2c51ef..0000000
--- a/pdk/docs/guide/instrumentation_framework.jd
+++ /dev/null
@@ -1,143 +0,0 @@
-page.title=Instrumentation Framework
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<a name="toc"/>
-<div style="padding:10px">
-<a href="#androidInstrumentationFrameworkIntro">Introduction</a><br/>
-<a href="#androidInstrumentationFrameworkamCommand">Understanding the am Command</a><br/>
-<a href="#androidInstrumentationFrameworkWritingRunning">Writing and Running Test Cases</a><br/>
-<a href="#androidInstrumentationFrameworkTestCase">Exploring a Test Case</a><br/>
-<a href="#androidInstrumentationFrameworkTroubleshooting">Troubleshooting</a><br/></div>
-
-<a name="androidInstrumentationFrameworkIntro"></a><h2>Introduction</h2>
-
-<p>This document describes how to use the Instrumentation Framework to write test cases. You should have a working knowledge of the following:</p>
-<ul>
-  <li> Android Application Framework </li>
-  <li> Using <code>adb</code>, <code>am</code> and various logging functionality </li>
-  <li> A brief understanding of the application of interest, that is, he names of the classes which handle the intents etc. </li>
-  <li> Junit testing. </li>
-</ul>
-<p> Each Android application runs in its own process. Instrumentation kills the application process and  restarts the process with Instrumentation. Instrumentation gives a handle to the application context used to poke around the application to validate test assertions, allowing you to write test cases to test applications at a much lower level than UI screen shot tests. Note that Instrumentation cannot catch UI bugs. </p>
-
-
-<a name="androidInstrumentationFrameworkamCommand"></a><h2>Understanding the am Command</h2>
-
-<p><code>am</code> is used to start and instrument activities using the adb shell command, as shown in the snippet below:</p>
-<pre class="prettify">
-&gt; adb shell am
-usage: am [start|instrument]
-       am start [-a &lt;ACTION&gt;] [-d &lt;DATA_URI&gt;] [-t &lt;MIME_TYPE&gt;]
-                [-c &lt;CATEGORY&gt; [-c &lt;CATEGORY&gt;] ...]
-                [-e &lt;EXTRA_KEY&gt; &lt;EXTRA_VALUE&gt; [-e &lt;EXTRA_KEY&gt; &lt;EXTRA_VALUE&gt; ...]
-                [-n &lt;COMPONENT&gt;] [-D] [&lt;URI&gt;]
-       am instrument [-e &lt;ARG_NAME&gt; &lt;ARG_VALUE&gt;] [-p &lt;PROF_FILE&gt;]
-                [-w] &lt;COMPONENT&gt;
-For example, to start the Contacts application you can use
-&gt; adb shell am start -n com.google.android.contacts/.ContactsActivity
-</pre>
-
-
-<a name="androidInstrumentationFrameworkWritingRunning"></a><h2>Writing and Running Test Cases</h2>
-
-<p>Each instrumentation test case is similar to an Android application with the distinction that it starts another application. For example, have a look in the <code>tests/Contacts</code> directory. </p>
-<ul>
-  <li> There should be a Makefile and an Android Manifest file. </li>
-  <li> Tests are located in <code>tests/Contacts/src/com/google/android/contactstests</code>. </li>
-  <li> The Instrumentation Test Runner is located at <code>tests/Contacts/src/com/google/android/contactstests/functional/ContactsInstrumentationTestRunner.java</code>.</li>
-</ul>
-<p>Suppose you have a makefile with <code>Contactstests</code> as the target. </p>
-<ul>
-  <li> <code>make Contactstests</code>: Compiles the test cases. </li>
-  <li> <code>adb install Contactstests.apk</code>: Installs the apk on the device. </li>
-  <li> Use the adb shell <code>am</code> command to run them. </li>
-</ul>
-<p> For options and other details, please see <a href="instrumentation_testing.html" target="_top">Instrumentation Testing</a>.</p>
-
-
-<a name="androidInstrumentationFrameworkTestCase"></a><h2>Exploring a Test Case</h2>
-
-<p> The test case described in this section adds and tests a new Contact. Note that you can send intents, register intent receivers, etc. </p>
-<p><code>Instrumentation.java</code> has helper functions that send key events and string, for example: </p>
-<ul>
-  <li><code>getInstrumentation()</code>: Returns the handle to the instrumentation </li>
-  <li><code>sendCharacterSync</code>: Sends a character. </li>
-  <li><code>sendStringSync</code>: Sends a string to an input box. </li>
-  <li><code>sendKeyDownUpSync</code>: Sends a specific keyevent. </li>
-  <li><code>sendTrackballEventSync</code>: Send a trackball event.</li>
-</ul>
-<p> You can find the test case below at <code>device/tests/Contacts.</code></p>
-<pre class="prettify">
-private void addNewContact(String name, int star, int phoneType, String number, String label,
-		String email, int emailType){
-	ContentValues values = new ContentValues();
-	Uri phoneUri = null;
-	Uri emailUri = null;
-
-	values.put(Contacts.People.NAME, name);
-	values.put(Contacts.People.STARRED, star);
-
-	//Add Phone Numbers
-	Uri uri = mActivity.getContentResolver().insert(Contacts.People.CONTENT_URI, values);
-	phoneUri = Uri.withAppendedPath(uri, Contacts.People.Phones.CONTENT_DIRECTORY);
-
-	values.clear();
-	values.put(Contacts.Phones.TYPE, phoneType);
-	values.put(Contacts.Phones.NUMBER, number);
-	values.put(Contacts.Phones.LABEL, label);
-	mActivity.getContentResolver().insert(phoneUri, values);
-
-	//Add Email
-	emailUri = Uri.withAppendedPath(uri, ContactMethods.CONTENT_DIRECTORY);
-
-	values.clear();
-	values.put(ContactMethods.KIND, Contacts.KIND_EMAIL);
-	values.put(ContactMethods.DATA, email);
-	values.put(ContactMethods.LABEL, "");
-	values.put(ContactMethods.TYPE, emailType);
-	mActivity.getContentResolver().insert(emailUri, values);
-}
-
-
- public void testAddSaveSingleContact(){
-	int previousCount = mActivity.getListView().getCount();
-	String message;
-
-	addNewContact(INPUT_NAME_1 + "1", "5435754532", "1" + INPUT_EMAIL_1, CONFIRM_OPTION);
-
-	message = "Added 1 to initial length=" + previousCount + ", but resulted with a count=" +
-		mActivity.getListView().getCount();
-	assertEquals(message, ++previousCount, mActivity.getListView().getCount());
-
-	// Check Content; Name; Num; Starred
-	assertEquals(INPUT_NAME_1 + "1", getTextFromView(0, android.R.id.text1));
-	assertEquals("5435754532", getTextFromView(0, android.R.id.text2));
-
-	//Check email is saved
-	//cursor = returnEmailCursorAtId("1");
-	Uri uri = Uri.parse("content://contacts/people/1");
-	uri = Uri.withAppendedPath(uri, ContactMethods.CONTENT_DIRECTORY);
-	Cursor cursor = mActivity.getContentResolver().query(uri, CONTACTS_COLUMNS, null, null, null);
-	assertTrue("returnEmailCursorAtId: Moving cursor to first row has failed", cursor.first());
-
-	int dataIndex = cursor.getColumnIndexOrThrow("data");
-	assertEquals("1" + INPUT_EMAIL_1, cursor.getString(dataIndex));
-	cursor.deactivate();
-}
-	</pre>
-
-
-<a name="androidInstrumentationFrameworkTroubleshooting"></a><h2>Troubleshooting</h2>
-
-<p>If you run your test cases and nothing appears to happen, have a look at <code>adb logcat</code>. The following is a common problem:</p>
-<pre class="prettify">
-I/dalvikvm(  688): threadid=11: attached from native, name=Binder Thread #1
-I/dalvikvm(  688): threadid=13: attached from native, name=Binder Thread #2
-W/ActivityManager(  469): Unable to find instrumentation info for: ComponentInfo{com.google.android.browser_instrumentation/com.google.android.browser_instrumentation.BrowserWebkitLayoutInstrumentation}
-D/AndroidRuntime(  688): Shutting down VM
-E/AndroidRuntime(  688): ERROR: thread attach failed
-</pre>		
-<p>It's possible that the instrumentation apk isn't installed on your device or that the package name is incorrect in the Manifest file. </p>
-
diff --git a/pdk/docs/guide/instrumentation_testing.jd b/pdk/docs/guide/instrumentation_testing.jd
deleted file mode 100755
index e4d7cc5..0000000
--- a/pdk/docs/guide/instrumentation_testing.jd
+++ /dev/null
@@ -1,494 +0,0 @@
-page.title=Instrumentation Testing
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#androidInstrumentationTestingFramework">Instrumentation Framework</a></li>
-<li><a href="#androidInstrumentationFrameworkPlatform">Platform Test Suites</a></li>
-<li><a href="#androidInstrumentationFrameworkWritingRunning">Running Tests</a></li>
-<li><a href="#androidInstrumentationTestingCreating">Writing Tests</a></li>
-<li><a href="#troubleshooting">Troubleshooting</a></li>
-</ul>
-</div>
-</div>
-
-<p>This document describes how to use the Instrumentation Framework to write test cases. Instrumentation testing allows you to verify a particular feature or behavior with an automated JUnit TestCase. You can launch activities and providers within an application, send key events, and make assertions about various UI elements. </p>
-<p>You should have a working knowledge of the following:</p>
-<ul>
-  <li> Android Application Framework</li>
-  <li> Using <code>adb</code>, <code>am</code> and various logging functionality </li>
-  <li> A brief understanding of the application of interest, that is, the names of the classes which handle the intents etc. </li>
-  <li> JUnit testing.</li>
-</ul>
-<p> Each Android application runs in its own process. Instrumentation kills the application process and  restarts the process with Instrumentation. Instrumentation gives a handle to the application context used to poke around the application to validate test assertions, allowing you to write test cases to test applications at a much lower level than UI screen shot tests. Note that Instrumentation cannot catch UI bugs. </p>
-
-
-<a name="androidInstrumentationTestingFramework"></a><h3>Instrumentation Framework</h3>
-
-
-
-<a name="androidInstrumentationTestingClasses"></a><h4>Classes</h4>
-
-<p> The following classes help glue together <code>Instrumentation</code> with JUnit testing. </p>
-<table>
-  <tr>
-    <th scope="col">Class</th>
-    <th scope="col">Description</th></tr>
-  <tr>
-    <td valign="top"><code>InstrumentationTestCase</code></td>
-    <td valign="top">
-	<p>This extends the standard JUnit <code>TestCase</code> and offers access to an <code>Instrumentation</code> class. Write tests inside your instrumentation class any way you see fit. For example, your test might launch activities and send key events. For this to work properly, the instrumentation needs to be injected into the test case.</p>	</td>
-  </tr>
-  <tr>
-    <td valign="top"><code>InstrumentationTestRunner</code></td>
-    <td valign="top">The instrumentation test runner is an instrumentation that runs instrumentation test cases and injects itself into each test case. Instrumentation test cases need to be grouped together with an instrumentation test runner with the appropriate target package.</td>
-  </tr>
-  <tr>
-    <td valign="top"><code>InstrumentationTestSuite</code></td>
-    <td valign="top">The instrumentation test suite is a simple extension of the standard JUnit <code>TestSuite</code> that keeps a member <code>Instrumentation</code> variable on hand to inject into each <code>TestCase</code> before running them.  It is used by <code>InstrumentationTestRunner</code>.</td>
-  </tr>
-</table>
-<p> Three additional base classes extend <code>InstrumentationTestCase</code> to allow you to test <code>Activity</code> and <code>Provider</code> classes:</p>
-<table>
-  <tr>
-    <th scope="col">Class</th>
-    <th scope="col">Description</th>
-  </tr>
-  <tr>
-    <td valign="top"><code>ActivityTestCase</code></td>
-    <td valign="top"><p>This class can be used to write tests for a specific activity.  An activity is launched in its <code>setUp()</code> method and finished with <code>tearDown</code>.  If you write a test case that extends <code>ActivityTestCase</code>, you can write tests that access the activity using <code>getActivity()</code> and assume it has been set up properly.</p></td>
-  </tr>
-  <tr>
-    <td valign="top"><code>ServiceTestCase</code></td>
-    <td valign="top">This test case provides a framework in which you can test Service classes in a controlled environment.  It provides basic support for the lifecycle of a Service, and hooks by which you can inject various dependencies and control the environment in which your Service is tested.</td>
-  </tr>
-  <tr>
-    <td valign="top"><code>SingleLaunchActivityTestCase</code></td>
-    <td valign="top">This class is similar to <code>ActivityTestCase</code> except that the activity is launched once per class instead of every time the test case calls setup. </td>
-  </tr>
-  <tr>
-    <td valign="top"><code>ProviderTestCase</code></td>
-    <td valign="top">This class is similar to <code>ActivityTestCase</code> except that it will setup, tear down, and provide access to the <code>Provider</code> of your choice.</td>
-  </tr>
-</table>
-
-
-<a name="androidInstrumentationFrameworkamCommand"></a><h4>Understanding the am Command</h4>
-
-<p>The am command is a command-line interface to the ActivityManager (see <a href="http://code.google.com/android/reference/android/app/ActivityManager.html">http://code.google.com/android/reference/android/app/ActivityManager.html</a> for details). <code>am</code> is used to start and instrument activities using the adb shell command, as shown in the snippet below:</p>
-<pre class="prettify">
-&gt; adb shell am
-usage: am [start|instrument]
-       am start [-a &lt;ACTION&gt;] [-d &lt;DATA_URI&gt;] [-t &lt;MIME_TYPE&gt;]
-                [-c &lt;CATEGORY&gt; [-c &lt;CATEGORY&gt;] ...]
-                [-e &lt;EXTRA_KEY&gt; &lt;EXTRA_VALUE&gt; [-e &lt;EXTRA_KEY&gt; &lt;EXTRA_VALUE&gt; ...]
-                [-n &lt;COMPONENT&gt;] [-D] [&lt;URI&gt;]
-       am instrument [-e &lt;ARG_NAME&gt; &lt;ARG_VALUE&gt;] [-p &lt;PROF_FILE&gt;]
-                [-w] &lt;COMPONENT&gt;
-For example, to start the Contacts application you can use
-&gt; adb shell am start -n com.google.android.contacts/.ContactsActivity
-</pre>
-
-
-<a name="androidInstrumentationFrameworkPlatform"></a><h3>Platform Test Suites</h3>
-
-<p>This section provides an overview for various unit and functional test cases that can be executed through the instrumentation framework.</p>
-
-
-<a name="androidTestingPlatformFramework"></a><h4>Framework Tests</h4>
-
-<p>Framework test cases test the Android application framework or specific Android application functionality that requires an Android runtime context.  These tests can be found in <code>//device/tests</code> and <code>//device/apps/AndroidTests</code>.</p>
-
-
-<a name="androidTestingPlatformCoreLibrary"></a><h4>Core Library</h4>
-
-<p>Core library test cases test the Android library functionality that does not require an Android runtime context.  These tests are split into Android library (android.* package space) tests at <code>//device/java/tests</code> and Java library (java.*, javax.*, etc. packages) tests at <code>//device/dalvik/libcore/.../tests</code>.</p>
-
-
-<a name="androidInstrumentationFrameworkWritingRunning"></a><h3>Running Tests</h3>
-
-<p>Each instrumentation test case is similar to an Android application with the distinction that it starts another application. For example, have a look in the <code>tests/Contacts</code> directory. </p>
-<ul>
-  <li> There should be a Makefile and an Android Manifest file. </li>
-  <li> Tests are located in <code>tests/Contacts/src/com/google/android/contactstests</code>. </li>
-  <li> The Instrumentation Test Runner is located at <code>tests/Contacts/src/com/google/android/contactstests/functional/ContactsInstrumentationTestRunner.java</code>.</li>
-</ul>
-<p>Suppose you have a makefile with <code>Contactstests</code> as the target. </p>
-<ul>
-  <li> <code>make Contactstests</code>: Compiles the test cases. </li>
-  <li> <code>adb install Contactstests.apk</code>: Installs the apk on the device. </li>
-  <li> Use the adb shell <code>am</code> command to run them. </li>
-</ul>
-<p> To run your tests, use the <code>am instrument</code> command with your <code>InstrumentationTestRunner</code> as its argument. Results are printed as a result of the instrumentation. For example, the following snippet displays the output after running the framework tests with one test failing (note the unusual syntax caused by how instrumentations are run via <code>am</code>):</p>
-<pre class="prettify">
-$ adb shell am instrument -w com.google.android.frameworktest/.tests.FrameworkInstrumentationTestRunner
-INSTRUMENTATION_RESULT: test results:=.......F.......
-Time: 6.837
-There was 1 failure:
-1) testSetUpConditions(com.google.android.frameworktest.tests.focus.RequestFocusTest)junit.framework.AssertionFailedError: requestFocus() should work from onCreate.
-        at com.google.android.frameworktest.tests.focus.RequestFocusTest.testSetUpConditions(RequestFocusTest.java:66)
-        at java.lang.reflect.Method.invokeNative(Native Method)
-        at android.test.InstrumentationTestSuite.runTest(InstrumentationTestSuite.java:73)
-        at android.test.InstrumentationTestSuite.runTest(InstrumentationTestSuite.java:73)
-        at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:151)
-        at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1088)
-
-FAILURES!!!
-Tests run: 14,  Failures: 1,  Errors: 0
-
-&lt;RETURN&gt; to continue
-
-INSTRUMENTATION_CODE: -1
-$ 
-</pre>
-
-
-<a name="androidInstrumentationTestingRunningAll"></a><h4>All Tests with Default TestRunner behavior</h4>
-
-<p>If no class or package is passed in to run, InstrumentationTestRunner will automatically find and run all tests under the package of the test application (as defined by the <code>android:targetPackage</code> attribute of the instrumentation defined in its manifest file).
-</p> 
-<pre> 
-$ adb shell am instrument -w \
-  com.android.samples.tests/android.test.InstrumentationTestRunner
- 
-INSTRUMENTATION_RESULT: Test results for InstrumentationTestRunner=..........
-Time: 2.317
- 
-OK (10 tests)
- 
- 
-INSTRUMENTATION_CODE: -1
-</pre>
-
-
-<a name="androidTestingTestSinglePakcage"></a><h4>Running all Tests Under Single Package</h4>
-
-<p>If you have many tests under one package, use the <code>-e package &lt;packagename&gt;</code> option to run all tests under that package without having to manually create a test suite.</p> 
-<pre> 
-$ adb shell am instrument -w \
-  -e package com.android.samples.view \
-  com.android.samples.tests/android.test.InstrumentationTestRunner
-INSTRUMENTATION_RESULT: Test results for InstrumentationTestRunner=........
-Time: 1.587
- 
-OK (8 tests)
-</pre>  
-
-
-<a name="androidTestingSingleTestSuite"></a><h4>Running a Single Test Suite</h4>
-
-<p>If you prefer to explicitly state which tests comprise all of your tests, you can define a test suite and run that directly. By convention, all test packages in your system should have at least one suite called <code>AllTests</code> (see <code>AllTests.java</code>).  To run all of the tests using the <code>AllTests</code> suite for the api demos test app:</p>
-
-<pre> 
-$ adb shell am instrument -w \
-  -e class com.android.samples.AllTests \
-  com.android.samples.tests/android.test.InstrumentationTestRunner
- 
-INSTRUMENTATION_RESULT: Test results for AllTests=..........
-Time: 2.286
- 
-OK (10 tests)
- 
- 
-INSTRUMENTATION_CODE: -1
-</pre> 
-
-
-<a name="androidInstrumentationTestingRunningSingleTestCase"></a><h4>A Single Test Case</h4>
-
-<pre> 
-$ adb shell am instrument -w \
-  -e class com.android.samples.view.Focus2ActivityTest \
-  com.android.samples.tests/android.test.InstrumentationTestRunner
- 
-INSTRUMENTATION_RESULT: Test results for Focus2ActivityTest=....
-Time: 1.359
- 
-OK (4 tests)
- 
- 
-INSTRUMENTATION_CODE: -1
-</pre> 
-
-
-<a name="androidInstrumentationTestingRunningSingleTest"></a><h4>A Single Test</h4>
-
-<pre> 
-$ adb shell am instrument -w \
-  -e class com.android.samples.view.Focus2ActivityTest#testGoingLeftFromRightButtonGoesToCenter \
-  com.android.samples.tests/android.test.InstrumentationTestRunner
- 
-INSTRUMENTATION_RESULT: Test results for Focus2ActivityTest=.
-Time: 0.51
- 
-OK (1 test)
- 
- 
-INSTRUMENTATION_CODE: -1
-</pre> 
-
-
-<a name="androidTestingDebugging"></a><h4>Attaching a debugger to your test</h4>
-
-<p>In order to debug your test code, instruct the controller to stop and wait for the debugger by adding <code>-e debug true</code> to your
-command line.  This causes the test runner to stop and wait for the debugger just before calling your <code>setUp()</code> method.  For example,</p> 
-
-<pre> 
-$ adb shell am instrument -w \
-  -e debug true \
-  com.android.samples.tests/android.test.InstrumentationTestRunner
-</pre> 
-
-
-<a name="androidInstrumentationTestingCreating"></a><h3>Writing Tests</h3>
-
-<p>When writing tests, refer to the ApiDemos tests as models (located at <code>//device/samples/ApiDemos</code>). This section provides an overview of the test structure with ApiDemos.</p>
-
-
-<a name="androidTestingLocationFiles"></a><h4>Location of Files</h4>
-
-<p>Test packages should use the following structure and include <code>Android.mk</code>, <code>AndroidManifest.xml</code>, <code>AllTests.java</code>, and a src directory that mirrors the src directory of the tested application.</p> 
-<p>Files are located within a <code>tests</code> directory found in the root directory:</p> 
-<pre> 
-$ find samples/ApiDemos/tests
-samples/ApiDemos/tests
-samples/ApiDemos/tests/Android.mk
-samples/ApiDemos/tests/AndroidManifest.xml
-samples/ApiDemos/tests/src
-samples/ApiDemos/tests/src/com
-samples/ApiDemos/tests/src/com/google
-samples/ApiDemos/tests/src/com/google/android
-samples/ApiDemos/tests/src/com/google/android/samples
-samples/ApiDemos/tests/src/com/google/android/samples/AllTests.java
-samples/ApiDemos/tests/src/com/google/android/samples/ApiDemosTest.java
-samples/ApiDemos/tests/src/com/google/android/samples/os
-samples/ApiDemos/tests/src/com/google/android/samples/os/MorseCodeConverterTest.java
-samples/ApiDemos/tests/src/com/google/android/samples/view
-samples/ApiDemos/tests/src/com/google/android/samples/view/Focus2ActivityTest.java
-samples/ApiDemos/tests/src/com/google/android/samples/view/Focus2AndroidTest.java
-</pre>
-
-
-<a name="androidTestingContentMakefile"></a><h4>Contents of makefile</h4>
-
-<p>The contents of the makefile are similar to a normal application with the addition of a <code>LOCAL_INSTRUMENTATION_FOR</code> declaration.<p /> 
-<pre> 
-# Add appropriate copyright banner here
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
- 
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
- 
-# Include all test java files.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
- 
-# Notice that we don't have to include the src files of ApiDemos because, by
-# running the tests using an instrumentation targeting ApiDemos, we
-# automatically get all of its classes loaded into our environment.
- 
-LOCAL_PACKAGE_NAME := ApiDemosTests
- 
-LOCAL_INSTRUMENTATION_FOR := ApiDemos
- 
-include $(BUILD_PACKAGE)
-</pre>
-
-
-<a name="androidTestingContentManifest"></a><h4>Content of Manifest</h4>
-
-<p>Use the following example to create an <code>AndroidManifest.xml</code> file that declares the instrumentation. Specify that the framework supplied Instrumentation TestRunner targest the package of your application, allowing the tests that are run with the instrumentation to get access to all of the classes of your application without having to build the source into the test app. The name of the test application is typically the same as your target application with <code>.tests</code> appended. </p>
-<pre> 
-# Add appropriate copyright banner here
-&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.samples.tests"&gt;
- 
-    &lt;uses-permission android:name="android.permission.RUN_INSTRUMENTATION" /&gt;
- 
-    &lt;!--
-    This declares that this app uses the instrumentation test runner targeting
-    the package of com.android.samples.  To run the tests use the command:
-    "adb shell am instrument -w com.android.samples.tests/android.test.InstrumentationTestRunner"
-    --&gt;
-    &lt;instrumentation android:name="android.test.InstrumentationTestRunner"
-                     android:targetPackage="com.android.samples"
-                     android:label="Tests for Api Demos."/&gt;
- 
-&lt;/manifest&gt;
-</pre> 
-<p>&nbsp;</p> 
-<p>The following snippet will prefix the <code>/android.test.InstrumentationTestRunner</code> when running tests from the command line:</p>
-<pre> 
-$ adb shell am instrument -w \
-  com.android.samples.tests/android.test.InstrumentationTestRunner
-</pre> 
-
-
-<a name="androidInstrumentationTestingCreatingTestRunner"></a><h4>New Instrumentation TestRunner</h4>
-
-<p>Create a class that derives from this class. You must override two abstract methods; one that returns the class loader of the target package, and another that defines all of the tests within the package. For example, the snippet below displays the test runner for the framework tests.</p>
-<pre class="prettify">
-public class FrameworkInstrumentationTestRunner extends InstrumentationTestRunner {
-
-    @Override
-    public TestSuite getAllTests() {
-        InstrumentationTestSuite suite = new InstrumentationTestSuite(this);
-
-        suite.addTestSuite(FocusAfterRemovalTest.class);
-        suite.addTestSuite(RequestFocusTest.class);
-        suite.addTestSuite(RequestRectangleVisibleTest.class);
-        return suite;
-    }
-
-    @Override
-    public ClassLoader getLoader() {
-        return FrameworkInstrumentationTestRunner.class.getClassLoader();
-    }
-}
-</pre>
-<p> Next, in an appropriate <code>AndroidManifest.xml</code>, define the instrumentation for the derived class with the appropriate <code>android:targetPackage</code> set.  For example, the snippet below defines the instrumentation runner for the framework tests.</p>
-<pre class="prettify">
-&lt;uses-permission android:name="android.permission.RUN_INSTRUMENTATION" /&gt;
-
-&lt;instrumentation android:name="android.tests.FrameworkInstrumentationTestRunner"
-                 android:targetPackage="com.google.android.frameworktest"
-                 android:label="framework instrumentation test runner" /&gt;
-</pre>		
-
-
-<a name="androidInstrumentationTestingCreatingTestCase"></a><h4>New InstrumentationTestCase</h4>
-
-<p> To create a new test case, write a class that extends <code>InstrumentationTestCase</code> in the same application as your test runner.  The following snippet illustrates an example <code>ActivityTestCase</code> that tests an activity named <code>MyActivity</code>.</p>
-<pre class="prettify">
-public class ButtonPressTest extends ActivityTestCase&lt;MyActivity&gt; {
-
-    Button mLeftButton;
-
-    public ButtonPressTest() {
-        super("com.example", MyActivity.class);
-    }
-
-    @Override
-    public void setUp() throws Exception {
-      super.setUp();
-      mLeftButton = (Button) getActivity().findViewById(R.id.leftButton);
-    }
-
-    public void testFocusMovesToRight() throws Exception {
-        assertTrue(mLeftButton.hasFocus());
-        getInstrumentation().sendCharacterSync(KeyEvent.KEYCODE_DPAD_RIGHT);
-
-        Button rightButton = (Button) getActivity().findViewById(R.id.rightButton);
-        assertTrue(rightButton.hasFocus());
-    }
-
-    // could have several more tests...
-}
-</pre>
-
-
-<a name="androidInstrumentationFrameworkTestCase"></a><h4>Exploring a Test Case</h4>
-
-<p> The test case described in this section adds and tests a new Contact. Note that you can send intents, register intent receivers, etc. </p>
-<p><code>Instrumentation.java</code> has helper functions that send key events and strings, for example: </p>
-<ul>
-  <li><code>getInstrumentation()</code>: Returns the handle to the instrumentation </li>
-  <li><code>sendCharacterSync</code>: Sends a character. </li>
-  <li><code>sendStringSync</code>: Sends a string to an input box. </li>
-  <li><code>sendKeyDownUpSync</code>: Sends a specific keyevent. </li>
-  <li><code>sendTrackballEventSync</code>: Sends a trackball event.</li>
-</ul>
-<p> You can find the test case below at <code>device/tests/Contacts.</code></p>
-<pre class="prettify">
-private void addNewContact(String name, int star, int phoneType, String number, String label,
-		String email, int emailType){
-	ContentValues values = new ContentValues();
-	Uri phoneUri = null;
-	Uri emailUri = null;
-
-	values.put(Contacts.People.NAME, name);
-	values.put(Contacts.People.STARRED, star);
-
-	//Add Phone Numbers
-	Uri uri = mActivity.getContentResolver().insert(Contacts.People.CONTENT_URI, values);
-	phoneUri = Uri.withAppendedPath(uri, Contacts.People.Phones.CONTENT_DIRECTORY);
-
-	values.clear();
-	values.put(Contacts.Phones.TYPE, phoneType);
-	values.put(Contacts.Phones.NUMBER, number);
-	values.put(Contacts.Phones.LABEL, label);
-	mActivity.getContentResolver().insert(phoneUri, values);
-
-	//Add Email
-	emailUri = Uri.withAppendedPath(uri, ContactMethods.CONTENT_DIRECTORY);
-
-	values.clear();
-	values.put(ContactMethods.KIND, Contacts.KIND_EMAIL);
-	values.put(ContactMethods.DATA, email);
-	values.put(ContactMethods.LABEL, "");
-	values.put(ContactMethods.TYPE, emailType);
-	mActivity.getContentResolver().insert(emailUri, values);
-}
-
-
- public void testAddSaveSingleContact(){
-	int previousCount = mActivity.getListView().getCount();
-	String message;
-
-	addNewContact(INPUT_NAME_1 + "1", "5435754532", "1" + INPUT_EMAIL_1, CONFIRM_OPTION);
-
-	message = "Added 1 to initial length=" + previousCount + ", but resulted with a count=" +
-		mActivity.getListView().getCount();
-	assertEquals(message, ++previousCount, mActivity.getListView().getCount());
-
-	// Check Content; Name; Num; Starred
-	assertEquals(INPUT_NAME_1 + "1", getTextFromView(0, android.R.id.text1));
-	assertEquals("5435754532", getTextFromView(0, android.R.id.text2));
-
-	//Check email is saved
-	//cursor = returnEmailCursorAtId("1");
-	Uri uri = Uri.parse("content://contacts/people/1");
-	uri = Uri.withAppendedPath(uri, ContactMethods.CONTENT_DIRECTORY);
-	Cursor cursor = mActivity.getContentResolver().query(uri, CONTACTS_COLUMNS, null, null, null);
-	assertTrue("returnEmailCursorAtId: Moving cursor to first row has failed", cursor.first());
-
-	int dataIndex = cursor.getColumnIndexOrThrow("data");
-	assertEquals("1" + INPUT_EMAIL_1, cursor.getString(dataIndex));
-	cursor.deactivate();
-}
-	</pre>
-
-
-<a name="androidTestingKindsofTests"></a><h4>Deciding Kinds of Tests to Write</h4>
-
-<p>Once you are bootstrapped with your test application, you can start writing tests.  There are three of types of tests you may wish to write:</p> 
-<p><ul> 
-<li> <strong>TestCase</strong>: The standard junit test case.
-</li> 
-<li> <strong>AndroidTestCase</strong>: A test case with access to a Context object that is injected for you by the instrumentation test runner.
-</li> 
-<li> <strong>InstrumentationTestCase</strong>: A test case with access to an Instrumentation, which can be used to launch activities, content providers, send key events, etc.
-</li> 
-</ul> 
-</p> 
-<p>The API Demos test suite includes examples of all three styles and can be used as a guideline for writing each type of test.</p>
-<p>There are two utility classes available for the most common uses of InstrumentationTestCase: ActivityTestCase and ProviderTestCase.  See their javadoc for more information.
-</p>
-
-
-<a name="troubleshooting"></a><h3>Troubleshooting</h3>
-
-<p>If you run your test cases and nothing appears to happen, have a look at <code>adb logcat</code>. The following is a common problem:</p>
-<pre class="prettify">
-I/dalvikvm(  688): threadid=11: attached from native, name=Binder Thread #1
-I/dalvikvm(  688): threadid=13: attached from native, name=Binder Thread #2
-W/ActivityManager(  469): Unable to find instrumentation info for: ComponentInfo{com.google.android.browser_instrumentation/com.google.android.browser_instrumentation.BrowserWebkitLayoutInstrumentation}
-D/AndroidRuntime(  688): Shutting down VM
-E/AndroidRuntime(  688): ERROR: thread attach failed
-</pre>		
-<p>It's possible that the instrumentation apk isn't installed on your device or that the package name is incorrect in the Manifest file. </p>
diff --git a/pdk/docs/guide/intro_source_code.jd b/pdk/docs/guide/intro_source_code.jd
deleted file mode 100755
index 21b34a7..0000000
--- a/pdk/docs/guide/intro_source_code.jd
+++ /dev/null
@@ -1,171 +0,0 @@
-page.title=Source Code Overview
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<a name="toc"/>
-<div style="padding:10px">
-<a href="#androidSourceCodeDirectories">Introduction</a><br/>
-<a href="#Android_Source">Android Source</a><br/><div style="padding-left:40px">
-
-<a href="#androidSourceCodeDirectoriesKernel">Linux Kernel</a><br/>
-<a href="#androidSourceCodeDirectoriesDevice">Android Platform and Applications</a><br/></div>
-<a href="#androidSourceGuidelines">Adding Source Code</a><br/></div>
-
-<a name="androidSourceCodeDirectories"></a><h2>Introduction</h2>
-
-<p>Android source code is maintained in two code bases: the Android Linux kernel (<code>kernel</code> directory) and Android platform and applications (<code>device</code> directory). This document provides a high-level introduction to the source code organization and an overview of the major components of each primary directory.</p>
-
-<a name="Android_Source"></a><h2>Android Source</h2>
-
-
-<a name="androidSourceCodeDirectoriesKernel"></a><h3>Linux Kernel</h3>
-
-<p>The Android Linux kernel includes enhancements to the Linux 2.6 kernel that provide additional drivers to support the Android platform, including:</p>
-<ul>
-  <li>Binder: an OpenBinder-based driver to facilitate inter-process communication (IPC) in the Android platform.</li>
-  <li>Android Power Management: a light weight power management driver built on top of standard Linux power management but optimized for embedded systems.</li>
-  <li>Low Memory Killer: Based on hints from the userspace, the low memory killer can kill off processes to free up memory as necessary. It is designed to provide more flexibility than the Out Of Memory (OOM) killer in the standard kernel.</li>
-  <li>Logger: A light weight logging device used to capture system, radio, logdata, etc.</li>
-  <li>USB Gadget: Uses the USB function framework.</li>
-  <li>Android/PMEM: The PMEM (physical memory) driver is used to provide contiguous physical memory regions to userspace libraries that interact with the digital signal processor (DSP) and other hardware that cannot cope with scatter-gather.</li>
-  <li>Android Alarm: A driver which provides timers that can wake the device up from sleep and a monotonic timebase that runs while the device is asleep.</li>
-</ul>
-<p>Look for Android-specific enhancements in the following directories:</p>
-<p><ul>
-<li><code>/drivers/android</code></li>
-<li><code>/drivers/misc</code></li>
-<li><code>/include/linux</code></li>
-</ul>
-</p>
-
-
-<a name="androidSourceCodeDirectoriesDevice"></a><h3>Android Platform and Applications</h3>
-
-<p>The following list outlines the directory structure found within the <code>device</code> branch of Android source code:</p>
-
-
-<p><span class="lh2"><a name="gmapiMobileTagsListStart"></a></span>
-
-<ul>
-
-
-<li>apps
-Core Android applications such as Phone, Camera, and Calendar.
-</li>
-
-
-<li>boot
-Reference Android bootloader and other boot-related source code.
-</li>
-
-
-<li>commands
-Common Android commands, the most important of which is the runtime command, which does much of the initialization of the system.
-</li>
-
-
-<li>config
-System-wide makefiles and linker scripts.
-</li>
-
-
-<li>content
-Standard Android ContentProvider modules.
-</li>
-
-
-<li>dalvik
-Android runtime Virtual Machine (VM).
-</li>
-
-
-<li>data
-Fonts, keymaps, sounds, timezone information, etc.
-</li>
-
-
-<li>docs
-Full set of Android documentation.
-</li>
-
-
-<li>extlibs
-Non-Android libraries. This directory is intended to host unmodified external code. None of the libraries included within this directory rely on Android headers or libraries.
-</li>
-
-
-<li>ide
-Tools for support of the IDE's used to write Android applications.
-</li>
-
-
-<li>include
-Android system headers for inclusion.
-</li>
-
-
-<li>java
-Android core APIs, as well as some external libraries.
-</li>
-
-
-<li>libs
-Android-specific C++ based libraries.
-</li>
-
-
-<li>partner
-Project-specific source code for various proprietary components.
-</li>
-
-
-<li>prebuilt
-Prebuilt tools, like the toolchains and emulator binary.
-</li>
-
-
-<li>product
-Device-specific configuration files. This directory will include a subdirectory for each new device.
-</li>
-
-
-<li>samples
-Sample applications.
-</li>
-
-
-<li>servers
-C++ based system servers.
-</li>
-
-
-<li>system
-Core of the embedded Linux platform at the heart of Android. These essential bits are required for basic booting, operation, and debugging.
-</li>
-
-
-<li>tests
-Platform and application test cases.
-</li>
-
-
-<li>tools
-Tools for building and debugging Android (of particular interest for porting are "adb" and "emulator").
-</li>
-
-
-
-<p><span class="lh2"><a name="gmapiMobileTagsListEnd"></a></span>
-
-</ul>
-
-
-<a name="androidSourceGuidelines"></a><h2>Adding Source Code</h2>
-
-<p>You can develop Android applications with the same standard tools you use to develop any Java application. The Android core libraries provide the functionality needed to build rich mobile applications and the Android development tools are designed to simplify running, debugging, and testing your applications.</p>
-
-<p>Add project-specific source code to the Android source tree under the <code>partner</code> directory in a directory specific to the application or service you are building. For example, all Google-specific applications would be placed under <code>vendor/google/</code>.  A Google search application would be placed under <code>vendor/google/apps/Search</code>.
-<p>See <a href="build_new_device.html">Building Android for a new Mobile Device</a> for detailed instructions.</p>
-
-
diff --git a/pdk/docs/guide/keymaps_keyboard_input.jd b/pdk/docs/guide/keymaps_keyboard_input.jd
deleted file mode 100755
index 5db0a86..0000000
--- a/pdk/docs/guide/keymaps_keyboard_input.jd
+++ /dev/null
@@ -1,504 +0,0 @@
-page.title=Keymaps and Keyboard Input
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#androidKeymapFunctionality">Functionality</a></li>
-<li><a href="#androidKeymapKeyLayoutMapTitle">Key Layout Map</a></li>
-<li><a href="#androidKeymapKeyCharMap">Key Character Map</a></li>
-<li><a href="#androidKeymapDriverTemplate">Implementing Your Own Driver (Driver Template)</a></li>
-<li><a href="#androidKeymapKeyCharMapSampleImplementation">Sample Implementation</a></li>
-</ul>
-</div>
-</div>
-
-<p>This document describes how keyboard input gets translated into Android actions and how you can customize key layout and key character maps to match the needs of your own device. </p>
-<p>Android uses the standard Linux input event device (<code>/dev/event0</code>) and driver as described in the <code>linux/input.h</code> kernel header file. For more information regarding standard Linux input drivers, please see <a href="http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.24.y.git;a=blob;f=Documentation/input/input.txt">Linux Input drivers</a> at <a href="http://kernel.org">http://kernel.org</a>.</p>
-
-
-
-
-<a name="androidKeymapFunctionality"></a><h3>Functionality</h3>
-
-<p>Android's input event device is structured around an interrupt or polling routine that captures the device-specific scancode and converts it to a standard form acceptable to Linux (as defined in <code>input.h</code>) before passing it to the kernel with <code>input_event()</code>.</p>
-<p>The keymap driver's other primary function is to establish a probe function that sets up the interrupt or polling function, handles hardware initialization, and attaches the driver to the input subsystem with <code>input_register_device()</code>.</p>
-<p>The table below describes the steps required to translate from keyboard input to application action: </p>
-<table border=1>
-    <tbody><tr>
-      <th scope="col">Step</th>
-        <th scope="col">Action</th>
-        <th scope="col">Explanation</th>
-    </tr>
-	<tr>
-	  <td>1.</td>
-	  <td>Window manager reads key event from Linux keyboard driver. </td>
-	  <td>Events are typically positional. For example, the top-left position on a keypad returns 16 regardless of whether that key is printed with a Q (as on a QWERTY keypad) or an A (as on an AZERTY keypads). This first conversion by the Linux Keyboard Driver yields a scancode (for example, 16).</td>
-	</tr>
-	<tr>
-	  <td>2. </td>
-	  <td>Window manager maps scancode to keycode.</td>
-	  <td>When the window manager reads a key event out of the driver, it maps the scancode to a keycode using a key layout map file. Typically, the keycode is the primary symbol screen-printed on a key. For example, <code>KEYCODE_DPAD_CENTER</code> is the center button on the five-way navigation control. Even though ALT + G generates a &quot;?&quot; character, <code>KEYCODE_G</code> is the keycode.</td>
-	  </tr>
-	<tr>
-	  <td>3. </td>
-	  <td>Window manager  sends both the scancode and the keycode to the application.</td>
-	  <td>Both the scancode and keycode are handled by the view with focus. 
-  How the application interprets both depend on the application.</td>
-	  </tr>
-</tbody>
-</table>
-
-
-<a name="androidKeymapKeyLayoutMapTitle"></a><h3>Key Layout Map</h3>
-
-
-
-<a name="androidKeymapKeyLayoutMapSelection"></a><h4>Selection of a Key Layout Map</h4>
-
-<p>Key layout maps are installed in <code>/system/usr/keylayout</code> and <code>/data/usr/keylayout</code>.</p>
-<p>For each keyboard device xxx, set the <code>android.keylayout.xxx</code> system property (see <a href="build_new_device.html">Building New Device</a> for help setting system properties). If you don't specify a keylayout file, Android will default to <code>/system/usr/keylayout/qwerty.kl</code>.</p>
-
-
-<a name="androidKeymapKeyLayoutMapFileFormat"></a><h4>File Format</h4>
-
-<p>Key layout maps are stored on the device as UTF-8 text files and have the following characteristics:</p>
-<p><ul>
-<li>Comments: The pound symbol (#) denotes a comment and everything after the pound symbol on a line is ignored.</li>
-<li>Whitespace: All empty lines are ignored.</li>
-<li>Key definitions: Key definitions follow the syntax <code>key SCANCODE KEYCODE [FLAGS...]</code>, where <code>SCANCODE</code> is a number, <code>KEYCODE</code> is defined in your specific keylayout file (<code>android.keylayout.xxx</code>), and potential <code>FLAGS</code> are defined as follows:
-<ul><li>SHIFT: While pressed, the shift key modifier is set</li>
-<li>ALT: While pressed, the alt key modifier is set</li>
-<li>CAPS: While pressed, the caps lock key modifier is set</li>
-<li>WAKE: When this key is pressed while the device is asleep, the device will wake up and the key event gets sent to the app.</li>
-<li>WAKE_DROPPED: When this key is pressed while the device is asleep, the device will wake up and the key event does not get sent to the app.</li>
-</ul>
-</li>
-</ul>
-</p>
-
-
-<a name="androidKeymapKeyLayoutMapExample"></a><h4>Example of a Key Layout Map File</h4>
-
-<p>The following code comes from  <code>android/src/device/product/generic/tuttle2.kl</code> and is an example of a complete key layout file:</p>
-<pre class="prettify">
-# Copyright 2007 Google Inc.
-
-key 2     1
-key 3     2
-key 4     3
-key 5     4
-key 6     5
-key 7     6
-key 8     7
-key 9     8
-key 10    9
-key 11    0
-key 158   BACK              WAKE_DROPPED
-key 230   SOFT_RIGHT        WAKE
-key 60    SOFT_RIGHT        WAKE
-key 107   ENDCALL           WAKE_DROPPED
-key 62    ENDCALL           WAKE_DROPPED
-key 229   MENU         WAKE_DROPPED
-key 59    MENU         WAKE_DROPPED
-key 228   POUND
-key 227   STAR
-key 231   CALL              WAKE_DROPPED
-key 61    CALL              WAKE_DROPPED
-key 232   DPAD_CENTER       WAKE_DROPPED
-key 108   DPAD_DOWN         WAKE_DROPPED
-key 103   DPAD_UP           WAKE_DROPPED
-key 102   HOME              WAKE
-key 105   DPAD_LEFT         WAKE_DROPPED
-key 106   DPAD_RIGHT        WAKE_DROPPED
-key 115   VOLUME_UP
-key 114   VOLUME_DOWN
-key 116   POWER             WAKE
-key 212   SLASH
-
-key 16    Q
-key 17    W
-key 18    E
-key 19    R
-key 20    T
-key 21    Y
-key 22    U
-key 23    I
-key 24    O
-key 25    P
-
-key 30    A
-key 31    S
-key 32    D
-key 33    F
-key 34    G
-key 35    H
-key 36    J
-key 37    K
-key 38    L
-key 14    DEL
-        
-key 44    Z
-key 45    X
-key 46    C
-key 47    V
-key 48    B
-key 49    N
-key 50    M
-key 51    COMMA
-key 52    PERIOD
-key 28    NEWLINE
-        
-key 56    ALT_LEFT
-key 42    SHIFT_LEFT
-key 215   AT
-key 57    SPACE
-key 53    SLASH
-key 127   SYM
-key 100   ALT_LEFT
-
-key 399   GRAVE
-</pre>
-
-
-<a name="androidKeymapKeyCharMap"></a><h3>Key Character Map</h3>
-
-
-
-<a name="androidKeymapKeyCharMapSelection"></a><h4>Selection of a Key Character Map</h4>
-
-<p>Key character maps are installed in <code>/system/usr/keychars</code> and <code>/data/usr/keychars</code>.</p>
-<p>For each keyboard device xxx, set the <code>android.keychar.xxx</code> system property to the full path of the desired keychar file. If you don't specify a keychar file, Android will default to <code>/system/usr/keychar/qwerty.kl</code>.
-
-
-<a name="androidKeymapKeyCharMapFileFormat"></a><h4>File Format</h4>
-
-<p>Key character maps are stored on the device as binary resources in order to reduce loading time. Key character maps have the following characteristics:</p>
-<p><ul>
-
-<li>Comments: The pound symbol (#) denotes a comment and everything after the pound symbol on a line is ignored.</li>
-<li>Whitespace: All empty lines are ignored.</li>
-<li>Column definitions: Column definitions follow the syntax <code>columns MODIFIERS [...]</code>, where <code>MODIFIERS</code> are defined as follows:
-<table border=1 cellpadding=2 cellspacing=0>
-    <tbody><tr>
-        <th scope="col">Character in MODIFIERS</th>
-        <th scope="col">Corresponding bit in the modifiers</th>
-    </tr>
-    <tr>
-        <td>O</td>
-        <td>no modifiers</td>
-    </tr>
-    <tr>
-        <td>S</td>
-        <td>MODIFIER_SHIFT</td>
-    </tr>
-    <tr>
-        <td>C</td>
-        <td>MODIFIER_CONTROL</td>
-    </tr>
-    <tr>
-        <td>L</td>
-        <td>MODIFIER_CAPS_LOCK</td>
-    </tr>
-    <tr>
-        <td>A</td>
-        <td>MODIFIER_ALT</td>
-    </tr>
-</table>
-</li>
-<li>Key definitions: Key definitions have the syntax <code>key SCANCODE CHARACTER [...]</code> where <code>SCANCODE</code> is a number and <code>CHARACTER</code> values are either UTF-8 characters in quotation marks (for example, "a") or a numeric value that <code>strtol</code> can parse.</li>
-</ul></p>
-
-
-<a name="androidKeymapKeyCharMapExample"></a><h4>Example of a Key Character Map File</h4>
-
-<p>The following code comes from <code>android/src/device/product/generic/tuttle2.kcm</code> and represents a complete key character file:</p>
-<p>The type line indicates what kind of keyboard your device implements. Possible types include:</p>
-<p><ul>
-<li><b>NUMERIC</b>: A numeric (12-key) keyboard.</li>
-<li><b>Q14</b>: A keyboard that includes all letters but multiple letters per key.</li>
-<li><b>QWERTY</b>: A keyboard with all letters and possibly numbers. This option applies to all full keyboard configurations, such as AZERTY.</li>
-</ul>
-</p>
-<pre class="prettify">
-# Copyright 2007 Google Inc.
-
-[type=QWERTY]
-
-# keycode   base    caps    fn      caps_fn number  display_label
-
-A           'a'     'A'     '%'     0x00    '%'     'A'
-B           'b'     'B'     '='     0x00    '='     'B'
-C           'c'     'C'     '8'     0x00E7  '8'     'C'
-D           'd'     'D'     '5'     0x00    '5'     'D'
-E           'e'     'E'     '2'     0x0301  '2'     'E'
-F           'f'     'F'     '6'     0x00A5  '6'     'F'
-G           'g'     'G'     '-'     '_'     '-'     'G'
-H           'h'     'H'     '['     '{'     '['     'H'
-I           'i'     'I'     '$'     0x0302  '$'     'I'
-J           'j'     'J'     ']'     '}'     ']'     'J'
-K           'k'     'K'     '"'     '~'     '"'     'K'
-L           'l'     'L'     '''     '`'     '''     'L'
-M           'm'     'M'     '>'     0x00    '>'     'M'
-N           'n'     'N'     '<'     0x0303  '<'     'N'
-O           'o'     'O'     '('     0x00    '('     'O'
-P           'p'     'P'     ')'     0x00    ')'     'P'
-Q           'q'     'Q'     '*'     0x0300  '*'     'Q'
-R           'r'     'R'     '3'     0x20AC  '3'     'R'
-S           's'     'S'     '4'     0x00DF  '4'     'S'
-T           't'     'T'     '+'     0x00A3  '+'     'T'
-U           'u'     'U'     '&'     0x0308  '&'     'U'
-V           'v'     'V'     '9'     '^'     '9'     'V'
-W           'w'     'W'     '1'     0x00    '1'     'W'
-X           'x'     'X'     '7'     0xEF00  '7'     'X'
-Y           'y'     'Y'     '!'     0x00A1  '!'     'Y'
-Z           'z'     'Z'     '#'     0x00    '#'     'Z'
-
-COMMA       ','     ';'     ';'     '|'     ','     ','
-PERIOD      '.'     ':'     ':'     0x2026  '.'     '.'
-AT          '@'     '0'     '0'     0x2022  '0'     '@'
-SLASH       '/'     '?'     '?'     '\'     '/'     '/'
-
-SPACE       0x20    0x20    0x9     0x9     0x20    0x20
-NEWLINE     0xa     0xa     0xa     0xa     0xa     0xa
-
-# on pc keyboards
-TAB         0x9     0x9     0x9     0x9     0x9     0x9
-0           '0'     ')'     ')'     ')'     '0'     '0'
-1           '1'     '!'     '!'     '!'     '1'     '1'
-2           '2'     '@'     '@'     '@'     '2'     '2'
-3           '3'     '#'     '#'     '#'     '3'     '3'
-4           '4'     '$'     '$'     '$'     '4'     '4'
-5           '5'     '%'     '%'     '%'     '5'     '5'
-6           '6'     '^'     '^'     '^'     '6'     '6'
-7           '7'     '&'     '&'     '&'     '7'     '7'
-8           '8'     '*'     '*'     '*'     '8'     '8'
-9           '9'     '('     '('     '('     '9'     '9'
-
-GRAVE         '`'     '~'     '`'     '~'     '`'     '`'
-MINUS         '-'     '_'     '-'     '_'     '-'     '-'
-EQUALS        '='     '+'     '='     '+'     '='     '='
-LEFT_BRACKET  '['     '{'     '['     '{'     '['     '['
-RIGHT_BRACKET ']'     '}'     ']'     '}'     ']'     ']'
-BACKSLASH     '\'     '|'     '\'     '|'     '\'     '\'
-SEMICOLON     ';'     ':'     ';'     ':'     ';'     ';'
-APOSTROPHE    '''     '"'     '''     '"'     '''     '''
-STAR          '*'     '*'     '*'     '*'     '*'     '*'
-POUND         '#'     '#'     '#'     '#'     '#'     '#'
-PLUS          '+'     '+'     '+'     '+'     '+'     '+'
-</pre>
-
-
-<a name="androidKeymapKeyCharMapResourceBinaryFileFormat"></a><h4>Resource Binary File Format</h4>
-
-<p>The file snippet above gets converted to the following by the <code>makekcharmap</code> tool as part of the build process. You can <code>mmap</code> this file in and share the approximately 4k of memory that it uses between processes to minimize load time.</p>
-<table>
-    <tbody><tr>
-        <th scope="col">Offset</th>
-
-        <th scope="col">Size (bytes)</th>
-        <th scope="col">Description</th>
-    </tr>
-    <tr>
-        <td>0x00-0x0b</td>
-        <td></td>
-        <td>The ascii value "keycharmap1" including the null character</td>
-
-    </tr>
-    <tr>
-        <td>0x0c-0x0f</td>
-        <td></td>
-        <td>padding</td>
-    </tr>
-    <tr>
-        <td>0x10-0x13</td>
-
-        <td></td>
-        <td>The number of entries in the modifiers table (COLS)</td>
-    </tr>
-    <tr>
-        <td>0x14-0x17</td>
-        <td></td>
-        <td>The number of entries in the characters table (ROWS)</td>
-
-    </tr>
-    <tr>
-        <td>0x18-0x1f</td>
-        <td></td>
-        <td>padding</td>
-    </tr>
-    <tr>
-        <td></td>
-
-        <td>4*COLS</td>
-        <td>Modifiers table.  The modifier mask values that each of the 
-            columns in the characters table correspond to.</td>
-    </tr>
-    <tr>
-        <td></td>
-        <td></td>
-        <td>padding to the next 16 byte boundary</td>
-
-    </tr>
-    <tr>
-        <td></td>
-        <td>4*COLS*ROWS</td>
-        <td>Characters table.  The modifier mask values that each of the
-            columns correspond to.</td>
-    </tr>
-</tbody></table>
-
-
-<a name="androidKeymapDriverTemplate"></a><h3>Implementing Your Own Driver (Driver Template)</h3>
-
-<p>The following file, <code>pguide_events.c</code>, illustrates how to implement an Android keymap driver.</p>
-<pre class="prettyprint">
-/*
- * pguide_events.c
- *
- * ANDROID PORTING GUIDE: INPUT EVENTS DRIVER TEMPLATE
- *
- * This template is designed to an example of the functionality
- * necessary for Android to recieve input events.  The PGUIDE_EVENT
- * macros are meant as pointers indicating where to implement the
- * hardware specific code necessary for the new device.  The existence
- * of the macros is not meant to trivialize the work required, just as
- * an indication of where the work needs to be done.
- * 
- * Copyright 2007, Google Inc.
- * Based on goldfish-events.c
- *
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/types.h>
-#include <linux/input.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-
-
-#include <asm/irq.h>
-#include <asm/io.h>
-
-
-
-#define PGUIDE_EVENTS_INTERRUPT do{} while(0)
-#define PGUIDE_EVENTS_PROBE do{} while(0)
-
-struct event_dev {
-    struct input_dev *input;
-    int irq;
-};
-
-static irqreturn_t pguide_events_interrupt(int irq, void *dev_id)
-{
-    struct event_dev *edev = dev_id;
-    unsigned type=0, code=0, value=0;
-
-    /* Set up type, code, and value per input.h
-     */
-    PGUIDE_EVENTS_INTERRUPT;
-
-    input_event(edev->input, type, code, value);
-    return IRQ_HANDLED;
-}
-
-static int pguide_events_probe(struct platform_device *pdev)
-{
-    struct input_dev *input_dev;
-    struct event_dev *edev;
-    
-    printk("*** pguide events probe ***\n");
-
-    edev = kzalloc(sizeof(struct event_dev), GFP_KERNEL);
-    input_dev = input_allocate_device();
-
-    /* Setup edev->irq and do any hardware init */
-    PGUIDE_EVENTS_PROBE;
-
-    if(request_irq(edev->irq, pguide_events_interrupt, 0,
-                   "pguide_events", edev) < 0) {
-        goto fail;
-    }
-    
-        /* indicate that we generate key events */
-    set_bit(EV_KEY, input_dev->evbit);
-    set_bit(EV_REL, input_dev->evbit);
-    set_bit(EV_ABS, input_dev->evbit);
-
-    /* indicate that we generate *any* key event */
-
-    bitmap_fill(input_dev->keybit, KEY_MAX);
-    bitmap_fill(input_dev->relbit, REL_MAX);
-    bitmap_fill(input_dev->absbit, ABS_MAX);
-    
-    platform_set_drvdata(pdev, edev);
-
-    input_dev->name = "pguide_events";
-    input_dev->private = edev;
-    input_dev->cdev.dev = &pdev->dev;
-    
-    input_register_device(input_dev);
-    return 0;
-
-fail:
-    kfree(edev);
-    input_free_device(input_dev);
-    
-    return -EINVAL;
-}
-
-static struct platform_driver pguide_events_driver = {
-    .probe = pguide_events_probe,
-    .driver = {
-        .name = "pguide_events",
-    },
-};
-
-static int __devinit pguide_events_init(void)
-{
-    return platform_driver_register(&pguide_events_driver);
-}
-
-
-static void __exit pguide_events_exit(void)
-{
-}
-
-module_init(pguide_events_init);
-module_exit(pguide_events_exit);
-
-MODULE_DESCRIPTION("Pguide Event Device");
-MODULE_LICENSE("GPL");
-</pre>
-
-
-<a name="androidKeymapKeyCharMapSampleImplementation"></a><h3>Sample Implementation</h3>
-
-<p>Assume the following for the setup of a new keypad device:</p>
-<pre class="prettify">
-android.keylayout.partnerxx_keypad = /system/usr/keylayout/partnerxx_keypad.kl
-android.keychar.partnerxx_keypad = /system/usr/keychars/partnerxx.kcm
-</pre>
-<p>The following example log file indicates that you have correctly registered the new keypad:</p>
-<pre class="prettify">
-I/EventHub( 1548): New device: path=/dev/input/event0 name=partnerxx_keypad id=0x10000 (of 0x1) index=1 fd=30
-I/EventHub( 1548): new keyboard input device added, name = partnerxx_keypad
-D/WindowManager( 1548): Starting input thread.
-D/WindowManager( 1548): Startup complete!
-I/EventHub( 1548): New keyboard: name=partnerxx_keypad 
-  keymap=partnerxx_keypad.kl 
-  keymapPath=/system/usr/keychars/partnerxx_keypad.kcm.bin
-I/ServiceManager( 1535): ServiceManager: addService(window, 0x13610)
-I/EventHub( 1548): Reporting device opened: id=0x10000, name=/dev/input/event0
-I/KeyInputQueue( 1548): Device added: id=0x10000, name=partnerxx_keypad, classes=1
-I/KeyInputQueue( 1548):   Keymap: partnerxx_keypad.kl
-</pre>
-<p>The snippet above contains artificial line breaks to maintain a print-friendly document.</p>
diff --git a/pdk/docs/guide/lights.jd b/pdk/docs/guide/lights.jd
deleted file mode 100755
index 1c445b2..0000000
--- a/pdk/docs/guide/lights.jd
+++ /dev/null
@@ -1,48 +0,0 @@
-page.title=Lights
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#androidLightsBuildingDriver">Building a Lights Library</a></li>
-<li><a href="#androidLightsInterface">Interface</a></li>
-</ul>
-</div>
-</div>
-
-<p>Android defines a user space C abstraction interface for LED hardware. The interface header is defined in 
-<code>hardware/libhardware/include/hardware/lights.h</code>.
-In order to integrate LEDs with Android you need to build a shared library that implements this interface. 
-
-The types of logical lights currently supported by Android include:
-<ul>
-<li>Backlight</li>
-<li>Keyboard</li>
-<li>Buttons</li>
-<li>Battery</li>
-<li>Notifications</li>
-<li>Attention</li>
-</ul>
-</p> 
- 
-<a name="androidLightsBuildingDriver"></a><h3>Building a Lights Library</h3>
-<p> To implement a Lights driver, create a shared library that implements the interface defined in <code>lights.h</code>. You must name your shared library 
-<code>liblights.so</code> so that it will get loaded from <code>/system/lib</code> at runtime. 
-</p
-
- 
-<a name="androidLightsInterface"></a><h3>Interface</h3> 
- 
- 
- 
-<p><span class="lh3"><a name="androidDoxygenNote"></a></span> 
- 
-<p class="note"><strong>Note</strong>: This document relies on some Doxygen-generated content that appears in an iFrame below. To return to the Doxygen default content for this page, <a href="lights.html">click here</a>.</p> 
- 
- 
-<iframe onLoad="resizeDoxFrameHeight();" src="lights_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" 
-frameborder="0" style="width:100%;"></iframe> 
diff --git a/pdk/docs/guide/modules.html b/pdk/docs/guide/modules.html
deleted file mode 100755
index ea2a07a..0000000
--- a/pdk/docs/guide/modules.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-<title>Doxygen-Generated Content</title>
-<link href="doxygen.css" rel="stylesheet" type="text/css" />
-<style type="text/css">
-<!--
-.navigation {
-	display: none;
-}
--->
-</style>
-</head>
-<body>
-<!-- Generated by Doxygen 1.5.6 -->
-<div class="navigation" id="top">
-  <div class="tabs">
-    <ul>
-      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
-      <li class="current"><a href="modules.html"><span>Modules</span></a></li>
-      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
-      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
-      <li><a href="files.html"><span>Files</span></a></li>
-    </ul>
-  </div>
-</div>
-<div class="contents">
-<h1>Modules</h1>Here is a list of all modules:<ul>
-<li><a class="el" href="group__networking.html">Neworking Support</a>
-<ul>
-<li><a class="el" href="group__memory.html">Porividng Heap Memory</a>
-</ul>
-</ul>
-</div>
-</body>
-</html>
diff --git a/pdk/docs/guide/pdk_toc.cs b/pdk/docs/guide/pdk_toc.cs
deleted file mode 100644
index d1493e6..0000000
--- a/pdk/docs/guide/pdk_toc.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-<script type="text/javascript" language="JavaScript">
-<!--
-function nothing() {}
--->
-</script>
-
-<ul>
-
-<li> <h2>Setup and Building</h2>
-  <ul>
-     <li class="toggle-list">
-     <div><a href="<?cs var:toroot ?>guide/build_system.html">Build System</a></div>
-     <ul>  
-       <li><a href="<?cs var:toroot ?>guide/build_new_device.html">Configuring a New Product</a></li>
-       <li><a href="<?cs var:toroot ?>guide/build_cookbook.html">Build Cookbook</a></li>
-     </ul>
-     </li>
-     <li><a href="<?cs var:toroot ?>guide/release_keys.html">Release Keys and Signing Builds</a></li> 
- </ul>
-</li>
-
-<li> <h2>Customization</h2>
-  <ul>
-    <li><a href="<?cs var:toroot ?>guide/customization.html">Customization</a></li>
-  </ul>
-</li>
-
-<li> <h2>System</h2>
-
-<ul>
-  <li><a href="<?cs var:toroot ?>guide/bring_up.html">Bring up</a></li>
-  <li class="toggle-list">
-    <div><a href="javascript:nothing()">Connectivity</a></div>
-    <ul> 
-      <li><a href="<?cs var:toroot ?>guide/bluetooth.html">Bluetooth</a></li>
-      <li><a href="<?cs var:toroot ?>guide/gps.html">GPS</a></li>
-      <li><a href="<?cs var:toroot ?>guide/wifi.html">Wi-Fi</a></li>
-    </ul>
-  </li>
-
-  <li><a href="<?cs var:toroot ?>guide/display_drivers.html">Display Drivers</a></li>
-  <li class="toggle-list"> 
-    <div><a href="javascript:nothing()">Input Devices</a></div>
-    <ul>
-      <li><a href="<?cs var:toroot ?>guide/keymaps_keyboard_input.html">Keymaps and Keyboard</a></li>
-    </ul>
-  </li>
-  <li><a href="<?cs var:toroot ?>guide/lights.html">Lights</a></li>
-  <li class="toggle-list">
-    <div><a href="javascript:nothing()">Multimedia</a></div>
-    <ul>
-      <li><a href="<?cs var:toroot ?>guide/audio.html">Audio</a></li>
-      <li><a href="<?cs var:toroot ?>guide/camera.html">Camera/Video</a></li>
-    </ul>
-  </li>
-  
-  <li><a href="<?cs var:toroot ?>guide/power_management.html">Power Management</a></li>
-  <li><a href="<?cs var:toroot ?>guide/sensors.html">Sensors</a></li>
-  <li class="toggle-list">
-    <div><a href="javascript:nothing()">Telephony</a></div>
-    <ul>
-      <li><a href="<?cs var:toroot ?>guide/telephony.html">Radio Interface Layer</a></li>
-      <li><a href="<?cs var:toroot ?>guide/stk.html">SIM Toolkit Application (STK)</a></li>
-    </ul>
-  </li>
-
-</ul>
-</li>
-
-<li> <h2>Dalvik Virtual Machine</h2>
-  <ul>
-    <li><a href="<?cs var:toroot ?>guide/dalvik.html">Porting Dalvik</a></li>
-  </ul>
-</li>
-<li> <h2>Testing and Debugging</h2>
-  <ul>
-    <li><a href="<?cs var:toroot ?>guide/instrumentation_testing.html">Instrumentation Testing</a></li>
-    <li><a href="<?cs var:toroot ?>guide/debugging_gdb.html">Debugging with GDB</a></li>
-    <li><a href="<?cs var:toroot ?>guide/debugging_native.html">Debugging Native Code</a></li>
-    <li><a href="<?cs var:toroot ?>guide/tcpdump.html">Debugging with tcpdump</a></li>
-  </ul>
-</li>
-
-
-
-</ul>
-
-<script type="text/javascript">
-<!--
-    buildToggleLists();
-//-->
-</script>
diff --git a/pdk/docs/guide/power_management.jd b/pdk/docs/guide/power_management.jd
deleted file mode 100755
index daff6ed..0000000
--- a/pdk/docs/guide/power_management.jd
+++ /dev/null
@@ -1,203 +0,0 @@
-page.title=Power Management
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<a name="toc"/>
-<div style="padding:10px">
-<a href="#androidPowerIntro">Introduction</a><br/>
-<a href="#androidPowerWakeLocks">Wake Locks</a><br/><div style="padding-left:40px">
-
-<a href="#androidPowerWakeLocksDefinitions">Types of Wake Locks</a><br/>
-<a href="#androidPowerWakeLockExample">Exploring a Wake Lock Example</a><br/></div>
-<a href="#androidPowerPowerManagerClass">PowerManager class</a><br/>
-<a href="#androidPowerKernelRegistration">Registering Drivers with the PM Driver</a><br/>
-<a href="#androidPowerEarlySuspend">Early Suspend</a><br/>
-</div>
-
-<a name="androidPowerIntro"></a><h2>Introduction</h2>
-
-<p>Android supports its own Power Management (on top of the standard Linux Power Management) designed with the premise that the CPU shouldn't consume power if no applications or services require power. For more information regarding standard Linux power management, please see <a href="http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.24.y.git;a=blob;f=Documentation/pm.txt">Linux Power Management Support</a> at <a href="http://kernel.org">http://kernel.org</a>.</p>
-<p>Android requires that applications and services request CPU resources with &quot;wake locks&quot; through the Android application framework and native Linux libraries. If there are no active wake locks, Android will shut down the CPU. </p>
-<p>The image below illustrates the Android power management architecture. </p>
-<p><img src='images/androidPMArchitecture.gif'></p>
-
-Solid elements represent Android blocks and dashed elements represent partner-specific blocks.
-
-
-
-<a name="androidPowerWakeLocks"></a><h2>Wake Locks</h2>
-
-<p>Wake locks are used by applications and services to request CPU resources.</p>
-
-<p>A locked wakelock, depending on its type, prevents the system from entering suspend or other low-power states. This document describes how to employ wakelocks. </p>
-<p>There are two settings for a wakelock:</p>
-<ul>
-  <li><code>WAKE_LOCK_SUSPEND</code>: prevents a full system suspend. </li>
-  <li><code></code><code>WAKE_LOCK_IDLE</code>: low-power states, which often cause large interrupt latencies or that disable a set of interrupts, will not be entered from idle until the wakelocks are released. </li>
-</ul>
-<p>Unless the type is specified, this document refers to wakelocks of type <code>WAKE_LOCK_SUSPEND</code>. </p>
-<p>If the suspend operation has already started when locking a wakelock, the system will abort the suspend operation as long it has not already reached the <code>suspend_late</code> stage. This means that locking a wakelock from an interrupt handler or a freezeable thread always works, but if you lock a wakelock from a <code>suspend_late</code> handler, you must also return an error from that handler to abort suspend. You can use wakelocks to allow the user-space to decide which keys should wake the full system and turn on the screen. Use <code>set_irq_wake</code> or a platform-specific API to ensure that the keypad interrupt wakes up the CPU. Once the keypad driver has resumed, the sequence of events can look like this:</p>
-<ol>
-  <li> The Keypad driver receives an interrupt, locks the keypad-scan wakelock,
-    and starts scanning the keypad matrix. </li>
-  <li>The keypad-scan code detects a key change and reports it to the input-event
-    driver. </li>
-  <li>The input-event driver sees the key change, enqueues an event, and locks
-    the input-event-queue wakelock. </li>
-  <li>The keypad-scan code detects that no keys are held and unlocks the
-    keypad-scan wakelock. </li>
-  <li>The user-space input-event thread returns from select/poll, locks the
-    process-input-events wakelock, and calls read in the input-event device. </li>
-  <li>The input-event driver dequeues the key-event and, since the queue is now
-    empty, unlocks the input-event-queue wakelock. </li>
-  <li>The user-space input-event thread returns from read. It determines that the
-    key should not wake up the full system, releases the process-input-events
-    wakelock, and calls select or poll. </li>
-</ol>
-<p>The simple sequence diagram below illustrates these steps:</p>
-    <pre>
-     					Key pressed      Key released
-      					     |		      |
-      keypad-scan       		     ++++++++++++++++++++++
-      input-event-queue 			  +++ 		  +++
-      process-input-events 		            +++ 	    +++
-      </pre>
-
-<a name="driverAPI"></a><h3>Driver API</h3>
-<p>A driver can use the wakelock API by adding a wakelock variable to its state and calling <code>wake_lock_init</code>, as illustrated in the snippet below:</p>
-<pre>
-  struct state {
-  struct wakelock wakelock;
-  }
-  init() {
-  wake_lock_init(&amp;state-&gt;wakelock, WAKE_LOCK_SUSPEND, &quot;wakelockname&quot;);
-  }
-  Before freeing the memory, wake_lock_destroy must be called:
-  uninit() {
-  wake_lock_destroy(&amp;state-&gt;wakelock);
-  }
-  </pre>
-<p> When the driver determines that it needs to run (usually in an interrupt handler), it calls <code>wake_lock</code>:</p>
-<pre>
-  wake_lock(&amp;state-&gt;wakelock);
-  </pre>
-<p>When it no longer needs to run, it calls <code>wake_unlock</code>:</p>
-<pre>
-  wake_unlock(&amp;state-&gt;wakelock);
-  </pre>
-<p> It can also call <code>wake_lock_timeout</code> to release the wakelock after a delay:</p>
-<pre>
-  wake_lock_timeout(&amp;state-&gt;wakelock, HZ);
-</pre>
-<p> This works whether or not the wakelock is already held. It is useful if the driver woke up other parts of the system that do not use wakelocks but still need to run. Avoid this when possible, since it will waste power if the timeout is long or may fail to finish needed work if the timeout is short.</p>
-<a name="userspaceAPI"></a><h3>User-space API</h3>
-<p>Write <code>lockname</code> or <code>lockname timeout</code> to <code>/sys/power/wake_lock</code> lock and, if needed, create a wakelock. The timeout here is specified in nanoseconds. Write <code>lockname</code> to <code>/sys/power/wake_unlock</code> to unlock a user wakelock.</p>
-<p> Do not use randomly generated wakelock names as there is no API to free a user-space wakelock.</p>
-
-<a name="androidPowerWakeLocksDefinitions"></a><h3>Types of Wake Locks</h3>
-
-<table border=1 cellpadding=2 cellspacing=0>
-    <tbody><tr>
-        <th scope="col">Wake Lock </th>
-        <th scope="col">Description</th>
-    </tr>
-    <tr>
-      <td>ACQUIRE_CAUSES_WAKEUP<br/></td>
-        <td>Normally wake locks don't actually wake the device, they just cause it to remain on once it's already on. Think of the video player app as the normal behavior. Notifications that pop up and want the device to be on are the exception; use this flag to be like them.</td>
-    </tr>
-    <tr>
-      <td>FULL_WAKE_LOCK</td>
-      <td>Wake lock that ensures that the screen and keyboard are on at full brightness. </td>
-    </tr>
-    <tr>
-      <td>ON_AFTER_RELEASE</td>
-      <td>When this wake lock is released, poke the user activity timer so the screen stays on for a little longer.</td>
-    </tr>
-    <tr>
-      <td>PARTIAL_WAKE_LOCK</td>
-      <td>Wake lock that ensures that the CPU is running. The screen might not be on.</td>
-    </tr>
-    <tr>
-      <td>SCREEN_BRIGHT_WAKE_LOCK</td>
-      <td>Wake lock that ensures that the screen is on at full brightness; the keyboard backlight will be allowed to go off.</td>
-    </tr>
-    <tr>
-      <td>SCREEN_DIM_WAKE_LOCK</td>
-      <td>Wake lock that ensures that the screen is on, but the keyboard backlight will be allowed to go off, and the screen backlight will be allowed to go dim.</td>
-    </tr>
-</table>
-
-
-<a name="androidPowerWakeLockExample"></a><h3>Exploring a Wake Lock Example</h3>
-
-<p>All power management calls follow the same basic format:</p>
-<p><ol><li>Acquire handle to the <code>PowerManager</code> service.</li>
-<li>Create a wake lock and specify the power management flags for screen, timeout, etc.</li>
-<li>Acquire wake lock.</li>
-<li>Perform operation (play MP3, open HTML page, etc.).</li>
-<li>Release wake lock.</li>
-</ol>
-</p>
-<p>The snippet below illustrates this process.</p>
-<pre class="prettify">
-PowerManager pm = (PowerManager)mContext.getSystemService(
-                                          Context.POWER_SERVICE);
-PowerManager.WakeLock wl = pm.newWakeLock(
-                                      PowerManager.SCREEN_DIM_WAKE_LOCK
-                                      | PowerManager.ON_AFTER_RELEASE,
-                                      TAG);
-wl.acquire();
- // ...
-wl.release();
-</pre>
-
-
-<a name="androidPowerPowerManagerClass"></a><h2>PowerManager class</h2>
-
-<p>The Android Framework exposes power management to services and applications through the <code>PowerManager</code> class.</p>
-<p>User space native libraries (any hardware function in <code>//device/lib/hardware/</code> meant to serve as supporting libraries for Android runtime) should never call into Android Power Management directly (see the image above). Bypassing the power management policy in the Android runtime will destabilize the system.</p>
-<p>All calls into Power Management should go through the Android runtime PowerManager APIs.</p>
-<p> Please visit 
-<a href="http://code.google.com/android/reference/android/os/PowerManager.html">http://code.google.com/android/reference/android/os/PowerManager.html</a> for a description of the API and examples.</p>
-
-
-<a name="androidPowerKernelRegistration"></a><h2>Registering Drivers with the PM Driver</h2>
-
-<p>You can register Kernel-level drivers with the Android Power Manager driver so that they're notified immediately before power down or after power up. For example, you might set a display driver to completely power down when a request comes in to power down from the user space (see the Android MSM MDDI display driver for a sample implementation).</p>
-<p>To register drivers with the Android PM driver, implement call-back handlers and register them with the Android PM, as illustrated in the snippet below:</p>
-<pre class="prettify">
-android_register_early_suspend(android_early_suspend_t *handler)
-android_register_early_resume(android_early_resume_t *handler)
-</pre>
-<p>It is critical in a drive to return immediately and not wait for anything to happen in the call back.</p>
-
-
-<a name="androidPowerEarlySuspend"></a><h2>Early Suspend</h2>
-
-<p>The early-suspend API allows drivers to get notified when user-space writes to <code>/sys/power/request_state</code> to indicate that the user visible sleep state should change. Suspend handlers are called in order of low to high (4 - 1 below) and resume handlers are called in order of high to low (1 - 4 below).</p>
-<ol>
-  <li><code>EARLY_SUSPEND_LEVEL_BLANK_SCREEN</code>: </li>
-  <ul>
-    <li>on suspend: the screen should be turned off but the framebuffer must still be accessible. </li>
-    <li>on resume: the screen can be turned back on.</li>
-  </ul>
-  <li><code>EARLY_SUSPEND_LEVEL_STOP_DRAWING</code>:
-    <ul>
-      <li>on suspend: this level notifies user-space that it should stop accessing the framebuffer and it waits for it to complete.</li>
-      <li>on resume: it notifies user-space that it should resume screen access. Two methods are provided, console switch or a sysfs interface.</li>
-    </ul>
-  </li>
-  <li><code>EARLY_SUSPEND_LEVEL_DISABLE_FB</code>: Turn off the framebuffer
-    <ul>
-      <li>on suspend: turn off the framebuffer</li>
-      <li>on resume: turn the framebuffer back on. </li>
-    </ul>
-  </li>
-  <li><code>EARLY_SUSPEND_LEVEL_STOP_INPUT</code>:
-    <ul>
-      <li>on suspend: turn off input devices that are not capable of wakeup or where wakeup is disabled. </li>
-      <li>on resume: turn the same devices back on.</li>
-    </ul>
-  </li>
-</ol>
diff --git a/pdk/docs/guide/release_keys.jd b/pdk/docs/guide/release_keys.jd
deleted file mode 100755
index 7e83834..0000000
--- a/pdk/docs/guide/release_keys.jd
+++ /dev/null
@@ -1,82 +0,0 @@
-page.title=Creating Release Keys and Signing Builds
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div id="qv-wrapper">
-  <div id ="qv"> 
-<h2>In this document</h2>
-<a name="toc"/>
-    <ul>
-      <li><a href="#intro">Introduction</a></li>
-      <li><a href="#generatingKeys">Generating keys</a></li>
-      <li><a href="#signing">Signing a build for release</a></li>
-    </ul>
-  </div>
-</div>
-<a name="intro"></a>
-<h3>Introduction</h3>
-<p>Android requires that each application be signed with the developer's digital keys to enforce signature permissions and application request to use shared user ID or target process.  For more information on the general Android security principles and signing requirements, see the Android Security and Permissions section in the Android Developer Guide).  The core Android platform uses four keys to maintain security of core platform components:</p>
-<ul>
-  <li><strong>platform</strong>: a key for packages that are part of the core platform.</li>
-  <li><strong>shared</strong>: a key for things that are shared in the <code>home/contacts</code> process.</li>
-  <li><strong>media</strong>: a key for packages that are part of the <code>media/download</code> system.</li>
-  <li><strong>releasekey</strong>: the default key to sign with if not otherwise specified</li>
-</ul>
-<p>These keys are used to sign applications separately for release images and are not used by the Android build system.  The build system signs packages with the testkeys provided in <code>build/target/product/security/</code>.  Because the testkeys are part of the standard Android open source distribution, they should never be used for production devices.  Instead, device manufacturers should generate their own private keys for shipping release builds.</p>
-<a name="generatingKeys"></a>
-<h3>Generating keys</h3>
-<p>A device manufacturer's keys for each product should be stored under  <code>vendor/&lt;vendor_name&gt;/security/&lt;product_name&gt;</code>, where <code>&lt;vendor_name&gt;</code> and <code>&lt;product_name&gt;</code> represent the manufacturer and product names.  To simplify key creation, copy the script below to this directory in a file called <code>mkkey.sh</code>.  To customize your keys, change the line that starts with AUTH to reflect the correct information for your company:</p>
-<pre>
-#!/bin/sh
-AUTH='/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'
-if [ "$1" == "" ]; then
-        echo "Create a test certificate key."
-        echo "Usage: $0 NAME"
-        echo "Will generate NAME.pk8 and NAME.x509.pem"
-        echo "  $AUTH"
-        exit
-fi
-
-openssl genrsa -3 -out $1.pem 2048
-
-openssl req -new -x509 -key $1.pem -out $1.x509.pem -days 10000 \
-    -subj "$AUTH"
-
-echo "Please enter the password for this key:"
-openssl pkcs8 -in $1.pem -topk8 -outform DER -out $1.pk8 -passout stdin
-</pre>
-<p><code>mkkey.sh</code>  is a helper script to generate the platform's keys.  NOTE: the password you type will be visible in your terminal window.  Note the passwords you use as you will need them to sign release builds.</p>
-<p>To generate the required 4 platform keys, run <code>mkkey.sh</code> four times specifying the key name and password for each:</p>
-<pre>
-sh mkkey.sh platform # enter password
-sh mkkey.sh media # enter password
-sh mkkey.sh shared # enter password
-sh mkkey.sh release # enter password
-</pre>
-<p>You should now have new keys for your product.</p>
-<a name="signing"></a>
-<h3>Signing a build for release</h3>
-<p>Signing a build for a release is a two-step process.  </p>
-<ol>
-  <li>Sign all the individual parts of the build.</li>
-  <li>Put the parts back together into  image files.</li>
-</ol>
-<h4>Signing applications</h4>
-<p>Use <code>build/tools/releasetools/sign_target_files_apks</code> to sign a <code>target_files</code> package. The <code>target_files</code> package isn't built by default, you need to make sure to specify the "dist" target when you call make.  For example:</p>
-<pre>
-make -j4 PRODUCT-&lt;product_name&gt;-user dist
-</pre>
-<p>The command above creates a a file under <code>out/dist </code>called <code>&lt;product_name&gt;-target_files.zip</code>.  This is the file you need to pass to the <code>sign_target_files_apks</code> script.</p>
-<p>You would typically run the script like this:</p>
-<pre>
-./build/tools/releasetools/sign_target_files_apks -d vendor/&lt;vendor_name&gt;/security/&lt;product_name&gt; &lt;product_name&gt;-target_files.zip signed-target-files.zip
-</pre>
-<p>If you have prebuilt and pre-signed apk's in your build that you don't want re-signed, you must explicitly ignore them by adding <code>-e Foo.apk=</code> to the command line for each apk you wish to ignore.</p>
-<p><code>sign_target_files_apks</code> also has many other options that could be useful for signing release builds.  Run it with <code>-h</code> as the only option to see the full help.</p>
-<h4>Creating image files</h4>
-<p>Once you have <code>signed-target-files.zip</code>, create the images so you can put it onto a device with the command below:</p>
-<pre>
-build/tools/releasetools/img_from_target_files signed-target-files.zip signed-img.zip
-</pre>
-<p><code>signed-img.zip</code> contains all the <code>.img</code> files.  You can use <code>fastboot update signed-img.zip</code> to use fastboot to get them on the device.</p>
diff --git a/pdk/docs/guide/sensors.jd b/pdk/docs/guide/sensors.jd
deleted file mode 100755
index 61ca2d9..0000000
--- a/pdk/docs/guide/sensors.jd
+++ /dev/null
@@ -1,67 +0,0 @@
-page.title=Sensors
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#androidSensorsInterface">Interface</a></li>
-</ul>
-</div>
-</div>
-
-<p>Android defines a user space C abstraction interface for sensor hardware. The interface header is defined in 
-<code>hardware/libhardware/include/hardware/sensors.h</code>.
-In order to integrate sensors with Android you need to build a shared library that implements this interface. 
-
-The types of sensors currently supported by Android include:
-<ul>
-<li>Accelerometer</li>
-<li>Magnetic Field</li>
-<li>Orientation</li>
-<li>Gyroscope</li>
-<li>Light</li>
-<li>Pressure</li>
-<li>Temperature</li>
-<li>Proximity</li>
-</ul>
-</p> 
- 
-<a name="androidSensorBuildingDriver"></a><h3>Building a Sensor Library</h3>
-<p> To implement a Sensors driver, create a shared library that implements the interface defined in <code>sensors.h</code>. You must name your shared library 
-<code>libsensors.so</code> so that it will get loaded from <code>/system/lib</code> at runtime. 
-</p>
-
-<p> The following stub file, <code>Android.mk</code>, ensures that <code>libsensors</code> compiles and links to the appropriate libraries:</p>
-
-<pre>
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := sensors
-
-LOCAL_PRELINK_MODULE := false
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-
-LOCAL_SHARED_LIBRARIES := liblog
-# include any shared library dependencies
-
-LOCAL_SRC_FILES := sensors.c
-
-include $(BUILD_SHARED_LIBRARY)
-</pre>
- 
-<a name="androidSensorsInterface"></a><h3>Interface</h3> 
- 
- 
-<p><span class="lh3"><a name="androidDoxygenNote"></a></span> 
- 
-<p class="note"><strong>Note</strong>: This document relies on some Doxygen-generated content that appears in an iFrame below. To return to the Doxygen default content for this page, <a href="sensors.html">click here</a>.</p> 
- 
- 
-<iframe onLoad="resizeDoxFrameHeight();" src="sensors_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" 
-frameborder="0" style="width:100%;"></iframe> 
diff --git a/pdk/docs/guide/source_setup_guide.jd b/pdk/docs/guide/source_setup_guide.jd
deleted file mode 100755
index 83c4a01..0000000
--- a/pdk/docs/guide/source_setup_guide.jd
+++ /dev/null
@@ -1,118 +0,0 @@
-page.title=Host System Setup
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<a name="toc"/>
-<div style="padding:10px">
-<a href="#androidSourceSetupIntro">Introduction</a><br/>
-<a href="#androidSourceSetupBuildSystemSetupPackages">Installing Packages</a><br/><div style="padding-left:40px">
-
-<a href="#androidSourceSetupBuildSystemSetupRequiredPackages">Required Packages</a><br/>
-<a href="#androidSourceSetupUbuntu606Intro">Ubuntu 6.06 (Dapper)</a><br/>
-<a href="#androidSourceSetupUbuntu710Intro">Ubuntu 7.10</a><br/>
-<a href="#androidSourceSetupUbuntu804Intro">Ubuntu 8.04</a><br/></div>
-<a href="#androidSourceSetupBuildSystemSetupJavaIntro">Installing Java</a><br/></div>
-
-<a name="androidSourceSetupIntro"></a><h2>Introduction</h2>
-
-<p>This section provides instructions on how to configure your host system to build Android for mobile devices. While Android is designed as host-environment agnostic, it has been tested and is known to work on the following Linux operating system; Ubuntu 6.06 (Dapper), 7.10 (Gutsy), and 8.04. Cygwin is not recommended. </p>
-
-
-<a name="androidSourceSetupBuildSystemSetupPackages"></a><h2>Installing Packages</h2>
-
-
-
-<a name="androidSourceSetupBuildSystemSetupRequiredPackages"></a><h3>Required Packages</h3>
-
-<p>Android requires the following system packages:</p>
-<p><ul>
-<li>flex: This lexical analyzer generator is used to read a given input file for a description of a scanner to generate.</li>
-<li>bison: This is a general-purpose parser generator.</li>
-<li>gperf: This is a perfect hash function generator.</li>
-<li>libesd0-dev: This enlightened sound daemon (dev files) is used to mix digitized audio streams for playback by a single device.</li>
-<li>libwxgtk2.6-dev: This package provides GUI components and other facilities for many different platforms.</li>
-<li>build-essential: This package contains a list of packages considered fundamental to building Debian packages.</li>
-</ul></p>
-
-
-<a name="androidSourceSetupUbuntu606Intro"></a><h3>Ubuntu 6.06 (Dapper)</h3>
-
-<p>On a clean Dapper system, type the following:</p>
-<pre class="prettyprint">
-% sudo apt-get install flex bison gperf libesd0-dev libwxgtk2.6-dev zlib1g-dev 
-   build-essential
-</pre>
-<p>This snippet includes an artificial line break to maintain a print-friendly document.</p>
-
-
-<a name="androidSourceSetupUbuntu710Intro"></a><h3>Ubuntu 7.10</h3>
-
-<ol><li>The libwxgtk2.6-dev package will only work if the following code is included in your  /etc/apt/source file.
-<p><pre class="prettyprint">
-## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
-## team, and may not be under a free license. Please satisfy yourself as to
-## your rights to use the software. Also, please note that software in
-## universe WILL NOT receive any review or updates from the Ubuntu security
-## team.
-# Line commented out by installer because it failed to verify:
-deb http://us.archive.ubuntu.com/ubuntu/ gutsy universe
-# Line commented out by installer because it failed to verify:
-deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy universe
-# Line commented out by installer because it failed to verify:
-deb http://us.archive.ubuntu.com/ubuntu/ gutsy-updates universe
-# Line commented out by installer because it failed to verify:
-deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-updates universe
-</pre></p></li>
-<li>Install required packages with the following command:
-<p><pre class="prettyprint">
-% sudo apt-get install flex bison gperf libesd0-dev libwxgtk2.6-dev zlib1g-dev
-   build-essential
-</pre></p>
-This snippet includes an artificial line break to maintain a print-friendly document.
-</li>
-<li>
-<p>Install the X11 development environment with the following commands:</p>
-<p><pre class="prettyprint">
-% sudo apt-get install x-dev
-% sudo apt-get install libx11-dev
-% sudo apt-get install libncurses5-dev
-</pre></p>
-</li>
-</ol>
-
-
-<a name="androidSourceSetupUbuntu804Intro"></a><h3>Ubuntu 8.04</h3>
-
-<p>On a clean system, type the following:</p>
-<pre class="prettify">
-% sudo apt-get install flex bison gperf libesd0-dev libwxgtk2.6-dev
-zlib1g-dev build-essential
-% sudo apt-get install x-dev
-% sudo apt-get install libx11-dev
-% sudo apt-get install libncurses5-dev
-% sudo apt-get install sun-java5-jdk
-</pre>
-
-
-<a name="androidSourceSetupBuildSystemSetupJavaIntro"></a><h2>Installing Java</h2>
-
-<p>Android source code includes a hard dependency on the Java Developer Kit (JDK) 5.0 Update 12 or greater. The specific file name of the Update 12 package is <code>jdk-1_5_0_12-linux-i586.bin</code>. To download this version of the Java JDK:</p>
-<p><ol>
-<li>Navigate to: <a href="http://java.sun.com/products/archive/">http://java.sun.com/products/archive/</a>.</li>
-<li>Select '5.0 Update 12' from the 'Java 2 Platform Standard Edition (J2SE)' -> 'JDK/JRE - 5.0' field and click 'Go.'</li>
-<li>Click 'Download JDK.'</li>
-<li>In the 'Linux Platform' section, click 'Linux self-extracting file' associated with the jdk-1_5_0_12-linux-i586.bin package.</li>
-<li>Follow the installation instructions.</li>
-</ol>
-</p>
-
-<p>Once you have cleanly installed the JDK, modify your PATH environment variable to include <code>&lt;jdk-install-dir&gt;/jdk1.5.0_12/bin</code> at its beginning so that Dapper will use the correct installation. </p>
-<p><b>Ubuntu 7.10</b></p>
-<p>An alternative method to quickly install Java is to enable multiverse repo in <code>/etc/apt/sources.list</code> and then execute:</p>
-<pre class="prettyprint">
-% sudo apt-get install sun-java5-jdk
-</pre>
-
-
-
diff --git a/pdk/docs/guide/stk.jd b/pdk/docs/guide/stk.jd
deleted file mode 100755
index 4f68c48..0000000
--- a/pdk/docs/guide/stk.jd
+++ /dev/null
@@ -1,508 +0,0 @@
-page.title=Sim Toolkit Application (STK)
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#androidSTKRILRilUp">Communication from the RIL up</a></li>
-<li><a href="#androidSTKRILApplciationDown">Communication from the application down</a></li>
-<li><a href="#androidSTKTelephony">Telephony</a></li>
-<li><a href="#androidSTKFeatureList">Feature List</a></li>
-</ul>
-</div>
-</div>
-
-
-<p>This document offers a high-level overview of the SIM Toolkit Application for Android 1.0 and is primarily of interest for implementors of the Radio Interface Layer (RIL). The STK is  R96 compatible (3GPP TS 11.14 v5.9.0) and complies partially with R99 (3GPP TS 101.267 v8.17.0). See the <a href="#androidSTKFeatureList">STK Feature List</a> for the complete feature list. </p>.
-<p>The Android STK implementation includes three layers:</p> 
-<ul> 
-  <li> STK RIL: Low-level layer provided by the vendor plus <code>libril</code>.</li> 
-  <li>STK Telephony: Protocol translation layer that converts raw messages provided by the STK RIL to application level messages.</li> 
-  <li>STK Application: Provides the user interface interactions needed by the STK.</li> 
-</ul> 
-<p align="left"><br /> 
-    <img src="images/stk.gif" alt="STK schema" width="566" height="516" /><br /> 
-</p> 
-<p> The Sim Toolkit communication flow is bi-directional and commands can originate from the <code>STK RIL</code> packaged in <code>RIL_UNSOL_STK_PROACTIVE_COMMAND</code>, <code>RIL_UNSOL_STK_EVENT_NOTIFY</code>, <code>RIL_UNSOL_REFRESH</code> and <code>RIL_UNSOL_STK_SESSION_END</code> messages.</p> 
-<p align="left">Commands originating from the STK App or STK Telephony layers are packaged in <code>RIL_REQUEST_STK_SEND_TERMINAL_REPSONSE</code>, <code>RIL_REQUEST_SEND_ENVELOPE_COMMAND</code> or <code>RIL_REQUEST_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM</code>.</p> 
-<p align="left">For commands sent or recieved by the STK RIL, it's not necessary to remove unused sub-commands because the upper layers will gracefully ignore unused information contained in the message. The content of each message is encoded in the BER-TLV format except for two:</p> 
-<ul> 
-  <li><code>RIL_UNSOL_STK_SESSION_END</code>: has no data </li> 
-  <li><code>RIL_REQUEST_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM</code>: has a single byte of data that indicates accept/reject.</li> 
-</ul> 
-<p>See the <a href="http://pdk-docs.prom.corp.google.com/docs/telephony.html">Android Platform Development Kit</a> for details.</p> 
- 
- 
-<a name="androidSTKRILRilUp"></a><h4>Communication from the RIL up</h4> 
- 
-<p>Communication to the upper layers is done using the <code>RIL_UNSOL_xxx</code> family of commands defined in <code>/hardware/ril/include/ril.h</code>. The payload for each command is encoded using BER-TLV. As stated above, it is not necessary to remove extraneous fields. This allows the SIM to pass a complete command to the upper layers and simplifies STK RIL code. Below is the mapping from RIL_UNSOL_xxx commands to the SIM commands.</p> 
- 
- 
-<a name="androidSTKRILRilUpUnsol"></a><h4>RIL_UNSOL_STK_PROACTIVE_COMMAND</h4> 
- 
-<p> The Sim Toolkit communication flow is bi-directional and commands can originate from the <code>STK RIL</code> packaged in <code>RIL_UNSOL_STK_PROACTIVE_COMMAND</code>, <code>RIL_UNSOL_STK_EVENT_NOTIFY</code>, <code>RIL_UNSOL_REFRESH</code> and <code>RIL_UNSOL_STK_SESSION_END</code> messages.</p> 
- 
- 
-<a name="androidSTKRILRilUpDisplay"></a><h5>DISPLAY TEXT (6.4.1)</h5> 
- 
-<p>This command is handled by <code>StkDialogActivity</code>. If the immediate response flag is set, the terminal response is sent with an "OK" <code>(0x00)</code> result code when the message is first received. Otherwise the terminal response is sent when the dialog is dismissed either from user action or it times out.</p> 
-<p>The user sees a dialog box with a message and / or icon, an OK button, and a Cancel button.</p> 
-<p>Terminal responses include:</p> 
-<ul> 
-  <li> "OK" (0x00)</li> 
-  <li> "Session terminated by user" (0x10)</li> 
-  <li> "Backward move by user" (0x11)</li> 
-  <li> "No response from user" (0x12)</li> 
-</ul> 
- 
-<img src="images/stk_display_text.gif" border="1"> 
- 
- 
-<a name="androidSTKRILRilUpGetInKey"></a><h5>GET IN KEY (6.4.2)</h5> 
- 
-<P>This command is processed by <code>StkInputActivity</code>. It displays a dialog box with a prompt and or an icon and yes and no buttons.</p> 
-<p>Terminal responses include:</p> 
-<p> 
-<ul> 
-  <li> “OK” (0x00) with “Yes” or “No” as the response text</li> 
-  <li> “Session terminated by user” (0x10) << Currently not supported</li> 
-  <li> “Backward move by user” (0x11)</li> 
-  <li> “No response from user” (0x12)</li> 
-</ul> 
-</p> 
- 
- 
-<a name="androidSTKRILRilUpGetInput"></a><h5>GET INPUT (6.4.3)</h5> 
- 
-<p>This command is handled by <code>StkInputActivity</code>. 
-<p>The user sees a dialog box with a prompt and / or an icon, a text box with optional default text, and an OK button. 'digits only,' 'min,' 'max,' and 'hidden' modes are all supported.
-<p>Terminal responses include:</p> 
-	<ul> 
-	  <li>OK” (0x00) if the input criteria is met	</li> 
-      <li>“Session terminated by user” (0x10) << Currently not supported	</li> 
-      <li>“Backward move by user” (0x11)        </li> 
-      <li>“No response from user” (0x12) </li> 
-</ul> 
- 
- 
-<a name="androidSTKRILRilUpPlayTone"></a><h5>PLAY TONE (6.4.5)</h5> 
- 
-<p>This command is processed by <code>ToneDialog</code>.</p> 
-<p>The user sees a dialog box with a prompt for the duration of the tone or until the user presses the back key.</p> 
-<p>Terminal responses include:</p> 
-	<ul> 
-	  <li>"OK" (0x00) if the tone is played to completion	</li> 
-      <li>“Session terminated by user” (0x10)  if back button is pressed </li> 
-</ul> 
- 
- 
-<a name="androidSTKRILRilUpSetMenu"></a><h5>SET UP MENU (6.4.8)</h5> 
- 
-<p>This command is processed by <code>StkAppService</code>. It installs the STK ICON on the home page and prepares the Main menu for use when the ICON is selected. Typically this is the first RIL unsolicited command and should not be sent until after the <code>RIL_RadioFunctions.getVersion</code> routine is called.</p> 
-<p>Terminal reponses:</p> 
-<ul> 
-  <li>“OK” (0x00) </li> 
-</ul> 
-<p>At a later time, the STK ICON will be selected and <code>StkMenuActivity</code> will launch and display the Main menu to the user. If an item is selected, it will be returned to the RIL in <code>RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND</code> with the item id. If no item is selected, the <code>StkMenuActivity</code> will receive a timeout message and return to the Main menu and no message will be sent to the RIL.</p> 
-<p>Depending upon what item is selected, the SIM may perform another action, such as sending another set of menu items via a SELECT ITEM command or performing an action like send an SMS or text display. </p> 
- 
- 
-<a name="androidSTKRILRilUpSelectItem"></a><h5>SELECT ITEM (6.4.9)</h5> 
- 
-<p>This command is processed by <code>StkMenuActivity</code>. Instead of displaying the Main menu, the list of menu items provided in this command are displayed.</p> 
-<p>Terminal responses:
-<ul> 
-  <li> “OK” (0x00)    </li> 
-</ul> 
-<p>The command then proceeds as in the SETUP MENU. </p> 
- 
- 
-<a name="androidSTKRILRilUpSetIdle"></a><h5>SET UP IDLE MODE TEXT (6.4.22)</h5> 
- 
-<p><code>StkAppService</code> displays the message and or icon as an Android notification.</p> 
-<p>Terminal responses include:</p> 
-	<ul> 
-	  <li>OK” (0x00)</li> 
-</ul> 
- 
- 
-<a name="androidSTKRILRilUpLaunchBrowser"></a><h5>LAUNCH BROWSER (6.4.26)</h5> 
- 
-<p>This command is initially handled by <code>StkDialogActivity</code> and presents the user with a confirmation dialog, a URL, and OK, and cancel buttons. If the user presses OK, the browser is launched using the URL.</p> 
-<p>Terminal responses include:</p> 
-	<ul> 
-	  <li>“OK” (0x00) the browser has been launched	    </li> 
-      <li>“Session terminated by user” (0x10) </li> 
-      <li>“Backward move by user” (0x11)</li> 
-      <li>“No response from user” (0x12)</li> 
-</ul> 
- 
- 
-<a name="androidSTKRILRilUpEvent"></a><h4>RIL_UNSOL_STK_EVENT_NOTIFY</h4> 
- 
-<p align="left">The commands in this section are proactive in nature. They are handled by the STK RIL and the upper layers and delivered using <code>RIL_UNSOL_STK_EVENT_NOTIFY</code> message. This distinction is an implementation detail of Android and is not defined in the 3GPP sepcifications.</p> 
-<p align="left">The upper layers handle the UI and the STK RIL handles all other aspects of each command, which means that the STK RIL sends the terminal response (it is never sent by the STK App). Each command must be a properlery-formed proactive command. It is not necessary to remove unused fields. The behavior of any other command <em>within this context </em>sent by <code>RIL_UNSOL_STK_EVENT_NOTIFY</code> is undefined. See Event Notify Command Details. </p> 
-<ul> 
-  <li>SEND SMS (6.4.10) – no response</li> 
-  <li>SEND SS (6.4.11) – no response</li> 
-  <li>SEND USSD (6.4.12) – no response</li> 
-  <li>SET UP CALL (6.4.13) – responds with <code>RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM</code></li> 
-  <li>SEND DTMF (6.4.24) – no response</li> 
-</ul> 
- 
-<img src="images/stk_send_SMS.gif"> 
- 
- 
-<a name="androidSTKRILRilUpUnsolSim"></a><h4>RIL_UNSOL_SIM_REFRESH</h4> 
- 
-<p> Used to send the <code>REFRESH</code> command. No response.</p> 
- 
- 
-<a name="androidSTKRILRilUpRefresh"></a><h4>REFRESH (6.4.7)</h4> 
- 
-<p><code>RIL_UNSOL_STK_SESSION_END</code></p> 
-<p>Sent by the SIM to signal the end of a session. No content and no response.</p> 
-<P><img src="images/stk_refresh_init.gif"></p>
-<p><img src="images/stk_refresh_update.gif"> </p>
-<p><img src="images/stk_refresh_reset.gif"> </p>
- 
- 
- 
-<a name="androidSTKRILRilUpRilUnsol"></a><h4>RIL_UNSOL_STK_SESSION_END</h4> 
- 
-<p>Sent by SIM to signal end of session. No content and no response.</p> 
- 
- 
-<a name="androidSTKRILApplciationDown"></a><h4>Communication from the application down</h4> 
- 
-<p>Communication from the upper layers to the RIL uses the commands below (defined in <code>ril.h</code>):</p> 
- 
- 
-<a name="androidSTKRILApplciationDownTerminal"></a><h4>RIL_REQUEST_STK_SEND_TERMINAL_REPSONSE</h4> 
- 
-<p> Used to send a terminal response for commands sent via <code>RIL_UNSOL_STK_PROACTIVE_COMMAND</code>. </P> 
-<P>Contents include TERMINAL RESPONSE (6.8).</p> 
- 
- 
-<a name="androidSTKRILApplciationDownEnvelope"></a><h4>RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND</h4> 
- 
-<p>Used to send information from to SIM encoded as BER-TLV tags (see R96  section 13). Two tags are supported:</p> 
-<ul> 
-  <li> BER_MENU_SELECTION_TAG (0xd3); Contents: MENU SELECTION (8)</li> 
-  <li>BER_EVENT_DOWNLOAD_TAG (0xd6); Contents: EVENT DOWNLOAD Language selection (11.8)</li> 
-</ul> 
-<P>Content for these tags include:
-<ul> 
-  <li>MENU SELECTION (8)</li> 
-  <li>EVENT DOWNLOAD Language selection (11.8)</li> 
-</ul> 
- 
- 
- 
-<a name="androidSTKRILApplciationDownFromSim"></a><h4>RIL_REQUEST_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM</h4> 
- 
-<p>Returns a single-byte parameter:</p> 
-<ul> 
-  <li>1: accepted</li> 
-  <li>0: not accepted</li> 
-</ul> 
-<p> This should cause the terminal response to be sent to the SIM.</p> 
- 
- 
-<a name="androidSTKTelephony"></a><h3>Telephony</h3> 
- 
-<p>STK Telephony is a protocol translation layer used to convert messages from BERL-TLV format to Application messages and back. </p> 
-<p>On the STK RIL side, STK Telphony receives raw buffer messages from RIL I/F and decodes them into a command parameters container before passing them on to the application. On the Application side, this layer receives application responses for commands and encodes them into raw buffer messages, which then get sent over the RIL I/F back to the SIM card.</p> 
- 
- 
-<a name="androidSTKFeatureList"></a><h3>Feature List</h3> 
- 
-<table border="1" cellspacing="2" cellpadding="2"> 
-  <tr> 
-    <td><p align="center"><strong>Feature</strong></p></td> 
-    <td><p align="center"><strong>Support</strong></p></td> 
-    <td><p align="center"><strong>Implemented by</strong></p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>PROFILE   DOWNLOAD - before radio turn-on</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>SET UP   MENU</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">ME</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom" u1:str="SELECT ITEM "><p>SELECT   ITEM&nbsp;</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">ME</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>GET INPUT</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">ME</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>GET INKEY</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">ME</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>DISPLAY   TEXT</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">ME</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom" u1:str="SET UP IDLE MODE TEXT   "><p>SET UP   IDLE MODE TEXT&nbsp;&nbsp;&nbsp;</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">ME</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom" u1:str="SEND SHORT MESSAGE "><p>SEND   SHORT MESSAGE&nbsp;</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband – ME</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom" u1:str="SEND SS "><p>SEND   SS&nbsp;</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband – ME</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>SEND USSD</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband – ME</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>SEND DTMF</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband – ME</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>LAUNCH   BROWSER</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">ME</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>SET UP   CALL</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband – ME</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>PLAY TONE</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">ME</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>POLL   INTERVAL</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>POLLING   OFF</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom" u1:str="TIMER MANAGEMENT "><p>TIMER   MANAGEMENT&nbsp;</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>MORE TIME</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>PROVIDE   LOCAL INFORMATION (MCC, MNC, LAC, Cell ID &amp; IMEI)</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>PROVIDE   LOCAL INFORMATION (NMR)</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>PROVIDE   LOCAL INFORMATION (Timing Advance)</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>PROVIDE   LOCAL INFORMATION(battery state)</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>PROVIDE   LOCAL INFORMATION (IMEISV)</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>PROVIDE   LOCAL INFORMATION (NMR(UTRAN))</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>PROVIDE   LOCAL INFORMATION (Search Mode change)</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>REFRESH</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">ME</p></td> 
-  </tr> 
-  
-  <tr> 
-    <td nowrap="nowrap" valign="bottom" u1:str="SET UP EVENT LIST "><p>SET UP   EVENT LIST&nbsp;</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband – ME</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>Event: MT   call</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>Event:   Call connected (all modes)</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>Event:   Call disconnected (all modes)</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>Event:   Idle screen available</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>Event:   Browser termination</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom" u1:str="Event: Location status "><p>Event:   Location status&nbsp;</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>Event:   Data available</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>Event:   Channel status</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>Event:   Access Technology changed</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>Event:   Local Connection</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>Event:   Network Search Mode Change</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>GET   READER STATUS</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>POWER ON   CARD</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>POWER OFF   CARD</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>PERFORM   CARD ADPU</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>RUN AT   COMMAND</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>OPEN   CHANNEL</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom" u1:str="CLOSE CHANNEL "><p>CLOSE   CHANNEL&nbsp;</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>RECEIVE   DATA</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>SEND DATA</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>GET   CHANNEL STATUS</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>CALL   CONTROL BY SIM</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>SMS-PP   data download</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>SMS-CB   data download</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">Baseband</p></td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom" u1:str="BIP over GPRS "><p>BIP over   GPRS&nbsp;</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>BIP over   USB</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom" u1:str="Text Attributes  "><p>Text   Attributes&nbsp;&nbsp;</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">NO</p></td> 
-    <td nowrap="nowrap" valign="bottom">&nbsp;</td> 
-  </tr> 
-  <tr> 
-    <td nowrap="nowrap" valign="bottom"><p>Color   icons</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">YES</p></td> 
-    <td nowrap="nowrap" valign="bottom"><p align="center">ME</p></td> 
-  </tr> 
-</table> 
diff --git a/pdk/docs/guide/system_requirements.jd b/pdk/docs/guide/system_requirements.jd
deleted file mode 100755
index 0077447..0000000
--- a/pdk/docs/guide/system_requirements.jd
+++ /dev/null
@@ -1,60 +0,0 @@
-page.title=Device Requirements
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<p>While Android is designed to support a wide variety of hardware platforms and configurations, this section provides recommended minimum device requirements.</p>
-<table border=1 cellpadding=2 cellspacing=0>
-    <tbody><tr>
-      <th scope="col">Feature</th>
-        <th scope="col">Minimum Requirement</th>
-        <th scope="col">Notes</th>
-    </tr>
-	<tr>
-	  <td>Chipset</td>
-	  <td>ARM-based</td>
-	  <td>For the first release, Android is primarily targeted towards mobile handsets and portions of the platform, such as Dalvik VM graphics processing, currently assume an ARM architecture.</td>
-	</tr>
-	<tr>
-	  <td>Memory</td>
-	  <td>128 MB RAM; 256 MB Flash External</td>
-	  <td>Android can boot and run in configurations with less memory, but it isn't recommended.</td>
-	  </tr>
-	<tr>
-	  <td>Storage</td>
-	  <td>Mini or Micro SD </td>
-	  <td>Not necessary for basic bring up, but recommended.</td>
-	  </tr>
-	<tr>
-	  <td>Primary Display </td>
-	  <td>HVGA required</td>
-	  <td>The current Android interface targets a touch-based HVGA resolution display with a touch-interface no smaller than 2.8 inches in size. However, smaller displays will suffice for initial porting.</td>
-	  </tr>
-	<tr>
-	  <td>Navigation Keys </td>
-	  <td>5-way navigation with 5 application keys, power, camera and volume controls</td>
-	  <td>&nbsp;</td>
-	  </tr>
-	<tr>
-	  <td>Camera</td>
-	  <td>2MP CMOS</td>
-	  <td>Not required for basic bring up. </td>
-	  </tr>
-	<tr>
-	  <td>USB</td>
-	  <td>Standard mini-B USB interface</td>
-	  <td>Android uses the USB interface for flashing the device system images and debugging a running device.</td>
-	  </tr>
-	<tr>
-	  <td>Bluetooth</td>
-	  <td>1.2 or 2.0 </td>
-	  <td>Not required for initial bring up.</td>
-	  </tr>
-</tbody>
-</table>
-<p>If available, your Android device can also benefit from the following optional device characteristics:</p>
-<ul>
-  <li>QWERTY keyboard</li>
-  <li>WiFi</li>
-  <li>GPS</li>
-</ul>
diff --git a/pdk/docs/guide/tcpdump.jd b/pdk/docs/guide/tcpdump.jd
deleted file mode 100755
index 01f77bb..0000000
--- a/pdk/docs/guide/tcpdump.jd
+++ /dev/null
@@ -1,90 +0,0 @@
-page.title=Debugging with tcpdump and other tools
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-
-<a name="toc"/>
-<div style="padding:10px">
-  <a href="#installing">Installing tcpdump</a><BR>
-  <a href="#running">Running tcpdump</a><br/>
-  <a href="#other">Other network debugging commands</a><br/>
-</div>
-
-<a name="installing"></a>
-<h3>Installing tcpdump</h3>
-<h4>Pushing the binary to an existing device</h4>
-<p>Download tcpdump from <a href="http://www.tcpdump.org/">http://www.tcpdump.org/</a>, then execute:</p>
-<pre>
-adb root
-adb remount
-adb push /wherever/you/put/tcpdump /system/xbin/tcpdump
-adb shell chmod 6755 /data/local/tmp/tcpdump
-</pre>
-<h4>Including tcpdump in the build image</h4>
-<p>If you are running your own build, execute:</p>
-<pre>
-mmm external/tcpdump  # install the binary in out/.../system/xbin
-make snod             # build a new system.img that includes it
-</pre>
-<p>Flash the device as usual, for example, <code>fastboot flashball</code>.</p>
-<p>If you want to build tcpdump by default, add <code>CUSTOM_TARGETS += tcpdump</code> to your <code>buildspec.mk</code>.</p>
-<h3><a name="running"></a>Running tcpdump</h3>
-<p>You need to have root access on your device. </p>
-<h4>Batch mode capture</h4>
-<p>The typical procedure is to capture packets to a file and then examine the file on the desktop, as illustrated below:</p>
-<pre>
-adb shell tcpdump -i any -p -s 0 -w /sdcard/capture.pcap
-# "-i any": listen on any network interface
-# "-p": disable promiscuous mode (doesn't work anyway)
-# "-s 0": capture the entire packet
-# "-w": write packets to a file (rather than printing to stdout)
-
-   ... do whatever you want to capture, then ^C to stop it ...
-
-adb pull /sdcard/capture.pcap .
-sudo apt-get install wireshark  # or ethereal, if you're still on dapper
-wireshark capture.pcap          # or ethereal
-
-   ... look at your packets and be wise ...
-</pre>
-<p>You can run <code>tcpdump</code> in the background from an interactive shell or from Terminal. By default, <code>tcpdump</code> captures all traffic without filtering. If you prefer, add an expression like port 80 to the <code>tcpdump</code> command line.</p>
-<h4>Real time packet monitoring</h4>
-<p>Execute the following if you would like to watch packets go by rather than capturing them to a file (<code>-n</code> skips DNS lookups. <code>-s 0</code> captures the entire packet rather than just the header):</p>
-<pre>
-adb shell tcpdump -n -s 0
-</pre>
-<p>Typical <code>tcpdump</code> options apply. For example, if you want to see HTTP traffic:</p>
-<pre>
-adb shell tcpdump -X -n -s 0 port 80
-</pre>
-<p>You can also monitor packets with <code>wireshark</code> or <code>ethereal</code>, as shown below:</p>
-<pre>
-# In one shell, start tcpdump.
-adb shell "tcpdump -n -s 0 -w - | nc -l -p 11233"
-
-# In a separate shell, forward data and run ethereal.
-adb forward tcp:11233 tcp:11233 && nc 127.0.0.1 11233 | ethereal -k -S -i -
-</pre>
-<p>Note that you can't restart capture via <code>ethereal</code>. If anything goes wrong, you will need to rerun both commands.</p>
-<p>For more immediate output, add <code>-l</code> to the <code>tcpdump</code> command line, but this can cause <code>adb</code> to choke (it helps to use a nonzero argument for <code>-s</code> to limit the amount of data captured per packet; <code>-s 100</code> is sufficient if you just want to see headers).</p>
-<h4>Disabling encryption</h4>
-<p>If your service runs over <code>https</code>, <code>tcpdump</code> is of limited use. In this case, you can rewrite some service URLs to use <code>http</code>, for example:</p>
-<pre>
-vendor/google/tools/override-gservices url:calendar_sync_https_proxy \
-  https://www.google.com/calendar rewrite http://android.clients.google.com/proxy/calendar
-</pre>
-<h3><a name="other"></a>Other network debugging commands</h3>
-<h4>On the device:</h4>
-<ul>
-  <li><code>ifconfig interface</code>: note that unlike Linux, you need to give <code>ifconfig</code> an argument</li>
-  <li><code>netcfg</code>: lists interfaces and IP addresses</li>
-  <li><code>iftop</code>: like top for network</li>
-  <li><code>route</code>: examine the routing table</li>
-  <li><code>netstat</code>: see active network connections</li>
-  <li><code>nc</code>: <code>netcat</code> connection utility</li>
-</ul>
-<h4>On the desktop:</h4>
-<ul>
-  <li> <code>curl</code>: fetch URLs directly to emulate device requests</li>
-</ul>
diff --git a/pdk/docs/guide/telephony.jd b/pdk/docs/guide/telephony.jd
deleted file mode 100755
index 2004e63..0000000
--- a/pdk/docs/guide/telephony.jd
+++ /dev/null
@@ -1,230 +0,0 @@
-page.title=Radio Layer Interface
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#androidTelephonyRILInitialization">RIL Initialization</a></li>
-<li><a href="#androidTelephonyRILIntro">RIL Interaction</a></li>
-<li><a href="#androidTelephonyRILImplementing">Implementing the RIL</a></li>
-<li><a href="#androidTelephonyRILFunctions">RIL Functions</a></li>
-</ul>
-</div>
-</div>
-
-<p>Android's Radio Interface Layer (RIL) provides an abstraction layer between Android telephony services (<a href="http://code.google.com/android/reference/android/telephony/package-descr.html">android.telephony</a>) and radio hardware. The RIL is radio agnostic, and includes support for Global System for Mobile communication (GSM)-based radios.&nbsp;</P>
-
-
-<p>The diagram below illustrates the RIL in the context of Android's Telephony system architecture.</p>
-<p><img src="images/telephony.gif"></p>
-
-Solid elements represent Android blocks and dashed elements represent partner-specific blocks.
-
-<p>The RIL consists of two primary components:</p>
-<p><ul>
-<li><b>RIL Daemon</b>: The RIL daemon initializes the Vendor RIL, processes all communication from Android telephony services, and dispatches calls to the Vendor RIL as solicited commands.</li>
-<li><b>Vendor RIL</b>: The radio-specific Vendor RIL of <code>ril.h</code> that processes all communication with radio hardware and dispatches calls to the RIL Daemon (<code>rild</code>) through unsolicited commands.</li>
-</ul>
-</p>
-
-
-<a name="androidTelephonyRILInitialization"></a><h3>RIL Initialization</h3>
-
-<p>Android initializes the telephony stack and the Vendor RIL at startup as described in the sequence below:</p>
-<p><ol>
-<li>RIL daemon reads <code>rild.lib</code> path and <code>rild.libargs</code> system properties to determine the Vendor RIL library to use and any initialization arguments to provide to the Vendor RIL</li>
-<li>RIL daemon loads the Vendor RIL library and calls <code>RIL_Init</code> to initialize the RIL and obtain a reference to RIL functions</li>
-<li>RIL daemon calls <code>RIL_register</code> on the Android telephony stack, providing a reference to the Vendor RIL functions</li></ol>
-</p>
-<p>See the RIL Daemon source code at <code>//device/commands/rild/rild.c</code> for details.</p>
-<p><b>System Properties</b></p>
-<p>The following RIL-related system properties are set by the RIL library:</p>
-<p><ul>
-<li><code>ro.ril.ecclist</code>: list of valid Emergency Call Codes, for example, 911. Values are read from <code>EF_ECC</code> on the SIM and possibly supplmented by tables based on operator, network, or manufacturing code.</li></ul></p>
-
-<p>The following RIL_related system properties are available to the RIL library:</p>
-<p><ul>
-<li><code>ro.ril.hsxpa</code>: inidcates <code>hsxpa</code> support of target network.</li>
-<li><code>ro.ril.gprsclass</code>: inidcates GPRS class of target network.</li>
-<li><code>ro.ril.enable.3g.prefix=1</code>: adds the 3G prefix to the operator name.</li>
-</ul></p>
-
-<a name="androidTelephonyRILIntro"></a><h3>RIL Interaction</h3>
-
-<p>There are two forms of communication that the RIL handles:</p>
-<ul>
-  <li>Solicited commands: Solicited commands originated by RIL lib, such as <code>DIAL</code> and <code>HANGUP</code>.</li>
-  <li>Unsolicited responses: Unsolicited responses that originate from the baseband, such as <code>CALL_STATE_CHANGED</code> and <code>NEW_SMS</code>.</li>
-</ul>
-
-
-<a name="androidTelephonyRILSolicited"></a><h4>Solicited</h4>
-
-<p>The following snippet illustrates the interface for solicited commands:</p>
-<pre class="prettify">
-void OnRequest (int request_id, void *data, size_t datalen, RIL_Token t);&#13;
-void OnRequestComplete (RIL_Token t, RIL_Error e, void *response, size_t responselen);&#13;
-</pre>
-<p>There are over sixty solicited commands grouped by the following families:</p>
-<p>
-<ul>
-  <li>SIM PIN, IO, and IMSI/IMEI (11)</li>
-  <li>Call status and handling (dial, answer, mute&hellip;) (16)</li>
-  <li>Network status query (4)</li>
-  <li>Network setting (barring, forwarding, selection&hellip;) (12)</li>
-  <li>SMS (3)</li>
-  <li>PDP connection (4)</li>
-  <li>Power and reset (2)</li>
-  <li>Supplementary Services (5)</li>
-  <li>Vendor defined and support (4)<br/>
-                    </li>
-</ul>
-</p>
-<p>The following diagram illustrates a solicited call in Android.</p>
-<p><img src="images/telephony_solicted_example.gif"></p>
-
-
-<a name="androidTelephonyRILUnsolicited"></a><h4>Unsolicited</h4>
-
-<p>The following snippet illustrates the interface for unsolicited commands:</p>
-<pre class="prettify">
-void OnUnsolicitedResponse (int unsolResponse, void *data, size_t datalen);
-</pre>
-<p>There are over ten unsolicited commands grouped by the following families:</p>
-<p>
-<ul>
-<li>Network status changed (4)</li>
-<li>New SMS notify (3)</li>
-<li>New USSD notify (2)</li>
-<li>Signal strength or time changed (2)</li>
-</ul>
-</p>
-<p>The following diagram illustrates an unsolicited call in Android.</p>
-<p><img src="images/telephony_unsolicted_example.gif"></p>
-
-
-<a name="androidTelephonyRILImplementing"></a><h3>Implementing the RIL</h3>
-
-<p>To implement a radio-specific RIL, create a shared library that implements a set of functions required by Android to process radio requests. The required functions are defined in the RIL header (<code>/include/telephony/ril.h</code>).</p>
-<p>The Android radio interface is radio-agnostic and the Vendor RIL can use any protocol to communicate with the radio.&nbsp;Android provides a reference Vendor RIL, using the Hayes AT command set, that you can use as a quick start for telephony testing and a guide for commercial vendor RILs. The source code for the reference RIL is found at <code>/commands/reference-ril/</code>.</p>
-<p>Compile your Vendor RIL as a shared library using the convention <code>libril-&lt;companyname&gt;-&lt;RIL version&gt;.so</code>, for example, libril-acme-124.so, where:</p>
-<p><ul>
-<li><b>libril</b>: all vendor RIL implementations start with 'libril'</li>
-<li><b>&lt;companyname&gt;</b>: a company-specific abbreviation</li>
-<li><b>&lt;RIL version&gt;</b>: RIL version number</li>
-<li><b>so</b>: file extension</li>
-</ul>
-</p>
-
-
-<a name="androidTelephonyRILInit"></a><h4>RIL_Init</h4>
-
-<p>Your Vendor RIL must define a RIL_Init function that provides a handle to the functions which will process all radio requests.  RIL_Init will be called by the Android RIL Daemon at boot time to initialize the RIL.</p>
-
-<pre class="prettify">
-RIL_RadioFunctions *RIL_Init (RIL_Env* env, int argc, char **argv);
-</pre>
-
-<p>RIL_Init should return a RIL_RadioFunctions structure containing the handles to the radio functions:</p>
-<pre class="prettify">
-type structure {
-	int RIL_version;
-	RIL_RequestFunc onRequest;
-	RIL_RadioStateRequest onStateRequest;      
-	RIL_Supports supports;
-	RIL_Cancel onCancel;
-	RIL_GetVersion getVersion;
-} 
-RIL_RadioFunctions;
-</pre>
-
-
-<a name="androidTelephonyRILFunctions"></a><h3>RIL Functions</h3>
-
-<p><code>ril.h</code> defines RIL states and variables, such as <code>RIL_UNSOL_STK_CALL_SETUP</code>, <code>RIL_SIM_READY</code>, <code>RIL_SIM_NOT_READY</code>, as well as the functions described in the tables below. Skim the header file (<code>/device/include/telephony/ril.h</code>) for details.</p>
-
-
-<a name="androidRilFunctionsSolicited"></a><h4>RIL Solicited Command Requests</h4>
-
-<p>The vendor RIL must provide the functions described in the table below to handle solicited commands. The RIL solicited command request types are defined in <code>ril.h</code> with the <code>RIL_REQUEST_</code> prefix. Check the header file for details.</p>
-<p><table>
-  <tr><th scope="col">Name</th><th scope="col">Description</th></tr>
-  <tr>
-    <td valign="top"><code> void (*RIL_RequestFunc) (int request, void *data, size_t datalen, RIL_Token t);</code></td>
-    <td valign="top">
-	<p>This is the RIL entry point for solicited commands and must be able to handle the various RIL solicited request types defined in <code>ril.h</code> with the <code>RIL_REQUEST_</code> prefix.</p>
-	<ul>
-        <li><code>request</code> is one of <code>RIL_REQUEST_*</code></li>
-        <li><code>data</code> is pointer to data defined for that <code>RIL_REQUEST_*</code></l>
-        <li><code>t</code> should be used in subsequent call to <code>RIL_onResponse</code></li>
-        <li><code>datalen</code> is owned by caller, and should not be modified or freed by callee</li>
-      </ul>
-	<p>Must be completed with a call to <code>RIL_onRequestComplete()</code>. &nbsp;<code>RIL_onRequestComplete()</code> may be called from any thread before or after this function returns. This will &nbsp;always be called from the same thread, so returning here implies that the radio is ready to process another command (whether or not the previous command has completed).</p></td>
-  </tr>
-  <tr>
-    <td valign="top"><code> RIL_RadioState (*RIL_RadioStateRequest)();</code></td>
-    <td valign="top">This function should return the current radio state synchronously.</td>
-  </tr>
-  <tr>
-    <td valign="top"><code> int (*RIL_Supports)(int requestCode);</code></td>
-    <td valign="top">This function returns "1" if the specified <code>RIL_REQUEST</code> code is supported and 0 if it is not.</td>
-  </tr>
-  <tr>
-    <td valign="top"><code> void (*RIL_Cancel)(RIL_Token t);</code></td>
-    <td valign="top"><p>This function is used to indicate that a pending request should be canceled. This function is called from a separate thread--not the thread that calls <code>RIL_RequestFunc</code>.</p>
-      <p>On cancel, the callee should do its best to abandon the request and call <code>RIL_onRequestComplete</code> with <code>RIL_Errno CANCELLED</code> at some later point.</p>
-      <p>Subsequent calls to <code>RIL_onRequestComplete</code> for this request with other results will be tolerated but ignored (that is, it is valid to ignore the cancellation request).</p>
-    <p><code>RIL_Cancel</code> calls should return immediately and not wait for cancellation.</p></td>
-  </tr>
-  <tr>
-    <td valign="top"><code> const char * (*RIL_GetVersion) (void);</code></td>
-    <td valign="top">Return a version string for your Vendor RIL</td>
-  </tr>
-</table>
-
-
-<p>The vendor RIL uses the following callback methods to communicate back to the Android RIL daemon.</p>
-<p>
-<table>
-  <tr>
-    <th scope="col">Name</th>
-    <th scope="col">Description</th>
-  </tr>
-  <tr>
-    <td><code>void RIL_onRequestComplete(RIL_Token t, RIL_Errno e, void *response, size_t responselen);</code></td>
-    <td><ul>
-      <li><code>t</code> is parameter passed in on previous call to <code>RIL_Notification</code> routine.</li>
-      <li>If <code>e</code> != SUCCESS, then response can be null and is ignored</li>
-      <li><code>response</code> is owned by caller, and should not be modified or freed by callee</li>
-      <li><code>RIL_onRequestComplete</code> will return as soon as possible</li>
-    </ul></td>
-  </tr>
-  <tr>
-    <td><code>void RIL_requestTimedCallback (RIL_TimedCallback callback, void *param, const struct timeval *relativeTime);</code></td>
-    <td>Call user-specified callback function on the same thread that <code>RIL_RequestFunc</code> is called. If <code>relativeTime</code> is specified, then it specifies a relative time value at which the callback is invoked. If <code>relativeTime</code> is NULL or points to a 0-filled structure, the callback will be invoked as soon as possible.</td>
-  </tr>
-</table></p>
-
-
-<a name="androidRilFunctionsUnsolicited"></a><h4>RIL Unsolicited Commands</h4>
-
-<p>The functions listed in the table below are call-back functions used by the Vendor RIL to invoke unsolicited commands on the Android platform. See <code>ril.h</code> for details. </p>
-<p>
-<table>
-  <tr>
-    <th scope="col">Name</th>
-    <th scope="col">Description</th>
-  </tr>
-  <tr>
-    <td><code>void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, size_t datalen);</code></td>
-    <td><ul>
-      <li><code>unsolResponse</code> is one of <code>RIL_UNSOL_RESPONSE_*</code></li>
-      <li><code>data</code> is pointer to data defined for that <code>RIL_UNSOL_RESPONSE_*</code></li>
-      <li><code>data</code> is owned by caller, and should not be modified or freed by callee</li>
-    </ul></td>
-  </tr>
-</table></p>
diff --git a/pdk/docs/guide/wifi.jd b/pdk/docs/guide/wifi.jd
deleted file mode 100755
index 1e9f527..0000000
--- a/pdk/docs/guide/wifi.jd
+++ /dev/null
@@ -1,51 +0,0 @@
-page.title=Wi-Fi
-pdk.version=1.0
-doc.type=guide
-@jd:body
-
-<div id="qv-wrapper">
-<div id="qv">
-<h2>In this document</h2>
-<a name="toc"/>
-<ul>
-<li><a href="#androidWifiBuildingDriver">Building a Wi-Fi Library</a></li>
-<li><a href="#androidWifiInterface">Interface</a></li>
-</ul>
-</div>
-</div>
-
-<p>Android uses wpa_supplicant as the platform interface to the Wi-Fi device. Your Wi-Fi driver must be compatible with the standard wpa_supplicant in addition to extensions added to the supplicant (specifically, the "DRIVER" commands described in <code>wifi.h/wifi_command()</code>).</p>
-
-
-<a name="androidWifiBuildingDriver"></a><h3>Building a Wi-Fi Library</h3>
-
-<p>To create a Wi-Fi driver for Android:</p>
-<p><ul>
-<li>create a shared library that implements the interface defined in <code>include/hardware/wifi.h</code>, which also defines the Wi-Fi supplicant.</li>
-<li>Follow the instructions posted at <a href="http://hostap.epitest.fi/wpa_supplicant/">http://hostap.epitest.fi/wpa_supplicant/</a>.</li>
-<li>Place your driver in <code>libs/hardware/wifi/</code></li>
-<li>Test your driver using the command line <code>wpa_cli</code> utilities.</li>
-</ul>
-
-<p>You can find the default implementation in <code>libs/hardware/wifi/wifi.c</code>. If you need to make changes, create a new source file similar to <code>wifi.c</code>, for example, <code>wifi_mywifi.c</code>. </p>
-
-<p>Update the default <code>Android.mk</code> file (<code>libs/hardware/wifi/Android.mk</code>) as shown below.</p>
-<pre class="prettify">
-LOCAL_SHARED_LIBRARIES += libnetutils
-
-ifeq ($(TARGET_PRODUCT),acme)
-LOCAL_SRC_FILES += wifi/wifi_mywifi.c
-else
-LOCAL_SRC_FILES += wifi/wifi.c
-endif
-</pre>
-
-
-<a name="androidWifiInterface"></a><h3>Interface</h3>
-
-
-
-<p class="note"><strong>Note</strong>: This document relies on some Doxygen-generated content that appears in an iFrame below. To return to the Doxygen default content for this page, <a href="wifi.html">click here</a>.</p>
-
-
-<iframe onLoad="resizeDoxFrameHeight();" src="wifi_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe>
diff --git a/pdk/docs/index.jd b/pdk/docs/index.jd
deleted file mode 100644
index 4175db7..0000000
--- a/pdk/docs/index.jd
+++ /dev/null
@@ -1,133 +0,0 @@
-home=true
-@jd:body
-
-
-	<div id="mainBodyFixed" align="top">
-              <div id="mainBodyLeft">			
-                   <h2>Android Open Source Project</h2>
-                   <!-- total max width is 520px -->
-                   <p> Android is the first free, open source, and fully customizable mobile platform. 
-                       Android offers a full stack: an operating system, middleware and key mobile applications.
-                       It also contains a rich set of APIs that allows third-party developers to develop great
-                       applications. </p>
-              </div><!-- end mainBodyLeft -->
-
-              <div id="mainBodyRight">
-                      <table id="rightColumn">
-                              <tr>
-                                      <td class="imageCell"><a href="{@docRoot}sdk/index.html"><img src="{@docRoot}assets/images/icon_download.jpg" style="padding:0" /></a></td>
-                                      <td>
-                                              <h2 class="green">Download</h2>
-                                              <p>The Android SDK has the tools, sample code, and docs you need to create great apps.  </p>
-                                              <p><a href="http://developer.android.com">Learn more &raquo;</a></p>
-                                      </td>
-                              </tr>
-                              <tr>
-                                      <td colspan="2"><div class="seperator">&nbsp;</div></td>
-                              </tr>
-                              <tr>
-                                      <td class="imageCell"><a href="http://www.android.com/market.html"><img src="{@docRoot}assets/images/icon_market.jpg" style="padding:0" /></a></td>
-                                      <td>
-                                              <h2 class="green">Publish</h2>
-                                              <p>Android Market is an open service that lets you distribute your apps to handsets.</p>
-                                              <p><a href="http://www.android.com/market.html">Learn more &raquo;</a></p>
-                                      </td>
-                              </tr>
-                              <tr>
-                                      <td colspan="2"><div class="seperator">&nbsp;</div></td>
-                              </tr>
-                              <tr>
-                                      <td class="imageCell"><a href="http://source.android.com"><img src="{@docRoot}assets/images/icon_contribute.jpg" style="padding:0" /></a></td>
-                                      <td>
-                                              <h2 class="green">Contribute</h2>
-                                              <p>Android Open Source Project gives you access to the entire platform source.</p>
-                                              <p><a href="http://source.android.com">Learn more &raquo;</a></p>
-                                      </td>
-                              </tr>
-                              <tr>
-                                      <td colspan="2"><div class="seperator">&nbsp;</div></td>
-                              </tr>
-                              <tr>
-                                      <td class="imageCell"><a href="http://www.youtube.com/user/androiddevelopers"><img src="{@docRoot}assets/images/video-droid.png" style="padding:0" /></a></td>
-                                      <td>
-                                              <h2 class="green">Watch</h2>
-                                              <object width="150" height="140"><param name="movie" value="http://www.youtube.com/v/GARMe7Km_gk&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/GARMe7Km_gk&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="150" height="140"></embed></object>
-                                              <p style="margin-top:1em"><a href="{@docRoot}videos/index.html">More Android videos &raquo;</a></p>
-                                      </td>
-                              </tr>
-
-                      </table>
-              </div>
-	</div>
-
-<!--[if lte IE 6]>
-  <style>
-    #arrow-left {
-      margin:0 0 0 5px;
-    }
-    #arrow-right {
-      margin-left:0;
-    }
-    .app-list-container {
-      margin: 37px 0 0 23px;
-    }
-    div#list-clip { 
-      width:468px;
-    }
-  </style>
-<![endif]-->
-
-<script type="text/javascript">
-
-// * -- carousel dictionary -- * //
-  /* layout:  imgLeft, imgRight, imgTop
-     icon:    image for carousel entry. cropped (height:70px, width:90px)
-     name:    string for carousel entry
-     img:     image for bulletin post. cropped (height: 170, width:230px)
-     title:   header for bulletin (optional, insert "" value to skip
-     desc:    the bulletin post. must include html tags. 
-  */
-
-  var droidList = {
-    'sdk': {
-      'layout':"imgLeft",
-      'icon':"sdk-small.png",
-      'name':"SDK 1.5 r3",
-      'img':"sdk-large.png",
-      'title':"Android 1.5 SDK",
-      'desc': "<p>Android 1.5 SDK is now available. It includes new APIs for Android 1.5, updated developer tools, multiple platform versions, and a Google APIs add-on.</p><p><a href='{@docRoot}sdk/1.5_r3/index.html'>Download Android 1.5 SDK &raquo;</a></p>"
-    },
-    
-    'io': {
-      'layout':"imgLeft",
-      'icon':"io-small.png",
-      'name':"Google I/O",
-      'img':"io-large.png",
-      'title':"Google I/O Developer Conference",
-      'desc': "<p>The Google I/O developer conference took place May 27-28 in San Francisco. If you missed the conference, you can experience the Android sessions by viewing YouTube videos.</p><p><a href='{@docRoot}videos/index.html'>See the sessions from Google I/O &raquo;</a></p>"
-    },
-
-    'mapskey': {
-      'layout':"imgLeft",
-      'icon':"maps-small.png",
-      'name':"Maps API Key",
-      'img':"maps-large.png",
-      'title':"Maps API Key",
-      'desc':"<p>If you're writing an Android application that uses Google Maps (with MapView), you must register your application to obtain a Maps API Key. Without the key, your maps application will not work on Android devices. Obtaining a key requires just a couple of steps.</p><p><a href='http://code.google.com/android/add-ons/google-apis/maps-overview.html'>Learn more &raquo;</a></p>"
-    },
-
-    'devphone': {
-      'layout':"imgLeft",
-      'icon':"devphone-small.png",
-      'name':"Dev Phone 1",
-      'img':"devphone-large.png",
-      'title':"Android Dev Phone 1",
-      'desc': "<p>Run and debug your Android applications directly on this device. Modify and rebuild the Android operating system, and flash it onto the phone. The Android Dev Phone 1 is carrier independent, and available for purchase by any developer registered with <a href='http://market.android.com/publish'>Android Market</a>.</p><p><a href='/guide/developing/device.html#dev-phone-1'>Learn more about the Android Dev Phone 1 &raquo;</a></p>"
-    }
-
-  }
-</script>
-<script type="text/javascript" src="{@docRoot}assets/carousel.js"></script>
-<script type="text/javascript">
-  initCarousel("sdk");
-</script>
diff --git a/pdk/docs/licenses/index.jd b/pdk/docs/licenses/index.jd
deleted file mode 100644
index a4f51dc..0000000
--- a/pdk/docs/licenses/index.jd
+++ /dev/null
@@ -1,47 +0,0 @@
-home=true
-doc.type=licenses
-@jd:body
-
-<div id="mainBodyFixed">
-
-<p>
-   The Android Open Source Project uses a few open source initiative approved open source licenses to enable availability
-   of source code and to accept contributions from individuals and corporations.
-</p>
-
-<p>
-   <b>Android Open Source Project license</b>
-</p>
-
-<p>
-   The preferred license for the Android Open Source Project is Apache 2.0. Apache 2.0 is a commercial and open source
-   friendly open source license. The majority of the Android platform is licensed under the Apache 2.0 license. While
-   the project will strive to adhere to the preferred license, there may be exceptions which will be handled on a case-by-case
-   basis. For example, the Linux kernel patches are under the GPLv2 license with system exceptions, which can be found on kernel.org
-</p>
-
-<p>
-   <b>Contributor License Grants</b>
-</p>
-
-<p>
-   All individual contributors of ideas, code, or documentation to the Android Open Source Project will be required to
-   complete, sign, and submit an Individual Contributor License Grant. The grant can be executed online through the code
-   review tool. The agreement clearly defines the terms under which intellectual property has been contributed to the
-   Android Open Source Project.  This license is for your protection as a contributor as well as the protection of the
-   project; it does not change your rights to use your own contributions for any other purpose.
-</p>
-
-<p>
-   For a corporation that has assigned employees to work on the Android Open Source Project, a Corporate Contributor License
-   Grant is available. This version of the Grant allows a corporation to authorize contributions submitted by its designated
-   employees and to grant copyright and patent licenses. Note that a Corporate Contributor License Grant does not remove the
-   need for any developer to sign their own Individual Contributor License Grant as an individual, to cover any of their
-   contributions which are not owned by the corporation signing the Corporate Contributor License Grant.
-</p>
-
-<p>
-   Please note that we based our grants on the ones that the Apache Software Foundation uses, which can be found on its site.
-</p>
-
-</div>
diff --git a/pdk/docs/licenses/licenses_toc.cs b/pdk/docs/licenses/licenses_toc.cs
deleted file mode 100644
index b2fa107..0000000
--- a/pdk/docs/licenses/licenses_toc.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-<script type="text/javascript" language="JavaScript">
-<!--
-function nothing() {}
--->
-</script>
-
-<ul>
-  <li> <h2> Referenced Licenses </h2>
-  <ul>
-    <li><a href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0 license</a></li>
-    <li><a href="http://www.kernel.org/pub/linux/kernel/COPYING">GPL v2 license</a></li>
-  </ul>
-  </li>
-
-</ul>
-
-<script type="text/javascript">
-<!--
-    buildToggleLists();
-//-->
-</script>
diff --git a/pdk/docs/releases/index.jd b/pdk/docs/releases/index.jd
deleted file mode 100644
index b3b7154..0000000
--- a/pdk/docs/releases/index.jd
+++ /dev/null
@@ -1,7 +0,0 @@
-home=true
-doc.type=releases
-@jd:body
-
-<p>
-  Some release information here
-</p>
diff --git a/pdk/docs/releases/releases_toc.cs b/pdk/docs/releases/releases_toc.cs
deleted file mode 100644
index a1842b5..0000000
--- a/pdk/docs/releases/releases_toc.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-<script type="text/javascript" language="JavaScript">
-<!--
-function nothing() {}
--->
-</script>
-
-<ul>
-  <li> <h2> Android Releases </h2>
-  <ul>
-    <li><a href="xxx">Android 1.0</a></li>
-    <li><a href="xxx">Android 1.1</a></li>
-    <li><a href="xxx">Android 1.5</a></li>
-  </ul>
-  </li>
-
-</ul>
-
-<script type="text/javascript">
-<!--
-    buildToggleLists();
-//-->
-</script>
diff --git a/pdk/doxygen_config/docsfiles/groups.dox b/pdk/doxygen_config/docsfiles/groups.dox
deleted file mode 100644
index 79f9d3f..0000000
--- a/pdk/doxygen_config/docsfiles/groups.dox
+++ /dev/null
@@ -1,3 +0,0 @@
-

-/*!

-*/

diff --git a/pdk/doxygen_config/docsfiles/main.dox b/pdk/doxygen_config/docsfiles/main.dox
deleted file mode 100644
index 069c1a2..0000000
--- a/pdk/doxygen_config/docsfiles/main.dox
+++ /dev/null
@@ -1,5 +0,0 @@
-/*! \mainpage Google Client Location Library (CLL): location Interface

- *  <p>This documentation is part of Google's Client Location Library (CLL) Getting Started Guide.</p>

- *  <p>In most cases, this Doxygen-generated content opens in a new window (or tab), so look for this window's parent to return to the Getting Started guide. If you maintained 

- *  the original directory structure when you unzipped the documentation, you may also return to the Getting Started guide by clicking <a href="../cll_getting_started.html">Client Location Library (CLL) Getting Started Guide</a>.</p>

- */
\ No newline at end of file
diff --git a/pdk/doxygen_config/footer.html b/pdk/doxygen_config/footer.html
deleted file mode 100644
index 691287b..0000000
--- a/pdk/doxygen_config/footer.html
+++ /dev/null
@@ -1,2 +0,0 @@
-</body>
-</html>
\ No newline at end of file
diff --git a/pdk/doxygen_config/header.html b/pdk/doxygen_config/header.html
deleted file mode 100644
index 794041a..0000000
--- a/pdk/doxygen_config/header.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-<title>Doxygen-Generated Content</title>
-<link href="doxygen.css" rel="stylesheet" type="text/css" />
-<style type="text/css">
-<!--
-.tabs {
-	display: none;
-}
--->
-</style>
-</head>
-<body>
diff --git a/pdk/doxygen_config/overrideconfig.conf b/pdk/doxygen_config/overrideconfig.conf
deleted file mode 100644
index f1e3819..0000000
--- a/pdk/doxygen_config/overrideconfig.conf
+++ /dev/null
@@ -1,50 +0,0 @@
-

-#---------------------------------------------------------------------------

-# Project related configuration options

-#---------------------------------------------------------------------------

-DOXYFILE_ENCODING      = UTF-8

-PROJECT_NAME           = pdk

-PROJECT_NUMBER         = 

-

-INPUT                  = sources \

-                         docsfiles

-

-OUTPUT_DIRECTORY       = generatedDocs

-HTML_HEADER            = header.html

-HTML_FOOTER            = footer.html

-# FILL IN PATH TO HEADER BLOB WANTED IN EVERY FILE

-# RELATIVE PATH TO WHER ERUNNING DOXYGEN FROM

-HTML_STYLESHEET        =

-# PATH TO STYLE SHEET\

-

-BRIEF_MEMBER_DESC      = YES 

-REPEAT_BRIEF           = YES

-

-OPTIMIZE_OUTPUT_FOR_C  = YES

-

-ALWAYS_DETAILED_SEC    = YES

-INLINE_INHERITED_MEMB  = NO

-FULL_PATH_NAMES        = NO

-STRIP_FROM_PATH        = 

-STRIP_FROM_INC_PATH    = 

-SHORT_NAMES            = NO

-JAVADOC_AUTOBRIEF      = YES

-QT_AUTOBRIEF           = NO

-MULTILINE_CPP_IS_BRIEF = NO

-DETAILS_AT_TOP         = NO

-INHERIT_DOCS           = YES

-SEPARATE_MEMBER_PAGES  = NO

-

-QUIET                  = NO

-WARNINGS               = YES

-

-

-

-SOURCE_BROWSER         = YES

-

-GENERATE_HTML          = YES

-ENABLE_PREPROCESSING   = NO

-

-# ADDED JULY 08 TO TRY TO FIGURE OUT DOCUMENING C FILES

-EXTRACT_ALL            = YES

-STRIP_CODE_COMMENTS    = NO 
diff --git a/pdk/doxygen_config/pdk_config.conf b/pdk/doxygen_config/pdk_config.conf
deleted file mode 100644
index 1f1f349..0000000
--- a/pdk/doxygen_config/pdk_config.conf
+++ /dev/null
@@ -1,273 +0,0 @@
-# Doxyfile 1.5.6

-

-#---------------------------------------------------------------------------

-# Project related configuration options

-#---------------------------------------------------------------------------

-DOXYFILE_ENCODING      = UTF-8

-PROJECT_NAME           = pdk

-PROJECT_NUMBER         = 

-OUTPUT_DIRECTORY       = 

-CREATE_SUBDIRS         = NO

-OUTPUT_LANGUAGE        = English

-BRIEF_MEMBER_DESC      = YES 

-REPEAT_BRIEF           = YES

-ABBREVIATE_BRIEF       = "The $name class" \

-                         "The $name widget" \

-                         "The $name file" \

-                         is \

-                         provides \

-                         specifies \

-                         contains \

-                         represents \

-                         a \

-                         an \

-                         the

-ALWAYS_DETAILED_SEC    = YES

-INLINE_INHERITED_MEMB  = NO

-FULL_PATH_NAMES        = NO

-STRIP_FROM_PATH        = 

-STRIP_FROM_INC_PATH    = 

-SHORT_NAMES            = NO

-JAVADOC_AUTOBRIEF      = YES

-QT_AUTOBRIEF           = NO

-MULTILINE_CPP_IS_BRIEF = NO

-DETAILS_AT_TOP         = NO

-INHERIT_DOCS           = YES

-SEPARATE_MEMBER_PAGES  = NO

-TAB_SIZE               = 8

-ALIASES                = 

-OPTIMIZE_OUTPUT_FOR_C  = NO

-OPTIMIZE_OUTPUT_JAVA   = NO

-OPTIMIZE_FOR_FORTRAN   = NO

-OPTIMIZE_OUTPUT_VHDL   = NO

-BUILTIN_STL_SUPPORT    = NO

-CPP_CLI_SUPPORT        = NO

-SIP_SUPPORT            = NO

-IDL_PROPERTY_SUPPORT   = YES

-DISTRIBUTE_GROUP_DOC   = NO

-SUBGROUPING            = YES

-TYPEDEF_HIDES_STRUCT   = NO

-#---------------------------------------------------------------------------

-# Build related configuration options

-#---------------------------------------------------------------------------

-EXTRACT_ALL            = YES

-EXTRACT_PRIVATE        = NO

-EXTRACT_STATIC         = NO

-EXTRACT_LOCAL_CLASSES  = NO

-EXTRACT_LOCAL_METHODS  = NO

-EXTRACT_ANON_NSPACES   = YES

-HIDE_UNDOC_MEMBERS     = NO

-HIDE_UNDOC_CLASSES     = NO

-HIDE_FRIEND_COMPOUNDS  = NO

-HIDE_IN_BODY_DOCS      = NO

-INTERNAL_DOCS          = NO

-CASE_SENSE_NAMES       = YES

-HIDE_SCOPE_NAMES       = NO

-SHOW_INCLUDE_FILES     = NO

-# MIGHT WANT TO TWEAK LEATER

-INLINE_INFO            = YES

-SORT_MEMBER_DOCS       = YES

-SORT_BRIEF_DOCS        = YES

-SORT_GROUP_NAMES       = NO

-SORT_BY_SCOPE_NAME     = NO

-GENERATE_TODOLIST      = NO

-GENERATE_TESTLIST      = NO

-GENERATE_BUGLIST       = NO

-GENERATE_DEPRECATEDLIST= YES

-ENABLED_SECTIONS       = 

-MAX_INITIALIZER_LINES  = 30

-SHOW_USED_FILES        = NO

-SHOW_DIRECTORIES       = NO

-SHOW_FILES             = YES

-SHOW_NAMESPACES        = YES

-FILE_VERSION_FILTER    = 

-#---------------------------------------------------------------------------

-# configuration options related to warning and progress messages

-#---------------------------------------------------------------------------

-QUIET                  = NO

-WARNINGS               = YES

-WARN_IF_UNDOCUMENTED   = YES

-WARN_IF_DOC_ERROR      = YES

-WARN_NO_PARAMDOC       = NO

-WARN_FORMAT            = "$file:$line: $text"

-WARN_LOGFILE           = 

-#---------------------------------------------------------------------------

-# configuration options related to the input files

-#---------------------------------------------------------------------------

-INPUT                  = 

-INPUT_ENCODING         = UTF-8

-FILE_PATTERNS          = *.c \

-                	 *.cpp \

-                         *.dox \

-                         *.h \

-                         *.htm \

-                         *.html

-RECURSIVE              = YES

-EXCLUDE                = 

-# ecxlude entire directories or files

-EXCLUDE_SYMLINKS       = NO

-EXCLUDE_PATTERNS       = 

-EXCLUDE_SYMBOLS        = 

-EXAMPLE_PATH           = 

-EXAMPLE_PATTERNS       = *

-EXAMPLE_RECURSIVE      = NO

-IMAGE_PATH             = 

-INPUT_FILTER           = 

-FILTER_PATTERNS        = 

-FILTER_SOURCE_FILES    = NO

-#---------------------------------------------------------------------------

-# configuration options related to source browsing

-#---------------------------------------------------------------------------

-SOURCE_BROWSER         = YES

-INLINE_SOURCES         = NO

-STRIP_CODE_COMMENTS    = YES

-REFERENCED_BY_RELATION = NO

-REFERENCES_RELATION    = YES

-REFERENCES_LINK_SOURCE = NO

-USE_HTAGS              = NO

-VERBATIM_HEADERS       = NO

-#---------------------------------------------------------------------------

-# configuration options related to the alphabetical class index

-#---------------------------------------------------------------------------

-ALPHABETICAL_INDEX     = NO

-COLS_IN_ALPHA_INDEX    = 1

-IGNORE_PREFIX          = 

-#---------------------------------------------------------------------------

-# configuration options related to the HTML output

-#---------------------------------------------------------------------------

-GENERATE_HTML          = YES

-HTML_OUTPUT            = html

-HTML_FILE_EXTENSION    = .html

-HTML_HEADER            = 

-# FILL IN PATH TO HEADER BLOB WANTED IN EVERY FILE

-# RELATIVE PATH TO WHER ERUNNING DOXYGEN FROM

-HTML_FOOTER            = 

-HTML_STYLESHEET        =

-# PATH TO STYLE SHEET

-HTML_ALIGN_MEMBERS     = YES

-GENERATE_HTMLHELP      = NO

-GENERATE_DOCSET        = NO

-DOCSET_FEEDNAME        = "Doxygen generated docs"

-DOCSET_BUNDLE_ID       = org.doxygen.Project

-HTML_DYNAMIC_SECTIONS  = NO

-CHM_FILE               = 

-HHC_LOCATION           = 

-GENERATE_CHI           = NO

-CHM_INDEX_ENCODING     = 

-BINARY_TOC             = NO

-TOC_EXPAND             = NO

-DISABLE_INDEX          = NO

-ENUM_VALUES_PER_LINE   = 4

-GENERATE_TREEVIEW      = NONE

-TREEVIEW_WIDTH         = 250

-FORMULA_FONTSIZE       = 10

-#---------------------------------------------------------------------------

-# configuration options related to the LaTeX output

-#---------------------------------------------------------------------------

-GENERATE_LATEX         = NO

-LATEX_OUTPUT           = latex

-LATEX_CMD_NAME         = latex

-MAKEINDEX_CMD_NAME     = makeindex

-COMPACT_LATEX          = NO

-PAPER_TYPE             = a4wide

-EXTRA_PACKAGES         = 

-LATEX_HEADER           = 

-PDF_HYPERLINKS         = YES

-USE_PDFLATEX           = YES

-LATEX_BATCHMODE        = NO

-LATEX_HIDE_INDICES     = NO

-#---------------------------------------------------------------------------

-# configuration options related to the RTF output

-#---------------------------------------------------------------------------

-GENERATE_RTF           = NO

-RTF_OUTPUT             = rtf

-COMPACT_RTF            = NO

-RTF_HYPERLINKS         = NO

-RTF_STYLESHEET_FILE    = 

-RTF_EXTENSIONS_FILE    = 

-#---------------------------------------------------------------------------

-# configuration options related to the man page output

-#---------------------------------------------------------------------------

-GENERATE_MAN           = NO

-MAN_OUTPUT             = man

-MAN_EXTENSION          = .3

-MAN_LINKS              = NO

-#---------------------------------------------------------------------------

-# configuration options related to the XML output

-#---------------------------------------------------------------------------

-GENERATE_XML           = NO

-XML_OUTPUT             = xml

-XML_SCHEMA             = 

-XML_DTD                = 

-XML_PROGRAMLISTING     = YES

-#---------------------------------------------------------------------------

-# configuration options for the AutoGen Definitions output

-#---------------------------------------------------------------------------

-GENERATE_AUTOGEN_DEF   = NO

-#---------------------------------------------------------------------------

-# configuration options related to the Perl module output

-#---------------------------------------------------------------------------

-GENERATE_PERLMOD       = NO

-PERLMOD_LATEX          = NO

-PERLMOD_PRETTY         = YES

-PERLMOD_MAKEVAR_PREFIX = 

-#---------------------------------------------------------------------------

-# Configuration options related to the preprocessor   

-#---------------------------------------------------------------------------

-ENABLE_PREPROCESSING   = NO

-# KEY CONSIDERATION TWEAK BACK AND FORTH. function in an # if/def preprocessor directive. Processor evalutes whether true. Should doxygen follow compiles behavior or document everything?

-# usually have optional things that people may want to tweak. 

-MACRO_EXPANSION        = YES

-EXPAND_ONLY_PREDEF     = YES

-SEARCH_INCLUDES        = NO

-INCLUDE_PATH           = 

-INCLUDE_FILE_PATTERNS  = 

-PREDEFINED             = 

-#to mimic preprocessor behaviors.

-EXPAND_AS_DEFINED      = 

-SKIP_FUNCTION_MACROS   = YES

-#---------------------------------------------------------------------------

-# Configuration::additions related to external references   

-#---------------------------------------------------------------------------

-TAGFILES               = 

-GENERATE_TAGFILE       = 

-ALLEXTERNALS           = NO

-EXTERNAL_GROUPS        = NO

-PERL_PATH              = 

-#---------------------------------------------------------------------------

-# Configuration options related to the dot tool   

-#---------------------------------------------------------------------------

-CLASS_DIAGRAMS         = NO

-#CHANGE WHEN HAVE DIAGRAMS

-MSCGEN_PATH            = YES

-HIDE_UNDOC_RELATIONS   = YES

-HAVE_DOT               = NO

-DOT_FONTNAME           = FreeSans

-DOT_FONTPATH           = 

-CLASS_GRAPH            = YES

-COLLABORATION_GRAPH    = YES

-GROUP_GRAPHS           = YES

-UML_LOOK               = NO

-TEMPLATE_RELATIONS     = NO

-INCLUDE_GRAPH          = YES

-INCLUDED_BY_GRAPH      = YES

-CALL_GRAPH             = NO

-CALLER_GRAPH           = NO

-GRAPHICAL_HIERARCHY    = YES

-DIRECTORY_GRAPH        = YES

-DOT_IMAGE_FORMAT       = png

-DOT_PATH               = 

-DOTFILE_DIRS           = 

-DOT_GRAPH_MAX_NODES    = 50

-MAX_DOT_GRAPH_DEPTH    = 1000

-DOT_TRANSPARENT        = YES

-DOT_MULTI_TARGETS      = NO

-GENERATE_LEGEND        = YES

-DOT_CLEANUP            = YES

-#---------------------------------------------------------------------------

-# Configuration::additions related to the search engine   

-#---------------------------------------------------------------------------

-SEARCHENGINE           = NO

-@INCLUDE = overrideconfig.conf

-# relative to where running doxygen from

-# @INCLUDE = $(PROJECTCONF)
diff --git a/pdk/hosting/app.yaml b/pdk/hosting/app.yaml
deleted file mode 100644
index b36efe8..0000000
--- a/pdk/hosting/app.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-application: pdk-docs
-version: 2
-runtime: python
-api_version: 1
-
-handlers:
-- url: /online-pdk
-  static_dir: online-pdk
-
-- url: /
-  script: pdk.py
diff --git a/pdk/hosting/edoxfix.sh b/pdk/hosting/edoxfix.sh
deleted file mode 100755
index f82e912..0000000
--- a/pdk/hosting/edoxfix.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-# $1 = output directory of generated docs: out/target/product/generic/obj/PACKAGING/pdkdocs_intermediates/generatedDocs/html
-# fix a bug in doxygen 1.5.6 and higher...
-# insert the line: '</div>\n' after line 25 in each generated source file: 
-echo \</div\> > $1/div.tmp
-for f in `find $1 -name '*-source.html' -print`
-do
-  head -n 25 $f > $f.head.tmp
-  let count=$(wc -l $f  | cut -d\  -f 1 )
-  count=$(($count-25))
-  tail -n $count $f > $f.tail.tmp
-  cat $f.head.tmp $1/div.tmp $f.tail.tmp > $f
-done
-rm $1/*.tmp
diff --git a/pdk/hosting/pdk.py b/pdk/hosting/pdk.py
deleted file mode 100644
index a1c7c07..0000000
--- a/pdk/hosting/pdk.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python2.5
-#
-# Copyright (C) 2008 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-"""Serve static pages for the pdk on appengine
-"""
-
-import os
-
-from google.appengine.ext import webapp
-from google.appengine.ext.webapp.util import run_wsgi_app
-
-
-class MainPage(webapp.RequestHandler):
-  def get(self):
-    self.redirect('online-pdk/guide/index.html')
-
-application = webapp.WSGIApplication([('/', MainPage)], debug=True)
-
-def main():
-  run_wsgi_app(application)
-
-if __name__ == "__main__":
-  main()
-  
-# Testing
-# You must install google appengine.  See: http://code.google.com/appengine/downloads.html
-# 
-# Here's the command to run the pdk-docs server locally:
-#   python <path_to_appengine_installation>/dev_appserver.py --address 0.0.0.0 \
-#     <path_to_cupcake_code>/android/out/target/common/docs
-    
-# To verify it is working you can access it with a browser loacally on port 8080:
-
-# http://localhost:8080/index.html
-
-
-# To upload this application:
-# /home/build/static/projects/apphosting/devtools/appcfg.py update pdk/
-# where the pdk directory contains: pdk.py, app.yaml, and the docs directory.
-# where the docs are made from the Pdk.mk file.
diff --git a/pdk/pndk/Android_PNDK_README.html b/pdk/pndk/Android_PNDK_README.html
deleted file mode 100644
index 40b7a72..0000000
--- a/pdk/pndk/Android_PNDK_README.html
+++ /dev/null
@@ -1,741 +0,0 @@
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-
-<html>
-
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-
-<base target="_top">
-
-<style type="text/css">
-  
-
-/* default css */
-
-table {
-  font-size: 1em;
-  line-height: inherit;
-}
-
-
-tr {
-  
-  text-align: left;
-  
-}
-
-
-div, address, ol, ul, li, option, select {
-  margin-top: 0px;
-  margin-bottom: 0px;
-}
-
-p {
-  margin: 0px;
-}
-
-body {
-  margin: 6px;
-  padding: 0px;
-  font-family: Verdana, sans-serif;
-  font-size: 10pt;
-  background-color: #ffffff;
-}
-
-
-img {
-  -moz-force-broken-image-icon: 1;
-}
-
-@media screen {
-  html.pageview {
-    background-color: #f3f3f3 !important;
-  }
-
-  
-
-  body {
-    min-height: 1100px;
-    
-    counter-reset: __goog_page__;
-  }
-  * html body {
-    height: 1100px;
-  }
-  .pageview body {
-    border-top: 1px solid #ccc;
-    border-left: 1px solid #ccc;
-    border-right: 2px solid #bbb;
-    border-bottom: 2px solid #bbb;
-    width: 648px !important;
-    margin: 15px auto 25px;
-    padding: 40px 50px;
-  }
-  /* IE6 */
-  * html {
-    overflow-y: scroll;
-  }
-  * html.pageview body {
-    overflow-x: auto;
-  }
-  /* Prevent repaint errors when scrolling in Safari. This "Star-7" css hack
-     targets Safari 3.1, but not WebKit nightlies and presumably Safari 4.
-     That's OK because this bug is fixed in WebKit nightlies/Safari 4 :-). */
-  html*#wys_frame::before {
-    content: '\A0';
-    position: fixed;
-    overflow: hidden;
-    width: 0;
-    height: 0;
-    top: 0;
-    left: 0;
-  }
-  
-  
-
-  
-    .writely-callout-data {
-      display: none;
-      *display: inline-block;
-      *width: 0;
-      *height: 0;
-      *overflow: hidden;
-    }
-    .writely-footnote-marker {
-      background-image: url('MISSING');
-      background-color: transparent;
-      background-repeat: no-repeat;
-      width: 7px;
-      overflow: hidden;
-      height: 16px;
-      vertical-align: top;
-
-      
-      -moz-user-select: none;
-    }
-    .editor .writely-footnote-marker {
-      cursor: move;
-    }
-    .writely-footnote-marker-highlight {
-      background-position: -15px 0;
-      -moz-user-select: text;
-    }
-    .writely-footnote-hide-selection ::-moz-selection, .writely-footnote-hide-selection::-moz-selection {
-      background: transparent;
-    }
-    .writely-footnote-hide-selection ::selection, .writely-footnote-hide-selection::selection {
-      background: transparent;
-    }
-    .writely-footnote-hide-selection {
-      cursor: move;
-    }
-
-    
-    .editor .writely-comment-yellow {
-      background-color: #FF9;
-      background-position: -240px 0;
-    }
-    .editor .writely-comment-yellow-hover {
-      background-color: #FF0;
-      background-position: -224px 0;
-    }
-    .editor .writely-comment-blue {
-      background-color: #C0D3FF;
-      background-position: -16px 0;
-    }
-    .editor .writely-comment-blue-hover {
-      background-color: #6292FE;
-      background-position: 0 0;
-    }
-    .editor .writely-comment-orange {
-      background-color: #FFDEAD;
-      background-position: -80px 0;
-    }
-    .editor .writely-comment-orange-hover {
-      background-color: #F90;
-      background-position: -64px 0;
-    }
-    .editor .writely-comment-green {
-      background-color: #99FBB3;
-      background-position: -48px 0;
-    }
-    .editor .writely-comment-green-hover {
-      background-color: #00F442;
-      background-position: -32px 0;
-    }
-    .editor .writely-comment-cyan {
-      background-color: #CFF;
-      background-position: -208px 0;
-    }
-    .editor .writely-comment-cyan-hover {
-      background-color: #0FF;
-      background-position: -192px 0;
-    }
-    .editor .writely-comment-purple {
-      background-color: #EBCCFF;
-      background-position: -144px 0;
-    }
-    .editor .writely-comment-purple-hover {
-      background-color: #90F;
-      background-position: -128px 0;
-    }
-    .editor .writely-comment-magenta {
-      background-color: #FCF;
-      background-position: -112px 0;
-    }
-    .editor .writely-comment-magenta-hover {
-      background-color: #F0F;
-      background-position: -96px 0;
-    }
-    .editor .writely-comment-red {
-      background-color: #FFCACA;
-      background-position: -176px 0;
-    }
-    .editor .writely-comment-red-hover {
-      background-color: #FF7A7A;
-      background-position: -160px 0;
-    }
-
-    .editor .writely-comment-marker {
-      background-image: url('MISSING');
-      background-color: transparent;
-      padding-right: 11px;
-      background-repeat: no-repeat;
-      width: 16px;
-      height: 16px;
-      -moz-user-select: none;
-    }
-
-    .editor .writely-comment-hidden {
-      padding: 0;
-      background: none;
-    }
-    .editor .writely-comment-marker-hidden {
-      background: none;
-      padding: 0;
-      width: 0;
-    }
-    .editor .writely-comment-none {
-      opacity: .2;
-      filter:progid:DXImageTransform.Microsoft.Alpha(opacity=20);
-      -moz-opacity: .2;
-    }
-    .editor .writely-comment-none-hover {
-      opacity: .2;
-      filter:progid:DXImageTransform.Microsoft.Alpha(opacity=20);
-      -moz-opacity: .2;
-    }
-  
-
-
-  
-  .br_fix br:not(:-moz-last-node):not(:-moz-first-node) {
-    
-    position:relative;
-    
-    left: -1ex
-    
-  }
-  
-  .br_fix br+br {
-    position: static !important
-  }
-}
-
-h6 { font-size: 8pt }
-h5 { font-size: 8pt }
-h4 { font-size: 10pt }
-h3 { font-size: 12pt }
-h2 { font-size: 14pt }
-h1 { font-size: 18pt }
-
-blockquote {padding: 10px; border: 1px #DDD dashed }
-
-a img {border: 0}
-
-.pb {
-  border-width: 0;
-  page-break-after: always;
-  /* We don't want this to be resizeable, so enforce a width and height
-     using !important */
-  height: 1px !important;
-  width: 100% !important;
-}
-
-.editor .pb {
-  border-top: 1px dashed #C0C0C0;
-  border-bottom: 1px dashed #C0C0C0;
-}
-
-div.google_header, div.google_footer {
-  position: relative;
-  margin-top: 1em;
-  margin-bottom: 1em;
-}
-
-
-/* Table of contents */
-.editor div.writely-toc {
-  background-color: #f3f3f3;
-  border: 1px solid #ccc;
-}
-.writely-toc > ol {
-  padding-left: 3em;
-  font-weight: bold;
-}
-ol.writely-toc-subheading {
-  padding-left: 1em;
-  font-weight: normal;
-}
-/* IE6 only */
-* html writely-toc ol {
-  list-style-position: inside;
-}
-.writely-toc-none {
-  list-style-type: none;
-}
-.writely-toc-decimal {
-  list-style-type: decimal;
-}
-.writely-toc-upper-alpha {
-  list-style-type: upper-alpha;
-}
-.writely-toc-lower-alpha {
-  list-style-type: lower-alpha;
-}
-.writely-toc-upper-roman {
-  list-style-type: upper-roman;
-}
-.writely-toc-lower-roman {
-  list-style-type: lower-roman;
-}
-.writely-toc-disc {
-  list-style-type: disc;
-}
-
-/* end default css */
-
-
-  /* default print css */
-  
-  @media print {
-    body {
-      padding: 0;
-      margin: 0;
-    }
-
-    div.google_header, div.google_footer {
-      display: block;
-      min-height: 0;
-      border: none;
-    }
-
-    div.google_header {
-      flow: static(header);
-    }
-
-    /* used to insert page numbers */
-    div.google_header::before, div.google_footer::before {
-      position: absolute;
-      top: 0;
-    }
-
-    div.google_footer {
-      flow: static(footer);
-    }
-
-    /* always consider this element at the start of the doc */
-    div#google_footer {
-      flow: static(footer, start);
-    }
-
-    span.google_pagenumber {
-      content: counter(page);
-    }
-
-    span.google_pagecount {
-      content: counter(pages);
-    }
-
-
-    callout.google_footnote {
-      
-      display: prince-footnote;
-      footnote-style-position: inside;
-      /* These styles keep the footnote from taking on the style of the text
-         surrounding the footnote marker. They can be overridden in the
-         document CSS. */
-      color: #000;
-      font-family: Verdana;
-      font-size: 10.0pt;
-      font-weight: normal;
-    }
-
-    /* Table of contents */
-    #WritelyTableOfContents a::after {
-      content: leader('.') target-counter(attr(href), page);
-    }
-
-    #WritelyTableOfContents a {
-      text-decoration: none;
-      color: black;
-    }
-  }
-
-  @page {
-    @top {
-      content: flow(header);
-    }
-    @bottom {
-      content: flow(footer);
-    }
-    @footnotes {
-      border-top: solid black thin;
-      padding-top: 8pt;
-    }
-  }
-  /* end default print css */
-
-
-/* custom css */
-
-
-/* end custom css */
-
-
-
-  /* ui edited css */
-  
-  body {
-    font-family: Verdana;
-    
-    font-size: 10.0pt;
-    line-height: normal;
-    background-color: #ffffff;
-  }
-  /* end ui edited css */
-
-
-
-/* editor CSS */
-.editor a:visited {color: #551A8B}
-.editor table.zeroBorder {border: 1px dotted gray}
-.editor table.zeroBorder td {border: 1px dotted gray}
-.editor table.zeroBorder th {border: 1px dotted gray}
-
-
-.editor div.google_header, .editor div.google_footer {
-  border: 2px #DDDDDD dashed;
-  position: static;
-  width: 100%;
-  min-height: 2em;
-}
-
-.editor .misspell {background-color: yellow}
-
-.editor .writely-comment {
-  font-size: 9pt;
-  line-height: 1.4;
-  padding: 1px;
-  border: 1px dashed #C0C0C0
-}
-
-
-/* end editor CSS */
-
-</style>
-
-</head>
-
-<body onload="DoPageLoad();"
-    
-    revision="cfnx2f69_111dp3jzfgb:107">
-
-    
-    
-    
-<h1>
-  Using the Android Native Development Kit (NDK)
-</h1>
-version 1.3<br>
-<br>
-<h2>
-  Introduction
-</h2>
-The Android Native Development Kit enables developers to write shared libraries
-in C or C++ and call them from Java code. The native shared libraries can be
-packaged into apk files along with a normal Android application written in Java,
-so that the resulting Android application can be downloaded and installed on an
-Android phone.<br>
-<br>
-The Native Development Kit consists of:<br>
-<ul>
-  <li>
-    C/C++ headers for native APIs<br>
-  </li>
-  <li>
-    C/C++ libraries for native APIs<br>
-  </li>
-  <li>
-    Documentation
-  </li>
-  <li>
-    Sample Code
-  </li>
-</ul>
-<br>
-The Native Development Kit is designed to be used with the Android SDK:<br>
-<ul>
-  <li>
-    The NDK is used to create a shared library containing native code.
-  </li>
-  <li>
-    The SDK is used to create an Android application written in Java that calls
-    into the native code shared library.
-  </li>
-</ul>
-<h1>
-</h1>
-<h2>
-  Setting up your machine<br>
-</h2>
-The Native Development Kit may be installed on either Linux or OS X. Developing
-under Windows is not yet supported.<br>
-<div>
-  <h3>
-    Linux Installation
-  </h3>
-  The
-  Android&nbsp;build&nbsp;is&nbsp;routinely&nbsp;tested&nbsp;on&nbsp;recent&nbsp;versions&nbsp;of&nbsp;Ubuntu&nbsp;(6.06&nbsp;and&nbsp;later),&nbsp;but
-  may work on other distributions as well.<br>
-  <h4>
-    <a name=TOC-Ubuntu-Linux-i386-></a><span style=FONT-FAMILY:Verdana>Ubuntu
-    Linux (i386)</span>
-  </h4>
-  <div style=FONT-FAMILY:Verdana>
-    To set up your Linux development environment, make sure you have the
-    following:<span style="WORD-SPACING:0px; FONT-STYLE:normal; FONT-VARIANT:normal; FONT-WEIGHT:normal; font-size-adjust:none; font-stretch:normal; TEXT-TRANSFORM:none; COLOR:#000000; WHITE-SPACE:normal; LETTER-SPACING:normal; border-collapse:separate"><font size=2>
-    </font></span>
-  </div>
-  <div style="MARGIN-TOP:0px; MARGIN-BOTTOM:0px; FONT-FAMILY:Verdana">
-    <div style="MARGIN-TOP:0px; MARGIN-BOTTOM:0px">
-      <div style="MARGIN-TOP:0px; MARGIN-BOTTOM:0px">
-        <ul style="MARGIN-TOP:0px; MARGIN-BOTTOM:0px">
-          <li style="MARGIN-TOP:8px; MARGIN-BOTTOM:8px">
-            Git 1.5.4 or
-            newer<span style="FONT-WEIGHT:normal; WORD-SPACING:0px; TEXT-TRANSFORM:none; COLOR:#000000; FONT-STYLE:normal; WHITE-SPACE:normal; LETTER-SPACING:normal; border-collapse:separate; FONT-VARIANT:normal"><font size=2>.&nbsp;</font></span>
-          </li>
-        </ul>
-      </div>
-    </div>
-  </div>
-  <blockquote style="BORDER:medium none ; MARGIN:0pt 0pt 0pt 40px; PADDING:0px">
-    <span style=FONT-FAMILY:arial><span style="FONT-WEIGHT:normal; WORD-SPACING:0px; TEXT-TRANSFORM:none; COLOR:#000000; FONT-STYLE:normal; WHITE-SPACE:normal; LETTER-SPACING:normal; border-collapse:separate; FONT-VARIANT:normal"><span style="FONT-FAMILY:courier new,monospace">$
-    </span></span><span style="FONT-FAMILY:courier new,monospace">sudo apt-get
-    install git-core<br>
-    </span></span>
-  </blockquote>
-  <div>
-    <div style="MARGIN-TOP:0px; MARGIN-BOTTOM:0px">
-      <div style="MARGIN-TOP:0px; MARGIN-BOTTOM:0px; FONT-FAMILY:arial,sans-serif">
-        <div style="MARGIN-TOP:0px; MARGIN-BOTTOM:0px">
-          <h4>
-            <a name=TOC-Ubuntu-Linux-amd64-></a><span style=FONT-FAMILY:Verdana>Ubuntu
-            Linux (amd64)</span>
-          </h4>
-          <span style=FONT-FAMILY:Verdana>This has not been as well
-          tested.</span>
-        </div>
-        <div style="MARGIN-TOP:0px; MARGIN-BOTTOM:0px; FONT-FAMILY:Verdana">
-          <br>
-        </div>
-        <div style="MARGIN-TOP:0px; MARGIN-BOTTOM:0px; FONT-FAMILY:Verdana">
-          The Android build requires a 32-bit build environment:
-        </div>
-        <div style="MARGIN-TOP:0px; MARGIN-BOTTOM:0px; FONT-FAMILY:Verdana">
-          <ul>
-            <li>
-              Get the packages as listed above in the i386
-              instructions:<span style="FONT-WEIGHT:normal; WORD-SPACING:0px; TEXT-TRANSFORM:none; COLOR:#000000; FONT-STYLE:normal; WHITE-SPACE:normal; LETTER-SPACING:normal; border-collapse:separate; FONT-VARIANT:normal">&nbsp;&nbsp;&nbsp;</span>
-            </li>
-          </ul>
-        </div>
-      </div>
-    </div>
-  </div>
-  <blockquote style="BORDER:medium none ; MARGIN:0pt 0pt 0pt 40px; PADDING:0px">
-    <span style=FONT-FAMILY:arial><span style="FONT-WEIGHT:normal; WORD-SPACING:0px; TEXT-TRANSFORM:none; COLOR:#000000; FONT-STYLE:normal; WHITE-SPACE:normal; LETTER-SPACING:normal; border-collapse:separate; FONT-VARIANT:normal"><span style="FONT-FAMILY:courier new,monospace">$&nbsp;</span></span><span style="FONT-FAMILY:courier new,monospace">sudo
-    apt-get install git-core<br>
-    </span></span>
-  </blockquote>
-  <h4>
-    <a name=TOC-Other-Linux></a>Other Linux
-  </h4>
-  <p>
-    There's
-    no&nbsp;reason&nbsp;why&nbsp;Android&nbsp;cannot&nbsp;be&nbsp;built&nbsp;on&nbsp;non-Ubuntu&nbsp;systems<span style=FONT-WEIGHT:normal><font size=2>.&nbsp;In&nbsp;general&nbsp;you&nbsp;will&nbsp;need:</font></span>
-  </p>
-  <ul>
-    <li>
-      Git&nbsp;1.5.4&nbsp;or&nbsp;newer.&nbsp;You&nbsp;can&nbsp;find&nbsp;it&nbsp;at&nbsp;<a href=http://git.or.cz/ rel=nofollow>http://git.or.cz/</a><span style=FONT-FAMILY:arial></span>
-    </li>
-  </ul>
-  <div>
-    <h3>
-      Mac OS Installation
-    </h3>
-    <ul>
-      <li>
-        <span style=FONT-FAMILY:arial,sans-serif>To build the Android files in a
-        Mac OS environment, you need an Intel/x86 machine. The Android build
-        system and tools do not support the older PowerPC architecture.</span>
-      </li>
-      <li>
-        <span style=FONT-FAMILY:arial,sans-serif>Android must be built on a
-        case-sensitive file system.<br>
-        </span>
-      </li>
-      <ul>
-        <li>
-          We recommend that you build Android on a partition that has been
-          formatted with the "Case-sensitive Journaled HFS+" file system:
-        </li>
-        <ul>
-          <li>
-            A case-sensitive file system is required because the sources contain
-            files that differ only in case.
-          </li>
-          <li>
-            Journaled systems are more robust. (This is optional, but
-            recommended.)
-          </li>
-          <li>
-            HFS+ is required to successfully build Mac OS applications such as
-            the Android Emulator for OS X.
-          </li>
-        </ul>
-        <li>
-          If you want to avoid partitioning/formatting your hard drive, you can
-          use a case-sensitive disk image instead.
-        </li>
-        <ul>
-          <li>
-            To create the image:<br>
-            <ul>
-              <li>
-                launch /Applications/Utilities/Disk Utility
-              </li>
-              <li>
-                select "New Image"
-              </li>
-              <li>
-                size: 8 GB (this will work, but you can choose more if you want
-                to)
-              </li>
-              <li>
-                volume format: case sensitive, journaled
-              </li>
-            </ul>
-          </li>
-          <li>
-            This will create a .dmg file which, once mounted, acts as a drive
-            with the required formatting for Android development. For a disk
-            image named "android.dmg" stored in your home directory, you can add
-            the following to your ~/.bash_profile to mount the image when you
-            execute "mountAndroid":<br>
-            <br>
-            <div style=MARGIN-LEFT:40px>
-              <span style="FONT-FAMILY:courier new,monospace"># command to mount
-              the android file
-              image</span><br style="FONT-FAMILY:courier new,monospace">
-              <span style="FONT-FAMILY:courier new,monospace">function
-              mountAndroid&nbsp; { hdiutil attach ~/android.dmg&nbsp;
-              -mountpoint /Volumes/android; }</span><br>
-            </div>
-            <br>
-            Once mounted, you'll do all your work in the "android" volume. You
-            can eject it (unmount it) just like you would with an external
-            drive.
-          </li>
-        </ul>
-      </ul>
-    </ul>
-    <div>
-      <br>
-      <ul>
-        <li>
-          Install git 1.5.4 or newer. You can find it at
-          <a href=http://git.or.cz/ rel=nofollow>http://git.or.cz/</a>
-        </li>
-      </ul>
-      <h2>
-        Installing the Android SDK
-      </h2>
-      The Android NDK uses the Android SDK.&nbsp;You can find the Android SDK at
-      <a href=http://code.google.com/android/download.html id=a.-o title=http://code.google.com/android/download.html>http://code.google.com/android/download.html</a><br>
-      This version of the Android NDK requires the Cupcake version of the
-      Android SDK.<br>
-      <br>
-      <h2>
-        Installing the Prebuilt Native Toolchain<br>
-      </h2>
-      The NDK uses the prebuilt native toolchain from the Android Open Source
-      git repository.<br>
-      <br>
-      To download the prebuilt native toolchain to your working directory,
-      execute the following commands:<br>
-      <br>
-      <span style="FONT-FAMILY:Courier New"></span>
-      <div style=MARGIN-LEFT:40px>
-        <span style="FONT-FAMILY:Courier New">git clone
-        git://android.git.kernel.org/platform/prebuilt.git</span><br>
-        <span style="FONT-FAMILY:Courier New">cd prebuilt</span><br>
-        <span style="FONT-FAMILY:Courier New">git checkout -b cupcake -t
-        origin/cupcake</span><br>
-      </div>
-      <div style=MARGIN-LEFT:40px>
-        <span style="FONT-FAMILY:Courier New"></span>
-      </div>
-      <br>
-      <h2>
-        Setting Environment Variables
-      </h2>
-      The NDK requires that you set two environment variables:<br>
-      <ul>
-        <li>
-          PREBUILT must be set to the directory that contains the prebuilt
-          toolchain. Include the "prebuilt" directory in the path. Example:
-          /Volumes/android/prebuilt<br>
-        </li>
-        <li>
-          ANDROID_SDK_BASE must be set to the directory that contains the
-          Android SDK. Example: ~/AndroidSDK<br>
-        </li>
-      </ul>
-      <br>
-      <h2>
-        <span style=FONT-FAMILY:Verdana>Unpacking the NDK</span>
-      </h2>
-      Unpack the android_pndk.tar.gz into your working directory<br>
-      <br>
-      <div style=MARGIN-LEFT:40px>
-        <span style="FONT-FAMILY:Courier New">tar -zxvf
-        android_pndk.tar.gz</span><br>
-      </div>
-      <br>
-      This will create a directory called pndk. It should contain a README.html
-      file (this file) and the following directories: config, include, lib, and
-      sample.<br>
-      <br>
-      Look in the "samples" directory for samples showing how to use the NDK.<br>
-      <br>
-      <br>
-    </div>
-    <br>
-  </div>
-  <br>
-</div>
-<br></body>
-</html>
\ No newline at end of file
diff --git a/pdk/pndk/Pndk.mk b/pdk/pndk/Pndk.mk
deleted file mode 100644
index ce9e3b0..0000000
--- a/pdk/pndk/Pndk.mk
+++ /dev/null
@@ -1,232 +0,0 @@
-#
-# Copyright (C) 2008 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Assemble the Native Development Kit
-# Assembled using the generic build by default.
-# (set in device/config/product_config.make)
-
-# A macro to make rules to copy all newer files in a directory tree matching an
-# optional find filter and add the files to a list variable for dependencies.
-# Designed after copy_headers.make: Create a rule to copy each file;
-# copy-one-file defines the actual rule.
-# $(1): source directory tree root
-# $(2): destination directory tree root
-# $(3): list variable to append destination files to
-# $(4): optional find(1) arguments
-define define-tree-copy-rules
-  $(eval _src_files := $(shell find $(1) -type f $(4))) \
-  $(foreach _src, $(_src_files), \
-    $(eval _dest := $(patsubst $(1)%,$(2)%,$(_src))) \
-    $(eval $(3) := $($(3)) $(_dest)) \
-    $(eval $(call copy-one-file,$(_src),$(_dest))) \
-   )
-endef
-
-#-------------------------------------------------------------------------------
-# Install all the files needed to build the pndk.
-#   We build three versions of the pndk
-#       (1) The full version, with source.
-#       (2) The full version, without source.
-#       (3) A JNI-only version, with source.
-#
-#   We make five sets of trees:
-#		(A) Common files used in all versions of the pndk
-#   (B) Common files used in the full versions of the pndk
-#		(C) Files used in the standard pndk (no source files included)
-#		(D) Files used in both the JNI-only and full-with-source version
-#		(E) Files used in just the full-with-source version
-#
-#   Each pndk version is created by combining the appropriate trees:
-#
-#            (A)   (B)  (C)  (D)  (E)
-#       (1)  yes   yes       yes  yes
-#       (2)  yes   yes  yes
-#       (3)  yes             yes
-#
-# Source is provided for partners who want to recompile our libraries for optimization.
-# The JNI-only version is provided for partners that want to create shared
-# libraries that can be packaged with APK files and called from Java code.
-
-LOCAL_PATH := $(call my-dir)
-
-# Source trees for the pndk
-samples_src_dir := $(LOCAL_PATH)/samples
-sample_src_dir := $(samples_src_dir)/sample
-samplejni_src_dir := $(samples_src_dir)/samplejni
-config_src_dir := $(LOCAL_PATH)/config
-kernel_common_src_dir := $(KERNEL_HEADERS_COMMON)
-kernel_arch_src_dir := $(KERNEL_HEADERS_ARCH)
-bionic_src_dir := bionic
-jni_src_dir := $(JNI_H_INCLUDE)
-
-# Workspace directory
-pndk_intermediates := $(call intermediates-dir-for,PACKAGING,pndk)
-
-# Common destination trees for the pndk
-pndk_common_tree := $(pndk_intermediates)/common
-pndk_common_dest_dir := $(pndk_common_tree)/pndk
-samplejni_dest_dir := $(pndk_common_dest_dir)/samples/samplejni
-config_dest_dir := $(pndk_common_dest_dir)/config
-kernel_dest_dir := $(pndk_common_dest_dir)/include/kernel/include
-gcc_dest_dir := $(pndk_common_dest_dir)/toolchain
-jni_dest_dir := $(pndk_common_dest_dir)/include/nativehelper
-
-# Common-full destination trees for the pndk
-pndk_common_full_tree := $(pndk_intermediates)/common_full
-pndk_common_full_dest_dir := $(pndk_common_full_tree)/pndk
-sample_dest_dir := $(pndk_common_full_dest_dir)/samples/sample
-
-# Destination trees without source for the standard pndk (without source)
-pndk_no_src_tree := $(pndk_intermediates)/no_src
-pndk_no_src_dest_dir := $(pndk_no_src_tree)/pndk
-bionic_no_src_dest_dir := $(pndk_no_src_dest_dir)/include/bionic
-
-# Destination trees including source for the pndk with source
-pndk_src_tree := $(pndk_intermediates)/with_src
-pndk_src_dest_dir := $(pndk_src_tree)/pndk
-bionic_src_dest_dir := $(pndk_src_dest_dir)/include/bionic
-
-# Destinations of all common files (not picked up by tree rules below)
-pndk_common_dest_files := $(pndk_common_dest_dir)/Android_PNDK_README.html \
-		$(pndk_common_dest_dir)/config/armelf.x \
-		$(pndk_common_dest_dir)/config/armelflib.x \
-		$(pndk_common_dest_dir)/lib/crtbegin_dynamic.o \
-		$(pndk_common_dest_dir)/lib/crtend_android.o \
-		$(pndk_common_dest_dir)/lib/libc.so \
-		$(pndk_common_dest_dir)/lib/libm.so 
-    
-# Destinations of files used by the full, non-jni-only configurations
-pndk_common_full_dest_files := \
-		$(pndk_common_full_dest_dir)/lib/libdl.so \
-		$(pndk_common_full_dest_dir)/lib/libstdc++.so
-
-# Install common files outside common trees
-$(pndk_common_dest_dir)/Android_PNDK_README.html: $(LOCAL_PATH)/Android_PNDK_README.html | $(ACP)
-	@echo "pndk Android_PNDK_README.html: from $? to $@"
-	$(copy-file-to-target)
-
-$(pndk_common_dest_dir)/config/armelf.x: $(BUILD_SYSTEM)/armelf.x | $(ACP)
-	@echo "pndk config: $@"
-	$(copy-file-to-target)
-
-$(pndk_common_dest_dir)/config/armelflib.x: $(BUILD_SYSTEM)/armelflib.x | $(ACP)
-	@echo "pndk config: $@"
-	$(copy-file-to-target)
-
-$(pndk_common_dest_dir)/lib/%: $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/% | $(ACP)
-	@echo "pndk lib: $@"
-	$(copy-file-to-target)
-
-# Install common_full files outside common trees
-$(pndk_common_full_dest_dir)/lib/%: $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/% | $(ACP)
-	@echo "pndk lib full: $@"
-	$(copy-file-to-target)
-
-# Install files in common trees
-listvar := pndk_common_dest_files
-$(call define-tree-copy-rules,$(samplejni_src_dir),$(samplejni_dest_dir),$(listvar))
-$(call define-tree-copy-rules,$(config_src_dir),$(config_dest_dir),$(listvar))
-$(call define-tree-copy-rules,$(kernel_common_src_dir),$(kernel_dest_dir),$(listvar))
-$(call define-tree-copy-rules,$(kernel_arch_src_dir),$(kernel_dest_dir),$(listvar))
-$(call define-tree-copy-rules,$(jni_src_dir),$(jni_dest_dir),$(listvar), -name jni.h)
-
-# Install files common to the full builds but not the JNI build
-listvar := pndk_common_full_dest_files
-$(call define-tree-copy-rules,$(sample_src_dir),$(sample_dest_dir),$(listvar))
-
-# Install files without sources
-listvar := pndk_no_src_dest_files
-$(call define-tree-copy-rules,$(bionic_src_dir),$(bionic_no_src_dest_dir),$(listvar),-name '*.h')
-
-# Install files including sources
-listvar := pndk_with_src_dest_files
-$(call define-tree-copy-rules,$(bionic_src_dir),$(bionic_src_dest_dir),$(listvar))
-
-
-#-------------------------------------------------------------------------------
-# Create the multiple versions of the pndk:
-# pndk_no_src           all files without source
-# pndk_with_source      all files with source
-# pndk_jni_with_source  just files for building JNI shared libraries with source.
-
-# Name the tar files
-name := android_pndk-$(TARGET_PRODUCT)
-ifeq ($(TARGET_BUILD_TYPE),debug)
-  name := $(name)_debug
-endif
-name := $(name)-$(BUILD_NUMBER)
-pndk_tarfile := $(pndk_intermediates)/$(name).tar
-pndk_tarfile_zipped := $(pndk_tarfile).gz
-pndk_with_src_tarfile := $(pndk_intermediates)/$(name)-src.tar
-pndk_with_src_tarfile_zipped := $(pndk_with_src_tarfile).gz
-pndk_jni_with_src_tarfile := $(pndk_intermediates)/$(name)-jni-src.tar
-pndk_jni_with_src_tarfile_zipped := $(pndk_jni_with_src_tarfile).gz
-
-.PHONY: pndk pndk_with_src pndk_no_src pndk_jni_with_src pndk_debug
-
-pndk: pndk_no_src pndk_with_src pndk_jni_with_src
-pndk_no_src: $(pndk_tarfile_zipped)
-pndk_with_src: $(pndk_with_src_tarfile_zipped)
-pndk_jni_with_src: $(pndk_jni_with_src_tarfile_zipped)
-
-# Put the pndk zip files in the distribution directory
-$(call dist-for-goals,pndk,$(pndk_tarfile_zipped))
-$(call dist-for-goals,pndk,$(pndk_with_src_tarfile_zipped))
-$(call dist-for-goals,pndk,$(pndk_jni_with_src_tarfile_zipped))
-
-# zip up tar files
-%.tar.gz: %.tar
-	@echo "pndk: zipped $<"
-	$(hide) gzip -cf $< > $@
-
-# tar up the files without our sources to make the pndk.
-$(pndk_tarfile): $(pndk_common_dest_files) $(pndk_common_full_dest_files) $(pndk_no_src_dest_files)
-	@echo "pndk: $@"
-	@mkdir -p $(dir $@)
-	@rm -f $@
-	$(hide) tar rf $@ -C $(pndk_common_tree) pndk
-	$(hide) tar rf $@ -C $(pndk_common_full_tree) pndk
-	$(hide) tar rf $@ -C $(pndk_no_src_tree) pndk
-
-# tar up the full sources to make the pndk with sources.
-$(pndk_with_src_tarfile): $(pndk_common_dest_files) $(pndk_common_full_dest_files) $(pndk_with_src_dest_files) $(pndk_full_with_src_dest_files)
-	@echo "pndk: $@"
-	@mkdir -p $(dir $@)
-	@rm -f $@
-	$(hide) tar rf $@ -C $(pndk_common_tree) pndk
-	$(hide) tar rf $@ -C $(pndk_common_full_tree) pndk
-	$(hide) tar rf $@ -C $(pndk_src_tree) pndk
-	
-# tar up the sources to make the pndk with JNI support.
-$(pndk_jni_with_src_tarfile): $(pndk_common_dest_files) $(pndk_with_src_dest_files)
-	@echo "pndk: $@"
-	@mkdir -p $(dir $@)
-	@rm -f $@
-	$(hide) tar rf $@ -C $(pndk_common_tree) pndk
-	$(hide) tar rf $@ -C $(pndk_src_tree) pndk
-
-# Debugging reporting can go here, add it as a target to get output.
-pndk_debug: pndk
-	@echo "You are here: $@"
-	@echo "pndk tar file:          $(pndk_tarfile_zipped)"
-	@echo "pndk_with_src tar file: $(pndk_with_src_tarfile_zipped)"
-	@echo "pndk_jni_with_src tar file: $(pndk_jni_with_src_tarfile_zipped)"
-	@echo "pndk_files:             $(pndk_no_src_dest_files)"
-	@echo "pndk_with_src files:    $(pndk_with_src_dest_files)"
-	@echo "pndk_full_with_src files:    $(pndk_full_with_src_dest_files)"
-	@echo "pndk_common_files:      $(pndk_common_dest_files)"
-	@echo "pndk_common_full_dest_files:      $(pndk_common_full_dest_files)"
-
diff --git a/pdk/pndk/config/config.mk b/pdk/pndk/config/config.mk
deleted file mode 100644
index a6972b1..0000000
--- a/pdk/pndk/config/config.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-# Assumes PREBUILT is defined to point to the correct flavor of the prebuilt 
-# directory in the Android source tree
-
-CC  := $(PREBUILT)/toolchain/arm-eabi-4.2.1/bin/arm-eabi-gcc
-AR  := $(PREBUILT)/toolchain/arm-eabi-4.2.1/bin/arm-eabi-ar
-
-INC   := -I$(NDK_BASE)/include/bionic/libc/arch-arm/include \
-         -I$(NDK_BASE)/include/kernel/include \
-         -I$(NDK_BASE)/include/bionic/libm/include \
-         -I$(NDK_BASE)/include/bionic/libm/include/arm \
-         -I$(NDK_BASE)/include/bionic/libc/include \
-         -I$(NDK_BASE)/include/bionic/libstdc++/include
-
-LINK       := -nostdlib -Bdynamic \
-     -Wl,-T,$(NDK_BASE)/config/armelf.x \
-     -Wl,-dynamic-linker,/system/bin/linker \
-     -Wl,-z,nocopyreloc \
-     -L$(NDK_BASE)/lib \
-     -Wl,-rpath-link=$(NDK_BASE)/lib \
-    $(NDK_BASE)/lib/crtbegin_dynamic.o
-
-POSTLINK := $(NDK_BASE)/lib/crtend_android.o
-
-%.o: %.cpp
-	$(CC) $(CFLAGS) -fno-exceptions -fno-rtti $(INC) -o $@ -c $< 
-  
-%.o: %.c
-	$(CC) $(CFLAGS) $(INC) -o $@ -c $< 
-  
diff --git a/pdk/pndk/samples/sample/Makefile b/pdk/pndk/samples/sample/Makefile
deleted file mode 100644
index a66ae86..0000000
--- a/pdk/pndk/samples/sample/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-
-NDK_BASE   := ../..
-
-include $(NDK_BASE)/config/config.mk
-
-EXECUTABLE := hello
-SOURCES    := hello.c
-OBJECTS    := $(SOURCES:.c=.o)
-LIBS       := -lc -lm
-
-all: $(EXECUTABLE)
-
-# need $(LINK) before all objects and $(POSTLINK) after all objects for 
-# android runtime setup.
-
-hello: $(OBJECTS)
-	$(CC) $(LINK) -o $@ $(OBJECTS) $(LIBS) $(POSTLINK)
-
-clean:
-	rm -rf *.o hello
-
diff --git a/pdk/pndk/samples/sample/Makefile.hello_cpp b/pdk/pndk/samples/sample/Makefile.hello_cpp
deleted file mode 100644
index 5d82b66..0000000
--- a/pdk/pndk/samples/sample/Makefile.hello_cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-NDK_BASE   := ../..
-
-include $(NDK_BASE)/config/config.mk
-
-EXECUTABLE := hello_cpp
-SOURCES    := hello_cpp.cpp
-OBJECTS    := $(SOURCES:.cpp=.o)
-LIBS       := -lc -lm -lstdc++
-
-all: $(EXECUTABLE)
-
-# need $(LINK) before all objects and $(POSTLINK) after all objects for 
-# android runtime setup.
-
-hello_cpp: $(OBJECTS)
-	$(CC) $(LINK) -o $@ $(OBJECTS) $(LIBS) $(POSTLINK)
-
-clean:
-	rm -rf *.o hello_cpp
-
diff --git a/pdk/pndk/samples/sample/Makefile.lib b/pdk/pndk/samples/sample/Makefile.lib
deleted file mode 100644
index fbb5a14..0000000
--- a/pdk/pndk/samples/sample/Makefile.lib
+++ /dev/null
@@ -1,31 +0,0 @@
-
-NDK_BASE   := ../..
-
-include $(NDK_BASE)/config/config.mk
-
-# Assumes PREBUILT is defined to point to the correct flavor of the prebuilt 
-# directory in the Android source tree
-
-SOURCES    := hellolibrary.c
-OBJECTS    := $(SOURCES:.c=.o)
-LIBS       := -lc -lm
-ALIB       := $(PREBUILT)/toolchain/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a
-
-all: sharedlib staticlib
-
-# Using shared and static suffixes as these are going in the same directory;
-# typically you would not do this as you would make only one version,
-# but if we don't we'll screw up the linking because of linker defaults.
-
-staticlib: $(OBJECTS)
-	$(AR) -cr libhello-static.a $(OBJECTS) 
-	
-sharedlib: hellolibrary-shared.o
-	$(CC) -nostdlib -Wl,-soname,libhello-shared.so -Wl,-shared,-Bsymbolic -L$(NDK_BASE)/lib $^ $(LIBS) -o libhello-shared.so -Wl,--no-undefined $(ALIB)
-	
-hellolibrary-shared.o: hellolibrary.c
-	$(CC) -c -fpic $(INC) -o $@ $^ 
-
-clean:
-	rm -rf *.o libhello-static.a libhello-shared.so
-					                                            
diff --git a/pdk/pndk/samples/sample/Makefile.uselib b/pdk/pndk/samples/sample/Makefile.uselib
deleted file mode 100644
index b44eae2e..0000000
--- a/pdk/pndk/samples/sample/Makefile.uselib
+++ /dev/null
@@ -1,23 +0,0 @@
-
-NDK_BASE   := ../..
-
-include $(NDK_BASE)/config/config.mk
-
-SOURCES    := use_hellolibrary.c
-OBJECTS    := $(SOURCES:.c=.o)
-LIBS       := -lc -lm 
-
-all: use_hellolibrary-a use_hellolibrary-so
-
-# need $(LINK) before all objects and $(POSTLINK) after all objects for 
-# android runtime setup.
-
-use_hellolibrary-a: $(OBJECTS)
-	$(CC) $(LINK) -o $@ $(OBJECTS) $(LIBS) -L. -lhello-static $(POSTLINK)
-
-use_hellolibrary-so: $(OBJECTS)
-	$(CC) $(LINK) -o $@ $(OBJECTS) $(LIBS) -L. -lhello-shared $(POSTLINK)
-
-clean:
-	rm -rf *.o use_hellolibrary-a use_hellolibrary-so
-
diff --git a/pdk/pndk/samples/sample/README b/pdk/pndk/samples/sample/README
deleted file mode 100644
index ecc751f..0000000
--- a/pdk/pndk/samples/sample/README
+++ /dev/null
@@ -1,135 +0,0 @@
-Building native code applications and libraries
-
-STEP 1
-Building an application.
---------
-
-0) set the environment variable PREBUILT to point to the Android prebuilt directory
-  export PREBUILT=<path_to_android_src>/prebuilt/<platform>
-
-where you type in the actual path to the android source in place of <path_to_android_src>
-and the platform you are using instead of <platform>: either linux-x86 or darwin-x86
-
-1) Test the pndk install by building the hello world sample application:
-
-  cd <your_pndk_base>/samples/sample
-  make clean
-  make
-
-The sample application uses hello.c to construct the hello binary,  which you 
-can load and run on the ARM device. To achieve proper runtime behavior, verify
-that:
-  * crtbegin_dynamic.o is the first linked object file
-  * crtend_android.o is last linked object.
-Both are set by the config.mk file in pndk/config.
-
-2) Test that this works correctly by attaching your ARM-based device to the USB 
-port and installing the application (hello) you just made by (in the commands
-below # is the ARM device's shell prompt):
-
-NOTE: need a development build so remount opens system permissions
-
-  adb remount
-  adb push hello system/app
-  adb shell
-  # cd system/app
-  # ./hello
-  Hello from the NDK; no user libraries.
-  # exit
-
-3) You may also build the c++ binary hello_cpp.cpp into an application:
-
-  make -f Makefile.hello_cpp clean
-  make -f Makefile.hello_cpp hello_cpp
-
-This uses the hello_cpp.cpp and hello_cpp.h files to construct the hello_cpp 
-binary application, which you can load and run on the ARM device.  Note that
-we do not provide for C++ exceptions thus you must use the -fno-exceptions flag
-when compiling.
-
-  adb push hello_cpp system/app
-  adb shell
-  # cd system/app
-  # ./hello_cpp
-  C++ example printing message: Hello world!
-  # exit
-
-
-STEP 2
-Building and using a library 
--------
-
-Makefile.lib in pndk/sample shows how to make either a shared library or a 
-static library from the hellolibrary.c source.  The example makes the libraries
-libhello-shared.so and libhello-static.a .
-
-Makefile.uselib then shows how to make an application that links against either
-a shared or a static library.  They examples shows how to build the two
-applications use_hellolibrary-so and use-hellolibrary-a from the source
-use_hellolibrary.c.
-
-1) To make a shared library and an application that uses it:
-
-  make -f Makefile.lib clean
-  make -f Makefile.lib sharedlib
-  make -f Makefile.uselib clean
-  make -f Makefile.uselib use_hellolibrary-so
-
-2) Copy the shared library libhello-shared.so to /system/lib (or the location 
-in which shared libraries are found by the kernel on your ARM-based device.) 
-
-  adb push libhello-shared.so system/lib
- 
-You would not typically use the -shared or -static extensions in the filename, 
-but the distinction is important in the case where a static and shared library 
-are made in the same directory. Giving the files different names allows you to 
-override the link defaults that default to a static library of the same name.
-
-3) The application, use_hellolibrary-so, can now be tested by loading and 
-running on the ARM device. 
-
-  adb push use_hellolibrary-so /system/app
-  adb shell
-  # cd system/app
-  # ./use_hellolibrary-so
-  Library printing message: Hello from the NDK.
-  # exit
-
-4) To make a static library:
-
-  make -f Makefile.lib clean
-  make -f Makefile.lib staticlib
-  make -f Makefile.uselib clean
-  make -f Makefile.uselib use_hellolibrary-a
-
-5) Test the application use_hellolibrary-a by loading and running it on the ARM
-device.
-
-  adb push use_hellolibrary-a system/app
-  adb shell
-  # cd system/app
-  # ./use_hellolibrary-a
-  Library printing message: Hello from the NDK.
-  # exit
-
-
-SUMMARY:
----------
-
-To make everything execute the following:
-
-make clean
-make
-make -f Makefile.lib clean
-make -f Makefile.lib
-make -f Makefile.uselib clean
-make -f Makefile.uselib
-make -f Makefile.hello_cpp clean
-make -f Makefile.hello_cpp hello_cpp
-
-
-You should have:
-	* The libraries libhello-static.a and libhello-shared.so built, the latter
-			ready for installation,
-	* The applications hello, use_hellolibrary-a, and use_hellolibrary-so 
-			available for installation on the ARM device.
diff --git a/pdk/pndk/samples/sample/hello.c b/pdk/pndk/samples/sample/hello.c
deleted file mode 100644
index b7d750f..0000000
--- a/pdk/pndk/samples/sample/hello.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <stdio.h>
-
-int main(int argc, char *argv[])
-{
-  printf("Hello from the NDK; no user libraries.\n");
-  return 0;
-}
diff --git a/pdk/pndk/samples/sample/hello_cpp.cpp b/pdk/pndk/samples/sample/hello_cpp.cpp
deleted file mode 100644
index c0a157a..0000000
--- a/pdk/pndk/samples/sample/hello_cpp.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdio.h>
-#include "hello_cpp.h"
-
-Hello::Hello()
-{
-}
-
-Hello::~Hello()
-{
-}
-
-void Hello::printMessage(char* msg)
-{
-  printf("C++ example printing message: %s", msg);
-}
-
-int main(void)
-{
-  Hello hello_obj;
-  hello_obj.printMessage("Hello world!\n");
-  return 0;
-}
diff --git a/pdk/pndk/samples/sample/hello_cpp.h b/pdk/pndk/samples/sample/hello_cpp.h
deleted file mode 100644
index b98ae7f..0000000
--- a/pdk/pndk/samples/sample/hello_cpp.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef HELLO_CPP_H
-#define HELLO_CPP_H
-
-class Hello
-{
-public:
-    Hello();
-    ~Hello();
-    void printMessage(char* msg);
-};
-
-#endif
diff --git a/pdk/pndk/samples/sample/hellolibrary.c b/pdk/pndk/samples/sample/hellolibrary.c
deleted file mode 100644
index 90f98fa..0000000
--- a/pdk/pndk/samples/sample/hellolibrary.c
+++ /dev/null
@@ -1,10 +0,0 @@
-/* hellolibrary.c - demonstrate library use with the NDK. 
- * This will be the library that gets called as wither a static or shared lib.*/
-
-#include <stdio.h>
-
-int hellolibrary(char *msg)
-{
-  printf("Library printing message: %s", msg);
-  return 0;
-}
diff --git a/pdk/pndk/samples/sample/use_hellolibrary.c b/pdk/pndk/samples/sample/use_hellolibrary.c
deleted file mode 100644
index e32a364..0000000
--- a/pdk/pndk/samples/sample/use_hellolibrary.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* use_hellolibrary.c -- used to show how to link to the hellolibrary */
-
-int hellolibrary(char *msg);
-
-int main()
-{
-  hellolibrary("Hello from the NDK.\n");
-  return 0;
-}
diff --git a/pdk/pndk/samples/samplejni/AndroidManifest.xml b/pdk/pndk/samples/samplejni/AndroidManifest.xml
deleted file mode 100644
index 450eb0b..0000000
--- a/pdk/pndk/samples/samplejni/AndroidManifest.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-      package="com.example.jniexample"
-      android:versionCode="1"
-      android:versionName="1.0.0">
-    <application android:icon="@drawable/icon" android:label="@string/app_name">
-        <activity android:name=".JNIExample"
-                  android:label="@string/app_name">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-</manifest> 
\ No newline at end of file
diff --git a/pdk/pndk/samples/samplejni/Makefile b/pdk/pndk/samples/samplejni/Makefile
deleted file mode 100644
index 18e97df..0000000
--- a/pdk/pndk/samples/samplejni/Makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-# Package a shared library into an APK
-
-NDK_BASE   := ../..
-
-# Assume ANDROID_SDK_BASE is defined to point to the base of the Android SDK
-# Assumes PREBUILT is defined to point to the prebuilt directory of the Android source
-
-include $(NDK_BASE)/config/config.mk
-
-SOURCES    := native.cpp
-OBJECTS    := $(SOURCES:.cpp=.o)
-LIBS       := -lc -lm
-ALIB       := $(PREBUILT)/toolchain/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a
-
-APKBUILDER := $(ANDROID_SDK_BASE)/tools/apkbuilder
-
-APK_INPUT_DIR := bin
-APK_OUTPUT_DIR := bin/full
-
-APK_NAME   := JNIExample.apk
-INPUT_APK  := $(APK_INPUT_DIR)/$(APK_NAME)
-OUTPUT_APK := $(APK_OUTPUT_DIR)/$(APK_NAME)
-APK_STAGE  := $(APK_OUTPUT_DIR)/temp
-
-JNI_LIBS := libnative.so
-
-all: $(OUTPUT_APK)
-
-$(OUTPUT_APK) : $(INPUT_APK) $(JNI_LIBS)
-	rm -rf $(APK_STAGE)
-	mkdir -p $(APK_STAGE)
-	unzip $(INPUT_APK) -d $(APK_STAGE)
-	mkdir -p $(APK_STAGE)/lib/armeabi
-	cp $(JNI_LIBS) $(APK_STAGE)/lib/armeabi
-	$(APKBUILDER) $(OUTPUT_APK) -v -rf $(APK_STAGE)
-	rm -rf $(APK_STAGE)
-
-libnative.so: native.o
-	$(CC) -nostdlib -Wl,-soname,libhello-shared.so -Wl,-shared,-Bsymbolic -L$(NDK_BASE)/lib $^ $(LIBS) -o $@ -Wl,--no-undefined $(ALIB)
-	
-native.o: native.cpp
-	$(CC) -c -fpic $(INC) -I$(NDK_BASE)/include/nativehelper -o $@ $^ 
-
-clean:
-	rm -rf *.o libnative.so $(APK_OUTPUT_DIR)
diff --git a/pdk/pndk/samples/samplejni/README b/pdk/pndk/samples/samplejni/README
deleted file mode 100644
index c5ed772..0000000
--- a/pdk/pndk/samples/samplejni/README
+++ /dev/null
@@ -1,43 +0,0 @@
-JNI Example
-
-This sample shows how to build a native code library, package it into an APK, and call it using JNI.
-
-Prerequesites
-
-You must install the Android SDK in order to build the Java APK. The Android SDK can be downloaded
-from
-
-http://code.google.com/android/download.html
-
-Build Steps:
-
-1) Create an Eclipse project to for the Java code.
-
-	Launch Eclipse
-	Choose File : New : Project...
-	Choose Android : Android Project
-	Choose Next
-	Enter "JNIExample" into the Project name: field.
-	Choose "Create project from existing source"
-	Click the Browse button and browse to the pndk/samplejni directory
-	
-	Click Finish
-
-2) Build the Eclipse Project
-
-	Select the JNIExample project in the Package Explorer
-	Make sure that the menu item Project:Build Automatically is not checked.
-	Choose Project:Build
-
-    The resulting apk file ends up in bin/full/JNIExample.apk
-
-2) Build the shared library, insert the shared library into the APK file and resign the
-    shared library.
-
-    ANDROID_SDK_BASE=<directory where SDK is installed> make
-
-Install the APK on the device:
-
-	adb install -r bin/full/JNIExample.apk
-
-Once the application is installed, you can run it by tapping on the "JNI Example" icon.
diff --git a/pdk/pndk/samples/samplejni/native.cpp b/pdk/pndk/samples/samplejni/native.cpp
deleted file mode 100644
index 2e5fa4d..0000000
--- a/pdk/pndk/samples/samplejni/native.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#include <jni.h>
-#include <stdio.h>
-
-static jint
-add(JNIEnv *env, jobject thiz, jint a, jint b) {
-int result = a + b;
-    printf("%d + %d = %d", a, b, result);
-    return result;
-}
-
-static const char *classPathName = "com/example/jniexample/Native";
-
-static JNINativeMethod methods[] = {
-  {"add", "(II)I", (void*)add },
-};
-
-/*
- * Register several native methods for one class.
- */
-static int registerNativeMethods(JNIEnv* env, const char* className,
-    JNINativeMethod* gMethods, int numMethods)
-{
-    jclass clazz;
-
-    clazz = env->FindClass(className);
-    if (clazz == NULL) {
-        fprintf(stderr, "Native registration unable to find class '%s'", className);
-        return JNI_FALSE;
-    }
-    if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) {
-        fprintf(stderr, "RegisterNatives failed for '%s'", className);
-        return JNI_FALSE;
-    }
-
-    return JNI_TRUE;
-}
-
-/*
- * Register native methods for all classes we know about.
- */
-static int registerNatives(JNIEnv* env)
-{
-  if (!registerNativeMethods(env, classPathName,
-                 methods, sizeof(methods) / sizeof(methods[0]))) {
-    return JNI_FALSE;
-  }
-
-  return JNI_TRUE;
-}
-
-/*
- * Set some test stuff up.
- *
- * Returns the JNI version on success, -1 on failure.
- */
-
-typedef union {
-    JNIEnv* env;
-    void* venv;
-} UnionJNIEnvToVoid;
-
-jint JNI_OnLoad(JavaVM* vm, void* reserved)
-{
-    UnionJNIEnvToVoid uenv;
-    uenv.venv = NULL;
-    jint result = -1;
-    JNIEnv* env = NULL;
-    
-    printf("JNI_OnLoad");
-
-    if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) {
-        fprintf(stderr, "GetEnv failed");
-        goto bail;
-    }
-    env = uenv.env;
-
-    if (!registerNatives(env)) {
-        fprintf(stderr, "registerNatives failed");
-    }
-    
-    result = JNI_VERSION_1_4;
-    
-bail:
-    return result;
-}
diff --git a/pdk/pndk/samples/samplejni/res/drawable/icon.png b/pdk/pndk/samples/samplejni/res/drawable/icon.png
deleted file mode 100644
index 7502484..0000000
--- a/pdk/pndk/samples/samplejni/res/drawable/icon.png
+++ /dev/null
Binary files differ
diff --git a/pdk/pndk/samples/samplejni/res/values/strings.xml b/pdk/pndk/samples/samplejni/res/values/strings.xml
deleted file mode 100644
index a647beb..0000000
--- a/pdk/pndk/samples/samplejni/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-    <string name="app_name">JNI Example</string>
-</resources>
diff --git a/pdk/pndk/samples/samplejni/src/com/example/jniexample/JNIExample.java b/pdk/pndk/samples/samplejni/src/com/example/jniexample/JNIExample.java
deleted file mode 100644
index 315ee21..0000000
--- a/pdk/pndk/samples/samplejni/src/com/example/jniexample/JNIExample.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.example.jniexample;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.widget.TextView;
-
-public class JNIExample extends Activity {
-    /** Called when the activity is first created. */
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        TextView tv = new TextView(this);
-        int sum = Native.add(2, 3);
-        tv.setText("Native Code test: 2 + 3 = " + Integer.toString(sum));
-        setContentView(tv);
-    }
-}
-
-class Native {
-    static {
-        System.loadLibrary("native");
-    }
-
-    static native int add(int a, int b);
-}
diff --git a/pdk/sample/partner/company/mychipset/libaudio/Android.mk.stub b/pdk/sample/partner/company/mychipset/libaudio/Android.mk.stub
deleted file mode 100644
index d7c7524..0000000
--- a/pdk/sample/partner/company/mychipset/libaudio/Android.mk.stub
+++ /dev/null
@@ -1,20 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libaudio
-
-LOCAL_SHARED_LIBRARIES := \
-    libcutils \
-    libutils \
-    libmedia \
-    libhardware
-
-LOCAL_SRC_FILES += MyAudioHardware.cpp
-
-LOCAL_CFLAGS +=
-
-LOCAL_C_INCLUDES +=
-
-LOCAL_STATIC_LIBRARIES += libaudiointerface
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/pdk/sample/partner/company/mychipset/libcamera/Android.mk.stub b/pdk/sample/partner/company/mychipset/libcamera/Android.mk.stub
deleted file mode 100755
index 29ec868..0000000
--- a/pdk/sample/partner/company/mychipset/libcamera/Android.mk.stub
+++ /dev/null
@@ -1,15 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= MyCameraHardware.cpp
-
-LOCAL_STATIC_LIBRARIES:= \
-	libcamera-common
- 
-LOCAL_SHARED_LIBRARIES:= libutils liblog
-
-LOCAL_MODULE:= libcamera
-
-include $(BUILD_SHARED_LIBRARY)
-
diff --git a/pdk/sample/partner/wifi_company/mychipset/Android.mk.stub b/pdk/sample/partner/wifi_company/mychipset/Android.mk.stub
deleted file mode 100644
index 2964d28..0000000
--- a/pdk/sample/partner/wifi_company/mychipset/Android.mk.stub
+++ /dev/null
@@ -1,53 +0,0 @@
-# Install firmware file for WiFi
-#
-#
-# where to install the file on the device
-#
-
-local_target_dir := $(TARGET_OUT_ETC)/wifi
-
-########################
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := MyFirmwareFile.bin
-
-LOCAL_MODULE_TAGS := user development
-
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(local_target_dir)
-
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-
-include $(BUILD_PREBUILT)
-
-########################
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := MyFirmwareConfigFile.ini
-
-LOCAL_MODULE_TAGS := user development
-
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(local_target_dir)
-
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-
-include $(BUILD_PREBUILT)
-
-########################
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := wlan.ko
-
-LOCAL_MODULE_TAGS := user development
-
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules
-
-LOCAL_SRC_FILES := $(LOCAL_MODULE)
-
-include $(BUILD_PREBUILT)
-
-########################
-
diff --git a/samples/ApiDemos/AndroidManifest.xml b/samples/ApiDemos/AndroidManifest.xml
index 032f5c2..5eb8ccb 100644
--- a/samples/ApiDemos/AndroidManifest.xml
+++ b/samples/ApiDemos/AndroidManifest.xml
@@ -24,15 +24,24 @@
 
     <uses-permission android:name="android.permission.READ_CONTACTS" />
     <uses-permission android:name="android.permission.WRITE_CONTACTS" />
-    <uses-permission android:name="android.permission.CAMERA" />
     <uses-permission android:name="android.permission.VIBRATE" />
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
     <uses-permission android:name="android.permission.INTERNET" />
 
+    <!-- We will request access to the camera, saying we require a camera
+         of some sort but not one with autofocus capability. -->
+    <uses-permission android:name="android.permission.CAMERA" />
+    <uses-feature android:name="android.hardware.camera" />
+    <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
+    
     <application android:name="ApiDemosApplication"
             android:label="@string/activity_sample_code"
             android:icon="@drawable/app_sample_code" >
 
+        <!-- This is how we can request a library but still allow the app
+             to be installed if it doesn't exist. -->
+        <uses-library android:name="com.example.will.never.exist" android:required="false" />
+        
         <activity android:name="ApiDemos">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -72,6 +81,15 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".app.WallpaperActivity"
+                android:label="@string/activity_wallpaper"
+                android:theme="@style/Theme.Wallpaper">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
         <activity android:name=".app.TranslucentActivity"
                 android:label="@string/activity_translucent"
                 android:theme="@style/Theme.Translucent">
@@ -90,6 +108,13 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".app.Animation" android:label="@string/activity_animation">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
         <activity android:name=".app.SaveRestoreState"
                 android:label="@string/activity_save_restore"
                 android:windowSoftInputMode="stateVisible|adjustResize">
@@ -1562,6 +1587,13 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".graphics.ColorFilters" android:label="Graphics/ColorFilters">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
         <activity android:name=".graphics.CreateBitmap" android:label="Graphics/CreateBitmap">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
diff --git a/samples/ApiDemos/default.properties b/samples/ApiDemos/default.properties
deleted file mode 100644
index 9d79b12..0000000
--- a/samples/ApiDemos/default.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-# 
-# This file must be checked in Version Control Systems.
-# 
-# To customize properties used by the Ant build system use,
-# "build.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=android-4
diff --git a/samples/ApiDemos/res/anim/fade.xml b/samples/ApiDemos/res/anim/fade.xml
index 78b193d..617c5f2 100644
--- a/samples/ApiDemos/res/anim/fade.xml
+++ b/samples/ApiDemos/res/anim/fade.xml
@@ -16,4 +16,5 @@
 
 <alpha xmlns:android="http://schemas.android.com/apk/res/android"
        android:interpolator="@android:anim/accelerate_interpolator"
-       android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="100" />
+       android:fromAlpha="0.0" android:toAlpha="1.0"
+       android:duration="@android:integer/config_longAnimTime" />
diff --git a/samples/ApiDemos/res/anim/hold.xml b/samples/ApiDemos/res/anim/hold.xml
new file mode 100644
index 0000000..65fbacf
--- /dev/null
+++ b/samples/ApiDemos/res/anim/hold.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<translate xmlns:android="http://schemas.android.com/apk/res/android"
+       android:interpolator="@android:anim/accelerate_interpolator"
+       android:fromXDelta="0" android:toXDelta="0"
+       android:duration="@android:integer/config_longAnimTime" />
diff --git a/samples/ApiDemos/res/anim/slide_left.xml b/samples/ApiDemos/res/anim/slide_left.xml
index 8760491..0a591b0 100644
--- a/samples/ApiDemos/res/anim/slide_left.xml
+++ b/samples/ApiDemos/res/anim/slide_left.xml
@@ -15,5 +15,6 @@
 -->
 
 <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
-    <translate android:fromXDelta="100%p" android:toXDelta="0" android:duration="150" />
+    <translate android:fromXDelta="100%p" android:toXDelta="0"
+        android:duration="@android:integer/config_shortAnimTime" />
 </set>
diff --git a/samples/ApiDemos/res/anim/slide_right.xml b/samples/ApiDemos/res/anim/slide_right.xml
index 7aaacdb..edeed24 100644
--- a/samples/ApiDemos/res/anim/slide_right.xml
+++ b/samples/ApiDemos/res/anim/slide_right.xml
@@ -15,5 +15,6 @@
 -->
 
 <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
-    <translate android:fromXDelta="-100%p" android:toXDelta="0" android:duration="150" />
+    <translate android:fromXDelta="-100%p" android:toXDelta="0"
+            android:duration="@android:integer/config_shortAnimTime" />
 </set>
diff --git a/samples/ApiDemos/res/anim/zoom_enter.xml b/samples/ApiDemos/res/anim/zoom_enter.xml
new file mode 100644
index 0000000..7c29852
--- /dev/null
+++ b/samples/ApiDemos/res/anim/zoom_enter.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License"); 
+** you may not use this file except in compliance with the License. 
+** You may obtain a copy of the License at 
+**
+**     http://www.apache.org/licenses/LICENSE-2.0 
+**
+** Unless required by applicable law or agreed to in writing, software 
+** distributed under the License is distributed on an "AS IS" BASIS, 
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+-->
+
+<!-- Special window zoom animation: this is the element that enters the screen,
+     it starts at 200% and scales down.  Goes with zoom_exit.xml. -->
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+        android:interpolator="@android:anim/decelerate_interpolator">
+    <scale android:fromXScale="2.0" android:toXScale="1.0"
+           android:fromYScale="2.0" android:toYScale="1.0"
+           android:pivotX="50%p" android:pivotY="50%p"
+           android:duration="@android:integer/config_mediumAnimTime" />
+</set>
diff --git a/samples/ApiDemos/res/anim/zoom_exit.xml b/samples/ApiDemos/res/anim/zoom_exit.xml
new file mode 100644
index 0000000..29dfe99
--- /dev/null
+++ b/samples/ApiDemos/res/anim/zoom_exit.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License"); 
+** you may not use this file except in compliance with the License. 
+** You may obtain a copy of the License at 
+**
+**     http://www.apache.org/licenses/LICENSE-2.0 
+**
+** Unless required by applicable law or agreed to in writing, software 
+** distributed under the License is distributed on an "AS IS" BASIS, 
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+** See the License for the specific language governing permissions and 
+** limitations under the License.
+*/
+-->
+
+<!-- Special window zoom animation: this is the element that exits the
+     screen, it is forced above the entering element and starts at its
+     normal size (filling the screen) and scales down while fading out.
+     This goes with zoom_enter.xml. -->
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+        android:interpolator="@android:anim/decelerate_interpolator"
+        android:zAdjustment="top">
+    <scale android:fromXScale="1.0" android:toXScale=".5"
+           android:fromYScale="1.0" android:toYScale=".5"
+           android:pivotX="50%p" android:pivotY="50%p"
+           android:duration="@android:integer/config_mediumAnimTime" />
+    <alpha android:fromAlpha="1.0" android:toAlpha="0"
+            android:duration="@android:integer/config_mediumAnimTime"/>
+</set>
diff --git a/samples/ApiDemos/res/drawable-hdpi/alert_dialog_icon.png b/samples/ApiDemos/res/drawable-hdpi/alert_dialog_icon.png
new file mode 100755
index 0000000..fe54477
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/alert_dialog_icon.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/app_sample_code.png b/samples/ApiDemos/res/drawable-hdpi/app_sample_code.png
new file mode 100755
index 0000000..66a1984
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/app_sample_code.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/arrow_down_float.png b/samples/ApiDemos/res/drawable-hdpi/arrow_down_float.png
new file mode 100755
index 0000000..923d330
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/arrow_down_float.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/arrow_up_float.png b/samples/ApiDemos/res/drawable-hdpi/arrow_up_float.png
new file mode 100755
index 0000000..eda5faf
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/arrow_up_float.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/btn_check_off.png b/samples/ApiDemos/res/drawable-hdpi/btn_check_off.png
new file mode 100755
index 0000000..0cf1f04
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/btn_check_off.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/btn_check_on.png b/samples/ApiDemos/res/drawable-hdpi/btn_check_on.png
new file mode 100755
index 0000000..fc791c4
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/btn_check_on.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/btn_circle_normal.png b/samples/ApiDemos/res/drawable-hdpi/btn_circle_normal.png
new file mode 100755
index 0000000..bf3fb5a
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/btn_circle_normal.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/btn_default_normal.9.png b/samples/ApiDemos/res/drawable-hdpi/btn_default_normal.9.png
new file mode 100755
index 0000000..5d3d733
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/btn_default_normal.9.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/button.9.png b/samples/ApiDemos/res/drawable-hdpi/button.9.png
new file mode 100755
index 0000000..6995e60
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/button.9.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/ic_popup_reminder.png b/samples/ApiDemos/res/drawable-hdpi/ic_popup_reminder.png
new file mode 100755
index 0000000..9652dde
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/ic_popup_reminder.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/icon48x48_2.png b/samples/ApiDemos/res/drawable-hdpi/icon48x48_2.png
new file mode 100755
index 0000000..1e256e6
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/icon48x48_2.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/progress_circular_background.png b/samples/ApiDemos/res/drawable-hdpi/progress_circular_background.png
new file mode 100755
index 0000000..c4ecd1f
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/progress_circular_background.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/progress_particle.png b/samples/ApiDemos/res/drawable-hdpi/progress_particle.png
new file mode 100755
index 0000000..3e72fb4
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/progress_particle.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/robot.png b/samples/ApiDemos/res/drawable-hdpi/robot.png
new file mode 100755
index 0000000..3e4fd21
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/robot.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/scrollbar_state2.png b/samples/ApiDemos/res/drawable-hdpi/scrollbar_state2.png
new file mode 100755
index 0000000..41ed5b7
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/scrollbar_state2.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/star_big_on.png b/samples/ApiDemos/res/drawable-hdpi/star_big_on.png
new file mode 100755
index 0000000..944918e
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/star_big_on.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/stat_happy.png b/samples/ApiDemos/res/drawable-hdpi/stat_happy.png
new file mode 100755
index 0000000..27f5bb7
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/stat_happy.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/stat_neutral.png b/samples/ApiDemos/res/drawable-hdpi/stat_neutral.png
new file mode 100755
index 0000000..34073ff
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/stat_neutral.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/stat_sad.png b/samples/ApiDemos/res/drawable-hdpi/stat_sad.png
new file mode 100755
index 0000000..25004cd
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/stat_sad.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-hdpi/stat_sample.png b/samples/ApiDemos/res/drawable-hdpi/stat_sample.png
new file mode 100755
index 0000000..6c9ba0a
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/stat_sample.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/alert_dialog_icon.png b/samples/ApiDemos/res/drawable-mdpi/alert_dialog_icon.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/alert_dialog_icon.png
rename to samples/ApiDemos/res/drawable-mdpi/alert_dialog_icon.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/app_sample_code.png b/samples/ApiDemos/res/drawable-mdpi/app_sample_code.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/app_sample_code.png
rename to samples/ApiDemos/res/drawable-mdpi/app_sample_code.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/arrow_down_float.png b/samples/ApiDemos/res/drawable-mdpi/arrow_down_float.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/arrow_down_float.png
rename to samples/ApiDemos/res/drawable-mdpi/arrow_down_float.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/arrow_up_float.png b/samples/ApiDemos/res/drawable-mdpi/arrow_up_float.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/arrow_up_float.png
rename to samples/ApiDemos/res/drawable-mdpi/arrow_up_float.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-mdpi/btn_check_off.png b/samples/ApiDemos/res/drawable-mdpi/btn_check_off.png
new file mode 100644
index 0000000..56d3861
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-mdpi/btn_check_off.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-mdpi/btn_check_on.png b/samples/ApiDemos/res/drawable-mdpi/btn_check_on.png
new file mode 100644
index 0000000..791ac1d
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-mdpi/btn_check_on.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-mdpi/btn_circle_normal.png b/samples/ApiDemos/res/drawable-mdpi/btn_circle_normal.png
new file mode 100644
index 0000000..fc5af1c
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-mdpi/btn_circle_normal.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-mdpi/btn_default_normal.9.png b/samples/ApiDemos/res/drawable-mdpi/btn_default_normal.9.png
new file mode 100644
index 0000000..a2d5ccd
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-mdpi/btn_default_normal.9.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/button.9.png b/samples/ApiDemos/res/drawable-mdpi/button.9.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/button.9.png
rename to samples/ApiDemos/res/drawable-mdpi/button.9.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/ic_popup_reminder.png b/samples/ApiDemos/res/drawable-mdpi/ic_popup_reminder.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/ic_popup_reminder.png
rename to samples/ApiDemos/res/drawable-mdpi/ic_popup_reminder.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/icon48x48_2.png b/samples/ApiDemos/res/drawable-mdpi/icon48x48_2.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/icon48x48_2.png
rename to samples/ApiDemos/res/drawable-mdpi/icon48x48_2.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/progress_circular_background.png b/samples/ApiDemos/res/drawable-mdpi/progress_circular_background.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/progress_circular_background.png
rename to samples/ApiDemos/res/drawable-mdpi/progress_circular_background.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/progress_particle.png b/samples/ApiDemos/res/drawable-mdpi/progress_particle.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/progress_particle.png
rename to samples/ApiDemos/res/drawable-mdpi/progress_particle.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/robot.png b/samples/ApiDemos/res/drawable-mdpi/robot.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/robot.png
rename to samples/ApiDemos/res/drawable-mdpi/robot.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/scrollbar_state2.png b/samples/ApiDemos/res/drawable-mdpi/scrollbar_state2.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/scrollbar_state2.png
rename to samples/ApiDemos/res/drawable-mdpi/scrollbar_state2.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/star_big_on.png b/samples/ApiDemos/res/drawable-mdpi/star_big_on.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/star_big_on.png
rename to samples/ApiDemos/res/drawable-mdpi/star_big_on.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/stat_happy.png b/samples/ApiDemos/res/drawable-mdpi/stat_happy.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/stat_happy.png
rename to samples/ApiDemos/res/drawable-mdpi/stat_happy.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/stat_neutral.png b/samples/ApiDemos/res/drawable-mdpi/stat_neutral.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/stat_neutral.png
rename to samples/ApiDemos/res/drawable-mdpi/stat_neutral.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/stat_sad.png b/samples/ApiDemos/res/drawable-mdpi/stat_sad.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/stat_sad.png
rename to samples/ApiDemos/res/drawable-mdpi/stat_sad.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable/stat_sample.png b/samples/ApiDemos/res/drawable-mdpi/stat_sample.png
similarity index 100%
rename from samples/ApiDemos/res/drawable/stat_sample.png
rename to samples/ApiDemos/res/drawable-mdpi/stat_sample.png
Binary files differ
diff --git a/samples/ApiDemos/res/layout/activity_animation.xml b/samples/ApiDemos/res/layout/activity_animation.xml
new file mode 100644
index 0000000..446f735
--- /dev/null
+++ b/samples/ApiDemos/res/layout/activity_animation.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- Demonstrates starting and stopping a local service.
+     See corresponding Java code com.android.sdk.app.LocalSerice.java. -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
+    android:gravity="center_horizontal"
+    android:layout_width="fill_parent" android:layout_height="fill_parent">
+
+    <TextView
+        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_weight="0"
+        android:paddingBottom="4dip"
+        android:text="@string/activity_animation_msg"/>
+
+    <Button android:id="@+id/fade_animation"
+        android:layout_width="wrap_content" android:layout_height="wrap_content" 
+        android:text="@string/activity_animation_fade">
+        <requestFocus />
+    </Button>
+
+    <Button android:id="@+id/zoom_animation"
+        android:layout_width="wrap_content" android:layout_height="wrap_content" 
+        android:text="@string/activity_animation_zoom">
+    </Button>
+
+</LinearLayout>
+
diff --git a/samples/ApiDemos/res/layout/service_start_arguments_controller.xml b/samples/ApiDemos/res/layout/service_start_arguments_controller.xml
index f10a2c3..19b7498 100644
--- a/samples/ApiDemos/res/layout/service_start_arguments_controller.xml
+++ b/samples/ApiDemos/res/layout/service_start_arguments_controller.xml
@@ -43,5 +43,15 @@
         android:text="@string/start3_service">
     </Button>
 
+    <Button android:id="@+id/startfail"
+        android:layout_width="wrap_content" android:layout_height="wrap_content" 
+        android:text="@string/startfail_service">
+    </Button>
+
+    <Button android:id="@+id/kill"
+        android:layout_width="wrap_content" android:layout_height="wrap_content" 
+        android:text="@string/kill_process">
+    </Button>
+
 </LinearLayout>
 
diff --git a/samples/ApiDemos/res/values/strings.xml b/samples/ApiDemos/res/values/strings.xml
index c2c9829..2800bff 100644
--- a/samples/ApiDemos/res/values/strings.xml
+++ b/samples/ApiDemos/res/values/strings.xml
@@ -38,6 +38,8 @@
             custom Theme.Dialog theme to make an activity that looks like a
             customized dialog, here with an ugly frame.</string>
 
+    <string name="activity_wallpaper">App/Activity/Wallpaper</string>
+    
     <string name="activity_translucent">App/Activity/Translucent</string>
     <string name="translucent_background">Example of how you can make an
             activity have a translucent background, compositing over
@@ -45,6 +47,11 @@
 
     <string name="activity_translucent_blur">App/Activity/Translucent Blur</string>
 
+    <string name="activity_animation">App/Activity/Animation</string>
+    <string name="activity_animation_msg">Press a button to launch an activity with a custom animation.</string>
+    <string name="activity_animation_fade">Fade in</string>
+    <string name="activity_animation_zoom">Zoom in</string>
+
     <string name="activity_save_restore">App/Activity/Save &amp; Restore State</string>
     <string name="save_restore_msg">Demonstration of saving and restoring activity state in onSaveInstanceState() and onCreate().</string>
     <string name="saves_state">This text field saves its state:</string>
@@ -115,9 +122,6 @@
     <string name="remote_service_disconnected">Disconnected from remote service</string>
     <string name="remote_call_failed">Failure calling remote service</string>
 
-    <string name="service_arguments_started">"Started with arguments: "</string>
-    <string name="service_arguments_stopped">Finished arguments,
-        stopping.</string>
     <string name="service_start_arguments_label">Sample Service Start Arguments
     </string>
 
@@ -128,10 +132,13 @@
         service can be started with arguments, and run until all arguments are
         processed.
     </string>
-    <string name="start1_service">Start with \"One\"</string>
-    <string name="start2_service">Start with \"Two\"</string>
-    <string name="start3_service">Start with \"Three\"</string>
-
+    <string name="start1_service">Start \"One\" no redeliver</string>
+    <string name="start2_service">Start \"Two\" no redeliver</string>
+    <string name="start3_service">Start \"Three\" w/redeliver</string>
+    <string name="startfail_service">Start failed delivery</string>
+    <string name="service_created">Service created.</string>
+    <string name="service_destroyed">Service destroyed.</string>
+    
     <string name="one_shot_received">The one-shot alarm has gone off</string>
     <string name="repeating_received">The repeating alarm has gone off</string>
 
@@ -362,8 +369,8 @@
     <string name="summary_my_preference">This is a custom counter preference</string>
 
     <string name="title_advanced_toggle_preference">Haunted preference</string>
-    <string name="summary_on_advanced_toggle_preference">I'm on! :)</string>
-    <string name="summary_off_advanced_toggle_preference">I'm off! :(</string>
+    <string name="summary_on_advanced_toggle_preference">I\'m on! :)</string>
+    <string name="summary_off_advanced_toggle_preference">I\'m off! :(</string>
 
     <string name="title_parent_preference">Parent toggle</string>
     <string name="summary_parent_preference">This is visually a parent</string>
@@ -632,13 +639,13 @@
  using the Java programming language and run on Dalvik, a custom virtual
  machine designed for embedded use which runs on top of a Linux kernel.
 
- If you want to know how to develop applications for Android, you're in the
+ If you want to know how to develop applications for Android, you\'re in the
  right place. This site provides a variety of documentation that will help you
  learn about Android and develop mobile applications for the platform.
 
  An early look at the the Android SDK is also available. It includes sample
  projects with source code, development tools, an emulator, and of course all
- the libraries you'll need to build an Android application. What would it take
+ the libraries you\'ll need to build an Android application. What would it take
  to build a better mobile phone?
     </string>
     <string name="spinner_1_color">Color:</string>
diff --git a/samples/ApiDemos/res/values/styles.xml b/samples/ApiDemos/res/values/styles.xml
index 3c9c681..8cc8312 100644
--- a/samples/ApiDemos/res/values/styles.xml
+++ b/samples/ApiDemos/res/values/styles.xml
@@ -37,9 +37,16 @@
         <item name="android:windowBackground">@drawable/filled_box</item>
     </style>
 
+    <!-- A theme that has a wallpaper background.  Here we explicitly specify
+         that this theme is to inherit from the system's wallpaper theme,
+         which sets up various attributes correctly. -->
+    <style name="Theme.Wallpaper" parent="android:style/Theme.Wallpaper">
+        <item name="android:colorForeground">#fff</item>
+    </style>
+
     <!-- A theme that has a translucent background.  Here we explicitly specify
          that this theme is to inherit from the system's translucent theme,
-         which sets up various attributes correctly.. -->
+         which sets up various attributes correctly. -->
     <style name="Theme.Translucent" parent="android:style/Theme.Translucent">
         <item name="android:windowBackground">@drawable/translucent_background</item>
         <item name="android:windowNoTitle">true</item>
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/Animation.java b/samples/ApiDemos/src/com/example/android/apis/app/Animation.java
new file mode 100644
index 0000000..90831f5
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/app/Animation.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.apis.app;
+
+// Need the following import to get access to the app resources, since this
+// class is in a sub-package.
+import com.example.android.apis.R;
+import com.example.android.apis.view.Controls1;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+
+
+/**
+ * <p>Example of explicitly starting and stopping the {@link LocalService}.
+ * This demonstrates the implementation of a service that runs in the same
+ * process as the rest of the application, which is explicitly started and stopped
+ * as desired.</p>
+ */
+public class Animation extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.activity_animation);
+
+        // Watch for button clicks.
+        Button button = (Button)findViewById(R.id.fade_animation);
+        button.setOnClickListener(mFadeListener);
+        button = (Button)findViewById(R.id.zoom_animation);
+        button.setOnClickListener(mZoomListener);
+    }
+
+    private OnClickListener mFadeListener = new OnClickListener() {
+        public void onClick(View v) {
+            // Request the next activity transition (here starting a new one).
+            startActivity(new Intent(Animation.this, Controls1.class));
+            // Supply a custom animation.  This one will just fade the new
+            // activity on top.  Note that we need to also supply an animation
+            // (here just doing nothing for the same amount of time) for the
+            // old activity to prevent it from going away too soon.
+            overridePendingTransition(R.anim.fade, R.anim.hold);
+        }
+    };
+
+    private OnClickListener mZoomListener = new OnClickListener() {
+        public void onClick(View v) {
+            // Request the next activity transition (here starting a new one).
+            startActivity(new Intent(Animation.this, Controls1.class));
+            // This is a more complicated animation, involving transformations
+            // on both this (exit) and the new (enter) activity.  Note how for
+            // the duration of the animation we force the exiting activity
+            // to be Z-ordered on top (even though it really isn't) to achieve
+            // the effect we want.
+            overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
+        }
+    };
+}
+
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/LocalService.java b/samples/ApiDemos/src/com/example/android/apis/app/LocalService.java
index 8791578..79324a4 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/LocalService.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/LocalService.java
@@ -24,6 +24,7 @@
 import android.os.Binder;
 import android.os.IBinder;
 import android.os.Parcel;
+import android.util.Log;
 import android.widget.Toast;
 
 // Need the following import to get access to the app resources, since this
@@ -64,6 +65,14 @@
     }
 
     @Override
+    public int onStartCommand(Intent intent, int flags, int startId) {
+        Log.i("LocalService", "Received start id " + startId + ": " + intent);
+        // We want this service to continue running until it is explicitly
+        // stopped, so return sticky.
+        return START_STICKY;
+    }
+
+    @Override
     public void onDestroy() {
         // Cancel the persistent notification.
         mNM.cancel(R.string.local_service_started);
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ServiceStartArguments.java b/samples/ApiDemos/src/com/example/android/apis/app/ServiceStartArguments.java
index 5e16158..f4f9af1 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/ServiceStartArguments.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ServiceStartArguments.java
@@ -27,6 +27,7 @@
 import android.os.IBinder;
 import android.os.Looper;
 import android.os.Message;
+import android.os.Process;
 import android.util.Log;
 import android.widget.Toast;
 
@@ -41,9 +42,12 @@
  * happen in the service.  This is generally how background services should
  * interact with the user, rather than doing something more disruptive such as
  * calling startActivity().
+ * 
+ * <p>For applications targeting Android 1.5 or beyond, you may want consider
+ * using the android.app.IntentService class, which takes care of all the
+ * work of creating the extra thread and dispatching commands to it.
  */
-public class ServiceStartArguments extends Service
-{
+public class ServiceStartArguments extends Service {
     private NotificationManager mNM;
     private Intent mInvokeIntent;
     private volatile Looper mServiceLooper;
@@ -58,16 +62,22 @@
         public void handleMessage(Message msg)
         {
             Bundle arguments = (Bundle)msg.obj;
-            String txt = getResources()
-                    .getString(R.string.service_arguments_started);
-            txt = txt + arguments.getString("name");
         
-            Log.i("ServiceStartArguments", "Message: " + msg + ", " + txt);
+            String txt = arguments.getString("name");
+            
+            Log.i("ServiceStartArguments", "Message: " + msg + ", "
+                    + arguments.getString("name"));
         
-            showNotification();
+            if ((msg.arg2&Service.START_FLAG_REDELIVERY) == 0) {
+                txt = "New cmd #" + msg.arg1 + ": " + txt;
+            } else {
+                txt = "Re-delivered #" + msg.arg1 + ": " + txt;
+            }
+            
+            showNotification(txt);
         
-        // Normally we would do some work here...  for our sample, we will
-        // just sleep for 10 seconds.
+            // Normally we would do some work here...  for our sample, we will
+            // just sleep for 5 seconds.
             long endTime = System.currentTimeMillis() + 5*1000;
             while (System.currentTimeMillis() < endTime) {
                 synchronized (this) {
@@ -78,6 +88,8 @@
                 }
             }
         
+            hideNotification();
+            
             Log.i("ServiceStartArguments", "Done with #" + msg.arg1);
             stopSelf(msg.arg1);
         }
@@ -88,14 +100,19 @@
     public void onCreate() {
         mNM = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
 
+        Toast.makeText(this, R.string.service_created,
+                Toast.LENGTH_SHORT).show();
+        
         // This is who should be launched if the user selects our persistent
         // notification.
         mInvokeIntent = new Intent(this, ServiceStartArgumentsController.class);
 
         // Start up the thread running the service.  Note that we create a
         // separate thread because the service normally runs in the process's
-        // main thread, which we don't want to block.
-        HandlerThread thread = new HandlerThread("ServiceStartArguments");
+        // main thread, which we don't want to block.  We also make it
+        // background priority so CPU-intensive work will not disrupt our UI.
+        HandlerThread thread = new HandlerThread("ServiceStartArguments",
+                Process.THREAD_PRIORITY_BACKGROUND);
         thread.start();
         
         mServiceLooper = thread.getLooper();
@@ -103,25 +120,45 @@
     }
 
     @Override
-    public void onStart(Intent intent, int startId) {
+    public int onStartCommand(Intent intent, int flags, int startId) {
         Log.i("ServiceStartArguments",
                 "Starting #" + startId + ": " + intent.getExtras());
         Message msg = mServiceHandler.obtainMessage();
         msg.arg1 = startId;
+        msg.arg2 = flags;
         msg.obj = intent.getExtras();
         mServiceHandler.sendMessage(msg);
         Log.i("ServiceStartArguments", "Sending: " + msg);
+        
+        // For the start fail button, we will simulate the process dying
+        // for some reason in onStartCommand().
+        if (intent.getBooleanExtra("fail", false)) {
+            // Don't do this if we are in a retry... the system will
+            // eventually give up if we keep crashing.
+            if ((flags&START_FLAG_RETRY) == 0) {
+                // Since the process hasn't finished handling the command,
+                // it will be restarted with the command again, regardless of
+                // whether we return START_REDELIVER_INTENT.
+                Process.killProcess(Process.myPid());
+            }
+        }
+        
+        // Normally we would consistently return one kind of result...
+        // however, here we will select between these two, so you can see
+        // how they impact the behavior.  Try killing the process while it
+        // is in the middle of executing the different commands.
+        return intent.getBooleanExtra("redeliver", false)
+                ? START_REDELIVER_INTENT : START_NOT_STICKY;
     }
 
     @Override
     public void onDestroy() {
         mServiceLooper.quit();
 
-        // Cancel the persistent notification.
-        mNM.cancel(R.string.service_arguments_started);
+        hideNotification();
 
         // Tell the user we stopped.
-        Toast.makeText(ServiceStartArguments.this, R.string.service_arguments_stopped,
+        Toast.makeText(ServiceStartArguments.this, R.string.service_destroyed,
                 Toast.LENGTH_SHORT).show();
     }
 
@@ -133,10 +170,7 @@
     /**
      * Show a notification while this service is running.
      */
-    private void showNotification() {
-        // In this sample, we'll use the same text for the ticker and the expanded notification
-        CharSequence text = getText(R.string.service_arguments_started);
-
+    private void showNotification(String text) {
         // Set the icon, scrolling text and timestamp
         Notification notification = new Notification(R.drawable.stat_sample, text,
                 System.currentTimeMillis());
@@ -149,9 +183,16 @@
         notification.setLatestEventInfo(this, getText(R.string.service_start_arguments_label),
                        text, contentIntent);
 
+        // We show this for as long as our service is processing a command.
+        notification.flags |= Notification.FLAG_ONGOING_EVENT;
+        
         // Send the notification.
         // We use a string id because it is a unique number.  We use it later to cancel.
-        mNM.notify(R.string.service_arguments_started, notification);
+        mNM.notify(R.string.service_created, notification);
+    }
+    
+    private void hideNotification() {
+        mNM.cancel(R.string.service_created);
     }
 }
 
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ServiceStartArgumentsController.java b/samples/ApiDemos/src/com/example/android/apis/app/ServiceStartArgumentsController.java
index 2c53ff4..9d79e2e 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/ServiceStartArgumentsController.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ServiceStartArgumentsController.java
@@ -21,14 +21,13 @@
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
+import android.os.Process;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
 
 import com.example.android.apis.R;
 
-import java.util.HashMap;
-
 /**
  * Example of explicitly starting the {@link ServiceStartArguments}.
  */
@@ -46,26 +45,51 @@
         button.setOnClickListener(mStart2Listener);
         button = (Button)findViewById(R.id.start3);
         button.setOnClickListener(mStart3Listener);
+        button = (Button)findViewById(R.id.startfail);
+        button.setOnClickListener(mStartFailListener);
+        button = (Button)findViewById(R.id.kill);
+        button.setOnClickListener(mKillListener);
     }
 
     private OnClickListener mStart1Listener = new OnClickListener() {
         public void onClick(View v) {
             startService(new Intent(ServiceStartArgumentsController.this,
-                    ServiceStartArguments.class).putExtra("name", "One"));
+                    ServiceStartArguments.class)
+                            .putExtra("name", "One"));
         }
     };
 
     private OnClickListener mStart2Listener = new OnClickListener() {
         public void onClick(View v) {
             startService(new Intent(ServiceStartArgumentsController.this,
-                    ServiceStartArguments.class).putExtra("name", "Two"));
+                    ServiceStartArguments.class)
+                            .putExtra("name", "Two"));
         }
     };
 
     private OnClickListener mStart3Listener = new OnClickListener() {
         public void onClick(View v) {
             startService(new Intent(ServiceStartArgumentsController.this,
-                    ServiceStartArguments.class).putExtra("name", "Three"));
+                    ServiceStartArguments.class)
+                            .putExtra("name", "Three")
+                            .putExtra("redeliver", true));
+        }
+    };
+
+    private OnClickListener mStartFailListener = new OnClickListener() {
+        public void onClick(View v) {
+            startService(new Intent(ServiceStartArgumentsController.this,
+                    ServiceStartArguments.class)
+                            .putExtra("name", "Failure")
+                            .putExtra("fail", true));
+        }
+    };
+
+    private OnClickListener mKillListener = new OnClickListener() {
+        public void onClick(View v) {
+            // This is to simulate the service being killed while it is
+            // running in the background.
+            Process.killProcess(Process.myPid());
         }
     };
 }
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/WallpaperActivity.java b/samples/ApiDemos/src/com/example/android/apis/app/WallpaperActivity.java
new file mode 100644
index 0000000..8d7f5a1
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/app/WallpaperActivity.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.apis.app;
+
+// Need the following import to get access to the app resources, since this
+// class is in a sub-package.
+import com.example.android.apis.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.WindowManager;
+
+/**
+ * <h3>Wallpaper Activity</h3>
+ * 
+ * <p>This demonstrates the how to write an activity that has the system
+ * wallpaper behind it.</p>
+ */
+public class WallpaperActivity extends Activity {
+    /**
+     * Initialization of the Activity after it is first created.  Must at least
+     * call {@link android.app.Activity#setContentView setContentView()} to
+     * describe what is to be displayed in the screen.
+     */
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        // Be sure to call the super class.
+        super.onCreate(savedInstanceState);
+        
+        // See assets/res/any/layout/translucent_background.xml for this
+        // view layout definition, which is being set here as
+        // the content of our screen.
+        setContentView(R.layout.translucent_background);
+    }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/ColorFilters.java b/samples/ApiDemos/src/com/example/android/apis/graphics/ColorFilters.java
new file mode 100644
index 0000000..92d18ba
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/ColorFilters.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.apis.graphics;
+
+import com.example.android.apis.R;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.*;
+import android.graphics.drawable.*;
+import android.os.Bundle;
+import android.view.KeyEvent;
+import android.view.*;
+
+public class ColorFilters extends GraphicsActivity {
+    
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(new SampleView(this));
+        
+    }
+    
+    private static class SampleView extends View {
+        private Activity mActivity;
+        private Drawable mDrawable;
+        private Drawable[] mDrawables;
+        private Paint mPaint;
+        private Paint mPaint2;
+        private float mPaintTextOffset;
+        private int[] mColors;
+        private PorterDuff.Mode[] mModes;
+        private int mModeIndex;
+
+        private static void addToTheRight(Drawable curr, Drawable prev) {
+            Rect r = prev.getBounds();
+            int x = r.right + 12;
+            int center = (r.top + r.bottom) >> 1;
+            int h = curr.getIntrinsicHeight();
+            int y = center - (h >> 1);
+            
+            curr.setBounds(x, y, x + curr.getIntrinsicWidth(), y + h);
+        }
+
+        public SampleView(Activity activity) {
+            super(activity);
+            mActivity = activity;
+            Context context = activity;
+            setFocusable(true);
+            
+            mDrawable = context.getResources().getDrawable(R.drawable.btn_default_normal);
+            mDrawable.setBounds(0, 0, 150, 48);
+            mDrawable.setDither(true);
+
+            int[] resIDs = new int[] {
+                R.drawable.btn_circle_normal,
+                R.drawable.btn_check_off,
+                R.drawable.btn_check_on
+            };
+            mDrawables = new Drawable[resIDs.length];
+            Drawable prev = mDrawable;
+            for (int i = 0; i < resIDs.length; i++) {
+                mDrawables[i] = context.getResources().getDrawable(resIDs[i]);
+                mDrawables[i].setDither(true);
+                addToTheRight(mDrawables[i], prev);
+                prev = mDrawables[i];
+            }
+
+            mPaint = new Paint();
+            mPaint.setAntiAlias(true);
+            mPaint.setTextSize(16);
+            mPaint.setTextAlign(Paint.Align.CENTER);
+            
+            mPaint2 = new Paint(mPaint);
+            mPaint2.setAlpha(64);
+            
+            Paint.FontMetrics fm = mPaint.getFontMetrics();
+            mPaintTextOffset = (fm.descent + fm.ascent) * 0.5f;
+            
+            mColors = new int[] {
+                0,
+                0xCC0000FF,
+                0x880000FF,
+                0x440000FF,
+                0xFFCCCCFF,
+                0xFF8888FF,
+                0xFF4444FF,
+            };
+
+            mModes = new PorterDuff.Mode[] {
+                PorterDuff.Mode.SRC_ATOP,
+                PorterDuff.Mode.MULTIPLY,
+            };
+            mModeIndex = 0;
+            
+            updateTitle();
+        }
+        
+        private void swapPaintColors() {
+            if (mPaint.getColor() == 0xFF000000) {
+                mPaint.setColor(0xFFFFFFFF);
+                mPaint2.setColor(0xFF000000);
+            } else {
+                mPaint.setColor(0xFF000000);
+                mPaint2.setColor(0xFFFFFFFF);
+            }
+            mPaint2.setAlpha(64);
+        }
+        
+        private void updateTitle() {
+            mActivity.setTitle(mModes[mModeIndex].toString());
+        }
+        
+        private void drawSample(Canvas canvas, ColorFilter filter) {
+            Rect r = mDrawable.getBounds();
+            float x = (r.left + r.right) * 0.5f;
+            float y = (r.top + r.bottom) * 0.5f - mPaintTextOffset;
+
+            mDrawable.setColorFilter(filter);
+            mDrawable.draw(canvas);
+            canvas.drawText("Label", x+1, y+1, mPaint2);
+            canvas.drawText("Label", x, y, mPaint);
+            
+            for (Drawable dr : mDrawables) {
+                dr.setColorFilter(filter);
+                dr.draw(canvas);
+            }
+        }
+        
+        @Override protected void onDraw(Canvas canvas) {
+            canvas.drawColor(0xFFCCCCCC);            
+
+            canvas.translate(8, 12);
+            for (int color : mColors) {
+                ColorFilter filter;
+                if (color == 0) {
+                    filter = null;
+                } else {
+                    filter = new PorterDuffColorFilter(color,
+                                                       mModes[mModeIndex]);
+                }
+                drawSample(canvas, filter);
+                canvas.translate(0, 55);
+            }
+        }
+
+        @Override
+        public boolean onTouchEvent(MotionEvent event) {
+            float x = event.getX();
+            float y = event.getY();
+            switch (event.getAction()) {
+                case MotionEvent.ACTION_DOWN:
+                    break;
+                case MotionEvent.ACTION_MOVE:
+                    break;
+                case MotionEvent.ACTION_UP:
+                    // update mode every other time we change paint colors
+                    if (mPaint.getColor() == 0xFFFFFFFF) {
+                        mModeIndex = (mModeIndex + 1) % mModes.length;
+                        updateTitle();
+                    }
+                    swapPaintColors();
+                    invalidate();
+                    break;
+            }
+            return true;
+        }
+    }
+}
+
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/CubeRenderer.java b/samples/ApiDemos/src/com/example/android/apis/graphics/CubeRenderer.java
index 527e2bc..0f15f91 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/CubeRenderer.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/CubeRenderer.java
@@ -64,29 +64,6 @@
         mAngle += 1.2f;
     }
 
-    public int[] getConfigSpec() {
-        if (mTranslucentBackground) {
-                // We want a depth buffer and an alpha buffer
-                int[] configSpec = {
-                        EGL10.EGL_RED_SIZE,      8,
-                        EGL10.EGL_GREEN_SIZE,    8,
-                        EGL10.EGL_BLUE_SIZE,     8,
-                        EGL10.EGL_ALPHA_SIZE,    8,
-                        EGL10.EGL_DEPTH_SIZE,   16,
-                        EGL10.EGL_NONE
-                };
-                return configSpec;
-            } else {
-                // We want a depth buffer, don't care about the
-                // details of the color buffer.
-                int[] configSpec = {
-                        EGL10.EGL_DEPTH_SIZE,   16,
-                        EGL10.EGL_NONE
-                };
-                return configSpec;
-            }
-    }
-
     public void onSurfaceChanged(GL10 gl, int width, int height) {
          gl.glViewport(0, 0, width, height);
 
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/TouchRotateActivity.java b/samples/ApiDemos/src/com/example/android/apis/graphics/TouchRotateActivity.java
index 09d3694..c0f32a7 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/TouchRotateActivity.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/TouchRotateActivity.java
@@ -134,16 +134,6 @@
             mCube.draw(gl);
         }
 
-        public int[] getConfigSpec() {
-            // We want a depth buffer, don't care about the
-            // details of the color buffer.
-            int[] configSpec = {
-                    EGL10.EGL_DEPTH_SIZE,   16,
-                    EGL10.EGL_NONE
-            };
-            return configSpec;
-        }
-
         public void onSurfaceChanged(GL10 gl, int width, int height) {
              gl.glViewport(0, 0, width, height);
 
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/spritetext/SpriteTextRenderer.java b/samples/ApiDemos/src/com/example/android/apis/graphics/spritetext/SpriteTextRenderer.java
index b9369cd..223300a 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/spritetext/SpriteTextRenderer.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/spritetext/SpriteTextRenderer.java
@@ -50,16 +50,6 @@
         mLabelPaint.setARGB(0xff, 0x00, 0x00, 0x00);
     }
 
-    public int[] getConfigSpec() {
-        // We don't need a depth buffer, and don't care about our
-        // color depth.
-        int[] configSpec = {
-                EGL10.EGL_DEPTH_SIZE, 0,
-                EGL10.EGL_NONE
-        };
-        return configSpec;
-    }
-
     public void onSurfaceCreated(GL10 gl, EGLConfig config) {
         /*
          * By default, OpenGL enables features that improve quality
diff --git a/samples/ApiDemos/tests/build.properties b/samples/ApiDemos/tests/build.properties
new file mode 100644
index 0000000..8ae22a3
--- /dev/null
+++ b/samples/ApiDemos/tests/build.properties
@@ -0,0 +1 @@
+tested.project.dir=..
\ No newline at end of file
diff --git a/samples/BrowserPlugin/Android.mk b/samples/BrowserPlugin/Android.mk
new file mode 100644
index 0000000..16047d5
--- /dev/null
+++ b/samples/BrowserPlugin/Android.mk
@@ -0,0 +1,36 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+TOP_LOCAL_PATH:= $(call my-dir)
+
+# Build application
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_PACKAGE_NAME := SampleBrowserPlugin
+
+LOCAL_JNI_SHARED_LIBRARIES := libsampleplugin
+
+include $(BUILD_PACKAGE)
+
+# ============================================================
+
+# Also build all of the sub-targets under this one: the shared library.
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/samples/BrowserPlugin/AndroidManifest.xml b/samples/BrowserPlugin/AndroidManifest.xml
new file mode 100644
index 0000000..ae6b5db
--- /dev/null
+++ b/samples/BrowserPlugin/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+      package="com.android.sampleplugin"
+      android:versionCode="1"
+      android:versionName="1.0">
+
+    <uses-permission android:name="android.webkit.permission.PLUGIN"/>
+
+    <uses-sdk android:minSdkVersion="3" />
+
+    <application android:icon="@drawable/sample_browser_plugin"
+                android:label="@string/sample_browser_plugin">
+        <service android:name="SamplePlugin">
+            <intent-filter>
+                <action android:name="android.webkit.PLUGIN" />
+            </intent-filter>
+        </service>
+    </application>
+
+</manifest>
diff --git a/ndk/build/platforms/android-3/common/include/cstddef b/samples/BrowserPlugin/MODULE_LICENSE_APACHE2
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/cstddef
copy to samples/BrowserPlugin/MODULE_LICENSE_APACHE2
diff --git a/samples/BrowserPlugin/NOTICE b/samples/BrowserPlugin/NOTICE
new file mode 100644
index 0000000..c5b1efa
--- /dev/null
+++ b/samples/BrowserPlugin/NOTICE
@@ -0,0 +1,190 @@
+
+   Copyright (c) 2005-2008, The Android Open Source Project
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
diff --git a/samples/BrowserPlugin/README b/samples/BrowserPlugin/README
new file mode 100644
index 0000000..08b04a5
--- /dev/null
+++ b/samples/BrowserPlugin/README
@@ -0,0 +1,173 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################
+######### CONTENTS ###########
+A. INTRODUCTION
+B. PLUGIN STRUCTURE
+C. HOW TO DEPLOY
+D. SUB-PLUGINS
+    1. ANIMATION
+    2. AUDIO
+    3. BACKGROUND
+    4. FORM
+    5. PAINT
+
+
+##############################
+## (A) INTRODUCTION ##########
+
+The sample plugin is intended to give plugin developers a point of reference to
+see how an android browser plugin is created and how to use the available APIs.
+A plugin is packaged like a standard apk and can be installed either via the 
+market or adb.  The sample plugin attempts to exercise as many of the APIs as
+possible but unfortunately not all are covered. 
+
+Trying to have a single plugin demonstrate all possible API interactions on one
+screen was not practical. On the other hand we also didn't want a separate
+plugin for each interction, as that would result in many separate apk's that
+would need to be maintained.  To solve this problem we developed the idea to use
+"sub-plugins". With a sub-plugin only one specific feature of the plugin would
+be active at a time, but they would all share as much common code as possible.
+A detailed description of each sub-plugin and its function can be found in the
+sub-plugins section.
+
+##############################
+## (B) PLUGIN STRUCTURE ######
+
+The sample plugin is packaged as one plugin but contains many unique sub-plugins
+(e.g. audio and paint).  The package consists of two pieces: (1) Java code
+containing the config; (2) C++ shared library containing the brower/plugin
+bindings and the sub-plugin classes.  
+
+~~~~ (1) JAVA ~~~~~
+Android.mk: specifies the name of the APK (SampleBrowserPlugin) as well as which
+            shared libraries to include.
+
+AndroidManifest.xml: similar to a standard android manifest file, except that it
+                     must contain the "uses-permission" and "intent-filter"
+                     elements that are plugin specific.
+
+src/*: location of the java files which in our case is just an empty service
+
+res/*: location of the static resources (e.g. an icon for the plugin)
+
+~~~~ (2) C++ ~~~~~
+jni/Android.mk: specifies the build parameters for the shared library that is to
+                be included with the apk. The library contains all the bindings
+                between the plugin and the browser.
+
+jni/main.*: this code is the binding point between the plugin and the browser.
+            It supports all of the functions required for a standard netscape
+            style plugin as well as all the android specific APIs. The initial
+            starting point for the plugin is the NP_Initialize function. The
+            NPP_New function is responsible for reading the input args and
+            selecting the appropriate sub-plugin to instantiate. Most other
+            functions either return fixed values or pass their inputs to the
+            sub-plugin for processing.
+
+jni/PluginObject.*: The pluginObject provides a convenient container in which to
+                    store variables (the plugin's state).  This objects two main
+                    responsibilities are (1) to construct and store the NPClass 
+                    object (done using code provided by Apple) and (2) provide
+                    the abstract class for the sub-plugin objects and a place to 
+                    store the sub-plugin after it is instantiated.  
+
+jni/*/*: Each of the sub-plugins has a folder that contains its class definition
+         and logic. The sub-plugin receives events from the browser and it can
+         also communicate with the browser using the netscape plugin functions
+         as well as the specialized android interfaces.
+
+
+##############################
+## (C) HOW TO DEPLOY #########
+
+To compile and install a plugin on a device/emulator simply...
+
+1. run "make SampleBrowserPlugin" (compiles libsampleplugin.so and builds the apk)
+2. the previous command produces an apk file so record its location
+3. run "adb install [apk_file]" to install it on a device/emulator
+4. the browser will auto recognize the plugin is available
+
+Now that the plugin is installed you can manage it just like you would any other
+application via Settings -> Applications -> Manage applications. To execute the
+plugin you need to include an html snippet (similar to the one found below) in
+a document that is accessible by the browser.  The mime-type cannot change but
+you can change the width, height, and parameters.  The parameters are used to
+notify the plugin which sub-plugin to execute and which drawing model to use.
+
+<object type="application/x-testbrowserplugin" height=50 width=250>
+    <param name="DrawingModel" value="Surface" />
+    <param name="PluginType" value="Background" />
+</object>
+
+
+##############################
+## (D) SUB-PLUGINS ###########
+
+Each sub-plugin corresponds to exactly one plugin type and can support one or
+more drawing models. In the subsections below there are descriptions of each of
+the sub-plugins as well as the information required to create the html snippets. 
+
+#######################
+## (D1) ANIMATION #####
+
+PLUGIN TYPE: Animation
+DRAWING MODEL: Bitmap
+
+This plugin draws a ball bouncing around the screen. If the plugin is not entirely
+on the screen and it it touched, then it will attempt to center itself on screen.
+
+#######################
+## (D2) AUDIO #########
+
+PLUGIN TYPE: Audio
+DRAWING MODEL: Bitmap
+
+This plugin plays a raw audio file located at /sdcard/sample.raw (need to supply
+your own). It uses touch to trigger the play, pause, and stop buttons.
+
+#######################
+## (D3) BACKGROUND ####
+
+PLUGIN TYPE: Background
+DRAWING MODEL: Surface
+
+This plugin has minimal visual components but mainly runs API tests in the 
+background. The  plugin handles scaling its own bitmap on zoom which in this
+case is a simple string of text. The output of this plugin is found in the logs
+as it prints errors if it detects any API failures. Some of the API's tested are
+timers, javascript access, and bitmap formatting.
+
+#######################
+## (D4) FORM ##########
+
+PLUGIN TYPE: Form
+DRAWING MODEL: Bitmap
+
+This plugin mimics a simple username/password form. You can select a textbox by
+either touching it or using the navigation keys.  Once selected the box will
+highlight and the keyboard will appear. If the textbox selected is not fully
+in view then the plugin will ensure it is centered on the screen.  
+
+#######################
+## (D5) PAINT #########
+
+PLUGIN TYPE: Paint
+DRAWING MODEL: Surface
+
+This plugin provides a surface that the user can "paint" on.  The inputs method
+can be toggled between mouse (dots) and touch (lines).  This plugin has a fixed
+surface and allows the browser to scale the surface when zooming. 
diff --git a/samples/BrowserPlugin/jni/Android.mk b/samples/BrowserPlugin/jni/Android.mk
new file mode 100644
index 0000000..cbd8a15
--- /dev/null
+++ b/samples/BrowserPlugin/jni/Android.mk
@@ -0,0 +1,64 @@
+##
+##
+## Copyright 2008, The Android Open Source Project
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted provided that the following conditions
+## are met:
+##  * Redistributions of source code must retain the above copyright
+##    notice, this list of conditions and the following disclaimer.
+##  * Redistributions in binary form must reproduce the above copyright
+##    notice, this list of conditions and the following disclaimer in the
+##    documentation and/or other materials provided with the distribution.
+##
+## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+## PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+	main.cpp \
+	PluginObject.cpp \
+	animation/AnimationPlugin.cpp \
+	audio/AudioPlugin.cpp \
+	background/BackgroundPlugin.cpp \
+	form/FormPlugin.cpp \
+	paint/PaintPlugin.cpp \
+	jni-bridge.cpp \
+
+LOCAL_C_INCLUDES += \
+	$(JNI_H_INCLUDE) \
+	$(LOCAL_PATH) \
+	$(LOCAL_PATH)/animation \
+	$(LOCAL_PATH)/audio \
+	$(LOCAL_PATH)/background \
+	$(LOCAL_PATH)/form \
+	$(LOCAL_PATH)/paint \
+	external/webkit/WebCore/bridge \
+	external/webkit/WebCore/plugins \
+	external/webkit/WebCore/platform/android/JavaVM \
+	external/webkit/WebKit/android/plugins
+
+LOCAL_SHARED_LIBRARIES := \
+	libnativehelper
+
+LOCAL_CFLAGS += -fvisibility=hidden 
+LOCAL_PRELINK_MODULE:=false
+
+LOCAL_MODULE:= libsampleplugin
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
+
diff --git a/samples/BrowserPlugin/jni/PluginObject.cpp b/samples/BrowserPlugin/jni/PluginObject.cpp
new file mode 100644
index 0000000..80f5e7c
--- /dev/null
+++ b/samples/BrowserPlugin/jni/PluginObject.cpp
@@ -0,0 +1,177 @@
+/*
+ IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
+ consideration of your agreement to the following terms, and your use, installation,
+ modification or redistribution of this Apple software constitutes acceptance of these
+ terms.  If you do not agree with these terms, please do not use, install, modify or
+ redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and subject to these
+ terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in
+ this original Apple software (the "Apple Software"), to use, reproduce, modify and
+ redistribute the Apple Software, with or without modifications, in source and/or binary
+ forms; provided that if you redistribute the Apple Software in its entirety and without
+ modifications, you must retain this notice and the following text and disclaimers in all
+ such redistributions of the Apple Software.  Neither the name, trademarks, service marks
+ or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
+ the Apple Software without specific prior written permission from Apple. Except as expressly
+ stated in this notice, no other rights or licenses, express or implied, are granted by Apple
+ herein, including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO WARRANTIES,
+ EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
+ USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+          OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
+ REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
+ WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
+ OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include "main.h"
+#include "PluginObject.h"
+
+static void pluginInvalidate(NPObject *obj);
+static bool pluginHasProperty(NPObject *obj, NPIdentifier name);
+static bool pluginHasMethod(NPObject *obj, NPIdentifier name);
+static bool pluginGetProperty(NPObject *obj, NPIdentifier name, NPVariant *variant);
+static bool pluginSetProperty(NPObject *obj, NPIdentifier name, const NPVariant *variant);
+static bool pluginInvoke(NPObject *obj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result);
+static bool pluginInvokeDefault(NPObject *obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
+static NPObject *pluginAllocate(NPP npp, NPClass *theClass);
+static void pluginDeallocate(NPObject *obj);
+static bool pluginRemoveProperty(NPObject *npobj, NPIdentifier name);
+static bool pluginEnumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count);
+
+
+
+static NPClass pluginClass = {
+    NP_CLASS_STRUCT_VERSION,
+    pluginAllocate,
+    pluginDeallocate,
+    pluginInvalidate,
+    pluginHasMethod,
+    pluginInvoke,
+    pluginInvokeDefault,
+    pluginHasProperty,
+    pluginGetProperty,
+    pluginSetProperty,
+    pluginRemoveProperty,
+    pluginEnumerate
+};
+
+NPClass *getPluginClass(void)
+{
+    return &pluginClass;
+}
+
+static bool identifiersInitialized = false;
+
+#define ID_TESTFILE_PROPERTY            0
+#define NUM_PROPERTY_IDENTIFIERS        1
+
+static NPIdentifier pluginPropertyIdentifiers[NUM_PROPERTY_IDENTIFIERS];
+static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
+    "testfile"
+};
+
+#define ID_GETTESTFILE_METHOD                   0
+#define NUM_METHOD_IDENTIFIERS                  1
+
+static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
+static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
+    "getTestFile"
+};
+
+static void initializeIdentifiers(void)
+{
+    browser->getstringidentifiers(pluginPropertyIdentifierNames, NUM_PROPERTY_IDENTIFIERS, pluginPropertyIdentifiers);
+    browser->getstringidentifiers(pluginMethodIdentifierNames, NUM_METHOD_IDENTIFIERS, pluginMethodIdentifiers);
+}
+
+static bool pluginHasProperty(NPObject *obj, NPIdentifier name)
+{
+    int i;
+    for (i = 0; i < NUM_PROPERTY_IDENTIFIERS; i++)
+        if (name == pluginPropertyIdentifiers[i])
+            return true;
+    return false;
+}
+
+static bool pluginHasMethod(NPObject *obj, NPIdentifier name)
+{
+    int i;
+    for (i = 0; i < NUM_METHOD_IDENTIFIERS; i++)
+        if (name == pluginMethodIdentifiers[i])
+            return true;
+    return false;
+}
+
+static bool pluginGetProperty(NPObject *obj, NPIdentifier name, NPVariant *variant)
+{
+    PluginObject *plugin = (PluginObject *)obj;
+    if (name == pluginPropertyIdentifiers[ID_TESTFILE_PROPERTY]) {
+        BOOLEAN_TO_NPVARIANT(true, *variant);
+        return true;
+    }
+    return false;
+}
+
+static bool pluginSetProperty(NPObject *obj, NPIdentifier name, const NPVariant *variant)
+{
+    return false;
+}
+
+static bool pluginInvoke(NPObject *obj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result)
+{
+    PluginObject *plugin = (PluginObject *)obj;
+    if (name == pluginMethodIdentifiers[ID_GETTESTFILE_METHOD]) {
+        return true;
+    }
+    return false;
+}
+
+static bool pluginInvokeDefault(NPObject *obj, const NPVariant *args, uint32_t argCount, NPVariant *result)
+{
+    return false;
+}
+
+static void pluginInvalidate(NPObject *obj)
+{
+    // Release any remaining references to JavaScript objects.
+}
+
+static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
+{
+    PluginObject *newInstance = (PluginObject*) malloc(sizeof(PluginObject));
+    newInstance->header._class = theClass;
+    newInstance->header.referenceCount = 1;
+
+    if (!identifiersInitialized) {
+        identifiersInitialized = true;
+        initializeIdentifiers();
+    }
+
+    newInstance->npp = npp;
+
+    return &newInstance->header;
+}
+
+static void pluginDeallocate(NPObject *obj)
+{
+    free(obj);
+}
+
+static bool pluginRemoveProperty(NPObject *npobj, NPIdentifier name)
+{
+    return false;
+}
+
+static bool pluginEnumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count)
+{
+    return false;
+}
diff --git a/samples/BrowserPlugin/jni/PluginObject.h b/samples/BrowserPlugin/jni/PluginObject.h
new file mode 100644
index 0000000..61486d5
--- /dev/null
+++ b/samples/BrowserPlugin/jni/PluginObject.h
@@ -0,0 +1,85 @@
+/*
+ IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
+ consideration of your agreement to the following terms, and your use, installation,
+ modification or redistribution of this Apple software constitutes acceptance of these
+ terms.  If you do not agree with these terms, please do not use, install, modify or
+ redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and subject to these
+ terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in
+ this original Apple software (the "Apple Software"), to use, reproduce, modify and
+ redistribute the Apple Software, with or without modifications, in source and/or binary
+ forms; provided that if you redistribute the Apple Software in its entirety and without
+ modifications, you must retain this notice and the following text and disclaimers in all
+ such redistributions of the Apple Software.  Neither the name, trademarks, service marks
+ or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
+ the Apple Software without specific prior written permission from Apple. Except as expressly
+ stated in this notice, no other rights or licenses, express or implied, are granted by Apple
+ herein, including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO WARRANTIES,
+ EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
+ USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+          OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
+ REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
+ WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
+ OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PluginObject__DEFINED
+#define PluginObject__DEFINED
+
+#include "main.h"
+#include <jni.h>
+
+class SubPlugin {
+public:
+    SubPlugin(NPP inst) : m_inst(inst) {}
+    virtual ~SubPlugin() {}
+    virtual int16 handleEvent(const ANPEvent* evt) = 0;
+    virtual bool supportsDrawingModel(ANPDrawingModel) = 0;
+
+    NPP inst() const { return m_inst; }
+
+private:
+    NPP m_inst;
+};
+
+class SurfaceSubPlugin : public SubPlugin {
+public:
+    SurfaceSubPlugin(NPP inst) : SubPlugin(inst) {}
+    virtual ~SurfaceSubPlugin() {}
+    virtual bool isFixedSurface() = 0;
+    virtual void surfaceCreated(JNIEnv*, jobject) = 0;
+    virtual void surfaceChanged(int format, int width, int height) = 0;
+    virtual void surfaceDestroyed() = 0;
+};
+
+enum PluginTypes {
+    kAnimation_PluginType  = 1,
+    kAudio_PluginType      = 2,
+    kBackground_PluginType = 3,
+    kForm_PluginType       = 4,
+    kText_PluginType       = 5,
+    kPaint_PluginType      = 6,
+};
+typedef uint32_t PluginType;
+
+typedef struct PluginObject {
+    NPObject header;
+    NPP npp;
+    NPWindow* window;
+
+    PluginType pluginType;
+    SubPlugin* activePlugin;
+
+} PluginObject;
+
+NPClass *getPluginClass(void);
+
+#endif // PluginObject__DEFINED
diff --git a/samples/BrowserPlugin/jni/animation/AnimationPlugin.cpp b/samples/BrowserPlugin/jni/animation/AnimationPlugin.cpp
new file mode 100644
index 0000000..b6175c1
--- /dev/null
+++ b/samples/BrowserPlugin/jni/animation/AnimationPlugin.cpp
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "AnimationPlugin.h"
+
+#include <math.h>
+#include <string.h>
+
+extern NPNetscapeFuncs*        browser;
+extern ANPLogInterfaceV0       gLogI;
+extern ANPCanvasInterfaceV0    gCanvasI;
+extern ANPPaintInterfaceV0     gPaintI;
+extern ANPPathInterfaceV0      gPathI;
+extern ANPWindowInterfaceV0    gWindowI;
+
+static uint16 rnd16(float x, int inset) {
+    int ix = (int)roundf(x) + inset;
+    if (ix < 0) {
+        ix = 0;
+    }
+    return static_cast<uint16>(ix);
+}
+
+static void inval(NPP instance, const ANPRectF& r, bool doAA) {
+    const int inset = doAA ? -1 : 0;
+
+    NPRect inval;
+    inval.left = rnd16(r.left, inset);
+    inval.top = rnd16(r.top, inset);
+    inval.right = rnd16(r.right, -inset);
+    inval.bottom = rnd16(r.bottom, -inset);
+    browser->invalidaterect(instance, &inval);
+}
+
+static void bounce(float* x, float* dx, const float max) {
+    *x += *dx;
+    if (*x < 0) {
+        *x = 0;
+        if (*dx < 0) {
+            *dx = -*dx;
+        }
+    } else if (*x > max) {
+        *x = max;
+        if (*dx > 0) {
+            *dx = -*dx;
+        }
+    }
+}
+///////////////////////////////////////////////////////////////////////////////
+
+BallAnimation::BallAnimation(NPP inst) : SubPlugin(inst) {
+    m_x = m_y = 0;
+    m_dx = 7 * SCALE;
+    m_dy = 5 * SCALE;
+
+    memset(&m_oval, 0, sizeof(m_oval));
+
+    m_paint = gPaintI.newPaint();
+    gPaintI.setFlags(m_paint, gPaintI.getFlags(m_paint) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setColor(m_paint, 0xFFFF0000);
+
+    //register for touch events
+    ANPEventFlags flags = kTouch_ANPEventFlag;
+    NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
+    if (err != NPERR_NO_ERROR) {
+        gLogI.log(inst, kError_ANPLogType, "Error selecting input events.");
+    }
+}
+
+BallAnimation::~BallAnimation() {
+    gPaintI.deletePaint(m_paint);
+}
+
+bool BallAnimation::supportsDrawingModel(ANPDrawingModel model) {
+    return (model == kBitmap_ANPDrawingModel);
+}
+
+void BallAnimation::drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip) {
+
+    // create a canvas
+    ANPCanvas* canvas = gCanvasI.newCanvas(&bitmap);
+
+    // clip the canvas
+    ANPRectF clipR;
+    clipR.left = clip.left;
+    clipR.top = clip.top;
+    clipR.right = clip.right;
+    clipR.bottom = clip.bottom;
+    gCanvasI.clipRect(canvas, &clipR);
+
+    // setup variables
+    PluginObject *obj = (PluginObject*) inst()->pdata;
+    const float OW = 20;
+    const float OH = 20;
+    const int W = obj->window->width;
+    const int H = obj->window->height;
+
+    // paint the canvas (using the path API)
+    gCanvasI.drawColor(canvas, 0xFFFFFFFF);
+    {
+        ANPPath* path = gPathI.newPath();
+
+        float cx = W * 0.5f;
+        float cy = H * 0.5f;
+        gPathI.moveTo(path, 0, 0);
+        gPathI.quadTo(path, cx, cy, W, 0);
+        gPathI.quadTo(path, cx, cy, W, H);
+        gPathI.quadTo(path, cx, cy, 0, H);
+        gPathI.quadTo(path, cx, cy, 0, 0);
+
+        gPaintI.setColor(m_paint, 0xFF0000FF);
+        gCanvasI.drawPath(canvas, path, m_paint);
+
+        ANPRectF bounds;
+        memset(&bounds, 0, sizeof(bounds));
+        gPathI.getBounds(path, &bounds);
+        gPathI.deletePath(path);
+    }
+
+    // draw the oval
+    inval(inst(), m_oval, true);  // inval the old
+    m_oval.left = m_x;
+    m_oval.top = m_y;
+    m_oval.right = m_x + OW;
+    m_oval.bottom = m_y + OH;
+    inval(inst(), m_oval, true);  // inval the new
+    gPaintI.setColor(m_paint, 0xFFFF0000);
+    gCanvasI.drawOval(canvas, &m_oval, m_paint);
+
+    // update the coordinates of the oval
+    bounce(&m_x, &m_dx, obj->window->width - OW);
+    bounce(&m_y, &m_dy, obj->window->height - OH);
+
+    // delete the canvas
+    gCanvasI.deleteCanvas(canvas);
+}
+
+void BallAnimation::showEntirePluginOnScreen() {
+    NPP instance = this->inst();
+    PluginObject *obj = (PluginObject*) instance->pdata;
+    NPWindow *window = obj->window;
+
+    ANPRectI visibleRects[1];
+
+    visibleRects[0].left = 0;
+    visibleRects[0].top = 0;
+    visibleRects[0].right = window->width;
+    visibleRects[0].bottom = window->height;
+
+    gWindowI.setVisibleRects(instance, visibleRects, 1);
+    gWindowI.clearVisibleRects(instance);
+}
+
+int16 BallAnimation::handleEvent(const ANPEvent* evt) {
+    NPP instance = this->inst();
+
+    switch (evt->eventType) {
+        case kDraw_ANPEventType:
+            switch (evt->data.draw.model) {
+                case kBitmap_ANPDrawingModel:
+                    drawPlugin(evt->data.draw.data.bitmap, evt->data.draw.clip);
+                    return 1;
+                default:
+                    break;   // unknown drawing model
+            }
+        case kTouch_ANPEventType:
+             if (kDown_ANPTouchAction == evt->data.touch.action) {
+                 showEntirePluginOnScreen();
+             }
+             return 1;
+        default:
+            break;
+    }
+    return 0;   // unknown or unhandled event
+}
diff --git a/samples/BrowserPlugin/jni/animation/AnimationPlugin.h b/samples/BrowserPlugin/jni/animation/AnimationPlugin.h
new file mode 100644
index 0000000..ef2a3f54
--- /dev/null
+++ b/samples/BrowserPlugin/jni/animation/AnimationPlugin.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "PluginObject.h"
+
+#ifndef pluginGraphics__DEFINED
+#define pluginGraphics__DEFINED
+
+class BallAnimation : public SubPlugin {
+public:
+    BallAnimation(NPP inst);
+    virtual ~BallAnimation();
+    virtual bool supportsDrawingModel(ANPDrawingModel);
+    virtual int16 handleEvent(const ANPEvent* evt);
+private:
+    void drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip);
+    void showEntirePluginOnScreen();
+
+    float m_x;
+    float m_y;
+    float m_dx;
+    float m_dy;
+
+    ANPRectF    m_oval;
+    ANPPaint*   m_paint;
+
+    static const float SCALE = 0.1;
+};
+
+#endif // pluginGraphics__DEFINED
diff --git a/samples/BrowserPlugin/jni/audio/AudioPlugin.cpp b/samples/BrowserPlugin/jni/audio/AudioPlugin.cpp
new file mode 100644
index 0000000..58d340c
--- /dev/null
+++ b/samples/BrowserPlugin/jni/audio/AudioPlugin.cpp
@@ -0,0 +1,382 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "AudioPlugin.h"
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+extern NPNetscapeFuncs*         browser;
+extern ANPLogInterfaceV0        gLogI;
+extern ANPCanvasInterfaceV0     gCanvasI;
+extern ANPPaintInterfaceV0      gPaintI;
+extern ANPAudioTrackInterfaceV0 gSoundI;
+extern ANPTypefaceInterfaceV0   gTypefaceI;
+
+
+static void inval(NPP instance) {
+    browser->invalidaterect(instance, NULL);
+}
+
+static uint16 rnd16(float x, int inset) {
+    int ix = (int)roundf(x) + inset;
+    if (ix < 0) {
+        ix = 0;
+    }
+    return static_cast<uint16>(ix);
+}
+
+static void inval(NPP instance, const ANPRectF& r, bool doAA) {
+    const int inset = doAA ? -1 : 0;
+
+    PluginObject *obj = reinterpret_cast<PluginObject*>(instance->pdata);
+    NPRect inval;
+    inval.left = rnd16(r.left, inset);
+    inval.top = rnd16(r.top, inset);
+    inval.right = rnd16(r.right, -inset);
+    inval.bottom = rnd16(r.bottom, -inset);
+    browser->invalidaterect(instance, &inval);
+}
+
+static void audioCallback(ANPAudioEvent evt, void* user, ANPAudioBuffer* buffer) {
+    switch (evt) {
+        case kMoreData_ANPAudioEvent: {
+            SoundPlay* play = reinterpret_cast<SoundPlay*>(user);
+            size_t amount = fread(buffer->bufferData, 1, buffer->size, play->file);
+            buffer->size = amount;
+            if (amount == 0) {
+                gSoundI.stop(play->track);
+                fclose(play->file);
+                play->file = NULL;
+                // TODO need to notify our main thread to delete the track now
+            }
+
+            if (play->fileSize > 0) {
+                // TODO we need to properly update the progress value
+                play->progress = 1;
+                inval(play->instance);
+            }
+
+
+            break;
+        }
+        default:
+            break;
+    }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+AudioPlugin::AudioPlugin(NPP inst) : SubPlugin(inst) {
+
+    const char path[] = "/sdcard/sample.raw";
+
+    // open a file stream
+    FILE* f = fopen(path, "r");
+    gLogI.log(inst, kDebug_ANPLogType, "--- path %s FILE %p", path, f);
+
+    // setup our private audio struct's default values
+    m_soundPlay = new SoundPlay;
+    m_soundPlay->instance = inst;
+    m_soundPlay->progress = 0;
+    m_soundPlay->fileSize = 0;
+    m_soundPlay->file = f;
+    m_soundPlay->track = NULL;
+
+    // create the audio track
+    if (f) {
+        m_soundPlay->track = gSoundI.newTrack(44100, kPCM16Bit_ANPSampleFormat, 2, audioCallback, m_soundPlay);
+        if (!m_soundPlay->track) {
+            fclose(f);
+            m_soundPlay->file = NULL;
+        }
+    }
+
+    // get the audio file's size
+    int fileDescriptor = open(path, O_RDONLY);
+    struct stat fileStatus;
+
+    if(fileDescriptor <= 0) {
+        gLogI.log(inst, kError_ANPLogType, "fopen error");
+    }
+    else if (fstat(fileDescriptor, &fileStatus) != 0) {
+        gLogI.log(inst, kDebug_ANPLogType, "File Size: %d", fileStatus.st_size);
+        m_soundPlay->fileSize = fileStatus.st_size;
+    } else {
+        gLogI.log(inst, kError_ANPLogType, "fstat error");
+    }
+
+    // configure the UI elements
+    m_activeTouch = false;
+
+    memset(&m_trackRect, 0, sizeof(m_trackRect));
+    memset(&m_playRect,  0, sizeof(m_playRect));
+    memset(&m_pauseRect, 0, sizeof(m_pauseRect));
+    memset(&m_stopRect,  0, sizeof(m_stopRect));
+
+    m_paintTrack = gPaintI.newPaint();
+    gPaintI.setFlags(m_paintTrack, gPaintI.getFlags(m_paintTrack) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setColor(m_paintTrack, 0xFFC0C0C0);
+
+    m_paintRect = gPaintI.newPaint();
+    gPaintI.setFlags(m_paintRect, gPaintI.getFlags(m_paintRect) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setColor(m_paintRect, 0xFFA8A8A8);
+
+    m_paintText = gPaintI.newPaint();
+    gPaintI.setFlags(m_paintText, gPaintI.getFlags(m_paintText) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setColor(m_paintText, 0xFF2F4F4F);
+    gPaintI.setTextSize(m_paintText, 18);
+
+    m_paintTrackProgress = gPaintI.newPaint();
+    gPaintI.setFlags(m_paintTrackProgress, gPaintI.getFlags(m_paintTrackProgress) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setColor(m_paintTrackProgress, 0xFF545454);
+
+    m_paintActiveRect = gPaintI.newPaint();
+    gPaintI.setFlags(m_paintActiveRect, gPaintI.getFlags(m_paintActiveRect) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setColor(m_paintActiveRect, 0xFF545454);
+
+    ANPTypeface* tf = gTypefaceI.createFromName("serif", kItalic_ANPTypefaceStyle);
+    gPaintI.setTypeface(m_paintText, tf);
+    gTypefaceI.unref(tf);
+
+    //register for touch events
+    ANPEventFlags flags = kTouch_ANPEventFlag;
+    NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
+    if (err != NPERR_NO_ERROR) {
+        gLogI.log(inst, kError_ANPLogType, "Error selecting input events.");
+    }
+}
+
+AudioPlugin::~AudioPlugin() {
+    gPaintI.deletePaint(m_paintTrack);
+    gPaintI.deletePaint(m_paintRect);
+    gPaintI.deletePaint(m_paintText);
+    gPaintI.deletePaint(m_paintTrackProgress);
+    gPaintI.deletePaint(m_paintActiveRect);
+    if(m_soundPlay->track)
+        gSoundI.deleteTrack(m_soundPlay->track);
+    delete m_soundPlay;
+}
+
+bool AudioPlugin::supportsDrawingModel(ANPDrawingModel model) {
+    return (model == kBitmap_ANPDrawingModel);
+}
+
+void AudioPlugin::drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip) {
+    ANPCanvas* canvas = gCanvasI.newCanvas(&bitmap);
+
+    ANPRectF clipR;
+    clipR.left = clip.left;
+    clipR.top = clip.top;
+    clipR.right = clip.right;
+    clipR.bottom = clip.bottom;
+    gCanvasI.clipRect(canvas, &clipR);
+
+    draw(canvas);
+    gCanvasI.deleteCanvas(canvas);
+}
+
+void AudioPlugin::draw(ANPCanvas* canvas) {
+    NPP instance = this->inst();
+    PluginObject *obj = (PluginObject*) instance->pdata;
+
+    gLogI.log(instance, kError_ANPLogType, "Drawing");
+
+    const float trackHeight = 30;
+    const float buttonWidth = 60;
+    const float buttonHeight = 30;
+    const int W = obj->window->width;
+    const int H = obj->window->height;
+
+    // color the plugin canvas
+    gCanvasI.drawColor(canvas, 0xFFCDCDCD);
+
+    // get font metrics
+    ANPFontMetrics fontMetrics;
+    gPaintI.getFontMetrics(m_paintText, &fontMetrics);
+
+    // draw the track box (1 px from the edge)
+    m_trackRect.left = 1;
+    m_trackRect.top = 1;
+    m_trackRect.right = W - 2;
+    m_trackRect.bottom = 1 + trackHeight;
+    gCanvasI.drawRect(canvas, &m_trackRect, m_paintTrack);
+
+    // draw the progress bar
+    if (m_soundPlay->progress > 0) {
+        // TODO need to draw progress bar to cover the proper percentage of the track bar
+        gCanvasI.drawRect(canvas, &m_trackRect, m_paintTrackProgress);
+    }
+
+    // draw the play box (under track box)
+    m_playRect.left = m_trackRect.left + 5;
+    m_playRect.top = m_trackRect.bottom + 10;
+    m_playRect.right = m_playRect.left + buttonWidth;
+    m_playRect.bottom = m_playRect.top + buttonHeight;
+    gCanvasI.drawRect(canvas, &m_playRect, getPaint(&m_playRect));
+    // draw the play box (under track box)
+    const char playText[] = "Play";
+    gCanvasI.drawText(canvas, playText, sizeof(playText)-1, m_playRect.left + 5,
+                      m_playRect.top - fontMetrics.fTop, m_paintText);
+
+    // draw the pause box (under track box)
+    m_pauseRect.left = m_playRect.right + 20;
+    m_pauseRect.top = m_trackRect.bottom + 10;
+    m_pauseRect.right = m_pauseRect.left + buttonWidth;
+    m_pauseRect.bottom = m_pauseRect.top + buttonHeight;
+    gCanvasI.drawRect(canvas, &m_pauseRect, getPaint(&m_pauseRect));
+    // draw the text in the pause box
+    const char pauseText[] = "Pause";
+    gCanvasI.drawText(canvas, pauseText, sizeof(pauseText)-1, m_pauseRect.left + 5,
+                      m_pauseRect.top - fontMetrics.fTop, m_paintText);
+
+    // draw the stop box (under track box)
+    m_stopRect.left = m_pauseRect.right + 20;
+    m_stopRect.top = m_trackRect.bottom + 10;
+    m_stopRect.right = m_stopRect.left + buttonWidth;
+    m_stopRect.bottom = m_stopRect.top + buttonHeight;
+    gCanvasI.drawRect(canvas, &m_stopRect, getPaint(&m_stopRect));
+    // draw the text in the pause box
+    const char stopText[] = "Stop";
+    gCanvasI.drawText(canvas, stopText, sizeof(stopText)-1, m_stopRect.left + 5,
+                      m_stopRect.top - fontMetrics.fTop, m_paintText);
+}
+
+ANPPaint* AudioPlugin::getPaint(ANPRectF* input) {
+    return (input == m_activeRect) ? m_paintActiveRect : m_paintRect;
+}
+
+int16 AudioPlugin::handleEvent(const ANPEvent* evt) {
+    NPP instance = this->inst();
+
+    switch (evt->eventType) {
+        case kDraw_ANPEventType:
+            switch (evt->data.draw.model) {
+                case kBitmap_ANPDrawingModel:
+                    drawPlugin(evt->data.draw.data.bitmap, evt->data.draw.clip);
+                    return 1;
+                default:
+                    break;   // unknown drawing model
+            }
+
+        case kTouch_ANPEventType: {
+            int x = evt->data.touch.x;
+            int y = evt->data.touch.y;
+            if (kDown_ANPTouchAction == evt->data.touch.action) {
+
+                m_activeTouchRect = validTouch(x,y);
+                if(m_activeTouchRect) {
+                    m_activeTouch = true;
+                    return 1;
+                }
+
+            } else if (kUp_ANPTouchAction == evt->data.touch.action && m_activeTouch) {
+                handleTouch(x, y);
+                m_activeTouch = false;
+                return 1;
+            } else if (kCancel_ANPTouchAction == evt->data.touch.action) {
+                m_activeTouch = false;
+            }
+            break;
+        }
+        default:
+            break;
+    }
+    return 0;   // unknown or unhandled event
+}
+
+void AudioPlugin::invalActiveRect() {
+
+}
+
+ANPRectF* AudioPlugin::validTouch(int x, int y) {
+
+    if (m_playRect.left && x < m_playRect.right && y > m_playRect.top && y < m_playRect.bottom)
+        return &m_playRect;
+    else if (m_pauseRect.left && x < m_pauseRect.right && y > m_pauseRect.top && y < m_pauseRect.bottom)
+        return &m_pauseRect;
+    else if (x > m_stopRect.left && x < m_stopRect.right && y > m_stopRect.top && y < m_stopRect.bottom)
+        return &m_stopRect;
+    else
+        return NULL;
+}
+
+void AudioPlugin::handleTouch(int x, int y) {
+    NPP instance = this->inst();
+
+    // if the track is null then return
+    if (NULL == m_soundPlay->track) {
+        gLogI.log(instance, kError_ANPLogType, "---- %p unable to create track",
+                  instance);
+        return;
+    }
+
+    // check to make sure the currentRect matches the activeRect
+    ANPRectF* currentRect = validTouch(x,y);
+    if (m_activeTouchRect != currentRect)
+        return;
+
+    if (currentRect == &m_playRect) {
+
+        gLogI.log(instance, kDebug_ANPLogType, "---- %p starting track (%d)",
+                  m_soundPlay->track, gSoundI.isStopped(m_soundPlay->track));
+
+        if (gSoundI.isStopped(m_soundPlay->track)) {
+            gSoundI.start(m_soundPlay->track);
+        }
+    }
+    else if (currentRect == &m_pauseRect) {
+
+        gLogI.log(instance, kDebug_ANPLogType, "---- %p pausing track (%d)",
+                  m_soundPlay->track, gSoundI.isStopped(m_soundPlay->track));
+
+        if (!gSoundI.isStopped(m_soundPlay->track)) {
+            gSoundI.pause(m_soundPlay->track);
+        }
+    }
+    else if (currentRect == &m_stopRect) {
+
+        gLogI.log(instance, kDebug_ANPLogType, "---- %p stopping track (%d)",
+                  m_soundPlay->track, gSoundI.isStopped(m_soundPlay->track));
+
+        if (!gSoundI.isStopped(m_soundPlay->track)) {
+            gSoundI.stop(m_soundPlay->track);
+        }
+        if (m_soundPlay->file) {
+            fseek(m_soundPlay->file, 0, SEEK_SET);
+        }
+    }
+    else {
+        return;
+    }
+
+    // set the currentRect to be the activeRect
+    m_activeRect = currentRect;
+    inval(instance);
+}
diff --git a/samples/BrowserPlugin/jni/audio/AudioPlugin.h b/samples/BrowserPlugin/jni/audio/AudioPlugin.h
new file mode 100644
index 0000000..129d33a
--- /dev/null
+++ b/samples/BrowserPlugin/jni/audio/AudioPlugin.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "PluginObject.h"
+#include <stdio.h>
+
+#ifndef audioPlugin__DEFINED
+#define audioPlugin__DEFINED
+
+struct SoundPlay {
+    NPP             instance;
+    ANPAudioTrack*  track;
+    FILE*           file;
+    int             fileSize;
+    int             progress; // value between 0 and 100
+};
+
+class AudioPlugin : public SubPlugin {
+public:
+    AudioPlugin(NPP inst);
+    virtual ~AudioPlugin();
+    virtual bool supportsDrawingModel(ANPDrawingModel);
+    virtual int16 handleEvent(const ANPEvent* evt);
+private:
+    void draw(ANPCanvas*);
+    void drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip);
+
+    void handleTouch(int x, int y);
+    void invalActiveRect();
+    ANPPaint* getPaint(ANPRectF*);
+    ANPRectF* validTouch(int x, int y);
+
+    ANPRectF    m_trackRect;
+    ANPRectF    m_playRect;
+    ANPRectF    m_pauseRect;
+    ANPRectF    m_stopRect;
+
+    ANPPaint*   m_paintTrack;
+    ANPPaint*   m_paintRect;
+    ANPPaint*   m_paintText;
+
+    ANPPaint*   m_paintTrackProgress;
+    ANPPaint*   m_paintActiveRect;
+
+    SoundPlay*  m_soundPlay;
+
+    bool        m_activeTouch;
+    ANPRectF*   m_activeTouchRect;
+    ANPRectF*   m_activeRect;
+};
+
+#endif // audioPlugin__DEFINED
diff --git a/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp b/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp
new file mode 100644
index 0000000..2a65b4f
--- /dev/null
+++ b/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp
@@ -0,0 +1,423 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "BackgroundPlugin.h"
+#include "android_npapi.h"
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+extern NPNetscapeFuncs*        browser;
+extern ANPBitmapInterfaceV0    gBitmapI;
+extern ANPCanvasInterfaceV0    gCanvasI;
+extern ANPLogInterfaceV0       gLogI;
+extern ANPPaintInterfaceV0     gPaintI;
+extern ANPSurfaceInterfaceV0   gSurfaceI;
+extern ANPTypefaceInterfaceV0  gTypefaceI;
+
+#define ARRAY_COUNT(array)      (sizeof(array) / sizeof(array[0]))
+
+static uint32_t getMSecs() {
+    struct timeval tv;
+    gettimeofday(&tv, NULL);
+    return (uint32_t) (tv.tv_sec * 1000 + tv.tv_usec / 1000 ); // microseconds to milliseconds
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+BackgroundPlugin::BackgroundPlugin(NPP inst) : SurfaceSubPlugin(inst) {
+
+    // initialize the drawing surface
+    m_surface = NULL;
+    m_vm = NULL;
+
+    //initialize bitmap transparency variables
+    mFinishedStageOne   = false;
+    mFinishedStageTwo   = false;
+    mFinishedStageThree = false;
+
+    // test basic plugin functionality
+    test_logging(); // android logging
+    test_timers();  // plugin timers
+    test_bitmaps(); // android bitmaps
+    test_domAccess();
+    test_javascript();
+}
+
+BackgroundPlugin::~BackgroundPlugin() { }
+
+bool BackgroundPlugin::supportsDrawingModel(ANPDrawingModel model) {
+    return (model == kSurface_ANPDrawingModel);
+}
+
+bool BackgroundPlugin::isFixedSurface() {
+    return false;
+}
+
+void BackgroundPlugin::surfaceCreated(JNIEnv* env, jobject surface) {
+    env->GetJavaVM(&m_vm);
+    m_surface = env->NewGlobalRef(surface);
+}
+
+void BackgroundPlugin::surfaceChanged(int format, int width, int height) {
+    drawPlugin(width, height);
+}
+
+void BackgroundPlugin::surfaceDestroyed() {
+    JNIEnv* env = NULL;
+    if (m_surface && m_vm->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
+        env->DeleteGlobalRef(m_surface);
+        m_surface = NULL;
+    }
+}
+
+void BackgroundPlugin::drawPlugin(int surfaceWidth, int surfaceHeight) {
+
+    // get the plugin's dimensions according to the DOM
+    PluginObject *obj = (PluginObject*) inst()->pdata;
+    const int W = obj->window->width;
+    const int H = obj->window->height;
+
+    // compute the current zoom level
+    const float zoomFactorW = static_cast<float>(surfaceWidth) / W;
+    const float zoomFactorH = static_cast<float>(surfaceHeight) / H;
+
+    // check to make sure the zoom level is uniform
+    if (zoomFactorW + .01 < zoomFactorH && zoomFactorW - .01 > zoomFactorH)
+        gLogI.log(inst(), kError_ANPLogType, " ------ %p zoom is out of sync (%f,%f)",
+                  inst(), zoomFactorW, zoomFactorH);
+
+    // scale the variables based on the zoom level
+    const int fontSize = (int)(zoomFactorW * 16);
+    const int leftMargin = (int)(zoomFactorW * 10);
+
+    // lock the surface
+    ANPBitmap bitmap;
+    JNIEnv* env = NULL;
+    if (!m_surface || m_vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK ||
+        !gSurfaceI.lock(env, m_surface, &bitmap, NULL)) {
+        gLogI.log(inst(), kError_ANPLogType, " ------ %p unable to lock the plugin", inst());
+        return;
+    }
+
+    // create a canvas
+    ANPCanvas* canvas = gCanvasI.newCanvas(&bitmap);
+    gCanvasI.drawColor(canvas, 0xFFFFFFFF);
+
+    ANPPaint* paint = gPaintI.newPaint();
+    gPaintI.setFlags(paint, gPaintI.getFlags(paint) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setColor(paint, 0xFFFF0000);
+    gPaintI.setTextSize(paint, fontSize);
+
+    ANPTypeface* tf = gTypefaceI.createFromName("serif", kItalic_ANPTypefaceStyle);
+    gPaintI.setTypeface(paint, tf);
+    gTypefaceI.unref(tf);
+
+    ANPFontMetrics fm;
+    gPaintI.getFontMetrics(paint, &fm);
+
+    gPaintI.setColor(paint, 0xFF0000FF);
+    const char c[] = "This is a background plugin.";
+    gCanvasI.drawText(canvas, c, sizeof(c)-1, leftMargin, -fm.fTop, paint);
+
+    // clean up variables and unlock the surface
+    gPaintI.deletePaint(paint);
+    gCanvasI.deleteCanvas(canvas);
+    gSurfaceI.unlock(env, m_surface);
+}
+
+int16 BackgroundPlugin::handleEvent(const ANPEvent* evt) {
+    switch (evt->eventType) {
+        case kDraw_ANPEventType:
+            gLogI.log(inst(), kError_ANPLogType, " ------ %p the plugin did not request draw events", inst());
+            break;
+        case kLifecycle_ANPEventType:
+            if (evt->data.lifecycle.action == kOnLoad_ANPLifecycleAction) {
+                gLogI.log(inst(), kDebug_ANPLogType, " ------ %p the plugin received an onLoad event", inst());
+                return 1;
+            }
+            break;
+        case kTouch_ANPEventType:
+            gLogI.log(inst(), kError_ANPLogType, " ------ %p the plugin did not request touch events", inst());
+            break;
+        case kKey_ANPEventType:
+            gLogI.log(inst(), kError_ANPLogType, " ------ %p the plugin did not request key events", inst());
+            break;
+        default:
+            break;
+    }
+    return 0;   // unknown or unhandled event
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// LOGGING TESTS
+///////////////////////////////////////////////////////////////////////////////
+
+
+void BackgroundPlugin::test_logging() {
+    NPP instance = this->inst();
+
+    //LOG_ERROR(instance, " ------ %p Testing Log Error", instance);
+    gLogI.log(instance, kError_ANPLogType, " ------ %p Testing Log Error", instance);
+    gLogI.log(instance, kWarning_ANPLogType, " ------ %p Testing Log Warning", instance);
+    gLogI.log(instance, kDebug_ANPLogType, " ------ %p Testing Log Debug", instance);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// TIMER TESTS
+///////////////////////////////////////////////////////////////////////////////
+
+#define TIMER_INTERVAL     50
+static void timer_oneshot(NPP instance, uint32 timerID);
+static void timer_repeat(NPP instance, uint32 timerID);
+static void timer_neverfires(NPP instance, uint32 timerID);
+static void timer_latency(NPP instance, uint32 timerID);
+
+void BackgroundPlugin::test_timers() {
+    NPP instance = this->inst();
+
+    //Setup the testing counters
+    mTimerRepeatCount = 5;
+    mTimerLatencyCount = 5;
+
+    // test for bogus timerID
+    browser->unscheduletimer(instance, 999999);
+    // test one-shot
+    browser->scheduletimer(instance, 100, false, timer_oneshot);
+    // test repeat
+    browser->scheduletimer(instance, 50, true, timer_repeat);
+    // test timer latency
+    browser->scheduletimer(instance, TIMER_INTERVAL, true, timer_latency);
+    mStartTime = mPrevTime = getMSecs();
+    // test unschedule immediately
+    uint32 id = browser->scheduletimer(instance, 100, false, timer_neverfires);
+    browser->unscheduletimer(instance, id);
+    // test double unschedule (should be no-op)
+    browser->unscheduletimer(instance, id);
+
+}
+
+static void timer_oneshot(NPP instance, uint32 timerID) {
+    gLogI.log(instance, kDebug_ANPLogType, "-------- oneshot timer\n");
+}
+
+static void timer_repeat(NPP instance, uint32 timerID) {
+    BackgroundPlugin *obj = ((BackgroundPlugin*) ((PluginObject*) instance->pdata)->activePlugin);
+
+    gLogI.log(instance, kDebug_ANPLogType, "-------- repeat timer %d\n",
+              obj->mTimerRepeatCount);
+    if (--obj->mTimerRepeatCount == 0) {
+        browser->unscheduletimer(instance, timerID);
+    }
+}
+
+static void timer_neverfires(NPP instance, uint32 timerID) {
+    gLogI.log(instance, kError_ANPLogType, "-------- timer_neverfires!!!\n");
+}
+
+static void timer_latency(NPP instance, uint32 timerID) {
+    BackgroundPlugin *obj = ((BackgroundPlugin*) ((PluginObject*) instance->pdata)->activePlugin);
+
+    obj->mTimerLatencyCurrentCount += 1;
+
+    uint32_t now = getMSecs();
+    uint32_t interval = now - obj->mPrevTime;
+    uint32_t dur = now - obj->mStartTime;
+    uint32_t expectedDur = obj->mTimerLatencyCurrentCount * TIMER_INTERVAL;
+    int32_t drift = dur - expectedDur;
+    int32_t avgDrift = drift / obj->mTimerLatencyCurrentCount;
+
+    obj->mPrevTime = now;
+
+    gLogI.log(instance, kDebug_ANPLogType,
+              "-------- latency test: [%3d] interval %d expected %d, total %d expected %d, drift %d avg %d\n",
+              obj->mTimerLatencyCurrentCount, interval, TIMER_INTERVAL, dur,
+              expectedDur, drift, avgDrift);
+
+    if (--obj->mTimerLatencyCount == 0) {
+        browser->unscheduletimer(instance, timerID);
+    }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// BITMAP TESTS
+///////////////////////////////////////////////////////////////////////////////
+
+static void test_formats(NPP instance);
+
+void BackgroundPlugin::test_bitmaps() {
+    test_formats(this->inst());
+}
+
+static void test_formats(NPP instance) {
+
+    // TODO pull names from enum in npapi instead of hardcoding them
+    static const struct {
+        ANPBitmapFormat fFormat;
+        const char*     fName;
+    } gRecs[] = {
+        { kUnknown_ANPBitmapFormat,   "unknown" },
+        { kRGBA_8888_ANPBitmapFormat, "8888" },
+        { kRGB_565_ANPBitmapFormat,   "565" },
+    };
+
+    ANPPixelPacking packing;
+    for (size_t i = 0; i < ARRAY_COUNT(gRecs); i++) {
+        if (gBitmapI.getPixelPacking(gRecs[i].fFormat, &packing)) {
+            gLogI.log(instance, kDebug_ANPLogType,
+                      "pixel format [%d] %s has packing ARGB [%d %d] [%d %d] [%d %d] [%d %d]\n",
+                      gRecs[i].fFormat, gRecs[i].fName,
+                      packing.AShift, packing.ABits,
+                      packing.RShift, packing.RBits,
+                      packing.GShift, packing.GBits,
+                      packing.BShift, packing.BBits);
+        } else {
+            gLogI.log(instance, kDebug_ANPLogType,
+                      "pixel format [%d] %s has no packing\n",
+                      gRecs[i].fFormat, gRecs[i].fName);
+        }
+    }
+}
+
+void BackgroundPlugin::test_bitmap_transparency(const ANPEvent* evt) {
+    NPP instance = this->inst();
+
+    // check default & set transparent
+    if (!mFinishedStageOne) {
+
+        gLogI.log(instance, kDebug_ANPLogType, "BEGIN: testing bitmap transparency");
+
+        //check to make sure it is not transparent
+        if (evt->data.draw.data.bitmap.format == kRGBA_8888_ANPBitmapFormat) {
+            gLogI.log(instance, kError_ANPLogType, "bitmap default format is transparent");
+        }
+
+        //make it transparent (any non-null value will set it to true)
+        bool value = true;
+        NPError err = browser->setvalue(instance, NPPVpluginTransparentBool, &value);
+        if (err != NPERR_NO_ERROR) {
+            gLogI.log(instance, kError_ANPLogType, "Error setting transparency.");
+        }
+
+        mFinishedStageOne = true;
+        browser->invalidaterect(instance, NULL);
+    }
+    // check transparent & set opaque
+    else if (!mFinishedStageTwo) {
+
+        //check to make sure it is transparent
+        if (evt->data.draw.data.bitmap.format != kRGBA_8888_ANPBitmapFormat) {
+            gLogI.log(instance, kError_ANPLogType, "bitmap did not change to transparent format");
+        }
+
+        //make it opaque
+        NPError err = browser->setvalue(instance, NPPVpluginTransparentBool, NULL);
+        if (err != NPERR_NO_ERROR) {
+            gLogI.log(instance, kError_ANPLogType, "Error setting transparency.");
+        }
+
+        mFinishedStageTwo = true;
+    }
+    // check opaque
+    else if (!mFinishedStageThree) {
+
+        //check to make sure it is not transparent
+        if (evt->data.draw.data.bitmap.format == kRGBA_8888_ANPBitmapFormat) {
+            gLogI.log(instance, kError_ANPLogType, "bitmap default format is transparent");
+        }
+
+        gLogI.log(instance, kDebug_ANPLogType, "END: testing bitmap transparency");
+
+        mFinishedStageThree = true;
+    }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// DOM TESTS
+///////////////////////////////////////////////////////////////////////////////
+
+void BackgroundPlugin::test_domAccess() {
+    NPP instance = this->inst();
+
+    gLogI.log(instance, kDebug_ANPLogType, " ------ %p Testing DOM Access", instance);
+
+    // Get the plugin's DOM object
+    NPObject* windowObject = NULL;
+    browser->getvalue(instance, NPNVWindowNPObject, &windowObject);
+
+    if (!windowObject)
+        gLogI.log(instance, kError_ANPLogType, " ------ %p Unable to retrieve DOM Window", instance);
+
+    // Retrieve a property from the plugin's DOM object
+    NPIdentifier topIdentifier = browser->getstringidentifier("top");
+    NPVariant topObjectVariant;
+    browser->getproperty(instance, windowObject, topIdentifier, &topObjectVariant);
+
+    if (topObjectVariant.type != NPVariantType_Object)
+        gLogI.log(instance, kError_ANPLogType, " ------ %p Invalid Variant type for DOM Property: %d,%d", instance, topObjectVariant.type, NPVariantType_Object);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// JAVASCRIPT TESTS
+///////////////////////////////////////////////////////////////////////////////
+
+
+void BackgroundPlugin::test_javascript() {
+    NPP instance = this->inst();
+
+    gLogI.log(instance, kDebug_ANPLogType, " ------ %p Testing JavaScript Access", instance);
+
+    // Get the plugin's DOM object
+    NPObject* windowObject = NULL;
+    browser->getvalue(instance, NPNVWindowNPObject, &windowObject);
+
+    if (!windowObject)
+        gLogI.log(instance, kError_ANPLogType, " ------ %p Unable to retrieve DOM Window", instance);
+
+    // create a string (JS code) that is stored in memory allocated by the browser
+    const char* jsString = "1200 + 34";
+    void* stringMem = browser->memalloc(strlen(jsString));
+    memcpy(stringMem, jsString, strlen(jsString));
+
+    // execute the javascript in the plugin's DOM object
+    NPString script = { (char*)stringMem, strlen(jsString) };
+    NPVariant scriptVariant;
+    if (!browser->evaluate(instance, windowObject, &script, &scriptVariant))
+        gLogI.log(instance, kError_ANPLogType, " ------ %p Unable to eval the JS.", instance);
+
+    if (scriptVariant.type == NPVariantType_Int32) {
+        if (scriptVariant.value.intValue != 1234)
+            gLogI.log(instance, kError_ANPLogType, " ------ %p Invalid Value for JS Return: %d,1234", instance, scriptVariant.value.intValue);
+    } else {
+        gLogI.log(instance, kError_ANPLogType, " ------ %p Invalid Variant type for JS Return: %d,%d", instance, scriptVariant.type, NPVariantType_Int32);
+    }
+
+    // free the memory allocated within the browser
+    browser->memfree(stringMem);
+}
diff --git a/samples/BrowserPlugin/jni/background/BackgroundPlugin.h b/samples/BrowserPlugin/jni/background/BackgroundPlugin.h
new file mode 100644
index 0000000..3b9c7ba
--- /dev/null
+++ b/samples/BrowserPlugin/jni/background/BackgroundPlugin.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "PluginObject.h"
+
+#ifndef backgroundPlugin__DEFINED
+#define backgroundPlugin__DEFINED
+
+class BackgroundPlugin : public SurfaceSubPlugin {
+public:
+    BackgroundPlugin(NPP inst);
+    virtual ~BackgroundPlugin();
+    virtual bool supportsDrawingModel(ANPDrawingModel);
+    virtual int16 handleEvent(const ANPEvent* evt);
+    virtual void surfaceCreated(JNIEnv* env, jobject surface);
+    virtual void surfaceChanged(int format, int width, int height);
+    virtual void surfaceDestroyed();
+    virtual bool isFixedSurface();
+
+    // Timer Testing Variables
+    uint32_t mStartTime;
+    uint32_t mPrevTime;
+    int      mTimerRepeatCount;
+    int      mTimerLatencyCount;
+    int      mTimerLatencyCurrentCount;
+
+    // Bitmap Transparency Variables
+    bool mFinishedStageOne;   // check default & set transparent
+    bool mFinishedStageTwo;   // check transparent & set opaque
+    bool mFinishedStageThree; // check opaque
+
+private:
+    void drawPlugin(int surfaceWidth, int surfaceHeight);
+
+    jobject     m_surface;
+    JavaVM*     m_vm;
+
+    void test_logging();
+    void test_timers();
+    void test_bitmaps();
+    void test_bitmap_transparency(const ANPEvent* evt);
+    void test_domAccess();
+    void test_javascript();
+
+};
+
+#endif // backgroundPlugin__DEFINED
diff --git a/samples/BrowserPlugin/jni/form/FormPlugin.cpp b/samples/BrowserPlugin/jni/form/FormPlugin.cpp
new file mode 100644
index 0000000..a92d447
--- /dev/null
+++ b/samples/BrowserPlugin/jni/form/FormPlugin.cpp
@@ -0,0 +1,381 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "FormPlugin.h"
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+extern NPNetscapeFuncs*         browser;
+extern ANPLogInterfaceV0        gLogI;
+extern ANPCanvasInterfaceV0     gCanvasI;
+extern ANPPaintInterfaceV0      gPaintI;
+extern ANPTypefaceInterfaceV0   gTypefaceI;
+extern ANPWindowInterfaceV0     gWindowI;
+
+
+static void inval(NPP instance) {
+    browser->invalidaterect(instance, NULL);
+}
+
+static uint16 rnd16(float x, int inset) {
+    int ix = (int)roundf(x) + inset;
+    if (ix < 0) {
+        ix = 0;
+    }
+    return static_cast<uint16>(ix);
+}
+
+static void inval(NPP instance, const ANPRectF& r, bool doAA) {
+    const int inset = doAA ? -1 : 0;
+
+    PluginObject *obj = reinterpret_cast<PluginObject*>(instance->pdata);
+    NPRect inval;
+    inval.left = rnd16(r.left, inset);
+    inval.top = rnd16(r.top, inset);
+    inval.right = rnd16(r.right, -inset);
+    inval.bottom = rnd16(r.bottom, -inset);
+    browser->invalidaterect(instance, &inval);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+FormPlugin::FormPlugin(NPP inst) : SubPlugin(inst) {
+
+    m_hasFocus = false;
+    m_activeInput = NULL;
+
+    memset(&m_usernameInput, 0, sizeof(m_usernameInput));
+    memset(&m_passwordInput, 0, sizeof(m_passwordInput));
+
+    m_usernameInput.text[0] = '\0';
+    m_usernameInput.charPtr = 0;
+
+    m_passwordInput.text[0] = '\0';
+    m_passwordInput.charPtr = 0;
+
+    m_paintInput = gPaintI.newPaint();
+    gPaintI.setFlags(m_paintInput, gPaintI.getFlags(m_paintInput) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setColor(m_paintInput, 0xFFFFFFFF);
+
+    m_paintActive = gPaintI.newPaint();
+    gPaintI.setFlags(m_paintActive, gPaintI.getFlags(m_paintActive) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setColor(m_paintActive, 0xFFFFFF00);
+
+    m_paintText = gPaintI.newPaint();
+    gPaintI.setFlags(m_paintText, gPaintI.getFlags(m_paintText) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setColor(m_paintText, 0xFF000000);
+    gPaintI.setTextSize(m_paintText, 18);
+
+    ANPTypeface* tf = gTypefaceI.createFromName("serif", kItalic_ANPTypefaceStyle);
+    gPaintI.setTypeface(m_paintText, tf);
+    gTypefaceI.unref(tf);
+
+    //register for key and visibleRect events
+    ANPEventFlags flags = kKey_ANPEventFlag;
+    NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
+    if (err != NPERR_NO_ERROR) {
+        gLogI.log(inst, kError_ANPLogType, "Error selecting input events.");
+    }
+}
+
+FormPlugin::~FormPlugin() {
+    gPaintI.deletePaint(m_paintInput);
+    gPaintI.deletePaint(m_paintActive);
+    gPaintI.deletePaint(m_paintText);
+}
+
+bool FormPlugin::supportsDrawingModel(ANPDrawingModel model) {
+    return (model == kBitmap_ANPDrawingModel);
+}
+
+void FormPlugin::drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip) {
+    ANPCanvas* canvas = gCanvasI.newCanvas(&bitmap);
+
+    ANPRectF clipR;
+    clipR.left = clip.left;
+    clipR.top = clip.top;
+    clipR.right = clip.right;
+    clipR.bottom = clip.bottom;
+    gCanvasI.clipRect(canvas, &clipR);
+
+    draw(canvas);
+    gCanvasI.deleteCanvas(canvas);
+}
+
+void FormPlugin::draw(ANPCanvas* canvas) {
+    NPP instance = this->inst();
+    PluginObject *obj = (PluginObject*) instance->pdata;
+
+    const float inputWidth = 60;
+    const float inputHeight = 30;
+    const int W = obj->window->width;
+    const int H = obj->window->height;
+
+    // color the plugin canvas
+    gCanvasI.drawColor(canvas, (m_hasFocus) ? 0xFFCDCDCD : 0xFF545454);
+
+    // draw the username box (5 px from the top edge)
+    m_usernameInput.rect.left = 5;
+    m_usernameInput.rect.top = 5;
+    m_usernameInput.rect.right = W - 5;
+    m_usernameInput.rect.bottom = m_usernameInput.rect.top + inputHeight;
+    gCanvasI.drawRect(canvas, &m_usernameInput.rect, getPaint(&m_usernameInput));
+    drawText(canvas, m_usernameInput);
+
+    // draw the password box (5 px from the bottom edge)
+    m_passwordInput.rect.left = 5;
+    m_passwordInput.rect.top = H - (inputHeight + 5);
+    m_passwordInput.rect.right = W - 5;
+    m_passwordInput.rect.bottom = m_passwordInput.rect.top + inputHeight;
+    gCanvasI.drawRect(canvas, &m_passwordInput.rect, getPaint(&m_passwordInput));
+    drawPassword(canvas, m_passwordInput);
+
+    //invalidate the canvas
+    //inval(instance);
+}
+
+ANPPaint* FormPlugin::getPaint(TextInput* input) {
+    return (input == m_activeInput) ? m_paintActive : m_paintInput;
+}
+
+void FormPlugin::drawText(ANPCanvas* canvas, TextInput textInput) {
+
+    // get font metrics
+    ANPFontMetrics fontMetrics;
+    gPaintI.getFontMetrics(m_paintText, &fontMetrics);
+
+    gCanvasI.drawText(canvas, textInput.text, textInput.charPtr,
+                      textInput.rect.left + 5,
+                      textInput.rect.bottom - fontMetrics.fBottom, m_paintText);
+}
+
+void FormPlugin::drawPassword(ANPCanvas* canvas, TextInput passwordInput) {
+
+    // get font metrics
+    ANPFontMetrics fontMetrics;
+    gPaintI.getFontMetrics(m_paintText, &fontMetrics);
+
+    // comput the circle dimensions and initial location
+    float initialX = passwordInput.rect.left + 5;
+    float ovalBottom = passwordInput.rect.bottom - 2;
+    float ovalTop = ovalBottom - (fontMetrics.fBottom - fontMetrics.fTop);
+    float ovalWidth = ovalBottom - ovalTop;
+    float ovalSpacing = 3;
+
+    // draw circles instead of the actual text
+    for (uint32_t x = 0; x < passwordInput.charPtr; x++) {
+        ANPRectF oval;
+        oval.left = initialX + ((ovalWidth + ovalSpacing) * (float) x);
+        oval.right = oval.left + ovalWidth;
+        oval.top = ovalTop;
+        oval.bottom = ovalBottom;
+        gCanvasI.drawOval(canvas, &oval, m_paintText);
+    }
+}
+
+int16 FormPlugin::handleEvent(const ANPEvent* evt) {
+    NPP instance = this->inst();
+
+    switch (evt->eventType) {
+        case kDraw_ANPEventType:
+            switch (evt->data.draw.model) {
+                case kBitmap_ANPDrawingModel:
+                    drawPlugin(evt->data.draw.data.bitmap, evt->data.draw.clip);
+                    return 1;
+                default:
+                    break;   // unknown drawing model
+            }
+            break;
+
+        case kLifecycle_ANPEventType:
+            if (evt->data.lifecycle.action == kLoseFocus_ANPLifecycleAction) {
+                gLogI.log(instance, kDebug_ANPLogType, "----%p Loosing Focus", instance);
+
+                if (m_activeInput) {
+                    // hide the keyboard
+                    gWindowI.showKeyboard(instance, false);
+
+                    //reset the activeInput
+                    m_activeInput = NULL;
+                }
+
+                m_hasFocus = false;
+                inval(instance);
+                return 1;
+            }
+            else if (evt->data.lifecycle.action == kGainFocus_ANPLifecycleAction) {
+                gLogI.log(instance, kDebug_ANPLogType, "----%p Gaining Focus", instance);
+                m_hasFocus = true;
+                inval(instance);
+                return 1;
+            }
+            break;
+
+        case kMouse_ANPEventType: {
+
+            int x = evt->data.mouse.x;
+            int y = evt->data.mouse.y;
+            if (kDown_ANPMouseAction == evt->data.mouse.action) {
+
+                TextInput* currentInput = validTap(x,y);
+
+                if (currentInput)
+                    gWindowI.showKeyboard(instance, true);
+                else if (m_activeInput)
+                    gWindowI.showKeyboard(instance, false);
+
+                if (currentInput != m_activeInput)
+                    switchActiveInput(currentInput);
+
+                return 1;
+            }
+            break;
+        }
+
+        case kKey_ANPEventType:
+            if (evt->data.key.action == kDown_ANPKeyAction) {
+
+                //handle navigation keys
+                if (evt->data.key.nativeCode >= kDpadUp_ANPKeyCode
+                        && evt->data.key.nativeCode <= kDpadCenter_ANPKeyCode) {
+                    return handleNavigation(evt->data.key.nativeCode) ? 1 : 0;
+                }
+
+                if (m_activeInput) {
+                    handleTextInput(m_activeInput, evt->data.key.nativeCode,
+                                    evt->data.key.unichar);
+                    inval(instance, m_activeInput->rect, true);
+                }
+            }
+            return 1;
+
+        default:
+            break;
+    }
+    return 0;   // unknown or unhandled event
+}
+
+void FormPlugin::switchActiveInput(TextInput* newInput) {
+    NPP instance = this->inst();
+
+    if (m_activeInput) {
+        inval(instance, m_activeInput->rect, true); // inval the old
+        gWindowI.clearVisibleRects(instance);
+    }
+
+    m_activeInput = newInput; // set the new active input
+
+    if (m_activeInput) {
+        inval(instance, m_activeInput->rect, true); // inval the new
+        scrollIntoView(m_activeInput);
+    }
+}
+
+bool FormPlugin::handleNavigation(ANPKeyCode keyCode) {
+    NPP instance = this->inst();
+
+    gLogI.log(instance, kDebug_ANPLogType, "----%p Recvd Nav Key %d", instance, keyCode);
+
+    if (!m_activeInput) {
+        gWindowI.showKeyboard(instance, true);
+        switchActiveInput(&m_usernameInput);
+    }
+    else if (m_activeInput == &m_usernameInput) {
+        if (keyCode == kDpadDown_ANPKeyCode) {
+            switchActiveInput(&m_passwordInput);
+        }
+        else if (keyCode == kDpadCenter_ANPKeyCode)
+            gWindowI.showKeyboard(instance, false);
+        else if (keyCode == kDpadUp_ANPKeyCode)
+            return false;
+    }
+    else if (m_activeInput == &m_passwordInput) {
+        if (keyCode == kDpadUp_ANPKeyCode) {
+            switchActiveInput(&m_usernameInput);
+        }
+        else if (keyCode == kDpadCenter_ANPKeyCode)
+            gWindowI.showKeyboard(instance, false);
+        else if (keyCode == kDpadDown_ANPKeyCode)
+            return false;
+    }
+
+    return true;
+}
+
+void FormPlugin::handleTextInput(TextInput* input, ANPKeyCode keyCode, int32_t unichar) {
+    NPP instance = this->inst();
+
+    //make sure the input field is in view
+    scrollIntoView(input);
+
+    //handle the delete operation
+    if (keyCode == kDel_ANPKeyCode) {
+        if (input->charPtr > 0) {
+            input->charPtr--;
+        }
+        return;
+    }
+
+    //check to see that the input is not full
+    if (input->charPtr >= (sizeof(input->text) - 1))
+        return;
+
+    //add the character
+    input->text[input->charPtr] = static_cast<char>(unichar);
+    input->charPtr++;
+
+    gLogI.log(instance, kDebug_ANPLogType, "----%p Text:  %c", instance, unichar);
+}
+
+void FormPlugin::scrollIntoView(TextInput* input) {
+    NPP instance = this->inst();
+    PluginObject *obj = (PluginObject*) instance->pdata;
+    NPWindow *window = obj->window;
+
+    // find the textInput's global rect coordinates
+    ANPRectI visibleRects[1];
+    visibleRects[0].left = input->rect.left;
+    visibleRects[0].top = input->rect.top;
+    visibleRects[0].right = input->rect.right;
+    visibleRects[0].bottom = input->rect.bottom;
+
+    gWindowI.setVisibleRects(instance, visibleRects, 1);
+}
+
+TextInput* FormPlugin::validTap(int x, int y) {
+
+    if (x > m_usernameInput.rect.left && x < m_usernameInput.rect.right &&
+        y > m_usernameInput.rect.top && y < m_usernameInput.rect.bottom)
+        return &m_usernameInput;
+    else if (x >m_passwordInput.rect.left && x < m_passwordInput.rect.right &&
+             y > m_passwordInput.rect.top && y < m_passwordInput.rect.bottom)
+        return &m_passwordInput;
+    else
+        return NULL;
+}
diff --git a/samples/BrowserPlugin/jni/form/FormPlugin.h b/samples/BrowserPlugin/jni/form/FormPlugin.h
new file mode 100644
index 0000000..041ffb8
--- /dev/null
+++ b/samples/BrowserPlugin/jni/form/FormPlugin.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "PluginObject.h"
+
+#ifndef formPlugin__DEFINED
+#define formPlugin__DEFINED
+
+struct TextInput {
+    ANPRectF    rect;
+    char        text[30];
+    uint32_t    charPtr;
+};
+
+class FormPlugin : public SubPlugin {
+public:
+    FormPlugin(NPP inst);
+    virtual ~FormPlugin();
+    virtual bool supportsDrawingModel(ANPDrawingModel);
+    virtual int16 handleEvent(const ANPEvent* evt);
+private:
+    void draw(ANPCanvas*);
+    void drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip);
+
+    bool        m_hasFocus;
+
+    TextInput*  m_activeInput;
+    TextInput   m_usernameInput;
+    TextInput   m_passwordInput;
+
+    ANPPaint*   m_paintInput;
+    ANPPaint*   m_paintActive;
+    ANPPaint*   m_paintText;
+
+    ANPRectI    m_visibleRect;
+
+    void drawText(ANPCanvas*, TextInput);
+    void drawPassword(ANPCanvas*, TextInput);
+
+    bool handleNavigation(ANPKeyCode keyCode);
+    void handleTextInput(TextInput* input, ANPKeyCode keyCode, int32_t unichar);
+    void scrollIntoView(TextInput* input);
+    void switchActiveInput(TextInput* input);
+
+    ANPPaint* getPaint(TextInput*);
+    TextInput* validTap(int x, int y);
+
+};
+
+#endif // formPlugin__DEFINED
diff --git a/samples/BrowserPlugin/jni/hello-jni.cpp b/samples/BrowserPlugin/jni/hello-jni.cpp
new file mode 100644
index 0000000..0789b7e
--- /dev/null
+++ b/samples/BrowserPlugin/jni/hello-jni.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <string.h>
+#include <jni.h>
+#include <JNIHelp.h>
+#include <utils/Log.h>
+
+#define EXPORT __attribute__((visibility("default")))
+
+static jstring stringFromJNI( JNIEnv* env, jobject thiz )
+{
+    return env->NewStringUTF("Hello from JNI !");
+}
+
+/*
+ * JNI registration.
+ */
+static JNINativeMethod gJavaSamplePluginStubMethods[] = {
+    { "nativeStringFromJNI", "()Ljava/lang/String;", (void*) stringFromJNI },
+};
+
+EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
+
+    JNIEnv* env = NULL;
+
+    if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
+        return -1;
+    }
+
+    jniRegisterNativeMethods(env, "com/android/sampleplugin/SamplePluginStub",
+                             gJavaSamplePluginStubMethods, NELEM(gJavaSamplePluginStubMethods));
+
+    return JNI_VERSION_1_4;
+}
diff --git a/samples/BrowserPlugin/jni/jni-bridge.cpp b/samples/BrowserPlugin/jni/jni-bridge.cpp
new file mode 100644
index 0000000..45ecd54
--- /dev/null
+++ b/samples/BrowserPlugin/jni/jni-bridge.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <string.h>
+#include <jni.h>
+#include <JNIHelp.h>
+#include <utils/Log.h>
+
+#include "PluginObject.h"
+
+#define EXPORT __attribute__((visibility("default")))
+
+static SurfaceSubPlugin* getPluginObject(int npp) {
+    NPP instance = (NPP)npp;
+    PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
+    if (obj && obj->activePlugin
+            && obj->activePlugin->supportsDrawingModel(kSurface_ANPDrawingModel)) {
+        return static_cast<SurfaceSubPlugin*>(obj->activePlugin);
+    }
+    return NULL;
+}
+
+static void surfaceCreated(JNIEnv* env, jobject thiz, jint npp, jobject surface) {
+    SurfaceSubPlugin* obj = getPluginObject(npp);
+
+    //TODO why is this VM different from the one in NP_INIT...
+    JavaVM* vm = NULL;
+    env->GetJavaVM(&vm);
+
+    obj->surfaceCreated(env, surface);
+}
+
+static void surfaceChanged(JNIEnv* env, jobject thiz, jint npp, jint format, jint width, jint height) {
+    SurfaceSubPlugin* obj = getPluginObject(npp);
+    obj->surfaceChanged(format, width, height);
+}
+
+static void surfaceDestroyed(JNIEnv* env, jobject thiz, jint npp) {
+    SurfaceSubPlugin* obj = getPluginObject(npp);
+    if (obj) {
+        obj->surfaceDestroyed();
+    }
+}
+
+static jboolean isFixedSurface(JNIEnv* env, jobject thiz, jint npp) {
+    SurfaceSubPlugin* obj = getPluginObject(npp);
+    return obj->isFixedSurface();
+}
+
+/*
+ * JNI registration.
+ */
+static JNINativeMethod gJavaSamplePluginStubMethods[] = {
+    { "nativeSurfaceCreated", "(ILandroid/view/View;)V", (void*) surfaceCreated },
+    { "nativeSurfaceChanged", "(IIII)V", (void*) surfaceChanged },
+    { "nativeSurfaceDestroyed", "(I)V", (void*) surfaceDestroyed },
+    { "nativeIsFixedSurface", "(I)Z", (void*) isFixedSurface },
+};
+
+EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
+
+    JNIEnv* env = NULL;
+
+    if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
+        return -1;
+    }
+
+    jniRegisterNativeMethods(env, "com/android/sampleplugin/SamplePluginStub",
+                             gJavaSamplePluginStubMethods, NELEM(gJavaSamplePluginStubMethods));
+
+    return JNI_VERSION_1_4;
+}
diff --git a/samples/BrowserPlugin/jni/main.cpp b/samples/BrowserPlugin/jni/main.cpp
new file mode 100644
index 0000000..d00091f
--- /dev/null
+++ b/samples/BrowserPlugin/jni/main.cpp
@@ -0,0 +1,412 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "main.h"
+#include "PluginObject.h"
+#include "AnimationPlugin.h"
+#include "AudioPlugin.h"
+#include "BackgroundPlugin.h"
+#include "FormPlugin.h"
+#include "PaintPlugin.h"
+
+NPNetscapeFuncs* browser;
+#define EXPORT __attribute__((visibility("default")))
+
+NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
+        char* argn[], char* argv[], NPSavedData* saved);
+NPError NPP_Destroy(NPP instance, NPSavedData** save);
+NPError NPP_SetWindow(NPP instance, NPWindow* window);
+NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream,
+        NPBool seekable, uint16* stype);
+NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
+int32   NPP_WriteReady(NPP instance, NPStream* stream);
+int32   NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len,
+        void* buffer);
+void    NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
+void    NPP_Print(NPP instance, NPPrint* platformPrint);
+int16   NPP_HandleEvent(NPP instance, void* event);
+void    NPP_URLNotify(NPP instance, const char* URL, NPReason reason,
+        void* notifyData);
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value);
+NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value);
+
+extern "C" {
+EXPORT NPError NP_Initialize(NPNetscapeFuncs* browserFuncs, NPPluginFuncs* pluginFuncs, void *java_env, void *application_context);
+EXPORT NPError NP_GetValue(NPP instance, NPPVariable variable, void *value);
+EXPORT const char* NP_GetMIMEDescription(void);
+EXPORT void NP_Shutdown(void);
+};
+
+ANPAudioTrackInterfaceV0    gSoundI;
+ANPBitmapInterfaceV0        gBitmapI;
+ANPCanvasInterfaceV0        gCanvasI;
+ANPLogInterfaceV0           gLogI;
+ANPPaintInterfaceV0         gPaintI;
+ANPPathInterfaceV0          gPathI;
+ANPSurfaceInterfaceV0       gSurfaceI;
+ANPSystemInterfaceV0        gSystemI;
+ANPTypefaceInterfaceV0      gTypefaceI;
+ANPWindowInterfaceV0        gWindowI;
+
+#define ARRAY_COUNT(array)      (sizeof(array) / sizeof(array[0]))
+#define DEBUG_PLUGIN_EVENTS     0
+
+NPError NP_Initialize(NPNetscapeFuncs* browserFuncs, NPPluginFuncs* pluginFuncs, void *java_env, void *application_context)
+{
+    // Make sure we have a function table equal or larger than we are built against.
+    if (browserFuncs->size < sizeof(NPNetscapeFuncs)) {
+        return NPERR_GENERIC_ERROR;
+    }
+
+    // Copy the function table (structure)
+    browser = (NPNetscapeFuncs*) malloc(sizeof(NPNetscapeFuncs));
+    memcpy(browser, browserFuncs, sizeof(NPNetscapeFuncs));
+
+    // Build the plugin function table
+    pluginFuncs->version = 11;
+    pluginFuncs->size = sizeof(pluginFuncs);
+    pluginFuncs->newp = NPP_New;
+    pluginFuncs->destroy = NPP_Destroy;
+    pluginFuncs->setwindow = NPP_SetWindow;
+    pluginFuncs->newstream = NPP_NewStream;
+    pluginFuncs->destroystream = NPP_DestroyStream;
+    pluginFuncs->asfile = NPP_StreamAsFile;
+    pluginFuncs->writeready = NPP_WriteReady;
+    pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write;
+    pluginFuncs->print = NPP_Print;
+    pluginFuncs->event = NPP_HandleEvent;
+    pluginFuncs->urlnotify = NPP_URLNotify;
+    pluginFuncs->getvalue = NPP_GetValue;
+    pluginFuncs->setvalue = NPP_SetValue;
+
+    static const struct {
+        NPNVariable     v;
+        uint32_t        size;
+        ANPInterface*   i;
+    } gPairs[] = {
+        { kAudioTrackInterfaceV0_ANPGetValue,   sizeof(gSoundI),    &gSoundI },
+        { kBitmapInterfaceV0_ANPGetValue,       sizeof(gBitmapI),   &gBitmapI },
+        { kCanvasInterfaceV0_ANPGetValue,       sizeof(gCanvasI),   &gCanvasI },
+        { kLogInterfaceV0_ANPGetValue,          sizeof(gLogI),      &gLogI },
+        { kPaintInterfaceV0_ANPGetValue,        sizeof(gPaintI),    &gPaintI },
+        { kPathInterfaceV0_ANPGetValue,         sizeof(gPathI),     &gPathI },
+        { kSurfaceInterfaceV0_ANPGetValue,      sizeof(gSurfaceI),  &gSurfaceI },
+        { kSystemInterfaceV0_ANPGetValue,       sizeof(gSystemI),   &gSystemI },
+        { kTypefaceInterfaceV0_ANPGetValue,     sizeof(gTypefaceI), &gTypefaceI },
+        { kWindowInterfaceV0_ANPGetValue,       sizeof(gWindowI),   &gWindowI },
+    };
+    for (size_t i = 0; i < ARRAY_COUNT(gPairs); i++) {
+        gPairs[i].i->inSize = gPairs[i].size;
+        NPError err = browser->getvalue(NULL, gPairs[i].v, gPairs[i].i);
+        if (err) {
+            return err;
+        }
+    }
+
+    return NPERR_NO_ERROR;
+}
+
+void NP_Shutdown(void)
+{
+
+}
+
+const char *NP_GetMIMEDescription(void)
+{
+    return "application/x-testbrowserplugin:tst:Test plugin mimetype is application/x-testbrowserplugin";
+}
+
+NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
+                char* argn[], char* argv[], NPSavedData* saved)
+{
+
+    /* BEGIN: STANDARD PLUGIN FRAMEWORK */
+    PluginObject *obj = NULL;
+
+    // Scripting functions appeared in NPAPI version 14
+    if (browser->version >= 14) {
+    instance->pdata = browser->createobject (instance, getPluginClass());
+    obj = static_cast<PluginObject*>(instance->pdata);
+    bzero(obj, sizeof(*obj));
+    }
+    /* END: STANDARD PLUGIN FRAMEWORK */
+
+    // select the drawing model based on user input
+    ANPDrawingModel model = kBitmap_ANPDrawingModel;
+
+    for (int i = 0; i < argc; i++) {
+        if (!strcmp(argn[i], "DrawingModel")) {
+            if (!strcmp(argv[i], "Bitmap")) {
+                model = kBitmap_ANPDrawingModel;
+            }
+            else if (!strcmp(argv[i], "Surface")) {
+               model = kSurface_ANPDrawingModel;
+            }
+            gLogI.log(instance, kDebug_ANPLogType, "------ %p DrawingModel is %d", instance, model);
+            break;
+        }
+    }
+
+    // notify the plugin API of the location of the java interface
+    char* className = "com.android.sampleplugin.SamplePluginStub";
+    NPError npErr = browser->setvalue(instance, kSetPluginStubJavaClassName_ANPSetValue,
+                                      reinterpret_cast<void*>(className));
+    if (npErr) {
+        gLogI.log(instance, kError_ANPLogType, "set class err %d", npErr);
+        return npErr;
+    }
+
+    // notify the plugin API of the drawing model we wish to use. This must be
+    // done prior to creating certain subPlugin objects (e.g. surfaceViews)
+    NPError err = browser->setvalue(instance, kRequestDrawingModel_ANPSetValue,
+                            reinterpret_cast<void*>(model));
+    if (err) {
+        gLogI.log(instance, kError_ANPLogType, "request model %d err %d", model, err);
+        return err;
+    }
+
+    const char* path = gSystemI.getApplicationDataDirectory();
+    if (path) {
+        gLogI.log(instance, kDebug_ANPLogType, "Application data dir is %s", path);
+    } else {
+        gLogI.log(instance, kError_ANPLogType, "Can't find Application data dir");
+    }
+
+    // select the pluginType
+    for (int i = 0; i < argc; i++) {
+        if (!strcmp(argn[i], "PluginType")) {
+            if (!strcmp(argv[i], "Animation")) {
+                obj->pluginType = kAnimation_PluginType;
+                obj->activePlugin = new BallAnimation(instance);
+            }
+            else if (!strcmp(argv[i], "Audio")) {
+                obj->pluginType = kAudio_PluginType;
+                obj->activePlugin = new AudioPlugin(instance);
+            }
+            else if (!strcmp(argv[i], "Background")) {
+                obj->pluginType = kBackground_PluginType;
+                obj->activePlugin = new BackgroundPlugin(instance);
+            }
+            else if (!strcmp(argv[i], "Form")) {
+                obj->pluginType = kForm_PluginType;
+                obj->activePlugin = new FormPlugin(instance);
+            }
+            else if (!strcmp(argv[i], "Paint")) {
+                obj->pluginType = kPaint_PluginType;
+                obj->activePlugin = new PaintPlugin(instance);
+            }
+            gLogI.log(instance, kDebug_ANPLogType, "------ %p PluginType is %d", instance, obj->pluginType);
+            break;
+        }
+    }
+
+    // if no pluginType is specified then default to Animation
+    if (!obj->pluginType) {
+        gLogI.log(instance, kError_ANPLogType, "------ %p No PluginType attribute was found", instance);
+        obj->pluginType = kAnimation_PluginType;
+        obj->activePlugin = new BallAnimation(instance);
+    }
+
+    // check to ensure the pluginType supports the model
+    if (!obj->activePlugin->supportsDrawingModel(model)) {
+        gLogI.log(instance, kError_ANPLogType, "------ %p Unsupported DrawingModel (%d)", instance, model);
+        return NPERR_GENERIC_ERROR;
+    }
+
+    return NPERR_NO_ERROR;
+}
+
+NPError NPP_Destroy(NPP instance, NPSavedData** save)
+{
+    PluginObject *obj = (PluginObject*) instance->pdata;
+    delete obj->activePlugin;
+
+    return NPERR_NO_ERROR;
+}
+
+NPError NPP_SetWindow(NPP instance, NPWindow* window)
+{
+    PluginObject *obj = (PluginObject*) instance->pdata;
+
+    // Do nothing if browser didn't support NPN_CreateObject which would have created the PluginObject.
+    if (obj != NULL) {
+        obj->window = window;
+    }
+
+    browser->invalidaterect(instance, NULL);
+
+    return NPERR_NO_ERROR;
+}
+
+NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype)
+{
+    *stype = NP_ASFILEONLY;
+    return NPERR_NO_ERROR;
+}
+
+NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
+{
+    return NPERR_NO_ERROR;
+}
+
+int32 NPP_WriteReady(NPP instance, NPStream* stream)
+{
+    return 0;
+}
+
+int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer)
+{
+    return 0;
+}
+
+void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
+{
+}
+
+void NPP_Print(NPP instance, NPPrint* platformPrint)
+{
+}
+
+int16 NPP_HandleEvent(NPP instance, void* event)
+{
+    PluginObject *obj = reinterpret_cast<PluginObject*>(instance->pdata);
+    const ANPEvent* evt = reinterpret_cast<const ANPEvent*>(event);
+
+#if DEBUG_PLUGIN_EVENTS
+    switch (evt->eventType) {
+        case kDraw_ANPEventType:
+
+            if (evt->data.draw.model == kBitmap_ANPDrawingModel) {
+
+                static ANPBitmapFormat currentFormat = -1;
+                if (evt->data.draw.data.bitmap.format != currentFormat) {
+                    currentFormat = evt->data.draw.data.bitmap.format;
+                    gLogI.log(instance, kDebug_ANPLogType, "---- %p Draw (bitmap)"
+                              " clip=%d,%d,%d,%d format=%d", instance,
+                              evt->data.draw.clip.left,
+                              evt->data.draw.clip.top,
+                              evt->data.draw.clip.right,
+                              evt->data.draw.clip.bottom,
+                              evt->data.draw.data.bitmap.format);
+                }
+            }
+            break;
+
+        case kKey_ANPEventType:
+            gLogI.log(instance, kDebug_ANPLogType, "---- %p Key action=%d"
+                      " code=%d vcode=%d unichar=%d repeat=%d mods=%x", instance,
+                      evt->data.key.action,
+                      evt->data.key.nativeCode,
+                      evt->data.key.virtualCode,
+                      evt->data.key.unichar,
+                      evt->data.key.repeatCount,
+                      evt->data.key.modifiers);
+            break;
+
+        case kLifecycle_ANPEventType:
+            gLogI.log(instance, kDebug_ANPLogType, "---- %p Lifecycle action=%d",
+                                instance, evt->data.lifecycle.action);
+            break;
+
+       case kTouch_ANPEventType:
+            gLogI.log(instance, kDebug_ANPLogType, "---- %p Touch action=%d [%d %d]",
+                      instance, evt->data.touch.action, evt->data.touch.x,
+                      evt->data.touch.y);
+            break;
+
+       case kMouse_ANPEventType:
+            gLogI.log(instance, kDebug_ANPLogType, "---- %p Mouse action=%d [%d %d]",
+                      instance, evt->data.mouse.action, evt->data.mouse.x,
+                      evt->data.mouse.y);
+            break;
+
+       case kVisibleRect_ANPEventType:
+            gLogI.log(instance, kDebug_ANPLogType, "---- %p VisibleRect [%d %d %d %d]",
+                      instance, evt->data.visibleRect.rect.left, evt->data.visibleRect.rect.top,
+                      evt->data.visibleRect.rect.right, evt->data.visibleRect.rect.bottom);
+            break;
+
+        default:
+            gLogI.log(instance, kError_ANPLogType, "---- %p Unknown Event [%d]",
+                      instance, evt->eventType);
+            break;
+    }
+#endif
+
+    if(!obj->activePlugin) {
+        gLogI.log(instance, kError_ANPLogType, "the active plugin is null.");
+        return 0; // unknown or unhandled event
+    }
+    else {
+        return obj->activePlugin->handleEvent(evt);
+    }
+}
+
+void NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData)
+{
+
+}
+
+EXPORT NPError NP_GetValue(NPP instance, NPPVariable variable, void *value) {
+
+    if (variable == NPPVpluginNameString) {
+        const char **str = (const char **)value;
+        *str = "Test Plugin";
+        return NPERR_NO_ERROR;
+    }
+
+    if (variable == NPPVpluginDescriptionString) {
+        const char **str = (const char **)value;
+        *str = "Description of Test Plugin";
+        return NPERR_NO_ERROR;
+    }
+
+    return NPERR_GENERIC_ERROR;
+}
+
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
+{
+    if (variable == NPPVpluginScriptableNPObject) {
+        void **v = (void **)value;
+        PluginObject *obj = (PluginObject*) instance->pdata;
+
+        if (obj)
+            browser->retainobject((NPObject*)obj);
+
+        *v = obj;
+        return NPERR_NO_ERROR;
+    }
+
+    return NPERR_GENERIC_ERROR;
+}
+
+NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value)
+{
+    return NPERR_GENERIC_ERROR;
+}
+
diff --git a/samples/BrowserPlugin/jni/main.h b/samples/BrowserPlugin/jni/main.h
new file mode 100644
index 0000000..8ad2cce
--- /dev/null
+++ b/samples/BrowserPlugin/jni/main.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2008, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <npapi.h>
+#include <npfunctions.h>
+#include <npruntime.h>
+#include "android_npapi.h"
+#include "ANPSurface_npapi.h"
+
+extern NPNetscapeFuncs* browser;
diff --git a/samples/BrowserPlugin/jni/paint/PaintPlugin.cpp b/samples/BrowserPlugin/jni/paint/PaintPlugin.cpp
new file mode 100644
index 0000000..5b00dba
--- /dev/null
+++ b/samples/BrowserPlugin/jni/paint/PaintPlugin.cpp
@@ -0,0 +1,388 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "PaintPlugin.h"
+
+#include <fcntl.h>
+#include <math.h>
+#include <string.h>
+
+extern NPNetscapeFuncs*         browser;
+extern ANPLogInterfaceV0        gLogI;
+extern ANPCanvasInterfaceV0     gCanvasI;
+extern ANPPaintInterfaceV0      gPaintI;
+extern ANPPathInterfaceV0       gPathI;
+extern ANPSurfaceInterfaceV0    gSurfaceI;
+extern ANPTypefaceInterfaceV0   gTypefaceI;
+
+///////////////////////////////////////////////////////////////////////////////
+
+PaintPlugin::PaintPlugin(NPP inst) : SurfaceSubPlugin(inst) {
+
+    m_isTouchActive = false;
+    m_isTouchCurrentInput = true;
+    m_activePaintColor = s_redColor;
+
+    memset(&m_drawingSurface, 0, sizeof(m_drawingSurface));
+    memset(&m_inputToggle,  0, sizeof(m_inputToggle));
+    memset(&m_colorToggle, 0, sizeof(m_colorToggle));
+    memset(&m_clearSurface,  0, sizeof(m_clearSurface));
+
+    // initialize the drawing surface
+    m_surface = NULL;
+    m_vm = NULL;
+
+    // initialize the path
+    m_touchPath = gPathI.newPath();
+    if(!m_touchPath)
+        gLogI.log(inst, kError_ANPLogType, "----%p Unable to create the touch path", inst);
+
+    // initialize the paint colors
+    m_paintSurface = gPaintI.newPaint();
+    gPaintI.setFlags(m_paintSurface, gPaintI.getFlags(m_paintSurface) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setColor(m_paintSurface, 0xFFC0C0C0);
+    gPaintI.setTextSize(m_paintSurface, 18);
+
+    m_paintButton = gPaintI.newPaint();
+    gPaintI.setFlags(m_paintButton, gPaintI.getFlags(m_paintButton) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setColor(m_paintButton, 0xFFA8A8A8);
+
+    // initialize the typeface (set the colors)
+    ANPTypeface* tf = gTypefaceI.createFromName("serif", kItalic_ANPTypefaceStyle);
+    gPaintI.setTypeface(m_paintSurface, tf);
+    gTypefaceI.unref(tf);
+
+    //register for touch events
+    ANPEventFlags flags = kTouch_ANPEventFlag;
+    NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
+    if (err != NPERR_NO_ERROR) {
+        gLogI.log(inst, kError_ANPLogType, "Error selecting input events.");
+    }
+}
+
+PaintPlugin::~PaintPlugin() {
+    gPathI.deletePath(m_touchPath);
+    gPaintI.deletePaint(m_paintSurface);
+    gPaintI.deletePaint(m_paintButton);
+    surfaceDestroyed();
+}
+
+bool PaintPlugin::supportsDrawingModel(ANPDrawingModel model) {
+    return (model == kSurface_ANPDrawingModel);
+}
+
+ANPCanvas* PaintPlugin::getCanvas(ANPRectI* dirtyRect) {
+
+    ANPBitmap bitmap;
+    JNIEnv* env = NULL;
+    if (!m_surface || m_vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK ||
+        !gSurfaceI.lock(env, m_surface, &bitmap, dirtyRect)) {
+            return NULL;
+        }
+
+    ANPCanvas* canvas = gCanvasI.newCanvas(&bitmap);
+
+    // clip the canvas to the dirty rect b/c the surface is only required to
+    // copy a minimum of the dirty rect and may copy more. The clipped canvas
+    // however will never write to pixels outside of the clipped area.
+    if (dirtyRect) {
+        ANPRectF clipR;
+        clipR.left = dirtyRect->left;
+        clipR.top = dirtyRect->top;
+        clipR.right = dirtyRect->right;
+        clipR.bottom = dirtyRect->bottom;
+        gCanvasI.clipRect(canvas, &clipR);
+    }
+
+    return canvas;
+}
+
+ANPCanvas* PaintPlugin::getCanvas(ANPRectF* dirtyRect) {
+
+    ANPRectI newRect;
+    newRect.left = (int) dirtyRect->left;
+    newRect.top = (int) dirtyRect->top;
+    newRect.right = (int) dirtyRect->right;
+    newRect.bottom = (int) dirtyRect->bottom;
+
+    return getCanvas(&newRect);
+}
+
+void PaintPlugin::releaseCanvas(ANPCanvas* canvas) {
+    JNIEnv* env = NULL;
+    if (m_surface && m_vm->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
+        gSurfaceI.unlock(env, m_surface);
+    }
+    gCanvasI.deleteCanvas(canvas);
+}
+
+void PaintPlugin::drawCleanPlugin(ANPCanvas* canvas) {
+    NPP instance = this->inst();
+    PluginObject *obj = (PluginObject*) instance->pdata;
+
+    // if no canvas get a locked canvas
+    if (!canvas)
+        canvas = getCanvas();
+
+    if (!canvas)
+        return;
+
+    const float buttonWidth = 60;
+    const float buttonHeight = 30;
+    const int W = obj->window->width;
+    const int H = obj->window->height;
+
+    // color the plugin canvas
+    gCanvasI.drawColor(canvas, 0xFFCDCDCD);
+
+    // get font metrics
+    ANPFontMetrics fontMetrics;
+    gPaintI.getFontMetrics(m_paintSurface, &fontMetrics);
+
+    // draw the input toggle button
+    m_inputToggle.left = 5;
+    m_inputToggle.top = H - buttonHeight - 5;
+    m_inputToggle.right = m_inputToggle.left + buttonWidth;
+    m_inputToggle.bottom = m_inputToggle.top + buttonHeight;
+    gCanvasI.drawRect(canvas, &m_inputToggle, m_paintButton);
+    const char* inputText = m_isTouchCurrentInput ? "Touch" : "Mouse";
+    gCanvasI.drawText(canvas, inputText, strlen(inputText), m_inputToggle.left + 5,
+                      m_inputToggle.top - fontMetrics.fTop, m_paintSurface);
+
+    // draw the color selector button
+    m_colorToggle.left = (W/2) - (buttonWidth/2);
+    m_colorToggle.top = H - buttonHeight - 5;
+    m_colorToggle.right = m_colorToggle.left + buttonWidth;
+    m_colorToggle.bottom = m_colorToggle.top + buttonHeight;
+    gCanvasI.drawRect(canvas, &m_colorToggle, m_paintButton);
+    const char* colorText = getColorText();
+    gCanvasI.drawText(canvas, colorText, strlen(colorText), m_colorToggle.left + 5,
+                      m_colorToggle.top - fontMetrics.fTop, m_paintSurface);
+
+    // draw the clear canvas button
+    m_clearSurface.left = W - buttonWidth - 5;
+    m_clearSurface.top = H - buttonHeight - 5;
+    m_clearSurface.right = m_clearSurface.left + buttonWidth;
+    m_clearSurface.bottom = m_clearSurface.top + buttonHeight;
+    gCanvasI.drawRect(canvas, &m_clearSurface, m_paintButton);
+    const char* clearText = "Clear";
+    gCanvasI.drawText(canvas, clearText, strlen(clearText), m_clearSurface.left + 5,
+                      m_clearSurface.top - fontMetrics.fTop, m_paintSurface);
+
+    // draw the drawing surface box (5 px from the edge)
+    m_drawingSurface.left = 5;
+    m_drawingSurface.top = 5;
+    m_drawingSurface.right = W - 5;
+    m_drawingSurface.bottom = m_colorToggle.top - 5;
+    gCanvasI.drawRect(canvas, &m_drawingSurface, m_paintSurface);
+
+    // release the canvas
+    releaseCanvas(canvas);
+}
+
+const char* PaintPlugin::getColorText() {
+
+    if (m_activePaintColor == s_blueColor)
+        return "Blue";
+    else if (m_activePaintColor == s_greenColor)
+        return "Green";
+    else
+        return "Red";
+}
+
+bool PaintPlugin::isFixedSurface() {
+    return true;
+}
+
+void PaintPlugin::surfaceCreated(JNIEnv* env, jobject surface) {
+    env->GetJavaVM(&m_vm);
+    m_surface = env->NewGlobalRef(surface);
+    drawCleanPlugin();
+}
+
+void PaintPlugin::surfaceChanged(int format, int width, int height) {
+    // get the plugin's dimensions according to the DOM
+    PluginObject *obj = (PluginObject*) inst()->pdata;
+    const int pW = obj->window->width;
+    const int pH = obj->window->height;
+    // compare to the plugin's surface dimensions
+    if (pW != width || pH != height)
+        gLogI.log(inst(), kError_ANPLogType,
+                  "----%p Invalid Surface Dimensions (%d,%d):(%d,%d)",
+                  inst(), pW, pH, width, height);
+}
+void PaintPlugin::surfaceDestroyed() {
+    JNIEnv* env = NULL;
+    if (m_surface && m_vm->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
+        env->DeleteGlobalRef(m_surface);
+        m_surface = NULL;
+    }
+}
+
+int16 PaintPlugin::handleEvent(const ANPEvent* evt) {
+    switch (evt->eventType) {
+        case kTouch_ANPEventType: {
+            float x = (float) evt->data.touch.x;
+            float y = (float) evt->data.touch.y;
+            if (kDown_ANPTouchAction == evt->data.touch.action && m_isTouchCurrentInput) {
+
+                ANPRectF* rect = validTouch(evt->data.touch.x, evt->data.touch.y);
+                if(rect == &m_drawingSurface) {
+                    m_isTouchActive = true;
+                    gPathI.moveTo(m_touchPath, x, y);
+                    paintTouch();
+                    return 1;
+                }
+
+            } else if (kMove_ANPTouchAction == evt->data.touch.action && m_isTouchActive) {
+                gPathI.lineTo(m_touchPath, x, y);
+                paintTouch();
+                return 1;
+            } else if (kUp_ANPTouchAction == evt->data.touch.action && m_isTouchActive) {
+                gPathI.lineTo(m_touchPath, x, y);
+                paintTouch();
+                m_isTouchActive = false;
+                gPathI.reset(m_touchPath);
+                return 1;
+            } else if (kCancel_ANPTouchAction == evt->data.touch.action) {
+                m_isTouchActive = false;
+                gPathI.reset(m_touchPath);
+                return 1;
+            }
+
+            break;
+        }
+        case kMouse_ANPEventType: {
+
+            if (m_isTouchActive)
+                gLogI.log(inst(), kError_ANPLogType, "----%p Received unintended mouse event", inst());
+
+            if (kDown_ANPMouseAction == evt->data.mouse.action) {
+                ANPRectF* rect = validTouch(evt->data.mouse.x, evt->data.mouse.y);
+                if (rect == &m_drawingSurface)
+                    paintMouse(evt->data.mouse.x, evt->data.mouse.y);
+                else if (rect == &m_inputToggle)
+                    toggleInputMethod();
+                else if (rect == &m_colorToggle)
+                    togglePaintColor();
+                else if (rect == &m_clearSurface)
+                    drawCleanPlugin();
+            }
+            return 1;
+        }
+        default:
+            break;
+    }
+    return 0;   // unknown or unhandled event
+}
+
+ANPRectF* PaintPlugin::validTouch(int x, int y) {
+
+    //convert to float
+    float fx = (int) x;
+    float fy = (int) y;
+
+    if (fx > m_drawingSurface.left && fx < m_drawingSurface.right && fy > m_drawingSurface.top && fy < m_drawingSurface.bottom)
+        return &m_drawingSurface;
+    else if (fx > m_inputToggle.left && fx < m_inputToggle.right && fy > m_inputToggle.top && fy < m_inputToggle.bottom)
+        return &m_inputToggle;
+    else if (fx > m_colorToggle.left && fx < m_colorToggle.right && fy > m_colorToggle.top && fy < m_colorToggle.bottom)
+        return &m_colorToggle;
+    else if (fx > m_clearSurface.left && fx < m_clearSurface.right && fy > m_clearSurface.top && fy < m_clearSurface.bottom)
+        return &m_clearSurface;
+    else
+        return NULL;
+}
+
+void PaintPlugin::toggleInputMethod() {
+    m_isTouchCurrentInput = !m_isTouchCurrentInput;
+
+    // lock only the input toggle and redraw the canvas
+    ANPCanvas* lockedCanvas = getCanvas(&m_inputToggle);
+    drawCleanPlugin(lockedCanvas);
+}
+
+void PaintPlugin::togglePaintColor() {
+    if (m_activePaintColor == s_blueColor)
+        m_activePaintColor = s_redColor;
+    else if (m_activePaintColor == s_greenColor)
+        m_activePaintColor = s_blueColor;
+    else
+        m_activePaintColor = s_greenColor;
+
+    // lock only the color toggle and redraw the canvas
+    ANPCanvas* lockedCanvas = getCanvas(&m_colorToggle);
+    drawCleanPlugin(lockedCanvas);
+}
+
+void PaintPlugin::paintMouse(int x, int y) {
+    //TODO do not paint outside the drawing surface
+
+    //create the paint color
+    ANPPaint* fillPaint = gPaintI.newPaint();
+    gPaintI.setFlags(fillPaint, gPaintI.getFlags(fillPaint) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setStyle(fillPaint, kFill_ANPPaintStyle);
+    gPaintI.setColor(fillPaint, m_activePaintColor);
+
+    // handle the simple "mouse" paint (draw a point)
+    ANPRectF point;
+    point.left =   (float) x-3;
+    point.top =    (float) y-3;
+    point.right =  (float) x+3;
+    point.bottom = (float) y+3;
+
+    // get a canvas that is only locked around the point and draw it
+    ANPCanvas* canvas = getCanvas(&point);
+    gCanvasI.drawOval(canvas, &point, fillPaint);
+
+    // clean up
+    releaseCanvas(canvas);
+    gPaintI.deletePaint(fillPaint);
+}
+
+void PaintPlugin::paintTouch() {
+    //TODO do not paint outside the drawing surface
+
+    //create the paint color
+    ANPPaint* strokePaint = gPaintI.newPaint();
+    gPaintI.setFlags(strokePaint, gPaintI.getFlags(strokePaint) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setColor(strokePaint, m_activePaintColor);
+    gPaintI.setStyle(strokePaint, kStroke_ANPPaintStyle);
+    gPaintI.setStrokeWidth(strokePaint, 6.0);
+    gPaintI.setStrokeCap(strokePaint, kRound_ANPPaintCap);
+    gPaintI.setStrokeJoin(strokePaint, kRound_ANPPaintJoin);
+
+    // handle the complex "touch" paint (draw a line)
+    ANPRectF bounds;
+    gPathI.getBounds(m_touchPath, &bounds);
+
+    // get a canvas that is only locked around the point and draw the path
+    ANPCanvas* canvas = getCanvas(&bounds);
+    gCanvasI.drawPath(canvas, m_touchPath, strokePaint);
+
+    // clean up
+    releaseCanvas(canvas);
+    gPaintI.deletePaint(strokePaint);
+}
diff --git a/samples/BrowserPlugin/jni/paint/PaintPlugin.h b/samples/BrowserPlugin/jni/paint/PaintPlugin.h
new file mode 100644
index 0000000..8ff561c
--- /dev/null
+++ b/samples/BrowserPlugin/jni/paint/PaintPlugin.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "PluginObject.h"
+#include <stdio.h>
+
+#ifndef paintPlugin__DEFINED
+#define paintPlugin__DEFINED
+
+class PaintPlugin : public SurfaceSubPlugin {
+public:
+    PaintPlugin(NPP inst);
+    virtual ~PaintPlugin();
+    virtual bool supportsDrawingModel(ANPDrawingModel);
+    virtual int16 handleEvent(const ANPEvent* evt);
+    virtual void surfaceCreated(JNIEnv* env, jobject surface);
+    virtual void surfaceChanged(int format, int width, int height);
+    virtual void surfaceDestroyed();
+    virtual bool isFixedSurface();
+
+private:
+    void        drawCleanPlugin(ANPCanvas* canvas = NULL);
+    ANPCanvas*  getCanvas(ANPRectI* dirtyRect = NULL);
+    ANPCanvas*  getCanvas(ANPRectF* dirtyRect);
+    const char* getColorText();
+    void        paintMouse(int x, int y);
+    void        paintTouch();
+    void        releaseCanvas(ANPCanvas*);
+    void        toggleInputMethod();
+    void        togglePaintColor();
+    ANPRectF*   validTouch(int x, int y);
+
+    bool        m_isTouchActive;
+    bool        m_isTouchCurrentInput;
+
+    JavaVM*     m_vm;
+    jobject     m_surface;
+    ANPPath*    m_touchPath;
+
+    ANPRectF    m_drawingSurface;
+    ANPRectF    m_inputToggle;
+    ANPRectF    m_colorToggle;
+    ANPRectF    m_clearSurface;
+
+    ANPPaint*   m_paintSurface;
+    ANPPaint*   m_paintButton;
+
+    ANPColor    m_activePaintColor;
+    static const ANPColor s_redColor   = 0xFFFF0000;
+    static const ANPColor s_greenColor = 0xFF00FF00;
+    static const ANPColor s_blueColor  = 0xFF0000FF;
+};
+
+#endif // paintPlugin__DEFINED
diff --git a/samples/BrowserPlugin/res/drawable-hdpi/sample_browser_plugin.png b/samples/BrowserPlugin/res/drawable-hdpi/sample_browser_plugin.png
new file mode 100755
index 0000000..4d9d559
--- /dev/null
+++ b/samples/BrowserPlugin/res/drawable-hdpi/sample_browser_plugin.png
Binary files differ
diff --git a/samples/BrowserPlugin/res/drawable-mdpi/sample_browser_plugin.png b/samples/BrowserPlugin/res/drawable-mdpi/sample_browser_plugin.png
new file mode 100755
index 0000000..47c79d1
--- /dev/null
+++ b/samples/BrowserPlugin/res/drawable-mdpi/sample_browser_plugin.png
Binary files differ
diff --git a/samples/BrowserPlugin/res/values/strings.xml b/samples/BrowserPlugin/res/values/strings.xml
new file mode 100644
index 0000000..1f8dd49
--- /dev/null
+++ b/samples/BrowserPlugin/res/values/strings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<resources>
+   <string name="sample_browser_plugin">Sample Browser Plugin</string>
+</resources>
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePlugin.java b/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePlugin.java
new file mode 100644
index 0000000..9b8ce95
--- /dev/null
+++ b/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePlugin.java
@@ -0,0 +1,15 @@
+package com.android.sampleplugin;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+
+public class SamplePlugin extends Service {
+
+    @Override
+    public IBinder onBind(Intent intent) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePluginStub.java b/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePluginStub.java
new file mode 100644
index 0000000..3c0a0c7
--- /dev/null
+++ b/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePluginStub.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sampleplugin;
+
+import android.content.Context;
+import android.graphics.PixelFormat;
+import android.opengl.GLSurfaceView;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+import android.view.View;
+import android.view.WindowManager;
+import android.view.SurfaceHolder.Callback;
+import android.view.ViewGroup.LayoutParams;
+import android.webkit.PluginStub;
+import android.widget.FrameLayout;
+import android.widget.MediaController;
+import android.widget.VideoView;
+import com.android.sampleplugin.graphics.CubeRenderer;
+
+public class SamplePluginStub implements PluginStub {
+
+    static {
+        //needed for jni calls
+        System.loadLibrary("sampleplugin");
+    }
+    
+    public View getEmbeddedView(final int npp, Context context) {
+        
+        final SurfaceView view = new SurfaceView(context);
+
+        /* You can do all sorts of interesting operations on the surface view
+         * here. We illustrate a few of the important operations below.
+         */
+        
+        //TODO get pixel format from the subplugin (via jni)
+        view.getHolder().setFormat(PixelFormat.RGBA_8888);
+        view.getHolder().addCallback(new Callback() {
+
+            public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+                nativeSurfaceChanged(npp, format, width, height);
+            }
+
+            public void surfaceCreated(SurfaceHolder holder) {
+                nativeSurfaceCreated(npp, view);
+            }
+
+            public void surfaceDestroyed(SurfaceHolder holder) {
+                nativeSurfaceDestroyed(npp);
+            }
+            
+        });
+        
+        if (nativeIsFixedSurface(npp)) {
+            //TODO get the fixed dimensions from the plugin 
+            //view.getHolder().setFixedSize(width, height);
+        }
+        
+        return view;
+    }
+    
+    public View getFullScreenView(int npp, Context context) {
+        
+        /* TODO make this aware of the plugin instance and get the video file
+         * from the plugin.
+         */
+        
+        FrameLayout layout = new FrameLayout(context);
+        LayoutParams fp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
+        layout.setLayoutParams(fp);
+
+        VideoView video = new VideoView(context);
+        LayoutParams vp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
+        layout.setLayoutParams(vp);
+
+        GLSurfaceView gl = new GLSurfaceView(context);
+        LayoutParams gp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
+        layout.setLayoutParams(gp);
+        
+        layout.addView(video);
+        layout.addView(gl);
+        
+        // We want an 8888 pixel format because that's required for a translucent 
+        // window. And we want a depth buffer.
+        gl.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
+        // Tell the cube renderer that we want to render a translucent version
+        // of the cube:
+        gl.setRenderer(new CubeRenderer(true));
+        // Use a surface format with an Alpha channel:
+        gl.getHolder().setFormat(PixelFormat.TRANSLUCENT);
+        gl.setWindowType(WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY);
+        
+        
+        video.setVideoPath("/sdcard/test_video.3gp");
+        video.setMediaController(new MediaController(context));
+        video.requestFocus();
+        
+        return layout;
+    }
+    
+    private native void nativeSurfaceCreated(int npp, View surfaceView);
+    private native void nativeSurfaceChanged(int npp, int format, int width, int height);
+    private native void nativeSurfaceDestroyed(int npp);
+    private native boolean nativeIsFixedSurface(int npp);
+}
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/graphics/Cube.java b/samples/BrowserPlugin/src/com/android/sampleplugin/graphics/Cube.java
new file mode 100644
index 0000000..9ad1410
--- /dev/null
+++ b/samples/BrowserPlugin/src/com/android/sampleplugin/graphics/Cube.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sampleplugin.graphics;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.IntBuffer;
+
+import javax.microedition.khronos.opengles.GL10;
+
+/**
+ * A vertex shaded cube.
+ */
+class Cube
+{
+    public Cube()
+    {
+        int one = 0x10000;
+        int vertices[] = {
+                -one, -one, -one,
+                one, -one, -one,
+                one,  one, -one,
+                -one,  one, -one,
+                -one, -one,  one,
+                one, -one,  one,
+                one,  one,  one,
+                -one,  one,  one,
+        };
+
+        int colors[] = {
+                0,    0,    0,  one,
+                one,    0,    0,  one,
+                one,  one,    0,  one,
+                0,  one,    0,  one,
+                0,    0,  one,  one,
+                one,    0,  one,  one,
+                one,  one,  one,  one,
+                0,  one,  one,  one,
+        };
+
+        byte indices[] = {
+                0, 4, 5,    0, 5, 1,
+                1, 5, 6,    1, 6, 2,
+                2, 6, 7,    2, 7, 3,
+                3, 7, 4,    3, 4, 0,
+                4, 7, 6,    4, 6, 5,
+                3, 0, 1,    3, 1, 2
+        };
+
+        // Buffers to be passed to gl*Pointer() functions
+        // must be direct, i.e., they must be placed on the
+        // native heap where the garbage collector cannot
+        // move them.
+        //
+        // Buffers with multi-byte datatypes (e.g., short, int, float)
+        // must have their byte order set to native order
+
+        ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length*4);
+        vbb.order(ByteOrder.nativeOrder());
+        mVertexBuffer = vbb.asIntBuffer();
+        mVertexBuffer.put(vertices);
+        mVertexBuffer.position(0);
+
+        ByteBuffer cbb = ByteBuffer.allocateDirect(colors.length*4);
+        cbb.order(ByteOrder.nativeOrder());
+        mColorBuffer = cbb.asIntBuffer();
+        mColorBuffer.put(colors);
+        mColorBuffer.position(0);
+
+        mIndexBuffer = ByteBuffer.allocateDirect(indices.length);
+        mIndexBuffer.put(indices);
+        mIndexBuffer.position(0);
+    }
+
+    public void draw(GL10 gl)
+    {
+        gl.glFrontFace(gl.GL_CW);
+        gl.glVertexPointer(3, gl.GL_FIXED, 0, mVertexBuffer);
+        gl.glColorPointer(4, gl.GL_FIXED, 0, mColorBuffer);
+        gl.glDrawElements(gl.GL_TRIANGLES, 36, gl.GL_UNSIGNED_BYTE, mIndexBuffer);
+    }
+
+    private IntBuffer   mVertexBuffer;
+    private IntBuffer   mColorBuffer;
+    private ByteBuffer  mIndexBuffer;
+}
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/graphics/CubeRenderer.java b/samples/BrowserPlugin/src/com/android/sampleplugin/graphics/CubeRenderer.java
new file mode 100644
index 0000000..246ac15
--- /dev/null
+++ b/samples/BrowserPlugin/src/com/android/sampleplugin/graphics/CubeRenderer.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sampleplugin.graphics;
+
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import android.opengl.GLSurfaceView;
+
+/**
+ * Render a pair of tumbling cubes.
+ */
+
+public class CubeRenderer implements GLSurfaceView.Renderer {
+    public CubeRenderer(boolean useTranslucentBackground) {
+        mTranslucentBackground = useTranslucentBackground;
+        mCube = new Cube();
+    }
+
+    public void onDrawFrame(GL10 gl) {
+        /*
+         * Usually, the first thing one might want to do is to clear
+         * the screen. The most efficient way of doing this is to use
+         * glClear().
+         */
+
+        gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
+
+        /*
+         * Now we're ready to draw some 3D objects
+         */
+
+        gl.glMatrixMode(GL10.GL_MODELVIEW);
+        gl.glLoadIdentity();
+        gl.glTranslatef(0, 0, -3.0f);
+        gl.glRotatef(mAngle,        0, 1, 0);
+        gl.glRotatef(mAngle*0.25f,  1, 0, 0);
+
+        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
+        gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
+
+        mCube.draw(gl);
+
+        gl.glRotatef(mAngle*2.0f, 0, 1, 1);
+        gl.glTranslatef(0.5f, 0.5f, 0.5f);
+
+        mCube.draw(gl);
+
+        mAngle += 1.2f;
+    }
+
+    public void onSurfaceChanged(GL10 gl, int width, int height) {
+         gl.glViewport(0, 0, width, height);
+
+         /*
+          * Set our projection matrix. This doesn't have to be done
+          * each time we draw, but usually a new projection needs to
+          * be set when the viewport is resized.
+          */
+
+         float ratio = (float) width / height;
+         gl.glMatrixMode(GL10.GL_PROJECTION);
+         gl.glLoadIdentity();
+         gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
+    }
+
+    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+        /*
+         * By default, OpenGL enables features that improve quality
+         * but reduce performance. One might want to tweak that
+         * especially on software renderer.
+         */
+        gl.glDisable(GL10.GL_DITHER);
+
+        /*
+         * Some one-time OpenGL initialization can be made here
+         * probably based on features of this particular context
+         */
+         gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT,
+                 GL10.GL_FASTEST);
+
+         if (mTranslucentBackground) {
+             gl.glClearColor(0,0,0,0);
+         } else {
+             gl.glClearColor(1,1,1,1);
+         }
+         gl.glEnable(GL10.GL_CULL_FACE);
+         gl.glShadeModel(GL10.GL_SMOOTH);
+         gl.glEnable(GL10.GL_DEPTH_TEST);
+    }
+    private boolean mTranslucentBackground;
+    private Cube mCube;
+    private float mAngle;
+}
diff --git a/samples/BusinessCard/Android.mk b/samples/BusinessCard/Android.mk
new file mode 100644
index 0000000..627cac1
--- /dev/null
+++ b/samples/BusinessCard/Android.mk
@@ -0,0 +1,13 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := samples
+
+# Only compile source java files in this apk.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := BusinessCard
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/samples/BusinessCard/AndroidManifest.xml b/samples/BusinessCard/AndroidManifest.xml
new file mode 100644
index 0000000..186e249
--- /dev/null
+++ b/samples/BusinessCard/AndroidManifest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.example.android.businesscard">
+    
+    <!-- IMPORTANT!  We want this app to run on Cupcake, Donut, Eclair and beyond -->
+    <uses-sdk android:minSdkVersion="3"/>
+    
+    <uses-permission android:name="android.permission.READ_CONTACTS" />
+    
+    <application android:label="@string/businesscard_app">
+        <activity android:name="BusinessCardActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest>
diff --git a/samples/BusinessCard/res/layout/business_card.xml b/samples/BusinessCard/res/layout/business_card.xml
new file mode 100644
index 0000000..c7ce713
--- /dev/null
+++ b/samples/BusinessCard/res/layout/business_card.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+    <Button
+        android:id="@+id/pick_contact_button"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:layout_margin="10dip"
+        android:text="@string/button_pick_contact"/>
+    <TextView
+        android:id="@+id/display_name_text_view"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerInParent="true"
+        android:textAppearance="?android:attr/textAppearanceLarge"/>
+    <TextView
+        android:id="@+id/phone_number_text_view"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/display_name_text_view"
+        android:layout_centerHorizontal="true"
+        android:textAppearance="?android:attr/textAppearanceMedium"/>
+</RelativeLayout>
+
diff --git a/samples/BusinessCard/res/values/strings.xml b/samples/BusinessCard/res/values/strings.xml
new file mode 100644
index 0000000..8668d57
--- /dev/null
+++ b/samples/BusinessCard/res/values/strings.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- This file contains resource definitions for displayed strings, allowing
+     them to be changed based on the locale and options. -->
+
+<resources>
+    <string name="businesscard_app">Business Card</string>
+    <string name="button_pick_contact">Pick Contact</string>
+</resources>
+
diff --git a/samples/BusinessCard/src/com/example/android/businesscard/BusinessCardActivity.java b/samples/BusinessCard/src/com/example/android/businesscard/BusinessCardActivity.java
new file mode 100644
index 0000000..d8d277e
--- /dev/null
+++ b/samples/BusinessCard/src/com/example/android/businesscard/BusinessCardActivity.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.businesscard;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.TextView;
+
+/**
+ * A simple activity that shows a "Pick Contact" button and two fields: contact's name
+ * and phone number.  The user taps on the Pick Contact button to bring up
+ * the contact chooser.  Once this activity receives the result from contact picker,
+ * it launches an asynchronous query (queries should always be asynchronous) to load
+ * contact's name and phone number. When the query completes, the activity displays
+ * the loaded data.
+ */
+public class BusinessCardActivity extends Activity  {
+
+    // Request code for the contact picker activity
+    private static final int PICK_CONTACT_REQUEST = 1;
+
+    /**
+     * An SDK-specific instance of {@link ContactAccessor}.  The activity does not need
+     * to know what SDK it is running in: all idiosyncrasies of different SDKs are
+     * encapsulated in the implementations of the ContactAccessor class.
+     */
+    private final ContactAccessor mContactAccessor = ContactAccessor.getInstance();
+
+    /**
+     * Called with the activity is first created.
+     */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.business_card);
+
+        // Install a click handler on the Pick Contact button
+        Button pickContact = (Button)findViewById(R.id.pick_contact_button);
+        pickContact.setOnClickListener(new OnClickListener() {
+
+            public void onClick(View v) {
+                pickContact();
+            }
+        });
+    }
+
+    /**
+     * Click handler for the Pick Contact button.  Invokes a contact picker activity.
+     * The specific intent used to bring up that activity differs between versions
+     * of the SDK, which is why we delegate the creation of the intent to ContactAccessor.
+     */
+    protected void pickContact() {
+        startActivityForResult(mContactAccessor.getPickContactIntent(), PICK_CONTACT_REQUEST);
+    }
+
+    /**
+     * Invoked when the contact picker activity is finished. The {@code contactUri} parameter
+     * will contain a reference to the contact selected by the user. We will treat it as
+     * an opaque URI and allow the SDK-specific ContactAccessor to handle the URI accordingly.
+     */
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        if (requestCode == PICK_CONTACT_REQUEST && resultCode == RESULT_OK) {
+            loadContactInfo(data.getData());
+        }
+    }
+
+    /**
+     * Load contact information on a background thread.
+     */
+    private void loadContactInfo(Uri contactUri) {
+
+        /*
+         * We should always run database queries on a background thread. The database may be
+         * locked by some process for a long time.  If we locked up the UI thread while waiting
+         * for the query to come back, we might get an "Application Not Responding" dialog.
+         */
+        AsyncTask<Uri, Void, ContactInfo> task = new AsyncTask<Uri, Void, ContactInfo>() {
+
+            @Override
+            protected ContactInfo doInBackground(Uri... uris) {
+                return mContactAccessor.loadContact(getContentResolver(), uris[0]);
+            }
+
+            @Override
+            protected void onPostExecute(ContactInfo result) {
+                bindView(result);
+            }
+        };
+
+        task.execute(contactUri);
+    }
+
+    /**
+     * Displays contact information: name and phone number.
+     */
+    protected void bindView(ContactInfo contactInfo) {
+        TextView displayNameView = (TextView) findViewById(R.id.display_name_text_view);
+        displayNameView.setText(contactInfo.getDisplayName());
+
+        TextView phoneNumberView = (TextView) findViewById(R.id.phone_number_text_view);
+        phoneNumberView.setText(contactInfo.getPhoneNumber());
+    }
+}
diff --git a/samples/BusinessCard/src/com/example/android/businesscard/ContactAccessor.java b/samples/BusinessCard/src/com/example/android/businesscard/ContactAccessor.java
new file mode 100644
index 0000000..6a402e9
--- /dev/null
+++ b/samples/BusinessCard/src/com/example/android/businesscard/ContactAccessor.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.businesscard;
+
+import android.content.ContentResolver;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Build;
+
+/**
+ * This abstract class defines SDK-independent API for communication with
+ * Contacts Provider. The actual implementation used by the application depends
+ * on the level of API available on the device. If the API level is Cupcake or
+ * Donut, we want to use the {@link ContactAccessorSdk3_4} class. If it is
+ * Eclair or higher, we want to use {@link ContactAccessorSdk5}.
+ */
+public abstract class ContactAccessor {
+
+    /**
+     * Static singleton instance of {@link ContactAccessor} holding the
+     * SDK-specific implementation of the class.
+     */
+    private static ContactAccessor sInstance;
+
+    public static ContactAccessor getInstance() {
+        if (sInstance == null) {
+            String className;
+
+            /*
+             * Check the version of the SDK we are running on. Choose an
+             * implementation class designed for that version of the SDK.
+             *
+             * Unfortunately we have to use strings to represent the class
+             * names. If we used the conventional ContactAccessorSdk5.class.getName()
+             * syntax, we would get a ClassNotFoundException at runtime on pre-Eclair SDKs.
+             * Using the above syntax would force Dalvik to load the class and try to
+             * resolve references to all other classes it uses. Since the pre-Eclair
+             * does not have those classes, the loading of ContactAccessorSdk5 would fail.
+             */
+            @SuppressWarnings("deprecation")
+            int sdkVersion = Integer.parseInt(Build.VERSION.SDK);       // Cupcake style
+            if (sdkVersion < Build.VERSION_CODES.ECLAIR) {
+                className = "com.example.android.businesscard.ContactAccessorSdk3_4";
+            } else {
+                className = "com.example.android.businesscard.ContactAccessorSdk5";
+            }
+
+            /*
+             * Find the required class by name and instantiate it.
+             */
+            try {
+                Class<? extends ContactAccessor> clazz =
+                        Class.forName(className).asSubclass(ContactAccessor.class);
+                sInstance = clazz.newInstance();
+            } catch (Exception e) {
+                throw new IllegalStateException(e);
+            }
+        }
+
+        return sInstance;
+    }
+
+    /**
+     * Returns the {@link Intent#ACTION_PICK} intent configured for the right authority: legacy
+     * or current.
+     */
+    public abstract Intent getPickContactIntent();
+
+    /**
+     * Loads contact data for the supplied URI. The actual queries will differ for different APIs
+     * used, but the result is the same: the {@link #mDisplayName} and {@link #mPhoneNumber}
+     * fields are populated with correct data.
+     */
+    public abstract ContactInfo loadContact(ContentResolver contentResolver, Uri contactUri);
+}
diff --git a/samples/BusinessCard/src/com/example/android/businesscard/ContactAccessorSdk3_4.java b/samples/BusinessCard/src/com/example/android/businesscard/ContactAccessorSdk3_4.java
new file mode 100644
index 0000000..7fcd388
--- /dev/null
+++ b/samples/BusinessCard/src/com/example/android/businesscard/ContactAccessorSdk3_4.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.businesscard;
+
+import android.content.AsyncQueryHandler;
+import android.content.ContentResolver;
+import android.content.Intent;
+import android.database.Cursor;
+import android.net.Uri;
+import android.provider.Contacts.People;
+import android.provider.Contacts.People.Phones;
+
+/**
+ * An implementation of {@link ContactAccessor} that uses legacy Contacts API.
+ * These APIs are deprecated and should not be used unless we are running on a
+ * pre-Eclair SDK.
+ * <p>
+ * There are several reasons why we wouldn't want to use this class on an Eclair device:
+ * <ul>
+ * <li>It would see at most one account, namely the first Google account created on the device.
+ * <li>It would work through a compatibility layer, which would make it inherently less efficient.
+ * <li>Not relevant to this particular example, but it would not have access to new kinds
+ * of data available through current APIs.
+ * </ul>
+ */
+@SuppressWarnings("deprecation")
+public class ContactAccessorSdk3_4 extends ContactAccessor {
+
+    /**
+     * Returns a Pick Contact intent using the pre-Eclair "people" URI.
+     */
+    @Override
+    public Intent getPickContactIntent() {
+        return new Intent(Intent.ACTION_PICK, People.CONTENT_URI);
+    }
+
+    /**
+     * Retrieves the contact information.
+     */
+    @Override
+    public ContactInfo loadContact(ContentResolver contentResolver, Uri contactUri) {
+        ContactInfo contactInfo = new ContactInfo();
+        Cursor cursor = contentResolver.query(contactUri,
+                new String[]{People.DISPLAY_NAME}, null, null, null);
+        try {
+            if (cursor.moveToFirst()) {
+                contactInfo.setDisplayName(cursor.getString(0));
+            }
+        } finally {
+            cursor.close();
+        }
+
+        Uri phoneUri = Uri.withAppendedPath(contactUri, Phones.CONTENT_DIRECTORY);
+        cursor = contentResolver.query(phoneUri,
+                new String[]{Phones.NUMBER}, null, null, Phones.ISPRIMARY + " DESC");
+
+        try {
+            if (cursor.moveToFirst()) {
+                contactInfo.setPhoneNumber(cursor.getString(0));
+            }
+        } finally {
+            cursor.close();
+        }
+
+        return contactInfo;
+    }
+}
diff --git a/samples/BusinessCard/src/com/example/android/businesscard/ContactAccessorSdk5.java b/samples/BusinessCard/src/com/example/android/businesscard/ContactAccessorSdk5.java
new file mode 100644
index 0000000..6855597
--- /dev/null
+++ b/samples/BusinessCard/src/com/example/android/businesscard/ContactAccessorSdk5.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.businesscard;
+
+import android.content.ContentResolver;
+import android.content.Intent;
+import android.database.Cursor;
+import android.net.Uri;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+
+/**
+ * An implementation of {@link ContactAccessor} that uses current Contacts API.
+ * This class should be used on Eclair or beyond, but would not work on any earlier
+ * release of Android.  As a matter of fact, it could not even be loaded.
+ * <p>
+ * This implementation has several advantages:
+ * <ul>
+ * <li>It sees contacts from multiple accounts.
+ * <li>It works with aggregated contacts. So for example, if the contact is the result
+ * of aggregation of two raw contacts from different accounts, it may return the name from
+ * one and the phone number from the other.
+ * <li>It is efficient because it uses the more efficient current API.
+ * <li>Not obvious in this particular example, but it has access to new kinds
+ * of data available exclusively through the new APIs. Exercise for the reader: add support
+ * for nickname (see {@link android.provider.ContactsContract.CommonDataKinds.Nickname}) or
+ * social status updates (see {@link android.provider.ContactsContract.StatusUpdates}).
+ * </ul>
+ */
+public class ContactAccessorSdk5 extends ContactAccessor {
+
+    /**
+     * Returns a Pick Contact intent using the Eclair "contacts" URI.
+     */
+    @Override
+    public Intent getPickContactIntent() {
+        return new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
+    }
+
+    /**
+     * Retrieves the contact information.
+     */
+    @Override
+    public ContactInfo loadContact(ContentResolver contentResolver, Uri contactUri) {
+        ContactInfo contactInfo = new ContactInfo();
+        long contactId = -1;
+
+        // Load the display name for the specified person
+        Cursor cursor = contentResolver.query(contactUri,
+                new String[]{Contacts._ID, Contacts.DISPLAY_NAME}, null, null, null);
+        try {
+            if (cursor.moveToFirst()) {
+                contactId = cursor.getLong(0);
+                contactInfo.setDisplayName(cursor.getString(1));
+            }
+        } finally {
+            cursor.close();
+        }
+
+        // Load the phone number (if any).
+        cursor = contentResolver.query(Phone.CONTENT_URI,
+                new String[]{Phone.NUMBER},
+                Phone.CONTACT_ID + "=" + contactId, null, Phone.IS_SUPER_PRIMARY + " DESC");
+        try {
+            if (cursor.moveToFirst()) {
+                contactInfo.setPhoneNumber(cursor.getString(0));
+            }
+        } finally {
+            cursor.close();
+        }
+
+        return contactInfo;
+    }
+}
diff --git a/samples/BusinessCard/src/com/example/android/businesscard/ContactInfo.java b/samples/BusinessCard/src/com/example/android/businesscard/ContactInfo.java
new file mode 100644
index 0000000..61a6f3b
--- /dev/null
+++ b/samples/BusinessCard/src/com/example/android/businesscard/ContactInfo.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.businesscard;
+
+/**
+ * A model object containing contact data.
+ */
+public class ContactInfo {
+
+    private String mDisplayName;
+    private String mPhoneNumber;
+
+    public void setDisplayName(String displayName) {
+        this.mDisplayName = displayName;
+    }
+
+    public String getDisplayName() {
+        return mDisplayName;
+    }
+
+    public void setPhoneNumber(String phoneNumber) {
+        this.mPhoneNumber = phoneNumber;
+    }
+
+    public String getPhoneNumber() {
+        return mPhoneNumber;
+    }
+}
diff --git a/samples/CubeLiveWallpaper/Android.mk b/samples/CubeLiveWallpaper/Android.mk
new file mode 100644
index 0000000..7227394
--- /dev/null
+++ b/samples/CubeLiveWallpaper/Android.mk
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+# LOCAL_MODULE_TAGS := user
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_PACKAGE_NAME := CubeLiveWallpapers
+LOCAL_CERTIFICATE := shared
+
+include $(BUILD_PACKAGE)
diff --git a/samples/CubeLiveWallpaper/AndroidManifest.xml b/samples/CubeLiveWallpaper/AndroidManifest.xml
new file mode 100644
index 0000000..8d24c4a
--- /dev/null
+++ b/samples/CubeLiveWallpaper/AndroidManifest.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<manifest
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.livecubes">
+
+    <application
+        android:label="@string/wallpapers"
+        android:icon="@drawable/ic_launcher_wallpaper">
+
+        <service
+            android:label="@string/wallpaper_cube1"
+            android:name=".cube1.CubeWallpaper1"
+            android:permission="android.permission.BIND_WALLPAPER">
+            <intent-filter>
+                <action android:name="android.service.wallpaper.WallpaperService" />
+            </intent-filter>
+            <meta-data android:name="android.service.wallpaper" android:resource="@xml/cube1" />
+        </service>
+
+        <service
+            android:label="@string/wallpaper_cube2"
+            android:name=".cube2.CubeWallpaper2"
+            android:permission="android.permission.BIND_WALLPAPER">
+            <intent-filter>
+                <action android:name="android.service.wallpaper.WallpaperService" />
+            </intent-filter>
+            <meta-data android:name="android.service.wallpaper" android:resource="@xml/cube2" />
+        </service>
+        <activity
+            android:label="@string/cube2_settings"
+            android:name="com.android.livecubes.cube2.CubeWallpaper2Settings"
+            android:theme="@android:style/Theme.Light.WallpaperSettings"
+            android:exported="true">
+        </activity>
+
+        <service
+            android:label="@string/wallpaper_cube3"
+            android:name=".cube3.CubeWallpaper3"
+            android:permission="android.permission.BIND_WALLPAPER">
+            <intent-filter>
+                <action android:name="android.service.wallpaper.WallpaperService" />
+            </intent-filter>
+            <meta-data android:name="android.service.wallpaper" android:resource="@xml/cube3" />
+        </service>
+
+    </application>
+
+</manifest>
diff --git a/ndk/build/platforms/android-3/common/include/cstddef b/samples/CubeLiveWallpaper/MODULE_LICENSE_APACHE2
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/cstddef
copy to samples/CubeLiveWallpaper/MODULE_LICENSE_APACHE2
diff --git a/samples/CubeLiveWallpaper/NOTICE b/samples/CubeLiveWallpaper/NOTICE
new file mode 100644
index 0000000..c5b1efa
--- /dev/null
+++ b/samples/CubeLiveWallpaper/NOTICE
@@ -0,0 +1,190 @@
+
+   Copyright (c) 2005-2008, The Android Open Source Project
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
diff --git a/samples/CubeLiveWallpaper/res/drawable/ic_launcher_wallpaper.png b/samples/CubeLiveWallpaper/res/drawable/ic_launcher_wallpaper.png
new file mode 100644
index 0000000..965fb71
--- /dev/null
+++ b/samples/CubeLiveWallpaper/res/drawable/ic_launcher_wallpaper.png
Binary files differ
diff --git a/samples/CubeLiveWallpaper/res/raw/cube.rs b/samples/CubeLiveWallpaper/res/raw/cube.rs
new file mode 100644
index 0000000..407d63b
--- /dev/null
+++ b/samples/CubeLiveWallpaper/res/raw/cube.rs
@@ -0,0 +1,50 @@
+// Copyright (C) 2009 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#pragma version(1)
+#pragma stateVertex(PVBackground)
+
+#define RSID_POINTS 0
+
+void dumpState() {
+
+//    debugF("@@@@@ yrot: ", State->yRotation);
+
+}
+
+int main(int launchID) {
+
+    int i;
+
+    // Change the model matrix to account for the large model
+    // and to do the necessary rotations.
+    float mat1[16];
+    float rads = ((float)startTimeMillis()) / 1000;
+    float xrot = degf(-rads);
+    float yrot = State->yRotation;
+    float scale = 1.0/900.0;
+    matrixLoadScale(mat1, scale, scale, scale);
+    matrixRotate(mat1, yrot, 0.f, 1.f, 0.f);
+    matrixRotate(mat1, xrot, 1.f, 0.f, 0.f);
+    vpLoadModelMatrix(mat1);
+
+    // Draw the cube. The default color will be used,
+    // but we can also set the color here with the color()
+    // function, or specify the color(s) as part of
+    // the vertex data.
+    uploadToBufferObject(NAMED_PointBuffer);
+    drawSimpleMesh(NAMED_CubeMesh);
+
+    return 1;
+}
diff --git a/samples/CubeLiveWallpaper/res/values/shapes.xml b/samples/CubeLiveWallpaper/res/values/shapes.xml
new file mode 100644
index 0000000..49bdaf9
--- /dev/null
+++ b/samples/CubeLiveWallpaper/res/values/shapes.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright (C) 4008 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+    <string-array name="cube2_shapenames">
+        <item>"Cube"</item>
+        <item>"Dodecahedron"</item>
+    </string-array>
+
+    <string-array name="cube2_shapeprefix">
+        <item>"cube"</item>
+        <item>"dodecahedron"</item>
+    </string-array>
+
+    <!-- x,y,z tuples for the points defining the object -->
+    <!-- stored as strings for easier human readability -->
+    <string-array name="cubepoints">
+        <item>"-400 -400 -400"</item>
+        <item>"400 -400 -400"</item>
+        <item>"400 400 -400"</item>
+        <item>"-400 400 -400"</item>
+        <item>"-400 -400 400"</item>
+        <item>"400 -400 400"</item>
+        <item>"400 400 400"</item>
+        <item>"-400 400 400"</item>
+    </string-array>
+
+    <!-- start,end point index tuples of the lines defining the object -->
+    <string-array name="cubelines">
+        <!-- lines forming one face -->
+        <item>"0 1"</item>
+        <item>"1 2"</item>
+        <item>"2 3"</item>
+        <item>"3 0"</item>
+
+        <!-- lines forming the opposite face -->
+        <item>"4 5"</item>
+        <item>"5 6"</item>
+        <item>"6 7"</item>
+        <item>"7 4"</item>
+
+        <!-- lines connecting the two faces -->
+        <item>"0 4"</item>
+        <item>"1 5"</item>
+        <item>"2 6"</item>
+        <item>"3 7"</item>
+    </string-array>
+
+    <string-array name="dodecahedronpoints">
+        <item>"333.850000 0.000000 437.250000"</item>
+        <item>"103.400000 317.350000 437.250000"</item>
+        <item>"-270.050000 196.350000 437.250000"</item>
+        <item>"-270.050000 -196.350000 437.250000"</item>
+        <item>"103.400000 -317.350000 437.250000"</item>
+        <item>"540.100000 0.000000 103.400000"</item>
+        <item>"167.200000 513.700000 103.400000"</item>
+        <item>"-437.250000 317.350000 103.400000"</item>
+        <item>"-437.250000 -317.350000 103.400000"</item>
+        <item>"167.200000 -513.700000 103.400000"</item>
+        <item>"437.250000 317.350000 -103.400000"</item>
+        <item>"-167.200000 513.700000 -103.400000"</item>
+        <item>"-540.100000 0.000000 -103.400000"</item>
+        <item>"-167.200000 -513.700000 -103.400000"</item>
+        <item>"437.250000 -317.350000 -103.400000"</item>
+        <item>"270.050000 196.350000 -437.250000"</item>
+        <item>"-103.400000 317.350000 -437.250000"</item>
+        <item>"-333.850000 0.000000 -437.250000"</item>
+        <item>"-103.400000 -317.350000 -437.250000"</item>
+        <item>"270.050000 -196.350000 -437.250000"</item>
+    </string-array>
+
+    <string-array name="dodecahedronlines">
+        <item>"0 1"</item>
+        <item>"0 4"</item>
+        <item>"0 5"</item>
+        <item>"1 2"</item>
+        <item>"1 6"</item>
+        <item>"2 3"</item>
+        <item>"2 7"</item>
+        <item>"3 4"</item>
+        <item>"3 8"</item>
+        <item>"4 9"</item>
+        <item>"5 10"</item>
+        <item>"5 14"</item>
+        <item>"6 10"</item>
+        <item>"6 11"</item>
+        <item>"7 11"</item>
+        <item>"7 12"</item>
+        <item>"8 12"</item>
+        <item>"8 13"</item>
+        <item>"9 13"</item>
+        <item>"9 14"</item>
+        <item>"10 15"</item>
+        <item>"11 16"</item>
+        <item>"12 17"</item>
+        <item>"13 18"</item>
+        <item>"14 19"</item>
+        <item>"15 16"</item>
+        <item>"15 19"</item>
+        <item>"16 17"</item>
+        <item>"17 18"</item>
+        <item>"18 19"</item>
+    </string-array>
+</resources>
diff --git a/samples/CubeLiveWallpaper/res/values/strings.xml b/samples/CubeLiveWallpaper/res/values/strings.xml
new file mode 100644
index 0000000..3302058
--- /dev/null
+++ b/samples/CubeLiveWallpaper/res/values/strings.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright (C) 2009 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- General -->
+    <skip />
+    <!-- Application name -->
+    <string name="wallpapers">Example Wallpapers</string>
+
+    <!-- Wallpaper showing a cube -->
+    <string name="wallpaper_cube1">Cube</string>
+
+    <!-- Wallpaper showing a cube or dodecahedron, data read from resource -->
+    <string name="wallpaper_cube2">Cube - resource</string>
+
+    <!-- Wallpaper showing a cube, renderscript version -->
+    <string name="wallpaper_cube3">Cube - RenderScript</string>
+
+    <string name="cube2_settings">Settings</string>
+    <string name="cube2_settings_title">Select shape</string>
+    <string name="cube2_settings_summary">Choose whether to display a cube or a dodecahedron</string>
+</resources>
diff --git a/samples/CubeLiveWallpaper/res/xml/cube1.xml b/samples/CubeLiveWallpaper/res/xml/cube1.xml
new file mode 100644
index 0000000..5c7fca5
--- /dev/null
+++ b/samples/CubeLiveWallpaper/res/xml/cube1.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright (c) 2009, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ *
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+-->
+
+<!-- The attributes in this XML file provide configuration information -->
+
+<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
+/>
diff --git a/samples/CubeLiveWallpaper/res/xml/cube2.xml b/samples/CubeLiveWallpaper/res/xml/cube2.xml
new file mode 100644
index 0000000..bf9054c
--- /dev/null
+++ b/samples/CubeLiveWallpaper/res/xml/cube2.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright (c) 2009, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ *
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+-->
+
+<!-- The attributes in this XML file provide configuration information -->
+
+<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
+        android:settingsActivity="com.android.livecubes.cube2.CubeWallpaper2Settings"
+/>
diff --git a/samples/CubeLiveWallpaper/res/xml/cube2_settings.xml b/samples/CubeLiveWallpaper/res/xml/cube2_settings.xml
new file mode 100644
index 0000000..50a28ae
--- /dev/null
+++ b/samples/CubeLiveWallpaper/res/xml/cube2_settings.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+        android:title="@string/cube2_settings"
+        android:key="cube2wallpaper_settings">
+
+    <ListPreference
+            android:key="cube2_shape"
+            android:title="@string/cube2_settings_title"
+            android:summary="@string/cube2_settings_summary"
+            android:entries="@array/cube2_shapenames"
+            android:entryValues="@array/cube2_shapeprefix" />
+
+</PreferenceScreen>
diff --git a/samples/CubeLiveWallpaper/res/xml/cube3.xml b/samples/CubeLiveWallpaper/res/xml/cube3.xml
new file mode 100644
index 0000000..5c7fca5
--- /dev/null
+++ b/samples/CubeLiveWallpaper/res/xml/cube3.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright (c) 2009, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ *
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+-->
+
+<!-- The attributes in this XML file provide configuration information -->
+
+<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
+/>
diff --git a/samples/CubeLiveWallpaper/src/com/android/livecubes/cube1/CubeWallpaper1.java b/samples/CubeLiveWallpaper/src/com/android/livecubes/cube1/CubeWallpaper1.java
new file mode 100644
index 0000000..52a708a
--- /dev/null
+++ b/samples/CubeLiveWallpaper/src/com/android/livecubes/cube1/CubeWallpaper1.java
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.livecubes.cube1;
+
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.os.Handler;
+import android.os.SystemClock;
+import android.service.wallpaper.WallpaperService;
+import android.util.Log;
+import android.view.MotionEvent;
+import android.view.SurfaceHolder;
+
+/*
+ * This animated wallpaper draws a rotating wireframe cube.
+ */
+public class CubeWallpaper1 extends WallpaperService {
+
+    private final Handler mHandler = new Handler();
+
+    @Override
+    public void onCreate() {
+        super.onCreate();
+    }
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+    }
+
+    @Override
+    public Engine onCreateEngine() {
+        return new CubeEngine();
+    }
+
+    class CubeEngine extends Engine {
+
+        private final Paint mPaint = new Paint();
+        private float mOffset;
+        private float mTouchX = -1;
+        private float mTouchY = -1;
+        private long mStartTime;
+        private float mCenterX;
+        private float mCenterY;
+
+        private final Runnable mDrawCube = new Runnable() {
+            public void run() {
+                drawFrame();
+            }
+        };
+        private boolean mVisible;
+
+        CubeEngine() {
+            // Create a Paint to draw the lines for our cube
+            final Paint paint = mPaint;
+            paint.setColor(0xffffffff);
+            paint.setAntiAlias(true);
+            paint.setStrokeWidth(2);
+            paint.setStrokeCap(Paint.Cap.ROUND);
+            paint.setStyle(Paint.Style.STROKE);
+
+            mStartTime = SystemClock.elapsedRealtime();
+        }
+
+        @Override
+        public void onCreate(SurfaceHolder surfaceHolder) {
+            super.onCreate(surfaceHolder);
+
+            // By default we don't get touch events, so enable them.
+            setTouchEventsEnabled(true);
+        }
+
+        @Override
+        public void onDestroy() {
+            super.onDestroy();
+            mHandler.removeCallbacks(mDrawCube);
+        }
+
+        @Override
+        public void onVisibilityChanged(boolean visible) {
+            mVisible = visible;
+            if (visible) {
+                drawFrame();
+            } else {
+                mHandler.removeCallbacks(mDrawCube);
+            }
+        }
+
+        @Override
+        public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+            super.onSurfaceChanged(holder, format, width, height);
+            // store the center of the surface, so we can draw the cube in the right spot
+            mCenterX = width/2.0f;
+            mCenterY = height/2.0f;
+            drawFrame();
+        }
+
+        @Override
+        public void onSurfaceCreated(SurfaceHolder holder) {
+            super.onSurfaceCreated(holder);
+        }
+
+        @Override
+        public void onSurfaceDestroyed(SurfaceHolder holder) {
+            super.onSurfaceDestroyed(holder);
+            mVisible = false;
+            mHandler.removeCallbacks(mDrawCube);
+        }
+
+        @Override
+        public void onOffsetsChanged(float xOffset, float yOffset,
+                float xStep, float yStep, int xPixels, int yPixels) {
+            mOffset = xOffset;
+            drawFrame();
+        }
+
+        /*
+         * Store the position of the touch event so we can use it for drawing later
+         */
+        @Override
+        public void onTouchEvent(MotionEvent event) {
+            if (event.getAction() == MotionEvent.ACTION_MOVE) {
+                mTouchX = event.getX();
+                mTouchY = event.getY();
+            } else {
+                mTouchX = -1;
+                mTouchY = -1;
+            }
+            super.onTouchEvent(event);
+        }
+
+        /*
+         * Draw one frame of the animation. This method gets called repeatedly
+         * by posting a delayed Runnable. You can do any drawing you want in
+         * here. This example draws a wireframe cube.
+         */
+        void drawFrame() {
+            final SurfaceHolder holder = getSurfaceHolder();
+
+            Canvas c = null;
+            try {
+                c = holder.lockCanvas();
+                if (c != null) {
+                    // draw something
+                    drawCube(c);
+                    drawTouchPoint(c);
+                }
+            } finally {
+                if (c != null) holder.unlockCanvasAndPost(c);
+            }
+
+            // Reschedule the next redraw
+            mHandler.removeCallbacks(mDrawCube);
+            if (mVisible) {
+                mHandler.postDelayed(mDrawCube, 1000 / 25);
+            }
+        }
+
+        /*
+         * Draw a wireframe cube by drawing 12 3 dimensional lines between
+         * adjacent corners of the cube
+         */
+        void drawCube(Canvas c) {
+            c.save();
+            c.translate(mCenterX, mCenterY);
+            c.drawColor(0xff000000);
+            drawLine(c, -400, -400, -400,  400, -400, -400);
+            drawLine(c,  400, -400, -400,  400,  400, -400);
+            drawLine(c,  400,  400, -400, -400,  400, -400);
+            drawLine(c, -400,  400, -400, -400, -400, -400);
+
+            drawLine(c, -400, -400,  400,  400, -400,  400);
+            drawLine(c,  400, -400,  400,  400,  400,  400);
+            drawLine(c,  400,  400,  400, -400,  400,  400);
+            drawLine(c, -400,  400,  400, -400, -400,  400);
+
+            drawLine(c, -400, -400,  400, -400, -400, -400);
+            drawLine(c,  400, -400,  400,  400, -400, -400);
+            drawLine(c,  400,  400,  400,  400,  400, -400);
+            drawLine(c, -400,  400,  400, -400,  400, -400);
+            c.restore();
+        }
+
+        /*
+         * Draw a 3 dimensional line on to the screen
+         */
+        void drawLine(Canvas c, int x1, int y1, int z1, int x2, int y2, int z2) {
+            long now = SystemClock.elapsedRealtime();
+            float xrot = ((float)(now - mStartTime)) / 1000;
+            float yrot = (0.5f - mOffset) * 2.0f;
+            float zrot = 0;
+
+            // 3D transformations
+
+            // rotation around X-axis
+            float newy1 = (float)(Math.sin(xrot) * z1 + Math.cos(xrot) * y1);
+            float newy2 = (float)(Math.sin(xrot) * z2 + Math.cos(xrot) * y2);
+            float newz1 = (float)(Math.cos(xrot) * z1 - Math.sin(xrot) * y1);
+            float newz2 = (float)(Math.cos(xrot) * z2 - Math.sin(xrot) * y2);
+
+            // rotation around Y-axis
+            float newx1 = (float)(Math.sin(yrot) * newz1 + Math.cos(yrot) * x1);
+            float newx2 = (float)(Math.sin(yrot) * newz2 + Math.cos(yrot) * x2);
+            newz1 = (float)(Math.cos(yrot) * newz1 - Math.sin(yrot) * x1);
+            newz2 = (float)(Math.cos(yrot) * newz2 - Math.sin(yrot) * x2);
+
+            // 3D-to-2D projection
+            float startX = newx1 / (4 - newz1 / 400);
+            float startY = newy1 / (4 - newz1 / 400);
+            float stopX =  newx2 / (4 - newz2 / 400);
+            float stopY =  newy2 / (4 - newz2 / 400);
+
+            c.drawLine(startX, startY, stopX, stopY, mPaint);
+        }
+
+        /*
+         * Draw a circle around the current touch point, if any.
+         */
+        void drawTouchPoint(Canvas c) {
+            if (mTouchX >=0 && mTouchY >= 0) {
+                c.drawCircle(mTouchX, mTouchY, 80, mPaint);
+            }
+        }
+
+    }
+}
diff --git a/samples/CubeLiveWallpaper/src/com/android/livecubes/cube2/CubeWallpaper2.java b/samples/CubeLiveWallpaper/src/com/android/livecubes/cube2/CubeWallpaper2.java
new file mode 100644
index 0000000..0c6d90e
--- /dev/null
+++ b/samples/CubeLiveWallpaper/src/com/android/livecubes/cube2/CubeWallpaper2.java
@@ -0,0 +1,297 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.livecubes.cube2;
+
+import com.android.livecubes.R;
+
+import android.content.SharedPreferences;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.os.Handler;
+import android.os.SystemClock;
+import android.service.wallpaper.WallpaperService;
+import android.util.Log;
+import android.view.MotionEvent;
+import android.view.SurfaceHolder;
+
+/*
+ * This animated wallpaper draws a rotating wireframe shape. It is similar to
+ * example #1, but has a choice of 2 shapes, which are user selectable and
+ * defined in resources instead of in code.
+ */
+
+public class CubeWallpaper2 extends WallpaperService {
+
+    public static final String SHARED_PREFS_NAME="cube2settings";
+
+    static class ThreeDPoint {
+        float x;
+        float y;
+        float z;
+    }
+
+    static class ThreeDLine {
+        int startPoint;
+        int endPoint;
+    }
+
+    @Override
+    public void onCreate() {
+        super.onCreate();
+    }
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+    }
+
+    @Override
+    public Engine onCreateEngine() {
+        return new CubeEngine();
+    }
+
+    class CubeEngine extends Engine 
+        implements SharedPreferences.OnSharedPreferenceChangeListener {
+
+        private final Handler mHandler = new Handler();
+
+        ThreeDPoint [] mOriginalPoints;
+        ThreeDPoint [] mRotatedPoints;
+        ThreeDLine [] mLines;
+        private final Paint mPaint = new Paint();
+        private float mOffset;
+        private float mTouchX = -1;
+        private float mTouchY = -1;
+        private long mStartTime;
+        private float mCenterX;
+        private float mCenterY;
+
+        private final Runnable mDrawCube = new Runnable() {
+            public void run() {
+                drawFrame();
+            }
+        };
+        private boolean mVisible;
+        private SharedPreferences mPrefs;
+
+        CubeEngine() {
+            // Create a Paint to draw the lines for our cube
+            final Paint paint = mPaint;
+            paint.setColor(0xffffffff);
+            paint.setAntiAlias(true);
+            paint.setStrokeWidth(2);
+            paint.setStrokeCap(Paint.Cap.ROUND);
+            paint.setStyle(Paint.Style.STROKE);
+
+            mStartTime = SystemClock.elapsedRealtime();
+
+            mPrefs = CubeWallpaper2.this.getSharedPreferences(SHARED_PREFS_NAME, 0);
+            mPrefs.registerOnSharedPreferenceChangeListener(this);
+            onSharedPreferenceChanged(mPrefs, null);
+        }
+
+        public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
+
+            String shape = prefs.getString("cube2_shape", "cube");
+
+            // read the 3D model from the resource
+            readModel(shape);
+        }
+
+        private void readModel(String prefix) {
+            // Read the model definition in from a resource.
+
+            // get the resource identifiers for the arrays for the selected shape
+            int pid = getResources().getIdentifier(prefix + "points", "array", getPackageName());
+            int lid = getResources().getIdentifier(prefix + "lines", "array", getPackageName());
+
+            String [] p = getResources().getStringArray(pid);
+            int numpoints = p.length;
+            mOriginalPoints = new ThreeDPoint[numpoints];
+            mRotatedPoints = new ThreeDPoint[numpoints];
+
+            for (int i = 0; i < numpoints; i++) {
+                mOriginalPoints[i] = new ThreeDPoint();
+                mRotatedPoints[i] = new ThreeDPoint();
+                String [] coord = p[i].split(" ");
+                mOriginalPoints[i].x = Float.valueOf(coord[0]);
+                mOriginalPoints[i].y = Float.valueOf(coord[1]);
+                mOriginalPoints[i].z = Float.valueOf(coord[2]);
+            }
+
+            String [] l = getResources().getStringArray(lid);
+            int numlines = l.length;
+            mLines = new ThreeDLine[numlines];
+
+            for (int i = 0; i < numlines; i++) {
+                mLines[i] = new ThreeDLine();
+                String [] idx = l[i].split(" ");
+                mLines[i].startPoint = Integer.valueOf(idx[0]);
+                mLines[i].endPoint = Integer.valueOf(idx[1]);
+            }
+        }
+
+        @Override
+        public void onCreate(SurfaceHolder surfaceHolder) {
+            super.onCreate(surfaceHolder);
+            setTouchEventsEnabled(true);
+        }
+
+        @Override
+        public void onDestroy() {
+            super.onDestroy();
+            mHandler.removeCallbacks(mDrawCube);
+        }
+
+        @Override
+        public void onVisibilityChanged(boolean visible) {
+            mVisible = visible;
+            if (visible) {
+                drawFrame();
+            } else {
+                mHandler.removeCallbacks(mDrawCube);
+            }
+        }
+
+        @Override
+        public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+            super.onSurfaceChanged(holder, format, width, height);
+            // store the center of the surface, so we can draw the cube in the right spot
+            mCenterX = width/2.0f;
+            mCenterY = height/2.0f;
+            drawFrame();
+        }
+
+        @Override
+        public void onSurfaceCreated(SurfaceHolder holder) {
+            super.onSurfaceCreated(holder);
+        }
+
+        @Override
+        public void onSurfaceDestroyed(SurfaceHolder holder) {
+            super.onSurfaceDestroyed(holder);
+            mVisible = false;
+            mHandler.removeCallbacks(mDrawCube);
+        }
+
+        @Override
+        public void onOffsetsChanged(float xOffset, float yOffset,
+                float xStep, float yStep, int xPixels, int yPixels) {
+            mOffset = xOffset;
+            drawFrame();
+        }
+
+        /*
+         * Store the position of the touch event so we can use it for drawing later
+         */
+        @Override
+        public void onTouchEvent(MotionEvent event) {
+            if (event.getAction() == MotionEvent.ACTION_MOVE) {
+                mTouchX = event.getX();
+                mTouchY = event.getY();
+            } else {
+                mTouchX = -1;
+                mTouchY = -1;
+            }
+            super.onTouchEvent(event);
+        }
+
+        /*
+         * Draw one frame of the animation. This method gets called repeatedly
+         * by posting a delayed Runnable. You can do any drawing you want in
+         * here. This example draws a wireframe cube.
+         */
+        void drawFrame() {
+            final SurfaceHolder holder = getSurfaceHolder();
+            final Rect frame = holder.getSurfaceFrame();
+            final int width = frame.width();
+            final int height = frame.height();
+
+            Canvas c = null;
+            try {
+                c = holder.lockCanvas();
+                if (c != null) {
+                    // draw something
+                    drawCube(c);
+                    drawTouchPoint(c);
+                }
+            } finally {
+                if (c != null) holder.unlockCanvasAndPost(c);
+            }
+
+            mHandler.removeCallbacks(mDrawCube);
+            if (mVisible) {
+                mHandler.postDelayed(mDrawCube, 1000 / 25);
+            }
+        }
+
+        void drawCube(Canvas c) {
+            c.save();
+            c.translate(mCenterX, mCenterY);
+            c.drawColor(0xff000000);
+
+            long now = SystemClock.elapsedRealtime();
+            float xrot = ((float)(now - mStartTime)) / 1000;
+            float yrot = (0.5f - mOffset) * 2.0f;
+            rotateAndProjectPoints(xrot, yrot);
+            drawLines(c);
+            c.restore();
+        }
+
+        void rotateAndProjectPoints(float xrot, float yrot) {
+            int n = mOriginalPoints.length;
+            for (int i = 0; i < n; i++) {
+                // rotation around X-axis
+                ThreeDPoint p = mOriginalPoints[i];
+                float x = p.x;
+                float y = p.y;
+                float z = p.z;
+                float newy = (float)(Math.sin(xrot) * z + Math.cos(xrot) * y);
+                float newz = (float)(Math.cos(xrot) * z - Math.sin(xrot) * y);
+
+                // rotation around Y-axis
+                float newx = (float)(Math.sin(yrot) * newz + Math.cos(yrot) * x);
+                newz = (float)(Math.cos(yrot) * newz - Math.sin(yrot) * x);
+
+                // 3D-to-2D projection
+                float screenX = newx / (4 - newz / 400);
+                float screenY = newy / (4 - newz / 400);
+
+                mRotatedPoints[i].x = screenX;
+                mRotatedPoints[i].y = screenY;
+                mRotatedPoints[i].z = 0;
+            }
+        }
+
+        void drawLines(Canvas c) {
+            int n = mLines.length;
+            for (int i = 0; i < n; i++) {
+                ThreeDLine l = mLines[i];
+                ThreeDPoint start = mRotatedPoints[l.startPoint];
+                ThreeDPoint end = mRotatedPoints[l.endPoint];
+                c.drawLine(start.x, start.y, end.x, end.y, mPaint);
+            }
+        }
+
+        void drawTouchPoint(Canvas c) {
+            if (mTouchX >=0 && mTouchY >= 0) {
+                c.drawCircle(mTouchX, mTouchY, 80, mPaint);
+            }
+        }
+    }
+}
diff --git a/samples/CubeLiveWallpaper/src/com/android/livecubes/cube2/CubeWallpaper2Settings.java b/samples/CubeLiveWallpaper/src/com/android/livecubes/cube2/CubeWallpaper2Settings.java
new file mode 100644
index 0000000..feeb0bd
--- /dev/null
+++ b/samples/CubeLiveWallpaper/src/com/android/livecubes/cube2/CubeWallpaper2Settings.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2009 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.android.livecubes.cube2;
+
+import com.android.livecubes.R;
+
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.service.wallpaper.WallpaperSettingsActivity;
+
+public class CubeWallpaper2Settings extends WallpaperSettingsActivity
+    implements SharedPreferences.OnSharedPreferenceChangeListener {
+
+    @Override
+    protected void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        getPreferenceManager().setSharedPreferencesName(
+                CubeWallpaper2.SHARED_PREFS_NAME);
+        addPreferencesFromResource(R.xml.cube2_settings);
+        getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(
+                this);
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+    }
+
+    @Override
+    protected void onDestroy() {
+        getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(
+                this);
+        super.onDestroy();
+    }
+
+    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
+            String key) {
+        //(new BackupManager(this)).dataChanged();
+    }
+}
diff --git a/samples/CubeLiveWallpaper/src/com/android/livecubes/cube3/Cube3RS.java b/samples/CubeLiveWallpaper/src/com/android/livecubes/cube3/Cube3RS.java
new file mode 100644
index 0000000..5cfad14
--- /dev/null
+++ b/samples/CubeLiveWallpaper/src/com/android/livecubes/cube3/Cube3RS.java
@@ -0,0 +1,242 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.livecubes.cube3;
+
+import com.android.livecubes.R;
+import com.android.livecubes.RenderScriptScene;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.Primitive;
+import android.renderscript.ProgramRaster;
+import android.renderscript.ProgramVertex;
+import android.renderscript.ScriptC;
+import android.renderscript.SimpleMesh;
+import android.renderscript.Type;
+import android.renderscript.Element.Builder;
+
+import java.util.TimeZone;
+
+/*
+ * This example draws a shape whose definition is read from resources (though
+ * it's not user selectable like in example #2), but does the drawing using
+ * RenderScript.
+ */
+class Cube3RS extends RenderScriptScene {
+
+    static class ThreeDPoint {
+        public float x;
+        public float y;
+        public float z;
+    }
+
+    static class ThreeDLine {
+        int startPoint;
+        int endPoint;
+    }
+
+    static class WorldState {
+        public float yRotation;
+        public float mCenterX;
+        public float mCenterY;
+    }
+    ThreeDPoint [] mOriginalPoints;
+    ThreeDLine [] mLines;
+
+    WorldState mWorldState = new WorldState();
+    private Type mStateType;
+    private Allocation mState;
+
+    private SimpleMesh mCubeMesh;
+
+    private Allocation mPointAlloc;
+    private float [] mPointData;
+
+    private Allocation mLineIdxAlloc;
+    private short [] mIndexData;
+
+    private ProgramVertex mPVBackground;
+    private ProgramVertex.MatrixAllocation mPVAlloc;
+
+    private int mWidth;
+    private int mHeight;
+
+    private static final int RSID_STATE = 0;
+    private static final int RSID_POINTS = 1;
+    private static final int RSID_LINES = 2;
+    private static final int RSID_PROGRAMVERTEX = 3;
+
+
+    Cube3RS(int width, int height) {
+        super(width, height);
+        mWidth = width;
+        mHeight = height;
+    }
+
+    @Override
+    public void resize(int width, int height) {
+        super.resize(width, height);
+        mWidth = width;
+        mHeight = height;
+    }
+
+    @Override
+    protected ScriptC createScript() {
+
+        // Read the model in to our point/line objects
+        readModel();
+
+        // Create a renderscript type from a java class. The specified name doesn't
+        // really matter; the name by which we refer to the object in RenderScript
+        // will be specified later.
+        mStateType = Type.createFromClass(mRS, WorldState.class, 1, "WorldState");
+        // Create an allocation from the type we just created.
+        mState = Allocation.createTyped(mRS, mStateType);
+        // set our java object as the data for the renderscript allocation
+        mWorldState.yRotation = (-0.5f) * 2 * 180 / (float) Math.PI;
+        mState.data(mWorldState);
+
+        /*
+         *  Now put our model in to a form that renderscript can work with:
+         *  - create a buffer of floats that are the coordinates for the points that define the cube
+         *  - create a buffer of integers that are the indices of the points that form lines
+         *  - combine the two in to a mesh
+         */
+
+        // First set up the coordinate system and such
+        ProgramVertex.Builder pvb = new ProgramVertex.Builder(mRS, null, null);
+        mPVBackground = pvb.create();
+        mPVBackground.setName("PVBackground");
+        mPVAlloc = new ProgramVertex.MatrixAllocation(mRS);
+        mPVBackground.bindAllocation(mPVAlloc);
+        mPVAlloc.setupProjectionNormalized(mWidth, mHeight);
+
+        // Start creating the mesh
+        final SimpleMesh.Builder meshBuilder = new SimpleMesh.Builder(mRS);
+
+        // Create the Element for the points
+        Builder elementBuilder = new Builder(mRS);
+        // By specifying a prefix, even an empty one, the members will be accessible
+        // in the renderscript. If we just called addFloatXYZ(), the members would be
+        // unnamed in the renderscript struct definition.
+        elementBuilder.addFloatXYZ("");
+        final Element vertexElement = elementBuilder.create();
+        final int vertexSlot = meshBuilder.addVertexType(vertexElement, mOriginalPoints.length);
+        // Specify the type and number of indices we need. We'll allocate them later.
+        meshBuilder.setIndexType(Element.INDEX_16(mRS), mLines.length * 2);
+        // This will be a line mesh
+        meshBuilder.setPrimitive(Primitive.LINE);
+
+        // Create the Allocation for the vertices
+        mCubeMesh = meshBuilder.create();
+        mCubeMesh.setName("CubeMesh");
+        mPointAlloc = mCubeMesh.createVertexAllocation(vertexSlot);
+        mPointAlloc.setName("PointBuffer");
+
+        // Create the Allocation for the indices
+        mLineIdxAlloc = mCubeMesh.createIndexAllocation();
+
+        // Bind the allocations to the mesh
+        mCubeMesh.bindVertexAllocation(mPointAlloc, 0);
+        mCubeMesh.bindIndexAllocation(mLineIdxAlloc);
+
+        /*
+         *  put the vertex and index data in their respective buffers
+         */
+        // one float each for x, y and z, and the 4th float will hold rgba
+        mPointData = new float[mOriginalPoints.length * 3];
+        for(int i = 0; i < mOriginalPoints.length; i ++) {
+            mPointData[i*3]   = mOriginalPoints[i].x;
+            mPointData[i*3+1] = mOriginalPoints[i].y;
+            mPointData[i*3+2] = mOriginalPoints[i].z;
+        }
+        mIndexData = new short[mLines.length * 2];
+        for(int i = 0; i < mLines.length; i++) {
+            mIndexData[i * 2] = (short)(mLines[i].startPoint);
+            mIndexData[i * 2 + 1] = (short)(mLines[i].endPoint);
+        }
+
+        /*
+         *  upload the vertex and index data
+         */
+        mPointAlloc.data(mPointData);
+        mPointAlloc.uploadToBufferObject();
+        mLineIdxAlloc.data(mIndexData);
+        mLineIdxAlloc.uploadToBufferObject();
+
+        // Time to create the script
+        ScriptC.Builder sb = new ScriptC.Builder(mRS);
+        // Specify the name by which to refer to the WorldState object in the
+        // renderscript.
+        sb.setType(mStateType, "State", RSID_STATE);
+        sb.setType(mCubeMesh.getVertexType(0), "Points", RSID_POINTS);
+        // this crashes when uncommented
+        //sb.setType(mCubeMesh.getIndexType(), "Lines", RSID_LINES);
+
+        // Set the render script that will make use of the objects we defined above
+        sb.setScript(mResources, R.raw.cube);
+        sb.setRoot(true);
+
+        ScriptC script = sb.create();
+        script.setClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+        script.setTimeZone(TimeZone.getDefault().getID());
+
+        script.bindAllocation(mState, RSID_STATE);
+        script.bindAllocation(mPointAlloc, RSID_POINTS);
+        script.bindAllocation(mLineIdxAlloc, RSID_LINES);
+        script.bindAllocation(mPVAlloc.mAlloc, RSID_PROGRAMVERTEX);
+
+        return script;
+    }
+
+    @Override
+    public void setOffset(float xOffset, float yOffset, int xPixels, int yPixels) {
+        // update our state, then push it to the renderscript
+        mWorldState.yRotation = (xOffset - 0.5f) * 2 * 180 / (float) Math.PI;
+        mState.data(mWorldState);
+    }
+
+    /*
+     *  Read the model definition from the resource.
+     */
+    private void readModel() {
+
+        String [] p = mResources.getStringArray(R.array.cubepoints);
+        int numpoints = p.length;
+        mOriginalPoints = new ThreeDPoint[numpoints];
+
+        for (int i = 0; i < numpoints; i++) {
+            mOriginalPoints[i] = new ThreeDPoint();
+            String [] coord = p[i].split(" ");
+            mOriginalPoints[i].x = Float.valueOf(coord[0]);
+            mOriginalPoints[i].y = Float.valueOf(coord[1]);
+            mOriginalPoints[i].z = Float.valueOf(coord[2]);
+        }
+
+        String [] l = mResources.getStringArray(R.array.cubelines);
+        int numlines = l.length;
+        mLines = new ThreeDLine[numlines];
+
+        for (int i = 0; i < numlines; i++) {
+            mLines[i] = new ThreeDLine();
+            String [] idx = l[i].split(" ");
+            mLines[i].startPoint = Integer.valueOf(idx[0]);
+            mLines[i].endPoint = Integer.valueOf(idx[1]);
+        }
+    }
+
+}
diff --git a/samples/CubeLiveWallpaper/src/com/android/livecubes/cube3/CubeWallpaper3.java b/samples/CubeLiveWallpaper/src/com/android/livecubes/cube3/CubeWallpaper3.java
new file mode 100644
index 0000000..8f09388
--- /dev/null
+++ b/samples/CubeLiveWallpaper/src/com/android/livecubes/cube3/CubeWallpaper3.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.livecubes.cube3;
+
+import com.android.livecubes.RenderScriptWallpaper;
+
+public class CubeWallpaper3 extends RenderScriptWallpaper<Cube3RS> {
+
+    @Override
+    protected Cube3RS createScene(int width, int height) {
+        return new Cube3RS(width, height);
+    }
+}
+
diff --git a/samples/CubeLiveWallpaper/src/com/android/livecubes/cube3/RenderScriptScene.java b/samples/CubeLiveWallpaper/src/com/android/livecubes/cube3/RenderScriptScene.java
new file mode 100644
index 0000000..429e93d
--- /dev/null
+++ b/samples/CubeLiveWallpaper/src/com/android/livecubes/cube3/RenderScriptScene.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package com.android.livecubes;
+
+import android.content.res.Resources;
+import android.renderscript.RenderScript;
+import android.renderscript.ScriptC;
+
+public abstract class RenderScriptScene {
+    protected int mWidth;
+    protected int mHeight;
+    protected boolean mPreview;
+    protected Resources mResources;
+    protected RenderScript mRS;
+    protected ScriptC mScript;
+
+    public RenderScriptScene(int width, int height) {
+        mWidth = width;
+        mHeight = height;
+    }
+
+    public void init(RenderScript rs, Resources res, boolean isPreview) {
+        mRS = rs;
+        mResources = res;
+        mPreview = isPreview;
+        mScript = createScript();
+    }
+
+    public boolean isPreview() {
+        return mPreview;
+    }
+
+    public int getWidth() {
+        return mWidth;
+    }
+
+    public int getHeight() {
+        return mHeight;
+    }
+
+    public Resources getResources() {
+        return mResources;
+    }
+
+    public RenderScript getRS() {
+        return mRS;
+    }
+
+    public ScriptC getScript() {
+        return mScript;
+    }
+
+    protected abstract ScriptC createScript();
+
+    public void stop() {
+        mRS.contextBindRootScript(null);
+    }
+
+    public void start() {
+        mRS.contextBindRootScript(mScript);
+    }
+
+    public void resize(int width, int height) {
+        mWidth = width;
+        mHeight = height;
+    }
+
+    @SuppressWarnings({"UnusedDeclaration"})
+    public void setOffset(float xOffset, float yOffset, int xPixels, int yPixels) {
+    }
+}
diff --git a/samples/CubeLiveWallpaper/src/com/android/livecubes/cube3/RenderScriptWallpaper.java b/samples/CubeLiveWallpaper/src/com/android/livecubes/cube3/RenderScriptWallpaper.java
new file mode 100644
index 0000000..3fb5148
--- /dev/null
+++ b/samples/CubeLiveWallpaper/src/com/android/livecubes/cube3/RenderScriptWallpaper.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package com.android.livecubes;
+
+import android.service.wallpaper.WallpaperService;
+import android.renderscript.RenderScript;
+import android.view.SurfaceHolder;
+import android.view.Surface;
+
+public abstract class RenderScriptWallpaper<T extends RenderScriptScene> extends WallpaperService {
+    public Engine onCreateEngine() {
+        return new RenderScriptEngine();
+    }
+
+    protected abstract T createScene(int width, int height);
+
+    private class RenderScriptEngine extends Engine {
+        private RenderScript mRs;
+        private T mRenderer;
+
+        @Override
+        public void onCreate(SurfaceHolder surfaceHolder) {
+            super.onCreate(surfaceHolder);
+            setTouchEventsEnabled(false);
+            surfaceHolder.setSizeFromLayout();
+        }
+
+        @Override
+        public void onDestroy() {
+            super.onDestroy();
+            destroyRenderer();
+        }
+
+        private void destroyRenderer() {
+            if (mRenderer != null) {
+                mRenderer.stop();
+                mRenderer = null;
+            }
+            if (mRs != null) {
+                mRs.destroy();
+                mRs = null;
+            }
+        }
+
+        @Override
+        public void onVisibilityChanged(boolean visible) {
+            super.onVisibilityChanged(visible);
+            if (mRenderer != null) {
+                if (visible) {
+                    mRenderer.start();
+                } else {
+                    mRenderer.stop();
+                }
+            }
+        }
+
+        @Override
+        public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+            super.onSurfaceChanged(holder, format, width, height);
+            if (mRenderer == null) {
+                mRenderer = createScene(width, height);
+                mRenderer.init(mRs, getResources(), isPreview());
+                mRenderer.start();
+            } else {
+                mRenderer.resize(width, height);
+            }
+        }
+
+        @Override
+        public void onOffsetsChanged(float xOffset, float yOffset,
+                float xStep, float yStep, int xPixels, int yPixels) {
+            mRenderer.setOffset(xOffset, yOffset, xPixels, yPixels);
+        }
+
+        @Override
+        public void onSurfaceCreated(SurfaceHolder holder) {
+            super.onSurfaceCreated(holder);
+
+            Surface surface = null;
+            while (surface == null) {
+                surface = holder.getSurface();
+            }
+            mRs = new RenderScript(surface, false, false);
+        }
+
+        @Override
+        public void onSurfaceDestroyed(SurfaceHolder holder) {
+            super.onSurfaceDestroyed(holder);
+            destroyRenderer();
+        }
+    }
+}
diff --git a/samples/FixedGridLayout/Android.mk b/samples/FixedGridLayout/Android.mk
new file mode 100644
index 0000000..1562cb9
--- /dev/null
+++ b/samples/FixedGridLayout/Android.mk
@@ -0,0 +1,12 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := samples
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_PACKAGE_NAME := FixedGridLayout
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/samples/FixedGridLayout/AndroidManifest.xml b/samples/FixedGridLayout/AndroidManifest.xml
new file mode 100644
index 0000000..9acd309
--- /dev/null
+++ b/samples/FixedGridLayout/AndroidManifest.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+      package="com.example.android.fixedgridlayout"
+      android:versionCode="1"
+      android:versionName="1.0">
+    <application android:label="@string/app_name">
+        <activity android:name=".FixedGridLayoutTest"
+                  android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest> 
diff --git a/samples/FixedGridLayout/res/drawable-hdpi/bugdroid.png b/samples/FixedGridLayout/res/drawable-hdpi/bugdroid.png
new file mode 100755
index 0000000..e64968f
--- /dev/null
+++ b/samples/FixedGridLayout/res/drawable-hdpi/bugdroid.png
Binary files differ
diff --git a/samples/FixedGridLayout/res/drawable-mdpi/bugdroid.png b/samples/FixedGridLayout/res/drawable-mdpi/bugdroid.png
new file mode 100644
index 0000000..855484a
--- /dev/null
+++ b/samples/FixedGridLayout/res/drawable-mdpi/bugdroid.png
Binary files differ
diff --git a/samples/FixedGridLayout/res/layout/main.xml b/samples/FixedGridLayout/res/layout/main.xml
new file mode 100644
index 0000000..93e2d5e
--- /dev/null
+++ b/samples/FixedGridLayout/res/layout/main.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<com.example.android.fixedgridlayout.FixedGridLayout
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:app="http://schemas.android.com/apk/res/com.example.android.fixedgridlayout"
+        android:id="@+id/grid"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        app:cellWidth="80dp"
+        app:cellHeight="100dp"
+        >
+    <ImageView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@drawable/bugdroid"
+        />
+    <ImageView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@drawable/bugdroid"
+        />
+    <ImageView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@drawable/bugdroid"
+        />
+    <ImageView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@drawable/bugdroid"
+        />
+    <ImageView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@drawable/bugdroid"
+        />
+    <ImageView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@drawable/bugdroid"
+        />
+</com.example.android.fixedgridlayout.FixedGridLayout>
+
diff --git a/samples/FixedGridLayout/res/values/attrs.xml b/samples/FixedGridLayout/res/values/attrs.xml
new file mode 100644
index 0000000..8287d0e
--- /dev/null
+++ b/samples/FixedGridLayout/res/values/attrs.xml
@@ -0,0 +1,7 @@
+<resources>
+    <declare-styleable name="FixedGridLayout">
+        <attr name="cellWidth" format="dimension" />
+        <attr name="cellHeight" format="dimension" />
+    </declare-styleable>
+</resources>
+
diff --git a/samples/FixedGridLayout/res/values/strings.xml b/samples/FixedGridLayout/res/values/strings.xml
new file mode 100644
index 0000000..14563c7
--- /dev/null
+++ b/samples/FixedGridLayout/res/values/strings.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">FixedGridLayoutTest</string>
+</resources>
diff --git a/samples/FixedGridLayout/src/com/example/android/fixedgridlayout/FixedGridLayout.java b/samples/FixedGridLayout/src/com/example/android/fixedgridlayout/FixedGridLayout.java
new file mode 100644
index 0000000..413157f
--- /dev/null
+++ b/samples/FixedGridLayout/src/com/example/android/fixedgridlayout/FixedGridLayout.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.fixedgridlayout;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.util.AttributeSet;
+import android.util.SparseIntArray;
+import android.view.Gravity;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewDebug;
+
+/**
+ * A layout that arranges its children in a grid.  The size of the
+ * cells is set by the {@link #setCellSize} method and the
+ * android:cell_width and android:cell_height attributes in XML.
+ * The number of rows and columns is determined at runtime.  Each
+ * cell contains exactly one view, and they flow in the natural
+ * child order (the order in which they were added, or the index
+ * in {@link #addViewAt}.  Views can not span multiple cells.
+ */
+public class FixedGridLayout extends ViewGroup {
+    int mCellWidth;
+    int mCellHeight;
+
+    public FixedGridLayout(Context context) {
+        super(context);
+    }
+
+    public FixedGridLayout(Context context, AttributeSet attrs) {
+        super(context, attrs);
+
+        // Read the resource attributes.
+        TypedArray a = context.obtainStyledAttributes(
+                attrs, R.styleable.FixedGridLayout);
+        mCellWidth = a.getDimensionPixelSize(
+                R.styleable.FixedGridLayout_cellWidth, -1);
+        mCellHeight = a.getDimensionPixelSize(
+                R.styleable.FixedGridLayout_cellHeight, -1);
+        a.recycle();
+    }
+
+    public void setCellWidth(int px) {
+        mCellWidth = px;
+        requestLayout();
+    }
+
+    public void setCellHeight(int px) {
+        mCellHeight = px;
+        requestLayout();
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        int cellWidthSpec = MeasureSpec.makeMeasureSpec(mCellWidth,
+                MeasureSpec.AT_MOST);
+        int cellHeightSpec = MeasureSpec.makeMeasureSpec(mCellHeight,
+                MeasureSpec.AT_MOST);
+
+        int count = getChildCount();
+        for (int index=0; index<count; index++) {
+            final View child = getChildAt(index);
+            child.measure(cellWidthSpec, cellHeightSpec);
+        }
+        // Use the size our parents gave us
+        setMeasuredDimension(resolveSize(mCellWidth*count, widthMeasureSpec),
+                resolveSize(mCellHeight*count, heightMeasureSpec));
+    }
+
+    @Override
+    protected void onLayout(boolean changed, int l, int t, int r, int b) {
+        int cellWidth = mCellWidth;
+        int cellHeight = mCellHeight;
+        int columns = (r - l) / cellWidth;
+        if (columns < 0) {
+            columns = 1;
+        }
+        int x = 0;
+        int y = 0;
+        int i = 0;
+        int count = getChildCount();
+        for (int index=0; index<count; index++) {
+            final View child = getChildAt(index);
+
+            int w = child.getMeasuredWidth();
+            int h = child.getMeasuredHeight();
+
+            int left = x + ((cellWidth-w)/2);
+            int top = y + ((cellHeight-h)/2);
+
+            child.layout(left, top, left+w, top+h);
+            if (i >= (columns-1)) {
+                // advance to next row
+                i = 0;
+                x = 0;
+                y += cellHeight;
+            } else {
+                i++;
+                x += cellWidth;
+            }
+        }
+    }
+}
+
diff --git a/samples/FixedGridLayout/src/com/example/android/fixedgridlayout/FixedGridLayoutTest.java b/samples/FixedGridLayout/src/com/example/android/fixedgridlayout/FixedGridLayoutTest.java
new file mode 100644
index 0000000..19c9da7
--- /dev/null
+++ b/samples/FixedGridLayout/src/com/example/android/fixedgridlayout/FixedGridLayoutTest.java
@@ -0,0 +1,19 @@
+package com.example.android.fixedgridlayout;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class FixedGridLayoutTest extends Activity
+{
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState)
+    {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.main);
+
+        FixedGridLayout grid = (FixedGridLayout)findViewById(R.id.grid);
+        grid.setCellWidth(80);
+        grid.setCellHeight(80);
+    }
+}
diff --git a/samples/GlobalTime/res/drawable-hdpi/app_global_time.png b/samples/GlobalTime/res/drawable-hdpi/app_global_time.png
new file mode 100755
index 0000000..46c658e
--- /dev/null
+++ b/samples/GlobalTime/res/drawable-hdpi/app_global_time.png
Binary files differ
diff --git a/samples/GlobalTime/res/drawable/app_global_time.png b/samples/GlobalTime/res/drawable-mdpi/app_global_time.png
similarity index 100%
rename from samples/GlobalTime/res/drawable/app_global_time.png
rename to samples/GlobalTime/res/drawable-mdpi/app_global_time.png
Binary files differ
diff --git a/samples/HelloActivity/tests/build.properties b/samples/HelloActivity/tests/build.properties
new file mode 100644
index 0000000..e0c39de
--- /dev/null
+++ b/samples/HelloActivity/tests/build.properties
@@ -0,0 +1 @@
+tested.project.dir=..
diff --git a/samples/Home/res/drawable-hdpi/all_applications_label_background.9.png b/samples/Home/res/drawable-hdpi/all_applications_label_background.9.png
new file mode 100755
index 0000000..75adf05
--- /dev/null
+++ b/samples/Home/res/drawable-hdpi/all_applications_label_background.9.png
Binary files differ
diff --git a/samples/Home/res/drawable-hdpi/application_background.9.png b/samples/Home/res/drawable-hdpi/application_background.9.png
new file mode 100755
index 0000000..70ae4d9
--- /dev/null
+++ b/samples/Home/res/drawable-hdpi/application_background.9.png
Binary files differ
diff --git a/samples/Home/res/drawable-hdpi/application_background_static.png b/samples/Home/res/drawable-hdpi/application_background_static.png
new file mode 100755
index 0000000..450eaa4
--- /dev/null
+++ b/samples/Home/res/drawable-hdpi/application_background_static.png
Binary files differ
diff --git a/samples/Home/res/drawable-hdpi/focused_application_background_static.png b/samples/Home/res/drawable-hdpi/focused_application_background_static.png
new file mode 100755
index 0000000..bec2cd9
--- /dev/null
+++ b/samples/Home/res/drawable-hdpi/focused_application_background_static.png
Binary files differ
diff --git a/samples/Home/res/drawable-hdpi/hide_all_applications.png b/samples/Home/res/drawable-hdpi/hide_all_applications.png
new file mode 100755
index 0000000..13e188f
--- /dev/null
+++ b/samples/Home/res/drawable-hdpi/hide_all_applications.png
Binary files differ
diff --git a/samples/Home/res/drawable-hdpi/ic_launcher_allhide.png b/samples/Home/res/drawable-hdpi/ic_launcher_allhide.png
new file mode 100755
index 0000000..9bef2ea
--- /dev/null
+++ b/samples/Home/res/drawable-hdpi/ic_launcher_allhide.png
Binary files differ
diff --git a/samples/Home/res/drawable-hdpi/ic_launcher_allshow.png b/samples/Home/res/drawable-hdpi/ic_launcher_allshow.png
new file mode 100755
index 0000000..2a6f86a
--- /dev/null
+++ b/samples/Home/res/drawable-hdpi/ic_launcher_allshow.png
Binary files differ
diff --git a/samples/Home/res/drawable-hdpi/ic_launcher_home.png b/samples/Home/res/drawable-hdpi/ic_launcher_home.png
new file mode 100755
index 0000000..1e256e6
--- /dev/null
+++ b/samples/Home/res/drawable-hdpi/ic_launcher_home.png
Binary files differ
diff --git a/samples/Home/res/drawable-hdpi/pressed_application_background_static.png b/samples/Home/res/drawable-hdpi/pressed_application_background_static.png
new file mode 100755
index 0000000..9931571
--- /dev/null
+++ b/samples/Home/res/drawable-hdpi/pressed_application_background_static.png
Binary files differ
diff --git a/samples/Home/res/drawable-hdpi/show_all_applications.png b/samples/Home/res/drawable-hdpi/show_all_applications.png
new file mode 100755
index 0000000..2a768b7
--- /dev/null
+++ b/samples/Home/res/drawable-hdpi/show_all_applications.png
Binary files differ
diff --git a/samples/Home/res/drawable/all_applications_label_background.9.png b/samples/Home/res/drawable-mdpi/all_applications_label_background.9.png
similarity index 100%
rename from samples/Home/res/drawable/all_applications_label_background.9.png
rename to samples/Home/res/drawable-mdpi/all_applications_label_background.9.png
Binary files differ
diff --git a/samples/Home/res/drawable/application_background.9.png b/samples/Home/res/drawable-mdpi/application_background.9.png
similarity index 100%
rename from samples/Home/res/drawable/application_background.9.png
rename to samples/Home/res/drawable-mdpi/application_background.9.png
Binary files differ
diff --git a/samples/Home/res/drawable/application_background_static.png b/samples/Home/res/drawable-mdpi/application_background_static.png
similarity index 100%
rename from samples/Home/res/drawable/application_background_static.png
rename to samples/Home/res/drawable-mdpi/application_background_static.png
Binary files differ
diff --git a/samples/Home/res/drawable/focused_application_background_static.png b/samples/Home/res/drawable-mdpi/focused_application_background_static.png
similarity index 100%
rename from samples/Home/res/drawable/focused_application_background_static.png
rename to samples/Home/res/drawable-mdpi/focused_application_background_static.png
Binary files differ
diff --git a/samples/Home/res/drawable/hide_all_applications.png b/samples/Home/res/drawable-mdpi/hide_all_applications.png
similarity index 100%
rename from samples/Home/res/drawable/hide_all_applications.png
rename to samples/Home/res/drawable-mdpi/hide_all_applications.png
Binary files differ
diff --git a/samples/Home/res/drawable/ic_launcher_allhide.png b/samples/Home/res/drawable-mdpi/ic_launcher_allhide.png
similarity index 100%
rename from samples/Home/res/drawable/ic_launcher_allhide.png
rename to samples/Home/res/drawable-mdpi/ic_launcher_allhide.png
Binary files differ
diff --git a/samples/Home/res/drawable/ic_launcher_allshow.png b/samples/Home/res/drawable-mdpi/ic_launcher_allshow.png
similarity index 100%
rename from samples/Home/res/drawable/ic_launcher_allshow.png
rename to samples/Home/res/drawable-mdpi/ic_launcher_allshow.png
Binary files differ
diff --git a/samples/Home/res/drawable/ic_launcher_home.png b/samples/Home/res/drawable-mdpi/ic_launcher_home.png
similarity index 100%
rename from samples/Home/res/drawable/ic_launcher_home.png
rename to samples/Home/res/drawable-mdpi/ic_launcher_home.png
Binary files differ
diff --git a/samples/Home/res/drawable/pressed_application_background_static.png b/samples/Home/res/drawable-mdpi/pressed_application_background_static.png
similarity index 100%
rename from samples/Home/res/drawable/pressed_application_background_static.png
rename to samples/Home/res/drawable-mdpi/pressed_application_background_static.png
Binary files differ
diff --git a/samples/Home/res/drawable/show_all_applications.png b/samples/Home/res/drawable-mdpi/show_all_applications.png
similarity index 100%
rename from samples/Home/res/drawable/show_all_applications.png
rename to samples/Home/res/drawable-mdpi/show_all_applications.png
Binary files differ
diff --git a/samples/Home/src/com/example/android/home/Home.java b/samples/Home/src/com/example/android/home/Home.java
index c23f7b8..7cae87e 100644
--- a/samples/Home/src/com/example/android/home/Home.java
+++ b/samples/Home/src/com/example/android/home/Home.java
@@ -110,6 +110,9 @@
 
     private boolean mBlockAnimation;
 
+    private boolean mHomeDown;
+    private boolean mBackDown;
+    
     private View mShowApplications;
     private CheckBox mShowApplicationsCheck;
 
@@ -396,19 +399,44 @@
     }
 
     @Override
+    public void onWindowFocusChanged(boolean hasFocus) {
+        super.onWindowFocusChanged(hasFocus);
+        if (!hasFocus) {
+            mBackDown = mHomeDown = false;
+        }
+    }
+
+    @Override
     public boolean dispatchKeyEvent(KeyEvent event) {
         if (event.getAction() == KeyEvent.ACTION_DOWN) {
             switch (event.getKeyCode()) {
                 case KeyEvent.KEYCODE_BACK:
+                    mBackDown = true;
                     return true;
                 case KeyEvent.KEYCODE_HOME:
+                    mHomeDown = true;
+                    return true;
+            }
+        } else if (event.getAction() == KeyEvent.ACTION_UP) {
+            switch (event.getKeyCode()) {
+                case KeyEvent.KEYCODE_BACK:
+                    if (!event.isCanceled()) {
+                        // Do BACK behavior.
+                    }
+                    mBackDown = true;
+                    return true;
+                case KeyEvent.KEYCODE_HOME:
+                    if (!event.isCanceled()) {
+                        // Do HOME behavior.
+                    }
+                    mHomeDown = true;
                     return true;
             }
         }
 
         return super.dispatchKeyEvent(event);
     }
-
+    
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
         super.onCreateOptionsMenu(menu);
diff --git a/samples/JetBoy/src/com/example/android/jetboy/JetBoy.java b/samples/JetBoy/src/com/example/android/jetboy/JetBoy.java
index 21d933c..d62eb32 100755
--- a/samples/JetBoy/src/com/example/android/jetboy/JetBoy.java
+++ b/samples/JetBoy/src/com/example/android/jetboy/JetBoy.java
@@ -133,19 +133,22 @@
      */
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent msg) {
-
-        if (keyCode == 4)
-            super.onKeyDown(keyCode, msg);
-
-        return mJetBoyThread.doKeyDown(keyCode, msg);
+        if (keyCode == KeyEvent.KEYCODE_BACK) {
+            return super.onKeyDown(keyCode, msg);
+        } else {
+            return mJetBoyThread.doKeyDown(keyCode, msg);
+        }
     }
 
     /**
-     * Standard override for key-up. We actually care about these, so we can
-     * turn off the engine or stop rotating.
+     * Standard override for key-up.
      */
     @Override
     public boolean onKeyUp(int keyCode, KeyEvent msg) {
-        return mJetBoyThread.doKeyUp(keyCode, msg);
+        if (keyCode == KeyEvent.KEYCODE_BACK) {
+            return super.onKeyUp(keyCode, msg);
+        } else {
+            return mJetBoyThread.doKeyUp(keyCode, msg);
+        }
     }
 }
diff --git a/samples/LunarLander/tests/build.properties b/samples/LunarLander/tests/build.properties
new file mode 100644
index 0000000..8ae22a3
--- /dev/null
+++ b/samples/LunarLander/tests/build.properties
@@ -0,0 +1 @@
+tested.project.dir=..
\ No newline at end of file
diff --git a/samples/NotePad/res/drawable-hdpi/app_notes.png b/samples/NotePad/res/drawable-hdpi/app_notes.png
new file mode 100755
index 0000000..258d3d1
--- /dev/null
+++ b/samples/NotePad/res/drawable-hdpi/app_notes.png
Binary files differ
diff --git a/samples/NotePad/res/drawable/app_notes.png b/samples/NotePad/res/drawable-mdpi/app_notes.png
similarity index 100%
rename from samples/NotePad/res/drawable/app_notes.png
rename to samples/NotePad/res/drawable-mdpi/app_notes.png
Binary files differ
diff --git a/samples/NotePad/tests/build.properties b/samples/NotePad/tests/build.properties
new file mode 100644
index 0000000..e0c39de
--- /dev/null
+++ b/samples/NotePad/tests/build.properties
@@ -0,0 +1 @@
+tested.project.dir=..
diff --git a/samples/SearchableDictionary/src/com/example/android/searchabledict/DictionaryProvider.java b/samples/SearchableDictionary/src/com/example/android/searchabledict/DictionaryProvider.java
index db626e8..586fddb 100644
--- a/samples/SearchableDictionary/src/com/example/android/searchabledict/DictionaryProvider.java
+++ b/samples/SearchableDictionary/src/com/example/android/searchabledict/DictionaryProvider.java
@@ -106,16 +106,17 @@
         List<Dictionary.Word> words = Dictionary.getInstance().getMatches(processedQuery);
 
         MatrixCursor cursor = new MatrixCursor(COLUMNS);
+        long id = 0;
         for (Dictionary.Word word : words) {
-            cursor.addRow(columnValuesOfWord(word));
+            cursor.addRow(columnValuesOfWord(id++, word));
         }
 
         return cursor;
     }
 
-    private Object[] columnValuesOfWord(Dictionary.Word word) {
-        return new String[] {
-                word.word,           // _id
+    private Object[] columnValuesOfWord(long id, Dictionary.Word word) {
+        return new Object[] {
+                id,                  // _id
                 word.word,           // text1
                 word.definition,     // text2
                 word.word,           // intent_data (included when clicking on item)
diff --git a/samples/SkeletonApp/tests/build.properties b/samples/SkeletonApp/tests/build.properties
new file mode 100644
index 0000000..8ae22a3
--- /dev/null
+++ b/samples/SkeletonApp/tests/build.properties
@@ -0,0 +1 @@
+tested.project.dir=..
\ No newline at end of file
diff --git a/samples/Snake/tests/build.properties b/samples/Snake/tests/build.properties
new file mode 100644
index 0000000..e0c39de
--- /dev/null
+++ b/samples/Snake/tests/build.properties
@@ -0,0 +1 @@
+tested.project.dir=..
diff --git a/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_delete.png b/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_delete.png
new file mode 100755
index 0000000..5139c71
--- /dev/null
+++ b/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_delete.png
Binary files differ
diff --git a/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_done.png b/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_done.png
new file mode 100755
index 0000000..471c502
--- /dev/null
+++ b/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_done.png
Binary files differ
diff --git a/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_return.png b/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_return.png
new file mode 100755
index 0000000..5a5670c
--- /dev/null
+++ b/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_return.png
Binary files differ
diff --git a/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_search.png b/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_search.png
new file mode 100755
index 0000000..e72cde3
--- /dev/null
+++ b/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_search.png
Binary files differ
diff --git a/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_shift.png b/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_shift.png
new file mode 100755
index 0000000..2757696
--- /dev/null
+++ b/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_shift.png
Binary files differ
diff --git a/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_space.png b/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_space.png
new file mode 100755
index 0000000..cef2daa
--- /dev/null
+++ b/samples/SoftKeyboard/res/drawable-hdpi/sym_keyboard_space.png
Binary files differ
diff --git a/samples/SoftKeyboard/res/drawable/sym_keyboard_delete.png b/samples/SoftKeyboard/res/drawable-mdpi/sym_keyboard_delete.png
similarity index 100%
rename from samples/SoftKeyboard/res/drawable/sym_keyboard_delete.png
rename to samples/SoftKeyboard/res/drawable-mdpi/sym_keyboard_delete.png
Binary files differ
diff --git a/samples/SoftKeyboard/res/drawable/sym_keyboard_done.png b/samples/SoftKeyboard/res/drawable-mdpi/sym_keyboard_done.png
similarity index 100%
rename from samples/SoftKeyboard/res/drawable/sym_keyboard_done.png
rename to samples/SoftKeyboard/res/drawable-mdpi/sym_keyboard_done.png
Binary files differ
diff --git a/samples/SoftKeyboard/res/drawable/sym_keyboard_return.png b/samples/SoftKeyboard/res/drawable-mdpi/sym_keyboard_return.png
similarity index 100%
rename from samples/SoftKeyboard/res/drawable/sym_keyboard_return.png
rename to samples/SoftKeyboard/res/drawable-mdpi/sym_keyboard_return.png
Binary files differ
diff --git a/samples/SoftKeyboard/res/drawable/sym_keyboard_search.png b/samples/SoftKeyboard/res/drawable-mdpi/sym_keyboard_search.png
similarity index 100%
rename from samples/SoftKeyboard/res/drawable/sym_keyboard_search.png
rename to samples/SoftKeyboard/res/drawable-mdpi/sym_keyboard_search.png
Binary files differ
diff --git a/samples/SoftKeyboard/res/drawable/sym_keyboard_shift.png b/samples/SoftKeyboard/res/drawable-mdpi/sym_keyboard_shift.png
similarity index 100%
rename from samples/SoftKeyboard/res/drawable/sym_keyboard_shift.png
rename to samples/SoftKeyboard/res/drawable-mdpi/sym_keyboard_shift.png
Binary files differ
diff --git a/samples/SoftKeyboard/res/drawable/sym_keyboard_space.png b/samples/SoftKeyboard/res/drawable-mdpi/sym_keyboard_space.png
similarity index 100%
rename from samples/SoftKeyboard/res/drawable/sym_keyboard_space.png
rename to samples/SoftKeyboard/res/drawable-mdpi/sym_keyboard_space.png
Binary files differ
diff --git a/simulator/app/Android.mk b/simulator/app/Android.mk
index c6e1d14..3ce7cd5 100644
--- a/simulator/app/Android.mk
+++ b/simulator/app/Android.mk
@@ -24,12 +24,15 @@
 	PhoneCollection.cpp \
 	PhoneData.cpp \
 	PhoneWindow.cpp \
+	Pipe.cpp \
 	Preferences.cpp \
 	PrefsDialog.cpp \
 	PropertyServer.cpp \
 	Semaphore.cpp \
 	Shmem.cpp \
-	UserEvent.cpp
+	UserEvent.cpp \
+	executablepath_linux.cpp \
+	ported.cpp
 
 LOCAL_STATIC_LIBRARIES := \
 	libtinyxml
diff --git a/simulator/app/LoadableImage.cpp b/simulator/app/LoadableImage.cpp
index e5bd0f3..513165b 100644
--- a/simulator/app/LoadableImage.cpp
+++ b/simulator/app/LoadableImage.cpp
@@ -17,7 +17,7 @@
 #include "AssetStream.h"
 #include "MyApp.h"
 
-#include <utils.h>
+#include "utils.h"
 
 #include <stdio.h>
 
diff --git a/simulator/app/LocalBiChannel.h b/simulator/app/LocalBiChannel.h
index ce04bc0..a4f4d62 100644
--- a/simulator/app/LocalBiChannel.h
+++ b/simulator/app/LocalBiChannel.h
@@ -10,7 +10,7 @@
 #error DO NOT USE THIS FILE IN THE DEVICE BUILD
 #endif
 
-#include <utils/Pipe.h>
+#include "Pipe.h"
 
 namespace android {
 
diff --git a/simulator/app/MessageStream.h b/simulator/app/MessageStream.h
index de9c398..82a9b4c 100644
--- a/simulator/app/MessageStream.h
+++ b/simulator/app/MessageStream.h
@@ -17,7 +17,7 @@
 #error DO NOT USE THIS FILE IN THE DEVICE BUILD
 #endif
 
-#include <utils/Pipe.h>
+#include "Pipe.h"
 #include <stdlib.h>
 #include <cutils/uio.h>
 
diff --git a/simulator/app/MyApp.cpp b/simulator/app/MyApp.cpp
index 313e44d..fd610b1 100644
--- a/simulator/app/MyApp.cpp
+++ b/simulator/app/MyApp.cpp
@@ -16,7 +16,7 @@
 
 #include "MainFrame.h"
 #include "MyApp.h"
-#include <utils/executablepath.h>
+#include "executablepath.h"
 
 #include <stdio.h>
 #include <unistd.h>
diff --git a/simulator/app/PhoneCollection.cpp b/simulator/app/PhoneCollection.cpp
index 5cddfa8..e1882cc 100644
--- a/simulator/app/PhoneCollection.cpp
+++ b/simulator/app/PhoneCollection.cpp
@@ -18,7 +18,7 @@
 #include "PhoneData.h"
 #include "MyApp.h"
 
-#include <utils.h>
+#include "utils.h"
 
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/simulator/app/PhoneData.cpp b/simulator/app/PhoneData.cpp
index 48614fd..f15df2b 100644
--- a/simulator/app/PhoneData.cpp
+++ b/simulator/app/PhoneData.cpp
@@ -19,7 +19,7 @@
 #include "PhoneCollection.h"
 #include "MyApp.h"
 
-#include <utils.h>
+#include "utils.h"
 #include <utils/AssetManager.h>
 #include <utils/String8.h>
 
diff --git a/simulator/app/PhoneData.h b/simulator/app/PhoneData.h
index c7f4732..2d7003a 100644
--- a/simulator/app/PhoneData.h
+++ b/simulator/app/PhoneData.h
@@ -22,7 +22,7 @@
 #include "PhoneButton.h"
 #include "LoadableImage.h"
 #include <ui/PixelFormat.h>
-#include <utils.h>
+#include "utils.h"
 
 
 /*
diff --git a/simulator/app/Pipe.cpp b/simulator/app/Pipe.cpp
new file mode 100644
index 0000000..05ce790
--- /dev/null
+++ b/simulator/app/Pipe.cpp
@@ -0,0 +1,465 @@
+/*
+ * Copyright (C) 2005 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// Unidirectional pipe.
+//
+
+#include "Pipe.h"
+#include <utils/Log.h>
+
+#if defined(HAVE_WIN32_IPC)
+# include <windows.h>
+#else
+# include <fcntl.h>
+# include <unistd.h>
+# include <errno.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <string.h>
+
+using namespace android;
+
+const unsigned long kInvalidHandle = (unsigned long) -1;
+
+
+/*
+ * Constructor.  Do little.
+ */
+Pipe::Pipe(void)
+    : mReadNonBlocking(false), mReadHandle(kInvalidHandle),
+      mWriteHandle(kInvalidHandle)
+{
+}
+
+/*
+ * Destructor.  Use the system-appropriate close call.
+ */
+Pipe::~Pipe(void)
+{
+#if defined(HAVE_WIN32_IPC)
+    if (mReadHandle != kInvalidHandle) {
+        if (!CloseHandle((HANDLE)mReadHandle))
+            LOG(LOG_WARN, "pipe", "failed closing read handle (%ld)\n",
+                mReadHandle);
+    }
+    if (mWriteHandle != kInvalidHandle) {
+        FlushFileBuffers((HANDLE)mWriteHandle);
+        if (!CloseHandle((HANDLE)mWriteHandle))
+            LOG(LOG_WARN, "pipe", "failed closing write handle (%ld)\n",
+                mWriteHandle);
+    }
+#else
+    if (mReadHandle != kInvalidHandle) {
+        if (close((int) mReadHandle) != 0)
+            LOG(LOG_WARN, "pipe", "failed closing read fd (%d)\n",
+                (int) mReadHandle);
+    }
+    if (mWriteHandle != kInvalidHandle) {
+        if (close((int) mWriteHandle) != 0)
+            LOG(LOG_WARN, "pipe", "failed closing write fd (%d)\n",
+                (int) mWriteHandle);
+    }
+#endif
+}
+
+/*
+ * Create the pipe.
+ *
+ * Use the POSIX stuff for everything but Windows.
+ */
+bool Pipe::create(void)
+{
+    assert(mReadHandle == kInvalidHandle);
+    assert(mWriteHandle == kInvalidHandle);
+
+#if defined(HAVE_WIN32_IPC)
+    /* we use this across processes, so they need to be inheritable */
+    HANDLE handles[2];
+    SECURITY_ATTRIBUTES saAttr;
+
+    saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
+    saAttr.bInheritHandle = TRUE;
+    saAttr.lpSecurityDescriptor = NULL;
+
+    if (!CreatePipe(&handles[0], &handles[1], &saAttr, 0)) {
+        LOG(LOG_ERROR, "pipe", "unable to create pipe\n");
+        return false;
+    }
+    mReadHandle = (unsigned long) handles[0];
+    mWriteHandle = (unsigned long) handles[1];
+    return true;
+#else
+    int fds[2];
+
+    if (pipe(fds) != 0) {
+        LOG(LOG_ERROR, "pipe", "unable to create pipe\n");
+        return false;
+    }
+    mReadHandle = fds[0];
+    mWriteHandle = fds[1];
+    return true;
+#endif
+}
+
+/*
+ * Create a "half pipe".  Please, no Segway riding.
+ */
+bool Pipe::createReader(unsigned long handle)
+{
+    mReadHandle = handle;
+    assert(mWriteHandle == kInvalidHandle);
+    return true;
+}
+
+/*
+ * Create a "half pipe" for writing.
+ */
+bool Pipe::createWriter(unsigned long handle)
+{
+    mWriteHandle = handle;
+    assert(mReadHandle == kInvalidHandle);
+    return true;
+}
+
+/*
+ * Return "true" if create() has been called successfully.
+ */
+bool Pipe::isCreated(void)
+{
+    // one or the other should be open
+    return (mReadHandle != kInvalidHandle || mWriteHandle != kInvalidHandle);
+}
+
+
+/*
+ * Read data from the pipe.
+ *
+ * For Linux and Darwin, just call read().  For Windows, implement
+ * non-blocking reads by calling PeekNamedPipe first.
+ */
+int Pipe::read(void* buf, int count)
+{
+    assert(mReadHandle != kInvalidHandle);
+
+#if defined(HAVE_WIN32_IPC)
+    DWORD totalBytesAvail = count;
+    DWORD bytesRead;
+
+    if (mReadNonBlocking) {
+        // use PeekNamedPipe to adjust read count expectations
+        if (!PeekNamedPipe((HANDLE) mReadHandle, NULL, 0, NULL,
+                &totalBytesAvail, NULL))
+        {
+            LOG(LOG_ERROR, "pipe", "PeekNamedPipe failed\n");
+            return -1;
+        }
+
+        if (totalBytesAvail == 0)
+            return 0;
+    }
+
+    if (!ReadFile((HANDLE) mReadHandle, buf, totalBytesAvail, &bytesRead,
+            NULL))
+    {
+        DWORD err = GetLastError();
+        if (err == ERROR_HANDLE_EOF || err == ERROR_BROKEN_PIPE)
+            return 0;
+        LOG(LOG_ERROR, "pipe", "ReadFile failed (err=%ld)\n", err);
+        return -1;
+    }
+
+    return (int) bytesRead;
+#else
+    int cc;
+    cc = ::read(mReadHandle, buf, count);
+    if (cc < 0 && errno == EAGAIN)
+        return 0;
+    return cc;
+#endif
+}
+
+/*
+ * Write data to the pipe.
+ *
+ * POSIX systems are trivial, Windows uses a different call and doesn't
+ * handle non-blocking writes.
+ *
+ * If we add non-blocking support here, we probably want to make it an
+ * all-or-nothing write.
+ *
+ * DO NOT use LOG() here, we could be writing a log message.
+ */
+int Pipe::write(const void* buf, int count)
+{
+    assert(mWriteHandle != kInvalidHandle);
+
+#if defined(HAVE_WIN32_IPC)
+    DWORD bytesWritten;
+
+    if (mWriteNonBlocking) {
+        // BUG: can't use PeekNamedPipe() to get the amount of space
+        // left.  Looks like we need to use "overlapped I/O" functions.
+        // I just don't care that much.
+    }
+
+    if (!WriteFile((HANDLE) mWriteHandle, buf, count, &bytesWritten, NULL)) {
+        // can't LOG, use stderr
+        fprintf(stderr, "WriteFile failed (err=%ld)\n", GetLastError());
+        return -1;
+    }
+
+    return (int) bytesWritten;
+#else
+    int cc;
+    cc = ::write(mWriteHandle, buf, count);
+    if (cc < 0 && errno == EAGAIN)
+        return 0;
+    return cc;
+#endif
+}
+
+/*
+ * Figure out if there is data available on the read fd.
+ *
+ * We return "true" on error because we want the caller to try to read
+ * from the pipe.  They'll notice the read failure and do something
+ * appropriate.
+ */
+bool Pipe::readReady(void)
+{
+    assert(mReadHandle != kInvalidHandle);
+
+#if defined(HAVE_WIN32_IPC)
+    DWORD totalBytesAvail;
+
+    if (!PeekNamedPipe((HANDLE) mReadHandle, NULL, 0, NULL,
+            &totalBytesAvail, NULL))
+    {
+        LOG(LOG_ERROR, "pipe", "PeekNamedPipe failed\n");
+        return true;
+    }
+
+    return (totalBytesAvail != 0);
+#else
+    errno = 0;
+    fd_set readfds;
+    struct timeval tv = { 0, 0 };
+    int cc;
+
+    FD_ZERO(&readfds);
+    FD_SET(mReadHandle, &readfds);
+
+    cc = select(mReadHandle+1, &readfds, NULL, NULL, &tv);
+    if (cc < 0) {
+        LOG(LOG_ERROR, "pipe", "select() failed\n");
+        return true;
+    } else if (cc == 0) {
+        /* timed out, nothing available */
+        return false;
+    } else if (cc == 1) {
+        /* our fd is ready */
+        return true;
+    } else {
+        LOG(LOG_ERROR, "pipe", "HUH? select() returned > 1\n");
+        return true;
+    }
+#endif
+}
+
+/*
+ * Enable or disable non-blocking mode for the read descriptor.
+ *
+ * NOTE: the calls succeed under Mac OS X, but the pipe doesn't appear to
+ * actually be in non-blocking mode.  If this matters -- i.e. you're not
+ * using a select() call -- put a call to readReady() in front of the
+ * ::read() call, with a PIPE_NONBLOCK_BROKEN #ifdef in the Makefile for
+ * Darwin.
+ */
+bool Pipe::setReadNonBlocking(bool val)
+{
+    assert(mReadHandle != kInvalidHandle);
+
+#if defined(HAVE_WIN32_IPC)
+    // nothing to do
+#else
+    int flags;
+
+    if (fcntl(mReadHandle, F_GETFL, &flags) == -1) {
+        LOG(LOG_ERROR, "pipe", "couldn't get flags for pipe read fd\n");
+        return false;
+    }
+    if (val)
+        flags |= O_NONBLOCK;
+    else
+        flags &= ~(O_NONBLOCK);
+    if (fcntl(mReadHandle, F_SETFL, &flags) == -1) {
+        LOG(LOG_ERROR, "pipe", "couldn't set flags for pipe read fd\n");
+        return false;
+    }
+#endif
+
+    mReadNonBlocking = val;
+    return true;
+}
+
+/*
+ * Enable or disable non-blocking mode for the write descriptor.
+ *
+ * As with setReadNonBlocking(), this does not work on the Mac.
+ */
+bool Pipe::setWriteNonBlocking(bool val)
+{
+    assert(mWriteHandle != kInvalidHandle);
+
+#if defined(HAVE_WIN32_IPC)
+    // nothing to do
+#else
+    int flags;
+
+    if (fcntl(mWriteHandle, F_GETFL, &flags) == -1) {
+        LOG(LOG_WARN, "pipe",
+            "Warning: couldn't get flags for pipe write fd (errno=%d)\n",
+            errno);
+        return false;
+    }
+    if (val)
+        flags |= O_NONBLOCK;
+    else
+        flags &= ~(O_NONBLOCK);
+    if (fcntl(mWriteHandle, F_SETFL, &flags) == -1) {
+        LOG(LOG_WARN, "pipe",
+            "Warning: couldn't set flags for pipe write fd (errno=%d)\n",
+            errno);
+        return false;
+    }
+#endif
+
+    mWriteNonBlocking = val;
+    return true;
+}
+
+/*
+ * Specify whether a file descriptor can be inherited by a child process.
+ * Under Linux this means setting the close-on-exec flag, under Windows
+ * this is SetHandleInformation(HANDLE_FLAG_INHERIT).
+ */
+bool Pipe::disallowReadInherit(void)
+{
+    if (mReadHandle == kInvalidHandle)
+        return false;
+
+#if defined(HAVE_WIN32_IPC)
+    if (SetHandleInformation((HANDLE) mReadHandle, HANDLE_FLAG_INHERIT, 0) == 0)
+        return false;
+#else
+    if (fcntl((int) mReadHandle, F_SETFD, FD_CLOEXEC) != 0)
+        return false;
+#endif
+    return true;
+}
+bool Pipe::disallowWriteInherit(void)
+{
+    if (mWriteHandle == kInvalidHandle)
+        return false;
+
+#if defined(HAVE_WIN32_IPC)
+    if (SetHandleInformation((HANDLE) mWriteHandle, HANDLE_FLAG_INHERIT, 0) == 0)
+        return false;
+#else
+    if (fcntl((int) mWriteHandle, F_SETFD, FD_CLOEXEC) != 0)
+        return false;
+#endif
+    return true;
+}
+
+/*
+ * Close read descriptor.
+ */
+bool Pipe::closeRead(void)
+{
+    if (mReadHandle == kInvalidHandle)
+        return false;
+
+#if defined(HAVE_WIN32_IPC)
+    if (mReadHandle != kInvalidHandle) {
+        if (!CloseHandle((HANDLE)mReadHandle)) {
+            LOG(LOG_WARN, "pipe", "failed closing read handle\n");
+            return false;
+        }
+    }
+#else
+    if (mReadHandle != kInvalidHandle) {
+        if (close((int) mReadHandle) != 0) {
+            LOG(LOG_WARN, "pipe", "failed closing read fd\n");
+            return false;
+        }
+    }
+#endif
+    mReadHandle = kInvalidHandle;
+    return true;
+}
+
+/*
+ * Close write descriptor.
+ */
+bool Pipe::closeWrite(void)
+{
+    if (mWriteHandle == kInvalidHandle)
+        return false;
+
+#if defined(HAVE_WIN32_IPC)
+    if (mWriteHandle != kInvalidHandle) {
+        if (!CloseHandle((HANDLE)mWriteHandle)) {
+            LOG(LOG_WARN, "pipe", "failed closing write handle\n");
+            return false;
+        }
+    }
+#else
+    if (mWriteHandle != kInvalidHandle) {
+        if (close((int) mWriteHandle) != 0) {
+            LOG(LOG_WARN, "pipe", "failed closing write fd\n");
+            return false;
+        }
+    }
+#endif
+    mWriteHandle = kInvalidHandle;
+    return true;
+}
+
+/*
+ * Get the read handle.
+ */
+unsigned long Pipe::getReadHandle(void)
+{
+    assert(mReadHandle != kInvalidHandle);
+
+    return mReadHandle;
+}
+
+/*
+ * Get the write handle.
+ */
+unsigned long Pipe::getWriteHandle(void)
+{
+    assert(mWriteHandle != kInvalidHandle);
+
+    return mWriteHandle;
+}
+
diff --git a/simulator/app/Pipe.h b/simulator/app/Pipe.h
new file mode 100644
index 0000000..6404168
--- /dev/null
+++ b/simulator/app/Pipe.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2005 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// FIFO I/O.
+//
+#ifndef _LIBS_UTILS_PIPE_H
+#define _LIBS_UTILS_PIPE_H
+
+#ifdef HAVE_ANDROID_OS
+#error DO NOT USE THIS FILE IN THE DEVICE BUILD
+#endif
+
+namespace android {
+
+/*
+ * Simple anonymous unidirectional pipe.
+ *
+ * The primary goal is to create an implementation with minimal overhead
+ * under Linux.  Making Windows, Mac OS X, and Linux all work the same way
+ * is a secondary goal.  Part of this goal is to have something that can
+ * be fed to a select() call, so that the application can sleep in the
+ * kernel until something interesting happens.
+ */
+class Pipe {
+public:
+    Pipe(void);
+    virtual ~Pipe(void);
+
+    /* Create the pipe */
+    bool create(void);
+
+    /* Create a read-only pipe, using the supplied handle as read handle */
+    bool createReader(unsigned long handle);
+    /* Create a write-only pipe, using the supplied handle as write handle */
+    bool createWriter(unsigned long handle);
+
+    /* Is this object ready to go? */
+    bool isCreated(void);
+
+    /*
+     * Read "count" bytes from the pipe.  Returns the amount of data read,
+     * or 0 if no data available and we're non-blocking.
+     * Returns -1 on error.
+     */
+    int read(void* buf, int count);
+
+    /*
+     * Write "count" bytes into the pipe.  Returns number of bytes written,
+     * or 0 if there's no room for more data and we're non-blocking.
+     * Returns -1 on error.
+     */
+    int write(const void* buf, int count);
+
+    /* Returns "true" if data is available to read */
+    bool readReady(void);
+
+    /* Enable or disable non-blocking I/O for reads */
+    bool setReadNonBlocking(bool val);
+    /* Enable or disable non-blocking I/O for writes.  Only works on Linux. */
+    bool setWriteNonBlocking(bool val);
+
+    /*
+     * Get the handle.  Only useful in some platform-specific situations.
+     */
+    unsigned long getReadHandle(void);
+    unsigned long getWriteHandle(void);
+
+    /*
+     * Modify inheritance, i.e. whether or not a child process will get
+     * copies of the descriptors.  Systems with fork+exec allow us to close
+     * the descriptors before launching the child process, but Win32
+     * doesn't allow it.
+     */
+    bool disallowReadInherit(void);
+    bool disallowWriteInherit(void);
+
+    /*
+     * Close one side or the other.  Useful in the parent after launching
+     * a child process.
+     */
+    bool closeRead(void);
+    bool closeWrite(void);
+
+private:
+    bool    mReadNonBlocking;
+    bool    mWriteNonBlocking;
+
+    unsigned long mReadHandle;
+    unsigned long mWriteHandle;
+};
+
+}; // android
+
+#endif // _LIBS_UTILS_PIPE_H
diff --git a/simulator/app/PropertyServer.cpp b/simulator/app/PropertyServer.cpp
index 0047b5d..c94aa75 100644
--- a/simulator/app/PropertyServer.cpp
+++ b/simulator/app/PropertyServer.cpp
@@ -147,6 +147,7 @@
         { "debug.sf.showcpu", "0" },
         { "debug.sf.showbackground", "0" },
         { "debug.sf.showfps", "0" },
+        { "default", "default" },
     };
 
     for (int i = 0; i < NELEM(propList); i++)
diff --git a/simulator/app/UserEventMessage.h b/simulator/app/UserEventMessage.h
index 4a66cc2..9b94ea7 100644
--- a/simulator/app/UserEventMessage.h
+++ b/simulator/app/UserEventMessage.h
@@ -6,7 +6,7 @@
 #ifndef _SIM_USER_EVENT_MESSAGE_H
 #define _SIM_USER_EVENT_MESSAGE_H
 
-#include <utils.h>
+#include "utils.h"
 #include "LogMessage.h"
 
 /*
diff --git a/simulator/app/executablepath.h b/simulator/app/executablepath.h
new file mode 100644
index 0000000..889982d
--- /dev/null
+++ b/simulator/app/executablepath.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _SIM_EXECUTABLEPATH_H
+#define _SIM_EXECUTABLEPATH_H
+
+#include <limits.h>
+
+// returns the path to this executable
+#if __cplusplus
+extern "C"
+#endif
+void executablepath(char s[PATH_MAX]);
+
+#endif // _SIM_EXECUTABLEPATH_H
diff --git a/simulator/app/executablepath_darwin.cpp b/simulator/app/executablepath_darwin.cpp
new file mode 100644
index 0000000..9ec1c18
--- /dev/null
+++ b/simulator/app/executablepath_darwin.cpp
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "executablepath.h"
+#import <Carbon/Carbon.h>
+#include <unistd.h>
+
+void executablepath(char s[PATH_MAX])
+{
+    ProcessSerialNumber psn;
+    GetCurrentProcess(&psn);
+    CFDictionaryRef dict;
+    dict = ProcessInformationCopyDictionary(&psn, 0xffffffff);
+    CFStringRef value = (CFStringRef)CFDictionaryGetValue(dict,
+                CFSTR("CFBundleExecutable"));
+    CFStringGetCString(value, s, PATH_MAX+1, kCFStringEncodingUTF8);
+}
+
diff --git a/simulator/app/executablepath_linux.cpp b/simulator/app/executablepath_linux.cpp
new file mode 100644
index 0000000..e4a3a2b
--- /dev/null
+++ b/simulator/app/executablepath_linux.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "executablepath.h"
+#include <sys/types.h>
+#include <unistd.h>
+#include <limits.h>
+#include <stdio.h>
+
+void executablepath(char exe[PATH_MAX])
+{
+    char proc[100];
+    sprintf(proc, "/proc/%d/exe", getpid());
+    
+    int err = readlink(proc, exe, PATH_MAX);
+}
+
diff --git a/simulator/app/ported.cpp b/simulator/app/ported.cpp
new file mode 100644
index 0000000..232b302
--- /dev/null
+++ b/simulator/app/ported.cpp
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2005 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// Ports of standard functions that don't exist on a specific platform.
+//
+// Note these are NOT in the "android" namespace.
+//
+#include "ported.h"
+
+#if defined(NEED_GETTIMEOFDAY) || defined(NEED_USLEEP)
+# include <sys/time.h>
+# include <windows.h>
+#endif
+
+
+#if defined(NEED_GETTIMEOFDAY)
+/*
+ * Replacement gettimeofday() for Windows environments (primarily MinGW).
+ *
+ * Ignores "tz".
+ */
+int gettimeofday(struct timeval* ptv, struct timezone* tz)
+{
+    long long nsTime;   // time in 100ns units since Jan 1 1601
+    FILETIME ft;
+
+    if (tz != NULL) {
+        // oh well
+    }
+
+    ::GetSystemTimeAsFileTime(&ft);
+    nsTime = (long long) ft.dwHighDateTime << 32 |
+             (long long) ft.dwLowDateTime;
+    // convert to time in usec since Jan 1 1970
+    ptv->tv_usec = (long) ((nsTime / 10LL) % 1000000LL);
+    ptv->tv_sec = (long) ((nsTime - 116444736000000000LL) / 10000000LL);
+
+    return 0;
+}
+#endif
+
+#if defined(NEED_USLEEP)
+//
+// Replacement usleep for Windows environments (primarily MinGW).
+//
+void usleep(unsigned long usec)
+{
+    // Win32 API function Sleep() takes milliseconds
+    ::Sleep((usec + 500) / 1000);
+}
+#endif
+
+#if 0 //defined(NEED_PIPE)
+//
+// Replacement pipe() command for MinGW
+//
+// The _O_NOINHERIT flag sets bInheritHandle to FALSE in the
+// SecurityAttributes argument to CreatePipe().  This means the handles
+// aren't inherited when a new process is created.  The examples I've seen
+// use it, possibly because there's a lot of junk going on behind the
+// scenes.  (I'm assuming "process" and "thread" are different here, so
+// we should be okay spinning up a thread.)  The recommended practice is
+// to dup() the descriptor you want the child to have.
+//
+// It appears that unnamed pipes can't do non-blocking ("overlapped") I/O.
+// You can't use select() either, since that only works on sockets.  The
+// Windows API calls that are useful here all operate on a HANDLE, not
+// an integer file descriptor, and I don't think you can get there from
+// here.  The "named pipe" stuff is insane.
+//
+int pipe(int filedes[2])
+{
+    return _pipe(filedes, 0, _O_BINARY | _O_NOINHERIT);
+}
+#endif
+
+#if defined(NEED_SETENV)
+/*
+ * MinGW lacks these.  For now, just stub them out so the code compiles.
+ */
+int setenv(const char* name, const char* value, int overwrite)
+{
+    return 0;
+}
+void unsetenv(const char* name)
+{
+}
+char* getenv(const char* name)
+{
+    return NULL;
+}
+#endif
diff --git a/simulator/app/ported.h b/simulator/app/ported.h
new file mode 100644
index 0000000..eb3be01
--- /dev/null
+++ b/simulator/app/ported.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2005 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// Standard functions ported to the current platform.  Note these are NOT
+// in the "android" namespace.
+//
+#ifndef _LIBS_UTILS_PORTED_H
+#define _LIBS_UTILS_PORTED_H
+
+#include <sys/time.h>       // for timeval
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* library replacement functions */
+#if defined(NEED_GETTIMEOFDAY)
+int gettimeofday(struct timeval* tv, struct timezone* tz);
+#endif
+#if defined(NEED_USLEEP)
+void usleep(unsigned long usec);
+#endif
+#if defined(NEED_PIPE)
+int pipe(int filedes[2]);
+#endif
+#if defined(NEED_SETENV)
+int setenv(const char* name, const char* value, int overwrite);
+void unsetenv(const char* name);
+char* getenv(const char* name);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _LIBS_UTILS_PORTED_H
diff --git a/simulator/app/utils.h b/simulator/app/utils.h
new file mode 100644
index 0000000..b74845f
--- /dev/null
+++ b/simulator/app/utils.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2005 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// Handy utility functions and portability code.  This file includes all
+// of the generally-useful headers in the "utils" directory.
+//
+#ifndef _SIM_UTILS_H
+#define _SIM_UTILS_H
+
+#include "ported.h"
+#include <utils/Log.h>
+#include <utils/threads.h>
+#include <utils/Timers.h>
+#include <utils/List.h>
+#include <utils/StringArray.h>
+#include <utils/misc.h>
+#include <utils/Errors.h>
+
+#endif // _SIM_UTILS_H
diff --git a/simulator/wrapsim/Android.mk b/simulator/wrapsim/Android.mk
index 0b7890d..f9a2414 100644
--- a/simulator/wrapsim/Android.mk
+++ b/simulator/wrapsim/Android.mk
@@ -3,7 +3,6 @@
 #
 # Build instructions for simulator LD_PRELOAD wrapper.
 #
-ifneq ($(TARGET_ARCH),arm)
 ifeq ($(TARGET_SIMULATOR),true)
 
 LOCAL_PATH:= $(call my-dir)
@@ -23,7 +22,8 @@
 	Intercept.c \
 	Log.c \
 	SimMgr.c \
-	SysPower.c
+	SysPower.c \
+	Util.c
 
 LOCAL_C_INCLUDES += prebuilt/common/esd
 
@@ -55,5 +55,3 @@
 include $(BUILD_EXECUTABLE)
 
 endif # ifeq ($(TARGET_SIMULATOR),true)
-endif
-# ifneq ($(TARGET_ARCH),arm)
diff --git a/simulator/wrapsim/Common.h b/simulator/wrapsim/Common.h
index a9c3bb8..463262f 100644
--- a/simulator/wrapsim/Common.h
+++ b/simulator/wrapsim/Common.h
@@ -14,5 +14,6 @@
 #include "Log.h"
 #include "SimMgr.h"
 #include "Globals.h"
+#include "Util.h"
 
 #endif /*_WRAPSIM_COMMON_H*/
diff --git a/simulator/wrapsim/DevEvent.c b/simulator/wrapsim/DevEvent.c
index 692856e..60060f4 100644
--- a/simulator/wrapsim/DevEvent.c
+++ b/simulator/wrapsim/DevEvent.c
@@ -31,14 +31,34 @@
  * (For now, just pretend to be a "goldfish" like the emulator.)
  */
 static const unsigned char gKeyBitMask[64] = {
+    // These bits indicate which keys the device has
     0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
     0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
     0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
     0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
-    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
-    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
-    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
-    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
+    // These bits indicate other capabilities, such
+    // as whether it's a trackball or a touchscreen
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // touchscreen
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+/*
+ * Abs bit mask, for EVIOCGBIT(EV_ABS).
+ *
+ * Pretend to be a normal single touch panel
+ */
+static const unsigned char gAbsBitMask[64] = {
+    // these bits indicate the capabilities of the touch screen
+    0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ABS_X, ABS_Y
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 };
 
 /*
@@ -193,7 +213,9 @@
     } else if (!getenv("NOTOUCH") && _IOC_NR(urequest) == _IOC_NR(EVIOCGBIT(EV_ABS,0))) {
         // absolute controllers (touch screen)
         int maxLen = _IOC_SIZE(urequest);
-        memset(argp, 0xff, maxLen);
+        if (maxLen > (int) sizeof(gAbsBitMask))
+            maxLen = sizeof(gAbsBitMask);
+        memcpy(argp, gAbsBitMask, maxLen);
 
     } else if (_IOC_NR(urequest) >= _IOC_NR(EVIOCGABS(ABS_X)) &&
                _IOC_NR(urequest) <= _IOC_NR(EVIOCGABS(ABS_MAX)))
diff --git a/simulator/wrapsim/DevFb.c b/simulator/wrapsim/DevFb.c
index c54403e..bfdbb22 100644
--- a/simulator/wrapsim/DevFb.c
+++ b/simulator/wrapsim/DevFb.c
@@ -14,6 +14,10 @@
 #include <linux/fb.h>
 
 typedef struct FbState {
+
+    /* refcount for dup() */
+    int refCount;
+
     /* index into gWrapSim.display[] */
     int     displayIdx;
 
@@ -77,7 +81,13 @@
  */
 static void freeState(FbState* fbState)
 {
-    free(fbState);
+    int oldcount;
+
+    oldcount = wsAtomicAdd(&fbState->refCount, -1);
+
+    if (oldcount == 0) {
+        free(fbState);
+    }
 }
 
 /*
@@ -242,6 +252,28 @@
 }
 
 /*
+ * dup() an existing fake descriptor
+ */
+static FakeDev* dupFb(FakeDev* dev, int fd)
+{
+    FakeDev* newDev = wsCreateFakeDev(dev->debugName);
+    if (newDev != NULL) {
+        newDev->mmap = mmapFb;
+        newDev->ioctl = ioctlFb;
+        newDev->close = closeFb;
+        newDev->dup = dupFb;
+
+        /* use state from existing FakeDev */
+        FbState* fbState = dev->state;
+        wsAtomicAdd(&fbState->refCount, 1);
+
+        newDev->state = fbState;
+    }
+
+    return newDev;
+}
+
+/*
  * Open the console TTY device, which responds to a collection of ioctl()s.
  */
 FakeDev* wsOpenDevFb(const char* pathName, int flags)
@@ -251,6 +283,7 @@
         newDev->mmap = mmapFb;
         newDev->ioctl = ioctlFb;
         newDev->close = closeFb;
+        newDev->dup = dupFb;
 
         FbState* fbState = calloc(1, sizeof(FbState));
 
diff --git a/simulator/wrapsim/FakeDev.c b/simulator/wrapsim/FakeDev.c
index 7d2494e..f03dd29 100644
--- a/simulator/wrapsim/FakeDev.c
+++ b/simulator/wrapsim/FakeDev.c
@@ -99,6 +99,11 @@
 {
     return 0;
 }
+static FakeDev* noDup(FakeDev* dev, ...)
+{
+    notImplemented(dev, "dup");
+    return NULL;
+}
 static int noRead(FakeDev* dev, ...)
 {
     return notImplemented(dev, "read");
@@ -146,6 +151,7 @@
     newDev->state = NULL;
 
     newDev->close = (Fake_close) noClose;
+    newDev->dup = (Fake_dup) noDup;
     newDev->read = (Fake_read) noRead;
     newDev->readv = (Fake_readv) noReadv;
     newDev->write = (Fake_write) noWrite;
diff --git a/simulator/wrapsim/FakeDev.h b/simulator/wrapsim/FakeDev.h
index 4781cfc..65f47ae 100644
--- a/simulator/wrapsim/FakeDev.h
+++ b/simulator/wrapsim/FakeDev.h
@@ -12,13 +12,14 @@
 
 typedef struct FakeDev FakeDev;
 
-typedef int     (*Fake_close)(FakeDev* dev, int);
-typedef ssize_t (*Fake_read)(FakeDev* dev, int, void*, size_t);
-typedef ssize_t (*Fake_readv)(FakeDev* dev, int, const struct iovec*, int);
-typedef ssize_t (*Fake_write)(FakeDev* dev, int, const void*, size_t);
-typedef ssize_t (*Fake_writev)(FakeDev* dev, int, const struct iovec*, int);
-typedef void*   (*Fake_mmap)(FakeDev* dev, void*, size_t, int, int, int, __off_t);
-typedef int     (*Fake_ioctl)(FakeDev* dev, int, int, void*);
+typedef int      (*Fake_close)(FakeDev* dev, int);
+typedef FakeDev* (*Fake_dup)(FakeDev* dev, int);
+typedef ssize_t  (*Fake_read)(FakeDev* dev, int, void*, size_t);
+typedef ssize_t  (*Fake_readv)(FakeDev* dev, int, const struct iovec*, int);
+typedef ssize_t  (*Fake_write)(FakeDev* dev, int, const void*, size_t);
+typedef ssize_t  (*Fake_writev)(FakeDev* dev, int, const struct iovec*, int);
+typedef void*    (*Fake_mmap)(FakeDev* dev, void*, size_t, int, int, int, __off_t);
+typedef int      (*Fake_ioctl)(FakeDev* dev, int, int, void*);
 
 /*
  * An open fake device entry.
@@ -42,6 +43,7 @@
      * All other file descriptor operations should fail, usually with EBADF.
      */
     Fake_close  close;
+    Fake_dup  dup;
     Fake_read   read;
     Fake_readv  readv;
     Fake_write  write;
diff --git a/simulator/wrapsim/Globals.h b/simulator/wrapsim/Globals.h
index 75c98d8..a8d834c 100644
--- a/simulator/wrapsim/Globals.h
+++ b/simulator/wrapsim/Globals.h
@@ -29,6 +29,7 @@
 typedef int     (*Func_open64)(const char*, int, mode_t);
 
 typedef int     (*Func_close)(int);
+typedef int     (*Func_dup)(int);
 typedef ssize_t (*Func_read)(int, void*, size_t);
 typedef ssize_t (*Func_readv)(int, const struct iovec*, int);
 typedef ssize_t (*Func_write)(int, const void*, size_t);
@@ -95,6 +96,7 @@
 EXTERN_FUNC Func_open64 _ws_open64;
 
 EXTERN_FUNC Func_close _ws_close;
+EXTERN_FUNC Func_dup _ws_dup;
 EXTERN_FUNC Func_read _ws_read;
 EXTERN_FUNC Func_readv _ws_readv;
 EXTERN_FUNC Func_write _ws_write;
@@ -201,6 +203,9 @@
     pthread_mutex_t fakeFdLock;
     BitVector*  fakeFdMap;
     FakeDev*    fakeFdList[kMaxFakeFdCount];
+
+    /* used for wsAtomicAdd */
+    pthread_mutex_t atomicLock;
 };
 
 extern struct WrapSimGlobals gWrapSim;
diff --git a/simulator/wrapsim/Init.c b/simulator/wrapsim/Init.c
index eed650b..3df0efe 100644
--- a/simulator/wrapsim/Init.c
+++ b/simulator/wrapsim/Init.c
@@ -40,6 +40,7 @@
     _ws_open64 = dlsym(RTLD_NEXT, "open64");
 
     _ws_close = dlsym(RTLD_NEXT, "close");
+    _ws_dup = dlsym(RTLD_NEXT, "dup");
     _ws_read = dlsym(RTLD_NEXT, "read");
     _ws_readv = dlsym(RTLD_NEXT, "readv");
     _ws_write = dlsym(RTLD_NEXT, "write");
@@ -108,6 +109,8 @@
     gWrapSim.fakeFdMap = wsAllocBitVector(kMaxFakeFdCount, 0);
     memset(gWrapSim.fakeFdList, 0, sizeof(gWrapSim.fakeFdList));
 
+    pthread_mutex_init(&gWrapSim.atomicLock, NULL);
+
     gWrapSim.numDisplays = 0;
 
     gWrapSim.keyInputDevice = NULL;
diff --git a/simulator/wrapsim/Intercept.c b/simulator/wrapsim/Intercept.c
index 49d77ee..3d4edb2 100644
--- a/simulator/wrapsim/Intercept.c
+++ b/simulator/wrapsim/Intercept.c
@@ -160,7 +160,7 @@
     _rtype _fname( __VA_ARGS__ )
 #define PASS_THROUGH_BODY(_fname, _patharg, ...)                            \
     {                                                                       \
-        CALLTRACEV("%s\n", __FUNCTION__);                                   \
+        CALLTRACEV("%s(%s)\n", __FUNCTION__, _patharg);                     \
         char pathBuf[PATH_MAX];                                             \
         return _ws_##_fname(rewritePath(#_fname, pathBuf, _patharg),        \
             ##__VA_ARGS__);                                                 \
@@ -631,6 +631,30 @@
 }
 
 
+int dup(int fd)
+{
+    CALLTRACEV("%s(%d)\n", __FUNCTION__, fd);
+
+    FakeDev* dev = wsFakeDevFromFd(fd);
+    if (dev != NULL) {
+        FakeDev* newDev = dev->dup(dev, fd);
+        if (newDev != NULL) {
+            /*
+             * Now that the device entry is ready, add it to the list.
+             */
+            wsLog("## dup'ed fake dev %d: '%s' %p\n",
+                newDev->fd, newDev->debugName, newDev->state);
+            gWrapSim.fakeFdList[newDev->fd - kFakeFdBase] = newDev;
+            return newDev->fd;
+        }
+        return -1;
+    } else {
+        CALLTRACE("dup(%d)\n", fd);
+        return _ws_dup(fd);
+    }
+}
+
+
 /*
  * Close a file descriptor.
  */
@@ -799,6 +823,16 @@
     return 0;
 }
 
+/*
+ * Pretend to be running as root, so the Android framework
+ * doesn't complain about permission problems all over the
+ * place.
+ */
+uid_t getuid(void)
+{
+    return 0;
+}
+
 #if 0
 /*
  * Create a pipe.  (Only needed for debugging an fd leak.)
diff --git a/simulator/wrapsim/Util.c b/simulator/wrapsim/Util.c
new file mode 100644
index 0000000..33d903b
--- /dev/null
+++ b/simulator/wrapsim/Util.c
@@ -0,0 +1,13 @@
+
+#include "Common.h"
+
+int wsAtomicAdd(int *var, int val)
+{
+    int cc;
+    int ret;
+    cc = pthread_mutex_lock(&gWrapSim.atomicLock);
+    ret = *var;
+    *var = *var + val;
+    cc = pthread_mutex_unlock(&gWrapSim.atomicLock);
+    return ret;
+}
diff --git a/simulator/wrapsim/Util.h b/simulator/wrapsim/Util.h
new file mode 100644
index 0000000..e470802
--- /dev/null
+++ b/simulator/wrapsim/Util.h
@@ -0,0 +1,4 @@
+
+
+
+int wsAtomicAdd(int *var, int val);
diff --git a/testrunner/am_instrument_parser.py b/testrunner/am_instrument_parser.py
index cad87c0..4554c4d 100755
--- a/testrunner/am_instrument_parser.py
+++ b/testrunner/am_instrument_parser.py
@@ -80,7 +80,7 @@
     code.
   """
 
-  re_result = re.compile(r'INSTRUMENTATION_RESULT: ([^=]+)=(.+)$')
+  re_result = re.compile(r'INSTRUMENTATION_RESULT: ([^=]+)=(.*)$')
   re_code = re.compile(r'INSTRUMENTATION_CODE: (\-?\d)$')
   result_dict = {}
   key = ''
@@ -135,38 +135,26 @@
     self._test_name = None
     self._status_code = None
     self._failure_reason = None
+    self._fields_map = {}
 
-    re_start_block = re.compile(
-       r'\s*INSTRUMENTATION_STATUS: stream=(?P<stream>.*)'
-        'INSTRUMENTATION_STATUS: test=(?P<test>\w+)\s+'
-        'INSTRUMENTATION_STATUS: class=(?P<class>[\w\.]+)\s+'
-        'INSTRUMENTATION_STATUS: current=(?P<current>\d+)\s+'
-        'INSTRUMENTATION_STATUS: numtests=(?P<numtests>\d+)\s+'
-        'INSTRUMENTATION_STATUS: id=.*\s+'
-        'INSTRUMENTATION_STATUS_CODE: 1\s*', re.DOTALL)
+    re_status_code = re.search(r'INSTRUMENTATION_STATUS_CODE: '
+        '(?P<status_code>1|0|-1|-2)', result_block_string)
+    re_fields = re.compile(r'INSTRUMENTATION_STATUS: '
+        '(?P<key>[\w.]+)=(?P<value>.*?)(?=\nINSTRUMENTATION_STATUS)', re.DOTALL)
 
-    re_end_block = re.compile(
-       r'\s*INSTRUMENTATION_STATUS: stream=(?P<stream>.*)'
-        'INSTRUMENTATION_STATUS: test=(?P<test>\w+)\s+'
-        '(INSTRUMENTATION_STATUS: stack=(?P<stack>.*))?'
-        'INSTRUMENTATION_STATUS: class=(?P<class>[\w\.]+)\s+'
-        'INSTRUMENTATION_STATUS: current=(?P<current>\d+)\s+'
-        'INSTRUMENTATION_STATUS: numtests=(?P<numtests>\d+)\s+'
-        'INSTRUMENTATION_STATUS: id=.*\s+'
-        'INSTRUMENTATION_STATUS_CODE: (?P<status_code>0|-1|-2)\s*', re.DOTALL)
+    for field in re_fields.finditer(result_block_string):
+      key, value = (field.group('key').strip(), field.group('value').strip())
+      if key.startswith('performance.'):
+        key = key[len('performance.'):]
+      self._fields_map[key] = value
+    self._fields_map.setdefault('class')
+    self._fields_map.setdefault('test')
 
-    start_block_match = re_start_block.match(result_block_string)
-    end_block_match = re_end_block.match(result_block_string)
-
-    if start_block_match:
-      self._test_name = "%s:%s" % (start_block_match.group('class'),
-                                   start_block_match.group('test'))
-      self._status_code = 1
-    elif end_block_match:
-      self._test_name = "%s:%s" % (end_block_match.group('class'),
-                                   end_block_match.group('test'))
-      self._status_code = int(end_block_match.group('status_code'))
-      self._failure_reason = end_block_match.group('stack')
+    self._test_name = '%s:%s' % (self._fields_map['class'],
+                                 self._fields_map['test'])
+    self._status_code = int(re_status_code.group('status_code'))
+    if 'stack' in self._fields_map:
+      self._failure_reason = self._fields_map['stack']
 
   def GetTestName(self):
     return self._test_name
@@ -176,3 +164,6 @@
 
   def GetFailureReason(self):
     return self._failure_reason
+
+  def GetResultFields(self):
+    return self._fields_map
diff --git a/testrunner/android_manifest.py b/testrunner/android_manifest.py
index 7ede96c..5825118 100644
--- a/testrunner/android_manifest.py
+++ b/testrunner/android_manifest.py
@@ -22,6 +22,7 @@
 """
 
 # python imports
+import os
 import xml.dom.minidom
 import xml.parsers
 
@@ -29,22 +30,26 @@
 class AndroidManifest(object):
   """In memory representation of AndroidManifest.xml file."""
 
-  FILENAME = "AndroidManifest.xml"
+  FILENAME = 'AndroidManifest.xml'
 
   def __init__(self, app_path=None):
     if app_path:
       self.ParseManifest(app_path)
 
+  def GetAppPath(self):
+    """Retrieve file system path to this manifest file's directory."""
+    return self._app_path
+
   def GetPackageName(self):
     """Retrieve package name defined at <manifest package="...">.
 
     Returns:
       Package name if defined, otherwise None
     """
-    manifests = self._dom.getElementsByTagName("manifest")
-    if not manifests or not manifests[0].getAttribute("package"):
+    manifest = self._GetManifestElement()
+    if not manifest or not manifest.hasAttribute('package'):
       return None
-    return manifests[0].getAttribute("package")
+    return manifest.getAttribute('package')
 
   def ParseManifest(self, app_path):
     """Parse AndroidManifest.xml at the specified path.
@@ -55,6 +60,51 @@
       IOError: AndroidManifest.xml cannot be found at given path, or cannot be
           opened for reading
     """
-    self.app_path = app_path.rstrip("/")
-    self.manifest_path = "%s/%s" % (self.app_path, self.FILENAME)
-    self._dom = xml.dom.minidom.parse(self.manifest_path)
+    self._app_path = app_path
+    self._manifest_path = os.path.join(app_path, self.FILENAME)
+    self._dom = xml.dom.minidom.parse(self._manifest_path)
+
+  def AddUsesSdk(self, min_sdk_version):
+    """Adds a uses-sdk element to manifest.
+
+    Args:
+      min_sdk_version: value to provide for minSdkVersion attribute.
+    """
+    manifest = self._GetManifestElement()
+    uses_sdk_elements = manifest.getElementsByTagName('uses-sdk')
+    if uses_sdk_elements:
+      uses_sdk_element = uses_sdk_elements[0]
+    else:
+      uses_sdk_element = self._dom.createElement('uses-sdk')
+      manifest.appendChild(uses_sdk_element)
+
+    uses_sdk_element.setAttribute('android:minSdkVersion', min_sdk_version)
+    self._SaveXml()
+
+  def GetInstrumentationNames(self):
+    """Get the instrumentation names from manifest.
+
+    Returns:
+      list of names, might be empty
+    """
+    instr_elements = self._dom.getElementsByTagName('instrumentation')
+    instrs = []
+    for element in instr_elements:
+      instrs.append(element.getAttribute('android:name'))
+    return instrs
+
+  def _GetManifestElement(self):
+    """Retrieve the root manifest element.
+
+    Returns:
+      the DOM element for manifest or None.
+    """
+    manifests = self._dom.getElementsByTagName('manifest')
+    if not manifests:
+      return None
+    return manifests[0]
+
+  def _SaveXml(self):
+    """Saves the manifest to disk."""
+    self._dom.writexml(open(self._manifest_path, mode='w'), encoding='utf-8')
+
diff --git a/testrunner/coverage_targets.xml b/testrunner/coverage_targets.xml
index 32a4856..1d7707b 100644
--- a/testrunner/coverage_targets.xml
+++ b/testrunner/coverage_targets.xml
@@ -79,7 +79,6 @@
         type="APPS" />
     <coverage_target name="Launcher" build_path="packages/apps/Home"
         type="APPS" />
-    <coverage_target name="IM" build_path="packages/apps/IM" type="APPS" />
     <coverage_target name="Mms" build_path="packages/apps/Mms" type="APPS" />
     <coverage_target name="Music" build_path="packages/apps/Music"
         type="APPS" />
diff --git a/testrunner/run_command.py b/testrunner/run_command.py
index 7d1f547..d398daa 100755
--- a/testrunner/run_command.py
+++ b/testrunner/run_command.py
@@ -34,16 +34,25 @@
   global _abort_on_error
   _abort_on_error = abort
 
-def RunCommand(cmd, timeout_time=None, retry_count=3, return_output=True):
-  """Spawns a subprocess to run the given shell command, and checks for
-  timeout_time. If return_output is True, the output of the command is returned
-  as a string. Otherwise, output of command directed to stdout """
+def RunCommand(cmd, timeout_time=None, retry_count=3, return_output=True,
+               stdin_input=None):
+  """Spawn and retry a subprocess to run the given shell command.
 
+  Args:
+    cmd: shell command to run
+    timeout_time: time in seconds to wait for command to run before aborting.
+    retry_count: number of times to retry command
+    return_output: if True return output of command as string. Otherwise,
+      direct output of command to stdout.
+    stdin_input: data to feed to stdin
+  Returns:
+    output of command
+  """
   result = None
   while True:
     try:
       result = RunOnce(cmd, timeout_time=timeout_time,
-                       return_output=return_output)
+                       return_output=return_output, stdin_input=stdin_input)
     except errors.WaitForResponseTimedOutError:
       if retry_count == 0:
         raise
@@ -53,7 +62,22 @@
       # Success
       return result
 
-def RunOnce(cmd, timeout_time=None, return_output=True):
+def RunOnce(cmd, timeout_time=None, return_output=True, stdin_input=None):
+  """Spawns a subprocess to run the given shell command.
+
+  Args:
+    cmd: shell command to run
+    timeout_time: time in seconds to wait for command to run before aborting.
+    return_output: if True return output of command as string. Otherwise,
+      direct output of command to stdout.
+    stdin_input: data to feed to stdin
+  Returns:
+    output of command
+  Raises:
+    errors.WaitForResponseTimedOutError if command did not complete within
+      timeout_time seconds.
+    errors.AbortError is command returned error code and SetAbortOnError is on.
+  """
   start_time = time.time()
   so = []
   pid = []
@@ -67,15 +91,20 @@
     else:
       # None means direct to stdout
       output_dest = None
+    if stdin_input:
+      stdin_dest = subprocess.PIPE
+    else:
+      stdin_dest = None
     pipe = subprocess.Popen(
         cmd,
         executable='/bin/bash',
+        stdin=stdin_dest,
         stdout=output_dest,
         stderr=subprocess.STDOUT,
         shell=True)
     pid.append(pipe.pid)
     try:
-      output = pipe.communicate()[0]
+      output = pipe.communicate(input=stdin_input)[0]
       if output is not None and len(output) > 0:
         so.append(output)
     except OSError, e:
@@ -83,7 +112,7 @@
       logger.Log(e)
       so.append("ERROR")
       error_occurred = True
-    if pipe.returncode != 0:
+    if pipe.returncode:
       logger.SilentLog("Error: %s returned %d error code" %(cmd,
           pipe.returncode))
       error_occurred = True
@@ -144,7 +173,7 @@
   else:
     # Need the full path to valgrind to avoid other versions on the system.
     subproc = subprocess.Popen(["/usr/bin/valgrind", "--tool=memcheck",
-                                "--leak-check=yes", "-q", full_path],
+                                "--leak-check=yes", "-q", binary],
                                stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
     # Cannot rely on the retcode of valgrind. Instead look for an empty output.
     valgrind_out = subproc.communicate()[0].strip()
diff --git a/testrunner/runtest.py b/testrunner/runtest.py
index 593d11d..a4d7231 100755
--- a/testrunner/runtest.py
+++ b/testrunner/runtest.py
@@ -14,9 +14,19 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-"""Command line utility for running a pre-defined test.
+"""Command line utility for running Android tests
 
-Based on previous <androidroot>/development/tools/runtest shell script.
+runtest helps automate the instructions for building and running tests
+- It builds the corresponding test package for the code you want to test
+- It pushes the test package to your device or emulator
+- It launches InstrumentationTestRunner (or similar) to run the tests you
+specify.
+
+runtest supports running tests whose attributes have been pre-defined in
+_TEST_FILE_NAME files, (runtest <testname>), or by specifying the file
+system path to the test to run (runtest --path <path>).
+
+Do runtest --help to see full list of options.
 """
 
 # Python imports
@@ -34,6 +44,7 @@
 import logger
 import run_command
 from test_defs import test_defs
+from test_defs import test_walker
 
 
 class TestRunner(object):
@@ -56,6 +67,9 @@
       "The runtest script works in two ways.  You can query it "
       "for a list of tests, or you can launch one or more tests.")
 
+  # default value for make -jX
+  _DEFAULT_JOBS = 4
+
   def __init__(self):
     # disable logging of timestamp
     self._root_path = android_build.GetTop()
@@ -64,6 +78,7 @@
     self._known_tests = None
     self._options = None
     self._test_args = None
+    self._tests_to_run = None
 
   def _ProcessOptions(self):
     """Processes command-line options."""
@@ -78,6 +93,9 @@
                       help="To view the list of tests")
     parser.add_option("-b", "--skip-build", dest="skip_build", default=False,
                       action="store_true", help="Skip build - just launch")
+    parser.add_option("-j", "--jobs", dest="make_jobs",
+                      metavar="X", default=self._DEFAULT_JOBS,
+                      help="Number of make jobs to use when building")
     parser.add_option("-n", "--skip_execute", dest="preview", default=False,
                       action="store_true",
                       help="Do not execute, just preview commands")
@@ -108,6 +126,8 @@
     parser.add_option("-o", "--coverage", dest="coverage",
                       default=False, action="store_true",
                       help="Generate code coverage metrics for test(s)")
+    parser.add_option("-x", "--path", dest="test_path",
+                      help="Run test(s) at given file system path")
     parser.add_option("-t", "--all-tests", dest="all_tests",
                       default=False, action="store_true",
                       help="Run all defined tests")
@@ -139,6 +159,7 @@
         and not self._options.all_tests
         and not self._options.continuous_tests
         and not self._options.cts_tests
+        and not self._options.test_path
         and len(self._test_args) < 1):
       parser.print_help()
       logger.SilentLog("at least one test name must be specified")
@@ -186,26 +207,46 @@
 
   def _DumpTests(self):
     """Prints out set of defined tests."""
-    print "The following tests are currently defined:"
+    print "The following tests are currently defined:\n"
+    print "%-25s %-40s %s" % ("name", "build path", "description")
+    print "-" * 80
     for test in self._known_tests:
-      print "%-15s %s" % (test.GetName(), test.GetDescription())
+      print "%-25s %-40s %s" % (test.GetName(), test.GetBuildPath(),
+                                test.GetDescription())
+    print "\nSee %s for more information" % self._TEST_FILE_NAME
 
   def _DoBuild(self):
     logger.SilentLog("Building tests...")
     target_set = Set()
     extra_args_set = Set()
-    for test_suite in self._GetTestsToRun():
+    tests = self._GetTestsToRun()
+    for test_suite in tests:
       self._AddBuildTarget(test_suite, target_set, extra_args_set)
 
     if target_set:
       if self._options.coverage:
         coverage.EnableCoverageBuild()
+
+      # hack to build cts dependencies
+      # TODO: remove this when build dependency support added to runtest or
+      # cts dependencies are removed
+      if self._IsCtsTests(tests):
+        # need to use make since these fail building with ONE_SHOT_MAKEFILE
+        cmd = ('make -j%s CtsTestStubs android.core.tests.runner' %
+               self._options.make_jobs)
+        logger.Log(cmd)
+        if not self._options.preview:
+          old_dir = os.getcwd()
+          os.chdir(self._root_path)
+          run_command.RunCommand(cmd, return_output=False)
+          os.chdir(old_dir)
       target_build_string = " ".join(list(target_set))
       extra_args_string = " ".join(list(extra_args_set))
       # mmm cannot be used from python, so perform a similar operation using
       # ONE_SHOT_MAKEFILE
-      cmd = 'ONE_SHOT_MAKEFILE="%s" make -C "%s" files %s' % (
-          target_build_string, self._root_path, extra_args_string)
+      cmd = 'ONE_SHOT_MAKEFILE="%s" make -j%s -C "%s" files %s' % (
+          target_build_string, self._options.make_jobs, self._root_path,
+          extra_args_string)
       logger.Log(cmd)
 
       if self._options.preview:
@@ -230,25 +271,41 @@
       if os.path.isfile(os.path.join(self._root_path, build_file_path)):
         target_set.add(build_file_path)
         return True
+      else:
+        logger.Log("%s has no Android.mk, skipping" % build_dir)
     return False
 
   def _GetTestsToRun(self):
     """Get a list of TestSuite objects to run, based on command line args."""
+    if self._tests_to_run:
+      return self._tests_to_run
+
+    self._tests_to_run = []
     if self._options.all_tests:
-      return self._known_tests.GetTests()
+      self._tests_to_run = self._known_tests.GetTests()
     elif self._options.continuous_tests:
-      return self._known_tests.GetContinuousTests()
+      self._tests_to_run = self._known_tests.GetContinuousTests()
     elif self._options.cts_tests:
-      return self._known_tests.GetCtsTests()
-    tests = []
+      self._tests_to_run = self._known_tests.GetCtsTests()
+    elif self._options.test_path:
+      walker = test_walker.TestWalker()
+      self._tests_to_run = walker.FindTests(self._options.test_path)
+
     for name in self._test_args:
       test = self._known_tests.GetTest(name)
       if test is None:
         logger.Log("Error: Could not find test %s" % name)
         self._DumpTests()
         raise errors.AbortError
-      tests.append(test)
-    return tests
+      self._tests_to_run.append(test)
+    return self._tests_to_run
+
+  def _IsCtsTests(self, test_list):
+    """Check if any cts tests are included in given list of tests to run."""
+    for test in test_list:
+      if test.IsCts():
+        return True
+    return False
 
   def RunTests(self):
     """Main entry method - executes the tests according to command line args."""
diff --git a/testrunner/test_defs.xml b/testrunner/test_defs.xml
index 6f073bb..0197a66 100644
--- a/testrunner/test_defs.xml
+++ b/testrunner/test_defs.xml
@@ -44,6 +44,12 @@
     coverage_target="framework"
     continuous="true" />
 
+<test name="account"
+    build_path="frameworks/base/tests/AndroidTests"
+    package="com.android.unit_tests"
+    class="com.android.unit_tests.accounts.AccountManagerServiceTest"
+    coverage_target="framework" />
+
 <test name="smoke"
     build_path="frameworks/base/tests/SmokeTest"
     package="com.android.smoketest.tests"
@@ -66,8 +72,7 @@
 <test name="apidemos"
     build_path="development/samples/ApiDemos"
     package="com.example.android.apis.tests"
-    coverage_target="ApiDemos"
-    continuous="true" />
+    coverage_target="ApiDemos" />
 
 <test name="launchperf"
     build_path="development/apps/launchperf"
@@ -88,6 +93,13 @@
     class="com.android.unit_tests.activity.ActivityTests"
     coverage_target="framework" />
 
+<test name="keystore-unit"
+    build_path="frameworks/base/keystore/tests"
+    package="android.security.tests"
+    runner=".KeyStoreTestRunner"
+    coverage_target="framework"
+    continuous="true" />
+
 <test name="vpntests"
     build_path="frameworks/base/tests/AndroidTests"
     package="com.android.unit_tests"
@@ -103,6 +115,12 @@
  -->
 
 
+<test name="contentprovideroperation"
+    build_path="frameworks/base/tests/FrameworkTest"
+    package="com.android.frameworktest.tests"
+    class="android.content.ContentProviderOperationTest"
+    coverage_target="framework" />
+
 <test name="tablemerger"
     build_path="frameworks/base/tests/FrameworkTest"
     package="com.android.frameworktest.tests"
@@ -125,7 +143,7 @@
 <!--  cts tests -->
 
 <test name="cts-permission"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/permission"
     package="com.android.cts.permission"
     runner="android.test.InstrumentationTestRunner"
     coverage_target="framework"
@@ -141,49 +159,49 @@
     cts="true" />
 
 <test name="cts-process"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/process"
     package="com.android.cts.process"
     coverage_target="framework"
     cts="true" />
 
 <test name="cts-api-signature"
-    build_path="cts/tests"
+    build_path="cts/tests/SignatureTest"
     package="android.tests.sigtest"
     runner=".InstrumentationRunner"
     cts="true" />
 
 <test name="cts-api-signature-func"
-    build_path="cts/tests"
+    build_path="cts/tests/SignatureTest"
     package="android.tests.sigtest.tests"
     cts="true" />
 
 <test name="cts-apidemos"
-    build_path="cts/tests"
+    build_path="cts/tests/ApiDemosReferenceTest"
     package="android.apidemos.cts"
     coverage_target="ApiDemos"
     cts="true" />
 
 <test name="cts-app"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/app"
     package="com.android.cts.app"
     runner="android.test.InstrumentationCtsTestRunner"
     coverage_target="framework"
     cts="true" />
 
 <test name="cts-content"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/content"
     package="com.android.cts.content"
     runner="android.test.InstrumentationCtsTestRunner"
     coverage_target="framework"
     cts="true" />
 
 <test name="cts-database"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/database"
     package="com.android.cts.database"
     runner="android.test.InstrumentationCtsTestRunner"
     coverage_target="framework"
     cts="true" />
-    
+
 <test name="cts-gesture"
     build_path="cts/tests/tests/gesture"
     package="com.android.cts.gesture"
@@ -192,107 +210,121 @@
     cts="true" />
 
 <test name="cts-graphics"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/graphics"
     package="com.android.cts.graphics"
     runner="android.test.InstrumentationCtsTestRunner"
     coverage_target="framework"
     cts="true" />
 
 <test name="cts-hardware"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/hardware"
     package="com.android.cts.hardware"
     runner="android.test.InstrumentationCtsTestRunner"
     coverage_target="framework"
     cts="true" />
 
 <test name="cts-location"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/location"
     package="com.android.cts.location"
     runner="android.test.InstrumentationCtsTestRunner"
     coverage_target="framework"
     cts="true" />
 
+<test name="cts-media"
+    build_path="cts/tests/tests/media"
+    package="com.android.cts.media"
+    runner="android.test.InstrumentationCtsTestRunner"
+    coverage_target="framework"
+    cts="true" />
+
 <test name="cts-net"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/net"
     package="com.android.cts.net"
     runner="android.test.InstrumentationCtsTestRunner"
     coverage_target="framework"
     cts="true" />
 
 <test name="cts-os"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/os"
     package="com.android.cts.os"
     runner="android.test.InstrumentationCtsTestRunner"
     coverage_target="framework"
     cts="true" />
 
 <test name="cts-perf1"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/performance"
     package="com.android.cts.performance"
     runner="android.test.InstrumentationCtsTestRunner"
     cts="true" />
 
 <test name="cts-perf2"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/performance2"
     package="com.android.cts.performance2"
     runner="android.test.InstrumentationCtsTestRunner"
     cts="true" />
 
 <test name="cts-perf3"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/performance3"
     package="com.android.cts.performance3"
     runner="android.test.InstrumentationCtsTestRunner"
     cts="true" />
 
 <test name="cts-perf4"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/performance4"
     package="com.android.cts.performance4"
     runner="android.test.InstrumentationCtsTestRunner"
     cts="true" />
 
 <test name="cts-perf5"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/performance5"
     package="com.android.cts.performance5"
     runner="android.test.InstrumentationCtsTestRunner"
     cts="true" />
 
 <test name="cts-provider"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/provider"
     package="com.android.cts.provider"
     runner="android.test.InstrumentationCtsTestRunner"
     coverage_target="framework"
     cts="true" />
 
 <test name="cts-text"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/text"
     package="com.android.cts.text"
     runner="android.test.InstrumentationCtsTestRunner"
     coverage_target="framework"
     cts="true" />
 
 <test name="cts-telephony"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/telephony"
     package="com.android.cts.telephony"
     runner="android.test.InstrumentationCtsTestRunner"
     coverage_target="framework"
     cts="true" />
 
 <test name="cts-util"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/util"
     package="com.android.cts.util"
     runner="android.test.InstrumentationCtsTestRunner"
     coverage_target="framework"
     cts="true" />
 
 <test name="cts-view"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/view"
     package="com.android.cts.view"
     runner="android.test.InstrumentationCtsTestRunner"
     coverage_target="framework"
     cts="true" />
 
+<test name="cts-webkit"
+    build_path="cts/tests/tests/webkit"
+    package="com.android.cts.webkit"
+    runner="android.test.InstrumentationCtsTestRunner"
+    coverage_target="framework"
+    cts="true" />
+
 <test name="cts-widget"
-    build_path="cts/tests"
+    build_path="cts/tests/tests/widget"
     package="com.android.cts.widget"
     runner="android.test.InstrumentationCtsTestRunner"
     coverage_target="framework"
@@ -322,8 +354,7 @@
 <test name="calprov"
     build_path="packages/providers/CalendarProvider/tests"
     package="com.android.providers.calendar.tests"
-    coverage_target="CalendarProvider"
-    continuous="true" />
+    coverage_target="CalendarProvider" />
 
 <test name="camerastress"
     build_path="packages/apps/Camera"
@@ -345,9 +376,23 @@
     coverage_target="Camera" />
 
 <test name="contactsprov"
+    build_path="packages/providers/ContactsProvider/tests"
+    package="com.android.providers.contacts.tests"
+    coverage_target="ContactsProvider"
+    continuous="true" />
+
+<test name="contacts"
+    build_path="packages/apps/Contacts"
+    package="com.android.contacts.tests"
+    runner="android.test.InstrumentationTestRunner"
+    coverage_target="Contacts"
+    description="Tests for the Contacts app."
+    continuous="true" />
+
+<test name="gcontactsprov"
     build_path="packages/providers/GoogleContactsProvider/tests"
     package="com.android.providers.contactstests"
-    coverage_target="ContactsProvider" />
+    coverage_target="GoogleContactsProvider" />
 
 <test name="downloadprovider-permission"
     build_path="packages/providers/DownloadProvider/tests/permission"
@@ -441,7 +486,6 @@
 <test name="mms"
     build_path="packages/apps/Mms"
     package="com.android.mms.tests"
-    runner="com.android.mms.ui.MMSInstrumentationTestRunner"
     coverage_target="Mms" />
 
 <test name="mmslaunch"
@@ -450,6 +494,11 @@
     runner="com.android.mms.SmsLaunchPerformance"
     coverage_target="Mms" />
 
+<test name="telephony-unit"
+    build_path="frameworks/base/telephony/tests/TelephonyTest"
+    package="com.android.telephonytest"
+    runner=".TelephonyUnitTestRunner"
+    coverage_target="framework" />
 
 <!-- obsolete?
 <test name="ringtone"
@@ -467,18 +516,16 @@
     description="Bionic libstdc++."
     extra_build_args="BIONIC_TESTS=1" />
 
+<test-native name="libskia"
+    build_path="external/skia/tests"
+    description="Skia tests." />
+
 <!--  Android STL tests -->
 <test-native name="astl"
     build_path="external/astl/tests"
     description="Android STL."
     extra_build_args="ASTL_TESTS=1" />
 
-<!-- Android Keystore tests -->
-<test-native name="netkeystore_test"
-    build_path="frameworks/base/cmds/keystore/tests"
-    description="Android keystore."
-    extra_build_args="KEYSTORE_TESTS=1" />
-
 <!-- pending patch 820
 <test-native name="gtest"
     build_path="external/gtest"
diff --git a/testrunner/test_defs/__init__.py b/testrunner/test_defs/__init__.py
index c205dcb..f397d2a 100644
--- a/testrunner/test_defs/__init__.py
+++ b/testrunner/test_defs/__init__.py
@@ -1 +1 @@
-__all__ = ['test_defs']
+__all__ = ['test_defs', 'test_walker']
diff --git a/testrunner/test_defs/abstract_test.py b/testrunner/test_defs/abstract_test.py
deleted file mode 100644
index e0c8db2..0000000
--- a/testrunner/test_defs/abstract_test.py
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/usr/bin/python2.4
-#
-#
-# Copyright 2009, The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Abstract Android test suite."""
-
-# Python imports
-import xml.dom.minidom
-import xml.parsers
-
-# local imports
-import errors
-
-
-class AbstractTestSuite(object):
-  """Represents a generic test suite definition parsed from xml.
-
-  This class will parse the XML attributes common to all TestSuite's.
-  """
-
-  # name of xml tag a test suite handles. subclasses must define this.
-  TAG_NAME = "unspecified"
-
-  _NAME_ATTR = "name"
-  _BUILD_ATTR = "build_path"
-  _CONTINUOUS_ATTR = "continuous"
-  _CTS_ATTR = "cts"
-  _DESCRIPTION_ATTR = "description"
-  _EXTRA_BUILD_ARGS_ATTR = "extra_build_args"
-
-  def __init__(self):
-    self._attr_map = {}
-
-  def Parse(self, suite_element):
-    """Populates this instance's data from given suite xml element.
-    Raises:
-      ParseError if a required attribute is missing.
-    """
-    # parse name first so it can be used for error reporting
-    self._ParseAttribute(suite_element, self._NAME_ATTR, True)
-    self._ParseAttribute(suite_element, self._BUILD_ATTR, True)
-    self._ParseAttribute(suite_element, self._CONTINUOUS_ATTR, False,
-                         default_value=False)
-    self._ParseAttribute(suite_element, self._CTS_ATTR, False,
-                         default_value=False)
-    self._ParseAttribute(suite_element, self._DESCRIPTION_ATTR, False,
-                         default_value="")
-    self._ParseAttribute(suite_element, self._EXTRA_BUILD_ARGS_ATTR, False,
-                         default_value="")
-
-  def _ParseAttribute(self, suite_element, attribute_name, mandatory,
-                      default_value=None):
-    if suite_element.hasAttribute(attribute_name):
-      self._attr_map[attribute_name] = \
-          suite_element.getAttribute(attribute_name)
-    elif mandatory:
-      error_msg = ("Could not find attribute %s in %s %s" %
-          (attribute_name, self.TAG_NAME, self.GetName()))
-      raise errors.ParseError(msg=error_msg)
-    else:
-      self._attr_map[attribute_name] = default_value
-
-  def GetName(self):
-    return self._GetAttribute(self._NAME_ATTR)
-
-  def GetBuildPath(self):
-    """Returns the build path of this test, relative to source tree root."""
-    return self._GetAttribute(self._BUILD_ATTR)
-
-  def GetBuildDependencies(self, options):
-    """Returns a list of dependent build paths."""
-    return []
-
-  def IsContinuous(self):
-    """Returns true if test is flagged as being part of the continuous tests"""
-    return self._GetAttribute(self._CONTINUOUS_ATTR)
-
-  def IsCts(self):
-    """Returns true if test is part of the compatibility test suite"""
-    return self._GetAttribute(self._CTS_ATTR)
-
-  def GetDescription(self):
-    """Returns a description if available, an empty string otherwise."""
-    return self._GetAttribute(self._DESCRIPTION_ATTR)
-
-  def GetExtraBuildArgs(self):
-    """Returns the extra build args if available, an empty string otherwise."""
-    return self._GetAttribute(self._EXTRA_BUILD_ARGS_ATTR)
-
-  def _GetAttribute(self, attribute_name):
-    return self._attr_map.get(attribute_name)
-
-  def Run(self, options, adb):
-    """Runs the test.
-
-    Subclasses must implement this.
-    Args:
-      options: global command line options
-    """
-    raise NotImplementedError
diff --git a/testrunner/test_defs/host_test.py b/testrunner/test_defs/host_test.py
index 4aefa3a..8105075 100644
--- a/testrunner/test_defs/host_test.py
+++ b/testrunner/test_defs/host_test.py
@@ -20,23 +20,15 @@
 # python imports
 import os
 
-# local imports
-from abstract_test import AbstractTestSuite
 import errors
 import logger
 import run_command
+import test_suite
 
 
-class HostTestSuite(AbstractTestSuite):
+class HostTestSuite(test_suite.AbstractTestSuite):
   """A test suite for running hosttestlib java tests."""
 
-  TAG_NAME = "test-host"
-
-  _CLASS_ATTR = "class"
-  # TODO: consider obsoleting in favor of parsing the Android.mk to find the
-  # jar name
-  _JAR_ATTR = "jar_name"
-
   _JUNIT_JAR_NAME = "junit.jar"
   _HOSTTESTLIB_NAME = "hosttestlib.jar"
   _DDMLIB_NAME = "ddmlib.jar"
@@ -54,21 +46,29 @@
   # the test suite?
   _TEST_RUNNER = "com.android.hosttest.DeviceTestRunner"
 
-  def Parse(self, suite_element):
-    super(HostTestSuite, self).Parse(suite_element)
-    self._ParseAttribute(suite_element, self._CLASS_ATTR, True)
-    self._ParseAttribute(suite_element, self._JAR_ATTR, True)
+  def __init__(self):
+    test_suite.AbstractTestSuite.__init__(self)
+    self._jar_name = None
+    self._class_name = None
 
   def GetBuildDependencies(self, options):
     """Override parent to tag on building host libs."""
     return self._LIB_BUILD_PATHS
 
-  def GetClass(self):
-    return self._GetAttribute(self._CLASS_ATTR)
+  def GetClassName(self):
+    return self._class_name
+
+  def SetClassName(self, class_name):
+    self._class_name = class_name
+    return self
 
   def GetJarName(self):
     """Returns the name of the host jar that contains the tests."""
-    return self._GetAttribute(self._JAR_ATTR)
+    return self._jar_name
+
+  def SetJarName(self, jar_name):
+    self._jar_name = jar_name
+    return self
 
   def Run(self, options, adb_interface):
     """Runs the host test.
@@ -77,11 +77,14 @@
 
     Args:
       options: command line options for running host tests. Expected member
-      fields:
+        fields:
         host_lib_path: path to directory that contains host library files
         test_data_path: path to directory that contains test data files
         preview: if true, do not execute, display commands only
       adb_interface: reference to device under test
+
+    Raises:
+      errors.AbortError: if fatal error occurs
     """
     # get the serial number of the device under test, so it can be passed to
     # hosttestlib.
@@ -100,7 +103,7 @@
     # -p <test data path>
     cmd = "java -cp %s %s %s -s %s -p %s" % (":".join(full_lib_paths),
                                              self._TEST_RUNNER,
-                                             self.GetClass(), serial_number,
+                                             self.GetClassName(), serial_number,
                                              options.test_data_path)
     logger.Log(cmd)
     if not options.preview:
diff --git a/testrunner/test_defs/instrumentation_test.py b/testrunner/test_defs/instrumentation_test.py
index 24b4b88..401a980 100644
--- a/testrunner/test_defs/instrumentation_test.py
+++ b/testrunner/test_defs/instrumentation_test.py
@@ -21,59 +21,75 @@
 import os
 
 # local imports
-from abstract_test import AbstractTestSuite
 import coverage
 import errors
 import logger
+import test_suite
 
 
-class InstrumentationTestSuite(AbstractTestSuite):
-  """Represents a java instrumentation test suite definition run on Android device."""
+class InstrumentationTestSuite(test_suite.AbstractTestSuite):
+  """Represents a java instrumentation test suite definition run on device."""
 
-  # for legacy reasons, the xml tag name for java (device) tests is "test:
-  TAG_NAME = "test"
-
-  _PKG_ATTR = "package"
-  _RUNNER_ATTR = "runner"
-  _CLASS_ATTR = "class"
-  _TARGET_ATTR = "coverage_target"
-
-  _DEFAULT_RUNNER = "android.test.InstrumentationTestRunner"
+  DEFAULT_RUNNER = "android.test.InstrumentationTestRunner"
 
     # build path to Emma target Makefile
   _EMMA_BUILD_PATH = os.path.join("external", "emma")
 
-  def _GetTagName(self):
-    return self._TAG_NAME
+  def __init__(self):
+    test_suite.AbstractTestSuite.__init__(self)
+    self._package_name = None
+    self._runner_name = self.DEFAULT_RUNNER
+    self._class_name = None
+    self._target_name = None
+    self._java_package = None
 
   def GetPackageName(self):
-    return self._GetAttribute(self._PKG_ATTR)
+    return self._package_name
+
+  def SetPackageName(self, package_name):
+    self._package_name = package_name
+    return self
 
   def GetRunnerName(self):
-    return self._GetAttribute(self._RUNNER_ATTR)
+    return self._runner_name
+
+  def SetRunnerName(self, runner_name):
+    self._runner_name = runner_name
+    return self
 
   def GetClassName(self):
-    return self._GetAttribute(self._CLASS_ATTR)
+    return self._class_name
+
+  def SetClassName(self, class_name):
+    self._class_name = class_name
+    return self
+
+  def GetJavaPackageFilter(self):
+    return self._java_package
+
+  def SetJavaPackageFilter(self, java_package_name):
+    """Configure the suite to only run tests in given java package."""
+    self._java_package = java_package_name
+    return self
 
   def GetTargetName(self):
     """Retrieve module that this test is targeting.
 
     Used for generating code coverage metrics.
+    Returns:
+      the module target name
     """
-    return self._GetAttribute(self._TARGET_ATTR)
+    return self._target_name
+
+  def SetTargetName(self, target_name):
+    self._target_name = target_name
+    return self
 
   def GetBuildDependencies(self, options):
     if options.coverage:
       return [self._EMMA_BUILD_PATH]
     return []
 
-  def Parse(self, suite_element):
-    super(InstrumentationTestSuite, self).Parse(suite_element)
-    self._ParseAttribute(suite_element, self._PKG_ATTR, True)
-    self._ParseAttribute(suite_element, self._RUNNER_ATTR, False, self._DEFAULT_RUNNER)
-    self._ParseAttribute(suite_element, self._CLASS_ATTR, False)
-    self._ParseAttribute(suite_element, self._TARGET_ATTR, False)
-
   def Run(self, options, adb):
     """Run the provided test suite.
 
@@ -82,6 +98,9 @@
     Args:
       options: command line options to provide to test run
       adb: adb_interface to device under test
+
+    Raises:
+      errors.AbortError: if fatal error occurs
     """
 
     test_class = self.GetClassName()
@@ -92,11 +111,18 @@
     if options.test_method is not None:
       test_class = "%s#%s" % (test_class, options.test_method)
 
+    test_package = self.GetJavaPackageFilter()
+    if options.test_package:
+      test_package = options.test_package
+
+    if test_class and test_package:
+      logger.Log('Error: both class and java package options are specified')
+
     instrumentation_args = {}
     if test_class is not None:
       instrumentation_args["class"] = test_class
-    if options.test_package:
-      instrumentation_args["package"] = options.test_package
+    if test_package:
+      instrumentation_args["package"] = test_package
     if options.test_size:
       instrumentation_args["size"] = options.test_size
     if options.wait_for_debugger:
@@ -122,10 +148,10 @@
       logger.Log("Running in coverage mode, suppressing test output")
       try:
         (test_results, status_map) = adb.StartInstrumentationForPackage(
-          package_name=self.GetPackageName(),
-          runner_name=self.GetRunnerName(),
-          timeout_time=60*60,
-          instrumentation_args=instrumentation_args)
+            package_name=self.GetPackageName(),
+            runner_name=self.GetRunnerName(),
+            timeout_time=60*60,
+            instrumentation_args=instrumentation_args)
       except errors.InstrumentationError, errors.DeviceUnresponsiveError:
         return
       self._PrintTestResults(test_results)
@@ -156,11 +182,11 @@
     error_count = 0
     fail_count = 0
     for test_result in test_results:
-      if test_result.GetStatusCode() == -1: # error
+      if test_result.GetStatusCode() == -1:  # error
         logger.Log("Error in %s: %s" % (test_result.GetTestName(),
                                         test_result.GetFailureReason()))
         error_count+=1
-      elif test_result.GetStatusCode() == -2: # failure
+      elif test_result.GetStatusCode() == -2:  # failure
         logger.Log("Failure in %s: %s" % (test_result.GetTestName(),
                                           test_result.GetFailureReason()))
         fail_count+=1
diff --git a/testrunner/test_defs/native_test.py b/testrunner/test_defs/native_test.py
index d250de2..e6917c9 100644
--- a/testrunner/test_defs/native_test.py
+++ b/testrunner/test_defs/native_test.py
@@ -18,28 +18,19 @@
 """TestSuite for running native Android tests."""
 
 # python imports
-import re
 import os
+import re
 
 # local imports
-from abstract_test import AbstractTestSuite
 import android_build
 import logger
 import run_command
+import test_suite
 
 
-class NativeTestSuite(AbstractTestSuite):
+class NativeTestSuite(test_suite.AbstractTestSuite):
   """A test suite for running native aka C/C++ tests on device."""
 
-  TAG_NAME = "test-native"
-
-  def _GetTagName(self):
-    return self._TAG_NAME
-
-  def Parse(self, suite_element):
-    super(NativeTestSuite, self).Parse(suite_element)
-
-
   def Run(self, options, adb):
     """Run the provided *native* test suite.
 
@@ -61,7 +52,7 @@
     # find all test files, convert unicode names to ascii, take the basename
     # and drop the .cc/.cpp  extension.
     source_list = []
-    build_path = self.GetBuildPath()
+    build_path = os.path.join(android_build.GetTop(), self.GetBuildPath())
     os.path.walk(build_path, self._CollectTestSources, source_list)
     logger.SilentLog("Tests source %s" % source_list)
 
diff --git a/testrunner/test_defs/test_defs.py b/testrunner/test_defs/test_defs.py
index 7f23b89..6d885fa 100644
--- a/testrunner/test_defs/test_defs.py
+++ b/testrunner/test_defs/test_defs.py
@@ -24,9 +24,7 @@
 # local imports
 import errors
 import logger
-from instrumentation_test import InstrumentationTestSuite
-from native_test import NativeTestSuite
-from host_test import HostTestSuite
+import xml_suite_helper
 
 
 class TestDefinitions(object):
@@ -74,21 +72,13 @@
 
   def _ParseDoc(self, doc):
     root_element = self._GetRootElement(doc)
+    suite_parser = xml_suite_helper.XmlSuiteParser()
     for element in root_element.childNodes:
       if element.nodeType != xml.dom.Node.ELEMENT_NODE:
         continue
-      test_suite = None
-      if element.nodeName == InstrumentationTestSuite.TAG_NAME:
-        test_suite = InstrumentationTestSuite()
-      elif element.nodeName == NativeTestSuite.TAG_NAME:
-        test_suite = NativeTestSuite()
-      elif element.nodeName == HostTestSuite.TAG_NAME:
-        test_suite = HostTestSuite()
-      else:
-        logger.Log("Unrecognized tag %s found" % element.nodeName)
-        continue
-      test_suite.Parse(element)
-      self._AddTest(test_suite)
+      test_suite = suite_parser.Parse(element)
+      if test_suite:
+        self._AddTest(test_suite)
 
   def _GetRootElement(self, doc):
     root_elements = doc.getElementsByTagName("test-definitions")
diff --git a/testrunner/test_defs/test_suite.py b/testrunner/test_defs/test_suite.py
new file mode 100644
index 0000000..42a0de1
--- /dev/null
+++ b/testrunner/test_defs/test_suite.py
@@ -0,0 +1,96 @@
+#!/usr/bin/python2.4
+#
+#
+# Copyright 2009, The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Abstract Android test suite."""
+
+
+class AbstractTestSuite(object):
+  """Represents a generic test suite definition."""
+
+  def __init__(self):
+    self._name = None
+    self._build_path = None
+    self._build_dependencies = []
+    self._is_continuous = False
+    self._is_cts = False
+    self._description = ''
+    self._extra_build_args = ''
+
+  def GetName(self):
+    return self._name
+
+  def SetName(self, name):
+    self._name = name
+    return self
+
+  def GetBuildPath(self):
+    """Returns the build path of this test, relative to source tree root."""
+    return self._build_path
+
+  def SetBuildPath(self, build_path):
+    self._build_path = build_path
+    return self
+
+  def GetBuildDependencies(self, options):
+    """Returns a list of dependent build paths."""
+    return self._build_dependencies
+
+  def SetBuildDependencies(self, build_dependencies):
+    self._build_dependencies = build_dependencies
+    return self
+
+  def IsContinuous(self):
+    """Returns true if test is part of the continuous test."""
+    return self._is_continuous
+
+  def SetContinuous(self, continuous):
+    self._is_continuous = continuous
+    return self._is_continuous
+
+  def IsCts(self):
+    """Returns true if test is part of the compatibility test suite"""
+    return self._is_cts
+
+  def SetCts(self, cts):
+    self._is_cts = cts
+    return self
+
+  def GetDescription(self):
+    """Returns a description if available, an empty string otherwise."""
+    return self._description
+
+  def SetDescription(self, desc):
+    self._description = desc
+    return self
+
+  def GetExtraBuildArgs(self):
+    """Returns the extra build args if available, an empty string otherwise."""
+    return self._extra_build_args
+
+  def SetExtraBuildArgs(self, build_args):
+    self._extra_build_args = build_args
+    return self
+
+  def Run(self, options, adb):
+    """Runs the test.
+
+    Subclasses must implement this.
+    Args:
+      options: global command line options
+      adb: asdb_interface to device under test
+    """
+    raise NotImplementedError
diff --git a/testrunner/test_defs/test_walker.py b/testrunner/test_defs/test_walker.py
new file mode 100755
index 0000000..973cac1
--- /dev/null
+++ b/testrunner/test_defs/test_walker.py
@@ -0,0 +1,296 @@
+#!/usr/bin/python2.4
+#
+#
+# Copyright 2009, The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Utility to find instrumentation test definitions from file system."""
+
+# python imports
+import os
+import re
+
+# local imports
+import android_build
+import android_manifest
+import android_mk
+import instrumentation_test
+import logger
+
+
+class TestWalker(object):
+  """Finds instrumentation tests from filesystem."""
+
+  def FindTests(self, path):
+    """Gets list of Android instrumentation tests found at given path.
+
+    Tests are created from the <instrumentation> tags found in
+    AndroidManifest.xml files relative to the given path.
+
+    FindTests will first scan sub-folders of path for tests. If none are found,
+    it will scan the file system upwards until a AndroidManifest.xml is found
+    or the Android build root is reached.
+
+    Some sample values for path:
+    - a parent directory containing many tests:
+    ie development/samples will return tests for instrumentation's in ApiDemos,
+    ApiDemos/tests, Notepad/tests etc
+    - a java test class file
+    ie ApiDemos/tests/src/../ApiDemosTest.java will return a test for
+    the instrumentation in ApiDemos/tests, with the class name filter set to
+    ApiDemosTest
+    - a java package directory
+    ie ApiDemos/tests/src/com/example/android/apis will return a test for
+    the instrumentation in ApiDemos/tests, with the java package filter set
+    to com.example.android.apis.
+
+    Args:
+      path: file system path to search
+
+    Returns:
+      list of test suites that support operations defined by
+      test_suite.AbstractTestSuite
+    """
+    if not os.path.exists(path):
+      logger.Log('%s does not exist' % path)
+      return []
+    abspath = os.path.abspath(path)
+    # ensure path is in ANDROID_BUILD_ROOT
+    self._build_top = android_build.GetTop()
+    if not self._IsPathInBuildTree(abspath):
+      logger.Log('%s is not a sub-directory of build root %s' %
+                 (path, self._build_top))
+      return []
+
+    # first, assume path is a parent directory, which specifies to run all
+    # tests within this directory
+    tests = self._FindSubTests(abspath, [])
+    if not tests:
+      logger.SilentLog('No tests found within %s, searching upwards' % path)
+      tests = self._FindUpstreamTests(abspath)
+    return tests
+
+  def _IsPathInBuildTree(self, path):
+    """Return true if given path is within current Android build tree.
+
+    Args:
+      path: absolute file system path
+
+    Returns:
+      True if path is within Android build tree
+    """
+    return os.path.commonprefix([self._build_top, path]) == self._build_top
+
+  def _MakePathRelativeToBuild(self, path):
+    """Convert given path to one relative to build tree root.
+
+    Args:
+      path: absolute file system path to convert.
+
+    Returns:
+      The converted path relative to build tree root.
+
+    Raises:
+      ValueError: if path is not within build tree
+    """
+    if not self._IsPathInBuildTree(path):
+      raise ValueError
+    build_path_len = len(self._build_top) + 1
+    # return string with common build_path removed
+    return path[build_path_len:]
+
+  def _FindSubTests(self, path, tests, build_path=None):
+    """Recursively finds all tests within given path.
+
+    Args:
+      path: absolute file system path to check
+      tests: current list of found tests
+      build_path: the parent directory where Android.mk was found
+
+    Returns:
+      updated list of tests
+    """
+    if not os.path.isdir(path):
+      return tests
+    filenames = os.listdir(path)
+    # Try to build as much of original path as possible, so
+    # keep track of upper-most parent directory where Android.mk was found
+    # this is also necessary in case of overlapping tests
+    # ie if a test exists at 'foo' directory  and 'foo/sub', attempting to
+    # build both 'foo' and 'foo/sub' will fail.
+    if not build_path and filenames.count(android_mk.AndroidMK.FILENAME):
+      build_path = self._MakePathRelativeToBuild(path)
+    if filenames.count(android_manifest.AndroidManifest.FILENAME):
+      # found a manifest! now parse it to find the test definition(s)
+      manifest = android_manifest.AndroidManifest(app_path=path)
+      tests.extend(self._CreateSuitesFromManifest(manifest, build_path))
+    for filename in filenames:
+      self._FindSubTests(os.path.join(path, filename), tests, build_path)
+    return tests
+
+  def _FindUpstreamTests(self, path):
+    """Find tests defined upward from given path.
+
+    Args:
+      path: the location to start searching. If it points to a java class file
+        or java package dir, the appropriate test suite filters will be set
+
+    Returns:
+      list of test_suite.AbstractTestSuite found, may be empty
+    """
+    class_name_arg = None
+    package_name = None
+    # if path is java file, populate class name
+    if self._IsJavaFile(path):
+      class_name_arg = self._GetClassNameFromFile(path)
+      logger.SilentLog('Using java test class %s' % class_name_arg)
+    elif self._IsJavaPackage(path):
+      package_name = self._GetPackageNameFromDir(path)
+      logger.SilentLog('Using java package %s' % package_name)
+    manifest = self._FindUpstreamManifest(path)
+    if manifest:
+      logger.SilentLog('Found AndroidManifest at %s' % manifest.GetAppPath())
+      build_path = self._MakePathRelativeToBuild(manifest.GetAppPath())
+      return self._CreateSuitesFromManifest(manifest,
+                                            build_path,
+                                            class_name=class_name_arg,
+                                            java_package_name=package_name)
+
+  def _IsJavaFile(self, path):
+    """Returns true if given file system path is a java file."""
+    return os.path.isfile(path) and self._IsJavaFileName(path)
+
+  def _IsJavaFileName(self, filename):
+    """Returns true if given file name is a java file name."""
+    return os.path.splitext(filename)[1] == '.java'
+
+  def _IsJavaPackage(self, path):
+    """Returns true if given file path is a java package.
+
+    Currently assumes if any java file exists in this directory, than it
+    represents a java package.
+
+    Args:
+      path: file system path of directory to check
+
+    Returns:
+      True if path is a java package
+    """
+    if not os.path.isdir(path):
+      return False
+    for file_name in os.listdir(path):
+      if self._IsJavaFileName(file_name):
+        return True
+    return False
+
+  def _GetClassNameFromFile(self, java_file_path):
+    """Gets the fully qualified java class name from path.
+
+    Args:
+      java_file_path: file system path of java file
+
+    Returns:
+      fully qualified java class name or None.
+    """
+    package_name = self._GetPackageNameFromFile(java_file_path)
+    if package_name:
+      filename = os.path.basename(java_file_path)
+      class_name = os.path.splitext(filename)[0]
+      return '%s.%s' % (package_name, class_name)
+    return None
+
+  def _GetPackageNameFromDir(self, path):
+    """Gets the java package name associated with given directory path.
+
+    Caveat: currently just parses defined java package name from first java
+    file found in directory.
+
+    Args:
+      path: file system path of directory
+
+    Returns:
+      the java package name or None
+    """
+    for filename in os.listdir(path):
+      if self._IsJavaFileName(filename):
+        return self._GetPackageNameFromFile(os.path.join(path, filename))
+
+  def _GetPackageNameFromFile(self, java_file_path):
+    """Gets the java package name associated with given java file path.
+
+    Args:
+      java_file_path: file system path of java file
+
+    Returns:
+      the java package name or None
+    """
+    logger.SilentLog('Looking for java package name in %s' % java_file_path)
+    re_package = re.compile(r'package\s+(.*);')
+    file_handle = open(java_file_path, 'r')
+    for line in file_handle:
+      match = re_package.match(line)
+      if match:
+        return match.group(1)
+    return None
+
+  def _FindUpstreamManifest(self, path):
+    """Recursively searches filesystem upwards for a AndroidManifest file.
+
+    Args:
+      path: file system path to search
+
+    Returns:
+      the AndroidManifest found or None
+    """
+    if (os.path.isdir(path) and
+        os.listdir(path).count(android_manifest.AndroidManifest.FILENAME)):
+      return android_manifest.AndroidManifest(app_path=path)
+    dirpath = os.path.dirname(path)
+    if self._IsPathInBuildTree(path):
+      return self._FindUpstreamManifest(dirpath)
+    logger.Log('AndroidManifest.xml not found')
+    return None
+
+  def _CreateSuitesFromManifest(self, manifest, build_path, class_name=None,
+                                java_package_name=None):
+    """Creates TestSuites from a AndroidManifest.
+
+    Args:
+      manifest: the AndroidManifest
+      build_path: the build path to use for test
+      class_name: optionally, the class filter for the suite
+      java_package_name: optionally, the java package filter for the suite
+
+    Returns:
+      the list of tests created
+    """
+    tests = []
+    for instr_name in manifest.GetInstrumentationNames():
+      pkg_name = manifest.GetPackageName()
+      logger.SilentLog('Found instrumentation %s/%s' % (pkg_name, instr_name))
+      suite = instrumentation_test.InstrumentationTestSuite()
+      suite.SetPackageName(pkg_name)
+      suite.SetBuildPath(build_path)
+      suite.SetRunnerName(instr_name)
+      suite.SetName(pkg_name)
+      suite.SetClassName(class_name)
+      suite.SetJavaPackageFilter(java_package_name)
+      # this is a bit of a hack, assume if 'com.android.cts' is in
+      # package name, this is a cts test
+      # this logic can be removed altogether when cts tests no longer require
+      # custom build steps
+      suite.SetCts(suite.GetPackageName().startswith('com.android.cts'))
+      tests.append(suite)
+    return tests
+
diff --git a/testrunner/test_defs/xml_suite_helper.py b/testrunner/test_defs/xml_suite_helper.py
new file mode 100644
index 0000000..c2ed1dd
--- /dev/null
+++ b/testrunner/test_defs/xml_suite_helper.py
@@ -0,0 +1,152 @@
+#!/usr/bin/python2.4
+#
+#
+# Copyright 2009, The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Utility to parse suite info from xml."""
+
+# Python imports
+import xml.dom.minidom
+import xml.parsers
+
+# local imports
+import errors
+import logger
+import host_test
+import instrumentation_test
+import native_test
+
+
+class XmlSuiteParser(object):
+  """Parses XML attributes common to all TestSuite's."""
+
+  # common attributes
+  _NAME_ATTR = 'name'
+  _BUILD_ATTR = 'build_path'
+  _CONTINUOUS_ATTR = 'continuous'
+  _CTS_ATTR = 'cts'
+  _DESCRIPTION_ATTR = 'description'
+  _EXTRA_BUILD_ARGS_ATTR = 'extra_build_args'
+
+  def Parse(self, element):
+    """Populates common suite attributes from given suite xml element.
+
+    Args:
+      element: xml node to parse
+    Raises:
+      ParseError if a required attribute is missing.
+    Returns:
+      parsed test suite or None
+    """
+    parser = None
+    if element.nodeName == InstrumentationParser.TAG_NAME:
+      parser = InstrumentationParser()
+    elif element.nodeName == NativeParser.TAG_NAME:
+      parser = NativeParser()
+    elif element.nodeName == HostParser.TAG_NAME:
+      parser = HostParser()
+    else:
+      logger.Log('Unrecognized tag %s found' % element.nodeName)
+      return None
+    test_suite = parser.Parse(element)
+    return test_suite
+
+  def _ParseCommonAttributes(self, suite_element, test_suite):
+    test_suite.SetName(self._ParseAttribute(suite_element, self._NAME_ATTR,
+                                            True))
+    test_suite.SetBuildPath(self._ParseAttribute(suite_element,
+                                                 self._BUILD_ATTR, True))
+    test_suite.SetContinuous(self._ParseAttribute(suite_element,
+                                                  self._CONTINUOUS_ATTR,
+                                                  False, default_value=False))
+    test_suite.SetCts(self._ParseAttribute(suite_element, self._CTS_ATTR, False,
+                                           default_value=False))
+    test_suite.SetDescription(self._ParseAttribute(suite_element,
+                                                   self._DESCRIPTION_ATTR,
+                                                   False,
+                                                   default_value=''))
+    test_suite.SetExtraBuildArgs(self._ParseAttribute(
+        suite_element, self._EXTRA_BUILD_ARGS_ATTR, False, default_value=''))
+
+  def _ParseAttribute(self, suite_element, attribute_name, mandatory,
+                      default_value=None):
+    if suite_element.hasAttribute(attribute_name):
+      value = suite_element.getAttribute(attribute_name)
+    elif mandatory:
+      error_msg = ('Could not find attribute %s in %s' %
+                   (attribute_name, self.TAG_NAME))
+      raise errors.ParseError(msg=error_msg)
+    else:
+      value = default_value
+    return value
+
+
+class InstrumentationParser(XmlSuiteParser):
+  """Parses instrumentation suite attributes from xml."""
+
+  # for legacy reasons, the xml tag name for java (device) tests is 'test'
+  TAG_NAME = 'test'
+
+  _PKG_ATTR = 'package'
+  _RUNNER_ATTR = 'runner'
+  _CLASS_ATTR = 'class'
+  _TARGET_ATTR = 'coverage_target'
+
+  def Parse(self, suite_element):
+    """Creates suite and populate with data from xml element."""
+    suite = instrumentation_test.InstrumentationTestSuite()
+    XmlSuiteParser._ParseCommonAttributes(self, suite_element, suite)
+    suite.SetPackageName(self._ParseAttribute(suite_element, self._PKG_ATTR,
+                                              True))
+    suite.SetRunnerName(self._ParseAttribute(
+        suite_element, self._RUNNER_ATTR, False,
+        instrumentation_test.InstrumentationTestSuite.DEFAULT_RUNNER))
+    suite.SetClassName(self._ParseAttribute(suite_element, self._CLASS_ATTR,
+                                            False))
+    suite.SetTargetName(self._ParseAttribute(suite_element, self._TARGET_ATTR,
+                                             False))
+    return suite
+
+
+class NativeParser(XmlSuiteParser):
+  """Parses native suite attributes from xml."""
+
+  TAG_NAME = 'test-native'
+
+  def Parse(self, suite_element):
+    """Creates suite and populate with data from xml element."""
+    suite = native_test.NativeTestSuite()
+    XmlSuiteParser._ParseCommonAttributes(self, suite_element, suite)
+    return suite
+
+
+class HostParser(XmlSuiteParser):
+  """Parses host suite attributes from xml."""
+
+  TAG_NAME = 'test-host'
+
+  _CLASS_ATTR = 'class'
+  # TODO: consider obsoleting in favor of parsing the Android.mk to find the
+  # jar name
+  _JAR_ATTR = 'jar_name'
+
+  def Parse(self, suite_element):
+    """Creates suite and populate with data from xml element."""
+    suite = host_test.HostTestSuite()
+    XmlSuiteParser._ParseCommonAttributes(self, suite_element, suite)
+    suite.SetClassName(self._ParseAttribute(suite_element, self._CLASS_ATTR,
+                                            True))
+    suite.SetJarName(self._ParseAttribute(suite_element, self._JAR_ATTR, True))
+    return suite
diff --git a/testrunner/tests/AndroidManifest.xml b/testrunner/tests/AndroidManifest.xml
new file mode 100644
index 0000000..e867f73
--- /dev/null
+++ b/testrunner/tests/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- Sample manifest file used for unit testing -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.example.android.tests">
+
+    <application>
+        <uses-library android:name="android.test.runner" />
+    </application>
+
+    <instrumentation android:name="android.test.InstrumentationTestRunner"
+                     android:targetPackage="com.example.android"
+                     android:label="Tests"/>
+
+</manifest>
diff --git a/testrunner/tests/am_instrument_parser_tests.py b/testrunner/tests/am_instrument_parser_tests.py
new file mode 100755
index 0000000..55356eb
--- /dev/null
+++ b/testrunner/tests/am_instrument_parser_tests.py
@@ -0,0 +1,201 @@
+#!/usr/bin/python2.4
+#
+#
+# Copyright 2009, The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import sys
+import unittest
+sys.path.append('../..')
+
+from testrunner import am_instrument_parser
+
+
+class AmParserTest(unittest.TestCase):
+
+  def testParseAmInstResult(self):
+    result="""INSTRUMENTATION_RESULT: performance.java_size=4871
+INSTRUMENTATION_RESULT: stream=
+Error: Failed to generate emma coverage.
+INSTRUMENTATION_RESULT: performance.cpu_time=33846
+INSTRUMENTATION_CODE: -1
+"""
+    bundle_dict = \
+        am_instrument_parser._ParseInstrumentationFinishedBundle(result)
+    self.assertEquals(4871, bundle_dict['java_size'])
+    self.assertEquals(33846, bundle_dict['cpu_time'])
+    self.assertEquals("\nError: Failed to generate emma coverage.",
+        bundle_dict['stream'])
+
+  def testParseAmInstStatus(self):
+    # numtests before id
+    segment1 = """INSTRUMENTATION_STATUS: stream=
+INSTRUMENTATION_STATUS: test=testLaunchComplexActivity
+INSTRUMENTATION_STATUS: class=LaunchPerformanceTest
+INSTRUMENTATION_STATUS: current=1
+INSTRUMENTATION_STATUS: numtests=2
+INSTRUMENTATION_STATUS: id=InstrumentationTestRunner
+INSTRUMENTATION_STATUS_CODE: 1"""
+    segment2 = """INSTRUMENTATION_STATUS: stream=.
+INSTRUMENTATION_STATUS: test=testLaunchComplexActivity
+INSTRUMENTATION_STATUS: performance.cpu_time=866
+INSTRUMENTATION_STATUS: performance.execution_time=1242
+INSTRUMENTATION_STATUS: class=LaunchPerformanceTest
+INSTRUMENTATION_STATUS: current=1
+INSTRUMENTATION_STATUS: numtests=2
+INSTRUMENTATION_STATUS: id=InstrumentationTestRunner
+INSTRUMENTATION_STATUS_CODE: 0"""
+    # numtests after id
+    segment3 = """INSTRUMENTATION_STATUS: stream=
+INSTRUMENTATION_STATUS: test=testLaunchSimpleActivity
+INSTRUMENTATION_STATUS: class=LaunchPerformanceTest
+INSTRUMENTATION_STATUS: current=2
+INSTRUMENTATION_STATUS: id=InstrumentationTestRunner
+INSTRUMENTATION_STATUS: numtests=8
+INSTRUMENTATION_STATUS_CODE: 1"""
+    segment4 = """INSTRUMENTATION_STATUS: stream=.
+INSTRUMENTATION_STATUS: test=testLaunchSimpleActivity
+INSTRUMENTATION_STATUS: performance.cpu_time=590
+INSTRUMENTATION_STATUS: performance.execution_time=1122
+INSTRUMENTATION_STATUS: class=LaunchPerformanceTest
+INSTRUMENTATION_STATUS: current=2
+INSTRUMENTATION_STATUS: id=InstrumentationTestRunner
+INSTRUMENTATION_STATUS: numtests=8
+INSTRUMENTATION_STATUS_CODE: 0"""
+
+    result = am_instrument_parser.TestResult(segment1)
+    map = result.GetResultFields()
+    self.assertEquals('testLaunchComplexActivity', map['test'])
+    self.assertEquals('LaunchPerformanceTest', map['class'])
+    self.assertEquals('1', map['current'])
+    self.assertEquals('2', map['numtests'])
+    self.assertEquals('InstrumentationTestRunner', map['id'])
+    self.assertEquals(1, result.GetStatusCode())
+
+    result = am_instrument_parser.TestResult(segment2)
+    map = result.GetResultFields()
+    self.assertEquals('testLaunchComplexActivity', map['test'])
+    self.assertEquals('866', map['cpu_time'])
+    self.assertEquals('1242', map['execution_time'])
+    self.assertEquals('LaunchPerformanceTest', map['class'])
+    self.assertEquals('1', map['current'])
+    self.assertEquals('2', map['numtests'])
+    self.assertEquals('InstrumentationTestRunner', map['id'])
+    self.assertEquals(0, result.GetStatusCode())
+
+    result = am_instrument_parser.TestResult(segment3)
+    map = result.GetResultFields()
+    self.assertEquals('testLaunchSimpleActivity', map['test'])
+    self.assertEquals('LaunchPerformanceTest', map['class'])
+    self.assertEquals('2', map['current'])
+    self.assertEquals('8', map['numtests'])
+    self.assertEquals('InstrumentationTestRunner', map['id'])
+    self.assertEquals(1, result.GetStatusCode())
+
+    result = am_instrument_parser.TestResult(segment4)
+    map = result.GetResultFields()
+    self.assertEquals('testLaunchSimpleActivity', map['test'])
+    self.assertEquals('590', map['cpu_time'])
+    self.assertEquals('1122', map['execution_time'])
+    self.assertEquals('LaunchPerformanceTest', map['class'])
+    self.assertEquals('2', map['current'])
+    self.assertEquals('8', map['numtests'])
+    self.assertEquals('InstrumentationTestRunner', map['id'])
+    self.assertEquals(0, result.GetStatusCode())
+
+  def testParseAmInstOutput(self):
+    result = """INSTRUMENTATION_STATUS: class=LaunchPerformanceTestCase
+INSTRUMENTATION_STATUS: current=1
+INSTRUMENTATION_STATUS: id=InstrumentationTestRunner
+INSTRUMENTATION_STATUS: numtests=2
+INSTRUMENTATION_STATUS: stream=
+LaunchPerformanceTestCase:
+INSTRUMENTATION_STATUS: test=testLaunchComplexActivity
+INSTRUMENTATION_STATUS_CODE: 1
+INSTRUMENTATION_STATUS: class=LaunchPerformanceTestCase
+INSTRUMENTATION_STATUS: current=1
+INSTRUMENTATION_STATUS: id=InstrumentationTestRunner
+INSTRUMENTATION_STATUS: numtests=2
+INSTRUMENTATION_STATUS: performance.cpu_time=866
+INSTRUMENTATION_STATUS: performance.execution_time=1242
+INSTRUMENTATION_STATUS: stream=.
+INSTRUMENTATION_STATUS: test=testLaunchComplexActivity
+INSTRUMENTATION_STATUS_CODE: 0
+INSTRUMENTATION_STATUS: class=LaunchPerformanceTestCase
+INSTRUMENTATION_STATUS: current=2
+INSTRUMENTATION_STATUS: id=InstrumentationTestRunner
+INSTRUMENTATION_STATUS: numtests=2
+INSTRUMENTATION_STATUS: stream=
+INSTRUMENTATION_STATUS: test=testLaunchSimpleActivity
+INSTRUMENTATION_STATUS_CODE: 1
+INSTRUMENTATION_STATUS: class=LaunchPerformanceTestCase
+INSTRUMENTATION_STATUS: current=2
+INSTRUMENTATION_STATUS: id=InstrumentationTestRunner
+INSTRUMENTATION_STATUS: numtests=2
+INSTRUMENTATION_STATUS: performance.cpu_time=590
+INSTRUMENTATION_STATUS: performance.execution_time=1122
+INSTRUMENTATION_STATUS: stream=.
+INSTRUMENTATION_STATUS: test=testLaunchSimpleActivity
+INSTRUMENTATION_STATUS_CODE: 0
+INSTRUMENTATION_RESULT: performance.cpu_time=829
+INSTRUMENTATION_RESULT: performance.execution_time=1708
+INSTRUMENTATION_RESULT: performance.gc_invocation_count=0
+INSTRUMENTATION_RESULT: performance.global_alloc_count=2848
+INSTRUMENTATION_RESULT: performance.global_alloc_size=193079
+INSTRUMENTATION_RESULT: performance.global_freed_count=1207
+INSTRUMENTATION_RESULT: performance.global_freed_size=93040
+INSTRUMENTATION_RESULT: performance.java_allocated=2175
+INSTRUMENTATION_RESULT: performance.java_free=580
+INSTRUMENTATION_RESULT: performance.java_private_dirty=740
+INSTRUMENTATION_RESULT: performance.java_pss=1609
+INSTRUMENTATION_RESULT: performance.java_shared_dirty=3860
+INSTRUMENTATION_RESULT: performance.java_size=2755
+INSTRUMENTATION_RESULT: performance.native_allocated=2585
+INSTRUMENTATION_RESULT: performance.native_free=34
+INSTRUMENTATION_RESULT: performance.native_private_dirty=632
+INSTRUMENTATION_RESULT: performance.native_pss=701
+INSTRUMENTATION_RESULT: performance.native_shared_dirty=1164
+INSTRUMENTATION_RESULT: performance.native_size=2620
+INSTRUMENTATION_RESULT: performance.other_private_dirty=896
+INSTRUMENTATION_RESULT: performance.other_pss=1226
+INSTRUMENTATION_RESULT: performance.other_shared_dirty=804
+INSTRUMENTATION_RESULT: performance.pre_received_transactions=-1
+INSTRUMENTATION_RESULT: performance.pre_sent_transactions=-1
+INSTRUMENTATION_RESULT: performance.received_transactions=-1
+INSTRUMENTATION_RESULT: performance.sent_transactions=-1
+INSTRUMENTATION_RESULT: stream=
+Test results for InstrumentationTestRunner=..
+Time: 2.413
+
+OK (2 tests)
+
+
+INSTRUMENTATION_CODE: -1
+"""
+    (results_list, perf_dict) = \
+        am_instrument_parser.ParseAmInstrumentOutput(result)
+    self.assertEquals(829, perf_dict['cpu_time'])
+    self.assertEquals(2848, perf_dict['global_alloc_count'])
+    self.assertEquals(93040, perf_dict['global_freed_size'])
+    self.assertEquals(740, perf_dict['java_private_dirty'])
+    self.assertEquals(2755, perf_dict['java_size'])
+    self.assertEquals(632, perf_dict['native_private_dirty'])
+    self.assertEquals(2620, perf_dict['native_size'])
+    self.assertEquals(804, perf_dict['other_shared_dirty'])
+    self.assertEquals(-1, perf_dict['received_transactions'])
+    self.assertTrue(len(perf_dict['stream']) > 50)
+    self.assertEquals('-1', perf_dict['code'])
+
+
+if __name__ == "__main__":
+  unittest.main()
diff --git a/testrunner/tests/android_manifest_tests.py b/testrunner/tests/android_manifest_tests.py
new file mode 100755
index 0000000..2817726
--- /dev/null
+++ b/testrunner/tests/android_manifest_tests.py
@@ -0,0 +1,42 @@
+#!/usr/bin/python2.4
+#
+#
+# Copyright 2009, The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+import unittest
+sys.path.append('../..')
+
+from testrunner import android_manifest
+
+
+class AndroidManifestTest(unittest.TestCase):
+  """Unit tests for AndroidManifest."""
+
+  def setUp(self):
+    """Create android_mainfest for testing from sample file."""
+    self._manifest = android_manifest.AndroidManifest(app_path='.')
+
+  def testGetPackageName(self):
+    self.assertEquals('com.example.android.tests',
+                      self._manifest.GetPackageName())
+
+  def testGetInstrumentationNames(self):
+    self.assertEquals(['android.test.InstrumentationTestRunner'],
+                      self._manifest.GetInstrumentationNames())
+
+
+if __name__ == '__main__':
+  unittest.main()
diff --git a/tools/anttasks/src/com/android/ant/AaptExecLoopTask.java b/tools/anttasks/src/com/android/ant/AaptExecLoopTask.java
index ef74fe7..47b8f48 100644
--- a/tools/anttasks/src/com/android/ant/AaptExecLoopTask.java
+++ b/tools/anttasks/src/com/android/ant/AaptExecLoopTask.java
@@ -17,6 +17,7 @@
 package com.android.ant;
 
 import com.android.sdklib.internal.project.ApkConfigurationHelper;
+import com.android.sdklib.internal.project.ApkSettings;
 import com.android.sdklib.internal.project.ProjectProperties;
 import com.android.sdklib.internal.project.ProjectProperties.PropertyType;
 
@@ -28,7 +29,6 @@
 
 import java.io.File;
 import java.util.Map;
-import java.util.Set;
 import java.util.Map.Entry;
 
 /**
@@ -38,7 +38,7 @@
  *
  */
 public final class AaptExecLoopTask extends Task {
-    
+
     private String mExecutable;
     private String mCommand;
     private String mManifest;
@@ -55,7 +55,7 @@
     public void setExecutable(String executable) {
         mExecutable = executable;
     }
-    
+
     /**
      * Sets the value of the "command" attribute.
      * @param command the value.
@@ -63,7 +63,7 @@
     public void setCommand(String command) {
         mCommand = command;
     }
-    
+
     /**
      * Sets the value of the "manifest" attribute.
      * @param manifest the value.
@@ -71,7 +71,7 @@
     public void setManifest(Path manifest) {
         mManifest = manifest.toString();
     }
-    
+
     /**
      * Sets the value of the "resources" attribute.
      * @param resources the value.
@@ -79,7 +79,7 @@
     public void setResources(Path resources) {
         mResources = resources.toString();
     }
-    
+
     /**
      * Sets the value of the "assets" attribute.
      * @param assets the value.
@@ -87,7 +87,7 @@
     public void setAssets(Path assets) {
         mAssets = assets.toString();
     }
-    
+
     /**
      * Sets the value of the "androidjar" attribute.
      * @param androidJar the value.
@@ -95,7 +95,7 @@
     public void setAndroidjar(Path androidJar) {
         mAndroidJar = androidJar.toString();
     }
-    
+
     /**
      * Sets the value of the "outfolder" attribute.
      * @param outFolder the value.
@@ -103,7 +103,7 @@
     public void setOutfolder(Path outFolder) {
         mOutFolder = outFolder.toString();
     }
-    
+
     /**
      * Sets the value of the "basename" attribute.
      * @param baseName the value.
@@ -111,19 +111,19 @@
     public void setBasename(String baseName) {
         mBaseName = baseName;
     }
-    
+
     /*
      * (non-Javadoc)
-     * 
+     *
      * Executes the loop. Based on the values inside default.properties, this will
      * create alternate temporary ap_ files.
-     * 
+     *
      * @see org.apache.tools.ant.Task#execute()
      */
     @Override
     public void execute() throws BuildException {
         Project taskProject = getProject();
-        
+
         // first do a full resource package
         createPackage(null /*configName*/, null /*resourceFilter*/);
 
@@ -132,12 +132,15 @@
         File baseDir = taskProject.getBaseDir();
         ProjectProperties properties = ProjectProperties.load(baseDir.getAbsolutePath(),
                 PropertyType.DEFAULT);
-        
-        Map<String, String> apkConfigs = ApkConfigurationHelper.getConfigs(properties);
-        if (apkConfigs.size() > 0) {
-            Set<Entry<String, String>> entrySet = apkConfigs.entrySet();
-            for (Entry<String, String> entry : entrySet) {
-                createPackage(entry.getKey(), entry.getValue());
+
+
+        ApkSettings apkSettings = ApkConfigurationHelper.getSettings(properties);
+        if (apkSettings != null) {
+            Map<String, String> apkFilters = apkSettings.getResourceFilters();
+            if (apkFilters.size() > 0) {
+                for (Entry<String, String> entry : apkFilters.entrySet()) {
+                    createPackage(entry.getKey(), entry.getValue());
+                }
             }
         }
     }
@@ -164,19 +167,19 @@
         ExecTask task = new ExecTask();
         task.setExecutable(mExecutable);
         task.setFailonerror(true);
-        
+
         // aapt command. Only "package" is supported at this time really.
         task.createArg().setValue(mCommand);
-        
+
         // filters if needed
         if (configName != null && resourceFilter != null) {
             task.createArg().setValue("-c");
             task.createArg().setValue(resourceFilter);
         }
-        
+
         // force flag
         task.createArg().setValue("-f");
-        
+
         // manifest location
         task.createArg().setValue("-M");
         task.createArg().setValue(mManifest);
@@ -187,18 +190,18 @@
             task.createArg().setValue("-S");
             task.createArg().setValue(mResources);
         }
-        
+
         // assets location. This may not exists, and aapt doesn't like it, so we check first.
         File assets = new File(mAssets);
         if (assets.isDirectory()) {
             task.createArg().setValue("-A");
             task.createArg().setValue(mAssets);
         }
-        
+
         // android.jar
         task.createArg().setValue("-I");
         task.createArg().setValue(mAndroidJar);
-        
+
         // out file. This is based on the outFolder, baseName, and the configName (if applicable)
         String filename;
         if (configName != null && resourceFilter != null) {
@@ -206,15 +209,15 @@
         } else {
             filename = mBaseName + ".ap_";
         }
-        
+
         File file = new File(mOutFolder, filename);
         task.createArg().setValue("-F");
         task.createArg().setValue(file.getAbsolutePath());
-        
+
         // final setup of the task
         task.setProject(taskProject);
         task.setOwningTarget(getOwningTarget());
-        
+
         // execute it.
         task.execute();
     }
diff --git a/tools/anttasks/src/com/android/ant/ApkBuilderTask.java b/tools/anttasks/src/com/android/ant/ApkBuilderTask.java
index 9231dc9..a7ee02b 100644
--- a/tools/anttasks/src/com/android/ant/ApkBuilderTask.java
+++ b/tools/anttasks/src/com/android/ant/ApkBuilderTask.java
@@ -20,6 +20,7 @@
 import com.android.apkbuilder.internal.ApkBuilderImpl;
 import com.android.apkbuilder.internal.ApkBuilderImpl.ApkFile;
 import com.android.sdklib.internal.project.ApkConfigurationHelper;
+import com.android.sdklib.internal.project.ApkSettings;
 import com.android.sdklib.internal.project.ProjectProperties;
 import com.android.sdklib.internal.project.ProjectProperties.PropertyType;
 
@@ -35,7 +36,6 @@
 import java.io.FileNotFoundException;
 import java.util.ArrayList;
 import java.util.Map;
-import java.util.Set;
 import java.util.Map.Entry;
 
 public class ApkBuilderTask extends Task {
@@ -68,7 +68,8 @@
     private final ArrayList<Value> mZipList = new ArrayList<Value>();
     private final ArrayList<Value> mFileList = new ArrayList<Value>();
     private final ArrayList<Value> mSourceList = new ArrayList<Value>();
-    private final ArrayList<Value> mJarList = new ArrayList<Value>();
+    private final ArrayList<Value> mJarfolderList = new ArrayList<Value>();
+    private final ArrayList<Value> mJarfileList = new ArrayList<Value>();
     private final ArrayList<Value> mNativeList = new ArrayList<Value>();
 
     private final ArrayList<FileInputStream> mZipArchives = new ArrayList<FileInputStream>();
@@ -141,7 +142,16 @@
      */
     public Object createJarfolder() {
         Value file = new Value();
-        mJarList.add(file);
+        mJarfolderList.add(file);
+        return file;
+    }
+
+    /**
+     * Returns an object representing a nested <var>jarfile</var> element.
+     */
+    public Object createJarfile() {
+        Value file = new Value();
+        mJarfileList.add(file);
         return file;
     }
 
@@ -183,10 +193,15 @@
             }
 
             // now go through the list of jar folders.
-            for (Value v : mJarList) {
+            for (Value v : mJarfolderList) {
                 ApkBuilderImpl.processJarFolder(v.mPath, mResourcesJars);
             }
 
+            // now go through the list of jar files.
+            for (Value v : mJarfileList) {
+                ApkBuilderImpl.processJarFile(v.mPath, mResourcesJars);
+            }
+
             // now the native lib folder.
             for (Value v : mNativeList) {
                 String parameter = v.mPath;
@@ -212,13 +227,14 @@
             // release: {base}[-{config}]-unsigned.apk
             // Unfortunately for 1.5 projects and before the 'install' ant target expects the name
             // of the default debug package to be {base}-debug.apk
-            // In order to support those package, we look for the 'out-debug-unaligned-package'
+            // In order to support those package, we look for the 'out.debug.unaligned.package'
             // property. If this exist, then we generate {base}[-{config}]-debug-unaligned.apk
             // otherwise we generate {base}[-{config}]-debug.apk
             // FIXME: Make apkbuilder export the package name used instead of
             // having to keep apkbuilder and the rules file in sync
             String debugPackageSuffix = "-debug-unaligned.apk";
-            if (antProject.getProperty("out-debug-unaligned-package") == null) {
+            if (antProject.getProperty("out.debug.unaligned.package") == null
+                    && antProject.getProperty("out-debug-unaligned-package") == null) {
                 debugPackageSuffix = "-debug.apk";
             }
 
@@ -232,12 +248,14 @@
             ProjectProperties properties = ProjectProperties.load(baseDir.getAbsolutePath(),
                     PropertyType.DEFAULT);
 
-            Map<String, String> apkConfigs = ApkConfigurationHelper.getConfigs(properties);
-            if (apkConfigs.size() > 0) {
-                Set<Entry<String, String>> entrySet = apkConfigs.entrySet();
-                for (Entry<String, String> entry : entrySet) {
-                    createApk(apkBuilder, entry.getKey(), entry.getValue(), path,
-                            debugPackageSuffix);
+            ApkSettings apkSettings = ApkConfigurationHelper.getSettings(properties);
+            if (apkSettings != null) {
+                Map<String, String> apkFilters = apkSettings.getResourceFilters();
+                if (apkFilters.size() > 0) {
+                    for (Entry<String, String> entry : apkFilters.entrySet()) {
+                        createApk(apkBuilder, entry.getKey(), entry.getValue(), path,
+                                debugPackageSuffix);
+                    }
                 }
             }
 
diff --git a/tools/anttasks/src/com/android/ant/SetupTask.java b/tools/anttasks/src/com/android/ant/SetupTask.java
index 04afba7..f13cccd 100644
--- a/tools/anttasks/src/com/android/ant/SetupTask.java
+++ b/tools/anttasks/src/com/android/ant/SetupTask.java
@@ -16,13 +16,14 @@
 
 package com.android.ant;
 
+import com.android.sdklib.AndroidVersion;
 import com.android.sdklib.IAndroidTarget;
 import com.android.sdklib.ISdkLog;
 import com.android.sdklib.SdkManager;
 import com.android.sdklib.IAndroidTarget.IOptionalLibrary;
 import com.android.sdklib.internal.project.ProjectProperties;
 import com.android.sdklib.xml.AndroidXPathFactory;
-import com.android.sdklib.xml.ManifestConstants;
+import com.android.sdklib.xml.AndroidManifest;
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
@@ -58,11 +59,16 @@
  */
 public final class SetupTask extends ImportTask {
     private final static String ANDROID_RULES = "android_rules.xml";
-
+    // additional android rules for test project - depends on android_rules.xml
+    private final static String ANDROID_TEST_RULES = "android_test_rules.xml";
     // ant property with the path to the android.jar
-    private final static String PROPERTY_ANDROID_JAR = "android-jar";
+    private final static String PROPERTY_ANDROID_JAR = "android.jar";
+    // LEGACY - compatibility with 1.6 and before
+    private final static String PROPERTY_ANDROID_JAR_LEGACY = "android-jar";
     // ant property with the path to the framework.jar
-    private final static String PROPERTY_ANDROID_AIDL = "android-aidl";
+    private final static String PROPERTY_ANDROID_AIDL = "android.aidl";
+    // LEGACY - compatibility with 1.6 and before
+    private final static String PROPERTY_ANDROID_AIDL_LEGACY = "android-aidl";
     // ant property with the path to the aapt tool
     private final static String PROPERTY_AAPT = "aapt";
     // ant property with the path to the aidl tool
@@ -83,7 +89,13 @@
 
         // check if it's valid and exists
         if (sdkLocation == null || sdkLocation.length() == 0) {
-            throw new BuildException("SDK Location is not set.");
+            // LEGACY support: project created with 1.6 or before may be using a different
+            // property to declare the location of the SDK. At this point, we cannot
+            // yet check which target is running so we check both always.
+            sdkLocation = antProject.getProperty(ProjectProperties.PROPERTY_SDK_LEGACY);
+            if (sdkLocation == null || sdkLocation.length() == 0) {
+                throw new BuildException("SDK Location is not set.");
+            }
         }
 
         File sdk = new File(sdkLocation);
@@ -93,6 +105,13 @@
 
         // get the target property value
         String targetHashString = antProject.getProperty(ProjectProperties.PROPERTY_TARGET);
+
+        boolean isTestProject = false;
+
+        if (antProject.getProperty("tested.project.dir") != null) {
+            isTestProject = true;
+        }
+
         if (targetHashString == null) {
             throw new BuildException("Android Target is not set.");
         }
@@ -142,18 +161,16 @@
         }
         System.out.println("API level: " + androidTarget.getVersion().getApiString());
 
-        // if needed check the manifest so that it matches the target
-        if (androidTarget.getVersion().isPreview()) {
-            // for preview, the manifest minSdkVersion node *must* match the target codename
-            checkManifest(antProject, androidTarget.getVersion().getCodename());
-        }
+        // always check the manifest minSdkVersion.
+        checkManifest(antProject, androidTarget.getVersion());
 
         // sets up the properties to find android.jar/framework.aidl/target tools
         String androidJar = androidTarget.getPath(IAndroidTarget.ANDROID_JAR);
         antProject.setProperty(PROPERTY_ANDROID_JAR, androidJar);
 
-        antProject.setProperty(PROPERTY_ANDROID_AIDL,
-                androidTarget.getPath(IAndroidTarget.ANDROID_AIDL));
+        String androidAidl = androidTarget.getPath(IAndroidTarget.ANDROID_AIDL);
+        antProject.setProperty(PROPERTY_ANDROID_AIDL, androidAidl);
+
         antProject.setProperty(PROPERTY_AAPT, androidTarget.getPath(IAndroidTarget.AAPT));
         antProject.setProperty(PROPERTY_AIDL, androidTarget.getPath(IAndroidTarget.AIDL));
         antProject.setProperty(PROPERTY_DX, androidTarget.getPath(IAndroidTarget.DX));
@@ -188,21 +205,37 @@
         // find the file to import, and import it.
         String templateFolder = androidTarget.getPath(IAndroidTarget.TEMPLATES);
 
+        // LEGACY support. android_rules.xml in older platforms expects properties with
+        // older names. This sets those properties to make sure the rules will work.
+        if (androidTarget.getVersion().getApiLevel() <= 4) { // 1.6 and earlier
+            antProject.setProperty(PROPERTY_ANDROID_JAR_LEGACY, androidJar);
+            antProject.setProperty(PROPERTY_ANDROID_AIDL_LEGACY, androidAidl);
+            antProject.setProperty(ProjectProperties.PROPERTY_SDK_LEGACY, sdkLocation);
+            String appPackage = antProject.getProperty(ProjectProperties.PROPERTY_APP_PACKAGE);
+            if (appPackage != null && appPackage.length() > 0) {
+                antProject.setProperty(ProjectProperties.PROPERTY_APP_PACKAGE_LEGACY, appPackage);
+            }
+        }
+
         // Now the import section. This is only executed if the task actually has to import a file.
         if (mDoImport) {
             // make sure the file exists.
             File templates = new File(templateFolder);
+
             if (templates.isDirectory() == false) {
                 throw new BuildException(String.format("Template directory '%s' is missing.",
                         templateFolder));
             }
 
+            String importedRulesFileName = isTestProject ? ANDROID_TEST_RULES : ANDROID_RULES;
+
             // now check the rules file exists.
-            File rules = new File(templateFolder, ANDROID_RULES);
+            File rules = new File(templateFolder, importedRulesFileName);
+
             if (rules.isFile() == false) {
                 throw new BuildException(String.format("Build rules file '%s' is missing.",
                         templateFolder));
-           }
+            }
 
             // set the file location to import
             setFile(rules.getAbsolutePath());
@@ -220,22 +253,65 @@
         mDoImport = value;
     }
 
-    private void checkManifest(Project antProject, String codename) {
+    /**
+     * Checks the manifest <code>minSdkVersion</code> attribute.
+     * @param antProject the ant project
+     * @param androidVersion the version of the platform the project is compiling against.
+     */
+    private void checkManifest(Project antProject, AndroidVersion androidVersion) {
         try {
             File manifest = new File(antProject.getBaseDir(), "AndroidManifest.xml");
 
             XPath xPath = AndroidXPathFactory.newXPath();
 
-            String value = xPath.evaluate("/" + ManifestConstants.NODE_MANIFEST +"/" +
-                    ManifestConstants.NODE_USES_SDK + "/@" +
-                    AndroidXPathFactory.DEFAULT_NS_PREFIX + ":" +
-                    ManifestConstants.ATTRIBUTE_MIN_SDK_VERSION,
+            String value = xPath.evaluate(
+                    "/"  + AndroidManifest.NODE_MANIFEST +
+                    "/"  + AndroidManifest.NODE_USES_SDK +
+                    "/@" + AndroidXPathFactory.DEFAULT_NS_PREFIX + ":" +
+                            AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION,
                     new InputSource(new FileInputStream(manifest)));
 
-            if (codename.equals(value) == false) {
-                throw new BuildException(String.format("For '%1$s' SDK Preview, application manifest must declare minSdkVersion to '%1$s'",
-                        codename));
+            if (androidVersion.isPreview()) {
+                // in preview mode, the content of the minSdkVersion must match exactly the
+                // platform codename.
+                String codeName = androidVersion.getCodename();
+                if (codeName.equals(value) == false) {
+                    throw new BuildException(String.format(
+                            "For '%1$s' SDK Preview, attribute minSdkVersion in AndroidManifest.xml must be '%1$s'",
+                            codeName));
+                }
+            } else if (value.length() > 0) {
+                // for normal platform, we'll only display warnings if the value is lower or higher
+                // than the target api level.
+                // First convert to an int.
+                int minSdkValue = -1;
+                try {
+                    minSdkValue = Integer.parseInt(value);
+                } catch (NumberFormatException e) {
+                    // looks like it's not a number: error!
+                    throw new BuildException(String.format(
+                            "Attribute %1$s in AndroidManifest.xml must be an Integer!",
+                            AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION));
+                }
+
+                int projectApiLevel = androidVersion.getApiLevel();
+                if (minSdkValue < projectApiLevel) {
+                    System.out.println(String.format(
+                            "WARNING: Attribute %1$s in AndroidManifest.xml (%2$d) is lower than the project target API level (%3$d)",
+                            AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION,
+                            minSdkValue, projectApiLevel));
+                } else if (minSdkValue > androidVersion.getApiLevel()) {
+                    System.out.println(String.format(
+                            "WARNING: Attribute %1$s in AndroidManifest.xml (%2$d) is higher than the project target API level (%3$d)",
+                            AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION,
+                            minSdkValue, projectApiLevel));
+                }
+            } else {
+                // no minSdkVersion? display a warning
+                System.out.println(
+                        "WARNING: No minSdkVersion value set. Application will install on all Android versions.");
             }
+
         } catch (XPathExpressionException e) {
             throw new BuildException(e);
         } catch (FileNotFoundException e) {
diff --git a/tools/anttasks/src/com/android/ant/XPathTask.java b/tools/anttasks/src/com/android/ant/XPathTask.java
new file mode 100644
index 0000000..b9cfb71
--- /dev/null
+++ b/tools/anttasks/src/com/android/ant/XPathTask.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ant;
+
+import com.android.sdklib.xml.AndroidXPathFactory;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Path;
+import org.xml.sax.InputSource;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpressionException;
+
+/**
+ * Android specific XPath task.
+ * The goal is to get the result of an XPath expression on Android XML files. The android namespace
+ * (http://schemas.android.com/apk/res/android) must be associated to the "android" prefix.
+ */
+public class XPathTask extends Task {
+
+    private Path mManifestFile;
+    private String mProperty;
+    private String mExpression;
+
+    public void setInput(Path manifestFile) {
+        mManifestFile = manifestFile;
+    }
+
+    public void setOutput(String property) {
+        mProperty = property;
+    }
+
+    public void setExpression(String expression) {
+        mExpression = expression;
+    }
+
+    @Override
+    public void execute() throws BuildException {
+        try {
+            if (mManifestFile == null || mManifestFile.list().length == 0) {
+                throw new BuildException("input attribute is missing!");
+            }
+
+            if (mProperty == null) {
+                throw new BuildException("output attribute is missing!");
+            }
+
+            if (mExpression == null) {
+                throw new BuildException("expression attribute is missing!");
+            }
+
+            XPath xpath = AndroidXPathFactory.newXPath();
+
+            String file = mManifestFile.list()[0];
+            String result = xpath.evaluate(mExpression, new InputSource(new FileInputStream(file)));
+
+            getProject().setProperty(mProperty, result);
+        } catch (XPathExpressionException e) {
+            throw new BuildException(e);
+        } catch (FileNotFoundException e) {
+            throw new BuildException(e);
+        }
+    }
+}
diff --git a/tools/apkbuilder/src/com/android/apkbuilder/internal/ApkBuilderImpl.java b/tools/apkbuilder/src/com/android/apkbuilder/internal/ApkBuilderImpl.java
index 780af75..9d21c22 100644
--- a/tools/apkbuilder/src/com/android/apkbuilder/internal/ApkBuilderImpl.java
+++ b/tools/apkbuilder/src/com/android/apkbuilder/internal/ApkBuilderImpl.java
@@ -133,7 +133,12 @@
                     throw new WrongOptionException("Missing value for -rj");
                 }
 
-                processJarFolder(args[index++], resourcesJars);
+                File f = new File(args[index]);
+                if (f.isDirectory()) {
+                    processJarFolder(args[index++], resourcesJars);
+                } else if (f.isFile()) {
+                    processJarFile(args[index++], resourcesJars);
+                }
             } else if ("-nf".equals(argument)) {
                 // quick check on the next argument.
                 if (index == args.length) {
@@ -249,15 +254,18 @@
 
             for (String file : files) {
                 String path = f.getAbsolutePath() + File.separator + file;
-                FileInputStream input = new FileInputStream(path);
-                resourcesJars.add(input);
+                processJarFile(path, resourcesJars);
             }
         } else {
-            FileInputStream input = new FileInputStream(parameter);
-            resourcesJars.add(input);
+            processJarFile(parameter, resourcesJars);
         }
     }
 
+    public static void processJarFile(String jarfilePath, Collection<FileInputStream> resourcesJars)
+            throws FileNotFoundException {
+        FileInputStream input = new FileInputStream(jarfilePath);
+        resourcesJars.add(input);
+    }
 
     /**
      * Processes a {@link File} that could be a {@link ApkFile}, or a folder containing
diff --git a/tools/ddms/app/.classpath b/tools/ddms/app/.classpath
index 2fa1fb7..1040688 100644
--- a/tools/ddms/app/.classpath
+++ b/tools/ddms/app/.classpath
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry excluding="Makefile|resources/" kind="src" path="src"/>
+	<classpathentry kind="src" path="src/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/ANDROID_SWT"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/ddmlib"/>
diff --git a/tools/ddms/app/etc/ddms b/tools/ddms/app/etc/ddms
index e9ee6a0..1367aeb 100755
--- a/tools/ddms/app/etc/ddms
+++ b/tools/ddms/app/etc/ddms
@@ -62,23 +62,21 @@
     java_debug=
 fi
 
+javaCmd="java"
+
 # Mac OS X needs an additional arg, or you get an "illegal thread" complaint.
 if [ `uname` = "Darwin" ]; then
     os_opts="-XstartOnFirstThread"
-    #because Java 1.6 is 64 bits only and SWT doesn't support this, we force the usage of java 1.5
-    java_cmd="/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/java"
 else
     os_opts=
-    java_cmd="java"
 fi
 
-if [ "$OSTYPE" = "cygwin" ] ; then
-    jarpath=`cygpath -w  "$frameworkdir/$jarfile"`
-    progdir=`cygpath -w  "$progdir"`
-else
-    jarpath="$frameworkdir/$jarfile"
+if [ `uname` = "Linux" ]; then
+    export GDK_NATIVE_WINDOWS=true
 fi
 
+jarpath="$frameworkdir/$jarfile"
+
 # Figure out the path to the swt.jar for the current architecture.
 # if ANDROID_SWT is defined, then just use this.
 # else, if running in the Android source tree, then look for the correct swt folder in prebuilt
@@ -87,7 +85,7 @@
 if [ -n "$ANDROID_SWT" ]; then
     swtpath="$ANDROID_SWT"
 else
-    vmarch=`java -jar "${frameworkdir}"/archquery.jar`
+    vmarch=`${javaCmd} -jar "${frameworkdir}"/archquery.jar`
     if [ -n "$ANDROID_BUILD_TOP" ]; then
         osname=`uname -s | tr A-Z a-z`
         swtpath="${ANDROID_BUILD_TOP}/prebuilt/${osname}-${vmarch}/swt"
@@ -107,4 +105,4 @@
 
 # need to use "java.ext.dirs" because "-jar" causes classpath to be ignored
 # might need more memory, e.g. -Xmx128M
-exec "$java_cmd" -Xmx256M $os_opts $java_debug -Djava.ext.dirs="$frameworkdir" -Dcom.android.ddms.bindir="$progdir" -jar "$jarpath" "$@"
+exec "$javaCmd" -Xmx256M $os_opts $java_debug -Djava.ext.dirs="$frameworkdir" -Dcom.android.ddms.bindir="$progdir" -jar "$jarpath" "$@"
diff --git a/tools/ddms/app/src/com/android/ddms/AboutDialog.java b/tools/ddms/app/src/com/android/ddms/AboutDialog.java
index 2910e5e..e946aee 100644
--- a/tools/ddms/app/src/com/android/ddms/AboutDialog.java
+++ b/tools/ddms/app/src/com/android/ddms/AboutDialog.java
@@ -124,7 +124,11 @@
 
         // Text lines
         label = new Label(textArea, SWT.NONE);
-        label.setText("Dalvik Debug Monitor v" + Main.VERSION);
+        if (Main.sRevision != null && Main.sRevision.length() > 0) {
+            label.setText("Dalvik Debug Monitor Revision " + Main.sRevision);
+        } else {
+            label.setText("Dalvik Debug Monitor");
+        }
         label = new Label(textArea, SWT.NONE);
         label.setText("Copyright 2007, The Android Open Source Project");
         label = new Label(textArea, SWT.NONE);
diff --git a/tools/ddms/app/src/com/android/ddms/DeviceCommandDialog.java b/tools/ddms/app/src/com/android/ddms/DeviceCommandDialog.java
index befb994..6145733 100644
--- a/tools/ddms/app/src/com/android/ddms/DeviceCommandDialog.java
+++ b/tools/ddms/app/src/com/android/ddms/DeviceCommandDialog.java
@@ -138,7 +138,7 @@
         shell.addListener(SWT.Close, new Listener() {
             public void handleEvent(Event event) {
                 if (!mFinished) {
-                    Log.i("ddms", "NOT closing - cancelling command");
+                    Log.d("ddms", "NOT closing - cancelling command");
                     event.doit = false;
                     mCancel = true;
                 }
@@ -354,7 +354,7 @@
             PrefsDialog.getStore().setValue("lastTextSaveDir",
                                             dlg.getFilterPath());
 
-            Log.i("ddms", "Saving output to " + fileName);
+            Log.d("ddms", "Saving output to " + fileName);
 
             /*
              * Convert to 8-bit characters.
diff --git a/tools/ddms/app/src/com/android/ddms/DropdownSelectionListener.java b/tools/ddms/app/src/com/android/ddms/DropdownSelectionListener.java
index 99d63ce..04d921c 100644
--- a/tools/ddms/app/src/com/android/ddms/DropdownSelectionListener.java
+++ b/tools/ddms/app/src/com/android/ddms/DropdownSelectionListener.java
@@ -73,7 +73,7 @@
             mMenu.setVisible(true);
         } else {
             // button clicked
-            Log.i("ddms", mDropdown.getText() + " Pressed");
+            Log.d("ddms", mDropdown.getText() + " Pressed");
         }
     }
 }
diff --git a/tools/ddms/app/src/com/android/ddms/Main.java b/tools/ddms/app/src/com/android/ddms/Main.java
index d545ed9..050519f 100644
--- a/tools/ddms/app/src/com/android/ddms/Main.java
+++ b/tools/ddms/app/src/com/android/ddms/Main.java
@@ -21,10 +21,15 @@
 import com.android.ddmlib.Log;
 import com.android.sdkstats.SdkStatsService;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.lang.management.ManagementFactory;
 import java.lang.management.RuntimeMXBean;
+import java.util.Properties;
 
 
 /**
@@ -32,8 +37,7 @@
  */
 public class Main {
 
-    /** User visible version number. */
-    public static final String VERSION = "0.8.1";
+    public static String sRevision;
 
     public Main() {
     }
@@ -67,7 +71,7 @@
                     "JAVA_STARTED_ON_FIRST_THREAD_" + (rt.getName().split("@"))[0], //$NON-NLS-1$
                     "1"); //$NON-NLS-1$
         }
-        
+
         Thread.setDefaultUncaughtExceptionHandler(new UncaughtHandler());
 
         // load prefs and init the default values
@@ -85,8 +89,12 @@
             System.exit(1);
         }
 
-        // ddms itself is wanted: send a ping for ourselves
-        SdkStatsService.ping("ddms", VERSION, null);  //$NON-NLS-1$
+        // get the ddms parent folder location
+        String ddmsParentLocation = System.getProperty("com.android.ddms.bindir"); //$NON-NLS-1$
+
+        // we're past the point where ddms can be called just to send a ping, so we can
+        // ping for ddms itself.
+        ping(ddmsParentLocation);
 
         DebugPortManager.setProvider(DebugPortProvider.getInstance());
 
@@ -94,17 +102,38 @@
         UIThread ui = UIThread.getInstance();
 
         try {
-            ui.runUI();
+            ui.runUI(ddmsParentLocation);
         } finally {
             PrefsDialog.save();
-    
+
             AndroidDebugBridge.terminate();
         }
 
         Log.d("ddms", "Bye");
-        
+
         // this is kinda bad, but on MacOS the shutdown doesn't seem to finish because of
         // a thread called AWT-Shutdown. This will help while I track this down.
         System.exit(0);
     }
+
+    public static void ping(String ddmsParentLocation) {
+        Properties p = new Properties();
+        try{
+            File sourceProp;
+            if (ddmsParentLocation != null && ddmsParentLocation.length() > 0) {
+                sourceProp = new File(ddmsParentLocation, "source.properties"); //$NON-NLS-1$
+            } else {
+                sourceProp = new File("source.properties"); //$NON-NLS-1$
+            }
+            p.load(new FileInputStream(sourceProp));
+            sRevision = p.getProperty("Pkg.Revision"); //$NON-NLS-1$
+            if (sRevision != null && sRevision.length() > 0) {
+                SdkStatsService.ping("ddms", sRevision, null);  //$NON-NLS-1$
+            }
+        } catch (FileNotFoundException e) {
+            // couldn't find the file? don't ping.
+        } catch (IOException e) {
+            // couldn't find the file? don't ping.
+        }
+    }
 }
diff --git a/tools/ddms/app/src/com/android/ddms/PrefsDialog.java b/tools/ddms/app/src/com/android/ddms/PrefsDialog.java
index 69c48b0..fbdbfe6 100644
--- a/tools/ddms/app/src/com/android/ddms/PrefsDialog.java
+++ b/tools/ddms/app/src/com/android/ddms/PrefsDialog.java
@@ -17,6 +17,7 @@
 
 package com.android.ddms;
 
+import com.android.ddmlib.DdmConstants;
 import com.android.ddmlib.DdmPreferences;
 import com.android.ddmlib.Log;
 import com.android.ddmlib.Log.LogLevel;
@@ -81,10 +82,9 @@
     private final static String PREFS_SELECTED_DEBUG_PORT = "debugSelectedPort"; //$NON-NLS-1$
     private final static String PREFS_DEFAULT_THREAD_UPDATE = "defaultThreadUpdateEnabled"; //$NON-NLS-1$
     private final static String PREFS_DEFAULT_HEAP_UPDATE = "defaultHeapUpdateEnabled"; //$NON-NLS-1$
-
     private final static String PREFS_THREAD_REFRESH_INTERVAL = "threadStatusInterval"; //$NON-NLS-1$
-
     private final static String PREFS_LOG_LEVEL = "ddmsLogLevel"; //$NON-NLS-1$
+    private final static String PREFS_TIMEOUT = "timeOut"; //$NON-NLS-1$
 
 
     /**
@@ -126,9 +126,9 @@
      */
     public static void init() {
         assert mPrefStore == null;
-        
+
         mPrefStore = SdkStatsService.getPreferenceStore();
-        
+
         if (mPrefStore == null) {
             // we have a serious issue here...
             Log.e("ddms",
@@ -150,6 +150,7 @@
         DdmPreferences.setLogLevel(mPrefStore.getString(PREFS_LOG_LEVEL));
         DdmPreferences.setInitialThreadUpdate(mPrefStore.getBoolean(PREFS_DEFAULT_THREAD_UPDATE));
         DdmPreferences.setInitialHeapUpdate(mPrefStore.getBoolean(PREFS_DEFAULT_HEAP_UPDATE));
+        DdmPreferences.setTimeOut(mPrefStore.getInt(PREFS_TIMEOUT));
 
         // some static values
         String out = System.getenv("ANDROID_PRODUCT_OUT"); //$NON-NLS-1$
@@ -158,9 +159,9 @@
 
         String traceview = System.getProperty("com.android.ddms.bindir");  //$NON-NLS-1$
         if (traceview != null && traceview.length() != 0) {
-            traceview += File.separator + "traceview"; //$NON-NLS-1$
+            traceview += File.separator + DdmConstants.FN_TRACEVIEW;
         } else {
-            traceview = "traceview"; //$NON-NLS-1$
+            traceview = DdmConstants.FN_TRACEVIEW;
         }
         DdmUiPreferences.setTraceviewLocation(traceview);
 
@@ -194,6 +195,8 @@
 
         mPrefStore.setDefault(PREFS_LOG_LEVEL, "info"); //$NON-NLS-1$
 
+        mPrefStore.setDefault(PREFS_TIMEOUT, DdmPreferences.DEFAULT_TIMEOUT);
+
         // choose a default font for the text output
         FontData fdat = new FontData("Courier", 10, SWT.NORMAL); //$NON-NLS-1$
         mPrefStore.setDefault("textOutputFont", fdat.toString()); //$NON-NLS-1$
@@ -234,7 +237,8 @@
             } else if (changed.equals("imageSaveDir")) {
                 mPrefStore.setValue("lastImageSaveDir",
                     (String) event.getNewValue());
-
+            } else if (changed.equals(PREFS_TIMEOUT)) {
+                DdmPreferences.setTimeOut(mPrefStore.getInt(PREFS_TIMEOUT));
             } else {
                 Log.v("ddms", "Preference change: " + event.getProperty()
                     + ": '" + event.getOldValue()
@@ -258,20 +262,17 @@
         //PreferenceNode app = new PreferenceNode("app", "Application", null,
         //    AppPrefs.class.getName());
 
-        node = new PreferenceNode("client", new ClientPrefs());
+        node = new PreferenceNode("debugger", new DebuggerPrefs());
         prefMgr.addToRoot(node);
 
         subNode = new PreferenceNode("panel", new PanelPrefs());
         //prefMgr.addTo(node.getId(), subNode);
         prefMgr.addToRoot(subNode);
 
-        node = new PreferenceNode("device", new DevicePrefs());
-        prefMgr.addToRoot(node);
-
         node = new PreferenceNode("LogCat", new LogCatPrefs());
         prefMgr.addToRoot(node);
 
-        node = new PreferenceNode("app", new AppPrefs());
+        node = new PreferenceNode("misc", new MiscPrefs());
         prefMgr.addToRoot(node);
 
         node = new PreferenceNode("stats", new UsageStatsPrefs());
@@ -296,16 +297,16 @@
     }
 
     /**
-     * "Client Scan" prefs page.
+     * "Debugger" prefs page.
      */
-    private static class ClientPrefs extends FieldEditorPreferencePage {
+    private static class DebuggerPrefs extends FieldEditorPreferencePage {
 
         /**
          * Basic constructor.
          */
-        public ClientPrefs() {
+        public DebuggerPrefs() {
             super(GRID);        // use "grid" layout so edit boxes line up
-            setTitle("Client Scan");
+            setTitle("Debugger");
         }
 
          /**
@@ -316,11 +317,11 @@
             IntegerFieldEditor ife;
 
             ife = new PortFieldEditor(PREFS_DEBUG_PORT_BASE,
-                "ADB debugger base:", getFieldEditorParent());
+                "Starting value for local port:", getFieldEditorParent());
             addField(ife);
 
             ife = new PortFieldEditor(PREFS_SELECTED_DEBUG_PORT,
-                "Debug selected VM:", getFieldEditorParent());
+                "Port of Selected VM:", getFieldEditorParent());
             addField(ife);
         }
     }
@@ -362,41 +363,6 @@
     }
 
     /**
-     * "Device" prefs page.
-     */
-    private static class DevicePrefs extends FieldEditorPreferencePage {
-
-        /**
-         * Basic constructor.
-         */
-        public DevicePrefs() {
-            super(FLAT);        // use "flat" layout
-            setTitle("Device");
-        }
-
-        /**
-         * Create field editors.
-         */
-        @Override
-        protected void createFieldEditors() {
-            DirectoryFieldEditor dfe;
-            FontFieldEditor ffe;
-
-            dfe = new DirectoryFieldEditor("textSaveDir",
-                "Default text save dir:", getFieldEditorParent());
-            addField(dfe);
-
-            dfe = new DirectoryFieldEditor("imageSaveDir",
-                "Default image save dir:", getFieldEditorParent());
-            addField(dfe);
-
-            ffe = new FontFieldEditor("textOutputFont", "Text output font:",
-                getFieldEditorParent());
-            addField(ffe);
-        }
-    }
-
-    /**
      * "logcat" prefs page.
      */
     private static class LogCatPrefs extends FieldEditorPreferencePage {
@@ -430,18 +396,17 @@
         }
     }
 
-
     /**
-     * "Application" prefs page.
+     * "misc" prefs page.
      */
-    private static class AppPrefs extends FieldEditorPreferencePage {
+    private static class MiscPrefs extends FieldEditorPreferencePage {
 
         /**
          * Basic constructor.
          */
-        public AppPrefs() {
+        public MiscPrefs() {
             super(FLAT);        // use "flat" layout
-            setTitle("DDMS");
+            setTitle("Misc");
         }
 
         /**
@@ -449,6 +414,25 @@
          */
         @Override
         protected void createFieldEditors() {
+            DirectoryFieldEditor dfe;
+            FontFieldEditor ffe;
+
+            IntegerFieldEditor ife = new IntegerFieldEditor(PREFS_TIMEOUT,
+                    "ADB connection time out (ms):", getFieldEditorParent());
+            addField(ife);
+
+            dfe = new DirectoryFieldEditor("textSaveDir",
+                "Default text save dir:", getFieldEditorParent());
+            addField(dfe);
+
+            dfe = new DirectoryFieldEditor("imageSaveDir",
+                "Default image save dir:", getFieldEditorParent());
+            addField(dfe);
+
+            ffe = new FontFieldEditor("textOutputFont", "Text output font:",
+                getFieldEditorParent());
+            addField(ffe);
+
             RadioGroupFieldEditor rgfe;
 
             rgfe = new RadioGroupFieldEditor(PREFS_LOG_LEVEL,
diff --git a/tools/ddms/app/src/com/android/ddms/UIThread.java b/tools/ddms/app/src/com/android/ddms/UIThread.java
index 86cab20..c98b3f1 100644
--- a/tools/ddms/app/src/com/android/ddms/UIThread.java
+++ b/tools/ddms/app/src/com/android/ddms/UIThread.java
@@ -18,13 +18,18 @@
 
 import com.android.ddmlib.AndroidDebugBridge;
 import com.android.ddmlib.Client;
+import com.android.ddmlib.ClientData;
 import com.android.ddmlib.IDevice;
 import com.android.ddmlib.Log;
+import com.android.ddmlib.SyncService;
+import com.android.ddmlib.AndroidDebugBridge.IClientChangeListener;
+import com.android.ddmlib.ClientData.IHprofDumpHandler;
+import com.android.ddmlib.ClientData.MethodProfilingStatus;
 import com.android.ddmlib.Log.ILogOutput;
 import com.android.ddmlib.Log.LogLevel;
+import com.android.ddmlib.SyncService.SyncResult;
 import com.android.ddmuilib.AllocationPanel;
 import com.android.ddmuilib.DevicePanel;
-import com.android.ddmuilib.DevicePanel.IUiSelectionListener;
 import com.android.ddmuilib.EmulatorControlPanel;
 import com.android.ddmuilib.HeapPanel;
 import com.android.ddmuilib.ITableFocusListener;
@@ -36,8 +41,11 @@
 import com.android.ddmuilib.SysinfoPanel;
 import com.android.ddmuilib.TablePanel;
 import com.android.ddmuilib.ThreadPanel;
+import com.android.ddmuilib.DevicePanel.IUiSelectionListener;
 import com.android.ddmuilib.actions.ToolItemAction;
 import com.android.ddmuilib.explorer.DeviceExplorer;
+import com.android.ddmuilib.handler.BaseFileHandler;
+import com.android.ddmuilib.handler.MethodProfilingHandler;
 import com.android.ddmuilib.log.event.EventLogPanel;
 import com.android.ddmuilib.logcat.LogColors;
 import com.android.ddmuilib.logcat.LogFilter;
@@ -62,6 +70,7 @@
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Font;
 import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.layout.FormAttachment;
@@ -92,7 +101,7 @@
  * SWT application. So this class mainly builds the ui, and manages communication between the panels
  * when {@link IDevice} / {@link Client} selection changes.
  */
-public class UIThread implements IUiSelectionListener {
+public class UIThread implements IUiSelectionListener, IClientChangeListener {
     /*
      * UI tab panel definitions. The constants here must match up with the array
      * indices in mPanels. PANEL_CLIENT_LIST is a "virtual" panel representing
@@ -164,6 +173,8 @@
     private ToolItem mTBShowHeapUpdates;
     private ToolItem mTBHalt;
     private ToolItem mTBCauseGc;
+    private ToolItem mTBDumpHprof;
+    private ToolItem mTBProfiling;
 
     private ImageLoader mDdmsImageLoader;
     private ImageLoader mDdmuiLibImageLoader;
@@ -241,6 +252,10 @@
 
     private EventLogPanel mEventLogPanel;
 
+    private Image mTracingStartImage;
+
+    private Image mTracingStopImage;
+
     private class TableFocusListener implements ITableFocusListener {
 
         private IFocusedTableActivator mCurrentActivator;
@@ -280,6 +295,71 @@
 
     }
 
+    /**
+     * Handler for HPROF dumps.
+     * This will always prompt the user to save the HPROF file.
+     */
+    private class HProfHandler extends BaseFileHandler implements IHprofDumpHandler {
+
+        public HProfHandler(Shell parentShell) {
+            super(parentShell);
+        }
+
+        public void onFailure(final Client client) {
+            mDisplay.asyncExec(new Runnable() {
+                public void run() {
+                    try {
+                        displayError("Unable to create HPROF file for application '%1$s'.\n" +
+                                "Check logcat for more information.",
+                                client.getClientData().getClientDescription());
+                    } finally {
+                        // this will make sure the dump hprof button is re-enabled for the
+                        // current selection. as the client is finished dumping an hprof file
+                        enableButtons();
+                    }
+                }
+            });
+        }
+
+        public void onSuccess(final String remoteFilePath, final Client client) {
+            mDisplay.asyncExec(new Runnable() {
+                public void run() {
+                    final IDevice device = client.getDevice();
+                    try {
+                        // get the sync service to pull the HPROF file
+                        final SyncService sync = client.getDevice().getSyncService();
+                        if (sync != null) {
+                            SyncResult result = promptAndPull(sync,
+                                    client.getClientData().getClientDescription() + ".hprof",
+                                    remoteFilePath, "Save HPROF file");
+                            if (result != null && result.getCode() != SyncService.RESULT_OK) {
+                                displayError(
+                                        "Unable to download HPROF file from device '%1$s'.\n\n%2$s",
+                                        device.getSerialNumber(), result.getMessage());
+                            }
+                        } else {
+                            displayError("Unable to download HPROF file from device '%1$s'.",
+                                    device.getSerialNumber());
+                        }
+                    } catch (Exception e) {
+                        displayError("Unable to download HPROF file from device '%1$s'.",
+                                device.getSerialNumber());
+
+                    } finally {
+                        // this will make sure the dump hprof button is re-enabled for the
+                        // current selection. as the client is finished dumping an hprof file
+                        enableButtons();
+                    }
+                }
+            });
+        }
+
+        private void displayError(String format, Object... args) {
+            MessageDialog.openError(mParentShell, "HPROF Error",
+                    String.format(format, args));
+        }
+    }
+
 
     /**
      * Generic constructor.
@@ -324,11 +404,12 @@
 
     /**
      * Create SWT objects and drive the user interface event loop.
+     * @param location location of the folder that contains ddms.
      */
-    public void runUI() {
+    public void runUI(String ddmsParentLocation) {
         Display.setAppName("ddms");
         mDisplay = new Display();
-        Shell shell = new Shell(mDisplay);
+        final Shell shell = new Shell(mDisplay);
 
         // create the image loaders for DDMS and DDMUILIB
         mDdmsImageLoader = new ImageLoader(this.getClass());
@@ -360,10 +441,14 @@
             }
         });
 
+        // set the handler for hprof dump
+        ClientData.setHprofDumpHandler(new HProfHandler(shell));
+        ClientData.setMethodProfilingHandler(new MethodProfilingHandler(shell));
+
         // [try to] ensure ADB is running
-        String adbLocation = System.getProperty("com.android.ddms.bindir"); //$NON-NLS-1$
-        if (adbLocation != null && adbLocation.length() != 0) {
-            adbLocation += File.separator + "adb"; //$NON-NLS-1$
+        String adbLocation;
+        if (ddmsParentLocation != null && ddmsParentLocation.length() != 0) {
+            adbLocation = ddmsParentLocation + File.separator + "adb"; //$NON-NLS-1$
         } else {
             adbLocation = "adb"; //$NON-NLS-1$
         }
@@ -371,6 +456,9 @@
         AndroidDebugBridge.init(true /* debugger support */);
         AndroidDebugBridge.createBridge(adbLocation, true /* forceNewBridge */);
 
+        // we need to listen to client change to be notified of client status (profiling) change
+        AndroidDebugBridge.addClientChangeListener(this);
+
         shell.setText("Dalvik Debug Monitor");
         setConfirmClose(shell);
         createMenus(shell);
@@ -665,16 +753,16 @@
         actionMenu.addMenuListener(new MenuAdapter() {
             @Override
             public void menuShown(MenuEvent e) {
-                actionHaltItem.setEnabled(mTBHalt.getEnabled());
-                actionCauseGcItem.setEnabled(mTBCauseGc.getEnabled());
+                actionHaltItem.setEnabled(mTBHalt.getEnabled() && mCurrentClient != null);
+                actionCauseGcItem.setEnabled(mTBCauseGc.getEnabled() && mCurrentClient != null);
             }
         });
 
         // create Device menu items
-        item = new MenuItem(deviceMenu, SWT.NONE);
-        item.setText("&Screen capture...\tCTrl-S");
-        item.setAccelerator('S' | SWT.CONTROL);
-        item.addSelectionListener(new SelectionAdapter() {
+        final MenuItem screenShotItem = new MenuItem(deviceMenu, SWT.NONE);
+        screenShotItem.setText("&Screen capture...\tCTrl-S");
+        screenShotItem.setAccelerator('S' | SWT.CONTROL);
+        screenShotItem.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
                 if (mCurrentDevice != null) {
@@ -686,9 +774,9 @@
 
         new MenuItem(deviceMenu, SWT.SEPARATOR);
 
-        item = new MenuItem(deviceMenu, SWT.NONE);
-        item.setText("File Explorer...");
-        item.addSelectionListener(new SelectionAdapter() {
+        final MenuItem explorerItem = new MenuItem(deviceMenu, SWT.NONE);
+        explorerItem.setText("File Explorer...");
+        explorerItem.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
                 createFileExplorer();
@@ -697,9 +785,9 @@
 
         new MenuItem(deviceMenu, SWT.SEPARATOR);
 
-        item = new MenuItem(deviceMenu, SWT.NONE);
-        item.setText("Show &process status...");
-        item.addSelectionListener(new SelectionAdapter() {
+        final MenuItem processItem = new MenuItem(deviceMenu, SWT.NONE);
+        processItem.setText("Show &process status...");
+        processItem.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
                 DeviceCommandDialog dlg;
@@ -708,9 +796,9 @@
             }
         });
 
-        item = new MenuItem(deviceMenu, SWT.NONE);
-        item.setText("Dump &device state...");
-        item.addSelectionListener(new SelectionAdapter() {
+        final MenuItem deviceStateItem = new MenuItem(deviceMenu, SWT.NONE);
+        deviceStateItem.setText("Dump &device state...");
+        deviceStateItem.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
                 DeviceCommandDialog dlg;
@@ -720,10 +808,10 @@
             }
         });
 
-        item = new MenuItem(deviceMenu, SWT.NONE);
-        item.setText("Dump &app state...");
-        item.setEnabled(false);
-        item.addSelectionListener(new SelectionAdapter() {
+        final MenuItem appStateItem = new MenuItem(deviceMenu, SWT.NONE);
+        appStateItem.setText("Dump &app state...");
+        appStateItem.setEnabled(false);
+        appStateItem.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
                 DeviceCommandDialog dlg;
@@ -732,9 +820,9 @@
             }
         });
 
-        item = new MenuItem(deviceMenu, SWT.NONE);
-        item.setText("Dump &radio state...");
-        item.addSelectionListener(new SelectionAdapter() {
+        final MenuItem radioStateItem = new MenuItem(deviceMenu, SWT.NONE);
+        radioStateItem.setText("Dump &radio state...");
+        radioStateItem.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
                 DeviceCommandDialog dlg;
@@ -747,9 +835,9 @@
             }
         });
 
-        item = new MenuItem(deviceMenu, SWT.NONE);
-        item.setText("Run &logcat...");
-        item.addSelectionListener(new SelectionAdapter() {
+        final MenuItem logCatItem = new MenuItem(deviceMenu, SWT.NONE);
+        logCatItem.setText("Run &logcat...");
+        logCatItem.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
                 DeviceCommandDialog dlg;
@@ -759,6 +847,21 @@
             }
         });
 
+        // configure Action items based on current state
+        deviceMenu.addMenuListener(new MenuAdapter() {
+            @Override
+            public void menuShown(MenuEvent e) {
+                boolean deviceEnabled = mCurrentDevice != null;
+                screenShotItem.setEnabled(deviceEnabled);
+                explorerItem.setEnabled(deviceEnabled);
+                processItem.setEnabled(deviceEnabled);
+                deviceStateItem.setEnabled(deviceEnabled);
+                appStateItem.setEnabled(deviceEnabled);
+                radioStateItem.setEnabled(deviceEnabled);
+                logCatItem.setEnabled(deviceEnabled);
+            }
+        });
+
         // create Help menu items
         item = new MenuItem(helpMenu, SWT.NONE);
         item.setText("&Contents...");
@@ -893,6 +996,58 @@
     private void createDevicePanelToolBar(ToolBar toolBar) {
         Display display = toolBar.getDisplay();
 
+        // add "show heap updates" button
+        mTBShowHeapUpdates = new ToolItem(toolBar, SWT.CHECK);
+        mTBShowHeapUpdates.setImage(ImageHelper.loadImage(mDdmuiLibImageLoader, display,
+                DevicePanel.ICON_HEAP, DevicePanel.ICON_WIDTH, DevicePanel.ICON_WIDTH, null));
+        mTBShowHeapUpdates.setToolTipText("Show heap updates");
+        mTBShowHeapUpdates.setEnabled(false);
+        mTBShowHeapUpdates.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                if (mCurrentClient != null) {
+                    // boolean status = ((ToolItem)e.item).getSelection();
+                    // invert previous state
+                    boolean enable = !mCurrentClient.isHeapUpdateEnabled();
+                    mCurrentClient.setHeapUpdateEnabled(enable);
+                } else {
+                    e.doit = false; // this has no effect?
+                }
+            }
+        });
+
+        // add "dump HPROF" button
+        mTBDumpHprof = new ToolItem(toolBar, SWT.PUSH);
+        mTBDumpHprof.setToolTipText("Dump HPROF file");
+        mTBDumpHprof.setEnabled(false);
+        mTBDumpHprof.setImage(ImageHelper.loadImage(mDdmuiLibImageLoader, display,
+                DevicePanel.ICON_HPROF, DevicePanel.ICON_WIDTH, DevicePanel.ICON_WIDTH, null));
+        mTBDumpHprof.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                mDevicePanel.dumpHprof();
+
+                // this will make sure the dump hprof button is disabled for the current selection
+                // as the client is already dumping an hprof file
+                enableButtons();
+            }
+        });
+
+        // add "cause GC" button
+        mTBCauseGc = new ToolItem(toolBar, SWT.PUSH);
+        mTBCauseGc.setToolTipText("Cause an immediate GC");
+        mTBCauseGc.setEnabled(false);
+        mTBCauseGc.setImage(ImageHelper.loadImage(mDdmuiLibImageLoader, display,
+                DevicePanel.ICON_GC, DevicePanel.ICON_WIDTH, DevicePanel.ICON_WIDTH, null));
+        mTBCauseGc.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                mDevicePanel.forceGcOnSelectedClient();
+            }
+        });
+
+        new ToolItem(toolBar, SWT.SEPARATOR);
+
         // add "show thread updates" button
         mTBShowThreadUpdates = new ToolItem(toolBar, SWT.CHECK);
         mTBShowThreadUpdates.setImage(ImageHelper.loadImage(mDdmuiLibImageLoader, display,
@@ -914,23 +1069,21 @@
             }
         });
 
-        // add "show heap updates" button
-        mTBShowHeapUpdates = new ToolItem(toolBar, SWT.CHECK);
-        mTBShowHeapUpdates.setImage(ImageHelper.loadImage(mDdmuiLibImageLoader, display,
-                DevicePanel.ICON_HEAP, DevicePanel.ICON_WIDTH, DevicePanel.ICON_WIDTH, null));
-        mTBShowHeapUpdates.setToolTipText("Show heap updates");
-        mTBShowHeapUpdates.setEnabled(false);
-        mTBShowHeapUpdates.addSelectionListener(new SelectionAdapter() {
+        // add a start/stop method tracing
+        mTracingStartImage = ImageHelper.loadImage(mDdmuiLibImageLoader, display,
+                DevicePanel.ICON_TRACING_START,
+                DevicePanel.ICON_WIDTH, DevicePanel.ICON_WIDTH, null);
+        mTracingStopImage = ImageHelper.loadImage(mDdmuiLibImageLoader, display,
+                DevicePanel.ICON_TRACING_STOP,
+                DevicePanel.ICON_WIDTH, DevicePanel.ICON_WIDTH, null);
+        mTBProfiling = new ToolItem(toolBar, SWT.PUSH);
+        mTBProfiling.setToolTipText("Start Method Profiling");
+        mTBProfiling.setEnabled(false);
+        mTBProfiling.setImage(mTracingStartImage);
+        mTBProfiling.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
-                if (mCurrentClient != null) {
-                    // boolean status = ((ToolItem)e.item).getSelection();
-                    // invert previous state
-                    boolean enable = !mCurrentClient.isHeapUpdateEnabled();
-                    mCurrentClient.setHeapUpdateEnabled(enable);
-                } else {
-                    e.doit = false; // this has no effect?
-                }
+                mDevicePanel.toggleMethodProfiling();
             }
         });
 
@@ -950,21 +1103,6 @@
             }
         });
 
-        new ToolItem(toolBar, SWT.SEPARATOR);
-
-        // add "cause GC" button
-        mTBCauseGc = new ToolItem(toolBar, SWT.PUSH);
-        mTBCauseGc.setToolTipText("Cause an immediate GC in the target VM");
-        mTBCauseGc.setEnabled(false);
-        mTBCauseGc.setImage(ImageHelper.loadImage(mDdmuiLibImageLoader, display,
-                DevicePanel.ICON_GC, DevicePanel.ICON_WIDTH, DevicePanel.ICON_WIDTH, null));
-        mTBCauseGc.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                mDevicePanel.forceGcOnSelectedClient();
-            }
-        });
-
        toolBar.pack();
     }
 
@@ -1305,15 +1443,33 @@
 
             ToolItemAction pullAction = new ToolItemAction(toolBar, SWT.PUSH);
             pullAction.item.setToolTipText("Pull File from Device");
-            pullAction.item.setImage(mDdmuiLibImageLoader.loadImage("pull.png", mDisplay)); //$NON-NLS-1$
+            Image image = mDdmuiLibImageLoader.loadImage("pull.png", mDisplay); //$NON-NLS-1$
+            if (image != null) {
+                pullAction.item.setImage(image);
+            } else {
+                // this is for debugging purpose when the icon is missing
+                pullAction.item.setText("Pull"); //$NON-NLS-1$
+            }
 
             ToolItemAction pushAction = new ToolItemAction(toolBar, SWT.PUSH);
             pushAction.item.setToolTipText("Push file onto Device");
-            pushAction.item.setImage(mDdmuiLibImageLoader.loadImage("push.png", mDisplay)); //$NON-NLS-1$
+            image = mDdmuiLibImageLoader.loadImage("push.png", mDisplay); //$NON-NLS-1$
+            if (image != null) {
+                pushAction.item.setImage(image);
+            } else {
+                // this is for debugging purpose when the icon is missing
+                pushAction.item.setText("Push"); //$NON-NLS-1$
+            }
 
             ToolItemAction deleteAction = new ToolItemAction(toolBar, SWT.PUSH);
             deleteAction.item.setToolTipText("Delete");
-            deleteAction.item.setImage(mDdmuiLibImageLoader.loadImage("delete.png", mDisplay)); //$NON-NLS-1$
+            image = mDdmuiLibImageLoader.loadImage("delete.png", mDisplay); //$NON-NLS-1$
+            if (image != null) {
+                deleteAction.item.setImage(image);
+            } else {
+                // this is for debugging purpose when the icon is missing
+                deleteAction.item.setText("Delete"); //$NON-NLS-1$
+            }
 
             // device explorer
             mExplorer = new DeviceExplorer();
@@ -1438,6 +1594,31 @@
             mTBShowHeapUpdates.setEnabled(true);
             mTBHalt.setEnabled(true);
             mTBCauseGc.setEnabled(true);
+
+            ClientData data = mCurrentClient.getClientData();
+
+            if (data.hasFeature(ClientData.FEATURE_HPROF)) {
+                mTBDumpHprof.setEnabled(data.hasPendingHprofDump() == false);
+                mTBDumpHprof.setToolTipText("Dump HPROF file");
+            } else {
+                mTBDumpHprof.setEnabled(false);
+                mTBDumpHprof.setToolTipText("Dump HPROF file (not supported by this VM)");
+            }
+
+            if (data.hasFeature(ClientData.FEATURE_PROFILING)) {
+                mTBProfiling.setEnabled(true);
+                if (data.getMethodProfilingStatus() == MethodProfilingStatus.ON) {
+                    mTBProfiling.setToolTipText("Stop Method Profiling");
+                    mTBProfiling.setImage(mTracingStopImage);
+                } else {
+                    mTBProfiling.setToolTipText("Start Method Profiling");
+                    mTBProfiling.setImage(mTracingStartImage);
+                }
+            } else {
+                mTBProfiling.setEnabled(false);
+                mTBProfiling.setImage(mTracingStartImage);
+                mTBProfiling.setToolTipText("Start Method Profiling (not supported by this VM)");
+            }
         } else {
             // list is empty, disable these
             mTBShowThreadUpdates.setSelection(false);
@@ -1446,6 +1627,13 @@
             mTBShowHeapUpdates.setEnabled(false);
             mTBHalt.setEnabled(false);
             mTBCauseGc.setEnabled(false);
+
+            mTBDumpHprof.setEnabled(false);
+            mTBDumpHprof.setToolTipText("Dump HPROF file");
+
+            mTBProfiling.setEnabled(false);
+            mTBProfiling.setImage(mTracingStartImage);
+            mTBProfiling.setToolTipText("Start Method Profiling");
         }
     }
 
@@ -1488,4 +1676,18 @@
             enableButtons();
         }
     }
+
+    public void clientChanged(Client client, int changeMask) {
+        if ((changeMask & Client.CHANGE_METHOD_PROFILING_STATUS) ==
+                Client.CHANGE_METHOD_PROFILING_STATUS) {
+            if (mCurrentClient == client) {
+                mDisplay.asyncExec(new Runnable() {
+                    public void run() {
+                        // force refresh of the button enabled state.
+                        enableButtons();
+                    }
+                });
+            }
+        }
+    }
 }
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/AdbHelper.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/AdbHelper.java
index 5f0f271..ce8d366 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/AdbHelper.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/AdbHelper.java
@@ -40,8 +40,6 @@
 
     static final int WAIT_TIME = 5; // spin-wait sleep, in ms
 
-    public static final int STD_TIMEOUT = 5000; // standard delay, in ms
-
     static final String DEFAULT_ENCODING = "ISO-8859-1"; //$NON-NLS-1$
 
     /** do not instantiate */
@@ -288,7 +286,8 @@
                 return null;
             }
 
-            reply = new byte[16];
+            // first the protocol version.
+            reply = new byte[4];
             if (read(adbChan, reply) == false) {
                 Log.w("ddms", "got partial reply from ADB fb:");
                 Log.hexDump("ddms", LogLevel.WARN, reply, 0, reply.length);
@@ -298,10 +297,27 @@
             ByteBuffer buf = ByteBuffer.wrap(reply);
             buf.order(ByteOrder.LITTLE_ENDIAN);
 
-            imageParams.bpp = buf.getInt();
-            imageParams.size = buf.getInt();
-            imageParams.width = buf.getInt();
-            imageParams.height = buf.getInt();
+            int version = buf.getInt();
+
+            // get the header size (this is a count of int)
+            int headerSize = RawImage.getHeaderSize(version);
+
+            // read the header
+            reply = new byte[headerSize * 4];
+            if (read(adbChan, reply) == false) {
+                Log.w("ddms", "got partial reply from ADB fb:");
+                Log.hexDump("ddms", LogLevel.WARN, reply, 0, reply.length);
+                adbChan.close();
+                return null;
+            }
+            buf = ByteBuffer.wrap(reply);
+            buf.order(ByteOrder.LITTLE_ENDIAN);
+
+            // fill the RawImage with the header
+            if (imageParams.readHeader(version, buf) == false) {
+                Log.e("Screenshot", "Unsupported protocol: " + version);
+                return null;
+            }
 
             Log.d("ddms", "image params: bpp=" + imageParams.bpp + ", size="
                     + imageParams.size + ", width=" + imageParams.width
@@ -316,6 +332,7 @@
                 adbChan.close();
                 return null;
             }
+
             imageParams.data = reply;
         } finally {
             if (adbChan != null) {
@@ -576,7 +593,7 @@
      */
     static boolean read(SocketChannel chan, byte[] data) {
        try {
-           read(chan, data, -1, STD_TIMEOUT);
+           read(chan, data, -1, DdmPreferences.getTimeOut());
        } catch (IOException e) {
            Log.d("ddms", "readAll: IOException: " + e.getMessage());
            return false;
@@ -613,7 +630,7 @@
             } else if (count == 0) {
                 // TODO: need more accurate timeout?
                 if (timeout != 0 && numWaits * WAIT_TIME > timeout) {
-                    Log.i("ddms", "read: timeout");
+                    Log.d("ddms", "read: timeout");
                     throw new IOException("timeout");
                 }
                 // non-blocking spin
@@ -636,7 +653,7 @@
      */
     static boolean write(SocketChannel chan, byte[] data) {
         try {
-            write(chan, data, -1, STD_TIMEOUT);
+            write(chan, data, -1, DdmPreferences.getTimeOut());
         } catch (IOException e) {
             Log.e("ddms", e);
             return false;
@@ -670,7 +687,7 @@
             } else if (count == 0) {
                 // TODO: need more accurate timeout?
                 if (timeout != 0 && numWaits * WAIT_TIME > timeout) {
-                    Log.i("ddms", "write: timeout");
+                    Log.d("ddms", "write: timeout");
                     throw new IOException("timeout");
                 }
                 // non-blocking spin
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/AndroidDebugBridge.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/AndroidDebugBridge.java
index 9d6294a..6b9dccc 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/AndroidDebugBridge.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/AndroidDebugBridge.java
@@ -150,7 +150,7 @@
          * @param client the updated client.
          * @param changeMask the bit mask describing the changed properties. It can contain
          * any of the following values: {@link Client#CHANGE_INFO},
-         * {@link Client#CHANGE_DEBUGGER_INTEREST}, {@link Client#CHANGE_THREAD_MODE},
+         * {@link Client#CHANGE_DEBUGGER_STATUS}, {@link Client#CHANGE_THREAD_MODE},
          * {@link Client#CHANGE_THREAD_DATA}, {@link Client#CHANGE_HEAP_MODE},
          * {@link Client#CHANGE_HEAP_DATA}, {@link Client#CHANGE_NATIVE_HEAP_DATA}
          */
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/Client.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/Client.java
index 64fbef6..d05fa14 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/Client.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/Client.java
@@ -16,6 +16,7 @@
 
 package com.android.ddmlib;
 
+import com.android.ddmlib.ClientData.MethodProfilingStatus;
 import com.android.ddmlib.DebugPortManager.IDebugPortProvider;
 import com.android.ddmlib.AndroidDebugBridge.IClientChangeListener;
 
@@ -40,32 +41,34 @@
     private static final int SERVER_PROTOCOL_VERSION = 1;
 
     /** Client change bit mask: application name change */
-    public static final int CHANGE_NAME = 0x0001;
-    /** Client change bit mask: debugger interest change */
-    public static final int CHANGE_DEBUGGER_INTEREST = 0x0002;
+    public static final int CHANGE_NAME                       = 0x0001;
+    /** Client change bit mask: debugger status change */
+    public static final int CHANGE_DEBUGGER_STATUS            = 0x0002;
     /** Client change bit mask: debugger port change */
-    public static final int CHANGE_PORT = 0x0004;
+    public static final int CHANGE_PORT                       = 0x0004;
     /** Client change bit mask: thread update flag change */
-    public static final int CHANGE_THREAD_MODE = 0x0008;
+    public static final int CHANGE_THREAD_MODE                = 0x0008;
     /** Client change bit mask: thread data updated */
-    public static final int CHANGE_THREAD_DATA = 0x0010;
+    public static final int CHANGE_THREAD_DATA                = 0x0010;
     /** Client change bit mask: heap update flag change */
-    public static final int CHANGE_HEAP_MODE = 0x0020;
+    public static final int CHANGE_HEAP_MODE                  = 0x0020;
     /** Client change bit mask: head data updated */
-    public static final int CHANGE_HEAP_DATA = 0x0040;
+    public static final int CHANGE_HEAP_DATA                  = 0x0040;
     /** Client change bit mask: native heap data updated */
-    public static final int CHANGE_NATIVE_HEAP_DATA = 0x0080;
+    public static final int CHANGE_NATIVE_HEAP_DATA           = 0x0080;
     /** Client change bit mask: thread stack trace updated */
-    public static final int CHANGE_THREAD_STACKTRACE = 0x0100;
+    public static final int CHANGE_THREAD_STACKTRACE          = 0x0100;
     /** Client change bit mask: allocation information updated */
-    public static final int CHANGE_HEAP_ALLOCATIONS = 0x0200;
+    public static final int CHANGE_HEAP_ALLOCATIONS           = 0x0200;
     /** Client change bit mask: allocation information updated */
-    public static final int CHANGE_HEAP_ALLOCATION_STATUS = 0x0400;
+    public static final int CHANGE_HEAP_ALLOCATION_STATUS     = 0x0400;
+    /** Client change bit mask: allocation information updated */
+    public static final int CHANGE_METHOD_PROFILING_STATUS    = 0x0800;
 
     /** Client change bit mask: combination of {@link Client#CHANGE_NAME},
-     * {@link Client#CHANGE_DEBUGGER_INTEREST}, and {@link Client#CHANGE_PORT}.
+     * {@link Client#CHANGE_DEBUGGER_STATUS}, and {@link Client#CHANGE_PORT}.
      */
-    public static final int CHANGE_INFO = CHANGE_NAME | CHANGE_DEBUGGER_INTEREST | CHANGE_PORT;
+    public static final int CHANGE_INFO = CHANGE_NAME | CHANGE_DEBUGGER_STATUS | CHANGE_PORT;
 
     private SocketChannel mChan;
 
@@ -224,6 +227,52 @@
     }
 
     /**
+     * Makes the VM dump an HPROF file
+     */
+    public void dumpHprof() {
+        try {
+            String file = "/sdcard/" + mClientData.getClientDescription().replaceAll("\\:.*", "") +
+                ".hprof";
+            HandleHeap.sendHPDU(this, file);
+        } catch (IOException e) {
+            Log.w("ddms", "Send of HPDU message failed");
+            // ignore
+        }
+    }
+
+    public void toggleMethodProfiling() {
+        try {
+            if (mClientData.getMethodProfilingStatus() == MethodProfilingStatus.ON) {
+                HandleProfiling.sendMPRE(this);
+            } else {
+                String file = "/sdcard/" + mClientData.getClientDescription().replaceAll("\\:.*", "") +
+                ".trace";
+                HandleProfiling.sendMPRS(this, file, 8*1024*1024, 0 /*flags*/);
+            }
+        } catch (IOException e) {
+            Log.w("ddms", "Toggle method profiling failed");
+            // ignore
+        }
+    }
+
+    /**
+     * Sends a request to the VM to send the enable status of the method profiling.
+     * This is asynchronous.
+     * <p/>The allocation status can be accessed by {@link ClientData#getAllocationStatus()}.
+     * The notification that the new status is available will be received through
+     * {@link IClientChangeListener#clientChanged(Client, int)} with a <code>changeMask</code>
+     * containing the mask {@link #CHANGE_HEAP_ALLOCATION_STATUS}.
+     */
+    public void requestMethodProfilingStatus() {
+        try {
+            HandleHeap.sendREAQ(this);
+        } catch (IOException e) {
+            Log.e("ddmlib", e);
+        }
+    }
+
+
+    /**
      * Enables or disables the thread update.
      * <p/>If <code>true</code> the VM will be able to send thread information. Thread information
      * must be requested with {@link #requestThreadUpdate()}.
@@ -527,7 +576,7 @@
         Debugger dbg = mDebugger;
 
         if (dbg == null) {
-            Log.i("ddms", "Discarding packet");
+            Log.d("ddms", "Discarding packet");
             packet.consume();
         } else {
             dbg.sendAndConsume(packet);
@@ -600,15 +649,15 @@
             //Log.v("ddms", "findHand: " + result);
             switch (result) {
                 case JdwpPacket.HANDSHAKE_GOOD:
-                    Log.i("ddms",
+                    Log.d("ddms",
                         "Good handshake from client, sending HELO to " + mClientData.getPid());
                     JdwpPacket.consumeHandshake(mReadBuffer);
                     mConnState = ST_NEED_DDM_PKT;
-                    HandleHello.sendHELO(this, SERVER_PROTOCOL_VERSION);
+                    HandleHello.sendHelloCommands(this, SERVER_PROTOCOL_VERSION);
                     // see if we have another packet in the buffer
                     return getJdwpPacket();
                 case JdwpPacket.HANDSHAKE_BAD:
-                    Log.i("ddms", "Bad handshake from client");
+                    Log.d("ddms", "Bad handshake from client");
                     if (MonitorThread.getInstance().getRetryOnBadHandshake()) {
                         // we should drop the client, but also attempt to reopen it.
                         // This is done by the DeviceMonitor.
@@ -621,7 +670,7 @@
                     }
                     break;
                 case JdwpPacket.HANDSHAKE_NOTYET:
-                    Log.i("ddms", "No handshake from client yet.");
+                    Log.d("ddms", "No handshake from client yet.");
                     break;
                 default:
                     Log.e("ddms", "Unknown packet while waiting for client handshake");
@@ -699,7 +748,7 @@
      */
     void packetFailed(JdwpPacket reply) {
         if (mConnState == ST_NEED_DDM_PKT) {
-            Log.i("ddms", "Marking " + this + " as non-DDM client");
+            Log.d("ddms", "Marking " + this + " as non-DDM client");
             mConnState = ST_NOT_DDM;
         } else if (mConnState != ST_NOT_DDM) {
             Log.w("ddms", "WEIRD: got JDWP failure packet on DDM req");
@@ -737,7 +786,7 @@
      * @param notify Whether or not to notify the listeners of a change.
      */
     void close(boolean notify) {
-        Log.i("ddms", "Closing " + this.toString());
+        Log.d("ddms", "Closing " + this.toString());
 
         mOutstandingReqs.clear();
 
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/ClientData.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/ClientData.java
index 2b46b6f..356f5d0 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/ClientData.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/ClientData.java
@@ -24,6 +24,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -46,37 +47,54 @@
     * access should be synchronized against the ClientData object.
     */
 
-    
+
     /** Temporary name of VM to be ignored. */
     private final static String PRE_INITIALIZED = "<pre-initialized>"; //$NON-NLS-1$
 
-    /** Debugger connection status: not waiting on one, not connected to one, but accepting
-     * new connections. This is the default value. */
-    public static final int DEBUGGER_DEFAULT = 1;
-    /**
-     * Debugger connection status: the application's VM is paused, waiting for a debugger to
-     * connect to it before resuming. */
-    public static final int DEBUGGER_WAITING = 2;
-    /** Debugger connection status : Debugger is connected */
-    public static final int DEBUGGER_ATTACHED = 3;
-    /** Debugger connection status: The listening port for debugger connection failed to listen.
-     * No debugger will be able to connect. */
-    public static final int DEBUGGER_ERROR = 4;
-    
-    /**
-     * Allocation tracking status: unknown.
-     * <p/>This happens right after a {@link Client} is discovered
-     * by the {@link AndroidDebugBridge}, and before the {@link Client} answered the query regarding
-     * its allocation tracking status.
-     * @see Client#requestAllocationStatus()
-     */
-    public static final int ALLOCATION_TRACKING_UNKNOWN = -1;
-    /**
-     * Allocation tracking status: the {@link Client} is not tracking allocations. */
-    public static final int ALLOCATION_TRACKING_OFF = 0;
-    /**
-     * Allocation tracking status: the {@link Client} is tracking allocations. */
-    public static final int ALLOCATION_TRACKING_ON = 1;
+    public static enum DebuggerStatus {
+        /** Debugger connection status: not waiting on one, not connected to one, but accepting
+         * new connections. This is the default value. */
+        DEFAULT,
+        /**
+         * Debugger connection status: the application's VM is paused, waiting for a debugger to
+         * connect to it before resuming. */
+        WAITING,
+        /** Debugger connection status : Debugger is connected */
+        ATTACHED,
+        /** Debugger connection status: The listening port for debugger connection failed to listen.
+         * No debugger will be able to connect. */
+        ERROR;
+    }
+
+    public static enum AllocationTrackingStatus {
+        /**
+         * Allocation tracking status: unknown.
+         * <p/>This happens right after a {@link Client} is discovered
+         * by the {@link AndroidDebugBridge}, and before the {@link Client} answered the query
+         * regarding its allocation tracking status.
+         * @see Client#requestAllocationStatus()
+         */
+        UNKNOWN,
+        /** Allocation tracking status: the {@link Client} is not tracking allocations. */
+        OFF,
+        /** Allocation tracking status: the {@link Client} is tracking allocations. */
+        ON;
+    }
+
+    public static enum MethodProfilingStatus {
+        /**
+         * Method profiling status: unknown.
+         * <p/>This happens right after a {@link Client} is discovered
+         * by the {@link AndroidDebugBridge}, and before the {@link Client} answered the query
+         * regarding its method profiling status.
+         * @see Client#requestMethodProfilingStatus()
+         */
+        UNKNOWN,
+        /** Method profiling status: the {@link Client} is not profiling method calls. */
+        OFF,
+        /** Method profiling status: the {@link Client} is profiling method calls. */
+        ON;
+    }
 
     /**
      * Name of the value representing the max size of the heap, in the {@link Map} returned by
@@ -99,6 +117,21 @@
      */
     public final static String HEAP_OBJECTS_ALLOCATED = "objectsAllocated"; // $NON-NLS-1$
 
+    /**
+     * String for feature enabling starting/stopping method profiling
+     * @see #hasFeature(String)
+     */
+    public final static String FEATURE_PROFILING = "method-trace-profiling"; // $NON-NLS-1$
+
+    /**
+     * String for feature allowing to dump hprof files
+     * @see #hasFeature(String)
+     */
+    public final static String FEATURE_HPROF = "hprof-heap-dump"; // $NON-NLS-1$
+
+    private static IHprofDumpHandler sHprofDumpHandler;
+    private static IMethodProfilingHandler sMethodProfilingHandler;
+
     // is this a DDM-aware client?
     private boolean mIsDdmAware;
 
@@ -112,7 +145,10 @@
     private String mClientDescription;
 
     // how interested are we in a debugger?
-    private int mDebuggerInterest;
+    private DebuggerStatus mDebuggerInterest;
+
+    // List of supported features by the client.
+    private final HashSet<String> mFeatures = new HashSet<String>();
 
     // Thread tracking (THCR, THDE).
     private TreeMap<Integer,ThreadInfo> mThreadMap;
@@ -138,7 +174,12 @@
     private int mNativeTotalMemory;
 
     private AllocationInfo[] mAllocations;
-    private int mAllocationStatus = ALLOCATION_TRACKING_UNKNOWN;
+    private AllocationTrackingStatus mAllocationStatus = AllocationTrackingStatus.UNKNOWN;
+
+    private String mPendingHprofDump;
+
+    private MethodProfilingStatus mProfilingStatus = MethodProfilingStatus.UNKNOWN;
+    private String mPendingMethodProfiling;
 
     /**
      * Heap Information.
@@ -232,14 +273,69 @@
         public void setProcessedHeapMap(Map<Integer, ArrayList<HeapSegmentElement>> heapMap) {
             mProcessedHeapMap = heapMap;
         }
-        
+
         public Map<Integer, ArrayList<HeapSegmentElement>> getProcessedHeapMap() {
             return mProcessedHeapMap;
         }
-        
-
     }
 
+    /**
+     * Handlers able to act on HPROF dumps.
+     */
+    public interface IHprofDumpHandler {
+        /**
+         * Called when a HPROF dump succeeded.
+         * @param remoteFilePath the device-side path of the HPROF file.
+         * @param client the client for which the HPROF file was.
+         */
+        void onSuccess(String remoteFilePath, Client client);
+
+        /**
+         * Called when the HPROF dump failed.
+         * @param client the client for which the HPROF file was.
+         */
+        void onFailure(Client client);
+    }
+
+    /**
+     * Handlers able to act on Method profiling info
+     */
+    public interface IMethodProfilingHandler {
+        /**
+         * Called when a method tracing was successful.
+         * @param remoteFilePath the device-side path of the trace file.
+         * @param client the client that was profiled.
+         */
+        void onSuccess(String remoteFilePath, Client client);
+
+        /**
+         * Called when method tracing failed.
+         * @param client the client that was profiled.
+         */
+        void onFailure(Client client);
+    }
+
+    /**
+     * Sets the handler to receive notifications when an HPROF dump succeeded or failed.
+     */
+    public static void setHprofDumpHandler(IHprofDumpHandler handler) {
+        sHprofDumpHandler = handler;
+    }
+
+    static IHprofDumpHandler getHprofDumpHandler() {
+        return sHprofDumpHandler;
+    }
+
+    /**
+     * Sets the handler to receive notifications when an HPROF dump succeeded or failed.
+     */
+    public static void setMethodProfilingHandler(IMethodProfilingHandler handler) {
+        sMethodProfilingHandler = handler;
+    }
+
+    static IMethodProfilingHandler getMethodProfilingHandler() {
+        return sMethodProfilingHandler;
+    }
 
     /**
      * Generic constructor.
@@ -247,10 +343,10 @@
     ClientData(int pid) {
         mPid = pid;
 
-        mDebuggerInterest = DEBUGGER_DEFAULT;
+        mDebuggerInterest = DebuggerStatus.DEFAULT;
         mThreadMap = new TreeMap<Integer,ThreadInfo>();
     }
-    
+
     /**
      * Returns whether the process is DDM-aware.
      */
@@ -290,7 +386,7 @@
      * Returns the client description.
      * <p/>This is generally the name of the package defined in the
      * <code>AndroidManifest.xml</code>.
-     * 
+     *
      * @return the client description or <code>null</code> if not the description was not yet
      * sent by the client.
      */
@@ -319,20 +415,19 @@
             }
         }
     }
-    
+
     /**
-     * Returns the debugger connection status. Possible values are {@link #DEBUGGER_DEFAULT},
-     * {@link #DEBUGGER_WAITING}, {@link #DEBUGGER_ATTACHED}, and {@link #DEBUGGER_ERROR}.
+     * Returns the debugger connection status.
      */
-    public int getDebuggerConnectionStatus() {
+    public DebuggerStatus getDebuggerConnectionStatus() {
         return mDebuggerInterest;
     }
 
     /**
      * Sets debugger connection status.
      */
-    void setDebuggerConnectionStatus(int val) {
-        mDebuggerInterest = val;
+    void setDebuggerConnectionStatus(DebuggerStatus status) {
+        mDebuggerInterest = status;
     }
 
     /**
@@ -422,7 +517,7 @@
     synchronized ThreadInfo getThread(int threadId) {
         return mThreadMap.get(threadId);
     }
-    
+
     synchronized void clearThreads() {
         mThreadMap.clear();
     }
@@ -474,23 +569,23 @@
     public synchronized Iterator<NativeLibraryMapInfo> getNativeLibraryMapInfo() {
         return mNativeLibMapInfo.iterator();
     }
-    
-    synchronized void setAllocationStatus(boolean enabled) {
-        mAllocationStatus = enabled ? ALLOCATION_TRACKING_ON : ALLOCATION_TRACKING_OFF;
+
+    synchronized void setAllocationStatus(AllocationTrackingStatus status) {
+        mAllocationStatus = status;
     }
 
     /**
      * Returns the allocation tracking status.
      * @see Client#requestAllocationStatus()
      */
-    public synchronized int getAllocationStatus() {
+    public synchronized AllocationTrackingStatus getAllocationStatus() {
         return mAllocationStatus;
     }
-    
+
     synchronized void setAllocations(AllocationInfo[] allocs) {
         mAllocations = allocs;
     }
-    
+
     /**
      * Returns the list of tracked allocations.
      * @see Client#requestAllocationDetails()
@@ -498,5 +593,67 @@
     public synchronized AllocationInfo[] getAllocations() {
         return mAllocations;
     }
+
+    void addFeature(String feature) {
+        mFeatures.add(feature);
+    }
+
+    /**
+     * Returns true if the {@link Client} supports the given <var>feature</var>
+     * @param feature The feature to test.
+     * @return true if the feature is supported
+     *
+     * @see ClientData#FEATURE_PROFILING
+     * @see ClientData#FEATURE_HPROF
+     */
+    public boolean hasFeature(String feature) {
+        return mFeatures.contains(feature);
+    }
+
+    /**
+     * Sets the device-side path to the hprof file being written
+     * @param pendingHprofDump the file to the hprof file
+     */
+    void setPendingHprofDump(String pendingHprofDump) {
+        mPendingHprofDump = pendingHprofDump;
+    }
+
+    /**
+     * Returns the path to the device-side hprof file being written.
+     */
+    String getPendingHprofDump() {
+        return mPendingHprofDump;
+    }
+
+    public boolean hasPendingHprofDump() {
+        return mPendingHprofDump != null;
+    }
+
+    synchronized void setMethodProfilingStatus(MethodProfilingStatus status) {
+        mProfilingStatus = status;
+    }
+
+    /**
+     * Returns the method profiling status.
+     * @see Client#requestMethodProfilingStatus()
+     */
+    public synchronized MethodProfilingStatus getMethodProfilingStatus() {
+        return mProfilingStatus;
+    }
+
+    /**
+     * Sets the device-side path to the method profile file being written
+     * @param pendingMethodProfiling the file being written
+     */
+    void setPendingMethodProfiling(String pendingMethodProfiling) {
+        mPendingMethodProfiling = pendingMethodProfiling;
+    }
+
+    /**
+     * Returns the path to the device-side method profiling file being written.
+     */
+    String getPendingMethodProfiling() {
+        return mPendingMethodProfiling;
+    }
 }
 
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/DdmConstants.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/DdmConstants.java
new file mode 100644
index 0000000..d9823f3
--- /dev/null
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/DdmConstants.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ddmlib;
+
+public final class DdmConstants {
+
+    public final static int PLATFORM_UNKNOWN = 0;
+    public final static int PLATFORM_LINUX = 1;
+    public final static int PLATFORM_WINDOWS = 2;
+    public final static int PLATFORM_DARWIN = 3;
+
+    /**
+     * Returns current platform, one of {@link #PLATFORM_WINDOWS}, {@link #PLATFORM_DARWIN},
+     * {@link #PLATFORM_LINUX} or {@link #PLATFORM_UNKNOWN}.
+     */
+    public final static int CURRENT_PLATFORM = currentPlatform();
+
+    /** hprof-conv executable (with extension for the current OS)  */
+    public final static String FN_HPROF_CONVERTER = (CURRENT_PLATFORM == PLATFORM_WINDOWS) ?
+            "hprof-conv.exe" : "hprof-conv"; //$NON-NLS-1$ //$NON-NLS-2$
+
+    /** traceview executable (with extension for the current OS)  */
+    public final static String FN_TRACEVIEW = (CURRENT_PLATFORM == PLATFORM_WINDOWS) ?
+            "traceview.bat" : "traceview"; //$NON-NLS-1$ //$NON-NLS-2$
+
+    /**
+     * Returns current platform
+     *
+     * @return one of {@link #PLATFORM_WINDOWS}, {@link #PLATFORM_DARWIN},
+     * {@link #PLATFORM_LINUX} or {@link #PLATFORM_UNKNOWN}.
+     */
+    public static int currentPlatform() {
+        String os = System.getProperty("os.name");          //$NON-NLS-1$
+        if (os.startsWith("Mac OS")) {                      //$NON-NLS-1$
+            return PLATFORM_DARWIN;
+        } else if (os.startsWith("Windows")) {              //$NON-NLS-1$
+            return PLATFORM_WINDOWS;
+        } else if (os.startsWith("Linux")) {                //$NON-NLS-1$
+            return PLATFORM_LINUX;
+        }
+
+        return PLATFORM_UNKNOWN;
+    }
+
+}
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/DdmPreferences.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/DdmPreferences.java
index c96d40d..8044ab1 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/DdmPreferences.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/DdmPreferences.java
@@ -40,6 +40,8 @@
     public final static int DEFAULT_DEBUG_PORT_BASE = 8600;
     /** Default value for the logcat {@link LogLevel} */
     public final static LogLevel DEFAULT_LOG_LEVEL = LogLevel.ERROR;
+    /** Default timeout values for adb connection (milliseconds) */
+    public static final int DEFAULT_TIMEOUT = 5000; // standard delay, in ms
 
     private static boolean sThreadUpdate = DEFAULT_INITIAL_THREAD_UPDATE;
     private static boolean sInitialHeapUpdate = DEFAULT_INITIAL_HEAP_UPDATE;
@@ -47,6 +49,7 @@
     private static int sSelectedDebugPort = DEFAULT_SELECTED_DEBUG_PORT;
     private static int sDebugPortBase = DEFAULT_DEBUG_PORT_BASE;
     private static LogLevel sLogLevel = DEFAULT_LOG_LEVEL;
+    private static int sTimeOut = DEFAULT_TIMEOUT;
 
     /**
      * Returns the initial {@link Client} flag for thread updates.
@@ -75,7 +78,7 @@
     /**
      * Sets the initial {@link Client} flag for heap updates.
      * <p/>If <code>true</code>, the {@link ClientData} will automatically be updated with
-     * the VM heap information whenever a GC happens. 
+     * the VM heap information whenever a GC happens.
      * <p/>This change takes effect right away, for newly created {@link Client} objects.
      */
     public static void setInitialHeapUpdate(boolean state) {
@@ -137,7 +140,23 @@
 
         Log.setLevel(sLogLevel);
     }
-    
+
+    /**
+     * Returns the timeout to be used in adb connections (milliseconds).
+     */
+    public static int getTimeOut() {
+        return sTimeOut;
+    }
+
+    /**
+     * Sets the timeout value for adb connection.
+     * <p/>This change takes effect for newly created connections only.
+     * @param timeOut the timeout value (milliseconds).
+     */
+    public static void setTimeOut(int timeOut) {
+        sTimeOut = timeOut;
+    }
+
     /**
      * Non accessible constructor.
      */
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/Debugger.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/Debugger.java
index f30509a..cebbc32 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/Debugger.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/Debugger.java
@@ -16,6 +16,8 @@
 
 package com.android.ddmlib;
 
+import com.android.ddmlib.ClientData.DebuggerStatus;
+
 import java.io.IOException;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
@@ -78,7 +80,7 @@
         mPreDataBuffer = ByteBuffer.allocate(PRE_DATA_BUF_SIZE);
         mConnState = ST_NOT_CONNECTED;
 
-        Log.i("ddms", "Created: " + this.toString());
+        Log.d("ddms", "Created: " + this.toString());
     }
 
     /**
@@ -137,7 +139,7 @@
 
         if (listenChan != null) {
             SocketChannel newChan;
-    
+
             newChan = listenChan.accept();
             if (mChannel != null) {
                 Log.w("ddms", "debugger already talking to " + mClient
@@ -150,7 +152,7 @@
             mConnState = ST_AWAIT_SHAKE;
             return mChannel;
         }
-        
+
         return null;
     }
 
@@ -165,8 +167,8 @@
                 mConnState = ST_NOT_CONNECTED;
 
                 ClientData cd = mClient.getClientData();
-                cd.setDebuggerConnectionStatus(ClientData.DEBUGGER_DEFAULT);
-                mClient.update(Client.CHANGE_DEBUGGER_INTEREST);
+                cd.setDebuggerConnectionStatus(DebuggerStatus.DEFAULT);
+                mClient.update(Client.CHANGE_DEBUGGER_STATUS);
             }
         } catch (IOException ioe) {
             Log.w("ddms", "Failed to close data " + this);
@@ -243,20 +245,20 @@
             //Log.v("ddms", "findHand: " + result);
             switch (result) {
                 case JdwpPacket.HANDSHAKE_GOOD:
-                    Log.i("ddms", "Good handshake from debugger");
+                    Log.d("ddms", "Good handshake from debugger");
                     JdwpPacket.consumeHandshake(mReadBuffer);
                     sendHandshake();
                     mConnState = ST_READY;
 
                     ClientData cd = mClient.getClientData();
-                    cd.setDebuggerConnectionStatus(ClientData.DEBUGGER_ATTACHED);
-                    mClient.update(Client.CHANGE_DEBUGGER_INTEREST);
+                    cd.setDebuggerConnectionStatus(DebuggerStatus.ATTACHED);
+                    mClient.update(Client.CHANGE_DEBUGGER_STATUS);
 
                     // see if we have another packet in the buffer
                     return getJdwpPacket();
                 case JdwpPacket.HANDSHAKE_BAD:
                     // not a debugger, throw an exception so we drop the line
-                    Log.i("ddms", "Bad handshake from debugger");
+                    Log.d("ddms", "Bad handshake from debugger");
                     throw new IOException("bad handshake");
                 case JdwpPacket.HANDSHAKE_NOTYET:
                     break;
@@ -272,7 +274,7 @@
         } else {
             Log.e("ddms", "Receiving data in state = " + mConnState);
         }
-        
+
         return null;
     }
 
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/Device.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/Device.java
index e929431..e23d817 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/Device.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/Device.java
@@ -438,14 +438,14 @@
             String packageFileName = getFileName(localFilePath);
             String remoteFilePath = String.format("/data/local/tmp/%1$s", packageFileName); //$NON-NLS-1$
 
-            Log.i(packageFileName, String.format("Uploading %1$s onto device '%2$s'",
+            Log.d(packageFileName, String.format("Uploading %1$s onto device '%2$s'",
                     packageFileName, getSerialNumber()));
 
             SyncService sync = getSyncService();
             if (sync != null) {
                 String message = String.format("Uploading file onto device '%1$s'",
                         getSerialNumber());
-                Log.i(LOG_TAG, message);
+                Log.d(LOG_TAG, message);
                 SyncResult result = sync.pushFile(localFilePath, remoteFilePath,
                         SyncService.getNullProgressMonitor());
 
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/DeviceMonitor.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/DeviceMonitor.java
index 3382067..402699c 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/DeviceMonitor.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/DeviceMonitor.java
@@ -17,6 +17,7 @@
 package com.android.ddmlib;
 
 import com.android.ddmlib.AdbHelper.AdbResponse;
+import com.android.ddmlib.ClientData.DebuggerStatus;
 import com.android.ddmlib.DebugPortManager.IDebugPortProvider;
 import com.android.ddmlib.IDevice.DeviceState;
 
@@ -748,7 +749,7 @@
                     client.listenForDebugger(debuggerPort);
                 }
             } catch (IOException ioe) {
-                client.getClientData().setDebuggerConnectionStatus(ClientData.DEBUGGER_ERROR);
+                client.getClientData().setDebuggerConnectionStatus(DebuggerStatus.ERROR);
                 Log.e("ddms", "Can't bind to local " + debuggerPort + " for debugger");
                 // oh well
             }
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/EmulatorConsole.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/EmulatorConsole.java
index 75347c6..6ac019d 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/EmulatorConsole.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/EmulatorConsole.java
@@ -566,7 +566,7 @@
             }
 
             // write the command
-            AdbHelper.write(mSocketChannel, bCommand, bCommand.length, AdbHelper.STD_TIMEOUT);
+            AdbHelper.write(mSocketChannel, bCommand, bCommand.length, DdmPreferences.getTimeOut());
 
             result = true;
         } catch (IOException e) {
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleAppName.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleAppName.java
index 99bd4d0..c821dfc 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleAppName.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleAppName.java
@@ -77,7 +77,7 @@
         appNameLen = data.getInt();
         appName = getString(data, appNameLen);
 
-        Log.i("ddm-appname", "APNM: app='" + appName + "'");
+        Log.d("ddm-appname", "APNM: app='" + appName + "'");
 
         ClientData cd = client.getClientData();
         synchronized (cd) {
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleHeap.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleHeap.java
index 5111638..23050af 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleHeap.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleHeap.java
@@ -16,6 +16,9 @@
 
 package com.android.ddmlib;
 
+import com.android.ddmlib.ClientData.AllocationTrackingStatus;
+import com.android.ddmlib.ClientData.IHprofDumpHandler;
+
 import java.io.IOException;
 import java.nio.BufferUnderflowException;
 import java.nio.ByteBuffer;
@@ -91,22 +94,18 @@
 
         if (type == CHUNK_HPIF) {
             handleHPIF(client, data);
-            client.update(Client.CHANGE_HEAP_DATA);
         } else if (type == CHUNK_HPST) {
             handleHPST(client, data);
         } else if (type == CHUNK_HPEN) {
             handleHPEN(client, data);
-            client.update(Client.CHANGE_HEAP_DATA);
         } else if (type == CHUNK_HPSG) {
             handleHPSG(client, data);
         } else if (type == CHUNK_HPDU) {
             handleHPDU(client, data);
         } else if (type == CHUNK_REAQ) {
             handleREAQ(client, data);
-            client.update(Client.CHANGE_HEAP_ALLOCATION_STATUS);
         } else if (type == CHUNK_REAL) {
             handleREAL(client, data);
-            client.update(Client.CHANGE_HEAP_ALLOCATIONS);
         } else {
             handleUnknownChunk(client, type, data, isReply, msgId);
         }
@@ -133,6 +132,7 @@
 
                 client.getClientData().setHeapInfo(heapId, maxHeapSize,
                         heapSize, bytesAllocated, objectsAllocated);
+                client.update(Client.CHANGE_HEAP_DATA);
             }
         } catch (BufferUnderflowException ex) {
             Log.w("ddm-heap", "malformed HPIF chunk from client");
@@ -174,6 +174,7 @@
          */
 //xxx todo: only seal data that belongs to the heap mentioned in <data>.
         client.getClientData().getVmHeapData().sealHeapData();
+        client.update(Client.CHANGE_HEAP_DATA);
     }
 
     /*
@@ -243,6 +244,7 @@
         finishChunkPacket(packet, CHUNK_HPDU, buf.position());
         Log.d("ddm-heap", "Sending " + name(CHUNK_HPDU) + " '" + fileName +"'");
         client.sendAndConsume(packet, mInst);
+        client.getClientData().setPendingHprofDump(fileName);
     }
 
     /*
@@ -251,13 +253,24 @@
     private void handleHPDU(Client client, ByteBuffer data) {
         byte result;
 
+        // get the filename and make the client not have pending HPROF dump anymore.
+        String filename = client.getClientData().getPendingHprofDump();
+        client.getClientData().setPendingHprofDump(null);
+
+        // get the dump result
         result = data.get();
 
-        if (result == 0) {
-            Log.i("ddm-heap", "Heap dump request has finished");
-            // TODO: stuff
-        } else {
-            Log.w("ddm-heap", "Heap dump request failed (check device log)");
+        // get the app-level handler for HPROF dump
+        IHprofDumpHandler handler = ClientData.getHprofDumpHandler();
+        if (handler != null) {
+            if (result == 0) {
+                handler.onSuccess(filename, client);
+
+                Log.d("ddm-heap", "Heap dump request has finished");
+            } else {
+                handler.onFailure(client);
+                Log.w("ddm-heap", "Heap dump request failed (check device log)");
+            }
         }
     }
 
@@ -317,8 +330,10 @@
 
         enabled = (data.get() != 0);
         Log.d("ddm-heap", "REAQ says: enabled=" + enabled);
-        
-        client.getClientData().setAllocationStatus(enabled);
+
+        client.getClientData().setAllocationStatus(enabled ?
+                AllocationTrackingStatus.ON : AllocationTrackingStatus.OFF);
+        client.update(Client.CHANGE_HEAP_ALLOCATION_STATUS);
     }
 
     /**
@@ -359,7 +374,7 @@
                 str = "double";
             }
         }
-        
+
         // now add the array part
         for (int a = 0 ; a < array; a++) {
             str = str + "[]";
@@ -410,7 +425,7 @@
      *   (xb) class name strings
      *   (xb) method name strings
      *   (xb) source file strings
-     * 
+     *
      *   As with other DDM traffic, strings are sent as a 4-byte length
      *   followed by UTF-16 data.
      */
@@ -498,11 +513,12 @@
             list.add(new AllocationInfo(classNames[classNameIndex],
                 totalSize, (short) threadId, steArray));
         }
-        
+
         // sort biggest allocations first.
         Collections.sort(list);
-        
+
         client.getClientData().setAllocations(list.toArray(new AllocationInfo[numEntries]));
+        client.update(Client.CHANGE_HEAP_ALLOCATIONS);
     }
 
     /*
@@ -521,11 +537,11 @@
 
             for (StackTraceElement ste: rec.getStackTrace()) {
                 if (ste.isNativeMethod()) {
-                    System.out.println("    " + ste.getClassName() 
+                    System.out.println("    " + ste.getClassName()
                         + "." + ste.getMethodName()
                         + " (Native method)");
                 } else {
-                    System.out.println("    " + ste.getClassName() 
+                    System.out.println("    " + ste.getClassName()
                         + "." + ste.getMethodName()
                         + " (" + ste.getFileName()
                         + ":" + ste.getLineNumber() + ")");
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleHello.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleHello.java
index fb9697c..4e62bca 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleHello.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleHello.java
@@ -29,7 +29,6 @@
 
     private static final HandleHello mInst = new HandleHello();
 
-
     private HandleHello() {}
 
     /**
@@ -56,6 +55,19 @@
     }
 
     /**
+     * Sends HELLO-type commands to the VM after a good handshake.
+     * @param client
+     * @param serverProtocolVersion
+     * @throws IOException
+     */
+    public static void sendHelloCommands(Client client, int serverProtocolVersion)
+            throws IOException {
+        sendHELO(client, serverProtocolVersion);
+        sendFEAT(client);
+        HandleProfiling.sendMPRQ(client);
+    }
+
+    /**
      * Chunk handler entry point.
      */
     @Override
@@ -87,12 +99,12 @@
 
         vmIdent = getString(data, vmIdentLen);
         appName = getString(data, appNameLen);
-        
+
         Log.d("ddm-hello", "HELO: v=" + version + ", pid=" + pid
             + ", vm='" + vmIdent + "', app='" + appName + "'");
 
         ClientData cd = client.getClientData();
-        
+
         synchronized (cd) {
             if (cd.getPid() == pid) {
                 cd.setVmIdentifier(vmIdent);
@@ -141,6 +153,7 @@
         for (i = 0; i < featureCount; i++) {
             int len = data.getInt();
             String feature = getString(data, len);
+            client.getClientData().addFeature(feature);
 
             Log.d("ddm-hello", "Feature: " + feature);
         }
@@ -160,6 +173,5 @@
         Log.d("ddm-heap", "Sending " + name(CHUNK_FEAT));
         client.sendAndConsume(packet, mInst);
     }
-
 }
 
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleProfiling.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleProfiling.java
index e8e8103..3b69973 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleProfiling.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleProfiling.java
@@ -16,6 +16,9 @@
 
 package com.android.ddmlib;
 
+import com.android.ddmlib.ClientData.IMethodProfilingHandler;
+import com.android.ddmlib.ClientData.MethodProfilingStatus;
+
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
@@ -27,6 +30,7 @@
     public static final int CHUNK_MPRS = type("MPRS");
     public static final int CHUNK_MPRE = type("MPRE");
     public static final int CHUNK_MPRQ = type("MPRQ");
+    public static final int CHUNK_FAIL = type("FAIL");
 
     private static final HandleProfiling mInst = new HandleProfiling();
 
@@ -65,6 +69,8 @@
             handleMPRE(client, data);
         } else if (type == CHUNK_MPRQ) {
             handleMPRQ(client, data);
+        } else if (type == CHUNK_FAIL) {
+            handleFAIL(client, data);
         } else {
             handleUnknownChunk(client, type, data, isReply, msgId);
         }
@@ -73,11 +79,14 @@
     /**
      * Send a MPRS (Method PRofiling Start) request to the client.
      *
+     * The arguments to this method will eventually be passed to
+     * android.os.Debug.startMethodTracing() on the device.
+     *
      * @param fileName is the name of the file to which profiling data
      *          will be written (on the device); it will have ".trace"
      *          appended if necessary
      * @param bufferSize is the desired buffer size in bytes (8MB is good)
-     * @param flags should be zero
+     * @param flags see startMethodTracing() docs; use 0 for default behavior
      */
     public static void sendMPRS(Client client, String fileName, int bufferSize,
         int flags) throws IOException {
@@ -95,6 +104,13 @@
         Log.d("ddm-prof", "Sending " + name(CHUNK_MPRS) + " '" + fileName
             + "', size=" + bufferSize + ", flags=" + flags);
         client.sendAndConsume(packet, mInst);
+
+        // record the filename we asked for.
+        client.getClientData().setPendingMethodProfiling(fileName);
+
+        // send a status query. this ensure that the status is properly updated if for some
+        // reason starting the tracing failed.
+        sendMPRQ(client);
     }
 
     /**
@@ -119,15 +135,28 @@
     private void handleMPRE(Client client, ByteBuffer data) {
         byte result;
 
+        // get the filename and make the client not have pending HPROF dump anymore.
+        String filename = client.getClientData().getPendingMethodProfiling();
+        client.getClientData().setPendingMethodProfiling(null);
+
         result = data.get();
 
-        if (result == 0) {
-            Log.i("ddm-prof", "Method profiling has finished");
-        } else {
-            Log.w("ddm-prof", "Method profiling has failed (check device log)");
+        // get the app-level handler for method tracing dump
+        IMethodProfilingHandler handler = ClientData.getMethodProfilingHandler();
+        if (handler != null) {
+            if (result == 0) {
+                handler.onSuccess(filename, client);
+
+                Log.d("ddm-prof", "Method profiling has finished");
+            } else {
+                handler.onFailure(client);
+
+                Log.w("ddm-prof", "Method profiling has failed (check device log)");
+            }
         }
 
-        // TODO: stuff
+        client.getClientData().setMethodProfilingStatus(MethodProfilingStatus.OFF);
+        client.update(Client.CHANGE_METHOD_PROFILING_STATUS);
     }
 
     /**
@@ -154,9 +183,36 @@
         result = data.get();
 
         if (result == 0) {
-            Log.i("ddm-prof", "Method profiling is not running");
+            client.getClientData().setMethodProfilingStatus(MethodProfilingStatus.OFF);
+            Log.d("ddm-prof", "Method profiling is not running");
         } else {
-            Log.i("ddm-prof", "Method profiling is running");
+            client.getClientData().setMethodProfilingStatus(MethodProfilingStatus.ON);
+            Log.d("ddm-prof", "Method profiling is running");
+        }
+        client.update(Client.CHANGE_METHOD_PROFILING_STATUS);
+    }
+
+    private void handleFAIL(Client client, ByteBuffer data) {
+        // this can be sent if MPRS failed (like wrong permission)
+
+        String filename = client.getClientData().getPendingMethodProfiling();
+        if (filename != null) {
+            // reset the pending file.
+            client.getClientData().setPendingMethodProfiling(null);
+
+            // and notify of failure
+            IMethodProfilingHandler handler = ClientData.getMethodProfilingHandler();
+            if (handler != null) {
+                handler.onFailure(client);
+            }
+
+        }
+
+        // send a query to know the current status
+        try {
+            sendMPRQ(client);
+        } catch (IOException e) {
+            Log.e("HandleProfiling", e);
         }
     }
 }
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleThread.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleThread.java
index 572eed2..8430c95 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleThread.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleThread.java
@@ -178,13 +178,13 @@
             if (threadInfo != null)
                 threadInfo.updateThread(status, tid, utime, stime, isDaemon);
             else
-                Log.i("ddms", "Thread with id=" + threadId + " not found");
+                Log.d("ddms", "Thread with id=" + threadId + " not found");
 
             // slurp up any extra
             for (int slurp = extraPerEntry; slurp > 0; slurp--)
                 data.get();
         }
-        
+
         client.update(Client.CHANGE_THREAD_DATA);
     }
 
@@ -207,7 +207,7 @@
             threadInfo.setThreadName(name);
             client.update(Client.CHANGE_THREAD_DATA);
         } else {
-            Log.i("ddms", "Thread with id=" + threadId + " not found");
+            Log.d("ddms", "Thread with id=" + threadId + " not found");
         }
     }
 
@@ -291,7 +291,7 @@
         throws IOException {
 
         if (false) {
-            Log.i("ddm-thread", "would send STKL " + threadId);
+            Log.d("ddm-thread", "would send STKL " + threadId);
             return;
         }
 
@@ -326,7 +326,7 @@
                     try {
                         sendTHST(client);
                     } catch (IOException ioe) {
-                        Log.i("ddms", "Unable to request thread updates from "
+                        Log.d("ddms", "Unable to request thread updates from "
                                 + client + ": " + ioe.getMessage());
                     } finally {
                         mThreadStatusReqRunning = false;
@@ -335,7 +335,7 @@
             }.start();
         }
     }
-    
+
     static void requestThreadStackCallRefresh(final Client client, final int threadId) {
         if (client.isDdmAware() && client.isThreadUpdateEnabled()) {
             if (mThreadStackTraceReqRunning ) {
@@ -350,7 +350,7 @@
                     try {
                         sendSTKL(client, threadId);
                     } catch (IOException ioe) {
-                        Log.i("ddms", "Unable to request thread stack call updates from "
+                        Log.d("ddms", "Unable to request thread stack call updates from "
                                 + client + ": " + ioe.getMessage());
                     } finally {
                         mThreadStackTraceReqRunning = false;
@@ -358,7 +358,7 @@
                 }
             }.start();
         }
-        
+
     }
 
     /*
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleWait.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleWait.java
index d27e636..934cbea 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleWait.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/HandleWait.java
@@ -16,6 +16,8 @@
 
 package com.android.ddmlib;
 
+import com.android.ddmlib.ClientData.DebuggerStatus;
+
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
@@ -75,15 +77,15 @@
 
         reason = data.get();
 
-        Log.i("ddm-wait", "WAIT: reason=" + reason);
+        Log.d("ddm-wait", "WAIT: reason=" + reason);
 
 
         ClientData cd = client.getClientData();
         synchronized (cd) {
-            cd.setDebuggerConnectionStatus(ClientData.DEBUGGER_WAITING);
+            cd.setDebuggerConnectionStatus(DebuggerStatus.WAITING);
         }
 
-        client.update(Client.CHANGE_DEBUGGER_INTEREST);
+        client.update(Client.CHANGE_DEBUGGER_STATUS);
     }
 }
 
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/MonitorThread.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/MonitorThread.java
index 3089c2e..a514945 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/MonitorThread.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/MonitorThread.java
@@ -499,7 +499,7 @@
                     throw re;
                 }
             } else {
-                Log.i("ddms", "ignoring duplicate debugger");
+                Log.w("ddms", "ignoring duplicate debugger");
                 // new connection already closed
             }
         }
@@ -542,19 +542,19 @@
              * this won't be necessary, and we can just send a "debugger
              * disconnected" message.
              */
-            Log.i("ddms", "Closing connection to debugger " + dbg);
+            Log.d("ddms", "Closing connection to debugger " + dbg);
             dbg.closeData();
             Client client = dbg.getClient();
             if (client.isDdmAware()) {
                 // TODO: soft-disconnect DDM-aware clients
-                Log.i("ddms", " (recycling client connection as well)");
+                Log.d("ddms", " (recycling client connection as well)");
 
                 // we should drop the client, but also attempt to reopen it.
                 // This is done by the DeviceMonitor.
                 client.getDeviceImpl().getMonitor().addClientToDropAndReopen(client,
                         IDebugPortProvider.NO_STATIC_PORT);
             } else {
-                Log.i("ddms", " (recycling client connection as well)");
+                Log.d("ddms", " (recycling client connection as well)");
                 // we should drop the client, but also attempt to reopen it.
                 // This is done by the DeviceMonitor.
                 client.getDeviceImpl().getMonitor().addClientToDropAndReopen(client,
@@ -747,7 +747,7 @@
             Debugger dbg = mSelectedClient.getDebugger();
 
             if (dbg != null) {
-                Log.i("ddms", "Accepting connection on 'debug selected' port");
+                Log.d("ddms", "Accepting connection on 'debug selected' port");
                 try {
                     acceptNewDebugger(dbg, acceptChan);
                 } catch (IOException ioe) {
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/RawImage.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/RawImage.java
index 610cb59..3ec6148 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/RawImage.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/RawImage.java
@@ -16,17 +16,212 @@
 
 package com.android.ddmlib;
 
+import java.nio.ByteBuffer;
+
 /**
  * Data representing an image taken from a device frame buffer.
  */
 public final class RawImage {
-    /**
-     * bit-per-pixel value.
-     */
+    public int version;
     public int bpp;
     public int size;
     public int width;
     public int height;
+    public int red_offset;
+    public int red_length;
+    public int blue_offset;
+    public int blue_length;
+    public int green_offset;
+    public int green_length;
+    public int alpha_offset;
+    public int alpha_length;
 
     public byte[] data;
+
+    /**
+     * Reads the header of a RawImage from a {@link ByteBuffer}.
+     * <p/>The way the data is sent over adb is defined in system/core/adb/framebuffer_service.c
+     * @param version the version of the protocol.
+     * @param buf the buffer to read from.
+     * @return true if success
+     */
+    public boolean readHeader(int version, ByteBuffer buf) {
+        this.version = version;
+
+        if (version == 16) {
+            // compatibility mode with original protocol
+            this.bpp = 16;
+
+            // read actual values.
+            this.size = buf.getInt();
+            this.width = buf.getInt();
+            this.height = buf.getInt();
+
+            // create default values for the rest. Format is 565
+            this.red_offset = 11;
+            this.red_length = 5;
+            this.green_offset = 5;
+            this.green_length = 6;
+            this.blue_offset = 0;
+            this.blue_length = 5;
+            this.alpha_offset = 0;
+            this.alpha_length = 0;
+        } else if (version == 1) {
+            this.bpp = buf.getInt();
+            this.size = buf.getInt();
+            this.width = buf.getInt();
+            this.height = buf.getInt();
+            this.red_offset = buf.getInt();
+            this.red_length = buf.getInt();
+            this.blue_offset = buf.getInt();
+            this.blue_length = buf.getInt();
+            this.green_offset = buf.getInt();
+            this.green_length = buf.getInt();
+            this.alpha_offset = buf.getInt();
+            this.alpha_length = buf.getInt();
+        } else {
+            // unsupported protocol!
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Returns the mask value for the red color.
+     * <p/>This value is compatible with org.eclipse.swt.graphics.PaletteData
+     */
+    public int getRedMask() {
+        return getMask(red_length, red_offset);
+    }
+
+    /**
+     * Returns the mask value for the green color.
+     * <p/>This value is compatible with org.eclipse.swt.graphics.PaletteData
+     */
+    public int getGreenMask() {
+        return getMask(green_length, green_offset);
+    }
+
+    /**
+     * Returns the mask value for the blue color.
+     * <p/>This value is compatible with org.eclipse.swt.graphics.PaletteData
+     */
+    public int getBlueMask() {
+        return getMask(blue_length, blue_offset);
+    }
+
+    /**
+     * Returns the size of the header for a specific version of the framebuffer adb protocol.
+     * @param version the version of the protocol
+     * @return the number of int that makes up the header.
+     */
+    public static int getHeaderSize(int version) {
+        switch (version) {
+            case 16: // compatibility mode
+                return 3; // size, width, height
+            case 1:
+                return 12; // bpp, size, width, height, 4*(length, offset)
+        }
+
+        return 0;
+    }
+
+    /**
+     * Returns a rotated version of the image
+     * The image is rotated counter-clockwise.
+     */
+    public RawImage getRotated() {
+        RawImage rotated = new RawImage();
+        rotated.version = this.version;
+        rotated.bpp = this.bpp;
+        rotated.size = this.size;
+        rotated.red_offset = this.red_offset;
+        rotated.red_length = this.red_length;
+        rotated.blue_offset = this.blue_offset;
+        rotated.blue_length = this.blue_length;
+        rotated.green_offset = this.green_offset;
+        rotated.green_length = this.green_length;
+        rotated.alpha_offset = this.alpha_offset;
+        rotated.alpha_length = this.alpha_length;
+
+        rotated.width = this.height;
+        rotated.height = this.width;
+
+        int count = this.data.length;
+        rotated.data = new byte[count];
+
+        int byteCount = this.bpp >> 3; // bpp is in bits, we want bytes to match our array
+        final int w = this.width;
+        final int h = this.height;
+        for (int y = 0 ; y < h ; y++) {
+            for (int x = 0 ; x < w ; x++) {
+                System.arraycopy(
+                        this.data, (y * w + x) * byteCount,
+                        rotated.data, ((w-x-1) * h + y) * byteCount,
+                        byteCount);
+            }
+        }
+
+        return rotated;
+    }
+
+    /**
+     * Returns an ARGB integer value for the pixel at <var>index</var> in {@link #data}.
+     */
+    public int getARGB(int index) {
+        int value;
+        if (bpp == 16) {
+            value = data[index] & 0x00FF;
+            value |= (data[index+1] << 8) & 0x0FF00;
+        } else if (bpp == 32) {
+            value = data[index] & 0x00FF;
+            value |= (data[index+1] & 0x00FF) << 8;
+            value |= (data[index+2] & 0x00FF) << 16;
+            value |= (data[index+3] & 0x00FF) << 24;
+        } else {
+            throw new UnsupportedOperationException("RawImage.getARGB(int) only works in 16 and 32 bit mode.");
+        }
+
+        int r = ((value >>> red_offset) & getMask(red_length)) << (8 - red_length);
+        int g = ((value >>> green_offset) & getMask(green_length)) << (8 - green_length);
+        int b = ((value >>> blue_offset) & getMask(blue_length)) << (8 - blue_length);
+        int a;
+        if (alpha_length == 0) {
+            a = 0xFF; // force alpha to opaque if there's no alpha value in the framebuffer.
+        } else {
+            a = ((value >>> alpha_offset) & getMask(alpha_length)) << (8 - alpha_length);
+        }
+
+        return a << 24 | r << 16 | g << 8 | b;
+    }
+
+    /**
+     * creates a mask value based on a length and offset.
+     * <p/>This value is compatible with org.eclipse.swt.graphics.PaletteData
+     */
+    private int getMask(int length, int offset) {
+        int res = getMask(length) << offset;
+
+        // if the bpp is 32 bits then we need to invert it because the buffer is in little endian
+        if (bpp == 32) {
+            return Integer.reverseBytes(res);
+        }
+
+        return res;
+    }
+
+    /**
+     * Creates a mask value based on a length.
+     * @param length
+     * @return
+     */
+    private int getMask(int length) {
+        int res = 0;
+        for (int i = 0 ; i < length ; i++) {
+            res = (res << 1) + 1;
+        }
+
+        return res;
+    }
 }
diff --git a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/SyncService.java b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/SyncService.java
index c1d1d3b..9f6b561 100644
--- a/tools/ddms/libs/ddmlib/src/com/android/ddmlib/SyncService.java
+++ b/tools/ddms/libs/ddmlib/src/com/android/ddmlib/SyncService.java
@@ -222,7 +222,7 @@
             AdbHelper.setDevice(mChannel, mDevice);
 
             byte[] request = AdbHelper.formAdbRequest("sync:"); // $NON-NLS-1$
-            AdbHelper.write(mChannel, request, -1, AdbHelper.STD_TIMEOUT);
+            AdbHelper.write(mChannel, request, -1, DdmPreferences.getTimeOut());
 
             AdbResponse resp = AdbHelper.readAdbResponse(mChannel, false /* readDiagString */);
 
@@ -374,6 +374,29 @@
     }
 
     /**
+     * Pulls a single file.
+     * <p/>Because this method just deals with a String for the remote file instead of a
+     * {@link FileEntry}, the size of the file being pulled is unknown and the
+     * {@link ISyncProgressMonitor} will not properly show the progress
+     * @param remoteFilepath the full path to the remote file
+     * @param localFilename The local destination.
+     * @param monitor The progress monitor. Cannot be null.
+     * @return a {@link SyncResult} object with a code and an optional message.
+     *
+     * @see #getNullProgressMonitor()
+     */
+    public SyncResult pullFile(String remoteFilepath, String localFilename,
+            ISyncProgressMonitor monitor) {
+        monitor.start(0);
+        //TODO: use the {@link FileListingService} to get the file size.
+
+        SyncResult result = doPullFile(remoteFilepath, localFilename, monitor);
+
+        monitor.stop();
+        return result;
+    }
+
+    /**
      * Push several files.
      * @param local An array of loca files to push
      * @param remote the remote {@link FileEntry} representing a directory.
@@ -536,6 +559,9 @@
             ISyncProgressMonitor monitor) {
         byte[] msg = null;
         byte[] pullResult = new byte[8];
+
+        final int timeOut = DdmPreferences.getTimeOut();
+
         try {
             byte[] remotePathContent = remotePath.getBytes(AdbHelper.DEFAULT_ENCODING);
 
@@ -547,11 +573,11 @@
             msg = createFileReq(ID_RECV, remotePathContent);
 
             // and send it.
-            AdbHelper.write(mChannel, msg, -1, AdbHelper.STD_TIMEOUT);
+            AdbHelper.write(mChannel, msg, -1, timeOut);
 
             // read the result, in a byte array containing 2 ints
             // (id, size)
-            AdbHelper.read(mChannel, pullResult, -1, AdbHelper.STD_TIMEOUT);
+            AdbHelper.read(mChannel, pullResult, -1, timeOut);
 
             // check we have the proper data back
             if (checkResult(pullResult, ID_DATA) == false &&
@@ -603,10 +629,10 @@
 
             try {
                 // now read the length we received
-                AdbHelper.read(mChannel, data, length, AdbHelper.STD_TIMEOUT);
+                AdbHelper.read(mChannel, data, length, timeOut);
 
                 // get the header for the next packet.
-                AdbHelper.read(mChannel, pullResult, -1, AdbHelper.STD_TIMEOUT);
+                AdbHelper.read(mChannel, pullResult, -1, timeOut);
             } catch (IOException e) {
                 return new SyncResult(RESULT_CONNECTION_ERROR, e);
             }
@@ -682,6 +708,8 @@
         FileInputStream fis = null;
         byte[] msg;
 
+        final int timeOut = DdmPreferences.getTimeOut();
+
         try {
             byte[] remotePathContent = remotePath.getBytes(AdbHelper.DEFAULT_ENCODING);
 
@@ -710,7 +738,7 @@
         // and send it. We use a custom try/catch block to make the difference between
         // file and network IO exceptions.
         try {
-            AdbHelper.write(mChannel, msg, -1, AdbHelper.STD_TIMEOUT);
+            AdbHelper.write(mChannel, msg, -1, timeOut);
         } catch (IOException e) {
             return new SyncResult(RESULT_CONNECTION_ERROR, e);
         }
@@ -748,7 +776,7 @@
 
             // now write it
             try {
-                AdbHelper.write(mChannel, mBuffer, readCount+8, AdbHelper.STD_TIMEOUT);
+                AdbHelper.write(mChannel, mBuffer, readCount+8, timeOut);
             } catch (IOException e) {
                 return new SyncResult(RESULT_CONNECTION_ERROR, e);
             }
@@ -769,19 +797,19 @@
             msg = createReq(ID_DONE, (int)time);
 
             // and send it.
-            AdbHelper.write(mChannel, msg, -1, AdbHelper.STD_TIMEOUT);
+            AdbHelper.write(mChannel, msg, -1, timeOut);
 
             // read the result, in a byte array containing 2 ints
             // (id, size)
             byte[] result = new byte[8];
-            AdbHelper.read(mChannel, result, -1 /* full length */, AdbHelper.STD_TIMEOUT);
+            AdbHelper.read(mChannel, result, -1 /* full length */, timeOut);
 
             if (checkResult(result, ID_OKAY) == false) {
                 if (checkResult(result, ID_FAIL)) {
                     // read some error message...
                     int len = ArrayHelper.swap32bitFromArray(result, 4);
 
-                    AdbHelper.read(mChannel, mBuffer, len, AdbHelper.STD_TIMEOUT);
+                    AdbHelper.read(mChannel, mBuffer, len, timeOut);
 
                     // output the result?
                     String message = new String(mBuffer, 0, len);
@@ -798,7 +826,6 @@
         return new SyncResult(RESULT_OK);
     }
 
-
     /**
      * Returns the mode of the remote file.
      * @param path the remote file
@@ -810,12 +837,12 @@
             // create the stat request message.
             byte[] msg = createFileReq(ID_STAT, path);
 
-            AdbHelper.write(mChannel, msg, -1 /* full length */, AdbHelper.STD_TIMEOUT);
+            AdbHelper.write(mChannel, msg, -1 /* full length */, DdmPreferences.getTimeOut());
 
             // read the result, in a byte array containing 4 ints
             // (id, mode, size, time)
             byte[] statResult = new byte[16];
-            AdbHelper.read(mChannel, statResult, -1 /* full length */, AdbHelper.STD_TIMEOUT);
+            AdbHelper.read(mChannel, statResult, -1 /* full length */, DdmPreferences.getTimeOut());
 
             // check we have the proper data back
             if (checkResult(statResult, ID_STAT) == false) {
diff --git a/tools/ddms/libs/ddmuilib/.classpath b/tools/ddms/libs/ddmuilib/.classpath
index ce7e7f0..2cd368c 100644
--- a/tools/ddms/libs/ddmuilib/.classpath
+++ b/tools/ddms/libs/ddmuilib/.classpath
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry excluding="Makefile|resources" kind="src" path="src"/>
+	<classpathentry excluding="Makefile|resources/" kind="src" path="src"/>
+	<classpathentry kind="src" path="src/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/ddmlib"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/ANDROID_SWT"/>
diff --git a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/AllocationPanel.java b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/AllocationPanel.java
index 45d45ff..11c0e19 100644
--- a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/AllocationPanel.java
+++ b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/AllocationPanel.java
@@ -18,8 +18,8 @@
 
 import com.android.ddmlib.AllocationInfo;
 import com.android.ddmlib.Client;
-import com.android.ddmlib.ClientData;
 import com.android.ddmlib.AndroidDebugBridge.IClientChangeListener;
+import com.android.ddmlib.ClientData.AllocationTrackingStatus;
 
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.viewers.ILabelProviderListener;
@@ -61,7 +61,7 @@
     private final static String PREFS_ALLOC_COL_THREAD = "allocPanel.Col2"; //$NON-NLS-1$
     private final static String PREFS_ALLOC_COL_TRACE_CLASS = "allocPanel.Col3"; //$NON-NLS-1$
     private final static String PREFS_ALLOC_COL_TRACE_METHOD = "allocPanel.Col4"; //$NON-NLS-1$
-    
+
     private final static String PREFS_ALLOC_SASH = "allocPanel.sash"; //$NON-NLS-1$
 
     private static final String PREFS_STACK_COL_CLASS = "allocPanel.stack.col0"; //$NON-NLS-1$
@@ -69,7 +69,7 @@
     private static final String PREFS_STACK_COL_FILE = "allocPanel.stack.col2"; //$NON-NLS-1$
     private static final String PREFS_STACK_COL_LINE = "allocPanel.stack.col3"; //$NON-NLS-1$
     private static final String PREFS_STACK_COL_NATIVE = "allocPanel.stack.col4"; //$NON-NLS-1$
-    
+
     private Composite mAllocationBase;
     private Table mAllocationTable;
     private TableViewer mAllocationViewer;
@@ -171,18 +171,18 @@
         // base composite for selected client with enabled thread update.
         mAllocationBase = new Composite(parent, SWT.NONE);
         mAllocationBase.setLayout(new FormLayout());
-        
+
         // table above the sash
         Composite topParent = new Composite(mAllocationBase, SWT.NONE);
         topParent.setLayout(new GridLayout(2, false));
-        
+
         mEnableButton = new Button(topParent, SWT.PUSH);
         mEnableButton.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
                 Client current = getCurrentClient();
-                int status = current.getClientData().getAllocationStatus();
-                if (status == ClientData.ALLOCATION_TRACKING_ON) {
+                AllocationTrackingStatus status = current.getClientData().getAllocationStatus();
+                if (status == AllocationTrackingStatus.ON) {
                     current.enableAllocationTracker(false);
                 } else {
                     current.enableAllocationTracker(true);
@@ -199,8 +199,8 @@
                 getCurrentClient().requestAllocationDetails();
             }
         });
-        
-        setUpButtons(false /* enabled */, ClientData.ALLOCATION_TRACKING_OFF /* trackingStatus */);
+
+        setUpButtons(false /* enabled */, AllocationTrackingStatus.OFF);
 
         mAllocationTable = new Table(topParent, SWT.MULTI | SWT.FULL_SELECTION);
         GridData gridData;
@@ -243,7 +243,7 @@
                 SWT.LEFT,
                 "utime", //$NON-NLS-1$
                 PREFS_ALLOC_COL_TRACE_METHOD, store);
-        
+
         mAllocationViewer = new TableViewer(mAllocationTable);
         mAllocationViewer.setContentProvider(new AllocationContentProvider());
         mAllocationViewer.setLabelProvider(new AllocationLabelProvider());
@@ -254,12 +254,12 @@
                 updateAllocationStackTrace(selectedAlloc);
             }
         });
-        
+
         // the separating sash
         final Sash sash = new Sash(mAllocationBase, SWT.HORIZONTAL);
         Color darkGray = parent.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY);
         sash.setBackground(darkGray);
-        
+
         // the UI below the sash
         mStackTracePanel = new StackTracePanel();
         mStackTraceTable = mStackTracePanel.createPanel(mAllocationBase,
@@ -269,7 +269,7 @@
                 PREFS_STACK_COL_LINE,
                 PREFS_STACK_COL_NATIVE,
                 store);
-        
+
         // now setup the sash.
         // form layout data
         FormData data = new FormData();
@@ -313,7 +313,7 @@
 
         return mAllocationBase;
     }
-    
+
     /**
      * Sets the focus to the proper control inside the panel.
      */
@@ -329,7 +329,7 @@
      * @param client the updated client.
      * @param changeMask the bit mask describing the changed properties. It can contain
      * any of the following values: {@link Client#CHANGE_INFO}, {@link Client#CHANGE_NAME}
-     * {@link Client#CHANGE_DEBUGGER_INTEREST}, {@link Client#CHANGE_THREAD_MODE},
+     * {@link Client#CHANGE_DEBUGGER_STATUS}, {@link Client#CHANGE_THREAD_MODE},
      * {@link Client#CHANGE_THREAD_DATA}, {@link Client#CHANGE_HEAP_MODE},
      * {@link Client#CHANGE_HEAP_DATA}, {@link Client#CHANGE_NATIVE_HEAP_DATA}
      *
@@ -382,20 +382,19 @@
         }
 
         Client client = getCurrentClient();
-        
+
         mStackTracePanel.setCurrentClient(client);
         mStackTracePanel.setViewerInput(null); // always empty on client selection change.
 
         if (client != null) {
             setUpButtons(true /* enabled */, client.getClientData().getAllocationStatus());
         } else {
-            setUpButtons(false /* enabled */,
-                    ClientData.ALLOCATION_TRACKING_OFF /* trackingStatus */);
+            setUpButtons(false /* enabled */, AllocationTrackingStatus.OFF);
         }
 
         mAllocationViewer.setInput(client);
     }
-    
+
     /**
      * Updates the stack call of the currently selected thread.
      * <p/>
@@ -406,7 +405,7 @@
         if (client != null) {
             // get the current selection in the ThreadTable
             AllocationInfo selectedAlloc = getAllocationSelection(null);
-            
+
             if (selectedAlloc != null) {
                 updateAllocationStackTrace(selectedAlloc);
             } else {
@@ -441,7 +440,7 @@
         if (selection == null) {
             selection = mAllocationViewer.getSelection();
         }
-        
+
         if (selection instanceof IStructuredSelection) {
             IStructuredSelection structuredSelection = (IStructuredSelection)selection;
             Object object = structuredSelection.getFirstElement();
@@ -449,29 +448,29 @@
                 return (AllocationInfo)object;
             }
         }
-        
+
         return null;
     }
 
     /**
-     * 
+     *
      * @param enabled
      * @param trackingStatus
      */
-    private void setUpButtons(boolean enabled, int trackingStatus) {
+    private void setUpButtons(boolean enabled, AllocationTrackingStatus trackingStatus) {
         if (enabled) {
             switch (trackingStatus) {
-                case ClientData.ALLOCATION_TRACKING_UNKNOWN:
+                case UNKNOWN:
                     mEnableButton.setText("?");
                     mEnableButton.setEnabled(false);
                     mRequestButton.setEnabled(false);
                     break;
-                case ClientData.ALLOCATION_TRACKING_OFF:
+                case OFF:
                     mEnableButton.setText("Start Tracking");
                     mEnableButton.setEnabled(true);
                     mRequestButton.setEnabled(false);
                     break;
-                case ClientData.ALLOCATION_TRACKING_ON:
+                case ON:
                     mEnableButton.setText("Stop Tracking");
                     mEnableButton.setEnabled(true);
                     mRequestButton.setEnabled(true);
diff --git a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/DevicePanel.java b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/DevicePanel.java
index d9d6fa1..691692f 100644
--- a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/DevicePanel.java
+++ b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/DevicePanel.java
@@ -24,6 +24,7 @@
 import com.android.ddmlib.AndroidDebugBridge.IClientChangeListener;
 import com.android.ddmlib.AndroidDebugBridge.IDebugBridgeChangeListener;
 import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
+import com.android.ddmlib.ClientData.DebuggerStatus;
 import com.android.ddmlib.IDevice.DeviceState;
 
 import org.eclipse.jface.preference.IPreferenceStore;
@@ -75,6 +76,9 @@
     public final static String ICON_HEAP = "heap.png"; //$NON-NLS-1$
     public final static String ICON_HALT = "halt.png"; //$NON-NLS-1$
     public final static String ICON_GC = "gc.png"; //$NON-NLS-1$
+    public final static String ICON_HPROF = "hprof.png"; //$NON-NLS-1$
+    public final static String ICON_TRACING_START = "tracing_start.png"; //$NON-NLS-1$
+    public final static String ICON_TRACING_STOP = "tracing_stop.png"; //$NON-NLS-1$
 
     private IDevice mCurrentDevice;
     private Client mCurrentClient;
@@ -166,13 +170,13 @@
                 switch (columnIndex) {
                     case CLIENT_COL_NAME:
                         switch (cd.getDebuggerConnectionStatus()) {
-                            case ClientData.DEBUGGER_DEFAULT:
+                            case DEFAULT:
                                 return null;
-                            case ClientData.DEBUGGER_WAITING:
+                            case WAITING:
                                 return mWaitingImage;
-                            case ClientData.DEBUGGER_ATTACHED:
+                            case ATTACHED:
                                 return mDebuggerImage;
-                            case ClientData.DEBUGGER_ERROR:
+                            case ERROR:
                                 return mDebugErrorImage;
                         }
                         return null;
@@ -423,6 +427,18 @@
         }
     }
 
+    public void dumpHprof() {
+        if (mCurrentClient != null) {
+            mCurrentClient.dumpHprof();
+        }
+    }
+
+    public void toggleMethodProfiling() {
+        if (mCurrentClient != null) {
+            mCurrentClient.toggleMethodProfiling();
+        }
+    }
+
     public void setEnabledHeapOnSelectedClient(boolean enable) {
         if (mCurrentClient != null) {
             mCurrentClient.setHeapUpdateEnabled(enable);
@@ -586,7 +602,7 @@
      * @param client the updated client.
      * @param changeMask the bit mask describing the changed properties. It can contain
      * any of the following values: {@link Client#CHANGE_INFO},
-     * {@link Client#CHANGE_DEBUGGER_INTEREST}, {@link Client#CHANGE_THREAD_MODE},
+     * {@link Client#CHANGE_DEBUGGER_STATUS}, {@link Client#CHANGE_THREAD_MODE},
      * {@link Client#CHANGE_THREAD_DATA}, {@link Client#CHANGE_HEAP_MODE},
      * {@link Client#CHANGE_HEAP_DATA}, {@link Client#CHANGE_NATIVE_HEAP_DATA}
      *
@@ -599,10 +615,10 @@
                     // refresh the client
                     mTreeViewer.refresh(client);
 
-                    if ((changeMask & Client.CHANGE_DEBUGGER_INTEREST) ==
-                            Client.CHANGE_DEBUGGER_INTEREST &&
+                    if ((changeMask & Client.CHANGE_DEBUGGER_STATUS) ==
+                            Client.CHANGE_DEBUGGER_STATUS &&
                             client.getClientData().getDebuggerConnectionStatus() ==
-                                ClientData.DEBUGGER_WAITING) {
+                                DebuggerStatus.WAITING) {
                         // make sure the device is expanded. Normally the setSelection below
                         // will auto expand, but the children of device may not already exist
                         // at this time. Forcing an expand will make the TreeViewer create them.
diff --git a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/HeapPanel.java b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/HeapPanel.java
index 977203b..f5cf9b1 100644
--- a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/HeapPanel.java
+++ b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/HeapPanel.java
@@ -217,7 +217,7 @@
      * @param client the updated client.
      * @param changeMask the bit mask describing the changed properties. It can contain
      * any of the following values: {@link Client#CHANGE_INFO}, {@link Client#CHANGE_NAME}
-     * {@link Client#CHANGE_DEBUGGER_INTEREST}, {@link Client#CHANGE_THREAD_MODE},
+     * {@link Client#CHANGE_DEBUGGER_STATUS}, {@link Client#CHANGE_THREAD_MODE},
      * {@link Client#CHANGE_THREAD_DATA}, {@link Client#CHANGE_HEAP_MODE},
      * {@link Client#CHANGE_HEAP_DATA}, {@link Client#CHANGE_NATIVE_HEAP_DATA}
      *
diff --git a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/InfoPanel.java b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/InfoPanel.java
index 72cbb4a..6cbb999 100644
--- a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/InfoPanel.java
+++ b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/InfoPanel.java
@@ -39,11 +39,15 @@
         "App description:",
         "VM version:",
         "Process ID:",
+        "Supports Profiling Control:",
+        "Supports HPROF Control:",
     };
-    private static final int ENT_DDM_AWARE = 0;
-    private static final int ENT_APP_DESCR = 1;
-    private static final int ENT_VM_VERSION = 2;
-    private static final int ENT_PROCESS_ID = 3;
+    private static final int ENT_DDM_AWARE          = 0;
+    private static final int ENT_APP_DESCR          = 1;
+    private static final int ENT_VM_VERSION         = 2;
+    private static final int ENT_PROCESS_ID         = 3;
+    private static final int ENT_SUPPORTS_PROFILING = 4;
+    private static final int ENT_SUPPORTS_HPROF     = 5;
 
     /**
      * Create our control(s).
@@ -71,7 +75,7 @@
 
         return mTable;
     }
-    
+
     /**
      * Sets the focus to the proper control inside the panel.
      */
@@ -88,7 +92,7 @@
      * @param client the updated client.
      * @param changeMask the bit mask describing the changed properties. It can contain
      * any of the following values: {@link Client#CHANGE_PORT}, {@link Client#CHANGE_NAME}
-     * {@link Client#CHANGE_DEBUGGER_INTEREST}, {@link Client#CHANGE_THREAD_MODE},
+     * {@link Client#CHANGE_DEBUGGER_STATUS}, {@link Client#CHANGE_THREAD_MODE},
      * {@link Client#CHANGE_THREAD_DATA}, {@link Client#CHANGE_HEAP_MODE},
      * {@link Client#CHANGE_HEAP_DATA}, {@link Client#CHANGE_NATIVE_HEAP_DATA}
      *
@@ -160,6 +164,10 @@
             item.setText(1, isDdmAware);
             item = mTable.getItem(ENT_PROCESS_ID);
             item.setText(1, pid);
+            item = mTable.getItem(ENT_SUPPORTS_PROFILING);
+            item.setText(1, Boolean.toString(cd.hasFeature(ClientData.FEATURE_PROFILING)));
+            item = mTable.getItem(ENT_SUPPORTS_HPROF);
+            item.setText(1, Boolean.toString(cd.hasFeature(ClientData.FEATURE_HPROF)));
         }
 
         mCol2.pack();
diff --git a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/NativeHeapPanel.java b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/NativeHeapPanel.java
index 46461bf..0b2460b 100644
--- a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/NativeHeapPanel.java
+++ b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/NativeHeapPanel.java
@@ -668,7 +668,7 @@
      * @param client the updated client.
      * @param changeMask the bit mask describing the changed properties. It can contain
      * any of the following values: {@link Client#CHANGE_INFO}, {@link Client#CHANGE_NAME}
-     * {@link Client#CHANGE_DEBUGGER_INTEREST}, {@link Client#CHANGE_THREAD_MODE},
+     * {@link Client#CHANGE_DEBUGGER_STATUS}, {@link Client#CHANGE_THREAD_MODE},
      * {@link Client#CHANGE_THREAD_DATA}, {@link Client#CHANGE_HEAP_MODE},
      * {@link Client#CHANGE_HEAP_DATA}, {@link Client#CHANGE_NATIVE_HEAP_DATA}
      *
diff --git a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/ScreenShotDialog.java b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/ScreenShotDialog.java
index b9bb10c..0f04a60 100644
--- a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/ScreenShotDialog.java
+++ b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/ScreenShotDialog.java
@@ -21,11 +21,13 @@
 import com.android.ddmlib.RawImage;
 
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.ImageTransfer;
+import org.eclipse.swt.dnd.Transfer;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.ImageLoader;
 import org.eclipse.swt.graphics.PaletteData;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
@@ -48,6 +50,8 @@
     private Label mImageLabel;
     private Button mSave;
     private IDevice mDevice;
+    private RawImage mRawImage;
+    private Clipboard mClipboard;
 
 
     /**
@@ -55,6 +59,7 @@
      */
     public ScreenShotDialog(Shell parent) {
         this(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+        mClipboard = new Clipboard(parent.getDisplay());
     }
 
     /**
@@ -95,22 +100,9 @@
     private void createContents(final Shell shell) {
         GridData data;
 
-        shell.setLayout(new GridLayout(3, true));
+        final int colCount = 5;
 
-        // title/"capturing" label
-        mBusyLabel = new Label(shell, SWT.NONE);
-        mBusyLabel.setText("Preparing...");
-        data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
-        data.horizontalSpan = 3;
-        mBusyLabel.setLayoutData(data);
-
-        // space for the image
-        mImageLabel = new Label(shell, SWT.BORDER);
-        data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
-        data.horizontalSpan = 3;
-        mImageLabel.setLayoutData(data);
-        Display display = shell.getDisplay();
-        mImageLabel.setImage(ImageHelper.createPlaceHolderArt(display, 50, 50, display.getSystemColor(SWT.COLOR_BLUE)));
+        shell.setLayout(new GridLayout(colCount, true));
 
         // "refresh" button
         Button refresh = new Button(shell, SWT.PUSH);
@@ -125,6 +117,22 @@
             }
         });
 
+        // "rotate" button
+        Button rotate = new Button(shell, SWT.PUSH);
+        rotate.setText("Rotate");
+        data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
+        data.widthHint = 80;
+        rotate.setLayoutData(data);
+        rotate.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                if (mRawImage != null) {
+                    mRawImage = mRawImage.getRotated();
+                    updateImageDisplay(shell);
+                }
+            }
+        });
+
         // "save" button
         mSave = new Button(shell, SWT.PUSH);
         mSave.setText("Save");
@@ -138,6 +146,20 @@
             }
         });
 
+        Button copy = new Button(shell, SWT.PUSH);
+        copy.setText("Copy");
+        copy.setToolTipText("Copy the screenshot to the clipboard");
+        data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
+        data.widthHint = 80;
+        copy.setLayoutData(data);
+        copy.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                copy();
+            }
+        });
+
+
         // "done" button
         Button done = new Button(shell, SWT.PUSH);
         done.setText("Done");
@@ -151,24 +173,75 @@
             }
         });
 
+        // title/"capturing" label
+        mBusyLabel = new Label(shell, SWT.NONE);
+        mBusyLabel.setText("Preparing...");
+        data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+        data.horizontalSpan = colCount;
+        mBusyLabel.setLayoutData(data);
+
+        // space for the image
+        mImageLabel = new Label(shell, SWT.BORDER);
+        data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
+        data.horizontalSpan = colCount;
+        mImageLabel.setLayoutData(data);
+        Display display = shell.getDisplay();
+        mImageLabel.setImage(ImageHelper.createPlaceHolderArt(
+                display, 50, 50, display.getSystemColor(SWT.COLOR_BLUE)));
+
+
         shell.setDefaultButton(done);
     }
 
-    /*
-     * Capture a new image from the device.
+    /**
+     * Copies the content of {@link #mImageLabel} to the clipboard.
+     */
+    private void copy() {
+        mClipboard.setContents(
+                new Object[] {
+                        mImageLabel.getImage().getImageData()
+                }, new Transfer[] {
+                        ImageTransfer.getInstance()
+                });
+    }
+
+    /**
+     * Captures a new image from the device, and display it.
      */
     private void updateDeviceImage(Shell shell) {
         mBusyLabel.setText("Capturing...");     // no effect
 
         shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
 
-        Image image = getDeviceImage();
-        if (image == null) {
+        mRawImage = getDeviceImage();
+
+        updateImageDisplay(shell);
+    }
+
+    /**
+     * Updates the display with {@link #mRawImage}.
+     * @param shell
+     */
+    private void updateImageDisplay(Shell shell) {
+        Image image;
+        if (mRawImage == null) {
             Display display = shell.getDisplay();
-            image = ImageHelper.createPlaceHolderArt(display, 320, 240, display.getSystemColor(SWT.COLOR_BLUE));
+            image = ImageHelper.createPlaceHolderArt(
+                    display, 320, 240, display.getSystemColor(SWT.COLOR_BLUE));
+
             mSave.setEnabled(false);
             mBusyLabel.setText("Screen not available");
         } else {
+            // convert raw data to an Image.
+            PaletteData palette = new PaletteData(
+                    mRawImage.getRedMask(),
+                    mRawImage.getGreenMask(),
+                    mRawImage.getBlueMask());
+
+            ImageData imageData = new ImageData(mRawImage.width, mRawImage.height,
+                    mRawImage.bpp, palette, 1, mRawImage.data);
+            image = new Image(getParent().getDisplay(), imageData);
+
             mSave.setEnabled(true);
             mBusyLabel.setText("Captured image:");
         }
@@ -181,31 +254,17 @@
         shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_ARROW));
     }
 
-    /*
-     * Grab an image from an ADB-connected device.
+    /**
+     * Grabs an image from an ADB-connected device and returns it as a {@link RawImage}.
      */
-    private Image getDeviceImage() {
-        RawImage rawImage;
-
+    private RawImage getDeviceImage() {
         try {
-            rawImage = mDevice.getScreenshot();
+            return mDevice.getScreenshot();
         }
         catch (IOException ioe) {
             Log.w("ddms", "Unable to get frame buffer: " + ioe.getMessage());
             return null;
         }
-
-        // device/adb not available?
-        if (rawImage == null)
-            return null;
-
-        // convert raw data to an Image
-        assert rawImage.bpp == 16;
-        PaletteData palette = new PaletteData(0xf800, 0x07e0, 0x001f);
-        ImageData imageData = new ImageData(rawImage.width, rawImage.height,
-            rawImage.bpp, palette, 1, rawImage.data);
-
-        return new Image(getParent().getDisplay(), imageData);
     }
 
     /*
@@ -229,7 +288,7 @@
         if (fileName != null) {
             DdmUiPreferences.getStore().setValue("lastImageSaveDir", dlg.getFilterPath());
 
-            Log.i("ddms", "Saving image to " + fileName);
+            Log.d("ddms", "Saving image to " + fileName);
             ImageData imageData = mImageLabel.getImage().getImageData();
 
             try {
@@ -238,17 +297,6 @@
             catch (IOException ioe) {
                 Log.w("ddms", "Unable to save " + fileName + ": " + ioe);
             }
-
-            if (false) {
-                ImageLoader loader = new ImageLoader();
-                loader.data = new ImageData[] { imageData };
-                // PNG writing not available until 3.3?  See bug at:
-                //  https://bugs.eclipse.org/bugs/show_bug.cgi?id=24697
-                // GIF writing only works for 8 bits
-                // JPEG uses lossy compression
-                // BMP has screwed-up colors
-                loader.save(fileName, SWT.IMAGE_JPEG);
-            }
         }
     }
 
diff --git a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/SyncProgressMonitor.java b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/SyncProgressMonitor.java
new file mode 100644
index 0000000..5925984
--- /dev/null
+++ b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/SyncProgressMonitor.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ddmuilib;
+
+import com.android.ddmlib.SyncService.ISyncProgressMonitor;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * Implementation of the {@link ISyncProgressMonitor} wrapping an Eclipse {@link IProgressMonitor}.
+ */
+public class SyncProgressMonitor implements ISyncProgressMonitor {
+
+    private IProgressMonitor mMonitor;
+    private String mName;
+
+    public SyncProgressMonitor(IProgressMonitor monitor, String name) {
+        mMonitor = monitor;
+        mName = name;
+    }
+
+    public void start(int totalWork) {
+        mMonitor.beginTask(mName, totalWork);
+    }
+
+    public void stop() {
+        mMonitor.done();
+    }
+
+    public void advance(int work) {
+        mMonitor.worked(work);
+    }
+
+    public boolean isCanceled() {
+        return mMonitor.isCanceled();
+    }
+
+    public void startSubTask(String name) {
+        mMonitor.subTask(name);
+    }
+}
diff --git a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/TableHelper.java b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/TableHelper.java
index f8d457e..9d557e0 100644
--- a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/TableHelper.java
+++ b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/TableHelper.java
@@ -146,4 +146,58 @@
         }
     }
 
+    /**
+     * Create a TreeColumn with the specified parameters. If a
+     * <code>PreferenceStore</code> object and a preference entry name String
+     * object are provided then the column will listen to change in its width
+     * and update the preference store accordingly.
+     *
+     * @param parent The Table parent object
+     * @param header The header string
+     * @param style The column style
+     * @param width the width of the column if the preference value is missing
+     * @param pref_name The preference entry name for column width
+     * @param prefs The preference store
+     */
+    public static void createTreeColumn(Tree parent, String header, int style,
+            int width, final String pref_name,
+            final IPreferenceStore prefs) {
+
+        // create the column
+        TreeColumn col = new TreeColumn(parent, style);
+
+        // if there is no pref store or the entry is missing, we use the sample
+        // text and pack the column.
+        // Otherwise we just read the width from the prefs and apply it.
+        if (prefs == null || prefs.contains(pref_name) == false) {
+            col.setWidth(width);
+
+            // init the prefs store with the current value
+            if (prefs != null) {
+                prefs.setValue(pref_name, width);
+            }
+        } else {
+            col.setWidth(prefs.getInt(pref_name));
+        }
+
+        // set the header
+        col.setText(header);
+
+        // if there is a pref store and a pref entry name, then we setup a
+        // listener to catch column resize to put store the new width value.
+        if (prefs != null && pref_name != null) {
+            col.addControlListener(new ControlListener() {
+                public void controlMoved(ControlEvent e) {
+                }
+
+                public void controlResized(ControlEvent e) {
+                    // get the new width
+                    int w = ((TreeColumn)e.widget).getWidth();
+
+                    // store in pref store
+                    prefs.setValue(pref_name, w);
+                }
+            });
+        }
+    }
 }
diff --git a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/ThreadPanel.java b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/ThreadPanel.java
index a034063..d94d4f3 100644
--- a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/ThreadPanel.java
+++ b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/ThreadPanel.java
@@ -376,7 +376,7 @@
      * @param client the updated client.
      * @param changeMask the bit mask describing the changed properties. It can contain
      * any of the following values: {@link Client#CHANGE_INFO}, {@link Client#CHANGE_NAME}
-     * {@link Client#CHANGE_DEBUGGER_INTEREST}, {@link Client#CHANGE_THREAD_MODE},
+     * {@link Client#CHANGE_DEBUGGER_STATUS}, {@link Client#CHANGE_THREAD_MODE},
      * {@link Client#CHANGE_THREAD_DATA}, {@link Client#CHANGE_HEAP_MODE},
      * {@link Client#CHANGE_HEAP_DATA}, {@link Client#CHANGE_NATIVE_HEAP_DATA}
      *
diff --git a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/WritePng.java b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/WritePng.java
index f65dafe..804b416 100644
--- a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/WritePng.java
+++ b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/WritePng.java
@@ -68,7 +68,7 @@
         int height = imageData.height;
         byte[] out24;
 
-        Log.i("ddms-png", "Convert to 24bit from " + imageData.depth);
+        Log.d("ddms-png", "Convert to 24bit from " + imageData.depth);
 
         if (imageData.depth == 24 || imageData.depth == 32) {
             out24 = convertTo24ForPng(imageData.data, width, height,
diff --git a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/explorer/DeviceExplorer.java b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/explorer/DeviceExplorer.java
index 4652b31..66843a4 100644
--- a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/explorer/DeviceExplorer.java
+++ b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/explorer/DeviceExplorer.java
@@ -25,6 +25,7 @@
 import com.android.ddmlib.SyncService.SyncResult;
 import com.android.ddmuilib.DdmUiPreferences;
 import com.android.ddmuilib.Panel;
+import com.android.ddmuilib.SyncProgressMonitor;
 import com.android.ddmuilib.TableHelper;
 import com.android.ddmuilib.actions.ICommonAction;
 import com.android.ddmuilib.console.DdmConsole;
@@ -103,41 +104,6 @@
 
     private String mDefaultSave;
 
-    /**
-     * Implementation of the SyncService.ISyncProgressMonitor. It wraps a jFace IProgressMonitor
-     * and just forward the calls to the jFace object.
-     */
-    private static class SyncProgressMonitor implements ISyncProgressMonitor {
-
-        private IProgressMonitor mMonitor;
-        private String mName;
-
-        SyncProgressMonitor(IProgressMonitor monitor, String name) {
-            mMonitor = monitor;
-            mName = name;
-        }
-
-        public void start(int totalWork) {
-            mMonitor.beginTask(mName, totalWork);
-        }
-
-        public void stop() {
-            mMonitor.done();
-        }
-
-        public void advance(int work) {
-            mMonitor.worked(work);
-        }
-
-        public boolean isCanceled() {
-            return mMonitor.isCanceled();
-        }
-
-        public void startSubTask(String name) {
-            mMonitor.subTask(name);
-        }
-    }
-
     public DeviceExplorer() {
 
     }
diff --git a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/handler/BaseFileHandler.java b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/handler/BaseFileHandler.java
new file mode 100644
index 0000000..3a2a2ef
--- /dev/null
+++ b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/handler/BaseFileHandler.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ddmuilib.handler;
+
+import com.android.ddmlib.SyncService;
+import com.android.ddmlib.ClientData.IHprofDumpHandler;
+import com.android.ddmlib.ClientData.IMethodProfilingHandler;
+import com.android.ddmlib.SyncService.SyncResult;
+import com.android.ddmuilib.SyncProgressMonitor;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * Base handler class for handler dealing with files located on a device.
+ *
+ * @see IHprofDumpHandler
+ * @see IMethodProfilingHandler
+ */
+public class BaseFileHandler {
+
+    protected final Shell mParentShell;
+
+    public BaseFileHandler(Shell parentShell) {
+        mParentShell = parentShell;
+    }
+
+    /**
+     * Prompts the user for a save location and pulls the remote files into this location.
+     * <p/>This <strong>must</strong> be called from the UI Thread.
+     * @param sync the {@link SyncService} to use to pull the file from the device
+     * @param localFileName The default local name
+     * @param remoteFilePath The name of the file to pull off of the device
+     * @param title The title of the File Save dialog.
+     * @return The result of the pull as a {@link SyncResult} object, or null if the sync
+     * didn't happen (canceled by the user).
+     * @throws InvocationTargetException
+     * @throws InterruptedException
+     */
+    protected SyncResult promptAndPull(SyncService sync,
+            String localFileName, String remoteFilePath, String title)
+            throws InvocationTargetException, InterruptedException {
+        FileDialog fileDialog = new FileDialog(mParentShell, SWT.SAVE);
+
+        fileDialog.setText(title);
+        fileDialog.setFileName(localFileName);
+
+        String localFilePath = fileDialog.open();
+        if (localFilePath != null) {
+            return pull(sync, localFilePath, remoteFilePath);
+        }
+
+        return null;
+    }
+
+    /**
+     * Pulls a file off of a device
+     * @param sync the {@link SyncService} to use to pull the file.
+     * @param localFilePath the path of the local file to create
+     * @param remoteFilePath the path of the remote file to pull
+     * @return the result of the sync as an instance of {@link SyncResult}
+     * @throws InvocationTargetException
+     * @throws InterruptedException
+     */
+    protected SyncResult pull(final SyncService sync, final String localFilePath,
+            final String remoteFilePath)
+            throws InvocationTargetException, InterruptedException {
+        final SyncResult[] res = new SyncResult[1];
+        new ProgressMonitorDialog(mParentShell).run(true, true, new IRunnableWithProgress() {
+            public void run(IProgressMonitor monitor) {
+                try {
+                    res[0] = sync.pullFile(remoteFilePath, localFilePath,
+                            new SyncProgressMonitor(monitor, String.format(
+                                    "Pulling %1$s from the device", remoteFilePath)));
+                } finally {
+                    sync.close();
+                }
+            }
+        });
+
+        return res[0];
+    }
+}
diff --git a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/handler/MethodProfilingHandler.java b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/handler/MethodProfilingHandler.java
new file mode 100644
index 0000000..f469a7d
--- /dev/null
+++ b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/handler/MethodProfilingHandler.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ddmuilib.handler;
+
+import com.android.ddmlib.Client;
+import com.android.ddmlib.IDevice;
+import com.android.ddmlib.Log;
+import com.android.ddmlib.SyncService;
+import com.android.ddmlib.ClientData.IMethodProfilingHandler;
+import com.android.ddmlib.SyncService.SyncResult;
+import com.android.ddmuilib.DdmUiPreferences;
+import com.android.ddmuilib.console.DdmConsole;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * Handler for Method tracing.
+ * This will pull the trace file into a temp file and launch traceview.
+ */
+public class MethodProfilingHandler extends BaseFileHandler
+        implements IMethodProfilingHandler {
+
+    public MethodProfilingHandler(Shell parentShell) {
+        super(parentShell);
+    }
+
+    public void onFailure(final Client client) {
+        mParentShell.getDisplay().asyncExec(new Runnable() {
+            public void run() {
+                displayError(
+                        "Unable to create Method Profiling file for application '%1$s'.\n" +
+                        "Check logcat for more information.",
+                        client.getClientData().getClientDescription());
+            }
+        });
+    }
+
+    public void onSuccess(final String remoteFilePath, final Client client) {
+        mParentShell.getDisplay().asyncExec(new Runnable() {
+            public void run() {
+                if (remoteFilePath == null) {
+                    displayError(
+                            "Unable to download trace file: unknown file name.\n" +
+                            "This can happen if you disconnected the device while recording the trace.");
+                    return;
+                }
+
+                final IDevice device = client.getDevice();
+                try {
+                    // get the sync service to pull the HPROF file
+                    final SyncService sync = client.getDevice().getSyncService();
+                    if (sync != null) {
+                        pullAndOpen(sync, remoteFilePath);
+                    } else {
+                        displayError("Unable to download trace file from device '%1$s'.",
+                                device.getSerialNumber());
+                    }
+                } catch (Exception e) {
+                    displayError("Unable to download trace file from device '%1$s'.",
+                            device.getSerialNumber());
+                }
+            }
+
+        });
+    }
+
+    private void pullAndOpen(SyncService sync, String remoteFilePath)
+            throws InvocationTargetException, InterruptedException, IOException {
+        // get a temp file
+        File temp = File.createTempFile("android", ".trace"); //$NON-NLS-1$ //$NON-NLS-2$
+        String tempPath = temp.getAbsolutePath();
+
+        // pull the file
+        SyncResult result = pull(sync, tempPath, remoteFilePath);
+        if (result != null) {
+            if (result.getCode() == SyncService.RESULT_OK) {
+                // open the temp file in traceview
+                openInTraceview(tempPath);
+            } else {
+                displayError("Unable to download trace file:\n\n%1$s",
+                        result.getMessage());
+            }
+        } else {
+            // this really shouldn't happen.
+            displayError("Unable to download trace file.");
+        }
+    }
+
+    private void openInTraceview(String tempPath) {
+        // now that we have the file, we need to launch traceview
+        String[] command = new String[2];
+        command[0] = DdmUiPreferences.getTraceview();
+        command[1] = tempPath;
+
+        try {
+            final Process p = Runtime.getRuntime().exec(command);
+
+            // create a thread for the output
+            new Thread("Traceview output") {
+                @Override
+                public void run() {
+                    // create a buffer to read the stderr output
+                    InputStreamReader is = new InputStreamReader(p.getErrorStream());
+                    BufferedReader resultReader = new BufferedReader(is);
+
+                    // read the lines as they come. if null is returned, it's
+                    // because the process finished
+                    try {
+                        while (true) {
+                            String line = resultReader.readLine();
+                            if (line != null) {
+                                DdmConsole.printErrorToConsole("Traceview: " + line);
+                            } else {
+                                break;
+                            }
+                        }
+                        // get the return code from the process
+                        p.waitFor();
+                    } catch (Exception e) {
+                        Log.e("traceview", e);
+                    }
+                }
+            }.start();
+        } catch (IOException e) {
+            Log.e("traceview", e);
+        }
+    }
+
+    private void displayError(String format, Object... args) {
+        MessageDialog.openError(mParentShell, "Method Profiling Error",
+                String.format(format, args));
+    }
+}
diff --git a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/log/event/DisplaySync.java b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/log/event/DisplaySync.java
index 82cc7a4..1c006bc 100644
--- a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/log/event/DisplaySync.java
+++ b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/log/event/DisplaySync.java
@@ -229,8 +229,14 @@
                 sb.append("sync already in progress\n");
             } else if ("I".equals(key)) {
                 sb.append("io exception\n");
+            } else if (auth == CONTACTS && "g".equals(key)) {
+                sb.append("aggregation query: ").append(val).append("\n");
+            } else if (auth == CONTACTS && "G".equals(key)) {
+                sb.append("aggregation merge: ").append(val).append("\n");
+            } else if (auth == CONTACTS && "n".equals(key)) {
+                sb.append("num entries: ").append(val).append("\n");
             } else if (auth == CONTACTS && "p".equals(key)) {
-                sb.append("photos uploaded from client: ").append(val).append("\n");
+                sb.append("photos uploaded from server: ").append(val).append("\n");
             } else if (auth == CONTACTS && "P".equals(key)) {
                 sb.append("photos downloaded from server: ").append(val).append("\n");
             } else if (auth == CALENDAR && "F".equals(key)) {
@@ -290,4 +296,4 @@
     int getDisplayType() {
         return DISPLAY_TYPE_SYNC;
     }
-}
\ No newline at end of file
+}
diff --git a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/log/event/SyncCommon.java b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/log/event/SyncCommon.java
index 108c097..0a355d1 100644
--- a/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/log/event/SyncCommon.java
+++ b/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib/log/event/SyncCommon.java
@@ -48,6 +48,7 @@
     final int EVENT_SYNC = 2720;
     final int EVENT_TICKLE = 2742;
     final int EVENT_SYNC_DETAILS = 2743;
+    final int EVENT_CONTACTS_AGGREGATION = 2747;
 
     protected SyncCommon(String name) {
         super(name);
@@ -111,6 +112,18 @@
                                 false, mLastSyncSource);
                     }
                 }
+            } else if (event.mTag == EVENT_CONTACTS_AGGREGATION) {
+                long stopTime = (long) event.sec * 1000L + (event.nsec / 1000000L);
+                long startTime = stopTime - Long.parseLong(event.getValueAsString(0));
+                String details;
+                int count = Integer.parseInt(event.getValueAsString(1));
+                if (count < 0) {
+                    details = "g" + (-count);
+                } else {
+                    details = "G" + count;
+                }
+                processSyncEvent(event, CONTACTS, startTime, stopTime, details,
+                        true /* newEvent */, mLastSyncSource);
             }
         } catch (InvalidTypeException e) {
         }
@@ -141,7 +154,8 @@
     protected int getAuth(String authname) throws InvalidTypeException {
         if ("calendar".equals(authname) || "cl".equals(authname)) {
             return CALENDAR;
-        } else if ("contacts".equals(authname) || "cp".equals(authname)) {
+        } else if ("contacts".equals(authname) || "cp".equals(authname) ||
+                "com.android.contacts".equals(authname)) {
             return CONTACTS;
         } else if ("subscribedfeeds".equals(authname)) {
             return FEEDS;
diff --git a/tools/ddms/libs/ddmuilib/src/resources/images/hprof.png b/tools/ddms/libs/ddmuilib/src/resources/images/hprof.png
new file mode 100644
index 0000000..123d062
--- /dev/null
+++ b/tools/ddms/libs/ddmuilib/src/resources/images/hprof.png
Binary files differ
diff --git a/tools/ddms/libs/ddmuilib/src/resources/images/tracing_start.png b/tools/ddms/libs/ddmuilib/src/resources/images/tracing_start.png
new file mode 100644
index 0000000..88771cc
--- /dev/null
+++ b/tools/ddms/libs/ddmuilib/src/resources/images/tracing_start.png
Binary files differ
diff --git a/tools/ddms/libs/ddmuilib/src/resources/images/tracing_stop.png b/tools/ddms/libs/ddmuilib/src/resources/images/tracing_stop.png
new file mode 100644
index 0000000..71bd215
--- /dev/null
+++ b/tools/ddms/libs/ddmuilib/src/resources/images/tracing_stop.png
Binary files differ
diff --git a/tools/eclipse/changes.txt b/tools/eclipse/changes.txt
index cd2736a..0c653c3 100644
--- a/tools/eclipse/changes.txt
+++ b/tools/eclipse/changes.txt
@@ -1,7 +1,11 @@
-0.9.2:
+0.9.4:
+- New "Create project from sample" choice in the New Project Wizard.
+
+0.9.3:
 - New wizard to create Android JUnit Test Projects.
 - New AVD wizard.
 - SDK Updater
+- zipalign support
 
 0.9.1:
 - Added an AVD creation wizard to ADT. It is automatically displayed during a launch if no compatible AVDs are found.
diff --git a/tools/eclipse/features/com.android.ide.eclipse.adt/feature.xml b/tools/eclipse/features/com.android.ide.eclipse.adt/feature.xml
index 6dd3ee7..f1d3e73 100644
--- a/tools/eclipse/features/com.android.ide.eclipse.adt/feature.xml
+++ b/tools/eclipse/features/com.android.ide.eclipse.adt/feature.xml
@@ -2,7 +2,7 @@
 <feature
       id="com.android.ide.eclipse.adt"
       label="Android Development Tools"
-      version="0.9.3.qualifier"
+      version="0.9.5.qualifier"
       provider-name="The Android Open Source Project"
       plugin="com.android.ide.eclipse.adt">
 
diff --git a/tools/eclipse/features/com.android.ide.eclipse.ddms/feature.xml b/tools/eclipse/features/com.android.ide.eclipse.ddms/feature.xml
index e67f960..455acc5 100644
--- a/tools/eclipse/features/com.android.ide.eclipse.ddms/feature.xml
+++ b/tools/eclipse/features/com.android.ide.eclipse.ddms/feature.xml
@@ -2,7 +2,7 @@
 <feature
       id="com.android.ide.eclipse.ddms"
       label="Android DDMS"
-      version="0.9.3.qualifier"
+      version="0.9.5.qualifier"
       provider-name="The Android Open Source Project">
 
    <description>
@@ -230,6 +230,9 @@
       <import plugin="org.eclipse.ui"/>
       <import plugin="org.eclipse.core.runtime"/>
       <import plugin="org.eclipse.ui.console"/>
+      <import plugin="org.eclipse.core.resources"/>
+      <import plugin="org.eclipse.ui.ide"/>
+      <import plugin="org.eclipse.core.filesystem"/>
    </requires>
 
    <plugin
diff --git a/tools/eclipse/features/com.android.ide.eclipse.tests/feature.xml b/tools/eclipse/features/com.android.ide.eclipse.tests/feature.xml
index cc34045..75abcd4 100644
--- a/tools/eclipse/features/com.android.ide.eclipse.tests/feature.xml
+++ b/tools/eclipse/features/com.android.ide.eclipse.tests/feature.xml
@@ -2,7 +2,7 @@
 <feature
       id="com.android.ide.eclipse.tests"
       label="ADT Tests"
-      version="0.9.3.qualifier"
+      version="0.9.5.qualifier"
       provider-name="The Android Open Source Project">
 
    <copyright>
diff --git a/tools/eclipse/plugins/.gitignore b/tools/eclipse/plugins/.gitignore
index 63ac0cf..72cc8c5 100644
--- a/tools/eclipse/plugins/.gitignore
+++ b/tools/eclipse/plugins/.gitignore
@@ -30,6 +30,7 @@
 com.android.ide.eclipse.ddms/icons/gc.png
 com.android.ide.eclipse.ddms/icons/halt.png
 com.android.ide.eclipse.ddms/icons/heap.png
+com.android.ide.eclipse.ddms/icons/hprof.png
 com.android.ide.eclipse.ddms/icons/i.png
 com.android.ide.eclipse.ddms/icons/importBug.png
 com.android.ide.eclipse.ddms/icons/load.png
@@ -39,6 +40,8 @@
 com.android.ide.eclipse.ddms/icons/push.png
 com.android.ide.eclipse.ddms/icons/save.png
 com.android.ide.eclipse.ddms/icons/thread.png
+com.android.ide.eclipse.ddms/icons/tracing_start.png
+com.android.ide.eclipse.ddms/icons/tracing_stop.png
 com.android.ide.eclipse.ddms/icons/up.png
 com.android.ide.eclipse.ddms/icons/v.png
 com.android.ide.eclipse.ddms/icons/w.png
@@ -50,4 +53,7 @@
 com.android.ide.eclipse.ddms/src/com/android/ddmuilib
 com.android.ide.eclipse.tests/kxml2-2.3.0.jar
 com.android.ide.eclipse.tests/unittests/com/android/ddmlib
+com.android.ide.eclipse.tests/unittests/com/android/sdklib
+com.android.ide.eclipse.tests/unittests/com/android/sdkuilib
+com.android.ide.eclipse.tests/unittests/com/android/layoutlib
 
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/.gitignore b/tools/eclipse/plugins/com.android.ide.eclipse.adt/.gitignore
new file mode 100644
index 0000000..d392f0e
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/.gitignore
@@ -0,0 +1 @@
+*.jar
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF b/tools/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
index 32c939b..24fbc56 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Android Development Toolkit
 Bundle-SymbolicName: com.android.ide.eclipse.adt;singleton:=true
-Bundle-Version: 0.9.3.qualifier
+Bundle-Version: 0.9.5.qualifier
 Bundle-ClassPath: .,
  jarutils.jar,
  androidprefs.jar,
@@ -54,6 +54,7 @@
  com.android.ide.eclipse.adt.internal.editors;x-friends:="com.android.ide.eclipse.tests",
  com.android.ide.eclipse.adt.internal.editors.descriptors;x-friends:="com.android.ide.eclipse.tests",
  com.android.ide.eclipse.adt.internal.editors.layout;x-friends:="com.android.ide.eclipse.tests",
+ com.android.ide.eclipse.adt.internal.editors.layout.configuration,
  com.android.ide.eclipse.adt.internal.editors.layout.descriptors;x-friends:="com.android.ide.eclipse.tests",
  com.android.ide.eclipse.adt.internal.editors.layout.parts;x-friends:="com.android.ide.eclipse.tests",
  com.android.ide.eclipse.adt.internal.editors.layout.uimodel;x-friends:="com.android.ide.eclipse.tests",
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/icons/clipping.png b/tools/eclipse/plugins/com.android.ide.eclipse.adt/icons/clipping.png
new file mode 100644
index 0000000..6f2a35f
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/icons/clipping.png
Binary files differ
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml b/tools/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
index f045b06..285f667 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
@@ -583,7 +583,7 @@
                menubarPath="Window/additions"
                style="push"
                toolbarPath="android_project"
-               tooltip="Opens the Android Virtual Device (AVD) and SDK Manager">
+               tooltip="Opens the Android SDK and AVD Manager">
          </action>
       </actionSet>
    </extension>
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
index 4aa3a80..5d8b6c2 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
@@ -244,6 +244,7 @@
      * (non-Javadoc)
      * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
      */
+    @SuppressWarnings("deprecation")
     @Override
     public void start(BundleContext context) throws Exception {
         super.start(context);
@@ -1025,10 +1026,13 @@
 
                         progress.setTaskName(Messages.AdtPlugin_Parsing_Resources);
 
-                        int n = sdk.getTargets().length;
+                        final IAndroidTarget[] targets = sdk.getTargets();
+                        final int n = targets.length;
                         if (n > 0) {
+                            // load the rest of the targets.
+                            // TODO: make this on-demand.
                             int w = 60 / n;
-                            for (IAndroidTarget target : sdk.getTargets()) {
+                            for (IAndroidTarget target : targets) {
                                 SubMonitor p2 = progress.newChild(w);
                                 IStatus status = new AndroidTargetParser(target).run(p2);
                                 if (status.getCode() != IStatus.OK) {
@@ -1041,12 +1045,12 @@
                             }
                         }
 
+                        ArrayList<IJavaProject> list = new ArrayList<IJavaProject>();
                         synchronized (getSdkLockObject()) {
                             mSdkIsLoaded = LoadStatus.LOADED;
 
                             progress.setTaskName("Check Projects");
 
-                            ArrayList<IJavaProject> list = new ArrayList<IJavaProject>();
                             for (IJavaProject javaProject : mPostLoadProjectsToResolve) {
                                 if (javaProject.getProject().isOpen()) {
                                     list.add(javaProject);
@@ -1055,24 +1059,24 @@
 
                             // done with this list.
                             mPostLoadProjectsToResolve.clear();
-
-                            // check the projects that need checking.
-                            // The method modifies the list (it removes the project that
-                            // do not need to be resolved again).
-                            AndroidClasspathContainerInitializer.checkProjectsCache(
-                                    mPostLoadProjectsToCheck);
-
-                            list.addAll(mPostLoadProjectsToCheck);
-
-                            // update the project that needs recompiling.
-                            if (list.size() > 0) {
-                                IJavaProject[] array = list.toArray(
-                                        new IJavaProject[list.size()]);
-                                AndroidClasspathContainerInitializer.updateProjects(array);
-                            }
-
-                            progress.worked(10);
                         }
+
+                        // check the projects that need checking.
+                        // The method modifies the list (it removes the project that
+                        // do not need to be resolved again).
+                        AndroidClasspathContainerInitializer.checkProjectsCache(
+                                mPostLoadProjectsToCheck);
+
+                        list.addAll(mPostLoadProjectsToCheck);
+
+                        // update the project that needs recompiling.
+                        if (list.size() > 0) {
+                            IJavaProject[] array = list.toArray(
+                                    new IJavaProject[list.size()]);
+                            AndroidClasspathContainerInitializer.updateProjects(array);
+                        }
+
+                        progress.worked(10);
                     }
 
                     // Notify resource changed listeners
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/ApkBuilder.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/ApkBuilder.java
index b49ee6e..1ed5123 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/ApkBuilder.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/ApkBuilder.java
@@ -34,6 +34,7 @@
 import com.android.prefs.AndroidLocation.AndroidLocationException;
 import com.android.sdklib.IAndroidTarget;
 import com.android.sdklib.SdkConstants;
+import com.android.sdklib.internal.project.ApkSettings;
 
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
@@ -303,11 +304,15 @@
                 return referencedProjects;
             }
 
-            // get the extra configs for the project.
-            // The map contains (name, filter) where 'name' is a name to be used in the apk filename,
-            // and filter is the resource filter to be used in the aapt -c parameters to restrict
-            // which resource configurations to package in the apk.
-            Map<String, String> configs = Sdk.getCurrent().getProjectApkConfigs(project);
+            // get the APK configs for the project.
+            ApkSettings apkSettings = Sdk.getCurrent().getApkSettings(project);
+            Set<Entry<String, String>> apkfilters = null;
+            if (apkSettings != null) {
+                Map<String, String> filterMap = apkSettings.getResourceFilters();
+                if (filterMap != null && filterMap.size() > 0) {
+                    apkfilters = filterMap.entrySet();
+                }
+            }
 
             // do some extra check, in case the output files are not present. This
             // will force to recreate them.
@@ -320,19 +325,20 @@
                     mPackageResources = true;
                     mBuildFinalPackage = true;
                 } else {
-                    // if the full package is present, we check the filtered resource packages as well
-                    if (configs != null) {
-                        Set<Entry<String, String>> entrySet = configs.entrySet();
-
-                        for (Entry<String, String> entry : entrySet) {
+                    // if the full package is present, we check the filtered resource packages
+                    // as well
+                    if (apkfilters != null) {
+                        for (Entry<String, String> entry : apkfilters) {
                             String filename = String.format(AndroidConstants.FN_RESOURCES_S_AP_,
                                     entry.getKey());
 
                             tmp = outputFolder.findMember(filename);
                             if (tmp == null || (tmp instanceof IFile &&
                                     tmp.exists() == false)) {
-                                String msg = String.format(Messages.s_Missing_Repackaging, filename);
-                                AdtPlugin.printBuildToConsole(AdtConstants.BUILD_VERBOSE, project, msg);
+                                String msg = String.format(Messages.s_Missing_Repackaging,
+                                        filename);
+                                AdtPlugin.printBuildToConsole(AdtConstants.BUILD_VERBOSE,
+                                        project, msg);
                                 mPackageResources = true;
                                 mBuildFinalPackage = true;
                                 break;
@@ -360,11 +366,9 @@
                     String msg = String.format(Messages.s_Missing_Repackaging, finalPackageName);
                     AdtPlugin.printBuildToConsole(AdtConstants.BUILD_VERBOSE, project, msg);
                     mBuildFinalPackage = true;
-                } else if (configs != null) {
+                } else if (apkfilters != null) {
                     // if the full apk is present, we check the filtered apk as well
-                    Set<Entry<String, String>> entrySet = configs.entrySet();
-
-                    for (Entry<String, String> entry : entrySet) {
+                    for (Entry<String, String> entry : apkfilters) {
                         String filename = ProjectHelper.getApkFilename(project, entry.getKey());
 
                         tmp = outputFolder.findMember(filename);
@@ -411,9 +415,8 @@
                 // notified.
                 finalPackage.delete();
 
-                if (configs != null) {
-                    Set<Entry<String, String>> entrySet = configs.entrySet();
-                    for (Entry<String, String> entry : entrySet) {
+                if (apkfilters != null) {
+                    for (Entry<String, String> entry : apkfilters) {
                         String packageFilepath = osBinPath + File.separator +
                                 ProjectHelper.getApkFilename(project, entry.getKey());
 
@@ -477,9 +480,8 @@
                         }
 
                         // now do the same thing for all the configured resource packages.
-                        if (configs != null) {
-                            Set<Entry<String, String>> entrySet = configs.entrySet();
-                            for (Entry<String, String> entry : entrySet) {
+                        if (apkfilters != null) {
+                            for (Entry<String, String> entry : apkfilters) {
                                 String outPathFormat = osBinPath + File.separator +
                                         AndroidConstants.FN_RESOURCES_S_AP_;
                                 String outPath = String.format(outPathFormat, entry.getKey());
@@ -527,12 +529,11 @@
                 }
 
                 // now do the same thing for all the configured resource packages.
-                if (configs != null) {
+                if (apkfilters != null) {
                     String resPathFormat = osBinPath + File.separator +
                             AndroidConstants.FN_RESOURCES_S_AP_;
 
-                    Set<Entry<String, String>> entrySet = configs.entrySet();
-                    for (Entry<String, String> entry : entrySet) {
+                    for (Entry<String, String> entry : apkfilters) {
                         // make the filename for the resource package.
                         String resPath = String.format(resPathFormat, entry.getKey());
 
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/PreCompilerBuilder.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/PreCompilerBuilder.java
index eb8fc53..5b6293c 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/PreCompilerBuilder.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/PreCompilerBuilder.java
@@ -27,7 +27,7 @@
 import com.android.sdklib.AndroidVersion;
 import com.android.sdklib.IAndroidTarget;
 import com.android.sdklib.SdkConstants;
-import com.android.sdklib.xml.ManifestConstants;
+import com.android.sdklib.xml.AndroidManifest;
 
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
@@ -335,8 +335,8 @@
                     if (codename != null) {
                         // integer minSdk when the target is a preview => fatal error
                         String msg = String.format(
-                                "Platform %1$s is a preview and requires appication manifests to set %2$s to '%1$s'",
-                                codename, ManifestConstants.ATTRIBUTE_MIN_SDK_VERSION);
+                                "Platform %1$s is a preview and requires appication manifest to set %2$s to '%1$s'",
+                                codename, AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION);
                         AdtPlugin.printErrorToConsole(project, msg);
                         BaseProjectHelper.addMarker(manifest, AdtConstants.MARKER_ADT, msg,
                                 IMarker.SEVERITY_ERROR);
@@ -344,8 +344,18 @@
                     } else if (minSdkValue < projectVersion.getApiLevel()) {
                         // integer minSdk is not high enough for the target => warning
                         String msg = String.format(
-                                "Manifest min SDK version (%1$s) is lower than project target API level (%2$d)",
-                                minSdkVersion, projectVersion.getApiLevel());
+                                "Attribute %1$s (%2$d) is lower than the project target API level (%3$d)",
+                                AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION,
+                                minSdkValue, projectVersion.getApiLevel());
+                        AdtPlugin.printBuildToConsole(AdtConstants.BUILD_VERBOSE, project, msg);
+                        BaseProjectHelper.addMarker(manifest, AdtConstants.MARKER_ADT, msg,
+                                IMarker.SEVERITY_WARNING);
+                    } else if (minSdkValue > projectVersion.getApiLevel()) {
+                        // integer minSdk is too high for the target => warning
+                        String msg = String.format(
+                                "Attribute %1$s (%2$d) is higher than the project target API level (%3$d)",
+                                AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION,
+                                minSdkValue, projectVersion.getApiLevel());
                         AdtPlugin.printBuildToConsole(AdtConstants.BUILD_VERBOSE, project, msg);
                         BaseProjectHelper.addMarker(manifest, AdtConstants.MARKER_ADT, msg,
                                 IMarker.SEVERITY_WARNING);
@@ -358,7 +368,7 @@
                         // platform is not a preview => fatal error
                         String msg = String.format(
                                 "Manifest attribute '%1$s' is set to '%2$s'. Integer is expected.",
-                                ManifestConstants.ATTRIBUTE_MIN_SDK_VERSION, minSdkVersion);
+                                AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION, minSdkVersion);
                         AdtPlugin.printErrorToConsole(project, msg);
                         BaseProjectHelper.addMarker(manifest, AdtConstants.MARKER_ADT, msg,
                                 IMarker.SEVERITY_ERROR);
@@ -367,7 +377,7 @@
                         // platform and manifest codenames don't match => fatal error.
                         String msg = String.format(
                                 "Value of manifest attribute '%1$s' does not match platform codename '%2$s'",
-                                ManifestConstants.ATTRIBUTE_MIN_SDK_VERSION, codename);
+                                AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION, codename);
                         AdtPlugin.printErrorToConsole(project, msg);
                         BaseProjectHelper.addMarker(manifest, AdtConstants.MARKER_ADT, msg,
                                 IMarker.SEVERITY_ERROR);
@@ -380,7 +390,7 @@
                 String codename = projectTarget.getVersion().getCodename();
                 String msg = String.format(
                         "Platform %1$s is a preview and requires appication manifests to set %2$s to '%1$s'",
-                        codename, ManifestConstants.ATTRIBUTE_MIN_SDK_VERSION);
+                        codename, AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION);
                 AdtPlugin.printErrorToConsole(project, msg);
                 BaseProjectHelper.addMarker(manifest, AdtConstants.MARKER_ADT, msg,
                         IMarker.SEVERITY_ERROR);
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/AbstractGraphicalLayoutEditor.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/AbstractGraphicalLayoutEditor.java
deleted file mode 100644
index e8ccdab..0000000
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/AbstractGraphicalLayoutEditor.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.ide.eclipse.adt.internal.editors.layout;
-
-import com.android.ide.eclipse.adt.internal.editors.layout.LayoutReloadMonitor.ILayoutReloadListener;
-import com.android.ide.eclipse.adt.internal.editors.layout.parts.ElementCreateCommand;
-import com.android.ide.eclipse.adt.internal.editors.uimodel.UiDocumentNode;
-import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-
-import org.eclipse.gef.DefaultEditDomain;
-import org.eclipse.gef.ui.parts.GraphicalEditorWithPalette;
-import org.eclipse.gef.ui.parts.SelectionSynchronizer;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Abstract GraphicalLayoutEditor.
- */
-/*package*/ abstract class AbstractGraphicalLayoutEditor extends GraphicalEditorWithPalette
-    implements IWorkbenchPart, ILayoutReloadListener {
-
-    /**
-     * Sets the UI for the edition of a new file.
-     * @param configuration the configuration of the new file.
-     */
-    abstract void editNewFile(FolderConfiguration configuration);
-
-    /**
-     * Reloads this editor, by getting the new model from the {@link LayoutEditor}.
-     */
-    abstract void reloadEditor();
-
-    /**
-     * Callback for XML model changed. Only update/recompute the layout if the editor is visible
-     */
-    abstract void onXmlModelChanged();
-
-    /**
-     * Responds to a page change that made the Graphical editor page the activated page.
-     */
-    abstract void activated();
-
-    /**
-     * Responds to a page change that made the Graphical editor page the deactivated page
-     */
-    abstract void deactivated();
-
-    /**
-     * Used by LayoutEditor.UiEditorActions.selectUiNode to select a new UI Node
-     * created by  {@link ElementCreateCommand#execute()}.
-     * 
-     * @param uiNodeModel The {@link UiElementNode} to select.
-     */
-    abstract void selectModel(UiElementNode uiNodeModel);
-
-    /**
-     * Returns the selection synchronizer object.
-     * The synchronizer can be used to sync the selection of 2 or more EditPartViewers.
-     * <p/>
-     * This is changed from protected to public so that the outline can use it.
-     *
-     * @return the synchronizer
-     */
-    @Override
-    public SelectionSynchronizer getSelectionSynchronizer() {
-        return super.getSelectionSynchronizer();
-    }
-
-    /**
-     * Returns the edit domain.
-     * <p/>
-     * This is changed from protected to public so that the outline can use it.
-     *
-     * @return the edit domain
-     */
-    @Override
-    public DefaultEditDomain getEditDomain() {
-        return super.getEditDomain();
-    }
-
-    abstract void reloadPalette();
-
-    abstract void recomputeLayout();
-
-    abstract UiDocumentNode getModel();
-
-    abstract LayoutEditor getLayoutEditor();
-
-    abstract Clipboard getClipboard();
-
-}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/GraphicalEditorPart.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/GraphicalEditorPart.java
new file mode 100755
index 0000000..302d3db
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/GraphicalEditorPart.java
@@ -0,0 +1,1059 @@
+/*

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.eclipse.org/org/documents/epl-v10.php

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package com.android.ide.eclipse.adt.internal.editors.layout;

+

+import com.android.ide.eclipse.adt.AdtPlugin;

+import com.android.ide.eclipse.adt.internal.editors.layout.LayoutReloadMonitor.ILayoutReloadListener;

+import com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite;

+import com.android.ide.eclipse.adt.internal.editors.layout.configuration.LayoutCreatorDialog;

+import com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.IConfigListener;

+import com.android.ide.eclipse.adt.internal.editors.layout.parts.ElementCreateCommand;

+import com.android.ide.eclipse.adt.internal.editors.uimodel.UiDocumentNode;

+import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;

+import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;

+import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources;

+import com.android.ide.eclipse.adt.internal.resources.manager.ResourceFile;

+import com.android.ide.eclipse.adt.internal.resources.manager.ResourceFolderType;

+import com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager;

+import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;

+import com.android.ide.eclipse.adt.internal.sdk.LoadStatus;

+import com.android.ide.eclipse.adt.internal.sdk.Sdk;

+import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData.LayoutBridge;

+import com.android.ide.eclipse.adt.internal.sdk.Sdk.ITargetChangeListener;

+import com.android.layoutlib.api.ILayoutBridge;

+import com.android.layoutlib.api.ILayoutLog;

+import com.android.layoutlib.api.ILayoutResult;

+import com.android.layoutlib.api.IProjectCallback;

+import com.android.layoutlib.api.IResourceValue;

+import com.android.layoutlib.api.IXmlPullParser;

+import com.android.sdklib.IAndroidTarget;

+

+import org.eclipse.core.resources.IFile;

+import org.eclipse.core.resources.IFolder;

+import org.eclipse.core.resources.IProject;

+import org.eclipse.core.resources.IResource;

+import org.eclipse.core.runtime.CoreException;

+import org.eclipse.core.runtime.IProgressMonitor;

+import org.eclipse.core.runtime.IStatus;

+import org.eclipse.core.runtime.Status;

+import org.eclipse.core.runtime.jobs.Job;

+import org.eclipse.draw2d.geometry.Rectangle;

+import org.eclipse.gef.ui.parts.SelectionSynchronizer;

+import org.eclipse.jface.dialogs.Dialog;

+import org.eclipse.swt.SWT;

+import org.eclipse.swt.custom.SashForm;

+import org.eclipse.swt.custom.StyledText;

+import org.eclipse.swt.dnd.Clipboard;

+import org.eclipse.swt.layout.GridData;

+import org.eclipse.swt.layout.GridLayout;

+import org.eclipse.swt.widgets.Composite;

+import org.eclipse.swt.widgets.Display;

+import org.eclipse.ui.IEditorInput;

+import org.eclipse.ui.IEditorSite;

+import org.eclipse.ui.PartInitException;

+import org.eclipse.ui.ide.IDE;

+import org.eclipse.ui.part.EditorPart;

+import org.eclipse.ui.part.FileEditorInput;

+

+import java.io.File;

+import java.io.FileOutputStream;

+import java.io.IOException;

+import java.io.InputStream;

+import java.io.PrintStream;

+import java.util.Map;

+

+/**

+ * Graphical layout editor part, version 2.

+ *

+ * @since GLE2

+ *

+ * TODO List:

+ * - display error icon

+ * - finish palette (see palette's todo list)

+ * - finish canvas (see canva's todo list)

+ * - completly rethink the property panel

+ * - link to the existing outline editor (prolly reuse/adapt for simplier model and will need

+ *   to adapt the selection synchronizer.)

+ */

+public class GraphicalEditorPart extends EditorPart implements IGraphicalLayoutEditor {

+

+    /*

+     * Useful notes:

+     * To understand Drag'n'drop:

+     *   http://www.eclipse.org/articles/Article-Workbench-DND/drag_drop.html

+     */

+

+    /** Reference to the layout editor */

+    private final LayoutEditor mLayoutEditor;

+

+    /** reference to the file being edited. */

+    private IFile mEditedFile;

+

+    /** The current clipboard. Must be disposed later. */

+    private Clipboard mClipboard;

+

+    /** The configuration composite at the top of the layout editor. */

+    private ConfigurationComposite mConfigComposite;

+

+    /** The sash that splits the palette from the canvas. */

+    private SashForm mSashPalette;

+    private SashForm mSashError;

+

+    /** The palette displayed on the left of the sash. */

+    private PaletteComposite mPalette;

+

+    /** The layout canvas displayed o the right of the sash. */

+    private LayoutCanvas mLayoutCanvas;

+

+    private StyledText mErrorLabel;

+

+    /** The {@link FolderConfiguration} being edited. */

+    private FolderConfiguration mEditedConfig;

+

+    private Map<String, Map<String, IResourceValue>> mConfiguredFrameworkRes;

+    private Map<String, Map<String, IResourceValue>> mConfiguredProjectRes;

+    private ProjectCallback mProjectCallback;

+    private ILayoutLog mLogger;

+

+    private boolean mNeedsXmlReload = false;

+    private boolean mNeedsRecompute = false;

+

+    private TargetListener mTargetListener;

+

+    private ConfigListener mConfigListener;

+

+    private ReloadListener mReloadListener;

+

+

+    public GraphicalEditorPart(LayoutEditor layoutEditor) {

+        mLayoutEditor = layoutEditor;

+        setPartName("Graphical Layout");

+    }

+

+    // ------------------------------------

+    // Methods overridden from base classes

+    //------------------------------------

+

+    /**

+     * Initializes the editor part with a site and input.

+     * {@inheritDoc}

+     */

+    @Override

+    public void init(IEditorSite site, IEditorInput input) throws PartInitException {

+        setSite(site);

+        useNewEditorInput(input);

+

+        if (mTargetListener == null) {

+            mTargetListener = new TargetListener();

+            AdtPlugin.getDefault().addTargetListener(mTargetListener);

+        }

+

+        if (mReloadListener == null) {

+            mReloadListener = new ReloadListener();

+            LayoutReloadMonitor.getMonitor().addListener(mEditedFile.getProject(), mReloadListener);

+        }

+    }

+

+    /**

+     * Reloads this editor, by getting the new model from the {@link LayoutEditor}.

+     */

+    public void reloadEditor() {

+        IEditorInput input = mLayoutEditor.getEditorInput();

+

+        try {

+            useNewEditorInput(input);

+        } catch (PartInitException e) {

+            // really this shouldn't happen! Log it in case it happens.

+            mEditedFile = null;

+            AdtPlugin.log(e, "Input is not of type FileEditorInput: %1$s",          //$NON-NLS-1$

+                    input == null ? "null" : input.toString());                     //$NON-NLS-1$

+        }

+    }

+

+    private void useNewEditorInput(IEditorInput input) throws PartInitException {

+        // The contract of init() mentions we need to fail if we can't understand the input.

+        if (!(input instanceof FileEditorInput)) {

+            throw new PartInitException("Input is not of type FileEditorInput: " +  //$NON-NLS-1$

+                    input == null ? "null" : input.toString());                     //$NON-NLS-1$

+        }

+

+        FileEditorInput fileInput = (FileEditorInput)input;

+        mEditedFile = fileInput.getFile();

+    }

+

+    @Override

+    public void createPartControl(Composite parent) {

+

+        Display d = parent.getDisplay();

+        mClipboard = new Clipboard(d);

+

+        GridLayout gl = new GridLayout(1, false);

+        parent.setLayout(gl);

+        gl.marginHeight = gl.marginWidth = 0;

+

+        // create the top part for the configuration control

+        mConfigListener = new ConfigListener();

+        mConfigComposite = new ConfigurationComposite(mConfigListener, parent, SWT.BORDER);

+        mConfigComposite.updateUIFromResources();

+

+        mSashPalette = new SashForm(parent, SWT.HORIZONTAL);

+        mSashPalette.setLayoutData(new GridData(GridData.FILL_BOTH));

+

+        mPalette = new PaletteComposite(mSashPalette);

+

+        mSashError = new SashForm(mSashPalette, SWT.VERTICAL | SWT.BORDER);

+        mSashError.setLayoutData(new GridData(GridData.FILL_BOTH));

+

+        mLayoutCanvas = new LayoutCanvas(mSashError, SWT.NONE);

+        mErrorLabel = new StyledText(mSashError, SWT.READ_ONLY);

+        mErrorLabel.setEditable(false);

+        mErrorLabel.setBackground(d.getSystemColor(SWT.COLOR_INFO_BACKGROUND));

+        mErrorLabel.setForeground(d.getSystemColor(SWT.COLOR_INFO_FOREGROUND));

+

+        mSashPalette.setWeights(new int[] { 20, 80 });

+        mSashError.setWeights(new int[] { 80, 20 });

+        mSashError.setMaximizedControl(mLayoutCanvas);

+

+        // Initialize the state

+        reloadPalette();

+    }

+

+    /**

+     * Switches the stack to display the error label and hide the canvas.

+     * @param errorFormat The new error to display if not null.

+     * @param parameters String.format parameters for the error format.

+     */

+    private void displayError(String errorFormat, Object...parameters) {

+        if (errorFormat != null) {

+            mErrorLabel.setText(String.format(errorFormat, parameters));

+        }

+        mSashError.setMaximizedControl(null);

+    }

+

+    /** Displays the canvas and hides the error label. */

+    private void hideError() {

+        mSashError.setMaximizedControl(mLayoutCanvas);

+    }

+

+    @Override

+    public void dispose() {

+        if (mTargetListener != null) {

+            AdtPlugin.getDefault().removeTargetListener(mTargetListener);

+            mTargetListener = null;

+        }

+

+        if (mReloadListener != null) {

+            LayoutReloadMonitor.getMonitor().removeListener(mReloadListener);

+            mReloadListener = null;

+        }

+

+        if (mClipboard != null) {

+            mClipboard.dispose();

+            mClipboard = null;

+        }

+

+        super.dispose();

+    }

+

+    /**

+     * Listens to changes from the Configuration UI banner and triggers layout rendering when

+     * changed. Also provide the Configuration UI with the list of resources/layout to display.

+     */

+    private class ConfigListener implements IConfigListener {

+

+        /**

+         * Looks for a file matching the new {@link FolderConfiguration} and attempts to open it.

+         * <p/>If there is no match, notify the user.

+         */

+        public void onConfigurationChange() {

+            mConfiguredFrameworkRes = mConfiguredProjectRes = null;

+

+            if (mEditedFile == null || mEditedConfig == null) {

+                return;

+            }

+

+            // get the resources of the file's project.

+            ProjectResources resources = ResourceManager.getInstance().getProjectResources(

+                    mEditedFile.getProject());

+

+            // from the resources, look for a matching file

+            ResourceFile match = null;

+            if (resources != null) {

+                match = resources.getMatchingFile(mEditedFile.getName(),

+                                                  ResourceFolderType.LAYOUT,

+                                                  mConfigComposite.getCurrentConfig());

+            }

+

+            if (match != null) {

+                if (match.getFile().equals(mEditedFile) == false) {

+                    try {

+                        IDE.openEditor(

+                                getSite().getWorkbenchWindow().getActivePage(),

+                                match.getFile().getIFile());

+

+                        // we're done!

+                        return;

+                    } catch (PartInitException e) {

+                        // FIXME: do something!

+                    }

+                }

+

+                // at this point, we have not opened a new file.

+

+                // update the configuration icons with the new edited config.

+                setConfiguration(mEditedConfig, false /*force*/);

+

+                // enable the create button if the current and edited config are not equals

+                mConfigComposite.setEnabledCreate(

+                        mEditedConfig.equals(mConfigComposite.getCurrentConfig()) == false);

+

+                // Even though the layout doesn't change, the config changed, and referenced

+                // resources need to be updated.

+                recomputeLayout();

+            } else {

+                // enable the Create button

+                mConfigComposite.setEnabledCreate(true);

+

+                // display the error.

+                FolderConfiguration currentConfig = mConfigComposite.getCurrentConfig();

+                displayError(

+                        "No resources match the configuration\n \n\t%1$s\n \nChange the configuration or create:\n \n\tres/%2$s/%3$s\n \nYou can also click the 'Create' button above.",

+                        currentConfig.toDisplayString(),

+                        currentConfig.getFolderName(ResourceFolderType.LAYOUT,

+                                Sdk.getCurrent().getTarget(mEditedFile.getProject())),

+                        mEditedFile.getName());

+            }

+        }

+

+        public void onThemeChange() {

+            recomputeLayout();

+        }

+

+        public void OnClippingChange() {

+            recomputeLayout();

+        }

+

+        public void onCreate() {

+            LayoutCreatorDialog dialog = new LayoutCreatorDialog(mConfigComposite.getShell(),

+                    mEditedFile.getName(),

+                    Sdk.getCurrent().getTarget(mEditedFile.getProject()),

+                    mConfigComposite.getCurrentConfig());

+            if (dialog.open() == Dialog.OK) {

+                final FolderConfiguration config = new FolderConfiguration();

+                dialog.getConfiguration(config);

+

+                createAlternateLayout(config);

+            }

+        }

+

+        public Map<String, Map<String, IResourceValue>> getConfiguredFrameworkResources() {

+            if (mConfiguredFrameworkRes == null && mConfigComposite != null) {

+                ProjectResources frameworkRes = getFrameworkResources();

+

+                if (frameworkRes == null) {

+                    AdtPlugin.log(IStatus.ERROR, "Failed to get ProjectResource for the framework");

+                } else {

+                    // get the framework resource values based on the current config

+                    mConfiguredFrameworkRes = frameworkRes.getConfiguredResources(

+                            mConfigComposite.getCurrentConfig());

+                }

+            }

+

+            return mConfiguredFrameworkRes;

+        }

+

+        public Map<String, Map<String, IResourceValue>> getConfiguredProjectResources() {

+            if (mConfiguredProjectRes == null && mConfigComposite != null) {

+                ProjectResources project = getProjectResources();

+

+                // make sure they are loaded

+                project.loadAll();

+

+                // get the project resource values based on the current config

+                mConfiguredProjectRes = project.getConfiguredResources(

+                        mConfigComposite.getCurrentConfig());

+            }

+

+            return mConfiguredProjectRes;

+        }

+

+        /**

+         * Returns a {@link ProjectResources} for the framework resources.

+         * @return the framework resources or null if not found.

+         */

+        public ProjectResources getFrameworkResources() {

+            if (mEditedFile != null) {

+                Sdk currentSdk = Sdk.getCurrent();

+                if (currentSdk != null) {

+                    IAndroidTarget target = currentSdk.getTarget(mEditedFile.getProject());

+

+                    if (target != null) {

+                        AndroidTargetData data = currentSdk.getTargetData(target);

+

+                        if (data != null) {

+                            return data.getFrameworkResources();

+                        }

+                    }

+                }

+            }

+

+            return null;

+        }

+

+        public ProjectResources getProjectResources() {

+            if (mEditedFile != null) {

+                ResourceManager manager = ResourceManager.getInstance();

+                return manager.getProjectResources(mEditedFile.getProject());

+            }

+

+            return null;

+        }

+

+        /**

+         * Creates a new layout file from the specified {@link FolderConfiguration}.

+         */

+        private void createAlternateLayout(final FolderConfiguration config) {

+            new Job("Create Alternate Resource") {

+                @Override

+                protected IStatus run(IProgressMonitor monitor) {

+                    // get the folder name

+                    String folderName = config.getFolderName(ResourceFolderType.LAYOUT,

+                            Sdk.getCurrent().getTarget(mEditedFile.getProject()));

+                    try {

+

+                        // look to see if it exists.

+                        // get the res folder

+                        IFolder res = (IFolder)mEditedFile.getParent().getParent();

+                        String path = res.getLocation().toOSString();

+

+                        File newLayoutFolder = new File(path + File.separator + folderName);

+                        if (newLayoutFolder.isFile()) {

+                            // this should not happen since aapt would have complained

+                            // before, but if one disable the automatic build, this could

+                            // happen.

+                            String message = String.format("File 'res/%1$s' is in the way!",

+                                    folderName);

+

+                            AdtPlugin.displayError("Layout Creation", message);

+

+                            return new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID, message);

+                        } else if (newLayoutFolder.exists() == false) {

+                            // create it.

+                            newLayoutFolder.mkdir();

+                        }

+

+                        // now create the file

+                        File newLayoutFile = new File(newLayoutFolder.getAbsolutePath() +

+                                    File.separator + mEditedFile.getName());

+

+                        newLayoutFile.createNewFile();

+

+                        InputStream input = mEditedFile.getContents();

+

+                        FileOutputStream fos = new FileOutputStream(newLayoutFile);

+

+                        byte[] data = new byte[512];

+                        int count;

+                        while ((count = input.read(data)) != -1) {

+                            fos.write(data, 0, count);

+                        }

+

+                        input.close();

+                        fos.close();

+

+                        // refreshes the res folder to show up the new

+                        // layout folder (if needed) and the file.

+                        // We use a progress monitor to catch the end of the refresh

+                        // to trigger the edit of the new file.

+                        res.refreshLocal(IResource.DEPTH_INFINITE, new IProgressMonitor() {

+                            public void done() {

+                                mConfigComposite.getDisplay().asyncExec(new Runnable() {

+                                    public void run() {

+                                        onConfigurationChange();

+                                    }

+                                });

+                            }

+

+                            public void beginTask(String name, int totalWork) {

+                                // pass

+                            }

+

+                            public void internalWorked(double work) {

+                                // pass

+                            }

+

+                            public boolean isCanceled() {

+                                // pass

+                                return false;

+                            }

+

+                            public void setCanceled(boolean value) {

+                                // pass

+                            }

+

+                            public void setTaskName(String name) {

+                                // pass

+                            }

+

+                            public void subTask(String name) {

+                                // pass

+                            }

+

+                            public void worked(int work) {

+                                // pass

+                            }

+                        });

+                    } catch (IOException e2) {

+                        String message = String.format(

+                                "Failed to create File 'res/%1$s/%2$s' : %3$s",

+                                folderName, mEditedFile.getName(), e2.getMessage());

+

+                        AdtPlugin.displayError("Layout Creation", message);

+

+                        return new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID,

+                                message, e2);

+                    } catch (CoreException e2) {

+                        String message = String.format(

+                                "Failed to create File 'res/%1$s/%2$s' : %3$s",

+                                folderName, mEditedFile.getName(), e2.getMessage());

+

+                        AdtPlugin.displayError("Layout Creation", message);

+

+                        return e2.getStatus();

+                    }

+

+                    return Status.OK_STATUS;

+

+                }

+            }.schedule();

+        }

+    }

+

+    /**

+     * Listens to target changed in the current project, to trigger a new layout rendering.

+     */

+    private class TargetListener implements ITargetChangeListener {

+

+        public void onProjectTargetChange(IProject changedProject) {

+            if (changedProject == getLayoutEditor().getProject()) {

+                onTargetsLoaded();

+            }

+        }

+

+        public void onTargetsLoaded() {

+            // because the SDK changed we must reset the configured framework resource.

+            mConfiguredFrameworkRes = null;

+

+            mConfigComposite.updateUIFromResources();

+

+            // updateUiFromFramework will reset language/region combo, so we must call

+            // setConfiguration after, or the settext on language/region will be lost.

+            if (mEditedConfig != null) {

+                setConfiguration(mEditedConfig, false /*force*/);

+            }

+

+            // make sure we remove the custom view loader, since its parent class loader is the

+            // bridge class loader.

+            mProjectCallback = null;

+

+            recomputeLayout();

+        }

+    }

+

+    /**

+     * Update the UI controls state with a given {@link FolderConfiguration}.

+     * <p/>If <var>force</var> is set to <code>true</code> the UI will be changed to exactly reflect

+     * <var>config</var>, otherwise, if a qualifier is not present in <var>config</var>,

+     * the UI control is not modified. However if the value in the control is not the default value,

+     * a warning icon is shown.

+     * @param config The {@link FolderConfiguration} to set.

+     * @param force Whether the UI should be changed to exactly match the received configuration.

+     */

+    void setConfiguration(FolderConfiguration config, boolean force) {

+        mEditedConfig = config;

+        mConfiguredFrameworkRes = mConfiguredProjectRes = null;

+

+        mConfigComposite.setConfiguration(config, force);

+

+    }

+

+    // ----------------

+

+    /**

+     * Save operation in the Graphical Editor Part.

+     * <p/>

+     * In our workflow, the model is owned by the Structured XML Editor.

+     * The graphical layout editor just displays it -- thus we don't really

+     * save anything here.

+     * <p/>

+     * This must NOT call the parent editor part. At the contrary, the parent editor

+     * part will call this *after* having done the actual save operation.

+     * <p/>

+     * The only action this editor must do is mark the undo command stack as

+     * being no longer dirty.

+     */

+    @Override

+    public void doSave(IProgressMonitor monitor) {

+        // TODO implement a command stack

+//        getCommandStack().markSaveLocation();

+//        firePropertyChange(PROP_DIRTY);

+    }

+

+    /**

+     * Save operation in the Graphical Editor Part.

+     * <p/>

+     * In our workflow, the model is owned by the Structured XML Editor.

+     * The graphical layout editor just displays it -- thus we don't really

+     * save anything here.

+     */

+    @Override

+    public void doSaveAs() {

+        // pass

+    }

+

+    /**

+     * In our workflow, the model is owned by the Structured XML Editor.

+     * The graphical layout editor just displays it -- thus we don't really

+     * save anything here.

+     */

+    @Override

+    public boolean isDirty() {

+        return false;

+    }

+

+    /**

+     * In our workflow, the model is owned by the Structured XML Editor.

+     * The graphical layout editor just displays it -- thus we don't really

+     * save anything here.

+     */

+    @Override

+    public boolean isSaveAsAllowed() {

+        return false;

+    }

+

+    @Override

+    public void setFocus() {

+        // TODO Auto-generated method stub

+

+    }

+

+    /**

+     * Responds to a page change that made the Graphical editor page the activated page.

+     */

+    public void activated() {

+        if (mNeedsRecompute || mNeedsXmlReload) {

+            recomputeLayout();

+        }

+    }

+

+    /**

+     * Responds to a page change that made the Graphical editor page the deactivated page

+     */

+    public void deactivated() {

+        // nothing to be done here for now.

+    }

+

+    /**

+     * Sets the UI for the edition of a new file.

+     * @param configuration the configuration of the new file.

+     */

+    public void editNewFile(FolderConfiguration configuration) {

+        // update the configuration UI

+        setConfiguration(configuration, true /*force*/);

+

+        // enable the create button if the current and edited config are not equals

+        mConfigComposite.setEnabledCreate(

+                mEditedConfig.equals(mConfigComposite.getCurrentConfig()) == false);

+

+        reloadConfigurationUi(false /*notifyListener*/);

+    }

+

+    public Clipboard getClipboard() {

+        return mClipboard;

+    }

+

+    public LayoutEditor getLayoutEditor() {

+        return mLayoutEditor;

+    }

+

+    public UiDocumentNode getModel() {

+        return mLayoutEditor.getUiRootNode();

+    }

+

+    public SelectionSynchronizer getSelectionSynchronizer() {

+        // TODO Auto-generated method stub

+        return null;

+    }

+

+    /**

+     * Callback for XML model changed. Only update/recompute the layout if the editor is visible

+     */

+    public void onXmlModelChanged() {

+        if (mLayoutEditor.isGraphicalEditorActive()) {

+            doXmlReload(true /* force */);

+            recomputeLayout();

+        } else {

+            mNeedsXmlReload = true;

+        }

+    }

+

+    /**

+     * Actually performs the XML reload

+     * @see #onXmlModelChanged()

+     */

+    private void doXmlReload(boolean force) {

+        if (force || mNeedsXmlReload) {

+

+            // TODO : update the mLayoutCanvas, preserving the current selection if possible.

+

+//            GraphicalViewer viewer = getGraphicalViewer();

+//

+//            // try to preserve the selection before changing the content

+//            SelectionManager selMan = viewer.getSelectionManager();

+//            ISelection selection = selMan.getSelection();

+//

+//            try {

+//                viewer.setContents(getModel());

+//            } finally {

+//                selMan.setSelection(selection);

+//            }

+

+            mNeedsXmlReload = false;

+        }

+    }

+

+    public void recomputeLayout() {

+        doXmlReload(false /* force */);

+        try {

+            // check that the resource exists. If the file is opened but the project is closed

+            // or deleted for some reason (changed from outside of eclipse), then this will

+            // return false;

+            if (mEditedFile.exists() == false) {

+                displayError("Resource '%1$s' does not exist.",

+                             mEditedFile.getFullPath().toString());

+                return;

+            }

+

+            IProject iProject = mEditedFile.getProject();

+

+            if (mEditedFile.isSynchronized(IResource.DEPTH_ZERO) == false) {

+                String message = String.format("%1$s is out of sync. Please refresh.",

+                        mEditedFile.getName());

+

+                displayError(message);

+

+                // also print it in the error console.

+                AdtPlugin.printErrorToConsole(iProject.getName(), message);

+                return;

+            }

+

+            Sdk currentSdk = Sdk.getCurrent();

+            if (currentSdk != null) {

+                IAndroidTarget target = currentSdk.getTarget(mEditedFile.getProject());

+                if (target == null) {

+                    displayError("The project target is not set.");

+                    return;

+                }

+

+                AndroidTargetData data = currentSdk.getTargetData(target);

+                if (data == null) {

+                    // It can happen that the workspace refreshes while the SDK is loading its

+                    // data, which could trigger a redraw of the opened layout if some resources

+                    // changed while Eclipse is closed.

+                    // In this case data could be null, but this is not an error.

+                    // We can just silently return, as all the opened editors are automatically

+                    // refreshed once the SDK finishes loading.

+                    if (AdtPlugin.getDefault().getSdkLoadStatus() != LoadStatus.LOADING) {

+                        displayError("The project target (%s) was not properly loaded.",

+                                     target.getName());

+                    }

+                    return;

+                }

+

+                // check there is actually a model (maybe the file is empty).

+                UiDocumentNode model = getModel();

+

+                if (model.getUiChildren().size() == 0) {

+                    displayError("No Xml content. Go to the Outline view and add nodes.");

+                    return;

+                }

+

+                LayoutBridge bridge = data.getLayoutBridge();

+

+                if (bridge.bridge != null) { // bridge can never be null.

+                    ResourceManager resManager = ResourceManager.getInstance();

+

+                    ProjectResources projectRes = resManager.getProjectResources(iProject);

+                    if (projectRes == null) {

+                        displayError("Missing project resources.");

+                        return;

+                    }

+

+                    // get the resources of the file's project.

+                    Map<String, Map<String, IResourceValue>> configuredProjectRes =

+                        mConfigListener.getConfiguredProjectResources();

+

+                    // get the framework resources

+                    Map<String, Map<String, IResourceValue>> frameworkResources =

+                        mConfigListener.getConfiguredFrameworkResources();

+

+                    if (configuredProjectRes != null && frameworkResources != null) {

+                        if (mProjectCallback == null) {

+                            mProjectCallback = new ProjectCallback(

+                                    bridge.classLoader, projectRes, iProject);

+                        }

+

+                        if (mLogger == null) {

+                            mLogger = new ILayoutLog() {

+                                public void error(String message) {

+                                    AdtPlugin.printErrorToConsole(mEditedFile.getName(), message);

+                                }

+

+                                public void error(Throwable error) {

+                                    String message = error.getMessage();

+                                    if (message == null) {

+                                        message = error.getClass().getName();

+                                    }

+

+                                    PrintStream ps = new PrintStream(AdtPlugin.getErrorStream());

+                                    error.printStackTrace(ps);

+                                }

+

+                                public void warning(String message) {

+                                    AdtPlugin.printToConsole(mEditedFile.getName(), message);

+                                }

+                            };

+                        }

+

+                        // get the selected theme

+                        String theme = mConfigComposite.getTheme();

+                        if (theme != null) {

+

+                            // Compute the layout

+                            UiElementPullParser parser = new UiElementPullParser(getModel());

+                            Rectangle rect = getBounds();

+                            boolean isProjectTheme = mConfigComposite.isProjectTheme();

+

+                            int density = mConfigComposite.getDensity().getDpiValue();

+                            float xdpi = mConfigComposite.getXDpi();

+                            float ydpi = mConfigComposite.getYDpi();

+

+                            ILayoutResult result = computeLayout(bridge, parser,

+                                    iProject /* projectKey */,

+                                    rect.width, rect.height, !mConfigComposite.getClipping(),

+                                    density, xdpi, ydpi,

+                                    theme, isProjectTheme,

+                                    configuredProjectRes, frameworkResources, mProjectCallback,

+                                    mLogger);

+

+                            mLayoutCanvas.setResult(result);

+

+                            // update the UiElementNode with the layout info.

+                            if (result.getSuccess() == ILayoutResult.SUCCESS) {

+                                hideError();

+                            } else {

+                                displayError(result.getErrorMessage());

+                            }

+

+                            model.refreshUi();

+                        }

+                    }

+                } else {

+                    // SDK is loaded but not the layout library!

+

+                    // check whether the bridge managed to load, or not

+                    if (bridge.status == LoadStatus.LOADING) {

+                        displayError("Eclipse is loading framework information and the layout library from the SDK folder.\n%1$s will refresh automatically once the process is finished.",

+                                     mEditedFile.getName());

+                    } else {

+                        displayError("Eclipse failed to load the framework information and the layout library!");

+                    }

+                }

+            } else {

+                displayError("Eclipse is loading the SDK.\n%1$s will refresh automatically once the process is finished.",

+                             mEditedFile.getName());

+            }

+        } finally {

+            // no matter the result, we are done doing the recompute based on the latest

+            // resource/code change.

+            mNeedsRecompute = false;

+        }

+    }

+

+    /**

+     * Computes a layout by calling the correct computeLayout method of ILayoutBridge based on

+     * the implementation API level.

+     *

+     * Implementation detail: the bridge's computeLayout() method already returns a newly

+     * allocated ILayourResult.

+     */

+    @SuppressWarnings("deprecation")

+    private static ILayoutResult computeLayout(LayoutBridge bridge,

+            IXmlPullParser layoutDescription, Object projectKey,

+            int screenWidth, int screenHeight, boolean renderFullSize,

+            int density, float xdpi, float ydpi,

+            String themeName, boolean isProjectTheme,

+            Map<String, Map<String, IResourceValue>> projectResources,

+            Map<String, Map<String, IResourceValue>> frameworkResources,

+            IProjectCallback projectCallback, ILayoutLog logger) {

+

+        if (bridge.apiLevel >= ILayoutBridge.API_CURRENT) {

+            // newest API with support for "render full height"

+            // TODO: link boolean to UI.

+            return bridge.bridge.computeLayout(layoutDescription,

+                    projectKey, screenWidth, screenHeight, renderFullSize,

+                    density, xdpi, ydpi,

+                    themeName, isProjectTheme,

+                    projectResources, frameworkResources, projectCallback,

+                    logger);

+        } else if (bridge.apiLevel == 3) {

+            // newer api with density support.

+            return bridge.bridge.computeLayout(layoutDescription,

+                    projectKey, screenWidth, screenHeight, density, xdpi, ydpi,

+                    themeName, isProjectTheme,

+                    projectResources, frameworkResources, projectCallback,

+                    logger);

+        } else if (bridge.apiLevel == 2) {

+            // api with boolean for separation of project/framework theme

+            return bridge.bridge.computeLayout(layoutDescription,

+                    projectKey, screenWidth, screenHeight, themeName, isProjectTheme,

+                    projectResources, frameworkResources, projectCallback,

+                    logger);

+        } else {

+            // oldest api with no density/dpi, and project theme boolean mixed

+            // into the theme name.

+

+            // change the string if it's a custom theme to make sure we can

+            // differentiate them

+            if (isProjectTheme) {

+                themeName = "*" + themeName; //$NON-NLS-1$

+            }

+

+            return bridge.bridge.computeLayout(layoutDescription,

+                    projectKey, screenWidth, screenHeight, themeName,

+                    projectResources, frameworkResources, projectCallback,

+                    logger);

+        }

+    }

+

+    public Rectangle getBounds() {

+        return mConfigComposite.getScreenBounds();

+    }

+

+    public void reloadPalette() {

+        if (mPalette != null) {

+            mPalette.reloadPalette(mLayoutEditor.getTargetData());

+        }

+    }

+

+    public void reloadConfigurationUi(boolean notifyListener) {

+        // enable the clipping button if it's supported.

+        Sdk currentSdk = Sdk.getCurrent();

+        if (currentSdk != null) {

+            IAndroidTarget target = currentSdk.getTarget(mEditedFile.getProject());

+            AndroidTargetData data = currentSdk.getTargetData(target);

+            if (data != null) {

+                LayoutBridge bridge = data.getLayoutBridge();

+                mConfigComposite.reloadDevices(notifyListener);

+                mConfigComposite.setClippingSupport(bridge.apiLevel >= 4);

+            }

+        }

+    }

+

+    /**

+     * Used by LayoutEditor.UiEditorActions.selectUiNode to select a new UI Node

+     * created by {@link ElementCreateCommand#execute()}.

+     *

+     * @param uiNodeModel The {@link UiElementNode} to select.

+     */

+    public void selectModel(UiElementNode uiNodeModel) {

+

+        // TODO this method was useful for GLE1. We may not need it anymore now.

+

+//        GraphicalViewer viewer = getGraphicalViewer();

+//

+//        // Give focus to the graphical viewer (in case the outline has it)

+//        viewer.getControl().forceFocus();

+//

+//        Object editPart = viewer.getEditPartRegistry().get(uiNodeModel);

+//

+//        if (editPart instanceof EditPart) {

+//            viewer.select((EditPart)editPart);

+//        }

+    }

+

+    private class ReloadListener implements ILayoutReloadListener {

+        /*

+         * (non-Javadoc)

+         * @see com.android.ide.eclipse.editors.layout.LayoutReloadMonitor.ILayoutReloadListener#reloadLayout(boolean, boolean, boolean)

+         *

+         * Called when the file changes triggered a redraw of the layout

+         */

+        public void reloadLayout(boolean codeChange, boolean rChange, boolean resChange) {

+            boolean recompute = rChange;

+

+            if (resChange) {

+                recompute = true;

+

+                // TODO: differentiate between single and multi resource file changed, and whether the resource change affects the cache.

+

+                // force a reparse in case a value XML file changed.

+                mConfiguredProjectRes = null;

+

+                // clear the cache in the bridge in case a bitmap/9-patch changed.

+                IAndroidTarget target = Sdk.getCurrent().getTarget(mEditedFile.getProject());

+                if (target != null) {

+

+                    AndroidTargetData data = Sdk.getCurrent().getTargetData(target);

+                    if (data != null) {

+                        LayoutBridge bridge = data.getLayoutBridge();

+

+                        if (bridge.bridge != null) {

+                            bridge.bridge.clearCaches(mEditedFile.getProject());

+                        }

+                    }

+                }

+

+                mLayoutCanvas.getDisplay().asyncExec(new Runnable() {

+                    public void run() {

+                        mConfigComposite.updateUIFromResources();

+                    }

+                });

+            }

+

+            if (codeChange) {

+                // only recompute if the custom view loader was used to load some code.

+                if (mProjectCallback != null && mProjectCallback.isUsed()) {

+                    mProjectCallback = null;

+                    recompute = true;

+                }

+            }

+

+            if (recompute) {

+                mLayoutCanvas.getDisplay().asyncExec(new Runnable() {

+                    public void run() {

+                        if (mLayoutEditor.isGraphicalEditorActive()) {

+                            recomputeLayout();

+                        } else {

+                            mNeedsRecompute = true;

+                        }

+                    }

+                });

+            }

+        }

+    }

+}

diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/GraphicalLayoutEditor.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/GraphicalLayoutEditor.java
index 225d5bd..1d9054c 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/GraphicalLayoutEditor.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/GraphicalLayoutEditor.java
@@ -20,6 +20,9 @@
 import com.android.ide.eclipse.adt.internal.editors.IconFactory;
 import com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor.UiEditorActions;
 import com.android.ide.eclipse.adt.internal.editors.layout.LayoutReloadMonitor.ILayoutReloadListener;
+import com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite;
+import com.android.ide.eclipse.adt.internal.editors.layout.configuration.LayoutCreatorDialog;
+import com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.IConfigListener;
 import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.ViewElementDescriptor;
 import com.android.ide.eclipse.adt.internal.editors.layout.parts.ElementCreateCommand;
 import com.android.ide.eclipse.adt.internal.editors.layout.parts.UiElementEditPart;
@@ -28,25 +31,7 @@
 import com.android.ide.eclipse.adt.internal.editors.ui.tree.PasteAction;
 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiDocumentNode;
 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
-import com.android.ide.eclipse.adt.internal.resources.ResourceType;
-import com.android.ide.eclipse.adt.internal.resources.configurations.CountryCodeQualifier;
 import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.KeyboardStateQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.LanguageQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.NavigationMethodQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.NetworkCodeQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.RegionQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenDimensionQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenOrientationQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.TextInputMethodQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.TouchScreenQualifier;
-import com.android.ide.eclipse.adt.internal.resources.configurations.KeyboardStateQualifier.KeyboardState;
-import com.android.ide.eclipse.adt.internal.resources.configurations.NavigationMethodQualifier.NavigationMethod;
-import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier.Density;
-import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenOrientationQualifier.ScreenOrientation;
-import com.android.ide.eclipse.adt.internal.resources.configurations.TextInputMethodQualifier.TextInputMethod;
-import com.android.ide.eclipse.adt.internal.resources.configurations.TouchScreenQualifier.TouchScreenType;
 import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources;
 import com.android.ide.eclipse.adt.internal.resources.manager.ResourceFile;
 import com.android.ide.eclipse.adt.internal.resources.manager.ResourceFolderType;
@@ -56,14 +41,11 @@
 import com.android.ide.eclipse.adt.internal.sdk.Sdk;
 import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData.LayoutBridge;
 import com.android.ide.eclipse.adt.internal.sdk.Sdk.ITargetChangeListener;
-import com.android.ide.eclipse.adt.internal.ui.ConfigurationSelector.DimensionVerifier;
-import com.android.ide.eclipse.adt.internal.ui.ConfigurationSelector.LanguageRegionVerifier;
-import com.android.ide.eclipse.adt.internal.ui.ConfigurationSelector.MobileCodeVerifier;
+import com.android.layoutlib.api.ILayoutBridge;
 import com.android.layoutlib.api.ILayoutLog;
 import com.android.layoutlib.api.ILayoutResult;
 import com.android.layoutlib.api.IProjectCallback;
 import com.android.layoutlib.api.IResourceValue;
-import com.android.layoutlib.api.IStyleResourceValue;
 import com.android.layoutlib.api.IXmlPullParser;
 import com.android.layoutlib.api.ILayoutResult.ILayoutViewInfo;
 import com.android.sdklib.IAndroidTarget;
@@ -88,6 +70,8 @@
 import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
 import org.eclipse.gef.palette.PaletteRoot;
 import org.eclipse.gef.requests.CreationFactory;
+import org.eclipse.gef.ui.parts.GraphicalEditorWithPalette;
+import org.eclipse.gef.ui.parts.SelectionSynchronizer;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.jface.action.IMenuManager;
@@ -97,22 +81,12 @@
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.ImageData;
 import org.eclipse.swt.graphics.PaletteData;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.ide.IDE;
@@ -127,12 +101,9 @@
 import java.io.InputStream;
 import java.io.PrintStream;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 /**
  * Graphical layout editor, based on GEF.
@@ -140,11 +111,12 @@
  * To understand GEF: http://www.ibm.com/developerworks/opensource/library/os-gef/
  * <p/>
  * To understand Drag'n'drop: http://www.eclipse.org/articles/Article-Workbench-DND/drag_drop.html
+ *
+ * @since GLE1
  */
-public class GraphicalLayoutEditor extends AbstractGraphicalLayoutEditor
-        implements ILayoutReloadListener {
+public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
+        implements IGraphicalLayoutEditor, IConfigListener, ILayoutReloadListener {
 
-    private final static String THEME_SEPARATOR = "----------"; //$NON-NLS-1$
 
     /** Reference to the layout editor */
     private final LayoutEditor mLayoutEditor;
@@ -154,43 +126,10 @@
 
     private Clipboard mClipboard;
     private Composite mParent;
+    private ConfigurationComposite mConfigComposite;
+
     private PaletteRoot mPaletteRoot;
 
-    private Text mCountry;
-    private Text mNetwork;
-    private Combo mLanguage;
-    private Combo mRegion;
-    private Combo mOrientation;
-    private Combo mDensity;
-    private Combo mTouch;
-    private Combo mKeyboard;
-    private Combo mTextInput;
-    private Combo mNavigation;
-    private Text mSize1;
-    private Text mSize2;
-    private Combo mThemeCombo;
-    private Button mCreateButton;
-
-    private Label mCountryIcon;
-    private Label mNetworkIcon;
-    private Label mLanguageIcon;
-    private Label mRegionIcon;
-    private Label mOrientationIcon;
-    private Label mDensityIcon;
-    private Label mTouchIcon;
-    private Label mKeyboardIcon;
-    private Label mTextInputIcon;
-    private Label mNavigationIcon;
-    private Label mSizeIcon;
-
-    private Label mCurrentLayoutLabel;
-
-    private Image mWarningImage;
-    private Image mMatchImage;
-    private Image mErrorImage;
-
-    /** The {@link FolderConfiguration} representing the state of the UI controls */
-    private FolderConfiguration mCurrentConfig = new FolderConfiguration();
     /** The {@link FolderConfiguration} being edited. */
     private FolderConfiguration mEditedConfig;
 
@@ -201,8 +140,6 @@
 
     private boolean mNeedsXmlReload = false;
     private boolean mNeedsRecompute = false;
-    private int mPlatformThemeCount = 0;
-    private boolean mDisableUpdates = false;
 
     /** Listener to update the root node if the target of the file is changed because of a
      * SDK location change or a project target change */
@@ -217,9 +154,7 @@
             // because the SDK changed we must reset the configured framework resource.
             mConfiguredFrameworkRes = null;
 
-            updateUIFromResources();
-
-            mThemeCombo.getParent().layout();
+            mConfigComposite.updateUIFromResources();
 
             // updateUiFromFramework will reset language/region combo, so we must call
             // setConfiguration after, or the settext on language/region will be lost.
@@ -247,21 +182,16 @@
 
     private final Runnable mUiUpdateFromResourcesRunnable = new Runnable() {
         public void run() {
-            updateUIFromResources();
-            mThemeCombo.getParent().layout();
+            mConfigComposite.updateUIFromResources();
         }
     };
 
+
     public GraphicalLayoutEditor(LayoutEditor layoutEditor) {
         mLayoutEditor = layoutEditor;
         setEditDomain(new DefaultEditDomain(this));
         setPartName("Layout");
 
-        IconFactory factory = IconFactory.getInstance();
-        mWarningImage = factory.getIcon("warning"); //$NON-NLS-1$
-        mMatchImage = factory.getIcon("match"); //$NON-NLS-1$
-        mErrorImage = factory.getIcon("error"); //$NON-NLS-1$
-
         AdtPlugin.getDefault().addTargetListener(mTargetListener);
     }
 
@@ -273,7 +203,6 @@
     public void createPartControl(Composite parent) {
         mParent = parent;
         GridLayout gl;
-        GridData gd;
 
         mClipboard = new Clipboard(parent.getDisplay());
 
@@ -281,286 +210,7 @@
         gl.marginHeight = gl.marginWidth = 0;
 
         // create the top part for the configuration control
-        int cols = 10;
-
-        Composite topParent = new Composite(parent, SWT.NONE);
-        topParent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-        topParent.setLayout(gl = new GridLayout(cols, false));
-
-        new Label(topParent, SWT.NONE).setText("MCC");
-        mCountryIcon = createControlComposite(topParent, true /* grab_horizontal */);
-        mCountry = new Text(mCountryIcon.getParent(), SWT.BORDER);
-        mCountry.setLayoutData(new GridData(
-                GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-        mCountry.addVerifyListener(new MobileCodeVerifier());
-        mCountry.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetDefaultSelected(SelectionEvent e) {
-                onCountryCodeChange();
-            }
-        });
-        mCountry.addModifyListener(new ModifyListener() {
-            public void modifyText(ModifyEvent e) {
-                onCountryCodeChange();
-            }
-        });
-
-        new Label(topParent, SWT.NONE).setText("MNC");
-        mNetworkIcon = createControlComposite(topParent, true /* grab_horizontal */);
-        mNetwork = new Text(mNetworkIcon.getParent(), SWT.BORDER);
-        mNetwork.setLayoutData(new GridData(
-                GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-        mNetwork.addVerifyListener(new MobileCodeVerifier());
-        mNetwork.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetDefaultSelected(SelectionEvent e) {
-                onNetworkCodeChange();
-            }
-        });
-        mNetwork.addModifyListener(new ModifyListener() {
-            public void modifyText(ModifyEvent e) {
-                onNetworkCodeChange();
-            }
-        });
-
-        new Label(topParent, SWT.NONE).setText("Lang");
-        mLanguageIcon = createControlComposite(topParent, true /* grab_horizontal */);
-        mLanguage = new Combo(mLanguageIcon.getParent(), SWT.DROP_DOWN);
-        mLanguage.setLayoutData(new GridData(
-                GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-        mLanguage.addVerifyListener(new LanguageRegionVerifier());
-        mLanguage.addSelectionListener(new SelectionListener() {
-            public void widgetDefaultSelected(SelectionEvent e) {
-                onLanguageChange();
-            }
-            public void widgetSelected(SelectionEvent e) {
-                onLanguageChange();
-            }
-        });
-        mLanguage.addModifyListener(new ModifyListener() {
-            public void modifyText(ModifyEvent e) {
-                onLanguageChange();
-            }
-        });
-
-        new Label(topParent, SWT.NONE).setText("Region");
-        mRegionIcon = createControlComposite(topParent, true /* grab_horizontal */);
-        mRegion = new Combo(mRegionIcon.getParent(), SWT.DROP_DOWN);
-        mRegion.setLayoutData(new GridData(
-                GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-        mRegion.addVerifyListener(new LanguageRegionVerifier());
-        mRegion.addSelectionListener(new SelectionListener() {
-            public void widgetDefaultSelected(SelectionEvent e) {
-                onRegionChange();
-            }
-            public void widgetSelected(SelectionEvent e) {
-                onRegionChange();
-            }
-        });
-        mRegion.addModifyListener(new ModifyListener() {
-            public void modifyText(ModifyEvent e) {
-                onRegionChange();
-            }
-        });
-
-        new Label(topParent, SWT.NONE).setText("Orient");
-        mOrientationIcon = createControlComposite(topParent, true /* grab_horizontal */);
-        mOrientation = new Combo(mOrientationIcon.getParent(), SWT.DROP_DOWN | SWT.READ_ONLY);
-        ScreenOrientation[] soValues = ScreenOrientation.values();
-        mOrientation.add("(Default)");
-        for (ScreenOrientation value : soValues) {
-            mOrientation.add(value.getDisplayValue());
-        }
-        mOrientation.select(0);
-        mOrientation.setLayoutData(new GridData(
-                GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-        mOrientation.addSelectionListener(new SelectionAdapter() {
-           @Override
-            public void widgetSelected(SelectionEvent e) {
-               onOrientationChange();
-            }
-        });
-
-        new Label(topParent, SWT.NONE).setText("Density");
-        mDensityIcon = createControlComposite(topParent, true /* grab_horizontal */);
-        mDensity = new Combo(mDensityIcon.getParent(), SWT.DROP_DOWN | SWT.READ_ONLY);
-        Density[] dValues = Density.values();
-        mDensity.add("(Default)");
-        for (Density value : dValues) {
-            mDensity.add(value.getDisplayValue());
-        }
-        mDensity.select(0);
-        mDensity.setLayoutData(new GridData(
-                GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-        mDensity.addSelectionListener(new SelectionAdapter() {
-           @Override
-            public void widgetSelected(SelectionEvent e) {
-               onDensityChange();
-            }
-        });
-
-        new Label(topParent, SWT.NONE).setText("Touch");
-        mTouchIcon = createControlComposite(topParent, true /* grab_horizontal */);
-        mTouch = new Combo(mTouchIcon.getParent(), SWT.DROP_DOWN | SWT.READ_ONLY);
-        TouchScreenType[] tstValues = TouchScreenType.values();
-        mTouch.add("(Default)");
-        for (TouchScreenType value : tstValues) {
-            mTouch.add(value.getDisplayValue());
-        }
-        mTouch.select(0);
-        mTouch.setLayoutData(new GridData(
-                GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-        mTouch.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                onTouchChange();
-            }
-        });
-
-        new Label(topParent, SWT.NONE).setText("Keybrd");
-        mKeyboardIcon = createControlComposite(topParent, true /* grab_horizontal */);
-        mKeyboard = new Combo(mKeyboardIcon.getParent(), SWT.DROP_DOWN | SWT.READ_ONLY);
-        KeyboardState[] ksValues = KeyboardState.values();
-        mKeyboard.add("(Default)");
-        for (KeyboardState value : ksValues) {
-            mKeyboard.add(value.getDisplayValue());
-        }
-        mKeyboard.select(0);
-        mKeyboard.setLayoutData(new GridData(
-                GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-        mKeyboard.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                onKeyboardChange();
-            }
-        });
-
-        new Label(topParent, SWT.NONE).setText("Input");
-        mTextInputIcon = createControlComposite(topParent, true /* grab_horizontal */);
-        mTextInput = new Combo(mTextInputIcon.getParent(), SWT.DROP_DOWN | SWT.READ_ONLY);
-        TextInputMethod[] timValues = TextInputMethod.values();
-        mTextInput.add("(Default)");
-        for (TextInputMethod value : timValues) {
-            mTextInput.add(value.getDisplayValue());
-        }
-        mTextInput.select(0);
-        mTextInput.setLayoutData(new GridData(
-                GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-        mTextInput.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                onTextInputChange();
-            }
-        });
-
-        new Label(topParent, SWT.NONE).setText("Nav");
-        mNavigationIcon = createControlComposite(topParent, true /* grab_horizontal */);
-        mNavigation = new Combo(mNavigationIcon.getParent(), SWT.DROP_DOWN | SWT.READ_ONLY);
-        NavigationMethod[] nValues = NavigationMethod.values();
-        mNavigation.add("(Default)");
-        for (NavigationMethod value : nValues) {
-            mNavigation.add(value.getDisplayValue());
-        }
-        mNavigation.select(0);
-        mNavigation.setLayoutData(new GridData(
-                GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-        mNavigation.addSelectionListener(new SelectionAdapter() {
-            @Override
-             public void widgetSelected(SelectionEvent e) {
-                onNavigationChange();
-            }
-        });
-
-        Composite labelParent = new Composite(topParent, SWT.NONE);
-        labelParent.setLayout(gl = new GridLayout(8, false));
-        gl.marginWidth = gl.marginHeight = 0;
-        labelParent.setLayoutData(gd = new GridData(GridData.FILL_HORIZONTAL));
-        gd.horizontalSpan = cols;
-
-        new Label(labelParent, SWT.NONE).setText("Editing config:");
-        mCurrentLayoutLabel = new Label(labelParent, SWT.NONE);
-        mCurrentLayoutLabel.setLayoutData(gd = new GridData(GridData.FILL_HORIZONTAL));
-        gd.widthHint = 50;
-
-        new Label(labelParent, SWT.NONE).setText("Size");
-        mSizeIcon = createControlComposite(labelParent, false);
-        Composite sizeParent = new Composite(mSizeIcon.getParent(), SWT.NONE);
-        sizeParent.setLayout(gl = new GridLayout(3, false));
-        gl.marginWidth = gl.marginHeight = 0;
-        gl.horizontalSpacing = 0;
-
-        mSize1 = new Text(sizeParent, SWT.BORDER);
-        mSize1.setLayoutData(gd = new GridData());
-        gd.widthHint = 30;
-        new Label(sizeParent, SWT.NONE).setText("x");
-        mSize2 = new Text(sizeParent, SWT.BORDER);
-        mSize2.setLayoutData(gd = new GridData());
-        gd.widthHint = 30;
-
-        DimensionVerifier verifier = new DimensionVerifier();
-        mSize1.addVerifyListener(verifier);
-        mSize2.addVerifyListener(verifier);
-
-        SelectionListener sl = new SelectionListener() {
-            public void widgetDefaultSelected(SelectionEvent e) {
-                onSizeChange();
-            }
-            public void widgetSelected(SelectionEvent e) {
-                onSizeChange();
-            }
-        };
-
-        mSize1.addSelectionListener(sl);
-        mSize2.addSelectionListener(sl);
-
-        ModifyListener sizeModifyListener = new ModifyListener() {
-            public void modifyText(ModifyEvent e) {
-                onSizeChange();
-            }
-        };
-
-        mSize1.addModifyListener(sizeModifyListener);
-        mSize2.addModifyListener(sizeModifyListener);
-
-        // first separator
-        Label separator = new Label(labelParent, SWT.SEPARATOR | SWT.VERTICAL);
-        separator.setLayoutData(gd = new GridData(
-                GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL));
-        gd.heightHint = 0;
-
-        mThemeCombo = new Combo(labelParent, SWT.READ_ONLY | SWT.DROP_DOWN);
-        mThemeCombo.setEnabled(false);
-        updateUIFromResources();
-        mThemeCombo.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                onThemeChange();
-            }
-        });
-
-        // second separator
-        separator = new Label(labelParent, SWT.SEPARATOR | SWT.VERTICAL);
-        separator.setLayoutData(gd = new GridData(
-                GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL));
-        gd.heightHint = 0;
-
-        mCreateButton = new Button(labelParent, SWT.PUSH | SWT.FLAT);
-        mCreateButton.setText("Create...");
-        mCreateButton.setEnabled(false);
-        mCreateButton.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                LayoutCreatorDialog dialog = new LayoutCreatorDialog(mCreateButton.getShell(),
-                        mEditedFile.getName(),
-                        Sdk.getCurrent().getTarget(mEditedFile.getProject()), mCurrentConfig);
-                if (dialog.open() == Dialog.OK) {
-                    final FolderConfiguration config = new FolderConfiguration();
-                    dialog.getConfiguration(config);
-
-                    createAlternateLayout(config);
-                }
-            }
-        });
+        mConfigComposite = new ConfigurationComposite(this, parent, SWT.NONE);
 
         // create a new composite that will contain the standard editor controls.
         Composite editorParent = new Composite(parent, SWT.NONE);
@@ -586,6 +236,31 @@
         super.dispose();
     }
 
+    /**
+     * Returns the selection synchronizer object.
+     * The synchronizer can be used to sync the selection of 2 or more EditPartViewers.
+     * <p/>
+     * This is changed from protected to public so that the outline can use it.
+     *
+     * @return the synchronizer
+     */
+    @Override
+    public SelectionSynchronizer getSelectionSynchronizer() {
+        return super.getSelectionSynchronizer();
+    }
+
+    /**
+     * Returns the edit domain.
+     * <p/>
+     * This is changed from protected to public so that the outline can use it.
+     *
+     * @return the edit domain
+     */
+    @Override
+    public DefaultEditDomain getEditDomain() {
+        return super.getEditDomain();
+    }
+
     /* (non-Javadoc)
      * Creates the palette root.
      */
@@ -596,7 +271,6 @@
         return mPaletteRoot;
     }
 
-    @Override
     public Clipboard getClipboard() {
         return mClipboard;
     }
@@ -689,7 +363,7 @@
             FileEditorInput fileInput = (FileEditorInput)input;
             mEditedFile = fileInput.getFile();
 
-            updateUIFromResources();
+            mConfigComposite.updateUIFromResources();
 
             LayoutReloadMonitor.getMonitor().addListener(mEditedFile.getProject(), this);
         } else {
@@ -714,12 +388,11 @@
 
     /**
      * Used by LayoutEditor.UiEditorActions.selectUiNode to select a new UI Node
-     * created by  {@link ElementCreateCommand#execute()}.
+     * created by {@link ElementCreateCommand#execute()}.
      *
      * @param uiNodeModel The {@link UiElementNode} to select.
      */
-    @Override
-    void selectModel(UiElementNode uiNodeModel) {
+    public void selectModel(UiElementNode uiNodeModel) {
         GraphicalViewer viewer = getGraphicalViewer();
 
         // Give focus to the graphical viewer (in case the outline has it)
@@ -737,7 +410,6 @@
     // Local methods
     //--------------
 
-    @Override
     public LayoutEditor getLayoutEditor() {
         return mLayoutEditor;
     }
@@ -867,55 +539,19 @@
      * Sets the UI for the edition of a new file.
      * @param configuration the configuration of the new file.
      */
-    @Override
-    void editNewFile(FolderConfiguration configuration) {
+    public void editNewFile(FolderConfiguration configuration) {
         // update the configuration UI
         setConfiguration(configuration, true /*force*/);
 
         // enable the create button if the current and edited config are not equals
-        mCreateButton.setEnabled(mEditedConfig.equals(mCurrentConfig) == false);
+        mConfigComposite.setEnabledCreate(
+                mEditedConfig.equals(mConfigComposite.getCurrentConfig()) == false);
+
+        reloadConfigurationUi(false /*notifyListener*/);
     }
 
     public Rectangle getBounds() {
-        ScreenOrientation orientation = null;
-        if (mOrientation.getSelectionIndex() == 0) {
-            orientation = ScreenOrientation.PORTRAIT;
-        } else {
-            orientation = ScreenOrientation.getByIndex(
-                    mOrientation.getSelectionIndex() - 1);
-        }
-
-        int s1, s2;
-
-        // get the size from the UI controls. If it fails, revert to default values.
-        try {
-            s1 = Integer.parseInt(mSize1.getText().trim());
-        } catch (NumberFormatException e) {
-            s1 = 480;
-        }
-
-        try {
-            s2 = Integer.parseInt(mSize2.getText().trim());
-        } catch (NumberFormatException e) {
-            s2 = 320;
-        }
-
-        // make sure s1 is bigger than s2
-        if (s1 < s2) {
-            int tmp = s1;
-            s1 = s2;
-            s2 = tmp;
-        }
-
-        switch (orientation) {
-            default:
-            case PORTRAIT:
-                return new Rectangle(0, 0, s2, s1);
-            case LANDSCAPE:
-                return new Rectangle(0, 0, s1, s2);
-            case SQUARE:
-                return new Rectangle(0, 0, s1, s1);
-        }
+        return mConfigComposite.getScreenBounds();
     }
 
     /**
@@ -960,7 +596,8 @@
                     projectRes.loadAll();
 
                     // get the project resource values based on the current config
-                    mConfiguredProjectRes = projectRes.getConfiguredResources(mCurrentConfig);
+                    mConfiguredProjectRes = projectRes.getConfiguredResources(
+                            mConfigComposite.getCurrentConfig());
                 }
 
                 configuredProjectResources = mConfiguredProjectRes;
@@ -975,17 +612,15 @@
 
             if (configuredProjectResources != null && frameworkResources != null) {
                 // get the selected theme
-                int themeIndex = mThemeCombo.getSelectionIndex();
-                if (themeIndex != -1) {
-                    String theme = mThemeCombo.getItem(themeIndex);
-
+                String theme = mConfigComposite.getTheme();
+                if (theme != null) {
                     // Render a single object as described by the ViewElementDescriptor.
                     WidgetPullParser parser = new WidgetPullParser(descriptor);
                     ILayoutResult result = computeLayout(bridge, parser,
                             null /* projectKey */,
-                            300 /* width */, 300 /* height */, 160 /*density*/,
-                            160.f /*xdpi*/, 160.f /*ydpi*/, theme,
-                            themeIndex >= mPlatformThemeCount /*isProjectTheme*/,
+                            1 /* width */, 1 /* height */, true /* renderFullSize */,
+                            160 /*density*/, 160.f /*xdpi*/, 160.f /*ydpi*/, theme,
+                            mConfigComposite.isProjectTheme(),
                             configuredProjectResources, frameworkResources, projectCallback,
                             null /* logger */);
 
@@ -1016,8 +651,7 @@
     /**
      * Reloads this editor, by getting the new model from the {@link LayoutEditor}.
      */
-    @Override
-    void reloadEditor() {
+    public void reloadEditor() {
         GraphicalViewer viewer = getGraphicalViewer();
         viewer.setContents(getModel());
 
@@ -1038,8 +672,7 @@
     /**
      * Callback for XML model changed. Only update/recompute the layout if the editor is visible
      */
-    @Override
-    void onXmlModelChanged() {
+    public void onXmlModelChanged() {
         if (mLayoutEditor.isGraphicalEditorActive()) {
             doXmlReload(true /* force */);
             recomputeLayout();
@@ -1080,511 +713,41 @@
      * @param force Whether the UI should be changed to exactly match the received configuration.
      */
     void setConfiguration(FolderConfiguration config, boolean force) {
-        mDisableUpdates = true; // we do not want to trigger onXXXChange when setting new values in the widgets.
-
         mEditedConfig = config;
         mConfiguredFrameworkRes = mConfiguredProjectRes = null;
 
-        mCountryIcon.setImage(mMatchImage);
-        CountryCodeQualifier countryQualifier = config.getCountryCodeQualifier();
-        if (countryQualifier != null) {
-            mCountry.setText(String.format("%1$d", countryQualifier.getCode()));
-            mCurrentConfig.setCountryCodeQualifier(countryQualifier);
-        } else if (force) {
-            mCountry.setText(""); //$NON-NLS-1$
-            mCurrentConfig.setCountryCodeQualifier(null);
-        } else if (mCountry.getText().length() > 0) {
-            mCountryIcon.setImage(mWarningImage);
-        }
+        mConfigComposite.setConfiguration(config, force);
 
-        mNetworkIcon.setImage(mMatchImage);
-        NetworkCodeQualifier networkQualifier = config.getNetworkCodeQualifier();
-        if (networkQualifier != null) {
-            mNetwork.setText(String.format("%1$d", networkQualifier.getCode()));
-            mCurrentConfig.setNetworkCodeQualifier(networkQualifier);
-        } else if (force) {
-            mNetwork.setText(""); //$NON-NLS-1$
-            mCurrentConfig.setNetworkCodeQualifier(null);
-        } else if (mNetwork.getText().length() > 0) {
-            mNetworkIcon.setImage(mWarningImage);
-        }
-
-        mLanguageIcon.setImage(mMatchImage);
-        LanguageQualifier languageQualifier = config.getLanguageQualifier();
-        if (languageQualifier != null) {
-            mLanguage.setText(languageQualifier.getValue());
-            mCurrentConfig.setLanguageQualifier(languageQualifier);
-        } else if (force) {
-            mLanguage.setText(""); //$NON-NLS-1$
-            mCurrentConfig.setLanguageQualifier(null);
-        } else if (mLanguage.getText().length() > 0) {
-            mLanguageIcon.setImage(mWarningImage);
-        }
-
-        mRegionIcon.setImage(mMatchImage);
-        RegionQualifier regionQualifier = config.getRegionQualifier();
-        if (regionQualifier != null) {
-            mRegion.setText(regionQualifier.getValue());
-            mCurrentConfig.setRegionQualifier(regionQualifier);
-        } else if (force) {
-            mRegion.setText(""); //$NON-NLS-1$
-            mCurrentConfig.setRegionQualifier(null);
-        } else if (mRegion.getText().length() > 0) {
-            mRegionIcon.setImage(mWarningImage);
-        }
-
-        mOrientationIcon.setImage(mMatchImage);
-        ScreenOrientationQualifier orientationQualifier = config.getScreenOrientationQualifier();
-        if (orientationQualifier != null) {
-            mOrientation.select(
-                    ScreenOrientation.getIndex(orientationQualifier.getValue()) + 1);
-            mCurrentConfig.setScreenOrientationQualifier(orientationQualifier);
-        } else if (force) {
-            mOrientation.select(0);
-            mCurrentConfig.setScreenOrientationQualifier(null);
-        } else if (mOrientation.getSelectionIndex() != 0) {
-            mOrientationIcon.setImage(mWarningImage);
-        }
-
-        mDensityIcon.setImage(mMatchImage);
-        PixelDensityQualifier densityQualifier = config.getPixelDensityQualifier();
-        if (densityQualifier != null) {
-            mDensity.select(
-                    Density.getIndex(densityQualifier.getValue()) + 1);
-            mCurrentConfig.setPixelDensityQualifier(densityQualifier);
-        } else if (force) {
-            mOrientation.select(0);
-            mCurrentConfig.setPixelDensityQualifier(null);
-        } else if (mDensity.getSelectionIndex() != 0) {
-            mDensityIcon.setImage(mWarningImage);
-        }
-
-        mTouchIcon.setImage(mMatchImage);
-        TouchScreenQualifier touchQualifier = config.getTouchTypeQualifier();
-        if (touchQualifier != null) {
-            mTouch.select(TouchScreenType.getIndex(touchQualifier.getValue()) + 1);
-            mCurrentConfig.setTouchTypeQualifier(touchQualifier);
-        } else if (force) {
-            mTouch.select(0);
-            mCurrentConfig.setTouchTypeQualifier(null);
-        } else if (mTouch.getSelectionIndex() != 0) {
-            mTouchIcon.setImage(mWarningImage);
-        }
-
-        mKeyboardIcon.setImage(mMatchImage);
-        KeyboardStateQualifier keyboardQualifier = config.getKeyboardStateQualifier();
-        if (keyboardQualifier != null) {
-            mKeyboard.select(KeyboardState.getIndex(keyboardQualifier.getValue()) + 1);
-            mCurrentConfig.setKeyboardStateQualifier(keyboardQualifier);
-        } else if (force) {
-            mKeyboard.select(0);
-            mCurrentConfig.setKeyboardStateQualifier(null);
-        } else if (mKeyboard.getSelectionIndex() != 0) {
-            mKeyboardIcon.setImage(mWarningImage);
-        }
-
-        mTextInputIcon.setImage(mMatchImage);
-        TextInputMethodQualifier inputQualifier = config.getTextInputMethodQualifier();
-        if (inputQualifier != null) {
-            mTextInput.select(TextInputMethod.getIndex(inputQualifier.getValue()) + 1);
-            mCurrentConfig.setTextInputMethodQualifier(inputQualifier);
-        } else if (force) {
-            mTextInput.select(0);
-            mCurrentConfig.setTextInputMethodQualifier(null);
-        } else if (mTextInput.getSelectionIndex() != 0) {
-            mTextInputIcon.setImage(mWarningImage);
-        }
-
-        mNavigationIcon.setImage(mMatchImage);
-        NavigationMethodQualifier navigationQualifiter = config.getNavigationMethodQualifier();
-        if (navigationQualifiter != null) {
-            mNavigation.select(
-                    NavigationMethod.getIndex(navigationQualifiter.getValue()) + 1);
-            mCurrentConfig.setNavigationMethodQualifier(navigationQualifiter);
-        } else if (force) {
-            mNavigation.select(0);
-            mCurrentConfig.setNavigationMethodQualifier(null);
-        } else if (mNavigation.getSelectionIndex() != 0) {
-            mNavigationIcon.setImage(mWarningImage);
-        }
-
-        mSizeIcon.setImage(mMatchImage);
-        ScreenDimensionQualifier sizeQualifier = config.getScreenDimensionQualifier();
-        if (sizeQualifier != null) {
-            mSize1.setText(String.format("%1$d", sizeQualifier.getValue1()));
-            mSize2.setText(String.format("%1$d", sizeQualifier.getValue2()));
-            mCurrentConfig.setScreenDimensionQualifier(sizeQualifier);
-        } else if (force) {
-            mSize1.setText(""); //$NON-NLS-1$
-            mSize2.setText(""); //$NON-NLS-1$
-            mCurrentConfig.setScreenDimensionQualifier(null);
-        } else if (mSize1.getText().length() > 0 && mSize2.getText().length() > 0) {
-            mSizeIcon.setImage(mWarningImage);
-        }
-
-        // update the string showing the folder name
-        String current = config.toDisplayString();
-        mCurrentLayoutLabel.setText(current != null ? current : "(Default)");
-
-        mDisableUpdates = false;
     }
 
-    /**
-     * Displays an error icon in front of all the non-null qualifiers.
-     */
-    void displayConfigError() {
-        mCountryIcon.setImage(mMatchImage);
-        CountryCodeQualifier countryQualifier = mCurrentConfig.getCountryCodeQualifier();
-        if (countryQualifier != null) {
-            mCountryIcon.setImage(mErrorImage);
-        }
 
-        mNetworkIcon.setImage(mMatchImage);
-        NetworkCodeQualifier networkQualifier = mCurrentConfig.getNetworkCodeQualifier();
-        if (networkQualifier != null) {
-            mNetworkIcon.setImage(mErrorImage);
-        }
-
-        mLanguageIcon.setImage(mMatchImage);
-        LanguageQualifier languageQualifier = mCurrentConfig.getLanguageQualifier();
-        if (languageQualifier != null) {
-            mLanguageIcon.setImage(mErrorImage);
-        }
-
-        mRegionIcon.setImage(mMatchImage);
-        RegionQualifier regionQualifier = mCurrentConfig.getRegionQualifier();
-        if (regionQualifier != null) {
-            mRegionIcon.setImage(mErrorImage);
-        }
-
-        mOrientationIcon.setImage(mMatchImage);
-        ScreenOrientationQualifier orientationQualifier =
-            mCurrentConfig.getScreenOrientationQualifier();
-        if (orientationQualifier != null) {
-            mOrientationIcon.setImage(mErrorImage);
-        }
-
-        mDensityIcon.setImage(mMatchImage);
-        PixelDensityQualifier densityQualifier = mCurrentConfig.getPixelDensityQualifier();
-        if (densityQualifier != null) {
-            mDensityIcon.setImage(mErrorImage);
-        }
-
-        mTouchIcon.setImage(mMatchImage);
-        TouchScreenQualifier touchQualifier = mCurrentConfig.getTouchTypeQualifier();
-        if (touchQualifier != null) {
-            mTouchIcon.setImage(mErrorImage);
-        }
-
-        mKeyboardIcon.setImage(mMatchImage);
-        KeyboardStateQualifier keyboardQualifier = mCurrentConfig.getKeyboardStateQualifier();
-        if (keyboardQualifier != null) {
-            mKeyboardIcon.setImage(mErrorImage);
-        }
-
-        mTextInputIcon.setImage(mMatchImage);
-        TextInputMethodQualifier inputQualifier = mCurrentConfig.getTextInputMethodQualifier();
-        if (inputQualifier != null) {
-            mTextInputIcon.setImage(mErrorImage);
-        }
-
-        mNavigationIcon.setImage(mMatchImage);
-        NavigationMethodQualifier navigationQualifiter =
-            mCurrentConfig.getNavigationMethodQualifier();
-        if (navigationQualifiter != null) {
-            mNavigationIcon.setImage(mErrorImage);
-        }
-
-        mSizeIcon.setImage(mMatchImage);
-        ScreenDimensionQualifier sizeQualifier = mCurrentConfig.getScreenDimensionQualifier();
-        if (sizeQualifier != null) {
-            mSizeIcon.setImage(mErrorImage);
-        }
-
-        // update the string showing the folder name
-        String current = mCurrentConfig.toDisplayString();
-        mCurrentLayoutLabel.setText(current != null ? current : "(Default)");
-    }
-
-    @Override
-    UiDocumentNode getModel() {
+    public UiDocumentNode getModel() {
         return mLayoutEditor.getUiRootNode();
     }
 
-    @Override
-    void reloadPalette() {
+    public void reloadPalette() {
         PaletteFactory.createPaletteRoot(mPaletteRoot, mLayoutEditor.getTargetData());
     }
 
-    private void onCountryCodeChange() {
-        // because mCountry triggers onCountryCodeChange at each modification, calling setText()
-        // will trigger notifications, and we don't want that.
-        if (mDisableUpdates == true) {
-            return;
-        }
-
-        // update the current config
-        String value = mCountry.getText();
-
-        // empty string, means no qualifier.
-        if (value.length() == 0) {
-            mCurrentConfig.setCountryCodeQualifier(null);
-        } else {
-            try {
-                CountryCodeQualifier qualifier = CountryCodeQualifier.getQualifier(
-                        CountryCodeQualifier.getFolderSegment(Integer.parseInt(value)));
-                if (qualifier != null) {
-                    mCurrentConfig.setCountryCodeQualifier(qualifier);
-                } else {
-                    // Failure! Looks like the value is wrong (for instance a one letter string).
-                    // We do nothing in this case.
-                    mCountryIcon.setImage(mErrorImage);
-                    return;
-                }
-            } catch (NumberFormatException e) {
-                // Looks like the code is not a number. This should not happen since the text
-                // field has a VerifyListener that prevents it.
-                mCurrentConfig.setCountryCodeQualifier(null);
-                mCountryIcon.setImage(mErrorImage);
+    public void reloadConfigurationUi(boolean notifyListener) {
+        // enable the clipping button if it's supported.
+        Sdk currentSdk = Sdk.getCurrent();
+        if (currentSdk != null) {
+            IAndroidTarget target = currentSdk.getTarget(mEditedFile.getProject());
+            AndroidTargetData data = currentSdk.getTargetData(target);
+            if (data != null) {
+                LayoutBridge bridge = data.getLayoutBridge();
+                mConfigComposite.reloadDevices(notifyListener);
+                mConfigComposite.setClippingSupport(bridge.apiLevel >= 4);
             }
         }
-
-        // look for a file to open/create
-        onConfigurationChange();
     }
 
-    private void onNetworkCodeChange() {
-        // because mNetwork triggers onNetworkCodeChange at each modification, calling setText()
-        // will trigger notifications, and we don't want that.
-        if (mDisableUpdates == true) {
-            return;
-        }
-
-        // update the current config
-        String value = mNetwork.getText();
-
-        // empty string, means no qualifier.
-        if (value.length() == 0) {
-            mCurrentConfig.setNetworkCodeQualifier(null);
-        } else {
-            try {
-                NetworkCodeQualifier qualifier = NetworkCodeQualifier.getQualifier(
-                        NetworkCodeQualifier.getFolderSegment(Integer.parseInt(value)));
-                if (qualifier != null) {
-                    mCurrentConfig.setNetworkCodeQualifier(qualifier);
-                } else {
-                    // Failure! Looks like the value is wrong (for instance a one letter string).
-                    // We do nothing in this case.
-                    mNetworkIcon.setImage(mErrorImage);
-                    return;
-                }
-            } catch (NumberFormatException e) {
-                // Looks like the code is not a number. This should not happen since the text
-                // field has a VerifyListener that prevents it.
-                mCurrentConfig.setNetworkCodeQualifier(null);
-                mNetworkIcon.setImage(mErrorImage);
-            }
-        }
-
-        // look for a file to open/create
-        onConfigurationChange();
-    }
-
-    /**
-     * Call back for language combo selection
-     */
-    private void onLanguageChange() {
-        // because mLanguage triggers onLanguageChange at each modification, the filling
-        // of the combo with data will trigger notifications, and we don't want that.
-        if (mDisableUpdates == true) {
-            return;
-        }
-
-        // update the current config
-        String value = mLanguage.getText();
-
-        updateRegionUi(null /* projectResources */, null /* frameworkResources */);
-
-        // empty string, means no qualifier.
-        if (value.length() == 0) {
-            mCurrentConfig.setLanguageQualifier(null);
-        } else {
-            LanguageQualifier qualifier = null;
-            String segment = LanguageQualifier.getFolderSegment(value);
-            if (segment != null) {
-                qualifier = LanguageQualifier.getQualifier(segment);
-            }
-
-            if (qualifier != null) {
-                mCurrentConfig.setLanguageQualifier(qualifier);
-            } else {
-                // Failure! Looks like the value is wrong (for instance a one letter string).
-                mCurrentConfig.setLanguageQualifier(null);
-                mLanguageIcon.setImage(mErrorImage);
-            }
-        }
-
-        // look for a file to open/create
-        onConfigurationChange();
-    }
-
-    private void onRegionChange() {
-        // because mRegion triggers onRegionChange at each modification, the filling
-        // of the combo with data will trigger notifications, and we don't want that.
-        if (mDisableUpdates == true) {
-            return;
-        }
-
-        // update the current config
-        String value = mRegion.getText();
-
-        // empty string, means no qualifier.
-        if (value.length() == 0) {
-            mCurrentConfig.setRegionQualifier(null);
-        } else {
-            RegionQualifier qualifier = null;
-            String segment = RegionQualifier.getFolderSegment(value);
-            if (segment != null) {
-                qualifier = RegionQualifier.getQualifier(segment);
-            }
-
-            if (qualifier != null) {
-                mCurrentConfig.setRegionQualifier(qualifier);
-            } else {
-                // Failure! Looks like the value is wrong (for instance a one letter string).
-                mCurrentConfig.setRegionQualifier(null);
-                mRegionIcon.setImage(mErrorImage);
-            }
-        }
-
-        // look for a file to open/create
-        onConfigurationChange();
-    }
-
-    private void onOrientationChange() {
-        // update the current config
-        int index = mOrientation.getSelectionIndex();
-        if (index != 0) {
-            mCurrentConfig.setScreenOrientationQualifier(new ScreenOrientationQualifier(
-                ScreenOrientation.getByIndex(index-1)));
-        } else {
-            mCurrentConfig.setScreenOrientationQualifier(null);
-        }
-
-        // look for a file to open/create
-        onConfigurationChange();
-    }
-
-    private void onDensityChange() {
-        int index = mDensity.getSelectionIndex();
-        if (index != 0) {
-            mCurrentConfig.setPixelDensityQualifier((new PixelDensityQualifier(
-                Density.getByIndex(index-1))));
-        } else {
-            mCurrentConfig.setPixelDensityQualifier(null);
-        }
-
-        // look for a file to open/create
-        onConfigurationChange();
-    }
-
-    private void onTouchChange() {
-        // update the current config
-        int index = mTouch.getSelectionIndex();
-        if (index != 0) {
-            mCurrentConfig.setTouchTypeQualifier(new TouchScreenQualifier(
-                TouchScreenType.getByIndex(index-1)));
-        } else {
-            mCurrentConfig.setTouchTypeQualifier(null);
-        }
-
-        // look for a file to open/create
-        onConfigurationChange();
-    }
-
-    private void onKeyboardChange() {
-        // update the current config
-        int index = mKeyboard.getSelectionIndex();
-        if (index != 0) {
-            mCurrentConfig.setKeyboardStateQualifier(new KeyboardStateQualifier(
-                KeyboardState.getByIndex(index-1)));
-        } else {
-            mCurrentConfig.setKeyboardStateQualifier(null);
-        }
-
-        // look for a file to open/create
-        onConfigurationChange();
-    }
-
-    private void onTextInputChange() {
-        // update the current config
-        int index = mTextInput.getSelectionIndex();
-        if (index != 0) {
-            mCurrentConfig.setTextInputMethodQualifier(new TextInputMethodQualifier(
-                TextInputMethod.getByIndex(index-1)));
-        } else {
-            mCurrentConfig.setTextInputMethodQualifier(null);
-        }
-
-        // look for a file to open/create
-        onConfigurationChange();
-    }
-
-    private void onNavigationChange() {
-        // update the current config
-        int index = mNavigation.getSelectionIndex();
-        if (index != 0) {
-            mCurrentConfig.setNavigationMethodQualifier(new NavigationMethodQualifier(
-                NavigationMethod.getByIndex(index-1)));
-        } else {
-            mCurrentConfig.setNavigationMethodQualifier(null);
-        }
-
-        // look for a file to open/create
-        onConfigurationChange();
-    }
-
-    private void onSizeChange() {
-        // because mSize1 and mSize2 trigger onSizeChange at each modification, calling setText()
-        // will trigger notifications, and we don't want that.
-        if (mDisableUpdates == true) {
-            return;
-        }
-
-        // update the current config
-        String size1 = mSize1.getText();
-        String size2 = mSize2.getText();
-
-        // if only one of the strings is empty, do nothing
-        if ((size1.length() == 0) ^ (size2.length() == 0)) {
-            mSizeIcon.setImage(mErrorImage);
-            return;
-        } else if (size1.length() == 0 && size2.length() == 0) {
-            // both sizes are empty: remove the qualifier.
-            mCurrentConfig.setScreenDimensionQualifier(null);
-        } else {
-            ScreenDimensionQualifier qualifier = ScreenDimensionQualifier.getQualifier(size1,
-                    size2);
-
-            if (qualifier != null) {
-                mCurrentConfig.setScreenDimensionQualifier(qualifier);
-            } else {
-                // Failure! Looks like the value is wrong.
-                // we do nothing in this case.
-                return;
-            }
-        }
-
-        // look for a file to open/create
-        onConfigurationChange();
-    }
-
-
     /**
      * Looks for a file matching the new {@link FolderConfiguration} and attempts to open it.
      * <p/>If there is no match, notify the user.
      */
-    private void onConfigurationChange() {
+    public void onConfigurationChange() {
         mConfiguredFrameworkRes = mConfiguredProjectRes = null;
 
         if (mEditedFile == null || mEditedConfig == null) {
@@ -1600,7 +763,7 @@
         if (resources != null) {
             match = resources.getMatchingFile(mEditedFile.getName(),
                                               ResourceFolderType.LAYOUT,
-                                              mCurrentConfig);
+                                              mConfigComposite.getCurrentConfig());
         }
 
         if (match != null) {
@@ -1623,73 +786,54 @@
             setConfiguration(mEditedConfig, false /*force*/);
 
             // enable the create button if the current and edited config are not equals
-            mCreateButton.setEnabled(mEditedConfig.equals(mCurrentConfig) == false);
+            mConfigComposite.setEnabledCreate(
+                    mEditedConfig.equals(mConfigComposite.getCurrentConfig()) == false);
 
             // Even though the layout doesn't change, the config changed, and referenced
             // resources need to be updated.
             recomputeLayout();
         } else {
-            // update the configuration icons with the new edited config.
-            displayConfigError();
-
             // enable the Create button
-            mCreateButton.setEnabled(true);
+            mConfigComposite.setEnabledCreate(true);
 
             // display the error.
+            FolderConfiguration currentConfig = mConfigComposite.getCurrentConfig();
             String message = String.format(
                     "No resources match the configuration\n \n\t%1$s\n \nChange the configuration or create:\n \n\tres/%2$s/%3$s\n \nYou can also click the 'Create' button above.",
-                    mCurrentConfig.toDisplayString(),
-                    mCurrentConfig.getFolderName(ResourceFolderType.LAYOUT,
+                    currentConfig.toDisplayString(),
+                    currentConfig.getFolderName(ResourceFolderType.LAYOUT,
                             Sdk.getCurrent().getTarget(mEditedFile.getProject())),
                     mEditedFile.getName());
             showErrorInEditor(message);
         }
     }
 
-    private void onThemeChange() {
-        int themeIndex = mThemeCombo.getSelectionIndex();
-        if (themeIndex != -1) {
-            String theme = mThemeCombo.getItem(themeIndex);
-
-            if (theme.equals(THEME_SEPARATOR)) {
-                mThemeCombo.select(0);
-            }
-
-            recomputeLayout();
-        }
+    public void onThemeChange() {
+        recomputeLayout();
     }
 
-    /**
-     * Creates a composite with no margin/spacing, and puts a {@link Label} in it with the matching
-     * icon.
-     * @param parent the parent to receive the composite
-     * @return the created {@link Label} object.
-     */
-    private Label createControlComposite(Composite parent, boolean grab) {
-        GridLayout gl;
+    public void OnClippingChange() {
+        recomputeLayout();
+    }
 
-        Composite composite = new Composite(parent, SWT.NONE);
-        composite.setLayout(gl = new GridLayout(2, false));
-        gl.marginHeight = gl.marginWidth = 0;
-        gl.horizontalSpacing = 0;
-        if (grab) {
-            composite.setLayoutData(
-                    new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
+
+    public void onCreate() {
+        LayoutCreatorDialog dialog = new LayoutCreatorDialog(mParent.getShell(),
+                mEditedFile.getName(),
+                Sdk.getCurrent().getTarget(mEditedFile.getProject()),
+                mConfigComposite.getCurrentConfig());
+        if (dialog.open() == Dialog.OK) {
+            final FolderConfiguration config = new FolderConfiguration();
+            dialog.getConfiguration(config);
+
+            createAlternateLayout(config);
         }
-
-        // create the label
-        Label icon = new Label(composite, SWT.NONE);
-        icon.setImage(mMatchImage);
-
-        return icon;
     }
 
     /**
      * Recomputes the layout with the help of layoutlib.
      */
-    @Override
-    @SuppressWarnings("deprecation")
-    void recomputeLayout() {
+    public void recomputeLayout() {
         doXmlReload(false /* force */);
         try {
             // check that the resource exists. If the file is opened but the project is closed
@@ -1760,19 +904,14 @@
                     }
 
                     // get the resources of the file's project.
-                    if (mConfiguredProjectRes == null) {
-                        // make sure they are loaded
-                        projectRes.loadAll();
-
-                        // get the project resource values based on the current config
-                        mConfiguredProjectRes = projectRes.getConfiguredResources(mCurrentConfig);
-                    }
+                    Map<String, Map<String, IResourceValue>> configuredProjectRes =
+                        getConfiguredProjectResources();
 
                     // get the framework resources
                     Map<String, Map<String, IResourceValue>> frameworkResources =
                         getConfiguredFrameworkResources();
 
-                    if (mConfiguredProjectRes != null && frameworkResources != null) {
+                    if (configuredProjectRes != null && frameworkResources != null) {
                         if (mProjectCallback == null) {
                             mProjectCallback = new ProjectCallback(
                                     bridge.classLoader, projectRes, iProject);
@@ -1801,31 +940,24 @@
                         }
 
                         // get the selected theme
-                        int themeIndex = mThemeCombo.getSelectionIndex();
-                        if (themeIndex != -1) {
-                            String theme = mThemeCombo.getItem(themeIndex);
+                        String theme = mConfigComposite.getTheme();
+                        if (theme != null) {
 
                             // Compute the layout
                             UiElementPullParser parser = new UiElementPullParser(getModel());
                             Rectangle rect = getBounds();
-                            boolean isProjectTheme = themeIndex >= mPlatformThemeCount;
+                            boolean isProjectTheme = mConfigComposite.isProjectTheme();
 
-                            // FIXME pass the density/dpi from somewhere (resource config or skin).
-                            // For now, get it from the config
-                            int density = Density.MEDIUM.getDpiValue();
-                            PixelDensityQualifier qual = mCurrentConfig.getPixelDensityQualifier();
-                            if (qual != null) {
-                                int d = qual.getValue().getDpiValue();
-                                if (d > 0) {
-                                    density = d;
-                                }
-                            }
+                            int density = mConfigComposite.getDensity().getDpiValue();
+                            float xdpi = mConfigComposite.getXDpi();
+                            float ydpi = mConfigComposite.getYDpi();
 
                             ILayoutResult result = computeLayout(bridge, parser,
                                     iProject /* projectKey */,
-                                    rect.width, rect.height, density, density, density,
+                                    rect.width, rect.height, !mConfigComposite.getClipping(),
+                                    density, xdpi, ydpi,
                                     theme, isProjectTheme,
-                                    mConfiguredProjectRes, frameworkResources, mProjectCallback,
+                                    configuredProjectRes, frameworkResources, mProjectCallback,
                                     mLogger);
 
                             // update the UiElementNode with the layout info.
@@ -1970,8 +1102,7 @@
     /**
      * Responds to a page change that made the Graphical editor page the activated page.
      */
-    @Override
-    void activated() {
+    public void activated() {
         if (mNeedsRecompute || mNeedsXmlReload) {
             recomputeLayout();
         }
@@ -1980,265 +1111,75 @@
     /**
      * Responds to a page change that made the Graphical editor page the deactivated page
      */
-    @Override
-    void deactivated() {
+    public void deactivated() {
         // nothing to be done here for now.
     }
 
-    /**
-     * Updates the UI from values in the resources, such as languages, regions, themes, etc...
-     * This must be called from the UI thread.
-     */
-    private void updateUIFromResources() {
-
-        ResourceManager manager = ResourceManager.getInstance();
-
-        ProjectResources frameworkProject = getFrameworkResources();
-
-        mDisableUpdates = true;
-
-        // Reset stuff
-        int selection = mThemeCombo.getSelectionIndex();
-        mThemeCombo.removeAll();
-        mPlatformThemeCount = 0;
-        mLanguage.removeAll();
-
-        Set<String> languages = new HashSet<String>();
-        ArrayList<String> themes = new ArrayList<String>();
-
-        // get the themes, and languages from the Framework.
-        if (frameworkProject != null) {
-            // get the configured resources for the framework
-            Map<String, Map<String, IResourceValue>> frameworResources =
-                getConfiguredFrameworkResources();
-
-            if (frameworResources != null) {
-                // get the styles.
-                Map<String, IResourceValue> styles = frameworResources.get(
-                        ResourceType.STYLE.getName());
-
-
-                // collect the themes out of all the styles.
-                for (IResourceValue value : styles.values()) {
-                    String name = value.getName();
-                    if (name.startsWith("Theme.") || name.equals("Theme")) {
-                        themes.add(value.getName());
-                        mPlatformThemeCount++;
-                    }
-                }
-
-                // sort them and add them to the combo
-                Collections.sort(themes);
-
-                for (String theme : themes) {
-                    mThemeCombo.add(theme);
-                }
-
-                mPlatformThemeCount = themes.size();
-                themes.clear();
-            }
-            // now get the languages from the framework.
-            Set<String> frameworkLanguages = frameworkProject.getLanguages();
-            if (frameworkLanguages != null) {
-                languages.addAll(frameworkLanguages);
-            }
-        }
-
-        // now get the themes and languages from the project.
-        ProjectResources project = null;
-        if (mEditedFile != null) {
-            project = manager.getProjectResources(mEditedFile.getProject());
-
-            // in cases where the opened file is not linked to a project, this could be null.
-            if (project != null) {
-                // get the configured resources for the project
-                if (mConfiguredProjectRes == null) {
-                    // make sure they are loaded
-                    project.loadAll();
-
-                    // get the project resource values based on the current config
-                    mConfiguredProjectRes = project.getConfiguredResources(mCurrentConfig);
-                }
-
-                if (mConfiguredProjectRes != null) {
-                    // get the styles.
-                    Map<String, IResourceValue> styleMap = mConfiguredProjectRes.get(
-                            ResourceType.STYLE.getName());
-
-                    if (styleMap != null) {
-                        // collect the themes out of all the styles, ie styles that extend,
-                        // directly or indirectly a platform theme.
-                        for (IResourceValue value : styleMap.values()) {
-                            if (isTheme(value, styleMap)) {
-                                themes.add(value.getName());
-                            }
-                        }
-
-                        // sort them and add them the to the combo.
-                        if (mPlatformThemeCount > 0 && themes.size() > 0) {
-                            mThemeCombo.add(THEME_SEPARATOR);
-                        }
-
-                        Collections.sort(themes);
-
-                        for (String theme : themes) {
-                            mThemeCombo.add(theme);
-                        }
-                    }
-                }
-
-                // now get the languages from the project.
-                Set<String> projectLanguages = project.getLanguages();
-                if (projectLanguages != null) {
-                    languages.addAll(projectLanguages);
-                }
-            }
-        }
-
-        // add the languages to the Combo
-        for (String language : languages) {
-            mLanguage.add(language);
-        }
-
-        mDisableUpdates = false;
-
-        // and update the Region UI based on the current language
-        updateRegionUi(project, frameworkProject);
-
-        // handle default selection of themes
-        if (mThemeCombo.getItemCount() > 0) {
-            mThemeCombo.setEnabled(true);
-            if (selection == -1) {
-                selection = 0;
-            }
-
-            if (mThemeCombo.getItemCount() <= selection) {
-                mThemeCombo.select(0);
-            } else {
-                mThemeCombo.select(selection);
-            }
-        } else {
-            mThemeCombo.setEnabled(false);
-        }
-    }
-
-    /**
-     * Returns whether the given <var>style</var> is a theme.
-     * This is done by making sure the parent is a theme.
-     * @param value the style to check
-     * @param styleMap the map of styles for the current project. Key is the style name.
-     * @return True if the given <var>style</var> is a theme.
-     */
-    private boolean isTheme(IResourceValue value, Map<String, IResourceValue> styleMap) {
-        if (value instanceof IStyleResourceValue) {
-            IStyleResourceValue style = (IStyleResourceValue)value;
-
-            boolean frameworkStyle = false;
-            String parentStyle = style.getParentStyle();
-            if (parentStyle == null) {
-                // if there is no specified parent style we look an implied one.
-                // For instance 'Theme.light' is implied child style of 'Theme',
-                // and 'Theme.light.fullscreen' is implied child style of 'Theme.light'
-                String name = style.getName();
-                int index = name.lastIndexOf('.');
-                if (index != -1) {
-                    parentStyle = name.substring(0, index);
-                }
-            } else {
-                // remove the useless @ if it's there
-                if (parentStyle.startsWith("@")) {
-                    parentStyle = parentStyle.substring(1);
-                }
-
-                // check for framework identifier.
-                if (parentStyle.startsWith("android:")) {
-                    frameworkStyle = true;
-                    parentStyle = parentStyle.substring("android:".length());
-                }
-
-                // at this point we could have the format style/<name>. we want only the name
-                if (parentStyle.startsWith("style/")) {
-                    parentStyle = parentStyle.substring("style/".length());
-                }
-            }
-
-            if (frameworkStyle) {
-                // if the parent is a framework style, it has to be 'Theme' or 'Theme.*'
-                return parentStyle.equals("Theme") || parentStyle.startsWith("Theme.");
-            } else {
-                // if it's a project style, we check this is a theme.
-                value = styleMap.get(parentStyle);
-                if (value != null) {
-                    return isTheme(value, styleMap);
-                }
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * Update the Region UI widget based on the current language selection
-     * @param projectResources the project resources or {@code null}.
-     * @param frameworkResources the framework resource or {@code null}
-     */
-    private void updateRegionUi(ProjectResources projectResources,
-            ProjectResources frameworkResources) {
-        if (projectResources == null && mEditedFile != null) {
-            projectResources = ResourceManager.getInstance().getProjectResources(
-                    mEditedFile.getProject());
-        }
-
-        if (frameworkResources == null) {
-            frameworkResources = getFrameworkResources();
-        }
-
-        String currentLanguage = mLanguage.getText();
-
-        Set<String> set = null;
-
-        if (projectResources != null) {
-            set = projectResources.getRegions(currentLanguage);
-        }
-
-        if (frameworkResources != null) {
-            if (set != null) {
-                Set<String> set2 = frameworkResources.getRegions(currentLanguage);
-                set.addAll(set2);
-            } else {
-                set = frameworkResources.getRegions(currentLanguage);
-            }
-        }
-
-        if (set != null) {
-            mDisableUpdates = true;
-
-            mRegion.removeAll();
-            for (String region : set) {
-                mRegion.add(region);
-            }
-
-            mDisableUpdates = false;
-        }
-    }
-
-    private Map<String, Map<String, IResourceValue>> getConfiguredFrameworkResources() {
+    public Map<String, Map<String, IResourceValue>> getConfiguredFrameworkResources() {
         if (mConfiguredFrameworkRes == null) {
             ProjectResources frameworkRes = getFrameworkResources();
 
             if (frameworkRes == null) {
                 AdtPlugin.log(IStatus.ERROR, "Failed to get ProjectResource for the framework");
+            } else {
+                // get the framework resource values based on the current config
+                mConfiguredFrameworkRes = frameworkRes.getConfiguredResources(
+                        mConfigComposite.getCurrentConfig());
             }
-
-            // get the framework resource values based on the current config
-            mConfiguredFrameworkRes = frameworkRes.getConfiguredResources(mCurrentConfig);
         }
 
         return mConfiguredFrameworkRes;
     }
 
+    public Map<String, Map<String, IResourceValue>> getConfiguredProjectResources() {
+        if (mConfiguredProjectRes == null) {
+            ProjectResources project = getProjectResources();
+
+            // make sure they are loaded
+            project.loadAll();
+
+            // get the project resource values based on the current config
+            mConfiguredProjectRes = project.getConfiguredResources(
+                    mConfigComposite.getCurrentConfig());
+        }
+
+        return mConfiguredProjectRes;
+    }
+
     /**
-     * Creates a new layout file from the specificed {@link FolderConfiguration}.
+     * Returns a {@link ProjectResources} for the framework resources.
+     * @return the framework resources or null if not found.
+     */
+    public ProjectResources getFrameworkResources() {
+        if (mEditedFile != null) {
+            Sdk currentSdk = Sdk.getCurrent();
+            if (currentSdk != null) {
+                IAndroidTarget target = currentSdk.getTarget(mEditedFile.getProject());
+
+                if (target != null) {
+                    AndroidTargetData data = currentSdk.getTargetData(target);
+
+                    if (data != null) {
+                        return data.getFrameworkResources();
+                    }
+                }
+            }
+        }
+
+        return null;
+    }
+
+    public ProjectResources getProjectResources() {
+        if (mEditedFile != null) {
+            ResourceManager manager = ResourceManager.getInstance();
+            return manager.getProjectResources(mEditedFile.getProject());
+        }
+
+        return null;
+    }
+
+    /**
+     * Creates a new layout file from the specified {@link FolderConfiguration}.
      */
     private void createAlternateLayout(final FolderConfiguration config) {
         new Job("Create Alternate Resource") {
@@ -2295,7 +1236,6 @@
                     // to trigger the edit of the new file.
                     res.refreshLocal(IResource.DEPTH_INFINITE, new IProgressMonitor() {
                         public void done() {
-                            mCurrentConfig.set(config);
                             mParent.getDisplay().asyncExec(new Runnable() {
                                 public void run() {
                                     onConfigurationChange();
@@ -2358,44 +1298,30 @@
     }
 
     /**
-     * Returns a {@link ProjectResources} for the framework resources.
-     * @return the framework resources or null if not found.
-     */
-    private ProjectResources getFrameworkResources() {
-        if (mEditedFile != null) {
-            Sdk currentSdk = Sdk.getCurrent();
-            if (currentSdk != null) {
-                IAndroidTarget target = currentSdk.getTarget(mEditedFile.getProject());
-
-                if (target != null) {
-                    AndroidTargetData data = currentSdk.getTargetData(target);
-
-                    if (data != null) {
-                        return data.getFrameworkResources();
-                    }
-                }
-            }
-        }
-
-        return null;
-    }
-
-    /**
      * Computes a layout by calling the correct computeLayout method of ILayoutBridge based on
      * the implementation API level.
      */
     @SuppressWarnings("deprecation")
-    private ILayoutResult computeLayout(LayoutBridge bridge,
+    private static ILayoutResult computeLayout(LayoutBridge bridge,
             IXmlPullParser layoutDescription, Object projectKey,
-            int screenWidth, int screenHeight, int density, float xdpi, float ydpi,
+            int screenWidth, int screenHeight, boolean renderFullSize,
+            int density, float xdpi, float ydpi,
             String themeName, boolean isProjectTheme,
             Map<String, Map<String, IResourceValue>> projectResources,
             Map<String, Map<String, IResourceValue>> frameworkResources,
             IProjectCallback projectCallback, ILayoutLog logger) {
 
-        if (bridge.apiLevel >= 3) {
-            // newer api with boolean for separation of project/framework theme,
-            // and density support.
+        if (bridge.apiLevel >= ILayoutBridge.API_CURRENT) {
+            // newest API with support for "render full height"
+            // TODO: link boolean to UI.
+            return bridge.bridge.computeLayout(layoutDescription,
+                    projectKey, screenWidth, screenHeight, renderFullSize,
+                    density, xdpi, ydpi,
+                    themeName, isProjectTheme,
+                    projectResources, frameworkResources, projectCallback,
+                    logger);
+        } else if (bridge.apiLevel == 3) {
+            // newer api with density support.
             return bridge.bridge.computeLayout(layoutDescription,
                     projectKey, screenWidth, screenHeight, density, xdpi, ydpi,
                     themeName, isProjectTheme,
@@ -2405,8 +1331,8 @@
             // api with boolean for separation of project/framework theme
             return bridge.bridge.computeLayout(layoutDescription,
                     projectKey, screenWidth, screenHeight, themeName, isProjectTheme,
-                    mConfiguredProjectRes, frameworkResources, mProjectCallback,
-                    mLogger);
+                    projectResources, frameworkResources, projectCallback,
+                    logger);
         } else {
             // oldest api with no density/dpi, and project theme boolean mixed
             // into the theme name.
@@ -2419,8 +1345,8 @@
 
             return bridge.bridge.computeLayout(layoutDescription,
                     projectKey, screenWidth, screenHeight, themeName,
-                    mConfiguredProjectRes, frameworkResources, mProjectCallback,
-                    mLogger);
+                    projectResources, frameworkResources, projectCallback,
+                    logger);
         }
     }
 }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/IGraphicalLayoutEditor.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/IGraphicalLayoutEditor.java
new file mode 100755
index 0000000..5816af6
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/IGraphicalLayoutEditor.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.layout;
+
+import com.android.ide.eclipse.adt.internal.editors.layout.parts.ElementCreateCommand;
+import com.android.ide.eclipse.adt.internal.editors.uimodel.UiDocumentNode;
+import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
+import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
+
+import org.eclipse.gef.ui.parts.SelectionSynchronizer;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ * Interface defining what {@link LayoutEditor} expects from a GraphicalLayoutEditor part.
+ *
+ * @since GLE2
+ */
+/*package*/ interface IGraphicalLayoutEditor extends IEditorPart {
+
+    /**
+     * Sets the UI for the edition of a new file.
+     * @param configuration the configuration of the new file.
+     */
+    abstract void editNewFile(FolderConfiguration configuration);
+
+    /**
+     * Reloads this editor, by getting the new model from the {@link LayoutEditor}.
+     */
+    abstract void reloadEditor();
+
+    /**
+     * Callback for XML model changed. Only update/recompute the layout if the editor is visible
+     */
+    abstract void onXmlModelChanged();
+
+    /**
+     * Responds to a page change that made the Graphical editor page the activated page.
+     */
+    abstract void activated();
+
+    /**
+     * Responds to a page change that made the Graphical editor page the deactivated page
+     */
+    abstract void deactivated();
+
+    /**
+     * Used by LayoutEditor.UiEditorActions.selectUiNode to select a new UI Node
+     * created by  {@link ElementCreateCommand#execute()}.
+     *
+     * @param uiNodeModel The {@link UiElementNode} to select.
+     */
+    abstract void selectModel(UiElementNode uiNodeModel);
+
+    /**
+     * Returns the selection synchronizer object.
+     * The synchronizer can be used to sync the selection of 2 or more EditPartViewers.
+     */
+    abstract public SelectionSynchronizer getSelectionSynchronizer();
+
+    abstract void reloadPalette();
+
+    abstract void recomputeLayout();
+
+    abstract UiDocumentNode getModel();
+
+    abstract LayoutEditor getLayoutEditor();
+
+    abstract Clipboard getClipboard();
+
+    abstract void reloadConfigurationUi(boolean notifyListener);
+
+}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutCanvas.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutCanvas.java
new file mode 100755
index 0000000..a0de610
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutCanvas.java
@@ -0,0 +1,774 @@
+/*

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.eclipse.org/org/documents/epl-v10.php

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package com.android.ide.eclipse.adt.internal.editors.layout;

+

+import com.android.layoutlib.api.ILayoutResult;

+import com.android.layoutlib.api.ILayoutResult.ILayoutViewInfo;

+

+import org.eclipse.swt.SWT;

+import org.eclipse.swt.events.MouseEvent;

+import org.eclipse.swt.events.MouseListener;

+import org.eclipse.swt.events.MouseMoveListener;

+import org.eclipse.swt.events.PaintEvent;

+import org.eclipse.swt.events.PaintListener;

+import org.eclipse.swt.graphics.Color;

+import org.eclipse.swt.graphics.Font;

+import org.eclipse.swt.graphics.FontMetrics;

+import org.eclipse.swt.graphics.GC;

+import org.eclipse.swt.graphics.Image;

+import org.eclipse.swt.graphics.ImageData;

+import org.eclipse.swt.graphics.PaletteData;

+import org.eclipse.swt.graphics.Rectangle;

+import org.eclipse.swt.widgets.Canvas;

+import org.eclipse.swt.widgets.Composite;

+import org.eclipse.swt.widgets.Display;

+

+import java.awt.image.BufferedImage;

+import java.awt.image.DataBufferInt;

+import java.awt.image.Raster;

+import java.util.ArrayList;

+import java.util.LinkedList;

+import java.util.List;

+import java.util.ListIterator;

+

+/**

+ * Displays the image rendered by the {@link GraphicalEditorPart} and handles

+ * the interaction with the widgets.

+ * <p/>

+ *

+ * @since GLE2

+ *

+ * TODO list:

+ * - gray on error, keep select but disable d'n'd.

+ * - make sure it is scrollable (Canvas derives from Scrollable, so prolly just setting bounds.)

+ * - handle drop target (from palette).

+ * - handle drag'n'drop (internal, for moving/duplicating).

+ * - handle context menu (depending on selection).

+ * - selection synchronization with the outline (both ways).

+ */

+public class LayoutCanvas extends Canvas {

+

+    /**

+     * Margin around the rendered image. Should be enough space to display the layout

+     * width and height pseudo widgets.

+     */

+    private static final int IMAGE_MARGIN = 5;

+    /**

+     * Minimal size of the selection, in case an empty view or layout is selected.

+     */

+    private static final int SELECTION_MIN_SIZE = 6;

+

+    private ILayoutResult mLastValidResult;

+    private ViewInfo mLastValidViewInfoRoot;

+

+    /** Current background image. Null when there's no image. */

+    private Image mImage;

+

+    private final LinkedList<Selection> mSelections = new LinkedList<Selection>();

+

+    /** Selection border color. Do not dispose, it's a system color. */

+    private Color mSelectionFgColor;

+

+    /** Selection name font. Do not dispose, it's a system font. */

+    private Font mSelectionFont;

+

+    /** Pixel height of the font displaying the selection name. Initially set to 0 and only

+     * initialized in onPaint() when we have a GC. */

+    private int mSelectionFontHeight;

+

+    /** Current hover view info. Null when no mouse hover. */

+    private ViewInfo mHoverViewInfo;

+

+    /** Current mouse hover border rectangle. Null when there's no mouse hover. */

+    private Rectangle mHoverRect;

+

+    /** Hover border color. Must be disposed, it's NOT a system color. */

+    private Color mHoverFgColor;

+

+    private AlternateSelection mAltSelection;

+

+    /**

+     * True when the last {@link #setResult(ILayoutResult)} provided a valid {@link ILayoutResult}

+     * in which case it is also available in {@link #mLastValidResult}.

+     * When false this means the canvas is displaying an out-dated result image & bounds and some

+     * features should be disabled accordingly such a drag'n'drop.

+     */

+    private boolean mIsResultValid;

+

+

+    public LayoutCanvas(Composite parent, int style) {

+        super(parent, style | SWT.DOUBLE_BUFFERED);

+

+        Display d = getDisplay();

+        mSelectionFgColor = d.getSystemColor(SWT.COLOR_RED);

+        mHoverFgColor     = new Color(d, 0xFF, 0x99, 0x00); // orange

+        mSelectionFont    = d.getSystemFont();

+

+        addPaintListener(new PaintListener() {

+            public void paintControl(PaintEvent e) {

+                onPaint(e);

+            }

+        });

+

+        addMouseMoveListener(new MouseMoveListener() {

+            public void mouseMove(MouseEvent e) {

+                onMouseMove(e);

+            }

+        });

+

+        addMouseListener(new MouseListener() {

+            public void mouseUp(MouseEvent e) {

+                onMouseUp(e);

+            }

+

+            public void mouseDown(MouseEvent e) {

+                onMouseDown(e);

+            }

+

+            public void mouseDoubleClick(MouseEvent e) {

+                onDoubleClick(e);

+            }

+        });

+    }

+

+    @Override

+    public void dispose() {

+        super.dispose();

+    }

+

+    /**

+     * Sets the result of the layout rendering. The result object indicates if the layout

+     * rendering succeeded. If it did, it contains a bitmap and the objects rectangles.

+     *

+     * Implementation detail: the bridge's computeLayout() method already returns a newly

+     * allocated ILayourResult. That means we can keep this result and hold on to it

+     * when it is valid.

+     *

+     * @param result The new rendering result, either valid or not.

+     */

+    public void setResult(ILayoutResult result) {

+

+        // disable any hover

+        mHoverRect = null;

+

+        mIsResultValid = (result != null && result.getSuccess() == ILayoutResult.SUCCESS);

+

+        if (mIsResultValid && result != null) {

+            mLastValidResult = result;

+            mLastValidViewInfoRoot = new ViewInfo(result.getRootView());

+            setImage(result.getImage());

+

+            // Check if the selection is still the same (based on the object keys)

+            // and eventually recompute their bounds.

+            for (ListIterator<Selection> it = mSelections.listIterator(); it.hasNext(); ) {

+                Selection s = it.next();

+

+                // Check the if the selected object still exists

+                Object key = s.getViewInfo().getKey();

+                ViewInfo vi = findViewInfoKey(key, mLastValidViewInfoRoot);

+

+                // Remove the previous selection -- if the selected object still exists

+                // we need to recompute its bounds in case it moved so we'll insert a new one

+                // at the same place.

+                it.remove();

+                if (vi != null) {

+                    it.add(new Selection(vi));

+                }

+            }

+

+            // remove the current alternate selection views

+            mAltSelection = null;

+        }

+

+        redraw();

+    }

+

+    //---

+

+    /**

+     * Sets the image of the last *successful* rendering.

+     * Converts the AWT image into an SWT image.

+     */

+    private void setImage(BufferedImage awtImage) {

+        int width = awtImage.getWidth();

+        int height = awtImage.getHeight();

+

+        Raster raster = awtImage.getData(new java.awt.Rectangle(width, height));

+        int[] imageDataBuffer = ((DataBufferInt)raster.getDataBuffer()).getData();

+

+        ImageData imageData = new ImageData(width, height, 32,

+                new PaletteData(0x00FF0000, 0x0000FF00, 0x000000FF));

+

+        imageData.setPixels(0, 0, imageDataBuffer.length, imageDataBuffer, 0);

+

+        mImage = new Image(getDisplay(), imageData);

+    }

+

+    /**

+     * Paints the canvas in response to paint events.

+     */

+    private void onPaint(PaintEvent e) {

+        GC gc = e.gc;

+

+        if (mImage != null) {

+            if (!mIsResultValid) {

+                gc.setAlpha(128);

+            }

+

+            gc.drawImage(mImage, IMAGE_MARGIN, IMAGE_MARGIN);

+

+            if (!mIsResultValid) {

+                gc.setAlpha(255);

+            }

+        }

+

+        if (mHoverRect != null) {

+            gc.setForeground(mHoverFgColor);

+            gc.setLineStyle(SWT.LINE_DOT);

+            gc.drawRectangle(mHoverRect);

+        }

+

+        // initialize the selection font height once. We need the GC to do that.

+        if (mSelectionFontHeight == 0) {

+            gc.setFont(mSelectionFont);

+            FontMetrics fm = gc.getFontMetrics();

+            mSelectionFontHeight = fm.getHeight();

+        }

+

+        for (Selection s : mSelections) {

+            drawSelection(gc, s);

+        }

+    }

+

+    private void drawSelection(GC gc, Selection s) {

+        Rectangle r = s.getRect();

+

+        gc.setForeground(mSelectionFgColor);

+        gc.setLineStyle(SWT.LINE_SOLID);

+        gc.drawRectangle(s.mRect);

+

+        String name = s.getName();

+

+        if (name != null) {

+            int xs = r.x + 2;

+            int ys = r.y - mSelectionFontHeight;

+            if (ys < 0) {

+                ys = r.y + r.height;

+            }

+            gc.drawString(name, xs, ys, true /*transparent*/);

+        }

+    }

+

+    /**

+     * Hover on top of a known child.

+     */

+    private void onMouseMove(MouseEvent e) {

+        if (mLastValidResult != null) {

+            ViewInfo root = mLastValidViewInfoRoot;

+            ViewInfo vi = findViewInfoAt(e.x - IMAGE_MARGIN, e.y - IMAGE_MARGIN, root);

+

+            // We don't hover on the root since it's not a widget per see and it is always there.

+            if (vi == root) {

+                vi = null;

+            }

+

+            boolean needsUpdate = vi != mHoverViewInfo;

+            mHoverViewInfo = vi;

+

+            if (vi == null) {

+                mHoverRect = null;

+            } else {

+                Rectangle r = vi.getSelectionRect();

+                mHoverRect = new Rectangle(r.x + IMAGE_MARGIN, r.y + IMAGE_MARGIN,

+                                           r.width, r.height);

+            }

+

+            if (needsUpdate) {

+                redraw();

+            }

+        }

+    }

+

+    private void onMouseDown(MouseEvent e) {

+        // pass, not used yet.

+    }

+

+    /**

+     * Performs selection on mouse up (not mouse down).

+     * <p/>

+     * Shift key is used to toggle in multi-selection.

+     * Alt key is used to cycle selection through objects at the same level than the one

+     * pointed at (i.e. click on an object then alt-click to cycle).

+     */

+    private void onMouseUp(MouseEvent e) {

+        if (mLastValidResult != null) {

+

+            boolean isShift = (e.stateMask & SWT.SHIFT) != 0;

+            boolean isAlt   = (e.stateMask & SWT.ALT)   != 0;

+

+            int x = e.x - IMAGE_MARGIN;

+            int y = e.y - IMAGE_MARGIN;

+            ViewInfo vi = findViewInfoAt(x, y, mLastValidViewInfoRoot);

+

+            if (isShift && !isAlt) {

+                // Case where shift is pressed: pointed object is toggled.

+

+                // reset alternate selection if any

+                mAltSelection = null;

+

+                // If nothing has been found at the cursor, assume it might be a user error

+                // and avoid clearing the existing selection.

+

+                if (vi != null) {

+                    // toggle this selection on-off: remove it if already selected

+                    if (deselect(vi)) {

+                        redraw();

+                        return;

+                    }

+

+                    // otherwise add it.

+                    mSelections.add(new Selection(vi));

+                    redraw();

+                }

+

+            } else if (isAlt) {

+                // Case where alt is pressed: select or cycle the object pointed at.

+

+                // Note: if shift and alt are pressed, shift is ignored. The alternate selection

+                // mechanism does not reset the current multiple selection unless they intersect.

+

+                // We need to remember the "origin" of the alternate selection, to be

+                // able to continue cycling through it later. If there's no alternate selection,

+                // create one. If there's one but not for the same origin object, create a new

+                // one too.

+                if (mAltSelection == null || mAltSelection.getOriginatingView() != vi) {

+                    mAltSelection = new AlternateSelection(vi, findAltViewInfoAt(

+                                                    x, y, mLastValidViewInfoRoot, null));

+

+                    // deselect them all, in case they were partially selected

+                    deselectAll(mAltSelection.getAltViews());

+

+                    // select the current one

+                    ViewInfo vi2 = mAltSelection.getCurrent();

+                    if (vi2 != null) {

+                        mSelections.addFirst(new Selection(vi2));

+                    }

+                } else {

+                    // We're trying to cycle through the current alternate selection.

+                    // First remove the current object.

+                    ViewInfo vi2 = mAltSelection.getCurrent();

+                    deselect(vi2);

+

+                    // Now select the next one.

+                    vi2 = mAltSelection.getNext();

+                    if (vi2 != null) {

+                        mSelections.addFirst(new Selection(vi2));

+                    }

+                }

+                redraw();

+

+            } else {

+                // Case where no modifier is pressed: either select or reset the selection.

+

+                // reset alternate selection if any

+                mAltSelection = null;

+

+                // reset (multi)selection if any

+                if (mSelections.size() > 0) {

+                    if (mSelections.size() == 1 && mSelections.getFirst().getViewInfo() == vi) {

+                        // Selection remains the same, don't touch it.

+                        return;

+                    }

+                    mSelections.clear();

+                }

+

+                if (vi != null) {

+                    mSelections.add(new Selection(vi));

+                }

+                redraw();

+            }

+        }

+    }

+

+    /** Deselects a view info. Returns true if the object was actually selected. */

+    private boolean deselect(ViewInfo viewInfo) {

+        if (viewInfo == null) {

+            return false;

+        }

+

+        for (ListIterator<Selection> it = mSelections.listIterator(); it.hasNext(); ) {

+            Selection s = it.next();

+            if (viewInfo == s.getViewInfo()) {

+                it.remove();

+                return true;

+            }

+        }

+

+        return false;

+    }

+

+    /** Deselects multiple view infos, */

+    private void deselectAll(List<ViewInfo> viewInfos) {

+        for (ListIterator<Selection> it = mSelections.listIterator(); it.hasNext(); ) {

+            Selection s = it.next();

+            if (viewInfos.contains(s.getViewInfo())) {

+                it.remove();

+            }

+        }

+    }

+

+    private void onDoubleClick(MouseEvent e) {

+        // pass, not used yet.

+    }

+

+    /**

+     * Tries to find a child with the same view key in the view info sub-tree.

+     * Returns null if not found.

+     */

+    private ViewInfo findViewInfoKey(Object viewKey, ViewInfo viewInfo) {

+        if (viewInfo.getKey() == viewKey) {

+            return viewInfo;

+        }

+

+        // try to find a matching child

+        for (ViewInfo child : viewInfo.getChildren()) {

+            ViewInfo v = findViewInfoKey(viewKey, child);

+            if (v != null) {

+                return v;

+            }

+        }

+

+        return null;

+    }

+

+    /**

+     * Tries to find the inner most child matching the given x,y coordinates in the view

+     * info sub-tree. This uses the potentially-expanded selection bounds.

+     *

+     * Returns null if not found.

+     */

+    private ViewInfo findViewInfoAt(int x, int y, ViewInfo viewInfo) {

+        Rectangle r = viewInfo.getSelectionRect();

+        if (r.contains(x, y)) {

+

+            // try to find a matching child first

+            for (ViewInfo child : viewInfo.getChildren()) {

+                ViewInfo v = findViewInfoAt(x, y, child);

+                if (v != null) {

+                    return v;

+                }

+            }

+

+            // if no children matched, this is the view that we're looking for

+            return viewInfo;

+        }

+

+        return null;

+    }

+

+    private ArrayList<ViewInfo> findAltViewInfoAt(

+            int x, int y, ViewInfo parent, ArrayList<ViewInfo> outList) {

+        Rectangle r;

+

+        if (outList == null) {

+            outList = new ArrayList<ViewInfo>();

+

+            // add the parent root only once

+            r = parent.getSelectionRect();

+            if (r.contains(x, y)) {

+                outList.add(parent);

+            }

+        }

+

+        if (parent.getChildren().size() > 0) {

+            // then add all children that match the position

+            for (ViewInfo child : parent.getChildren()) {

+                r = child.getSelectionRect();

+                if (r.contains(x, y)) {

+                    outList.add(child);

+                }

+            }

+

+            // finally recurse in the children

+            for (ViewInfo child : parent.getChildren()) {

+                r = child.getSelectionRect();

+                if (r.contains(x, y)) {

+                    findAltViewInfoAt(x, y, child, outList);

+                }

+            }

+        }

+

+        return outList;

+    }

+

+    /**

+     * Maps a {@link ILayoutViewInfo} in a structure more adapted to our needs.

+     * The only large difference is that we keep both the original bounds of the view info

+     * and we pre-compute the selection bounds which are absolute to the rendered image (where

+     * as the original bounds are relative to the parent view.)

+     * <p/>

+     * Each view also know its parent, which should be handy later.

+     * <p/>

+     * We can't alter {@link ILayoutViewInfo} as it is part of the LayoutBridge and needs to

+     * have a fixed API.

+     */

+    private static class ViewInfo {

+        private final Rectangle mRealRect;

+        private final Rectangle mSelectionRect;

+        private final String mName;

+        private final Object mKey;

+        private final ViewInfo mParent;

+        private final ArrayList<ViewInfo> mChildren = new ArrayList<ViewInfo>();

+

+        /**

+         * Constructs a {@link ViewInfo} hierarchy based on a given {@link ILayoutViewInfo}

+         * hierarchy. This call is recursives and builds a full tree.

+         *

+         * @param viewInfo The root of the {@link ILayoutViewInfo} hierarchy.

+         */

+        public ViewInfo(ILayoutViewInfo viewInfo) {

+            this(viewInfo, null /*parent*/, 0 /*parentX*/, 0 /*parentY*/);

+        }

+

+        private ViewInfo(ILayoutViewInfo viewInfo, ViewInfo parent, int parentX, int parentY) {

+            mParent = parent;

+            mKey  = viewInfo.getViewKey();

+            mName = viewInfo.getName();

+

+            int x = viewInfo.getLeft();

+            int y = viewInfo.getTop();

+            int w = viewInfo.getRight() - x;

+            int h = viewInfo.getBottom() - y;

+

+            mRealRect = new Rectangle(x, y, w, h);

+

+            if (parent != null) {

+                x += parentX;

+                y += parentY;

+            }

+

+            if (viewInfo.getChildren() != null) {

+                for (ILayoutViewInfo child : viewInfo.getChildren()) {

+                    mChildren.add(new ViewInfo(child, this, x, y));

+                }

+            }

+

+            // adjust selection bounds for views which are too small to select

+

+            if (w < SELECTION_MIN_SIZE) {

+                int d = (SELECTION_MIN_SIZE - w) / 2;

+                x -= d;

+                w += SELECTION_MIN_SIZE - w;

+            }

+

+            if (h < SELECTION_MIN_SIZE) {

+                int d = (SELECTION_MIN_SIZE - h) / 2;

+                y -= d;

+                h += SELECTION_MIN_SIZE - h;

+            }

+

+            mSelectionRect = new Rectangle(x, y, w - 1, h - 1);

+        }

+

+        /** Returns the original {@link ILayoutResult} bounds, relative to the parent. */

+        public Rectangle getRealRect() {

+            return mRealRect;

+        }

+

+        /*

+        * Returns the absolute selection bounds of the view info as a rectangle.

+        * The selection bounds will always have a size greater or equal to

+        * {@link #SELECTION_MIN_SIZE}.

+        * The width/height is inclusive (i.e. width = right-left-1).

+        * This is in absolute "screen" coordinates (relative to the rendered bitmap).

+        */

+        public Rectangle getSelectionRect() {

+            return mSelectionRect;

+        }

+

+        /**

+         * Returns the view key. Could be null, although unlikely.

+         * @see ILayoutViewInfo#getViewKey()

+         */

+        public Object getKey() {

+            return mKey;

+        }

+

+        /**

+         * Returns the parent {@link ViewInfo}.

+         * It is null for the root and non-null for children.

+         */

+        public ViewInfo getParent() {

+            return mParent;

+        }

+

+        /**

+         * Returns the list of children of this {@link ViewInfo}.

+         * The list is never null. It can be empty.

+         * By contract, this.getChildren().get(0..n-1).getParent() == this.

+         */

+        public ArrayList<ViewInfo> getChildren() {

+            return mChildren;

+        }

+

+        /**

+         * Returns the name of the {@link ViewInfo}.

+         * Could be null, although unlikely.

+         * Experience shows this is the full qualified Java name of the View.

+         * @see ILayoutViewInfo#getName()

+         */

+        public String getName() {

+            return mName;

+        }

+    }

+

+    /**

+     * Represents one selection.

+     */

+    private static class Selection {

+        /** Current selected view info. Cannot be null. */

+        private final ViewInfo mViewInfo;

+

+        /** Current selection border rectangle. Cannot be null. */

+        private final Rectangle mRect;

+

+        /** The name displayed over the selection, typically the widget class name. Can be null. */

+        private final String mName;

+

+        /**

+         * Creates a new {@link Selection} object.

+         * @param viewInfo The view info being selected. Must not be null.

+         */

+        public Selection(ViewInfo viewInfo) {

+

+            assert viewInfo != null;

+

+            mViewInfo = viewInfo;

+

+            if (viewInfo == null) {

+                mRect = null;

+            } else {

+                Rectangle r = viewInfo.getSelectionRect();

+                mRect = new Rectangle(r.x + IMAGE_MARGIN, r.y + IMAGE_MARGIN, r.width, r.height);

+            }

+

+            String name = viewInfo == null ? null : viewInfo.getName();

+            if (name != null) {

+                // The name is typically a fully-qualified class name. Let's make it a tad shorter.

+

+                if (name.startsWith("android.")) {                                      // $NON-NLS-1$

+                    // For android classes, convert android.foo.Name to android...Name

+                    int first = name.indexOf('.');

+                    int last = name.lastIndexOf('.');

+                    if (last > first) {

+                        name = name.substring(0, first) + ".." + name.substring(last);   // $NON-NLS-1$

+                    }

+                } else {

+                    // For custom non-android classes, it's best to keep the 2 first segments of

+                    // the namespace, e.g. we want to get something like com.example...MyClass

+                    int first = name.indexOf('.');

+                    first = name.indexOf('.', first + 1);

+                    int last = name.lastIndexOf('.');

+                    if (last > first) {

+                        name = name.substring(0, first) + ".." + name.substring(last);   // $NON-NLS-1$

+                    }

+                }

+            }

+

+            mName = name;

+        }

+

+        /**

+         * Returns the selected view info. Cannot be null.

+         */

+        public ViewInfo getViewInfo() {

+            return mViewInfo;

+        }

+

+        /**

+         * Returns the selection border rectangle.

+         * Cannot be null.

+         */

+        public Rectangle getRect() {

+            return mRect;

+        }

+

+        /**

+         * The name displayed over the selection, typically the widget class name.

+         * Can be null.

+         */

+        public String getName() {

+            return mName;

+        }

+    }

+

+    /**

+     * Information for the current alternate selection, i.e. the possible selected items

+     * that are located at the same x/y as the original view, either sibling or parents.

+     */

+    private static class AlternateSelection {

+        private final ViewInfo mOriginatingView;

+        private final List<ViewInfo> mAltViews;

+        private int mIndex;

+

+        /**

+         * Creates a new alternate selection based on the given originating view and the

+         * given list of alternate views. Both cannot be null.

+         */

+        public AlternateSelection(ViewInfo originatingView, List<ViewInfo> altViews) {

+            assert originatingView != null;

+            assert altViews != null;

+            mOriginatingView = originatingView;

+            mAltViews = altViews;

+            mIndex = altViews.size() - 1;

+        }

+

+        /** Returns the list of alternate views. Cannot be null. */

+        public List<ViewInfo> getAltViews() {

+            return mAltViews;

+        }

+

+        /** Returns the originating view. Cannot be null. */

+        public ViewInfo getOriginatingView() {

+            return mOriginatingView;

+        }

+

+        /**

+         * Returns the current alternate view to select.

+         * Initially this is the top-most view.

+         */

+        public ViewInfo getCurrent() {

+            return mIndex >= 0 ? mAltViews.get(mIndex) : null;

+        }

+

+        /**

+         * Changes the current view to be the next one and then returns it.

+         * This loops through the alternate views.

+         */

+        public ViewInfo getNext() {

+            if (mIndex == 0) {

+                mIndex = mAltViews.size() - 1;

+            } else if (mIndex > 0) {

+                mIndex--;

+            }

+

+            return getCurrent();

+        }

+    }

+

+

+}

diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutCreatorDialog.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutCreatorDialog.java
deleted file mode 100644
index a55f1d0..0000000
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutCreatorDialog.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.ide.eclipse.adt.internal.editors.layout;
-
-import com.android.ide.eclipse.adt.internal.editors.IconFactory;
-import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
-import com.android.ide.eclipse.adt.internal.resources.configurations.ResourceQualifier;
-import com.android.ide.eclipse.adt.internal.resources.manager.ResourceFolderType;
-import com.android.ide.eclipse.adt.internal.ui.ConfigurationSelector;
-import com.android.ide.eclipse.adt.internal.ui.ConfigurationSelector.ConfigurationState;
-import com.android.sdklib.IAndroidTarget;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.TrayDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Dialog to choose a non existing {@link FolderConfiguration}.
- */
-class LayoutCreatorDialog extends TrayDialog {
-
-    private ConfigurationSelector mSelector;
-    private Composite mStatusComposite;
-    private Label mStatusLabel;
-    private Label mStatusImage;
-
-    private final FolderConfiguration mConfig = new FolderConfiguration();
-    private final String mFileName;
-    private final IAndroidTarget mTarget;
-
-    /**
-     * Creates a dialog, and init the UI from a {@link FolderConfiguration}.
-     * @param parentShell the parent {@link Shell}.
-     * @param config The starting configuration.
-     */
-    LayoutCreatorDialog(Shell parentShell, String fileName, IAndroidTarget target,
-            FolderConfiguration config) {
-        super(parentShell);
-
-        mFileName = fileName;
-        mTarget = target;
-
-        // FIXME: add some data to know what configurations already exist.
-        mConfig.set(config);
-    }
-
-    @Override
-    protected Control createDialogArea(Composite parent) {
-        Composite top = new Composite(parent, SWT.NONE);
-        top.setLayoutData(new GridData());
-        top.setLayout(new GridLayout(1, false));
-
-        new Label(top, SWT.NONE).setText(
-                String.format("Configuration for the alternate version of %1$s", mFileName));
-
-        mSelector = new ConfigurationSelector(top);
-        mSelector.setConfiguration(mConfig);
-
-        // parent's layout is a GridLayout as specified in the javadoc.
-        GridData gd = new GridData();
-        gd.widthHint = ConfigurationSelector.WIDTH_HINT;
-        gd.heightHint = ConfigurationSelector.HEIGHT_HINT;
-        mSelector.setLayoutData(gd);
-
-        // add a listener to check on the validity of the FolderConfiguration as
-        // they are built.
-        mSelector.setOnChangeListener(new Runnable() {
-            public void run() {
-                ConfigurationState state = mSelector.getState();
-
-                switch (state) {
-                    case OK:
-                        mSelector.getConfiguration(mConfig);
-
-                        resetStatus();
-                        mStatusImage.setImage(null);
-                        getButton(IDialogConstants.OK_ID).setEnabled(true);
-                        break;
-                    case INVALID_CONFIG:
-                        ResourceQualifier invalidQualifier = mSelector.getInvalidQualifier();
-                        mStatusLabel.setText(String.format(
-                                "Invalid Configuration: %1$s has no filter set.",
-                                invalidQualifier.getName()));
-                        mStatusImage.setImage(IconFactory.getInstance().getIcon("warning")); //$NON-NLS-1$
-                        getButton(IDialogConstants.OK_ID).setEnabled(false);
-                        break;
-                    case REGION_WITHOUT_LANGUAGE:
-                        mStatusLabel.setText(
-                                "The Region qualifier requires the Language qualifier.");
-                        mStatusImage.setImage(IconFactory.getInstance().getIcon("warning")); //$NON-NLS-1$
-                        getButton(IDialogConstants.OK_ID).setEnabled(false);
-                        break;
-                }
-
-                // need to relayout, because of the change in size in mErrorImage.
-                mStatusComposite.layout();
-            }
-        });
-
-        mStatusComposite = new Composite(top, SWT.NONE);
-        mStatusComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-        GridLayout gl = new GridLayout(2, false);
-        mStatusComposite.setLayout(gl);
-        gl.marginHeight = gl.marginWidth = 0;
-
-        mStatusImage = new Label(mStatusComposite, SWT.NONE);
-        mStatusLabel = new Label(mStatusComposite, SWT.NONE);
-        mStatusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-        resetStatus();
-
-        return top;
-    }
-
-    public void getConfiguration(FolderConfiguration config) {
-        config.set(mConfig);
-    }
-
-    /**
-     * resets the status label to show the file that will be created.
-     */
-    private void resetStatus() {
-        mStatusLabel.setText(String.format("New File: res/%1$s/%2$s",
-                mConfig.getFolderName(ResourceFolderType.LAYOUT, mTarget), mFileName));
-    }
-}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditor.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditor.java
index 6226b7b..99670d8 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditor.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditor.java
@@ -46,7 +46,7 @@
 import org.w3c.dom.Document;
 
 /**
- * Multi-page form editor for /res/layout XML files. 
+ * Multi-page form editor for /res/layout XML files.
  */
 public class LayoutEditor extends AndroidEditor implements IShowEditorInput, IPartListener {
 
@@ -54,8 +54,8 @@
 
     /** Root node of the UI element hierarchy */
     private UiDocumentNode mUiRootNode;
-    
-    private AbstractGraphicalLayoutEditor mGraphicalEditor;
+
+    private IGraphicalLayoutEditor mGraphicalEditor;
     private int mGraphicalEditorIndex;
     /** Implementation of the {@link IContentOutlinePage} for this editor */
     private UiContentOutlinePage mOutline;
@@ -63,7 +63,7 @@
     private UiPropertySheetPage mPropertyPage;
 
     private UiEditorActions mUiEditorActions;
-   
+
     /**
      * Creates the form editor for resources XML files.
      */
@@ -87,7 +87,7 @@
 
         super.dispose();
     }
-    
+
     /**
      * Save the XML.
      * <p/>
@@ -105,12 +105,12 @@
             mGraphicalEditor.doSave(monitor);
         }
     }
-    
+
     /**
      * Returns whether the "save as" operation is supported by this editor.
      * <p/>
      * Save-As is a valid operation for the ManifestEditor since it acts on a
-     * single source file. 
+     * single source file.
      *
      * @see IEditorPart
      */
@@ -128,9 +128,15 @@
             // The graphical layout editor is now enabled by default.
             // In case there's an issue we provide a way to disable it using an
             // env variable.
-            if (System.getenv("ANDROID_DISABLE_LAYOUT") == null) {
+            if (System.getenv("ANDROID_DISABLE_LAYOUT") == null) {      //$NON-NLS-1$
                 if (mGraphicalEditor == null) {
-                    mGraphicalEditor = new GraphicalLayoutEditor(this);
+
+                    if (System.getenv("USE_GLE2") != null) {            //$NON-NLS-1$ //$NON-NLS-2$
+                        mGraphicalEditor = new GraphicalEditorPart(this);
+                    } else {
+                        mGraphicalEditor = new GraphicalLayoutEditor(this);
+                    }
+
                     mGraphicalEditorIndex = addPage(mGraphicalEditor, getEditorInput());
                     setPageText(mGraphicalEditorIndex, mGraphicalEditor.getTitle());
                 } else {
@@ -174,7 +180,7 @@
         super.setInputWithNotify(input);
         handleNewInput(input);
     }
-    
+
     /**
      * Called to replace the current {@link IEditorInput} with another one.
      * <p/>This is used when {@link MatchingStrategy} returned <code>true</code> which means we're
@@ -183,10 +189,10 @@
     public void showEditorInput(IEditorInput editorInput) {
         // save the current editor input.
         doSave(new NullProgressMonitor());
-        
+
         // get the current page
         int currentPage = getActivePage();
-        
+
         // remove the pages, except for the graphical editor, which will be dynamically adapted
         // to the new model.
         // page after the graphical editor:
@@ -198,10 +204,10 @@
         for (int i = mGraphicalEditorIndex - 1 ; i >= 0 ; i--) {
             removePage(i);
         }
-        
+
         // set the current input.
         setInputWithNotify(editorInput);
-        
+
         // re-create or reload the pages with the default page shown as the previous active page.
         createAndroidPages();
         selectDefaultPage(Integer.toString(currentPage));
@@ -211,10 +217,10 @@
             mOutline.reloadModel();
         }
     }
-    
+
     /**
      * Processes the new XML Model, which XML root node is given.
-     * 
+     *
      * @param xml_doc The XML document, if available, or null if none exists.
      */
     @Override
@@ -226,16 +232,16 @@
 
         // update the model first, since it is used by the viewers.
         super.xmlModelChanged(xml_doc);
-        
+
         if (mGraphicalEditor != null) {
             mGraphicalEditor.onXmlModelChanged();
         }
-        
+
         if (mOutline != null) {
             mOutline.reloadModel();
         }
     }
-    
+
     /* (non-java doc)
      * Returns the IContentOutlinePage when asked for it.
      */
@@ -246,29 +252,33 @@
         // This fixes the case where a layout file is opened in XML view first and the outline
         // gets stuck in the XML outline.
         if (IContentOutlinePage.class == adapter && mGraphicalEditor != null) {
-            if (mOutline == null) {
-                mOutline = new UiContentOutlinePage(mGraphicalEditor, new TreeViewer());
+
+            if (mOutline == null && mGraphicalEditor instanceof GraphicalLayoutEditor) {
+                // TODO add support for GLE2
+                mOutline = new UiContentOutlinePage(
+                        (GraphicalLayoutEditor) mGraphicalEditor,
+                        new TreeViewer());
             }
-            
+
             return mOutline;
         }
-        
+
         if (IPropertySheetPage.class == adapter && mGraphicalEditor != null) {
             if (mPropertyPage == null) {
                 mPropertyPage = new UiPropertySheetPage();
             }
-            
+
             return mPropertyPage;
         }
 
         // return default
         return super.getAdapter(adapter);
     }
-    
+
     @Override
     protected void pageChange(int newPageIndex) {
         super.pageChange(newPageIndex);
-        
+
         if (mGraphicalEditor != null) {
             if (newPageIndex == mGraphicalEditorIndex) {
                 mGraphicalEditor.activated();
@@ -277,9 +287,9 @@
             }
         }
     }
-    
+
     // ----- IPartListener Methods ----
-    
+
     public void partActivated(IWorkbenchPart part) {
         if (part == this) {
             if (mGraphicalEditor != null) {
@@ -312,7 +322,7 @@
         EclipseUiHelper.showView(EclipseUiHelper.CONTENT_OUTLINE_VIEW_ID, false /* activate */);
         EclipseUiHelper.showView(EclipseUiHelper.PROPERTY_SHEET_VIEW_ID, false /* activate */);
     }
-    
+
     public class UiEditorActions extends UiActions {
 
         @Override
@@ -331,16 +341,16 @@
             // Pass. There is nothing to commit before the XML is changed here.
         }
     }
-    
+
     public UiEditorActions getUiEditorActions() {
         if (mUiEditorActions == null) {
             mUiEditorActions = new UiEditorActions();
         }
         return mUiEditorActions;
     }
-    
+
     // ---- Local Methods ----
-    
+
     /**
      * Returns true if the Graphics editor page is visible. This <b>must</b> be
      * called from the UI thread.
@@ -357,20 +367,20 @@
         }
 
         return false;
-    }   
-    
+    }
+
     @Override
     protected void initUiRootNode(boolean force) {
         // The root UI node is always created, even if there's no corresponding XML node.
         if (mUiRootNode == null || force) {
             // get the target data from the opened file (and its project)
             AndroidTargetData data = getTargetData();
-            
+
             Document doc = null;
             if (mUiRootNode != null) {
                 doc = mUiRootNode.getXmlDocument();
             }
-            
+
             DocumentDescriptor desc;
             if (data == null) {
                 desc = new DocumentDescriptor("temp", null /*children*/);
@@ -385,21 +395,22 @@
             onDescriptorsChanged(doc);
         }
     }
-    
+
     private void onDescriptorsChanged(Document document) {
         if (document != null) {
             mUiRootNode.loadFromXmlNode(document);
         } else {
             mUiRootNode.reloadFromXmlNode(mUiRootNode.getXmlDocument());
         }
-        
+
         if (mOutline != null) {
             mOutline.reloadModel();
         }
-        
+
         if (mGraphicalEditor != null) {
             mGraphicalEditor.reloadEditor();
             mGraphicalEditor.reloadPalette();
+            mGraphicalEditor.reloadConfigurationUi(true /*notify listener */);
             mGraphicalEditor.recomputeLayout();
         }
     }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutReloadMonitor.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutReloadMonitor.java
index d9e81f5..507cb21 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutReloadMonitor.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutReloadMonitor.java
@@ -31,6 +31,7 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -39,16 +40,16 @@
  * Monitor for file changes triggering a layout redraw.
  */
 public final class LayoutReloadMonitor implements IFileListener, IResourceEventListener {
-    
+
     // singleton, enforced by private constructor.
     private final static LayoutReloadMonitor sThis = new LayoutReloadMonitor();
-    
+
     /**
      * Map of listeners by IProject.
      */
     private final Map<IProject, List<ILayoutReloadListener>> mListenerMap =
         new HashMap<IProject, List<ILayoutReloadListener>>();
-    
+
     private final static int CHANGE_CODE = 0;
     private final static int CHANGE_RESOURCES = 1;
     private final static int CHANGE_R = 2;
@@ -60,7 +61,7 @@
      * <li>CHANGE_R: R clas change flag</li></ul>
      */
     private final Map<IProject, boolean[]> mChangedProjects = new HashMap<IProject, boolean[]>();
-    
+
     /**
      * Classes which implement this interface provide a method to respond to resource changes
      * triggering a layout redraw
@@ -72,22 +73,22 @@
          * @param rChange The trigger happened due to a change in the R class.
          * @param resChange The trigger happened due to a resource change.
          */
-        void reloadLayout(boolean codeChange, boolean rChange, boolean resChange); 
+        void reloadLayout(boolean codeChange, boolean rChange, boolean resChange);
     }
-    
+
     /**
      * Returns the single instance of {@link LayoutReloadMonitor}.
      */
     public static LayoutReloadMonitor getMonitor() {
         return sThis;
     }
-    
+
     private LayoutReloadMonitor() {
         ResourceMonitor monitor = ResourceMonitor.getMonitor();
         monitor.addFileListener(this, IResourceDelta.ADDED | IResourceDelta.CHANGED);
         monitor.addResourceEventListener(this);
     }
-    
+
     /**
      * Adds a listener for a given {@link IProject}.
      * @param project
@@ -100,15 +101,13 @@
                 list = new ArrayList<ILayoutReloadListener>();
                 mListenerMap.put(project, list);
             }
-            
+
             list.add(listener);
         }
     }
-    
+
     /**
      * Removes a listener for a given {@link IProject}.
-     * @param project
-     * @param listener
      */
     public void removeListener(IProject project, ILayoutReloadListener listener) {
         synchronized (mListenerMap) {
@@ -119,10 +118,28 @@
         }
     }
 
+    /**
+     * Removes a listener, no matter which {@link IProject} it was associated with.
+     */
+    public void removeListener(ILayoutReloadListener listener) {
+        synchronized (mListenerMap) {
+
+            for (List<ILayoutReloadListener> list : mListenerMap.values()) {
+                Iterator<ILayoutReloadListener> it = list.iterator();
+                while (it.hasNext()) {
+                    ILayoutReloadListener i = it.next();
+                    if (i == listener) {
+                        it.remove();
+                    }
+                }
+            }
+        }
+    }
+
     /*
      * (non-Javadoc)
      * @see com.android.ide.eclipse.editors.resources.manager.ResourceMonitor.IFileListener#fileChanged(org.eclipse.core.resources.IFile, org.eclipse.core.resources.IMarkerDelta[], int)
-     * 
+     *
      * Callback for ResourceMonitor.IFileListener. Called when a file changed.
      * This records the changes for each project, but does not notify listeners.
      * @see #resourceChangeEventEnd
@@ -137,7 +154,7 @@
                 changeFlags[CHANGE_R]) {
             return;
         }
-        
+
         // now check that the file is *NOT* a layout file (those automatically trigger a layout
         // reload and we don't want to do it twice.
         ResourceFolder resFolder = ResourceManager.getInstance().getResourceFolder(file);
@@ -148,7 +165,7 @@
                     changeFlags = new boolean[CHANGE_COUNT];
                     mChangedProjects.put(project, changeFlags);
                 }
-    
+
                 changeFlags[CHANGE_RESOURCES] = true;
             }
         } else if (AndroidConstants.EXT_CLASS.equals(file.getFileExtension())) {
@@ -171,14 +188,14 @@
             }
         }
     }
-    
+
     /*
      * (non-Javadoc)
      * @see com.android.ide.eclipse.editors.resources.manager.ResourceMonitor.IResourceEventListener#resourceChangeEventStart()
-     * 
+     *
      * Callback for ResourceMonitor.IResourceEventListener. Called at the beginning of a resource
      * change event. This is called once, while fileChanged can be called several times.
-     * 
+     *
      */
     public void resourceChangeEventStart() {
         // nothing to be done here, it all happens in the resourceChangeEventEnd
@@ -187,7 +204,7 @@
     /*
      * (non-Javadoc)
      * @see com.android.ide.eclipse.editors.resources.manager.ResourceMonitor.IResourceEventListener#resourceChangeEventEnd()
-     * 
+     *
      * Callback for ResourceMonitor.IResourceEventListener. Called at the end of a resource
      * change event. This is where we notify the listeners.
      */
@@ -196,9 +213,9 @@
         synchronized (mListenerMap) {
             for (Entry<IProject, boolean[]> project : mChangedProjects.entrySet()) {
                 List<ILayoutReloadListener> listeners = mListenerMap.get(project.getKey());
-                
+
                 boolean[] flags = project.getValue();
-                
+
                 if (listeners != null) {
                     for (ILayoutReloadListener listener : listeners) {
                         listener.reloadLayout(flags[CHANGE_CODE], flags[CHANGE_R],
@@ -207,7 +224,7 @@
                 }
             }
         }
-        
+
         // empty the list.
         mChangedProjects.clear();
     }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/PaletteComposite.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/PaletteComposite.java
new file mode 100755
index 0000000..229494c
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/PaletteComposite.java
@@ -0,0 +1,118 @@
+/*

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.eclipse.org/org/documents/epl-v10.php

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package com.android.ide.eclipse.adt.internal.editors.layout;

+

+import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor;

+import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;

+

+import org.eclipse.swt.SWT;

+import org.eclipse.swt.layout.GridLayout;

+import org.eclipse.swt.widgets.Button;

+import org.eclipse.swt.widgets.Composite;

+import org.eclipse.swt.widgets.Control;

+import org.eclipse.swt.widgets.Label;

+

+import java.util.List;

+

+/**

+ * A palette composite for the {@link GraphicalEditorPart}.

+ * <p/>

+ * The palette contains several groups, each with a UI name (e.g. layouts and views) and each

+ * with a list of element descriptors.

+ * <p/>

+ *

+ * @since GLE2

+ *

+ * TODO list:

+ * - *Mandatory* for a first release:

+ *   - Currently this displays elements as buttons. Eventually this needs to either be replaced

+ *     by custom drawing right in here or we need to use a custom control.

+ *   - Needs to be able to originate drag'n'drop from these controls onto the GEP.

+ *   - Scroll the list.

+ * - For later releases:

+ *   - Ability to collapse palettes or dockable palettes.

+ *   - Different view strategies: big icon, small icons, text vs no text, compact grid.

+ *     - This would only be useful with meaningful icons. Out current 1-letter icons are not enough

+ *       to get rid of text labels.

+ *   - Would be nice to have context-sensitive tools items, e.g. selection arrow tool,

+ *     group selection tool, alignment, etc.

+ */

+public class PaletteComposite extends Composite {

+

+    /**

+     * Create the composite.

+     * @param parent The parent composite.

+     */

+    public PaletteComposite(Composite parent) {

+        super(parent, SWT.BORDER | SWT.V_SCROLL);

+    }

+

+    @Override

+    protected void checkSubclass() {

+        // Disable the check that prevents subclassing of SWT components

+    }

+

+    /**

+     * Load or reload the palette elements by using the layour and view descriptors from the

+     * given target data.

+     *

+     * @param targetData The target data that contains the descriptors. If null or empty,

+     *   no groups will be created.

+     */

+    public void reloadPalette(AndroidTargetData targetData) {

+

+        for (Control c : getChildren()) {

+            c.dispose();

+        }

+

+        if (targetData != null) {

+            GridLayout gl = new GridLayout(1, false);

+            gl.horizontalSpacing = 0;

+            gl.verticalSpacing = 0;

+            gl.marginHeight = 2;

+            gl.marginBottom = 2;

+            gl.marginLeft = 2;

+            gl.marginRight = 2;

+            gl.marginTop = 2;

+            gl.marginBottom = 2;

+            setLayout(gl);

+

+            /* TODO: All this is TEMPORARY. */

+            Label l = new Label(this, SWT.NONE);

+            l.setText("*** PLACEHOLDER ***");  //$NON-NLS-1$

+            l.setToolTipText("Temporary mock for the palette. Needs to scroll, needs no buttons, needs to drag'n'drop."); //$NON-NLS-1$

+

+            addGroup("Layouts", targetData.getLayoutDescriptors().getLayoutDescriptors());

+            addGroup("Views", targetData.getLayoutDescriptors().getViewDescriptors());

+        }

+

+        layout(true);

+    }

+

+    private void addGroup(String uiName, List<ElementDescriptor> descriptors) {

+        Label label = new Label(this, SWT.NONE);

+        label.setText(uiName);

+

+        for (ElementDescriptor desc : descriptors) {

+            Button b = new Button(this, SWT.PUSH);

+            b.setText(desc.getUiName());

+            b.setImage(desc.getIcon());

+            b.setToolTipText(desc.getTooltip());

+            b.setData(desc);

+        }

+    }

+}

diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/PaletteFactory.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/PaletteFactory.java
index 950be13..7bf6acf 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/PaletteFactory.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/PaletteFactory.java
@@ -28,6 +28,8 @@
 
 /**
  * Factory that creates the palette for the {@link GraphicalLayoutEditor}.
+ *
+ * @since GLE1
  */
 public class PaletteFactory {
 
@@ -37,7 +39,7 @@
 
     public static PaletteRoot createPaletteRoot(PaletteRoot currentPalette,
             AndroidTargetData targetData) {
-        
+
         if (currentPalette == null) {
             currentPalette = new PaletteRoot();
         }
@@ -45,7 +47,7 @@
         for (int n = currentPalette.getChildren().size() - 1; n >= 0; n--) {
             currentPalette.getChildren().remove(n);
         }
-        
+
         if (targetData != null) {
             addTools(currentPalette);
             addViews(currentPalette, "Layouts",
@@ -59,7 +61,7 @@
 
     private static void addTools(PaletteRoot paletteRoot) {
         PaletteGroup group = new PaletteGroup("Tools");
-        
+
         // Default tools: selection.
         // Do not use the MarqueeToolEntry since we don't support multiple selection.
         /* -- Do not put the selection tool. It's the unique tool so it looks useless.
@@ -75,7 +77,7 @@
     private static void addViews(PaletteRoot paletteRoot, String groupName,
             List<ElementDescriptor> descriptors) {
         PaletteDrawer group = new PaletteDrawer(groupName);
-        
+
         for (ElementDescriptor desc : descriptors) {
             PaletteTemplateEntry entry = new PaletteTemplateEntry(
                     desc.getUiName(),           // label
@@ -84,10 +86,10 @@
                     desc.getImageDescriptor(),  // small icon
                     desc.getImageDescriptor()   // large icon
                     );
-            
+
             group.add(entry);
         }
-        
+
         paletteRoot.add(group);
     }
 }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiContentOutlinePage.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiContentOutlinePage.java
index 62abd5f..8e15681 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiContentOutlinePage.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiContentOutlinePage.java
@@ -67,29 +67,31 @@
 
 /**
  * Implementation of the {@link ContentOutlinePage} to display {@link UiElementNode}.
+ *
+ * @since GLE1
  */
 class UiContentOutlinePage extends ContentOutlinePage {
 
-    private AbstractGraphicalLayoutEditor mEditor;
-    
+    private GraphicalLayoutEditor mEditor;
+
     private Action mAddAction;
     private Action mDeleteAction;
     private Action mUpAction;
     private Action mDownAction;
-    
+
     private UiOutlineActions mUiActions = new UiOutlineActions();
 
-    public UiContentOutlinePage(AbstractGraphicalLayoutEditor editor, final EditPartViewer viewer) {
+    public UiContentOutlinePage(GraphicalLayoutEditor editor, final EditPartViewer viewer) {
         super(viewer);
         mEditor = editor;
         IconFactory factory = IconFactory.getInstance();
-        
+
         mAddAction = new Action("Add...") {
             @Override
             public void run() {
                 List<UiElementNode> nodes = getModelSelections();
                 UiElementNode node = nodes != null && nodes.size() > 0 ? nodes.get(0) : null;
-                
+
                 mUiActions.doAdd(node, viewer.getControl().getShell());
             }
         };
@@ -100,7 +102,7 @@
             @Override
             public void run() {
                 List<UiElementNode> nodes = getModelSelections();
-                
+
                 mUiActions.doRemove(nodes, viewer.getControl().getShell());
             }
         };
@@ -111,7 +113,7 @@
             @Override
             public void run() {
                 List<UiElementNode> nodes = getModelSelections();
-                
+
                 mUiActions.doUp(nodes);
             }
         };
@@ -122,7 +124,7 @@
             @Override
             public void run() {
                 List<UiElementNode> nodes = getModelSelections();
-                
+
                 mUiActions.doDown(nodes);
             }
         };
@@ -138,7 +140,7 @@
         addSelectionChangedListener(new ISelectionChangedListener() {
             public void selectionChanged(SelectionChangedEvent event) {
                 ISelection selection = event.getSelection();
-                
+
                 // the selection is never empty. The least it'll contain is the
                 // UiDocumentTreeEditPart object.
                 if (selection instanceof StructuredSelection) {
@@ -162,7 +164,7 @@
             }
         });
     }
-    
+
 
     /* (non-Javadoc)
      * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
@@ -184,7 +186,7 @@
     /*
      * (non-Javadoc)
      * @see org.eclipse.ui.part.Page#setActionBars(org.eclipse.ui.IActionBars)
-     * 
+     *
      * Called automatically after createControl
      */
     @Override
@@ -195,7 +197,7 @@
         toolBarManager.add(new Separator());
         toolBarManager.add(mUpAction);
         toolBarManager.add(mDownAction);
-        
+
         IMenuManager menuManager = actionBars.getMenuManager();
         menuManager.add(mAddAction);
         menuManager.add(mDeleteAction);
@@ -222,18 +224,19 @@
     public Control getControl() {
         return getViewer().getControl();
     }
-    
+
     void setNewEditor(GraphicalLayoutEditor editor) {
         mEditor = editor;
         setupOutline();
     }
-    
+
     void breakConnectionWithEditor() {
         // unhook outline viewer
         mEditor.getSelectionSynchronizer().removeViewer(getViewer());
     }
-    
+
     private void setupOutline() {
+
         getViewer().setEditDomain(mEditor.getEditDomain());
 
         // hook outline viewer
@@ -255,13 +258,13 @@
              */
            public void menuAboutToShow(IMenuManager manager) {
                List<UiElementNode> selected = getModelSelections();
-               
+
                if (selected != null) {
                    doCreateMenuAction(manager, selected);
                    return;
                }
                doCreateMenuAction(manager, null /* ui_node */);
-            } 
+            }
         });
         Control control = getControl();
         Menu contextMenu = menuManager.createContextMenu(control);
@@ -271,13 +274,13 @@
     /**
      * Adds the menu actions to the context menu when the given UI node is selected in
      * the tree view.
-     * 
+     *
      * @param manager The context menu manager
      * @param selected The UI node selected in the tree. Can be null, in which case the root
      *                is to be modified.
      */
     private void doCreateMenuAction(IMenuManager manager, List<UiElementNode> selected) {
-        
+
         if (selected != null) {
             boolean hasXml = false;
             for (UiElementNode uiNode : selected) {
@@ -323,14 +326,14 @@
         if (selected != null) {
             manager.add(mDeleteAction);
             manager.add(new Separator());
-            
+
             manager.add(mUpAction);
             manager.add(mDownAction);
         }
 
         if (selected != null && selected.size() == 1) {
             manager.add(new Separator());
-            
+
             Action propertiesAction = new Action("Properties") {
                 @Override
                 public void run() {
@@ -344,7 +347,7 @@
     }
 
     /**
-     * Updates the outline view with the model of the {@link GraphicalLayoutEditor}.
+     * Updates the outline view with the model of the {@link IGraphicalLayoutEditor}.
      * <p/>
      * This attemps to preserve the selection, if any.
      */
@@ -380,22 +383,22 @@
         ISelection selection = getSelection();
         if (selection instanceof StructuredSelection) {
             StructuredSelection structuredSelection = (StructuredSelection)selection;
-            
+
             if (structuredSelection.size() > 0) {
                 ArrayList<UiElementTreeEditPart> selected = new ArrayList<UiElementTreeEditPart>();
-                
+
                 for (Iterator it = structuredSelection.iterator(); it.hasNext(); ) {
                     Object selectedObj = it.next();
-                
+
                     if (selectedObj instanceof UiElementTreeEditPart) {
                         selected.add((UiElementTreeEditPart) selectedObj);
                     }
                 }
-                
+
                 return selected.size() > 0 ? selected : null;
             }
         }
-        
+
         return null;
     }
 
@@ -412,16 +415,16 @@
 
         if (parts != null) {
             ArrayList<UiElementNode> selected = new ArrayList<UiElementNode>();
-            
+
             for (UiElementTreeEditPart part : parts) {
                 if (part instanceof UiViewTreeEditPart || part instanceof UiLayoutTreeEditPart) {
                     selected.add((UiElementNode) part.getModel());
                 }
             }
-            
+
             return selected.size() > 0 ? selected : null;
         }
-        
+
         return null;
     }
 
@@ -440,17 +443,17 @@
         }
     }
 
-    /** 
+    /**
      * Selects the corresponding model element in the tree viewer.
      */
     private void setModelSelection(UiElementNode uiNodeToSelect) {
         if (uiNodeToSelect != null) {
-            
+
             // find an edit part that has the requested model element
             UiElementTreeEditPart part = findPartForModel(
                     (UiElementTreeEditPart) getViewer().getContents(),
                     uiNodeToSelect);
-            
+
             // if we found a part, select it and reveal it
             if (part != null) {
                 setViewerSelection(part);
@@ -461,7 +464,7 @@
 
     /**
      * Utility method that tries to find an edit part that matches a given model UI node.
-     * 
+     *
      * @param rootPart The root of the viewer edit parts
      * @param uiNode The UI node model to find
      * @return The part that matches the model or null if it's not in the sub tree.
@@ -471,7 +474,7 @@
         if (rootPart.getModel() == uiNode) {
             return rootPart;
         }
-        
+
         for (Object part : rootPart.getChildren()) {
             if (part instanceof UiElementTreeEditPart) {
                 UiElementTreeEditPart found = findPartForModel(
@@ -492,16 +495,16 @@
      */
     private void setupTooltip() {
         final Tree tree = (Tree) getControl();
-        
+
         /*
-         * Reference: 
+         * Reference:
          * http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet125.java?view=markup
          */
-        
+
         final Listener listener = new Listener() {
             Shell tip = null;
             Label label  = null;
-            
+
             public void handleEvent(Event event) {
                 switch(event.type) {
                 case SWT.Dispose:
@@ -523,7 +526,7 @@
                     }
 
                     String tooltip = null;
-                    
+
                     TreeItem item = tree.getItem(new Point(event.x, event.y));
                     if (item != null) {
                         Object data = item.getData();
@@ -540,12 +543,12 @@
                             tooltip = item.getText() + ":\r" + tooltip;
                         }
                     }
-                    
-                    
+
+
                     if (tooltip != null) {
                         Shell shell = tree.getShell();
                         Display display = tree.getDisplay();
-                        
+
                         tip = new Shell(shell, SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
                         tip.setBackground(display .getSystemColor(SWT.COLOR_INFO_BACKGROUND));
                         FillLayout layout = new FillLayout();
@@ -567,7 +570,7 @@
                 }
             }
         };
-        
+
         tree.addListener(SWT.Dispose, listener);
         tree.addListener(SWT.KeyDown, listener);
         tree.addListener(SWT.MouseMove, listener);
@@ -592,7 +595,7 @@
     }
 
     // ---------------
-    
+
     private class UiOutlineActions extends UiActions {
 
         @Override
@@ -610,6 +613,6 @@
         public void commitPendingXmlChanges() {
             // Pass. There is nothing to commit before the XML is changed here.
         }
-        
+
     }
 }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiPropertySheetPage.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiPropertySheetPage.java
index 33d2ed4..43b73b0 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiPropertySheetPage.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiPropertySheetPage.java
@@ -35,10 +35,12 @@
  * A customized property sheet page for the graphical layout editor.
  * <p/>
  * Currently it just provides a custom tooltip to display attributes javadocs.
+ *
+ * @since GLE1
  */
 public class UiPropertySheetPage extends PropertySheetPage {
 
-    
+
     public UiPropertySheetPage() {
         super();
     }
@@ -46,7 +48,7 @@
     @Override
     public void createControl(Composite parent) {
         super.createControl(parent);
-        
+
         setupTooltip();
     }
 
@@ -59,14 +61,14 @@
         final Tree tree = (Tree) getControl();
 
         /*
-         * Reference: 
+         * Reference:
          * http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet125.java?view=markup
          */
 
         final Listener listener = new Listener() {
             Shell tip = null;
             Label label  = null;
-            
+
             public void handleEvent(Event event) {
                 switch(event.type) {
                 case SWT.Dispose:
@@ -88,7 +90,7 @@
                     }
 
                     String tooltip = null;
-                    
+
                     TreeItem item = tree.getItem(new Point(event.x, event.y));
                     if (item != null) {
                         Object data = item.getData();
@@ -102,11 +104,11 @@
                             tooltip = item.getText() + ":\r" + tooltip;
                         }
                     }
-                    
+
                     if (tooltip != null) {
                         Shell shell = tree.getShell();
                         Display display = tree.getDisplay();
-                        
+
                         tip = new Shell(shell, SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
                         tip.setBackground(display .getSystemColor(SWT.COLOR_INFO_BACKGROUND));
                         FillLayout layout = new FillLayout();
@@ -128,7 +130,7 @@
                 }
             }
         };
-        
+
         tree.addListener(SWT.Dispose, listener);
         tree.addListener(SWT.KeyDown, listener);
         tree.addListener(SWT.MouseMove, listener);
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigEditDialog.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigEditDialog.java
new file mode 100644
index 0000000..5c9ceef
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigEditDialog.java
@@ -0,0 +1,304 @@
+package com.android.ide.eclipse.adt.internal.editors.layout.configuration;
+
+import com.android.ide.eclipse.adt.internal.editors.IconFactory;
+import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
+import com.android.ide.eclipse.adt.internal.resources.configurations.LanguageQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.RegionQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ResourceQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.VersionQualifier;
+import com.android.ide.eclipse.adt.internal.sdk.LayoutDevice;
+import com.android.ide.eclipse.adt.internal.ui.ConfigurationSelector;
+import com.android.ide.eclipse.adt.internal.ui.ConfigurationSelector.ConfigurationState;
+import com.android.ide.eclipse.adt.internal.ui.ConfigurationSelector.IQualifierFilter;
+import com.android.sdkuilib.ui.GridDialog;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import java.util.regex.Pattern;
+
+/**
+ * Dialog to edit both a {@link LayoutDevice}, and a {@link FolderConfiguration} at the same time.
+ */
+public class ConfigEditDialog extends GridDialog {
+
+    private static final Pattern FLOAT_PATTERN = Pattern.compile("\\d*(\\.\\d?)?");
+
+
+    private final FolderConfiguration mConfig = new FolderConfiguration();
+
+    private ConfigurationSelector mConfigSelector;
+    private Composite mStatusComposite;
+    private Label mStatusLabel;
+    private Label mStatusImage;
+
+    private Image mError;
+
+    private String mDeviceName;
+    private String mConfigName;
+    private float mXDpi = Float.NaN;
+    private float mYDpi = Float.NaN;
+
+
+    public ConfigEditDialog(Shell parentShell, FolderConfiguration config) {
+        super(parentShell, 1, false);
+        mConfig.set(config);
+    }
+
+    public void setDeviceName(String name) {
+        mDeviceName = name;
+    }
+
+    public String getDeviceName() {
+        return mDeviceName;
+    }
+
+    public void setXDpi(float xdpi) {
+        mXDpi = xdpi;
+    }
+
+    public float getXDpi() {
+        return mXDpi;
+    }
+
+    public void setYDpi(float ydpi) {
+        mYDpi = ydpi;
+    }
+
+    public float getYDpi() {
+        return mYDpi;
+    }
+
+    public void setConfigName(String name) {
+        mConfigName = name;
+    }
+
+    public String getConfigName() {
+        return mConfigName;
+    }
+
+    public void setConfig(FolderConfiguration config) {
+        mConfig.set(config);
+    }
+
+    public void getConfig(FolderConfiguration config) {
+        config.set(mConfig);
+    }
+
+    @Override
+    public void createDialogContent(Composite parent) {
+        mError = IconFactory.getInstance().getIcon("error"); //$NON-NLS-1$
+
+        Group deviceGroup = new Group(parent, SWT.NONE);
+        deviceGroup.setText("Device");
+        deviceGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
+        deviceGroup.setLayout(new GridLayout(2, false));
+
+        Label l = new Label(deviceGroup, SWT.None);
+        l.setText("Name");
+
+        final Text deviceNameText = new Text(deviceGroup, SWT.BORDER);
+        deviceNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        if (mDeviceName != null) {
+            deviceNameText.setText(mDeviceName);
+        }
+        deviceNameText.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                mDeviceName = deviceNameText.getText().trim();
+                validateOk();
+            }
+        });
+
+
+        VerifyListener floatVerifier = new VerifyListener() {
+            public void verifyText(VerifyEvent event) {
+                // combine the current content and the new text
+                String text = ((Text)event.widget).getText();
+                text = text.substring(0, event.start) + event.text + text.substring(event.end);
+
+                // now make sure it's a match for the regex
+                event.doit = FLOAT_PATTERN.matcher(text).matches();
+            }
+        };
+
+        l = new Label(deviceGroup, SWT.None);
+        l.setText("x dpi");
+
+        final Text deviceXDpiText = new Text(deviceGroup, SWT.BORDER);
+        deviceXDpiText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        if (Float.isNaN(mXDpi) == false) {
+            deviceXDpiText.setText(String.format("%.1f", mXDpi)); //$NON-NLS-1$
+        }
+        deviceXDpiText.addVerifyListener(floatVerifier);
+        deviceXDpiText.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                String value = deviceXDpiText.getText();
+                if (value.length() == 0) {
+                    mXDpi = Float.NaN;
+                } else {
+                    mXDpi = Float.parseFloat(value);
+                }
+            }
+        });
+
+        l = new Label(deviceGroup, SWT.None);
+        l.setText("y dpi");
+
+        final Text deviceYDpiText = new Text(deviceGroup, SWT.BORDER);
+        deviceYDpiText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        if (Float.isNaN(mYDpi) == false) {
+            deviceYDpiText.setText(String.format("%.1f", mYDpi)); //$NON-NLS-1$
+        }
+        deviceYDpiText.addVerifyListener(floatVerifier);
+        deviceYDpiText.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                String value = deviceYDpiText.getText();
+                if (value.length() == 0) {
+                    mYDpi = Float.NaN;
+                } else {
+                    mYDpi = Float.parseFloat(value);
+                }
+            }
+        });
+
+        Group configGroup = new Group(parent, SWT.NONE);
+        configGroup.setText("Configuration");
+        configGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
+        configGroup.setLayout(new GridLayout(2, false));
+
+        l = new Label(configGroup, SWT.None);
+        l.setText("Name");
+
+        final Text configNameText = new Text(configGroup, SWT.BORDER);
+        configNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        if (mConfigName != null) {
+            configNameText.setText(mConfigName);
+        }
+        configNameText.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                mConfigName = configNameText.getText().trim();
+                validateOk();
+            }
+        });
+
+        mConfigSelector = new ConfigurationSelector(configGroup, true /*deviceMode*/);
+        // configure the selector to be in "device mode" and not accept language/region/version
+        // since those are selected from a different combo
+        // FIXME: add version combo.
+        mConfigSelector.setQualifierFilter(new IQualifierFilter() {
+            public boolean accept(ResourceQualifier qualifier) {
+                if (qualifier instanceof LanguageQualifier ||
+                        qualifier instanceof RegionQualifier ||
+                        qualifier instanceof VersionQualifier) {
+                    return false;
+                }
+
+                return true;
+            }
+        });
+        mConfigSelector.setConfiguration(mConfig);
+        GridData gd;
+        mConfigSelector.setLayoutData(gd = new GridData(GridData.FILL_HORIZONTAL));
+        gd.horizontalSpan = 2;
+        gd.widthHint = ConfigurationSelector.WIDTH_HINT;
+        gd.heightHint = ConfigurationSelector.HEIGHT_HINT;
+
+        // add a listener to check on the validity of the FolderConfiguration as
+        // they are built.
+        mConfigSelector.setOnChangeListener(new Runnable() {
+            public void run() {
+                if (mConfigSelector.getState() == ConfigurationState.OK) {
+                    mConfigSelector.getConfiguration(mConfig);
+                }
+
+                validateOk();
+            }
+        });
+
+        mStatusComposite = new Composite(parent, SWT.NONE);
+        mStatusComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        GridLayout gl = new GridLayout(2, false);
+        mStatusComposite.setLayout(gl);
+        gl.marginHeight = gl.marginWidth = 0;
+
+        mStatusImage = new Label(mStatusComposite, SWT.NONE);
+        mStatusLabel = new Label(mStatusComposite, SWT.NONE);
+        mStatusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        resetStatus();
+    }
+
+    @Override
+    protected Control createContents(Composite parent) {
+        Control c = super.createContents(parent);
+        validateOk();
+        return c;
+    }
+
+    /**
+     * resets the status label to show the file that will be created.
+     */
+    private void resetStatus() {
+        String displayString = Dialog.shortenText(
+                String.format("Config: %1$s", mConfig.toString()),
+                mStatusLabel);
+        mStatusLabel.setText(displayString);
+    }
+
+    private void setError(String text) {
+        String displayString = Dialog.shortenText(text, mStatusLabel);
+        mStatusLabel.setText(displayString);
+        mStatusImage.setImage(mError);
+        getButton(IDialogConstants.OK_ID).setEnabled(false);
+    }
+
+    private void validateOk() {
+        // check the device name
+        if (mDeviceName == null || mDeviceName.length() == 0) {
+            setError("Device name must not be empty");
+            return;
+        }
+
+        // check the config name
+        if (mConfigName == null || mConfigName.length() == 0) {
+            setError("Configuration name must not be empty");
+            return;
+        }
+
+        // and check the config itself
+        ConfigurationState state = mConfigSelector.getState();
+
+        switch (state) {
+            case INVALID_CONFIG:
+                ResourceQualifier invalidQualifier = mConfigSelector.getInvalidQualifier();
+                setError(String.format(
+                        "Invalid Configuration: %1$s has no filter set.",
+                        invalidQualifier.getName()));
+                return;
+            case REGION_WITHOUT_LANGUAGE:
+                setError("The Region qualifier requires the Language qualifier.");
+                return;
+        }
+
+        // no error
+        mStatusImage.setImage(null);
+        resetStatus();
+        getButton(IDialogConstants.OK_ID).setEnabled(true);
+
+        // need to relayout, because of the change in size in mErrorImage.
+        mStatusComposite.layout();
+    }
+}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigManagerDialog.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigManagerDialog.java
new file mode 100644
index 0000000..61d870b
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigManagerDialog.java
@@ -0,0 +1,554 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.layout.configuration;
+
+import com.android.ddmuilib.TableHelper;
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
+import com.android.ide.eclipse.adt.internal.sdk.LayoutDevice;
+import com.android.ide.eclipse.adt.internal.sdk.LayoutDeviceManager;
+import com.android.ide.eclipse.adt.internal.sdk.Sdk;
+import com.android.sdkuilib.ui.GridDialog;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * Dialog to view the layout devices with action button to create/edit/delete/copy layout devices
+ * and configs.
+ *
+ */
+public class ConfigManagerDialog extends GridDialog {
+
+    private final static String COL_NAME = AdtPlugin.PLUGIN_ID + ".configmanager.name"; //$NON-NLS-1$
+    private final static String COL_CONFIG = AdtPlugin.PLUGIN_ID + ".configmanager.config"; //$NON-NLS-1$
+
+    /**
+     * enum to represent the different origin of the layout devices.
+     */
+    private static enum DeviceType {
+        DEFAULT("Default"),
+        ADDON("Add-on"),
+        CUSTOM("Custom");
+
+        private final String mDisplay;
+
+        DeviceType(String display) {
+            mDisplay = display;
+        }
+
+        String getDisplayString() {
+            return mDisplay;
+        }
+    }
+
+    /**
+     * simple class representing the tree selection with the proper types.
+     */
+    private static class DeviceSelection {
+        public DeviceSelection(DeviceType type, LayoutDevice device,
+                Entry<String, FolderConfiguration> entry) {
+            this.type = type;
+            this.device = device;
+            this.entry = entry;
+        }
+
+        final DeviceType type;
+        final LayoutDevice device;
+        final Entry<String, FolderConfiguration> entry;
+    }
+
+    private final LayoutDeviceManager mManager;
+
+    private TreeViewer mTreeViewer;
+    private Button mNewButton;
+    private Button mEditButton;
+    private Button mCopyButton;
+    private Button mDeleteButton;
+
+    /**
+     * Content provider of the {@link TreeViewer}. The expected input is
+     * {@link LayoutDeviceManager}.
+     *
+     */
+    private final static class DeviceContentProvider implements ITreeContentProvider {
+        private final static DeviceType[] sCategory = new DeviceType[] {
+            DeviceType.DEFAULT, DeviceType.ADDON, DeviceType.CUSTOM
+        };
+
+        private LayoutDeviceManager mLayoutDeviceManager;
+
+        public DeviceContentProvider() {
+        }
+
+        public Object[] getElements(Object inputElement) {
+            return sCategory;
+        }
+
+        public Object[] getChildren(Object parentElement) {
+            if (parentElement instanceof DeviceType) {
+                if (DeviceType.DEFAULT.equals(parentElement)) {
+                    return mLayoutDeviceManager.getDefaultLayoutDevices().toArray();
+                } else if (DeviceType.ADDON.equals(parentElement)) {
+                    return mLayoutDeviceManager.getAddOnLayoutDevice().toArray();
+                } else if (DeviceType.CUSTOM.equals(parentElement)) {
+                    return mLayoutDeviceManager.getUserLayoutDevices().toArray();
+                }
+            } else if (parentElement instanceof LayoutDevice) {
+                LayoutDevice device = (LayoutDevice)parentElement;
+                return device.getConfigs().entrySet().toArray();
+            }
+
+            return null;
+        }
+
+        public Object getParent(Object element) {
+            // parent cannot be computed. this is fine.
+            return null;
+        }
+
+        public boolean hasChildren(Object element) {
+            if (element instanceof DeviceType) {
+                if (DeviceType.DEFAULT.equals(element)) {
+                    return mLayoutDeviceManager.getDefaultLayoutDevices().size() > 0;
+                } else if (DeviceType.ADDON.equals(element)) {
+                    return mLayoutDeviceManager.getAddOnLayoutDevice().size() > 0;
+                } else if (DeviceType.CUSTOM.equals(element)) {
+                    return mLayoutDeviceManager.getUserLayoutDevices().size() > 0;
+                }
+            } else if (element instanceof LayoutDevice) {
+                LayoutDevice device = (LayoutDevice)element;
+                return device.getConfigs().size() > 0;
+            }
+
+            return false;
+        }
+
+
+        public void dispose() {
+            // nothing to dispose
+        }
+
+        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+            if (newInput instanceof LayoutDeviceManager) {
+                mLayoutDeviceManager = (LayoutDeviceManager)newInput;
+                return;
+            }
+
+            // when the dialog closes we get null input
+            if (newInput != null) {
+                throw new IllegalArgumentException(
+                        "ConfigContentProvider requires input to be LayoutDeviceManager");
+            }
+        }
+    }
+
+    /**
+     * Label provider for the {@link TreeViewer}.
+     * Supported elements are {@link DeviceType}, {@link LayoutDevice}, and {@link Entry} (where
+     * the key is a {@link String} object, and the value is a {@link FolderConfiguration} object).
+     *
+     */
+    private final static class DeviceLabelProvider implements ITableLabelProvider {
+
+        public String getColumnText(Object element, int columnIndex) {
+            if (element instanceof DeviceType) {
+                if (columnIndex == 0) {
+                    return ((DeviceType)element).getDisplayString();
+                }
+            } else if (element instanceof LayoutDevice) {
+                if (columnIndex == 0) {
+                    return ((LayoutDevice)element).getName();
+                }
+            } else if (element instanceof Entry<?, ?>) {
+                if (columnIndex == 0) {
+                    return (String)((Entry<?,?>)element).getKey();
+                } else {
+                    return ((Entry<?,?>)element).getValue().toString();
+                }
+            }
+            return null;
+        }
+
+        public Image getColumnImage(Object element, int columnIndex) {
+            // no image
+            return null;
+        }
+
+        public void addListener(ILabelProviderListener listener) {
+            // no listener
+        }
+
+        public void removeListener(ILabelProviderListener listener) {
+            // no listener
+        }
+
+        public void dispose() {
+            // nothing to dispose
+        }
+
+        public boolean isLabelProperty(Object element, String property) {
+            return false;
+        }
+    }
+
+    protected ConfigManagerDialog(Shell parentShell) {
+        super(parentShell, 2, false);
+        mManager = Sdk.getCurrent().getLayoutDeviceManager();
+    }
+
+    @Override
+    protected int getShellStyle() {
+        return super.getShellStyle() | SWT.RESIZE;
+    }
+
+    @Override
+    protected void configureShell(Shell newShell) {
+        super.configureShell(newShell);
+        newShell.setText("Device Configurations");
+    }
+
+    @Override
+    public void createDialogContent(final Composite parent) {
+        GridData gd;
+        GridLayout gl;
+
+        Tree tree = new Tree(parent, SWT.SINGLE | SWT.FULL_SELECTION);
+        tree.setLayoutData(gd = new GridData(GridData.FILL_BOTH));
+        gd.widthHint = 700;
+
+        tree.setHeaderVisible(true);
+        tree.setLinesVisible(true);
+        TableHelper.createTreeColumn(tree, "Name", SWT.LEFT, 150, COL_NAME,
+                AdtPlugin.getDefault().getPreferenceStore());
+        TableHelper.createTreeColumn(tree, "Configuration", SWT.LEFT, 500, COL_CONFIG,
+                AdtPlugin.getDefault().getPreferenceStore());
+
+        mTreeViewer = new TreeViewer(tree);
+        mTreeViewer.setContentProvider(new DeviceContentProvider());
+        mTreeViewer.setLabelProvider(new DeviceLabelProvider());
+        mTreeViewer.setAutoExpandLevel(TreeViewer.ALL_LEVELS);
+        mTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+            public void selectionChanged(SelectionChangedEvent event) {
+                setEnabled(getSelection());
+            }
+        });
+
+        Composite buttons = new Composite(parent, SWT.NONE);
+        buttons.setLayoutData(new GridData(GridData.FILL_VERTICAL));
+        buttons.setLayout(gl = new GridLayout());
+        gl.marginHeight = gl.marginWidth = 0;
+
+        mNewButton = new Button(buttons, SWT.PUSH | SWT.FLAT);
+        mNewButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        mNewButton.setText("New...");
+        mNewButton.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                DeviceSelection selection = getSelection();
+
+                ConfigEditDialog dlg = new ConfigEditDialog(parent.getShell(), null);
+                if (selection.device != null) {
+                    dlg.setDeviceName(selection.device.getName());
+                    dlg.setXDpi(selection.device.getXDpi());
+                    dlg.setYDpi(selection.device.getYDpi());
+                }
+                if (selection.entry != null) {
+                    dlg.setConfigName(selection.entry.getKey());
+                    dlg.setConfig(selection.entry.getValue());
+                }
+
+                if (dlg.open() == Window.OK) {
+                    String deviceName = dlg.getDeviceName();
+                    String configName = dlg.getConfigName();
+                    FolderConfiguration config = new FolderConfiguration();
+                    dlg.getConfig(config);
+
+                    // first if there was no original device, we create one.
+                    // Because the new button is disabled when something else than "custom" is
+                    // selected, we always add to the user devices without checking.
+                    LayoutDevice d;
+                    if (selection.device == null) {
+                        // FIXME: this doesn't check if the device name is taken.
+                        d = mManager.addUserDevice(deviceName, dlg.getXDpi(), dlg.getYDpi());
+                    } else {
+                        // search for it.
+                        d = mManager.getUserLayoutDevice(deviceName);
+                    }
+
+                    if (d != null) {
+                        // then if there was no config, we add it, otherwise we edit it
+                        // (same method that adds/replace a config).
+                        // FIXME this doesn't check if the name was already taken.
+                        mManager.addUserConfiguration(d, configName, config);
+
+                        mTreeViewer.refresh();
+                        select(d, configName);
+                    }
+                }
+            }
+        });
+
+        mEditButton = new Button(buttons, SWT.PUSH | SWT.FLAT);
+        mEditButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        mEditButton.setText("Edit...");
+        mEditButton.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                DeviceSelection selection = getSelection();
+                ConfigEditDialog dlg = new ConfigEditDialog(parent.getShell(), null);
+                dlg.setDeviceName(selection.device.getName());
+                dlg.setXDpi(selection.device.getXDpi());
+                dlg.setYDpi(selection.device.getYDpi());
+                dlg.setConfigName(selection.entry.getKey());
+                dlg.setConfig(selection.entry.getValue());
+
+                if (dlg.open() == Window.OK) {
+                    String deviceName = dlg.getDeviceName();
+                    String configName = dlg.getConfigName();
+                    FolderConfiguration config = new FolderConfiguration();
+                    dlg.getConfig(config);
+
+                    // replace the device if needed.
+                    // FIXME: this doesn't check if the replacement name doesn't exist already.
+                    LayoutDevice d = mManager.replaceUserDevice(selection.device, deviceName,
+                            dlg.getXDpi(), dlg.getYDpi());
+
+                    // and add/replace the config
+                    mManager.replaceUserConfiguration(d, selection.entry.getKey(), configName,
+                            config);
+
+                    mTreeViewer.refresh();
+                    select(d, configName);
+                }
+            }
+        });
+
+        mCopyButton = new Button(buttons, SWT.PUSH | SWT.FLAT);
+        mCopyButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        mCopyButton.setText("Copy");
+        mCopyButton.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                DeviceSelection selection = getSelection();
+
+                // is the source a default/add-on device, or are we copying a full device?
+                // if so the target device is a new device.
+                LayoutDevice targetDevice = selection.device;
+                if (selection.type == DeviceType.DEFAULT || selection.type == DeviceType.ADDON ||
+                        selection.entry == null) {
+                    // create a new device
+                    targetDevice = mManager.addUserDevice(
+                            selection.device.getName() + " Copy", // new name
+                            selection.device.getXDpi(),
+                            selection.device.getYDpi());
+                }
+
+                String newConfigName = null; // name of the single new config. used for the select.
+
+                // are we copying the full device?
+                if (selection.entry == null) {
+                    // get the config from the origin device
+                    Map<String, FolderConfiguration> configs = selection.device.getConfigs();
+
+                    // and copy them in the target device
+                    for (Entry<String, FolderConfiguration> entry : configs.entrySet()) {
+                        // we need to make a copy of the config object, or it could be modified
+                        // in default/addon by editing the version in the new device.
+                        FolderConfiguration copy = new FolderConfiguration();
+                        copy.set(entry.getValue());
+
+                        // the name can stay the same since we are copying a full device
+                        // and the target device has its own new name.
+                        mManager.addUserConfiguration(targetDevice, entry.getKey(), copy);
+                    }
+                } else {
+                    // only copy the config. target device is not the same as the selection, don't
+                    // change the config name as we already changed the name of the device.
+                    newConfigName = (selection.device != targetDevice) ?
+                            selection.entry.getKey() : selection.entry.getKey() + " Copy";
+
+                    // copy of the config
+                    FolderConfiguration copy = new FolderConfiguration();
+                    copy.set(selection.entry.getValue());
+
+                    // and create the config
+                    mManager.addUserConfiguration(targetDevice, newConfigName, copy);
+                }
+
+                mTreeViewer.refresh();
+
+                select(targetDevice, newConfigName);
+            }
+        });
+
+        mDeleteButton = new Button(buttons, SWT.PUSH | SWT.FLAT);
+        mDeleteButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        mDeleteButton.setText("Delete");
+        mDeleteButton.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                DeviceSelection selection = getSelection();
+
+                if (selection.entry != null) {
+                    mManager.removeUserConfiguration(selection.device, selection.entry.getKey());
+                } else if (selection.device != null) {
+                    mManager.removeUserDevice(selection.device);
+                }
+
+                mTreeViewer.refresh();
+
+                // either select the device (if we removed a entry, or the top custom node if
+                // we removed a device)
+                select(selection.entry != null ? selection.device : null, null);
+            }
+        });
+
+        Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
+        separator.setLayoutData(gd = new GridData(GridData.FILL_HORIZONTAL));
+        gd.horizontalSpan = 2;
+
+        mTreeViewer.setInput(mManager);
+        setEnabled(null); // no selection at the start
+    }
+
+    @Override
+    protected void createButtonsForButtonBar(Composite parent) {
+        // we only want an OK button.
+        createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+    }
+
+    /**
+     * Returns a {@link DeviceSelection} object representing the selected path in the
+     * {@link TreeViewer}
+     */
+    private DeviceSelection getSelection() {
+        // get the selection paths
+        TreeSelection selection = (TreeSelection)mTreeViewer.getSelection();
+        TreePath[] paths =selection.getPaths();
+
+        if (paths.length == 0) {
+            return null;
+        }
+
+        TreePath pathSelection = paths[0];
+
+        DeviceType type = (DeviceType)pathSelection.getFirstSegment();
+        LayoutDevice device = null;
+        Entry<String, FolderConfiguration> entry = null;
+        switch (pathSelection.getSegmentCount()) {
+            case 2: // layout device is selected
+                device = (LayoutDevice)pathSelection.getLastSegment();
+                break;
+            case 3: // config is selected
+                device = (LayoutDevice)pathSelection.getSegment(1);
+                entry = (Entry<String, FolderConfiguration>)pathSelection.getLastSegment();
+        }
+
+        return new DeviceSelection(type, device, entry);
+    }
+
+    /**
+     * Enables/disables the action button based on the {@link DeviceSelection}.
+     * @param selection the selection
+     */
+    protected void setEnabled(DeviceSelection selection) {
+        if (selection == null) {
+            mNewButton.setEnabled(false);
+            mEditButton.setEnabled(false);
+            mCopyButton.setEnabled(false);
+            mDeleteButton.setEnabled(false);
+        } else {
+            switch (selection.type) {
+                case DEFAULT:
+                case ADDON:
+                    // only allow copy if device is not null
+                    mNewButton.setEnabled(false);
+                    mEditButton.setEnabled(false);
+                    mDeleteButton.setEnabled(false);
+                    mCopyButton.setEnabled(selection.device != null);
+                    break;
+                case CUSTOM:
+                    mNewButton.setEnabled(true); // always true to create new devices.
+                    mEditButton.setEnabled(selection.entry != null); // only edit config for now
+
+                    boolean enabled = selection.device != null; // need at least selected device
+                    mDeleteButton.setEnabled(enabled);          // for delete and copy buttons
+                    mCopyButton.setEnabled(enabled);
+                    break;
+            }
+        }
+    }
+
+    /**
+     * Selects a device and optionally a config. Because this is meant to show newly created/edited
+     * device/config, it'll only do so for {@link DeviceType#CUSTOM} devices.
+     * @param device the device to select
+     * @param configName the config to select (optional)
+     */
+    private void select(LayoutDevice device, String configName) {
+        Object[] path;
+        if (device == null) {
+            // select the "custom" node
+            path = new Object[] { DeviceType.CUSTOM };
+        } else if (configName == null) {
+            // this is the easy case. no config to select
+            path = new Object[] { DeviceType.CUSTOM, device };
+        } else {
+            // this is more complex. we have the configName, but the tree contains Entry<?,?>
+            // Look for the entry.
+            Entry<?, ?> match = null;
+            for (Entry<?, ?> entry : device.getConfigs().entrySet()) {
+                if (entry.getKey().equals(configName)) {
+                    match = entry;
+                    break;
+                }
+            }
+
+            if (match != null) {
+                path = new Object[] { DeviceType.CUSTOM, device, match };
+            } else {
+                path = new Object[] { DeviceType.CUSTOM, device };
+            }
+        }
+
+        mTreeViewer.setSelection(new TreeSelection(new TreePath(path)), true /*reveal*/);
+    }
+}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java
new file mode 100644
index 0000000..1178449
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java
@@ -0,0 +1,742 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.layout.configuration;
+
+import com.android.ide.eclipse.adt.internal.editors.IconFactory;
+import com.android.ide.eclipse.adt.internal.resources.ResourceType;
+import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
+import com.android.ide.eclipse.adt.internal.resources.configurations.LanguageQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.RegionQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ResourceQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenDimensionQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenOrientationQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.VersionQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier.Density;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenOrientationQualifier.ScreenOrientation;
+import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources;
+import com.android.ide.eclipse.adt.internal.sdk.LayoutDevice;
+import com.android.ide.eclipse.adt.internal.sdk.LayoutDeviceManager;
+import com.android.ide.eclipse.adt.internal.sdk.Sdk;
+import com.android.ide.eclipse.adt.internal.ui.ConfigurationSelector.LanguageRegionVerifier;
+import com.android.layoutlib.api.IResourceValue;
+import com.android.layoutlib.api.IStyleResourceValue;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+
+/**
+ * A composite that displays the current configuration displayed in a Graphical Layout Editor.
+ */
+public class ConfigurationComposite extends Composite {
+
+    private final static String THEME_SEPARATOR = "----------"; //$NON-NLS-1$
+
+    private Button mClippingButton;
+    private Label mCurrentLayoutLabel;
+
+    private Combo mLocale;
+    private Combo mDeviceList;
+    private Combo mDeviceConfigs;
+    private Combo mThemeCombo;
+    private Button mCreateButton;
+
+
+    private int mPlatformThemeCount = 0;
+    private boolean mDisableUpdates = false;
+
+    /** The {@link FolderConfiguration} representing the state of the UI controls */
+    private final FolderConfiguration mCurrentConfig = new FolderConfiguration();
+
+    private List<LayoutDevice> mDevices;
+
+    private final ArrayList<ResourceQualifier[] > mLocaleList =
+        new ArrayList<ResourceQualifier[]>();
+
+    private final IConfigListener mListener;
+
+    private boolean mClipping = true;
+
+    private LayoutDevice mCurrentDevice;
+
+    /**
+     * Interface implemented by the part which owns a {@link ConfigurationComposite}.
+     * This notifies the owners when the configuration change.
+     * The owner must also provide methods to provide the configuration that will
+     * be displayed.
+     */
+    public interface IConfigListener {
+        void onConfigurationChange();
+        void onThemeChange();
+        void onCreate();
+        void OnClippingChange();
+
+        ProjectResources getProjectResources();
+        ProjectResources getFrameworkResources();
+        Map<String, Map<String, IResourceValue>> getConfiguredProjectResources();
+        Map<String, Map<String, IResourceValue>> getConfiguredFrameworkResources();
+    }
+
+    public ConfigurationComposite(IConfigListener listener, Composite parent, int style) {
+        super(parent, style);
+        mListener = listener;
+
+        GridLayout gl;
+        GridData gd;
+        int cols = 10; // device*2+config*2+locale*2+separator*2+theme+createBtn
+
+        // ---- First line: collapse button, clipping button, editing config display.
+        Composite labelParent = new Composite(this, SWT.NONE);
+        labelParent.setLayout(gl = new GridLayout(3, false));
+        gl.marginWidth = gl.marginHeight = 0;
+        labelParent.setLayoutData(gd = new GridData(GridData.FILL_HORIZONTAL));
+        gd.horizontalSpan = cols;
+
+        new Label(labelParent, SWT.NONE).setText("Editing config:");
+        mCurrentLayoutLabel = new Label(labelParent, SWT.NONE);
+        mCurrentLayoutLabel.setLayoutData(gd = new GridData(GridData.FILL_HORIZONTAL));
+        gd.widthHint = 50;
+
+        mClippingButton = new Button(labelParent, SWT.TOGGLE | SWT.FLAT);
+        mClippingButton.setSelection(mClipping);
+        mClippingButton.setToolTipText("Toggles screen clipping on/off");
+        mClippingButton.setImage(IconFactory.getInstance().getIcon("clipping")); //$NON-NLS-1$
+        mClippingButton.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                OnClippingChange();
+            }
+        });
+
+        // ---- 2nd line: device/config/locale/theme Combos, create button.
+
+        setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        setLayout(gl = new GridLayout(cols, false));
+        gl.marginHeight = 0;
+        gl.horizontalSpacing = 0;
+
+        new Label(this, SWT.NONE).setText("Devices");
+        mDeviceList = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
+        mDeviceList.setLayoutData(new GridData(
+                GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
+        mDeviceList.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                onDeviceChange(true /* recomputeLayout*/);
+            }
+        });
+
+        new Label(this, SWT.NONE).setText("Config");
+        mDeviceConfigs = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
+        mDeviceConfigs.setLayoutData(new GridData(
+                GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
+        mDeviceConfigs.addSelectionListener(new SelectionAdapter() {
+            @Override
+             public void widgetSelected(SelectionEvent e) {
+                onDeviceConfigChange();
+            }
+        });
+
+        new Label(this, SWT.NONE).setText("Locale");
+        mLocale = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
+        mLocale.setLayoutData(new GridData(
+                GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
+        mLocale.addVerifyListener(new LanguageRegionVerifier());
+        mLocale.addSelectionListener(new SelectionListener() {
+            public void widgetDefaultSelected(SelectionEvent e) {
+                onLocaleChange();
+            }
+            public void widgetSelected(SelectionEvent e) {
+                onLocaleChange();
+            }
+        });
+
+        // first separator
+        Label separator = new Label(this, SWT.SEPARATOR | SWT.VERTICAL);
+        separator.setLayoutData(gd = new GridData(
+                GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL));
+        gd.heightHint = 0;
+
+        mThemeCombo = new Combo(this, SWT.READ_ONLY | SWT.DROP_DOWN);
+        mThemeCombo.setEnabled(false);
+        updateUIFromResources();
+        mThemeCombo.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                onThemeChange();
+            }
+        });
+
+        // second separator
+        separator = new Label(this, SWT.SEPARATOR | SWT.VERTICAL);
+        separator.setLayoutData(gd = new GridData(
+                GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL));
+        gd.heightHint = 0;
+
+        mCreateButton = new Button(this, SWT.PUSH | SWT.FLAT);
+        mCreateButton.setText("Create...");
+        mCreateButton.setEnabled(false);
+        mCreateButton.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                if (mListener != null) {
+                    mListener.onCreate();
+                }
+            }
+        });
+
+        initUiWithDevices();
+
+        onDeviceConfigChange();
+    }
+
+
+    public FolderConfiguration getCurrentConfig() {
+        return mCurrentConfig;
+    }
+
+    public void getCurrentConfig(FolderConfiguration config) {
+        config.set(mCurrentConfig);
+    }
+
+    /**
+     * Returns the currently selected {@link Density}. This is guaranteed to be non null.
+     */
+    public Density getDensity() {
+        if (mCurrentConfig != null) {
+            PixelDensityQualifier qual = mCurrentConfig.getPixelDensityQualifier();
+            if (qual != null) {
+                // just a sanity check
+                Density d = qual.getValue();
+                if (d != Density.NODPI) {
+                    return d;
+                }
+            }
+        }
+
+        // no config? return medium as the default density.
+        return Density.MEDIUM;
+    }
+
+    /**
+     * Returns the current device xdpi.
+     */
+    public float getXDpi() {
+        if (mCurrentDevice != null) {
+            float dpi = mCurrentDevice.getXDpi();
+            if (Float.isNaN(dpi) == false) {
+                return dpi;
+            }
+        }
+
+        // get the pixel density as the density.
+        return getDensity().getDpiValue();
+    }
+
+    /**
+     * Returns the current device ydpi.
+     */
+    public float getYDpi() {
+        if (mCurrentDevice != null) {
+            float dpi = mCurrentDevice.getYDpi();
+            if (Float.isNaN(dpi) == false) {
+                return dpi;
+            }
+        }
+
+        // get the pixel density as the density.
+        return getDensity().getDpiValue();
+    }
+
+    public Rectangle getScreenBounds() {
+        // get the orientation from the current device config
+        ScreenOrientationQualifier qual = mCurrentConfig.getScreenOrientationQualifier();
+        ScreenOrientation orientation = ScreenOrientation.PORTRAIT;
+        if (qual != null) {
+            orientation = qual.getValue();
+        }
+
+        // get the device screen dimension
+        ScreenDimensionQualifier qual2 = mCurrentConfig.getScreenDimensionQualifier();
+        int s1, s2;
+        if (qual2 != null) {
+            s1 = qual2.getValue1();
+            s2 = qual2.getValue2();
+        } else {
+            s1 = 480;
+            s2 = 320;
+        }
+
+        switch (orientation) {
+            default:
+            case PORTRAIT:
+                return new Rectangle(0, 0, s2, s1);
+            case LANDSCAPE:
+                return new Rectangle(0, 0, s1, s2);
+            case SQUARE:
+                return new Rectangle(0, 0, s1, s1);
+        }
+    }
+
+    /**
+     * Updates the UI from values in the resources, such as languages, regions, themes, etc...
+     * This must be called from the UI thread.
+     */
+    public void updateUIFromResources() {
+        if (mListener == null) {
+            return; // can't do anything w/o it.
+        }
+
+        ProjectResources frameworkProject = mListener.getFrameworkResources();
+
+        mDisableUpdates = true;
+
+        // Reset stuff
+        int selection = mThemeCombo.getSelectionIndex();
+        mThemeCombo.removeAll();
+        mPlatformThemeCount = 0;
+
+        mLocale.removeAll();
+        mLocaleList.clear();
+
+        SortedSet<String> languages = null;
+        ArrayList<String> themes = new ArrayList<String>();
+
+        // get the themes, and languages from the Framework.
+        if (frameworkProject != null) {
+            // get the configured resources for the framework
+            Map<String, Map<String, IResourceValue>> frameworResources =
+                mListener.getConfiguredFrameworkResources();
+
+            if (frameworResources != null) {
+                // get the styles.
+                Map<String, IResourceValue> styles = frameworResources.get(
+                        ResourceType.STYLE.getName());
+
+
+                // collect the themes out of all the styles.
+                for (IResourceValue value : styles.values()) {
+                    String name = value.getName();
+                    if (name.startsWith("Theme.") || name.equals("Theme")) {
+                        themes.add(value.getName());
+                        mPlatformThemeCount++;
+                    }
+                }
+
+                // sort them and add them to the combo
+                Collections.sort(themes);
+
+                for (String theme : themes) {
+                    mThemeCombo.add(theme);
+                }
+
+                mPlatformThemeCount = themes.size();
+                themes.clear();
+            }
+        }
+
+        // now get the themes and languages from the project.
+        ProjectResources project = mListener.getProjectResources();
+        // in cases where the opened file is not linked to a project, this could be null.
+        if (project != null) {
+            // get the configured resources for the project
+            Map<String, Map<String, IResourceValue>> configuredProjectRes =
+                mListener.getConfiguredProjectResources();
+
+            if (configuredProjectRes != null) {
+                // get the styles.
+                Map<String, IResourceValue> styleMap = configuredProjectRes.get(
+                        ResourceType.STYLE.getName());
+
+                if (styleMap != null) {
+                    // collect the themes out of all the styles, ie styles that extend,
+                    // directly or indirectly a platform theme.
+                    for (IResourceValue value : styleMap.values()) {
+                        if (isTheme(value, styleMap)) {
+                            themes.add(value.getName());
+                        }
+                    }
+
+                    // sort them and add them the to the combo.
+                    if (mPlatformThemeCount > 0 && themes.size() > 0) {
+                        mThemeCombo.add(THEME_SEPARATOR);
+                    }
+
+                    Collections.sort(themes);
+
+                    for (String theme : themes) {
+                        mThemeCombo.add(theme);
+                    }
+                }
+            }
+
+            // now get the languages from the project.
+            languages = project.getLanguages();
+        }
+
+        // add the languages to the Combo
+        mLocale.add("Default");
+        mLocaleList.add(new ResourceQualifier[] { null, null });
+
+        if (project != null && languages != null && languages.size() > 0) {
+            for (String language : languages) {
+                // first the language alone
+                mLocale.add(language);
+                LanguageQualifier qual = new LanguageQualifier(language);
+                mLocaleList.add(new ResourceQualifier[] { qual, null });
+
+                // now find the matching regions and add them
+                SortedSet<String> regions = project.getRegions(language);
+                for (String region : regions) {
+                    mLocale.add(String.format("%1$s_%2$s", language, region)); //$NON-NLS-1$
+                    RegionQualifier qual2 = new RegionQualifier(region);
+                    mLocaleList.add(new ResourceQualifier[] { qual, qual2 });
+                }
+
+            }
+        }
+
+        mDisableUpdates = false;
+
+        // handle default selection of themes
+        if (mThemeCombo.getItemCount() > 0) {
+            mThemeCombo.setEnabled(true);
+            if (selection == -1) {
+                selection = 0;
+            }
+
+            if (mThemeCombo.getItemCount() <= selection) {
+                mThemeCombo.select(0);
+            } else {
+                mThemeCombo.select(selection);
+            }
+        } else {
+            mThemeCombo.setEnabled(false);
+        }
+
+        mThemeCombo.getParent().layout();
+    }
+
+    /**
+     * Returns the current theme, or null if the combo has no selection.
+     */
+    public String getTheme() {
+        int themeIndex = mThemeCombo.getSelectionIndex();
+        if (themeIndex != -1) {
+            return mThemeCombo.getItem(themeIndex);
+        }
+
+        return null;
+    }
+
+    /**
+     * Returns whether the current theme selection is a project theme.
+     * <p/>The returned value is meaningless if {@link #getTheme()} returns <code>null</code>.
+     * @return true for project theme, false for framework theme
+     */
+    public boolean isProjectTheme() {
+        return mThemeCombo.getSelectionIndex() >= mPlatformThemeCount;
+    }
+
+    public boolean getClipping() {
+        return mClipping;
+    }
+
+    public void setEnabledCreate(boolean enabled) {
+        mCreateButton.setEnabled(enabled);
+    }
+
+    public void setClippingSupport(boolean b) {
+        mClippingButton.setEnabled(b);
+        if (b) {
+            mClippingButton.setToolTipText("Toggles screen clipping on/off");
+        } else {
+            mClipping = true;
+            mClippingButton.setSelection(true);
+            mClippingButton.setToolTipText("Non clipped rendering is not supported");
+        }
+    }
+
+    /**
+     * Update the UI controls state with a given {@link FolderConfiguration}.
+     * <p/>If <var>force</var> is set to <code>true</code> the UI will be changed to exactly reflect
+     * <var>config</var>, otherwise, if a qualifier is not present in <var>config</var>,
+     * the UI control is not modified. However if the value in the control is not the default value,
+     * a warning icon is shown.
+     * @param config The {@link FolderConfiguration} to set.
+     * @param force Whether the UI should be changed to exactly match the received configuration.
+     */
+    public void setConfiguration(FolderConfiguration config, boolean force) {
+        mDisableUpdates = true; // we do not want to trigger onXXXChange when setting new values in the widgets.
+
+        // TODO: find a device that can display this particular config or create a custom one if needed.
+
+
+        // update the string showing the folder name
+        String current = config.toDisplayString();
+        mCurrentLayoutLabel.setText(current != null ? current : "(Default)");
+
+        mDisableUpdates = false;
+    }
+
+    /**
+     * Reloads the list of {@link LayoutDevice} from the {@link Sdk}.
+     * @param notifyListener
+     */
+    public void reloadDevices(boolean notifyListener) {
+        loadDevices();
+        initUiWithDevices();
+        onDeviceChange(notifyListener);
+    }
+
+    private void loadDevices() {
+        mDevices = null;
+
+        Sdk sdk = Sdk.getCurrent();
+        if (sdk != null) {
+            LayoutDeviceManager manager = sdk.getLayoutDeviceManager();
+            mDevices = manager.getCombinedList();
+        }
+    }
+
+    /**
+     * Init the UI with the list of Devices.
+     */
+    private void initUiWithDevices() {
+        // remove older devices if applicable
+        mDeviceList.removeAll();
+        mDeviceConfigs.removeAll();
+
+        // fill with the devices
+        if (mDevices != null) {
+            for (LayoutDevice device : mDevices) {
+                mDeviceList.add(device.getName());
+            }
+            mDeviceList.select(0);
+
+            if (mDevices.size() > 0) {
+                Map<String, FolderConfiguration> configs = mDevices.get(0).getConfigs();
+                Set<String> configNames = configs.keySet();
+                for (String name : configNames) {
+                    mDeviceConfigs.add(name);
+                }
+                mDeviceConfigs.select(0);
+                if (configNames.size() == 1) {
+                    mDeviceConfigs.setEnabled(false);
+                }
+            }
+        }
+
+        // add the custom item
+        mDeviceList.add("Custom...");
+    }
+
+    /**
+     * Call back for language combo selection
+     */
+    private void onLocaleChange() {
+        // because mLanguage triggers onLanguageChange at each modification, the filling
+        // of the combo with data will trigger notifications, and we don't want that.
+        if (mDisableUpdates == true) {
+            return;
+        }
+
+        int localeIndex = mLocale.getSelectionIndex();
+        ResourceQualifier[] localeQualifiers = mLocaleList.get(localeIndex);
+
+        mCurrentConfig.setLanguageQualifier((LanguageQualifier)localeQualifiers[0]); // language
+        mCurrentConfig.setRegionQualifier((RegionQualifier)localeQualifiers[1]); // region
+
+        if (mListener != null) {
+            mListener.onConfigurationChange();
+        }
+    }
+
+    private void onDeviceChange(boolean recomputeLayout) {
+
+        int deviceIndex = mDeviceList.getSelectionIndex();
+        if (deviceIndex != -1) {
+            // check if the user is ask for the custom item
+            if (deviceIndex == mDeviceList.getItemCount() - 1) {
+                ConfigManagerDialog dialog = new ConfigManagerDialog(getShell());
+                dialog.open();
+
+                // save the user devices
+                Sdk.getCurrent().getLayoutDeviceManager().save();
+
+                // reload the combo with the new content.
+                loadDevices();
+                initUiWithDevices();
+
+                // at this point we need to reset the combo to something (hopefully) valid.
+                // look for the previous selected device
+                int index = mDevices.indexOf(mCurrentDevice);
+                if (index != -1) {
+                    mDeviceList.select(index);
+                } else {
+                    // we should at least have one built-in device, so we select it
+                    mDeviceList.select(0);
+                }
+
+                // force a redraw
+                onDeviceChange(true /*recomputeLayout*/);
+
+                return;
+            }
+
+            mCurrentDevice = mDevices.get(deviceIndex);
+        } else {
+            mCurrentDevice = null;
+        }
+
+        mDeviceConfigs.removeAll();
+
+        if (mCurrentDevice != null) {
+            Set<String> configNames = mCurrentDevice.getConfigs().keySet();
+            for (String name : configNames) {
+                mDeviceConfigs.add(name);
+            }
+
+            mDeviceConfigs.select(0);
+            mDeviceConfigs.setEnabled(configNames.size() > 1);
+        }
+        if (recomputeLayout) {
+            onDeviceConfigChange();
+        }
+    }
+
+    private void onDeviceConfigChange() {
+        if (mCurrentDevice != null) {
+            int configIndex = mDeviceConfigs.getSelectionIndex();
+            String name = mDeviceConfigs.getItem(configIndex);
+            FolderConfiguration config = mCurrentDevice.getConfigs().get(name);
+
+            // get the current qualifiers from the current config
+            LanguageQualifier lang = mCurrentConfig.getLanguageQualifier();
+            RegionQualifier region = mCurrentConfig.getRegionQualifier();
+            VersionQualifier version = mCurrentConfig.getVersionQualifier();
+
+            // replace the config with the one from the device
+            mCurrentConfig.set(config);
+
+            // and put back the rest of the qualifiers
+            mCurrentConfig.addQualifier(lang);
+            mCurrentConfig.addQualifier(region);
+            mCurrentConfig.addQualifier(version);
+
+            if (mListener != null) {
+                mListener.onConfigurationChange();
+            }
+        }
+    }
+
+    private void onThemeChange() {
+        int themeIndex = mThemeCombo.getSelectionIndex();
+        if (themeIndex != -1) {
+            String theme = mThemeCombo.getItem(themeIndex);
+
+            if (theme.equals(THEME_SEPARATOR)) {
+                mThemeCombo.select(0);
+            }
+
+            if (mListener != null) {
+                mListener.onThemeChange();
+            }
+        }
+    }
+
+    protected void OnClippingChange() {
+        mClipping = mClippingButton.getSelection();
+        if (mListener != null) {
+            mListener.OnClippingChange();
+        }
+    }
+
+    /**
+     * Returns whether the given <var>style</var> is a theme.
+     * This is done by making sure the parent is a theme.
+     * @param value the style to check
+     * @param styleMap the map of styles for the current project. Key is the style name.
+     * @return True if the given <var>style</var> is a theme.
+     */
+    private boolean isTheme(IResourceValue value, Map<String, IResourceValue> styleMap) {
+        if (value instanceof IStyleResourceValue) {
+            IStyleResourceValue style = (IStyleResourceValue)value;
+
+            boolean frameworkStyle = false;
+            String parentStyle = style.getParentStyle();
+            if (parentStyle == null) {
+                // if there is no specified parent style we look an implied one.
+                // For instance 'Theme.light' is implied child style of 'Theme',
+                // and 'Theme.light.fullscreen' is implied child style of 'Theme.light'
+                String name = style.getName();
+                int index = name.lastIndexOf('.');
+                if (index != -1) {
+                    parentStyle = name.substring(0, index);
+                }
+            } else {
+                // remove the useless @ if it's there
+                if (parentStyle.startsWith("@")) {
+                    parentStyle = parentStyle.substring(1);
+                }
+
+                // check for framework identifier.
+                if (parentStyle.startsWith("android:")) {
+                    frameworkStyle = true;
+                    parentStyle = parentStyle.substring("android:".length());
+                }
+
+                // at this point we could have the format style/<name>. we want only the name
+                if (parentStyle.startsWith("style/")) {
+                    parentStyle = parentStyle.substring("style/".length());
+                }
+            }
+
+            if (parentStyle != null) {
+                if (frameworkStyle) {
+                    // if the parent is a framework style, it has to be 'Theme' or 'Theme.*'
+                    return parentStyle.equals("Theme") || parentStyle.startsWith("Theme.");
+                } else {
+                    // if it's a project style, we check this is a theme.
+                    value = styleMap.get(parentStyle);
+                    if (value != null) {
+                        return isTheme(value, styleMap);
+                    }
+                }
+            }
+        }
+
+        return false;
+    }
+}
+
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/LayoutCreatorDialog.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/LayoutCreatorDialog.java
new file mode 100644
index 0000000..fdbb366
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/LayoutCreatorDialog.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.layout.configuration;
+
+import com.android.ide.eclipse.adt.internal.editors.IconFactory;
+import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ResourceQualifier;
+import com.android.ide.eclipse.adt.internal.resources.manager.ResourceFolderType;
+import com.android.ide.eclipse.adt.internal.ui.ConfigurationSelector;
+import com.android.ide.eclipse.adt.internal.ui.ConfigurationSelector.ConfigurationState;
+import com.android.sdklib.IAndroidTarget;
+import com.android.sdkuilib.ui.GridDialog;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Dialog to choose a non existing {@link FolderConfiguration}.
+ */
+public final class LayoutCreatorDialog extends GridDialog {
+
+    private ConfigurationSelector mSelector;
+    private Composite mStatusComposite;
+    private Label mStatusLabel;
+    private Label mStatusImage;
+
+    private final FolderConfiguration mConfig = new FolderConfiguration();
+    private final String mFileName;
+    private final IAndroidTarget mTarget;
+
+    /**
+     * Creates a dialog, and init the UI from a {@link FolderConfiguration}.
+     * @param parentShell the parent {@link Shell}.
+     * @param config The starting configuration.
+     */
+    public LayoutCreatorDialog(Shell parentShell, String fileName, IAndroidTarget target,
+            FolderConfiguration config) {
+        super(parentShell, 1, false);
+
+        mFileName = fileName;
+        mTarget = target;
+
+        // FIXME: add some data to know what configurations already exist.
+        mConfig.set(config);
+    }
+
+    @Override
+    public void createDialogContent(Composite parent) {
+        new Label(parent, SWT.NONE).setText(
+                String.format("Configuration for the alternate version of %1$s", mFileName));
+
+        mSelector = new ConfigurationSelector(parent, false /*deviceMode*/);
+        mSelector.setConfiguration(mConfig);
+
+        // parent's layout is a GridLayout as specified in the javadoc.
+        GridData gd = new GridData();
+        gd.widthHint = ConfigurationSelector.WIDTH_HINT;
+        gd.heightHint = ConfigurationSelector.HEIGHT_HINT;
+        mSelector.setLayoutData(gd);
+
+        // add a listener to check on the validity of the FolderConfiguration as
+        // they are built.
+        mSelector.setOnChangeListener(new Runnable() {
+            public void run() {
+                ConfigurationState state = mSelector.getState();
+
+                switch (state) {
+                    case OK:
+                        mSelector.getConfiguration(mConfig);
+
+                        resetStatus();
+                        mStatusImage.setImage(null);
+                        getButton(IDialogConstants.OK_ID).setEnabled(true);
+                        break;
+                    case INVALID_CONFIG:
+                        ResourceQualifier invalidQualifier = mSelector.getInvalidQualifier();
+                        mStatusLabel.setText(String.format(
+                                "Invalid Configuration: %1$s has no filter set.",
+                                invalidQualifier.getName()));
+                        mStatusImage.setImage(IconFactory.getInstance().getIcon("warning")); //$NON-NLS-1$
+                        getButton(IDialogConstants.OK_ID).setEnabled(false);
+                        break;
+                    case REGION_WITHOUT_LANGUAGE:
+                        mStatusLabel.setText(
+                                "The Region qualifier requires the Language qualifier.");
+                        mStatusImage.setImage(IconFactory.getInstance().getIcon("warning")); //$NON-NLS-1$
+                        getButton(IDialogConstants.OK_ID).setEnabled(false);
+                        break;
+                }
+
+                // need to relayout, because of the change in size in mErrorImage.
+                mStatusComposite.layout();
+            }
+        });
+
+        mStatusComposite = new Composite(parent, SWT.NONE);
+        mStatusComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        GridLayout gl = new GridLayout(2, false);
+        mStatusComposite.setLayout(gl);
+        gl.marginHeight = gl.marginWidth = 0;
+
+        mStatusImage = new Label(mStatusComposite, SWT.NONE);
+        mStatusLabel = new Label(mStatusComposite, SWT.NONE);
+        mStatusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        resetStatus();
+    }
+
+    public void getConfiguration(FolderConfiguration config) {
+        config.set(mConfig);
+    }
+
+    /**
+     * resets the status label to show the file that will be created.
+     */
+    private void resetStatus() {
+        String displayString = Dialog.shortenText(String.format("New File: res/%1$s/%2$s",
+                mConfig.getFolderName(ResourceFolderType.LAYOUT, mTarget), mFileName),
+                mStatusLabel);
+        mStatusLabel.setText(displayString);
+    }
+}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/DropFeedback.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/DropFeedback.java
index 327b53c..d75e016 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/DropFeedback.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/DropFeedback.java
@@ -4,7 +4,7 @@
  * Licensed under the Eclipse Public License, Version 1.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.eclipse.org/org/documents/epl-v10.php
  *
  * Unless required by applicable law or agreed to in writing, software
@@ -35,6 +35,8 @@
  * This class uses some temporary static storage to avoid excessive allocations during
  * drop operations. It is expected to only be invoked from the main UI thread with no
  * concurrent access.
+ *
+ * @since GLE1
  */
 class DropFeedback {
 
@@ -43,12 +45,12 @@
     private static final int BOTTOM = 2;
     private static final int RIGHT  = 3;
     private static final int MAX_DIR = RIGHT;
-    
+
     private static final int sOppositeDirection[] = { BOTTOM, RIGHT, TOP, LEFT };
 
     private static final UiElementEditPart sTempClosests[] = new UiElementEditPart[4];
     private static final int sTempMinDists[] = new int[4];
-    
+
 
     /**
      * Target information computed from a drop on a RelativeLayout.
@@ -69,20 +71,20 @@
     private static final RelativeInfo sRelativeInfo = new RelativeInfo();
     /** A temporary array of 2 {@link UiElementEditPart} to avoid allocations. */
     private static final UiElementEditPart sTempTwoParts[] = new UiElementEditPart[2];
-    
+
 
     private DropFeedback() {
     }
 
-    
+
     //----- Package methods called by users of this helper class -----
-    
-    
+
+
     /**
      * This method is used by {@link ElementCreateCommand#execute()} when a new item
      * needs to be "dropped" in the current XML document. It creates the new item using
      * the given descriptor as a child of the given parent part.
-     * 
+     *
      * @param parentPart The parent part.
      * @param descriptor The descriptor for the new XML element.
      * @param where      The drop location (in parent coordinates)
@@ -91,16 +93,16 @@
     static void addElementToXml(UiElementEditPart parentPart,
             ElementDescriptor descriptor, Point where,
             UiEditorActions actions) {
-        
+
         String layoutXmlName = getXmlLocalName(parentPart);
         RelativeInfo info = null;
         UiElementEditPart sibling = null;
-        
+
         // TODO consider merge like a vertical layout
         // TODO consider TableLayout like a linear
         if (LayoutConstants.LINEAR_LAYOUT.equals(layoutXmlName)) {
             sibling = findLinearTarget(parentPart, where)[1];
-            
+
         } else if (LayoutConstants.RELATIVE_LAYOUT.equals(layoutXmlName)) {
             info = findRelativeTarget(parentPart, where, sRelativeInfo);
             if (info != null) {
@@ -114,7 +116,7 @@
             UiElementNode uiParent = parentPart.getUiNode();
             UiElementNode uiNode = actions.addElement(uiParent, uiSibling, descriptor,
                     false /*updateLayout*/);
-            
+
             if (LayoutConstants.ABSOLUTE_LAYOUT.equals(layoutXmlName)) {
                 adjustAbsoluteAttributes(uiNode, where);
             } else if (LayoutConstants.RELATIVE_LAYOUT.equals(layoutXmlName)) {
@@ -128,8 +130,8 @@
      * highlight information when a drop target is moved over a valid drop area.
      * <p/>
      * Since there are no "out" parameters in Java, all the information is returned
-     * via the {@link HighlightInfo} structure passed as parameter. 
-     * 
+     * via the {@link HighlightInfo} structure passed as parameter.
+     *
      * @param parentPart    The parent part, always a layout.
      * @param highlightInfo A structure where result is stored to perform highlight.
      * @param where         The target drop point, in parent's coordinates
@@ -139,16 +141,16 @@
             HighlightInfo highlightInfo,
             Point where) {
         String layoutType = getXmlLocalName(parentPart);
-        
+
         if (LayoutConstants.ABSOLUTE_LAYOUT.equals(layoutType)) {
             highlightInfo.anchorPoint = where;
-            
+
         } else if (LayoutConstants.LINEAR_LAYOUT.equals(layoutType)) {
             boolean isVertical = isVertical(parentPart);
 
             highlightInfo.childParts = findLinearTarget(parentPart, where);
             computeLinearLine(parentPart, isVertical, highlightInfo);
-            
+
         } else if (LayoutConstants.RELATIVE_LAYOUT.equals(layoutType)) {
 
             RelativeInfo info = findRelativeTarget(parentPart, where, sRelativeInfo);
@@ -157,13 +159,13 @@
                 computeRelativeLine(parentPart, info, highlightInfo);
             }
         }
-        
+
         return highlightInfo;
     }
-    
-    
+
+
     //----- Misc utilities -----
-    
+
     /**
      * Returns the next UI sibling of this part, i.e. the element which is just after in
      * the UI/XML order in the same parent. Returns null if there's no such part.
@@ -208,7 +210,7 @@
 
     /**
      * Adjusts the attributes of a new node dropped in an AbsoluteLayout.
-     * 
+     *
      * @param uiNode The new node being dropped.
      * @param where  The drop location (in parent coordinates)
      */
@@ -237,12 +239,12 @@
      *      will "attach". The anchor part can be null, either because the layout is currently
      *      empty or the user is attaching to an existing empty border.
      * <li> direction: the direction from the anchor part to the drop point. That's also the
-     *      direction from the anchor part to the new part. 
+     *      direction from the anchor part to the new part.
      * <li> the new node; it is created either after the anchor for right or top directions
-     *      or before the anchor for left or bottom directions. This means the new part can 
-     *      reference the id of the anchor part. 
+     *      or before the anchor for left or bottom directions. This means the new part can
+     *      reference the id of the anchor part.
      * </ul>
-     * 
+     *
      * Several cases:
      * <ul>
      * <li> set:  layout_above/below/toLeftOf/toRightOf to point to the anchor.
@@ -251,7 +253,7 @@
      * <li> copy: layout_above/below/toLeftOf/toRightOf for the orthogonal direction
      *            (i.e. top/bottom or left/right.)
      * </ul>
-     * 
+     *
      * @param uiNode The new node being dropped.
      * @param info   The context computed by {@link #findRelativeTarget(UiElementEditPart, Point, RelativeInfo)}.
      */
@@ -259,10 +261,10 @@
         if (uiNode == null || info == null) {
             return;
         }
-        
-        final UiElementEditPart anchorPart = info.targetParts[info.anchorIndex];  // can be null       
+
+        final UiElementEditPart anchorPart = info.targetParts[info.anchorIndex];  // can be null
         final int direction = info.direction;
-        
+
         uiNode.getEditor().editXmlModel(new Runnable() {
             public void run() {
                 HashMap<String, String> map = new HashMap<String, String>();
@@ -276,7 +278,7 @@
                     anchorId = DescriptorsUtils.getFreeWidgetId(anchorUiNode);
                     anchorUiNode.setAttributeValue("id", anchorId, true /*override*/); //$NON-NLS-1$
                 }
-                
+
                 if (anchorId != null) {
                     switch(direction) {
                     case TOP:
@@ -315,7 +317,7 @@
                         map.put(LayoutConstants.ATTR_LAYOUT_ALIGN_BASELINE,
                                 anchorUiNode.getAttributeValue(
                                         LayoutConstants.ATTR_LAYOUT_ALIGN_BASELINE));
-                        
+
                         map.put(LayoutConstants.ATTR_LAYOUT_ABOVE,
                                 anchorUiNode.getAttributeValue(LayoutConstants.ATTR_LAYOUT_ABOVE));
                         map.put(LayoutConstants.ATTR_LAYOUT_BELOW,
@@ -344,7 +346,7 @@
                         break;
                     }
                 }
-                
+
                 for (Entry<String, String> entry : map.entrySet()) {
                     uiNode.setAttributeValue(entry.getKey(), entry.getValue(), true /* override */);
                 }
@@ -365,7 +367,7 @@
      * <p/>
      * It returns null if it can't be determined, in which case the element will be added at the
      * end of the parent child list.
-     * 
+     *
      * @return The edit parts that correspond to what will be the "prev" and "next sibling" of the
      *         new element. The previous sibling can be null if adding before the first element.
      *         The next sibling can be null if adding after the last element.
@@ -373,9 +375,9 @@
     private static UiElementEditPart[] findLinearTarget(UiElementEditPart parent, Point point) {
         // default orientation is horizontal
         boolean isVertical = isVertical(parent);
-        
+
         int target = isVertical ? point.y : point.x;
-        
+
         UiElementEditPart prev = null;
         UiElementEditPart next = null;
 
@@ -391,7 +393,7 @@
                 prev = childPart;
             }
         }
-        
+
         sTempTwoParts[0] = prev;
         sTempTwoParts[1] = next;
         return sTempTwoParts;
@@ -405,7 +407,7 @@
      * The result is stored in HighlightInfo.
      * <p/>
      * Caller must clear the HighlightInfo as appropriate before this call.
-     * 
+     *
      * @param parentPart    The parent part, always a layout.
      * @param isVertical    True for vertical parts, thus computing an horizontal line.
      * @param highlightInfo The in-out highlight info.
@@ -455,18 +457,18 @@
 
     /**
      * Returns true if the linear layout is marked as vertical.
-     * 
-     * @param parent The a layout part that must be a LinearLayout 
+     *
+     * @param parent The a layout part that must be a LinearLayout
      * @return True if the linear layout has a vertical orientation attribute.
      */
     private static boolean isVertical(UiElementEditPart parent) {
         String orientation = parent.getStringAttr("orientation");     //$NON-NLS-1$
-        boolean isVertical = "vertical".equals(orientation) ||        //$NON-NLS-1$ 
+        boolean isVertical = "vertical".equals(orientation) ||        //$NON-NLS-1$
                              "1".equals(orientation);                 //$NON-NLS-1$
         return isVertical;
     }
 
-    
+
     //----- RelativeLayout --------
 
     /**
@@ -481,26 +483,26 @@
      * <p/>
      * If the drop point is not exactly on a current element, find the closest in each
      * direction and align with the two closest of these.
-     * 
+     *
      * @return null if we fail to find anything (such as there are currently no items to compare
      *         with); otherwise fills the {@link RelativeInfo} and return it.
      */
     private static RelativeInfo findRelativeTarget(UiElementEditPart parent,
             Point point,
             RelativeInfo outInfo) {
-        
+
         for (int i = 0; i < 4; i++) {
             sTempMinDists[i] = Integer.MAX_VALUE;
             sTempClosests[i] = null;
         }
 
-        
+
         for (Object child : parent.getChildren()) {
             if (child instanceof UiElementEditPart) {
                 UiElementEditPart childPart = (UiElementEditPart) child;
                 Rectangle r = childPart.getBounds();
                 if (r.contains(point)) {
-                    
+
                     float rx = ((float)(point.x - r.x) / (float)r.width ) - 0.5f;
                     float ry = ((float)(point.y - r.y) / (float)r.height) - 0.5f;
 
@@ -537,18 +539,18 @@
 
                     return outInfo;
                 }
-                
+
                 computeClosest(point, childPart, sTempClosests, sTempMinDists, TOP);
                 computeClosest(point, childPart, sTempClosests, sTempMinDists, LEFT);
                 computeClosest(point, childPart, sTempClosests, sTempMinDists, BOTTOM);
                 computeClosest(point, childPart, sTempClosests, sTempMinDists, RIGHT);
             }
         }
-        
+
         UiElementEditPart closest = null;
         int minDist = Integer.MAX_VALUE;
         int minDir = -1;
-        
+
         for (int i = 0; i <= MAX_DIR; i++) {
             if (sTempClosests[i] != null && sTempMinDists[i] < minDist) {
                 closest = sTempClosests[i];
@@ -556,7 +558,7 @@
                 minDir = i;
             }
         }
-        
+
         if (closest != null) {
             int index = 0;
             switch(minDir) {
@@ -662,7 +664,7 @@
 
         Point p = null;
         boolean usable = false;
-        
+
         switch(direction) {
         case TOP:
             p = r.getBottom();
@@ -701,7 +703,7 @@
         if (referencePart == null || referencePart.getParent() == null) {
             return null;
         }
-        
+
         Rectangle r = referencePart.getBounds();
         Point ref = null;
         switch(direction) {
@@ -718,16 +720,16 @@
             ref = r.getRight();
             break;
         }
-        
+
         int minDist = Integer.MAX_VALUE;
         UiElementEditPart closestPart = null;
-        
+
         for (Object childPart : referencePart.getParent().getChildren()) {
             if (childPart != referencePart && childPart instanceof UiElementEditPart) {
                 r = ((UiElementEditPart) childPart).getBounds();
                 Point p = null;
                 boolean usable = false;
-                
+
                 switch(direction) {
                 case TOP:
                     p = r.getBottom();
@@ -756,7 +758,7 @@
                 }
             }
         }
-        
+
         return closestPart;
     }
 
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/ElementCreateCommand.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/ElementCreateCommand.java
index 0795b90..562570f 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/ElementCreateCommand.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/ElementCreateCommand.java
@@ -29,6 +29,8 @@
 /**
  * A command that knows how to instantiate a new element based on a given {@link ElementDescriptor},
  * the parent {@link UiElementEditPart} and an optional target location.
+ *
+ * @since GLE1
  */
 public class ElementCreateCommand extends Command {
 
@@ -41,7 +43,7 @@
 
     /**
      * Creates a new {@link ElementCreateCommand}.
-     * 
+     *
      * @param descriptor Descriptor of the new element to create
      * @param targetPart The edit part that hosts the new edit part
      * @param targetPoint The drop location in parent coordinates
@@ -52,7 +54,7 @@
                 mParentPart = targetPart;
                 mTargetPoint = targetPoint;
     }
-    
+
     // --- Methods inherited from Command ---
 
     @Override
@@ -82,14 +84,14 @@
                     }
                 });
             }
-        }        
+        }
     }
 
     @Override
     public void redo() {
         throw new UnsupportedOperationException("redo not supported by this command"); //$NON-NLS-1$
     }
-    
+
     @Override
     public void undo() {
         throw new UnsupportedOperationException("undo not supported by this command"); //$NON-NLS-1$
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/ElementFigure.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/ElementFigure.java
index 2d82058..23c2c9e 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/ElementFigure.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/ElementFigure.java
@@ -22,11 +22,13 @@
 import org.eclipse.draw2d.geometry.Rectangle;
 import org.eclipse.swt.SWT;
 
-    
+
 /**
  * The figure used to draw basic elements.
  * <p/>
  * The figure is totally empty and transparent except for the selection border.
+ *
+ * @since GLE1
  */
 class ElementFigure extends Figure {
 
@@ -36,18 +38,18 @@
     public ElementFigure() {
         setOpaque(false);
     }
-    
+
     public void setSelected(boolean isSelected) {
         if (isSelected != mIsSelected) {
             mIsSelected = isSelected;
             repaint();
         }
     }
-    
+
     @Override
     public void setBounds(Rectangle rect) {
         super.setBounds(rect);
-        
+
         mInnerBounds = getBounds().getCopy();
         if (mInnerBounds.width > 0) {
             mInnerBounds.width--;
@@ -56,11 +58,11 @@
             mInnerBounds.height--;
         }
     }
-    
+
     public Rectangle getInnerBounds() {
         return mInnerBounds;
     }
-    
+
     @Override
     protected void paintBorder(Graphics graphics) {
         super.paintBorder(graphics);
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/LayoutFigure.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/LayoutFigure.java
index 4e5527f..6334751 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/LayoutFigure.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/LayoutFigure.java
@@ -30,11 +30,13 @@
  * By default the figure is transparent and empty.
  * The base {@link ElementFigure} knows how to draw the selection border.
  * This figure knows how to draw the drop feedback.
+ *
+ * @since GLE1
  */
 class LayoutFigure extends ElementFigure {
 
     private HighlightInfo mHighlightInfo;
-    
+
     public LayoutFigure() {
         super();
     }
@@ -50,12 +52,12 @@
      * The parent {@link Figure#paint(Graphics)} calls {@link #paintFigure(Graphics)} then
      * {@link #paintClientArea(Graphics)} then {@link #paintBorder(Graphics)}. Here we thus
      * draw the actual highlight border but also the highlight anchor lines and points so that
-     * we can make sure they are all drawn on top of the border. 
+     * we can make sure they are all drawn on top of the border.
      * <p/>
      * Note: This method doesn't really need to restore its graphic state. The parent
      * Figure will do it for us.
      * <p/>
-     * 
+     *
      * @param graphics The Graphics object used for painting
      */
     @Override
@@ -98,7 +100,7 @@
             int y1 = mHighlightInfo.linePoints[0].y;
             int x2 = mHighlightInfo.linePoints[1].x;
             int y2 = mHighlightInfo.linePoints[1].y;
-            
+
             // if the line is right to the edge, draw it one pixel more inside so that the
             // full 2-pixel width be visible.
             if (x1 <= 0) x1++;
@@ -110,12 +112,12 @@
             if (x2 >= w - 1) x2--;
             if (y1 >= h - 1) y1--;
             if (y2 >= h - 1) y2--;
-            
+
             x1 += bx;
             x2 += bx;
             y1 += by;
             y2 += by;
-            
+
             graphics.setLineWidth(2);
             graphics.setLineStyle(SWT.LINE_DASH);
             graphics.setLineCap(SWT.CAP_ROUND);
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiDocumentEditPart.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiDocumentEditPart.java
index d12856c..9f6557c 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiDocumentEditPart.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiDocumentEditPart.java
@@ -46,27 +46,29 @@
 /**
  * Graphical edit part for the root document.
  * <p/>
- * It acts as a simple container. 
+ * It acts as a simple container.
+ *
+ * @since GLE1
  */
 public class UiDocumentEditPart extends UiElementEditPart {
-    
+
     private Display mDisplay;
     private FreeformLayer mLayer;
     private ImageBackground mImage;
     private Label mChild = null;
-    
+
     final static class ImageBackground extends AbstractBackground {
-        
+
         private BufferedImage mBufferedImage;
         private Image mImage;
 
         ImageBackground() {
         }
-        
+
         ImageBackground(BufferedImage image, Display display) {
             setImage(image, display);
         }
-        
+
         @Override
         public void paintBackground(IFigure figure, Graphics graphics, Insets insets) {
             if (mImage != null) {
@@ -74,7 +76,7 @@
                 graphics.drawImage(mImage, rect.x, rect.y);
             }
         }
-        
+
         void setImage(BufferedImage image, Display display) {
             if (image != null) {
                 int[] data = ((DataBufferInt)image.getData().getDataBuffer()).getData();
@@ -104,27 +106,27 @@
     protected IFigure createFigure() {
         mLayer = new FreeformLayer();
         mLayer.setLayoutManager(new FreeformLayout());
-        
+
         mLayer.setOpaque(true);
         mLayer.setBackgroundColor(ColorConstants.lightGray);
-        
+
         return mLayer;
     }
-    
+
     @Override
     protected void refreshVisuals() {
         UiElementNode model = (UiElementNode)getModel();
-        
+
         Object editData = model.getEditData();
         if (editData instanceof BufferedImage) {
             BufferedImage image = (BufferedImage)editData;
-            
+
             if (mImage == null || image != mImage.getBufferedImage()) {
                 mImage = new ImageBackground(image, mDisplay);
             }
-            
+
             mLayer.setBorder(mImage);
-            
+
             if (mChild != null && mChild.getParent() == mLayer) {
                 mLayer.remove(mChild);
             }
@@ -156,7 +158,7 @@
     protected void showSelection() {
         // no selection at this level.
     }
-    
+
     @Override
     protected void createEditPolicies() {
         super.createEditPolicies();
@@ -168,12 +170,12 @@
     }
 
     /**
-     * Returns the EditPart that should be used as the target for the specified Request. 
+     * Returns the EditPart that should be used as the target for the specified Request.
      * For instance this is called during drag'n'drop with a CreateRequest.
      * <p/>
      * For the root document, we want the first child edit part to the be the target
      * since an XML document can have only one root element.
-     * 
+     *
      * {@inheritDoc}
      */
     @Override
@@ -194,7 +196,7 @@
                             return null;
                         }
                     }
-                    
+
                 }
             }
 
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiDocumentTreeEditPart.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiDocumentTreeEditPart.java
index 57db255..b78c519 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiDocumentTreeEditPart.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiDocumentTreeEditPart.java
@@ -22,13 +22,15 @@
 
 /**
  * Implementation of {@link UiElementTreeEditPart} for the document root.
+ *
+ * @since GLE1
  */
 public class UiDocumentTreeEditPart extends UiElementTreeEditPart {
 
     public UiDocumentTreeEditPart(UiDocumentNode model) {
         super(model);
     }
-    
+
     @SuppressWarnings("unchecked")
     @Override
     protected List getModelChildren() {
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementEditPart.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementEditPart.java
index 94590c5..75c7b6d 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementEditPart.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementEditPart.java
@@ -44,10 +44,12 @@
 
 /**
  * An {@link EditPart} for a {@link UiElementNode}.
+ *
+ * @since GLE1
  */
 public abstract class UiElementEditPart extends AbstractGraphicalEditPart
     implements IUiUpdateListener {
-    
+
     public UiElementEditPart(UiElementNode uiElementNode) {
         setModel(uiElementNode);
     }
@@ -60,7 +62,7 @@
 
     //-------------------------
     // Base class overrides
-    
+
     @Override
     public DragTracker getDragTracker(Request request) {
         return new SelectEditPartTracker(this);
@@ -71,12 +73,12 @@
         /*
          * This is no longer needed, as a selection edit policy is set by the parent layout.
          * Leave this code commented out right now, I'll want to play with this later.
-         * 
+         *
         installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE,
                 new NonResizableSelectionEditPolicy(this));
          */
     }
-    
+
     /* (non-javadoc)
      * Returns a List containing the children model objects.
      * Must not return null, instead use the super which returns an empty list.
@@ -92,7 +94,7 @@
         super.activate();
         getUiNode().addUpdateListener(this);
     }
-    
+
     @Override
     public void deactivate() {
         super.deactivate();
@@ -104,11 +106,11 @@
         if (getFigure().getParent() != null) {
             ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), getBounds());
         }
-        
+
         // update the visuals of the children as well
         refreshChildrenVisuals();
     }
-    
+
     protected void refreshChildrenVisuals() {
         if (children != null) {
             for (Object child : children) {
@@ -131,7 +133,7 @@
             break;
         case CHILDREN_CHANGED:
             refreshChildren();
-            
+
             // new children list, need to update the layout
             refreshVisuals();
             break;
@@ -151,19 +153,19 @@
     public final UiElementNode getUiNode() {
         return (UiElementNode) getModel();
     }
-    
+
     protected final ElementDescriptor getDescriptor() {
         return getUiNode().getDescriptor();
     }
-    
+
     protected final UiElementEditPart getEditPartParent() {
         EditPart parent = getParent();
         if (parent instanceof UiElementEditPart) {
-            return (UiElementEditPart)parent; 
+            return (UiElementEditPart)parent;
         }
         return null;
     }
-    
+
     /**
      * Returns a given XML attribute.
      * @param attrName The local name of the attribute.
@@ -186,17 +188,17 @@
         }
         return null;
     }
-    
+
     protected final Rectangle getBounds() {
         UiElementNode model = (UiElementNode)getModel();
-        
+
         Object editData = model.getEditData();
 
         if (editData != null) {
             // assert with fully qualified class name to prevent import changes to another
             // Rectangle class.
             assert (editData instanceof org.eclipse.draw2d.geometry.Rectangle);
-    
+
             return (Rectangle)editData;
         }
 
@@ -205,12 +207,12 @@
     }
 
     /**
-     * Returns the EditPart that should be used as the target for the specified Request. 
+     * Returns the EditPart that should be used as the target for the specified Request.
      * <p/>
      * For instance this is called during drag'n'drop with a CreateRequest.
      * <p/>
      * Reject being a target for elements which descriptor does not allow children.
-     * 
+     *
      * {@inheritDoc}
      */
     @Override
@@ -227,7 +229,7 @@
     /**
      * Used by derived classes {@link UiDocumentEditPart} and {@link UiLayoutEditPart}
      * to accept drag'n'drop of new items from the palette.
-     * 
+     *
      * @param layoutEditPart The layout edit part where this policy is installed. It can
      *        be either a {@link UiDocumentEditPart} or a {@link UiLayoutEditPart}.
      */
@@ -269,18 +271,18 @@
                     Point where = request.getLocation().getCopy();
                     Point origin = getLayoutContainer().getClientArea().getLocation();
                     where.translate(origin.getNegated());
-                    
+
                     // The host is the EditPart where this policy is installed,
                     // e.g. this UiElementEditPart.
                     EditPart host = getHost();
                     if (host instanceof UiElementEditPart) {
-                        
+
                         return new ElementCreateCommand((ElementDescriptor) newType,
                                 (UiElementEditPart) host,
                                 where);
                     }
                 }
-                
+
                 return null;
             }
 
@@ -289,14 +291,14 @@
                 // TODO Auto-generated method stub
                 return null;
             }
-            
+
             @Override
             public void showLayoutTargetFeedback(Request request) {
                 super.showLayoutTargetFeedback(request);
-                
+
                 // for debugging
                 // System.out.println("target: " + request.toString() + " -- " + layoutEditPart.getUiNode().getBreadcrumbTrailDescription(false));
-                
+
                 if (layoutEditPart instanceof UiLayoutEditPart &&
                         request instanceof DropRequest) {
                     Point where = ((DropRequest) request).getLocation().getCopy();
@@ -314,24 +316,24 @@
                     ((UiLayoutEditPart) layoutEditPart).hideDropTarget();
                 }
             }
-            
+
             @Override
             protected IFigure createSizeOnDropFeedback(CreateRequest createRequest) {
                 // TODO understand if this is useful for us or remove
                 return super.createSizeOnDropFeedback(createRequest);
             }
-            
+
         });
     }
-    
+
     protected static class NonResizableSelectionEditPolicy extends SelectionEditPolicy {
-        
+
         private final UiElementEditPart mEditPart;
 
         public NonResizableSelectionEditPolicy(UiElementEditPart editPart) {
             mEditPart = editPart;
         }
-        
+
         @Override
         protected void hideSelection() {
             mEditPart.hideSelection();
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementTreeEditPart.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementTreeEditPart.java
index 459919a..81737f8 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementTreeEditPart.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementTreeEditPart.java
@@ -25,6 +25,8 @@
 /**
  * Base {@link AbstractTreeEditPart} to represent {@link UiElementNode} objects in the
  * {@link IContentOutlinePage} linked to the layout editor.
+ *
+ * @since GLE1
  */
 public class UiElementTreeEditPart extends AbstractTreeEditPart {
 
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementTreeEditPartFactory.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementTreeEditPartFactory.java
index 4c9eeb8..c10298c 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementTreeEditPartFactory.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementTreeEditPartFactory.java
@@ -26,7 +26,9 @@
 
 /**
  * {@link EditPartFactory} to create {@link AbstractTreeEditPart} for {@link UiElementNode} objects.
- * These objects are used in the {@link IContentOutlinePage} linked to the layout editor. 
+ * These objects are used in the {@link IContentOutlinePage} linked to the layout editor.
+ *
+ * @since GLE1
  */
 public class UiElementTreeEditPartFactory implements EditPartFactory {
 
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementsEditPartFactory.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementsEditPartFactory.java
index 8fe4702..5f17937 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementsEditPartFactory.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiElementsEditPartFactory.java
@@ -28,15 +28,17 @@
  * <p/>
  * The only model objects we use are {@link UiElementNode} objects and they are
  * edited using {@link UiElementEditPart}.
+ *
+ * @since GLE1
  */
 public class UiElementsEditPartFactory implements EditPartFactory {
-    
+
     private Display mDisplay;
 
     public UiElementsEditPartFactory(Display display) {
         mDisplay = display;
     }
-    
+
     public EditPart createEditPart(EditPart context, Object model) {
         if (model instanceof UiDocumentNode) {
             return new UiDocumentEditPart((UiDocumentNode) model, mDisplay);
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiLayoutEditPart.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiLayoutEditPart.java
index 2fe0a59..14d6edb 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiLayoutEditPart.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiLayoutEditPart.java
@@ -29,10 +29,12 @@
 /**
  * Graphical edit part for an {@link UiElementNode} that represents a ViewLayout.
  * <p/>
- * It acts as a simple container. 
+ * It acts as a simple container.
+ *
+ * @since GLE1
  */
 public final class UiLayoutEditPart extends UiElementEditPart {
-    
+
     static class HighlightInfo {
         public boolean drawDropBorder;
         public UiElementEditPart[] childParts;
@@ -48,24 +50,24 @@
             linePoints = null;
         }
     }
-    
+
     private final HighlightInfo mHighlightInfo = new HighlightInfo();
-    
+
     public UiLayoutEditPart(UiElementNode uiElementNode) {
         super(uiElementNode);
     }
-    
+
     @Override
     protected void createEditPolicies() {
         super.createEditPolicies();
-        
+
         installEditPolicy(EditPolicy.CONTAINER_ROLE, new ContainerEditPolicy() {
             @Override
             protected Command getCreateCommand(CreateRequest request) {
                 return null;
             }
         });
-        
+
         installLayoutEditPolicy(this);
     }
 
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiLayoutTreeEditPart.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiLayoutTreeEditPart.java
index 09fdc86..5e78b46 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiLayoutTreeEditPart.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiLayoutTreeEditPart.java
@@ -22,13 +22,15 @@
 
 /**
  * Implementation of {@link UiElementTreeEditPart} for layout objects.
+ *
+ * @since GLE1
  */
 public class UiLayoutTreeEditPart extends UiElementTreeEditPart {
 
     public UiLayoutTreeEditPart(UiElementNode node) {
         super(node);
     }
-    
+
     @SuppressWarnings("unchecked")
     @Override
     protected List getModelChildren() {
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiViewEditPart.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiViewEditPart.java
index e8a1b83..430e1ce 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiViewEditPart.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiViewEditPart.java
@@ -23,6 +23,8 @@
 
 /**
  * Graphical edit part for an {@link UiElementNode} that represents a View.
+ *
+ * @since GLE1
  */
 public class UiViewEditPart extends UiElementEditPart {
 
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiViewTreeEditPart.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiViewTreeEditPart.java
index b505ec0..22cc952 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiViewTreeEditPart.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/parts/UiViewTreeEditPart.java
@@ -20,6 +20,8 @@
 
 /**
  * Implementation of {@link UiElementTreeEditPart} for view objects.
+ *
+ * @since GLE1
  */
 public class UiViewTreeEditPart extends UiElementTreeEditPart {
 
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiClassAttributeNode.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiClassAttributeNode.java
index 3119b70..d5abc09 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiClassAttributeNode.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiClassAttributeNode.java
@@ -25,8 +25,8 @@
 import com.android.ide.eclipse.adt.internal.editors.ui.SectionHelper;
 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiTextAttributeNode;
-import com.android.ide.eclipse.adt.internal.project.AndroidManifestParser;
 import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper;
+import com.android.sdklib.xml.AndroidManifest;
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
@@ -94,9 +94,9 @@
     private IPostTypeCreationAction mPostCreationAction;
     private boolean mMandatory;
     private final boolean mDefaultToProjectOnly;
-    
+
     private class HierarchyTypeSelection extends TypeSelectionExtension {
-        
+
         private IJavaProject mJavaProject;
         private IType mReferenceType;
         private Button mProjectOnly;
@@ -112,13 +112,13 @@
         public ITypeInfoFilterExtension getFilterExtension() {
             return new ITypeInfoFilterExtension() {
                 public boolean select(ITypeInfoRequestor typeInfoRequestor) {
-                    
+
                     boolean projectOnly = mUseProjectOnly;
-                    
+
                     String packageName = typeInfoRequestor.getPackageName();
                     String typeName = typeInfoRequestor.getTypeName();
                     String enclosingType = typeInfoRequestor.getEnclosingName();
-                    
+
                     // build the full class name.
                     StringBuilder sb = new StringBuilder(packageName);
                     sb.append('.');
@@ -127,9 +127,9 @@
                         sb.append('.');
                     }
                     sb.append(typeName);
-                    
+
                     String className = sb.toString();
-                    
+
                     try {
                         IType type = mJavaProject.findType(className);
 
@@ -150,11 +150,11 @@
                                 return false;
                             }
                         }
-                        
+
                         // get the type hierarchy and reference type is one of the super classes.
                         ITypeHierarchy hierarchy = type.newSupertypeHierarchy(
                                 new NullProgressMonitor());
-                        
+
                         IType[] supertypes = hierarchy.getAllSupertypes(type);
                         int n = supertypes.length;
                         for (int i = 0; i < n; i++) {
@@ -165,12 +165,12 @@
                         }
                     } catch (JavaModelException e) {
                     }
-                    
+
                     return false;
                 }
             };
         }
-        
+
         @Override
         public Control createContentArea(Composite parent) {
 
@@ -178,10 +178,10 @@
             mProjectOnly.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
             mProjectOnly.setText(String.format("Display classes from sources of project '%s' only",
                     mJavaProject.getProject().getName()));
-            
+
             mUseProjectOnly = mDefaultToProjectOnly;
             mProjectOnly.setSelection(mUseProjectOnly);
-            
+
             mProjectOnly.addSelectionListener(new SelectionAdapter() {
                 @Override
                 public void widgetSelected(SelectionEvent e) {
@@ -190,7 +190,7 @@
                     getTypeSelectionComponent().triggerSearch();
                 }
             });
-            
+
             return super.createContentArea(parent);
         }
     }
@@ -216,13 +216,13 @@
      * @param mandatory indicates if the class value is mandatory
      * @param attributeDescriptor the {@link AttributeDescriptor} object linked to the Ui Node.
      * @param defaultToProjectOnly When true display classes of this project only by default.
-     *         When false any class path will be considered. The user can always toggle this. 
+     *         When false any class path will be considered. The user can always toggle this.
      */
     public UiClassAttributeNode(String referenceClass, IPostTypeCreationAction postCreationAction,
             boolean mandatory, AttributeDescriptor attributeDescriptor, UiElementNode uiParent,
             boolean defaultToProjectOnly) {
         super(attributeDescriptor, uiParent);
-        
+
         mReferenceClass = referenceClass;
         mPostCreationAction = postCreationAction;
         mMandatory = mandatory;
@@ -256,7 +256,7 @@
         });
         formText.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE));
         SectionHelper.addControlTooltip(formText, desc.getTooltip());
-        
+
         Composite composite = toolkit.createComposite(parent);
         composite.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.MIDDLE));
         GridLayout gl = new GridLayout(2, false);
@@ -265,13 +265,13 @@
         // Fixes missing text borders under GTK... also requires adding a 1-pixel margin
         // for the text field below
         toolkit.paintBordersFor(composite);
-        
+
         final Text text = toolkit.createText(composite, getCurrentValue());
         GridData gd = new GridData(GridData.FILL_HORIZONTAL);
         gd.horizontalIndent = 1;  // Needed by the fixed composite borders under GTK
         text.setLayoutData(gd);
         Button browseButton = toolkit.createButton(composite, "Browse...", SWT.PUSH);
-        
+
         setTextWidget(text);
 
         browseButton.addSelectionListener(new SelectionAdapter() {
@@ -282,9 +282,9 @@
             }
         });
     }
-    
+
     /* (non-java doc)
-     * 
+     *
      * Add a modify listener that will check the validity of the class
      */
     @Override
@@ -305,12 +305,12 @@
                     String javaPackage = getManifestPackage();
 
                     // build the fully qualified name of the class
-                    String className = AndroidManifestParser.combinePackageAndClassName(
+                    String className = AndroidManifest.combinePackageAndClassName(
                             javaPackage, textValue);
-                    
+
                     // only test the vilibility for activities.
                     boolean testVisibility = AndroidConstants.CLASS_ACTIVITY.equals(
-                            mReferenceClass); 
+                            mReferenceClass);
 
                     // test the class
                     setErrorMessage(BaseProjectHelper.testClassForManifest(
@@ -339,11 +339,11 @@
 
     private void handleBrowseClick() {
         Text text = getTextWidget();
-        
+
         // we need to get the project of the manifest.
         IProject project = getProject();
         if (project != null) {
-            
+
             // Create a search scope including only the source folder of the current
             // project.
             IPackageFragmentRoot[] packageFragmentRoots = getPackageFragmentRoots(project,
@@ -365,7 +365,7 @@
                 if (dlg instanceof ITypeSelectionComponent) {
                     ((ITypeSelectionComponent)dlg).triggerSearch();
                 }
-                
+
                 if (dlg.open() == Window.OK) {
                     Object[] results = dlg.getResult();
                     if (results.length == 1) {
@@ -384,7 +384,7 @@
 
         // get the package name from the manifest.
         String packageName = getManifestPackage();
-        
+
         if (className.length() == 0) {
             createNewClass(packageName, null /* className */);
         } else {
@@ -398,10 +398,10 @@
                     fullClassName = packageName + "." + className; //$NON-NLS-1$
                 }
             }
-            
+
             // in case the type is enclosed, we need to replace the $ with .
             fullClassName = fullClassName.replaceAll("\\$", "\\."); //$NON-NLS-1$ //$NON-NLS2$
-            
+
             // now we try to find the file that contains this class and we open it in the editor.
             IProject project = getProject();
             IJavaProject javaProject = JavaCore.create(project);
@@ -427,7 +427,7 @@
             }
         }
     }
-    
+
     private IProject getProject() {
         UiElementNode uiNode = getUiParent();
         AndroidEditor editor = uiNode.getEditor();
@@ -437,7 +437,7 @@
             IFile file = ((IFileEditorInput)input).getFile();
             return file.getProject();
         }
-        
+
         return null;
     }
 
@@ -449,7 +449,7 @@
     private String getManifestPackage() {
         // get the root uiNode to get the 'package' attribute value.
         UiElementNode rootNode = getUiParent().getUiRoot();
-                  
+
         Element xmlElement = (Element) rootNode.getXmlNode();
 
         if (xmlElement != null) {
@@ -485,20 +485,20 @@
 
         return result.toArray(new IPackageFragmentRoot[result.size()]);
     }
-    
+
     private void handleNewType(IType type) {
         Text text = getTextWidget();
 
         // get the fully qualified name with $ to properly detect the enclosing types.
         String name = type.getFullyQualifiedName('$');
-        
+
         String packageValue = getManifestPackage();
-        
+
         // check if the class doesn't start with the package.
         if (packageValue.length() > 0 && name.startsWith(packageValue)) {
             // if it does, we remove the package and the first dot.
             name = name.substring(packageValue.length() + 1);
-            
+
             // look for how many segments we have left.
             // if one, just write it that way.
             // if more than one, write it with a leading dot.
@@ -512,14 +512,14 @@
             text.setText(name);
         }
     }
-    
+
     private void createNewClass(String packageName, String className) {
         // create the wizard page for the class creation, and configure it
         NewClassWizardPage page = new NewClassWizardPage();
-        
+
         // set the parent class
         page.setSuperClass(mReferenceClass, true /* canBeModified */);
-        
+
         // get the source folders as java elements.
         IPackageFragmentRoot[] roots = getPackageFragmentRoots(getProject(),
                 true /*include_containers*/);
@@ -527,7 +527,7 @@
         IPackageFragmentRoot currentRoot = null;
         IPackageFragment currentFragment = null;
         int packageMatchCount = -1;
-        
+
         for (IPackageFragmentRoot root : roots) {
             // Get the java element for the package.
             // This method is said to always return a IPackageFragment even if the
@@ -564,7 +564,7 @@
                 }
             }
         }
-        
+
         ArrayList<IPackageFragment> createdFragments = null;
 
         if (currentRoot != null) {
@@ -578,7 +578,7 @@
                 // know what to delete in case of a cancel.
                 try {
                     createdFragments = new ArrayList<IPackageFragment>();
-                    
+
                     int totalCount = packageName.split("\\.").length; //$NON-NLS-1$
                     int count = 0;
                     int index = -1;
@@ -587,7 +587,7 @@
                         index = packageName.indexOf('.', index+1);
                         count++;
                     }
-                    
+
                     // create the rest of the segments, except for the last one as indexOf will
                     // return -1;
                     while (count < totalCount - 1) {
@@ -597,11 +597,11 @@
                                 packageName.substring(0, index),
                                 true /* force*/, new NullProgressMonitor()));
                     }
-                    
+
                     // create the last package
                     createdFragments.add(currentRoot.createPackageFragment(
                             packageName, true /* force*/, new NullProgressMonitor()));
-                    
+
                     // set the root and fragment in the Wizard page
                     page.setPackageFragmentRoot(currentRoot, true /* canBeModified*/);
                     page.setPackageFragment(createdFragments.get(createdFragments.size()-1),
@@ -626,27 +626,27 @@
             // if we haven't found a valid fragment, we set the root to the first source folder.
             page.setPackageFragmentRoot(roots[0], true /* canBeModified*/);
         }
-        
+
         // if we have a starting class name we use it
         if (className != null) {
             page.setTypeName(className, true /* canBeModified*/);
         }
-        
+
         // create the action that will open it the wizard.
         OpenNewClassWizardAction action = new OpenNewClassWizardAction();
         action.setConfiguredWizardPage(page);
         action.run();
         IJavaElement element = action.getCreatedElement();
-        
+
         if (element != null) {
             if (element.getElementType() == IJavaElement.TYPE) {
-                    
+
                 IType type = (IType)element;
-                
+
                 if (mPostCreationAction != null) {
                     mPostCreationAction.processNewType(type);
                 }
-                
+
                 handleNewType(type);
             }
         } else {
@@ -663,7 +663,7 @@
             }
         }
     }
-    
+
     /**
      * Sets the error messages. If message is <code>null</code>, the message is removed.
      * @param message the message to set, or <code>null</code> to remove the current message
@@ -679,7 +679,7 @@
             getManagedForm().getMessageManager().removeMessage(textWidget, textWidget);
         }
     }
-    
+
     @Override
     public String[] getPossibleValues(String prefix) {
         // TODO: compute a list of existing classes for content assist completion
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiManifestElementNode.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiManifestElementNode.java
index 62b6d9d..5dc8544 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiManifestElementNode.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/model/UiManifestElementNode.java
@@ -21,6 +21,7 @@
 import com.android.ide.eclipse.adt.internal.editors.manifest.descriptors.ManifestElementDescriptor;
 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiAttributeNode;
 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
+import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
 import com.android.sdklib.SdkConstants;
 
 import org.w3c.dom.Element;
@@ -41,10 +42,10 @@
  * {@link ElementDescriptor}.
  */
 public final class UiManifestElementNode extends UiElementNode {
-    
+
     /**
      * Creates a new {@link UiElementNode} described by a given {@link ElementDescriptor}.
-     * 
+     *
      * @param elementDescriptor The {@link ElementDescriptor} for the XML node. Cannot be null.
      */
     public UiManifestElementNode(ManifestElementDescriptor elementDescriptor) {
@@ -55,18 +56,23 @@
      * Computes a short string describing the UI node suitable for tree views.
      * Uses the element's attribute "android:name" if present, or the "android:label" one
      * followed by the element's name.
-     * 
+     *
      * @return A short string describing the UI node suitable for tree views.
      */
     @Override
     public String getShortDescription() {
-        if (getXmlNode() != null &&
+        AndroidTargetData target = getAndroidTarget();
+        AndroidManifestDescriptors manifestDescriptors = null;
+        if (target != null) {
+            manifestDescriptors = target.getManifestDescriptors();
+        }
+
+        if (manifestDescriptors != null &&
+                getXmlNode() != null &&
                 getXmlNode() instanceof Element &&
                 getXmlNode().hasAttributes()) {
 
-            AndroidManifestDescriptors manifestDescriptors =
-                    getAndroidTarget().getManifestDescriptors();
-            
+
             // Application and Manifest nodes have a special treatment: they are unique nodes
             // so we don't bother trying to differentiate their strings and we fall back to
             // just using the UI name below.
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/tree/UiTreeBlock.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/tree/UiTreeBlock.java
index a0546c1..1641284 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/tree/UiTreeBlock.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/tree/UiTreeBlock.java
@@ -90,7 +90,7 @@
 
     /** Container editor */
     AndroidEditor mEditor;
-    /** The root {@link UiElementNode} which contains all the elements that are to be 
+    /** The root {@link UiElementNode} which contains all the elements that are to be
      *  manipulated by this tree view. In general this is the manifest UI node. */
     private UiElementNode mUiRootNode;
     /** The descriptor of the elements to be displayed as root in this tree view. All elements
@@ -104,7 +104,7 @@
     private ManifestSectionPart mMasterPart;
     /** The tree viewer in the master-detail part */
     private TreeViewer mTreeViewer;
-    /** The "add" button for the tree view */ 
+    /** The "add" button for the tree view */
     private Button mAddButton;
     /** The "remove" button for the tree view */
     private Button mRemoveButton;
@@ -137,7 +137,7 @@
     /**
      * Creates a new {@link MasterDetailsBlock} that will display all UI nodes matching the
      * given filter in the given root node.
-     * 
+     *
      * @param editor The parent manifest editor.
      * @param uiRootNode The root {@link UiElementNode} which contains all the elements that are
      *        to be manipulated by this tree view. In general this is the manifest UI node or the
@@ -165,17 +165,17 @@
         mTitle = title;
         mDescription = description;
     }
-    
+
     /** @returns The container editor */
     AndroidEditor getEditor() {
         return mEditor;
     }
-    
+
     /** @returns The reference to the clipboard for copy-paste */
     Clipboard getClipboard() {
         return mClipboard;
     }
-    
+
     /** @returns The master-detail part, composed of a main tree and an auxiliary detail part */
     ManifestSectionPart getMasterPart() {
         return mMasterPart;
@@ -186,7 +186,7 @@
      * <p/>
      * This is used by the content provider attached to {@link #mTreeViewer} since
      * the uiRootNode changes after each call to
-     * {@link #changeRootAndDescriptors(UiElementNode, ElementDescriptor[], boolean)}. 
+     * {@link #changeRootAndDescriptors(UiElementNode, ElementDescriptor[], boolean)}.
      */
     public UiElementNode getRootNode() {
         return mUiRootNode;
@@ -215,21 +215,21 @@
     private void createSectionActions(Section section, FormToolkit toolkit) {
         ToolBarManager manager = new ToolBarManager(SWT.FLAT);
         manager.removeAll();
-        
-        ToolBar toolbar = manager.createControl(section);        
+
+        ToolBar toolbar = manager.createControl(section);
         section.setTextClient(toolbar);
-        
+
         ElementDescriptor[] descs = mDescriptorFilters;
         if (descs == null && mUiRootNode != null) {
             descs = mUiRootNode.getDescriptor().getChildren();
         }
-        
+
         if (descs != null && descs.length > 1) {
             for (ElementDescriptor desc : descs) {
                 manager.add(new DescriptorFilterAction(desc));
             }
         }
-        
+
         manager.add(new TreeSortAction());
 
         manager.update(true /*force*/);
@@ -264,7 +264,7 @@
                 adjustTreeButtons(event.getSelection());
             }
         });
-        
+
         // Create three listeners:
         // - One to refresh the tree viewer when the parent's node has been updated
         // - One to refresh the tree viewer when the framework resources have changed
@@ -274,7 +274,7 @@
                 mTreeViewer.refresh();
             }
         };
-        
+
         mUiEnableListener = new IUiUpdateListener() {
             public void uiElementNodeUpdated(UiElementNode ui_node, UiUpdateState state) {
                 // The UiElementNode for the application XML node always exists, even
@@ -345,7 +345,7 @@
                 }
             }
         });
-        
+
         // Get a new clipboard reference. It is disposed when the tree is disposed.
         mClipboard = new Clipboard(tree.getDisplay());
 
@@ -357,7 +357,7 @@
      * <p/>
      * This removes the listeners attached to the old root node and reattaches them to the
      * new one.
-     * 
+     *
      * @param uiRootNode The root {@link UiElementNode} which contains all the elements that are
      *        to be manipulated by this tree view. In general this is the manifest UI node or the
      *        application UI node. This cannot be null.
@@ -375,7 +375,7 @@
             node.removeUpdateListener(mUiRefreshListener);
             mUiRootNode.removeUpdateListener(mUiEnableListener);
         }
-        
+
         mUiRootNode = uiRootNode;
         mDescriptorFilters = descriptorFilters;
 
@@ -385,13 +385,13 @@
         // If the node has a parent, listen on the parent instead.
         node = mUiRootNode.getUiParent() != null ? mUiRootNode.getUiParent() : mUiRootNode;
         node.addUpdateListener(mUiRefreshListener);
-        
+
         // Use the root node to listen to its presence.
         mUiRootNode.addUpdateListener(mUiEnableListener);
 
         // Initialize the enabled/disabled state
         mUiEnableListener.uiElementNodeUpdated(mUiRootNode, null /* state, not used */);
-        
+
         if (forceRefresh) {
             mTreeViewer.refresh();
         }
@@ -403,9 +403,9 @@
      * Creates the buttons next to the tree.
      */
     private void createButtons(FormToolkit toolkit, Composite grid) {
-        
+
         mUiTreeActions = new UiTreeActions();
-        
+
         Composite button_grid = SectionHelper.createGridLayout(grid, toolkit, 1);
         button_grid.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
         mAddButton = toolkit.createButton(button_grid, "Add...", SWT.PUSH);
@@ -420,11 +420,11 @@
                 doTreeAdd();
             }
         });
-        
+
         mRemoveButton = toolkit.createButton(button_grid, "Remove...", SWT.PUSH);
         SectionHelper.addControlTooltip(mRemoveButton, "Removes an existing selected element.");
         mRemoveButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-        
+
         mRemoveButton.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
@@ -432,11 +432,11 @@
                 doTreeRemove();
             }
         });
-        
+
         mUpButton = toolkit.createButton(button_grid, "Up", SWT.PUSH);
         SectionHelper.addControlTooltip(mRemoveButton, "Moves the selected element up.");
         mUpButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-        
+
         mUpButton.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
@@ -448,7 +448,7 @@
         mDownButton = toolkit.createButton(button_grid, "Down", SWT.PUSH);
         SectionHelper.addControlTooltip(mRemoveButton, "Moves the selected element down.");
         mDownButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-        
+
         mDownButton.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
@@ -478,7 +478,7 @@
                    return;
                }
                doCreateMenuAction(manager, null /* ui_node */);
-            } 
+            }
         });
         Menu contextMenu = menuManager.createContextMenu(tree);
         tree.setMenu(contextMenu);
@@ -487,7 +487,7 @@
     /**
      * Adds the menu actions to the context menu when the given UI node is selected in
      * the tree view.
-     * 
+     *
      * @param manager The context menu manager
      * @param selected The UI nodes selected in the tree. Can be null, in which case the root
      *                is to be modified.
@@ -526,7 +526,6 @@
 
         // Append "add" and "remove" actions. They do the same thing as the add/remove
         // buttons on the side.
-        Action action;
         IconFactory factory = IconFactory.getInstance();
 
         // "Add" makes sense only if there's 0 or 1 item selected since the
@@ -552,7 +551,7 @@
                 });
             }
             manager.add(new Separator());
-            
+
             manager.add(new Action("Up", factory.getImageDescriptor("up")) { //$NON-NLS-1$
                 @Override
                 public void run() {
@@ -570,7 +569,7 @@
         }
     }
 
-    
+
     /**
      * This is called by the tree when a selection is made.
      * It enables/disables the buttons associated with the tree depending on the current
@@ -619,16 +618,16 @@
     /**
      * Filters an ITreeSelection to only keep the {@link UiElementNode}s (in case there's
      * something else in there).
-     * 
+     *
      * @return A new list of {@link UiElementNode} with at least one item or null.
      */
     @SuppressWarnings("unchecked")
     private ArrayList<UiElementNode> filterSelection(ITreeSelection selection) {
         ArrayList<UiElementNode> selected = new ArrayList<UiElementNode>();
-        
+
         for (Iterator it = selection.iterator(); it.hasNext(); ) {
             Object selectedObj = it.next();
-        
+
             if (selectedObj instanceof UiElementNode) {
                 selected.add((UiElementNode) selectedObj);
             }
@@ -639,7 +638,7 @@
 
     /**
      * Called when the "Add..." button next to the tree view is selected.
-     * 
+     *
      * Displays a selection dialog that lets the user select which kind of node
      * to create, depending on the current selection.
      */
@@ -663,7 +662,7 @@
 
     /**
      * Called when the "Remove" button is selected.
-     * 
+     *
      * If the tree has a selection, remove it.
      * This simply deletes the XML node attached to the UI node: when the XML model fires the
      * update event, the tree will get refreshed.
@@ -689,10 +688,10 @@
             mUiTreeActions.doUp(selected);
         }
     }
-    
+
     /**
      * Called when the "Down" button is selected.
-     * 
+     *
      * If the tree has a selection, move it down, either in the same child list or as the
      * first child of the next parent.
      */
@@ -729,16 +728,16 @@
         // Keep a reference on the details part (the super class doesn't provide a getter
         // for it.)
         mDetailsPart = detailsPart;
-        
+
         // The page selection mechanism does not use pages registered by association with
         // a node class. Instead it uses a custom details page provider that provides a
         // new UiElementDetail instance for each node instance. A limit of 5 pages is
         // then set (the value is arbitrary but should be reasonable) for the internal
         // page book.
         detailsPart.setPageLimit(5);
-        
+
         final UiTreeBlock tree = this;
-        
+
         detailsPart.setPageProvider(new IDetailsPageProvider() {
             public IDetailsPage getPage(Object key) {
                 if (key instanceof UiElementNode) {
@@ -757,13 +756,13 @@
      * An alphabetic sort action for the tree viewer.
      */
     private class TreeSortAction extends Action {
-        
+
         private ViewerComparator mComparator;
 
         public TreeSortAction() {
             super("Sorts elements alphabetically.", AS_CHECK_BOX);
             setImageDescriptor(IconFactory.getInstance().getImageDescriptor("az_sort")); //$NON-NLS-1$
- 
+
             if (mTreeViewer != null) {
                 boolean is_sorted = mTreeViewer.getComparator() != null;
                 setChecked(is_sorted);
@@ -794,7 +793,7 @@
                 }
                 mTreeViewer.setComparator(mComparator);
             }
-            
+
             notifyResult(true /*success*/);
         }
     }
@@ -813,11 +812,11 @@
 
         private final ElementDescriptor mDescriptor;
         private ViewerFilter mFilter;
-        
+
         public DescriptorFilterAction(ElementDescriptor descriptor) {
             super(String.format("Displays only %1$s elements.", descriptor.getUiName()),
                     AS_CHECK_BOX);
-            
+
             mDescriptor = descriptor;
             setImageDescriptor(descriptor.getImageDescriptor());
         }
@@ -830,7 +829,7 @@
         @Override
         public void run() {
             super.run();
-            
+
             if (isChecked()) {
                 if (mFilter == null) {
                     // create filter when required
@@ -868,7 +867,7 @@
             public DescriptorFilter(DescriptorFilterAction action) {
                 mAction = action;
             }
-            
+
             public DescriptorFilterAction getAction() {
                 return mAction;
             }
@@ -890,5 +889,5 @@
             }
         }
     }
-    
+
 }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiElementNode.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiElementNode.java
index 0ff4dfc..b31917e 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiElementNode.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiElementNode.java
@@ -73,12 +73,12 @@
  * an element is selected. The {@link AttributeDescriptor} are used property descriptors.
  */
 public class UiElementNode implements IPropertySource {
-    
+
     /** List of prefixes removed from android:id strings when creating short descriptions. */
     private static String[] ID_PREFIXES = {
         "@android:id/", //$NON-NLS-1$
         "@+id/", "@id/", "@+", "@" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-    
+
     /** The element descriptor for the node. Always present, never null. */
     private ElementDescriptor mDescriptor;
     /** The parent element node in the UI model. It is null for a root element or until
@@ -117,17 +117,17 @@
     private boolean mHasError;
     /** Temporary data used by the editors. This data is not sync'ed with the XML */
     private Object mEditData;
-    
+
     /**
      * Creates a new {@link UiElementNode} described by a given {@link ElementDescriptor}.
-     * 
+     *
      * @param elementDescriptor The {@link ElementDescriptor} for the XML node. Cannot be null.
      */
     public UiElementNode(ElementDescriptor elementDescriptor) {
         mDescriptor = elementDescriptor;
         clearContent();
     }
-    
+
     /**
      * Clears the {@link UiElementNode} by resetting the children list and
      * the {@link UiAttributeNode}s list.
@@ -168,7 +168,7 @@
      * <p/>
      * When the descriptor derives from ViewElementDescriptor, this list depends on the
      * current UiParent node.
-     *  
+     *
      * @return A new set of {@link UiAttributeNode} that matches the expected
      *         attributes for this node.
      */
@@ -190,7 +190,7 @@
      * Computes a short string describing the UI node suitable for tree views.
      * Uses the element's attribute "android:name" if present, or the "android:label" one
      * followed by the element's name.
-     * 
+     *
      * @return A short string describing the UI node suitable for tree views.
      */
     public String getShortDescription() {
@@ -200,7 +200,7 @@
             // so we don't bother trying to differentiate their strings and we fall back to
             // just using the UI name below.
             Element elem = (Element) mXmlNode;
-            
+
             String attr = elem.getAttributeNS(SdkConstants.NS_RESOURCES,
                                               AndroidManifestDescriptors.ANDROID_NAME_ATTR);
             if (attr == null || attr.length() == 0) {
@@ -234,11 +234,11 @@
 
         return String.format("%1$s", mDescriptor.getUiName());
     }
-    
+
     /**
      * Computes a "breadcrumb trail" description for this node.
      * It will look something like "Manifest > Application > .myactivity (Activity) > Intent-Filter"
-     * 
+     *
      * @param include_root Whether to include the root (e.g. "Manifest") or not. Has no effect
      *                     when called on the root node itself.
      * @return The "breadcrumb trail" description for this node.
@@ -254,15 +254,15 @@
             }
             sb.insert(0, String.format("%1$s > ", ui_node.getShortDescription())); //$NON-NLS-1$
         }
-        
+
         return sb.toString();
     }
-    
+
     /**
      * Sets the XML {@link Document}.
      * <p/>
      * The XML {@link Document} is initially null. The XML {@link Document} must be set only on the
-     * UI root element node (this method takes care of that.) 
+     * UI root element node (this method takes care of that.)
      */
     public void setXmlDocument(Document xml_doc) {
         if (mUiParent == null) {
@@ -277,7 +277,7 @@
      * <p/>
      * The value is initially null until the UI node is attached to its UI parent -- the value
      * of the document is then propagated.
-     * 
+     *
      * @return the XML {@link Document} or the parent's XML {@link Document} or null.
      */
     public Document getXmlDocument() {
@@ -295,7 +295,7 @@
      * Some {@link ElementDescriptor} are declared as being "mandatory". This means the
      * corresponding UI node will exist even if there is no corresponding XML node. Such structure
      * is created and enforced by the parent of the tree, not the element themselves. However
-     * such nodes will likely not have an XML node associated, so getXmlNode() can return null. 
+     * such nodes will likely not have an XML node associated, so getXmlNode() can return null.
      *
      * @return The associated XML node. Can be null for mandatory nodes.
      */
@@ -317,7 +317,7 @@
      * Returns the {@link AttributeDescriptor} array for the descriptor of this node.
      * <p/>
      * Use this instead of getDescriptor().getAttributes() -- derived classes can override
-     * this to manipulate the attribute descriptor list depending on the current UI node. 
+     * this to manipulate the attribute descriptor list depending on the current UI node.
      */
     public AttributeDescriptor[] getAttributeDescriptors() {
         return mDescriptor.getAttributes();
@@ -337,7 +337,7 @@
             for (AttributeDescriptor attr_desc : getAttributeDescriptors()) {
                 if (attr_desc instanceof XmlnsAttributeDescriptor) {
                     mCachedHiddenAttributes.put(
-                            ((XmlnsAttributeDescriptor) attr_desc).getXmlNsName(), 
+                            ((XmlnsAttributeDescriptor) attr_desc).getXmlNsName(),
                             attr_desc);
                 }
             }
@@ -362,7 +362,7 @@
     public UiElementNode getUiParent() {
         return mUiParent;
     }
-    
+
     /**
      * Returns The root {@link UiElementNode}.
      */
@@ -371,13 +371,13 @@
         while (root.mUiParent != null) {
             root = root.mUiParent;
         }
-        
+
         return root;
     }
 
     /**
      * Returns the previous UI sibling of this UI node.
-     * If the node does not have a previous sibling, returns null. 
+     * If the node does not have a previous sibling, returns null.
      */
     public UiElementNode getUiPreviousSibling() {
         if (mUiParent != null) {
@@ -392,7 +392,7 @@
 
     /**
      * Returns the next UI sibling of this UI node.
-     * If the node does not have a next sibling, returns null. 
+     * If the node does not have a next sibling, returns null.
      */
     public UiElementNode getUiNextSibling() {
         if (mUiParent != null) {
@@ -426,13 +426,13 @@
      * <p/>
      * The value is initially null until the node is attached to its parent -- the value
      * of the root node is then propagated.
-     * 
+     *
      * @return The embedding {@link AndroidEditor} or null.
      */
     public AndroidEditor getEditor() {
         return mUiParent == null ? mEditor : mUiParent.getEditor();
     }
-    
+
     /**
      * Returns the Android target data for the file being edited.
      */
@@ -467,7 +467,7 @@
     public Collection<UiAttributeNode> getUnknownUiAttributes() {
         return Collections.unmodifiableCollection(mUnknownUiAttributes);
     }
-    
+
     /**
      * Sets the error flag value.
      * @param errorFlag the error flag
@@ -475,7 +475,7 @@
     public final void setHasError(boolean errorFlag) {
         mHasError = errorFlag;
     }
-    
+
     /**
      * Returns whether this node, its attributes, or one of the children nodes (and attributes)
      * has errors.
@@ -530,7 +530,7 @@
      * F.ex. "node1/node2" would find a child "node1" that contains a child "node2" and
      * returns the latter. If there are multiple nodes with the same name at the same
      * level, always uses the first one found.
-     * 
+     *
      * @param path The path like expression to select a child node.
      * @return The ui node found or null.
      */
@@ -556,7 +556,7 @@
     /**
      * Finds an {@link UiElementNode} which contains the give XML {@link Node}.
      * Looks recursively in all children UI nodes.
-     * 
+     *
      * @param xmlNode The XML node to look for.
      * @return The {@link UiElementNode} that contains xmlNode or null if not found,
      */
@@ -567,21 +567,21 @@
         if (getXmlNode() == xmlNode) {
             return this;
         }
-        
+
         for (UiElementNode uiChild : mUiChildren) {
             UiElementNode found = uiChild.findXmlNode(xmlNode);
             if (found != null) {
                 return found;
             }
         }
-        
+
         return null;
     }
 
     /**
      * Returns the {@link UiAttributeNode} matching this attribute descriptor or
      * null if not found.
-     * 
+     *
      * @param attr_desc The {@link AttributeDescriptor} to match.
      * @return the {@link UiAttributeNode} matching this attribute descriptor or null
      *         if not found.
@@ -592,13 +592,13 @@
 
     /**
      * Populate this element node with all values from the given XML node.
-     * 
+     *
      * This fails if the given XML node has a different element name -- it won't change the
      * type of this ui node.
-     * 
+     *
      * This method can be both used for populating values the first time and updating values
      * after the XML model changed.
-     * 
+     *
      * @param xml_node The XML node to mirror
      * @return Returns true if the XML structure has changed (nodes added, removed or replaced)
      */
@@ -623,7 +623,7 @@
      * This is used in the special case where the ElementDescriptor structure has changed.
      * Rather than try to diff inflated UI nodes (as loadFromXmlNode does), we don't bother
      * and reload everything. This is not subtle and should be used very rarely.
-     * 
+     *
      * @param xml_node The XML node or document to reload. Can be null.
      */
     public void reloadFromXmlNode(Node xml_node) {
@@ -648,7 +648,7 @@
      * </br>
      * For non-mandatory nodes, simply return the underlying XML node, which
      * must always exists.
-     * 
+     *
      * @return The XML node matching this {@link UiElementNode} or null.
      */
     public Node prepareCommit() {
@@ -669,7 +669,7 @@
         for (UiAttributeNode ui_attr : getInternalUiAttributes().values()) {
             ui_attr.commit();
         }
-        
+
         for (UiAttributeNode ui_attr : mUnknownUiAttributes) {
             ui_attr.commit();
         }
@@ -685,7 +685,7 @@
                 return true;
             }
         }
-        
+
         for (UiAttributeNode ui_attr : mUnknownUiAttributes) {
             if (ui_attr.isDirty()) {
                 return true;
@@ -698,7 +698,7 @@
     /**
      * Creates the underlying XML element node for this UI node if it doesn't already
      * exists.
-     * 
+     *
      * @return The new value of getXmlNode() (can be null if creation failed)
      */
     public Node createXmlNode() {
@@ -732,7 +732,7 @@
         }
 
         mXmlNode = doc.createElement(element_name);
-        
+
         Node xmlNextSibling = null;
 
         UiElementNode uiNextSibling = getUiNextSibling();
@@ -746,7 +746,7 @@
         Text sep = doc.createTextNode("\n");
         parentXmlNode.appendChild(sep);
 
-        // Set all initial attributes in the XML node if they are not empty. 
+        // Set all initial attributes in the XML node if they are not empty.
         // Iterate on the descriptor list to get the desired order and then use the
         // internal values, if any.
         for (AttributeDescriptor attr_desc : getAttributeDescriptors()) {
@@ -762,7 +762,7 @@
                 commitAttributeToXml(ui_attr, ui_attr.getCurrentValue());
             }
         }
-        
+
         invokeUiUpdateListeners(UiUpdateState.CREATED);
         return mXmlNode;
     }
@@ -770,8 +770,8 @@
     /**
      * Removes the XML node corresponding to this UI node if it exists
      * and also removes all mirrored information in this UI node (i.e. children, attributes)
-     * 
-     * @return The removed node or null if it didn't exist in the firtst place. 
+     *
+     * @return The removed node or null if it didn't exist in the firtst place.
      */
     public Node deleteXmlNode() {
         if (mXmlNode == null) {
@@ -783,7 +783,7 @@
         // revisited via loadFromXmlNode).
         Node old_xml_node = mXmlNode;
         clearContent();
-        
+
         Node xml_parent = old_xml_node.getParentNode();
         if (xml_parent == null) {
             xml_parent = getXmlDocument();
@@ -810,7 +810,7 @@
      *      removed unless they are mandatory ui nodes.
      * </ul>
      * Note that only the first case is used when populating the ui list the first time.
-     * 
+     *
      * @param xml_node The XML node to mirror
      * @return True when the XML structure has changed.
      */
@@ -925,9 +925,10 @@
     /**
      * Internal helper to remove an UI child node given by its index in the
      * internal child list.
-     * 
-     * Also invokes the update listener on the node to be deleted.
-     * 
+     *
+     * Also invokes the update listener on the node to be deleted *after* the node has
+     * been removed.
+     *
      * @param ui_index The index of the UI child to remove, range 0 .. mUiChildren.size()-1
      * @return True if the structure has changed
      * @throws IndexOutOfBoundsException if index is out of mUiChildren's bounds. Of course you
@@ -935,26 +936,53 @@
      */
     private boolean removeUiChildAtIndex(int ui_index) {
         UiElementNode ui_node = mUiChildren.get(ui_index);
-        invokeUiUpdateListeners(UiUpdateState.DELETED);
-        if (ui_node.getDescriptor().isMandatory()) {
-            // We can't remove a mandatory node, we just clear its content.
+        ElementDescriptor desc = ui_node.getDescriptor();
 
-            // A mandatory node with no XML means it doesn't really exist, so it can't be
-            // deleted.
-            boolean xml_exists = (ui_node.getXmlNode() != null); 
+        try {
+            if (ui_node.getDescriptor().isMandatory()) {
+                // This is a mandatory node. Such a node must exist in the UiNode hierarchy
+                // even if there's no XML counterpart. However we only need to keep one.
 
-            ui_node.clearContent();
-            return xml_exists;
-        } else {
+                // Check if the parent (e.g. this node) has another similar ui child node.
+                boolean keepNode = true;
+                for (UiElementNode child : mUiChildren) {
+                    if (child != ui_node && child.getDescriptor() == desc) {
+                        // We found another child with the same descriptor that is not
+                        // the node we want to remove. This means we have one mandatory
+                        // node so we can safely remove ui_node.
+                        keepNode = false;
+                        break;
+                    }
+                }
+
+                if (keepNode) {
+                    // We can't remove a mandatory node as we need to keep at least one
+                    // mandatory node in the parent. Instead we just clear its content
+                    // (including its XML Node reference).
+
+                    // A mandatory node with no XML means it doesn't really exist, so it can't be
+                    // deleted. So the structure will change only if the ui node is actually
+                    // associated to an XML node.
+                    boolean xml_exists = (ui_node.getXmlNode() != null);
+
+                    ui_node.clearContent();
+                    return xml_exists;
+                }
+            }
+
             mUiChildren.remove(ui_index);
             return true;
+        } finally {
+            // Tell listeners that a node has been removed.
+            // The model has already been modified.
+            invokeUiUpdateListeners(UiUpdateState.DELETED);
         }
     }
 
     /**
      * Creates a new {@link UiElementNode} from the given {@link ElementDescriptor}
      * and appends it to the end of the element children list.
-     *  
+     *
      * @param descriptor The {@link ElementDescriptor} that knows how to create the UI node.
      * @return The new UI node that has been appended
      */
@@ -970,7 +998,7 @@
     /**
      * Creates a new {@link UiElementNode} from the given {@link ElementDescriptor}
      * and inserts it in the element children list at the specified position.
-     *  
+     *
      * @param index The position where to insert in the element children list.
      * @param descriptor The {@link ElementDescriptor} that knows how to create the UI node.
      * @return The new UI node.
@@ -994,14 +1022,14 @@
      * For each attribute declared in this {@link UiElementNode}, get
      * the corresponding XML attribute. It may not exist, in which case the
      * value will be null. We don't really know if a value has changed, so
-     * the updateValue() is called on the UI sattribute in all cases. 
-     * 
+     * the updateValue() is called on the UI sattribute in all cases.
+     *
      * @param xmlNode The XML node to mirror
      */
     protected void updateAttributeList(Node xmlNode) {
         NamedNodeMap xmlAttrMap = xmlNode.getAttributes();
         HashSet<Node> visited = new HashSet<Node>();
-        
+
         // For all known (i.e. expected) UI attributes, find an existing XML attribute of
         // same (uri, local name) and update the internal Ui attribute value.
         for (UiAttributeNode uiAttr : getInternalUiAttributes().values()) {
@@ -1022,23 +1050,23 @@
 
         // We need to ignore hidden attributes.
         Map<String, AttributeDescriptor> hiddenAttrDesc = getHiddenAttributeDescriptors();
-        
+
         // Traverse the actual XML attribute list to find unknown attributes
         if (xmlAttrMap != null) {
             for (int i = 0; i < xmlAttrMap.getLength(); i++) {
                 Node xmlAttr = xmlAttrMap.item(i);
-                // Ignore attributes which have actual descriptors 
+                // Ignore attributes which have actual descriptors
                 if (visited.contains(xmlAttr)) {
                     continue;
                 }
-                
+
                 String xmlFullName = xmlAttr.getNodeName();
 
                 // Ignore attributes which are hidden (based on the prefix:localName key)
                 if (hiddenAttrDesc.containsKey(xmlFullName)) {
                     continue;
                 }
-                
+
                 String xmlAttrLocalName = xmlAttr.getLocalName();
                 String xmlNsUri = xmlAttr.getNamespaceURI();
 
@@ -1065,10 +1093,10 @@
                     uiAttr = desc.createUiNode(this);
                     mUnknownUiAttributes.add(uiAttr);
                 }
-                
+
                 uiAttr.updateValue(xmlAttr);
             }
-            
+
             // Remove from the internal list unknown attributes that have been deleted from the xml
             for (UiAttributeNode a : deleted) {
                 mUnknownUiAttributes.remove(a);
@@ -1077,7 +1105,7 @@
     }
 
     /**
-     * Invoke all registered {@link IUiUpdateListener} listening on this UI updates for this node.
+     * Invoke all registered {@link IUiUpdateListener} listening on this UI update for this node.
      */
     protected void invokeUiUpdateListeners(UiUpdateState state) {
         if (mUiUpdateListeners != null) {
@@ -1100,15 +1128,18 @@
     protected void setXmlNode(Node xml_node) {
         mXmlNode = xml_node;
     }
-    
+
     /**
      * Sets the temporary data used by the editors.
      * @param data the data.
+     *
+     * @since GLE1
+     * @deprecated Used by GLE1. Should be deprecated for GLE2.
      */
     public void setEditData(Object data) {
         mEditData = data;
     }
-    
+
     /**
      * Returns the temporary data used by the editors for this object.
      * @return the data, or <code>null</code> if none has been set.
@@ -1116,14 +1147,14 @@
     public Object getEditData() {
         return mEditData;
     }
-    
+
     public void refreshUi() {
         invokeUiUpdateListeners(UiUpdateState.ATTR_UPDATED);
     }
-    
+
 
     // ------------- Helpers
-    
+
     /**
      * Helper method to commit a single attribute value to XML.
      * <p/>
@@ -1133,9 +1164,9 @@
      * <p/>
      * Note that the caller MUST ensure that modifying the underlying XML model is
      * safe and must take care of marking the model as dirty if necessary.
-     * 
+     *
      * @see AndroidEditor#editXmlModel(Runnable)
-     * 
+     *
      * @param uiAttr The attribute node to commit. Must be a child of this UiElementNode.
      * @param newValue The new value to set.
      * @return True if the XML attribute was modified or removed, false if nothing changed.
@@ -1146,7 +1177,7 @@
         if (element != null && uiAttr != null) {
             String attrLocalName = uiAttr.getDescriptor().getXmlLocalName();
             String attrNsUri = uiAttr.getDescriptor().getNamespaceUri();
-            
+
             NamedNodeMap attrMap = element.getAttributes();
             if (newValue == null || newValue.length() == 0) {
                 // Remove attribute if it's empty
@@ -1155,7 +1186,7 @@
                     return true;
                 }
             } else {
-                // Add or replace an attribute 
+                // Add or replace an attribute
                 Document doc = element.getOwnerDocument();
                 if (doc != null) {
                     Attr attr = doc.createAttributeNS(attrNsUri, attrLocalName);
@@ -1179,16 +1210,16 @@
      * <p/>
      * Note that the caller MUST ensure that modifying the underlying XML model is
      * safe and must take care of marking the model as dirty if necessary.
-     * 
+     *
      * @see AndroidEditor#editXmlModel(Runnable)
-     * 
+     *
      * @return True if one or more values were actually modified or removed,
      *         false if nothing changed.
      */
     public boolean commitDirtyAttributesToXml() {
         boolean result = false;
         HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
-        
+
         for (Entry<AttributeDescriptor, UiAttributeNode> entry : attributeMap.entrySet()) {
             UiAttributeNode ui_attr = entry.getValue();
             if (ui_attr.isDirty()) {
@@ -1202,7 +1233,7 @@
     /**
      * Returns the namespace prefix matching the requested namespace URI.
      * If no such declaration is found, returns the default "android" prefix.
-     *  
+     *
      * @param node The current node. Must not be null.
      * @param nsUri The namespace URI of which the prefix is to be found,
      *              e.g. SdkConstants.NS_RESOURCES
@@ -1217,15 +1248,15 @@
         if (nsUri == null) {
             return null;
         }
-        
+
         // per XML specification, the "xmlns" URI is reserved
         if (XmlnsAttributeDescriptor.XMLNS_URI.equals(nsUri)) {
             return "xmlns"; //$NON-NLS-1$
         }
-        
+
         HashSet<String> visited = new HashSet<String>();
         Document doc = node == null ? null : node.getOwnerDocument();
-        
+
         for (; node != null && node.getNodeType() == Node.ELEMENT_NODE;
                node = node.getParentNode()) {
             NamedNodeMap attrs = node.getAttributes();
@@ -1242,7 +1273,7 @@
                 }
             }
         }
-        
+
         // Use a sensible default prefix if we can't find one.
         // We need to make sure the prefix is not one that was declared in the scope
         // visited above. Use a default namespace prefix "android" for the Android resource
@@ -1252,7 +1283,7 @@
         for (int i = 1; visited.contains(prefix); i++) {
             prefix = base + Integer.toString(i);
         }
-        
+
         // Also create & define this prefix/URI in the XML document as an attribute in the
         // first element of the document.
         if (doc != null) {
@@ -1267,7 +1298,7 @@
                 node.getAttributes().setNamedItemNS(attr);
             }
         }
-        
+
         return prefix;
     }
 
@@ -1275,16 +1306,16 @@
      * Utility method to internally set the value of a text attribute for the current
      * UiElementNode.
      * <p/>
-     * This method is a helper. It silently ignores the errors such as the requested 
+     * This method is a helper. It silently ignores the errors such as the requested
      * attribute not being present in the element or attribute not being settable.
      * It accepts inherited attributes (such as layout).
      * <p/>
      * This does not commit to the XML model. It does mark the attribute node as dirty.
      * This is up to the caller.
-     * 
+     *
      * @see #commitAttributeToXml(UiAttributeNode, String)
      * @see #commitDirtyAttributesToXml()
-     * 
+     *
      * @param attrXmlName The XML name of the attribute to modify
      * @param value The new value for the attribute. If set to null, the attribute is removed.
      * @param override True if the value must be set even if one already exists.
@@ -1292,11 +1323,11 @@
      */
     public UiAttributeNode setAttributeValue(String attrXmlName, String value, boolean override) {
         HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
-        
+
         if (value == null) {
             value = ""; //$NON-NLS-1$ -- this removes an attribute
         }
-        
+
         for (Entry<AttributeDescriptor, UiAttributeNode> entry : attributeMap.entrySet()) {
             AttributeDescriptor ui_desc = entry.getKey();
             if (ui_desc.getXmlLocalName().equals(attrXmlName)) {
@@ -1325,13 +1356,13 @@
      * <p/>
      * Note that this retrieves the *field* value if the attribute has some UI, and
      * not the actual XML value. They may differ if the attribute is dirty.
-     * 
+     *
      * @param attrXmlName The XML name of the attribute to modify
      * @return The current internal value for the attribute or null in case of error.
      */
     public String getAttributeValue(String attrXmlName) {
         HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
-        
+
         for (Entry<AttributeDescriptor, UiAttributeNode> entry : attributeMap.entrySet()) {
             AttributeDescriptor ui_desc = entry.getKey();
             if (ui_desc.getXmlLocalName().equals(attrXmlName)) {
@@ -1351,7 +1382,7 @@
     /*
      * (non-Javadoc)
      * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
-     * 
+     *
      * Returns the property descriptor for this node. Since the descriptors are not linked to the
      * data, the AttributeDescriptor are used directly.
      */
@@ -1361,22 +1392,22 @@
         // get the standard descriptors
         HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
         Set<AttributeDescriptor> keys = attributeMap.keySet();
-        
-        
+
+
         // we only want the descriptor that do implement the IPropertyDescriptor interface.
         for (AttributeDescriptor key : keys) {
             if (key instanceof IPropertyDescriptor) {
                 propDescs.add((IPropertyDescriptor)key);
             }
         }
-        
+
         // now get the descriptor from the unknown attributes
         for (UiAttributeNode unknownNode : mUnknownUiAttributes) {
             if (unknownNode.getDescriptor() instanceof IPropertyDescriptor) {
                 propDescs.add((IPropertyDescriptor)unknownNode.getDescriptor());
             }
         }
-        
+
         // TODO cache this maybe, as it's not going to change (except for unknown descriptors)
         return propDescs.toArray(new IPropertyDescriptor[propDescs.size()]);
     }
@@ -1384,13 +1415,13 @@
     /*
      * (non-Javadoc)
      * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
-     * 
+     *
      * Returns the value of a given property. The id is the result of IPropertyDescriptor.getId(),
      * which return the AttributeDescriptor itself.
      */
     public Object getPropertyValue(Object id) {
         HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
-        
+
         UiAttributeNode attribute = attributeMap.get(id);
 
         if (attribute == null) {
@@ -1401,56 +1432,56 @@
                 }
             }
         }
-        
+
         return attribute;
     }
 
     /*
      * (non-Javadoc)
      * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
-     * 
+     *
      * Returns whether the property is set. In our case this is if the string is non empty.
      */
     public boolean isPropertySet(Object id) {
         HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
-        
+
         UiAttributeNode attribute = attributeMap.get(id);
 
         if (attribute != null) {
             return attribute.getCurrentValue().length() > 0;
         }
-        
+
         // look for the id in the unknown attributes.
         for (UiAttributeNode unknownAttr : mUnknownUiAttributes) {
             if (id == unknownAttr.getDescriptor()) {
                 return unknownAttr.getCurrentValue().length() > 0;
             }
         }
-        
+
         return false;
     }
 
     /*
      * (non-Javadoc)
      * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
-     * 
+     *
      * Reset the property to its default value. For now we simply empty it.
      */
     public void resetPropertyValue(Object id) {
         HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
-        
+
         UiAttributeNode attribute = attributeMap.get(id);
         if (attribute != null) {
             // TODO: reset the value of the attribute
-            
+
             return;
         }
-        
+
         // look for the id in the unknown attributes.
         for (UiAttributeNode unknownAttr : mUnknownUiAttributes) {
             if (id == unknownAttr.getDescriptor()) {
                 // TODO: reset the value of the attribute
-                
+
                 return;
             }
         }
@@ -1459,15 +1490,15 @@
     /*
      * (non-Javadoc)
      * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
-     * 
+     *
      * Set the property value. id is the result of IPropertyDescriptor.getId(), which is the
      * AttributeDescriptor itself. Value should be a String.
      */
     public void setPropertyValue(Object id, Object value) {
         HashMap<AttributeDescriptor, UiAttributeNode> attributeMap = getInternalUiAttributes();
-        
+
         UiAttributeNode attribute = attributeMap.get(id);
-        
+
         if (attribute == null) {
             // look for the id in the unknown attributes.
             for (UiAttributeNode unknownAttr : mUnknownUiAttributes) {
@@ -1483,7 +1514,7 @@
             // get the current value and compare it to the new value
             String oldValue = attribute.getCurrentValue();
             final String newValue = (String)value;
-            
+
             if (oldValue.equals(newValue)) {
                 return;
             }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/XmlEditor.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/XmlEditor.java
index 0129048..aca6c8f 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/XmlEditor.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/XmlEditor.java
@@ -37,7 +37,7 @@
 import org.w3c.dom.Document;
 
 /**
- * Multi-page form editor for /res/xml XML files. 
+ * Multi-page form editor for /res/xml XML files.
  */
 public class XmlEditor extends AndroidEditor {
 
@@ -69,7 +69,7 @@
      * <p/>
      * The {@link XmlEditor} can handle XML files that have a <searchable> or
      * <Preferences> root XML element with the adequate xmlns:android attribute.
-     * 
+     *
      * @return True if the {@link XmlEditor} can handle that file.
      */
     public static boolean canHandleFile(IFile file) {
@@ -77,14 +77,17 @@
         IProject project = file.getProject();
         IAndroidTarget target = Sdk.getCurrent().getTarget(project);
         if (target != null) {
+            // Note: the target data can be null when an SDK is not finished loading yet.
+            // We can potentially arrive here when Eclipse is started with a file previously
+            // open and the resource gets refreshed -- at that point we may not have the SDK yet.
             AndroidTargetData data = Sdk.getCurrent().getTargetData(target);
-        
+
             FirstElementParser.Result result = FirstElementParser.parse(
                     file.getLocation().toOSString(),
                     SdkConstants.NS_RESOURCES);
-            
-            if (result != null) {
-                String name = result.getElement(); 
+
+            if (result != null && data != null) {
+                String name = result.getElement();
                 if (name != null && result.getXmlnsPrefix() != null) {
                     DocumentDescriptor desc = data.getXmlDescriptors().getDescriptor();
                     for (ElementDescriptor elem : desc.getChildren()) {
@@ -96,7 +99,7 @@
                 }
             }
         }
-        
+
         return false;
     }
 
@@ -106,7 +109,7 @@
      * Returns whether the "save as" operation is supported by this editor.
      * <p/>
      * Save-As is a valid operation for the ManifestEditor since it acts on a
-     * single source file. 
+     * single source file.
      *
      * @see IEditorPart
      */
@@ -125,7 +128,7 @@
         } catch (PartInitException e) {
             AdtPlugin.log(e, "Error creating nested page"); //$NON-NLS-1$
         }
-        
+
     }
 
     /* (non-java doc)
@@ -140,10 +143,10 @@
             setPartName(String.format("%1$s", file.getName()));
         }
     }
-    
+
     /**
      * Processes the new XML Model, which XML root node is given.
-     * 
+     *
      * @param xml_doc The XML document, if available, or null if none exists.
      */
     @Override
@@ -152,10 +155,10 @@
         initUiRootNode(false /*force*/);
 
         mUiRootNode.loadFromXmlNode(xml_doc);
-        
+
         super.xmlModelChanged(xml_doc);
     }
-    
+
     /**
      * Creates the initial UI Root Node, including the known mandatory elements.
      * @param force if true, a new UiRootNode is recreated even if it already exists.
@@ -198,5 +201,5 @@
             mUiRootNode.reloadFromXmlNode(mUiRootNode.getXmlNode());
         }
     }
-    
+
 }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/ActivityLaunchAction.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/ActivityLaunchAction.java
index 09f01ec..d1502d3 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/ActivityLaunchAction.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/ActivityLaunchAction.java
@@ -28,10 +28,10 @@
 
     private final String mActivity;
     private final ILaunchController mLaunchController;
-    
+
     /**
      * Creates a ActivityLaunchAction
-     * 
+     *
      * @param activity fully qualified activity name to launch
      * @param controller the {@link ILaunchController} that performs launch
      */
@@ -39,13 +39,13 @@
         mActivity = activity;
         mLaunchController = controller;
     }
-    
+
     /**
      * Launches the activity on targeted device
-     * 
+     *
      * @param info the {@link DelayedLaunchInfo} that contains launch details
      * @param device the Android device to perform action on
-     * 
+     *
      * @see IAndroidLaunchAction#doLaunchAction(DelayedLaunchInfo, IDevice)
      */
     public boolean doLaunchAction(DelayedLaunchInfo info, IDevice device) {
@@ -65,7 +65,9 @@
                             : "") //$NON-NLS-1$
                     + " -n " //$NON-NLS-1$
                     + info.getPackageName() + "/" //$NON-NLS-1$
-                    + mActivity.replaceAll("\\$", "\\\\\\$"), //$NON-NLS-1$ //$NON-NLS-2$
+                    + mActivity.replaceAll("\\$", "\\\\\\$") //$NON-NLS-1$ //$NON-NLS-2$
+                    + " -a android.intent.action.MAIN"  //$NON-NLS-1$
+                    + " -c android.intent.category.LAUNCHER",  //$NON-NLS-1$
                     new AMReceiver(info, device, mLaunchController));
 
             // if the app is not a debug app, we need to do some clean up, as
@@ -84,14 +86,14 @@
         }
         return true;
     }
-    
+
     /**
      * Returns a description of the activity being launched
-     * 
+     *
      * @see IAndroidLaunchAction#getLaunchDescription()
      */
     public String getLaunchDescription() {
        return String.format("%1$s activity launch", mActivity);
     }
-    
+
 }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java
index b834bcf..eab0c6c 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java
@@ -24,6 +24,7 @@
 import com.android.ddmlib.AndroidDebugBridge.IClientChangeListener;
 import com.android.ddmlib.AndroidDebugBridge.IDebugBridgeChangeListener;
 import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
+import com.android.ddmlib.ClientData.DebuggerStatus;
 import com.android.ide.eclipse.adt.AdtPlugin;
 import com.android.ide.eclipse.adt.internal.launch.AndroidLaunchConfiguration.TargetMode;
 import com.android.ide.eclipse.adt.internal.launch.DelayedLaunchInfo.InstallRetryMode;
@@ -1382,7 +1383,7 @@
      * @param client the updated client.
      * @param changeMask the bit mask describing the changed properties. It can contain
      * any of the following values: {@link Client#CHANGE_INFO}, {@link Client#CHANGE_NAME}
-     * {@link Client#CHANGE_DEBUGGER_INTEREST}, {@link Client#CHANGE_THREAD_MODE},
+     * {@link Client#CHANGE_DEBUGGER_STATUS}, {@link Client#CHANGE_THREAD_MODE},
      * {@link Client#CHANGE_THREAD_DATA}, {@link Client#CHANGE_HEAP_MODE},
      * {@link Client#CHANGE_HEAP_DATA}, {@link Client#CHANGE_NATIVE_HEAP_DATA}
      *
@@ -1445,7 +1446,7 @@
                 }
 
                 // check if it's already waiting for a debugger, and if so we connect to it.
-                if (client.getClientData().getDebuggerConnectionStatus() == ClientData.DEBUGGER_WAITING) {
+                if (client.getClientData().getDebuggerConnectionStatus() == DebuggerStatus.WAITING) {
                     // search for this client in the list;
                     synchronized (sListLock) {
                         int index = mUnknownClientsWaitingForDebugger.indexOf(client);
@@ -1461,10 +1462,10 @@
         // if it's not home, it could be an app that is now in debugger mode that we're waiting for
         // lets check it
 
-        if ((changeMask & Client.CHANGE_DEBUGGER_INTEREST) == Client.CHANGE_DEBUGGER_INTEREST) {
+        if ((changeMask & Client.CHANGE_DEBUGGER_STATUS) == Client.CHANGE_DEBUGGER_STATUS) {
             ClientData clientData = client.getClientData();
             String applicationName = client.getClientData().getClientDescription();
-            if (clientData.getDebuggerConnectionStatus() == ClientData.DEBUGGER_WAITING) {
+            if (clientData.getDebuggerConnectionStatus() == DebuggerStatus.WAITING) {
                 // Get the application name, and make sure its valid.
                 if (applicationName == null) {
                     // looks like we don't have the client yet, so we keep it around for when its
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/AndroidManifestParser.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/AndroidManifestParser.java
index 10e727c..f03749c 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/AndroidManifestParser.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/AndroidManifestParser.java
@@ -20,7 +20,7 @@
 import com.android.ide.eclipse.adt.AndroidConstants;
 import com.android.ide.eclipse.adt.internal.project.XmlErrorHandler.XmlErrorListener;
 import com.android.sdklib.SdkConstants;
-import com.android.sdklib.xml.ManifestConstants;
+import com.android.sdklib.xml.AndroidManifest;
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IMarker;
@@ -285,55 +285,55 @@
                     String value;
                     switch (mValidLevel) {
                         case LEVEL_MANIFEST:
-                            if (ManifestConstants.NODE_MANIFEST.equals(localName)) {
+                            if (AndroidManifest.NODE_MANIFEST.equals(localName)) {
                                 // lets get the package name.
                                 mPackage = getAttributeValue(attributes,
-                                        ManifestConstants.ATTRIBUTE_PACKAGE,
+                                        AndroidManifest.ATTRIBUTE_PACKAGE,
                                         false /* hasNamespace */);
                                 mValidLevel++;
                             }
                             break;
                         case LEVEL_APPLICATION:
-                            if (ManifestConstants.NODE_APPLICATION.equals(localName)) {
+                            if (AndroidManifest.NODE_APPLICATION.equals(localName)) {
                                 value = getAttributeValue(attributes,
-                                        ManifestConstants.ATTRIBUTE_PROCESS,
+                                        AndroidManifest.ATTRIBUTE_PROCESS,
                                         true /* hasNamespace */);
                                 if (value != null) {
                                     addProcessName(value);
                                 }
 
                                 value = getAttributeValue(attributes,
-                                        ManifestConstants.ATTRIBUTE_DEBUGGABLE,
+                                        AndroidManifest.ATTRIBUTE_DEBUGGABLE,
                                         true /* hasNamespace*/);
                                 if (value != null) {
                                     mDebuggable = Boolean.parseBoolean(value);
                                 }
 
                                 mValidLevel++;
-                            } else if (ManifestConstants.NODE_USES_SDK.equals(localName)) {
+                            } else if (AndroidManifest.NODE_USES_SDK.equals(localName)) {
                                 mApiLevelRequirement = getAttributeValue(attributes,
-                                        ManifestConstants.ATTRIBUTE_MIN_SDK_VERSION,
+                                        AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION,
                                         true /* hasNamespace */);
-                            } else if (ManifestConstants.NODE_INSTRUMENTATION.equals(localName)) {
+                            } else if (AndroidManifest.NODE_INSTRUMENTATION.equals(localName)) {
                                 processInstrumentationNode(attributes);
                             }
                             break;
                         case LEVEL_ACTIVITY:
-                            if (ManifestConstants.NODE_ACTIVITY.equals(localName)) {
+                            if (AndroidManifest.NODE_ACTIVITY.equals(localName)) {
                                 processActivityNode(attributes);
                                 mValidLevel++;
-                            } else if (ManifestConstants.NODE_SERVICE.equals(localName)) {
+                            } else if (AndroidManifest.NODE_SERVICE.equals(localName)) {
                                 processNode(attributes, AndroidConstants.CLASS_SERVICE);
                                 mValidLevel++;
-                            } else if (ManifestConstants.NODE_RECEIVER.equals(localName)) {
+                            } else if (AndroidManifest.NODE_RECEIVER.equals(localName)) {
                                 processNode(attributes, AndroidConstants.CLASS_BROADCASTRECEIVER);
                                 mValidLevel++;
-                            } else if (ManifestConstants.NODE_PROVIDER.equals(localName)) {
+                            } else if (AndroidManifest.NODE_PROVIDER.equals(localName)) {
                                 processNode(attributes, AndroidConstants.CLASS_CONTENTPROVIDER);
                                 mValidLevel++;
-                            } else if (ManifestConstants.NODE_USES_LIBRARY.equals(localName)) {
+                            } else if (AndroidManifest.NODE_USES_LIBRARY.equals(localName)) {
                                 value = getAttributeValue(attributes,
-                                        ManifestConstants.ATTRIBUTE_NAME,
+                                        AndroidManifest.ATTRIBUTE_NAME,
                                         true /* hasNamespace */);
                                 if (value != null) {
                                     mLibraries.add(value);
@@ -343,26 +343,26 @@
                         case LEVEL_INTENT_FILTER:
                             // only process this level if we are in an activity
                             if (mCurrentActivity != null &&
-                                    ManifestConstants.NODE_INTENT.equals(localName)) {
+                                    AndroidManifest.NODE_INTENT.equals(localName)) {
                                 mCurrentActivity.resetIntentFilter();
                                 mValidLevel++;
                             }
                             break;
                         case LEVEL_CATEGORY:
                             if (mCurrentActivity != null) {
-                                if (ManifestConstants.NODE_ACTION.equals(localName)) {
+                                if (AndroidManifest.NODE_ACTION.equals(localName)) {
                                     // get the name attribute
                                     String action = getAttributeValue(attributes,
-                                            ManifestConstants.ATTRIBUTE_NAME,
+                                            AndroidManifest.ATTRIBUTE_NAME,
                                             true /* hasNamespace */);
                                     if (action != null) {
                                         mCurrentActivity.setHasAction(true);
                                         mCurrentActivity.setHasMainAction(
                                                 ACTION_MAIN.equals(action));
                                     }
-                                } else if (ManifestConstants.NODE_CATEGORY.equals(localName)) {
+                                } else if (AndroidManifest.NODE_CATEGORY.equals(localName)) {
                                     String category = getAttributeValue(attributes,
-                                            ManifestConstants.ATTRIBUTE_NAME,
+                                            AndroidManifest.ATTRIBUTE_NAME,
                                             true /* hasNamespace */);
                                     if (CATEGORY_LAUNCHER.equals(category)) {
                                         mCurrentActivity.setHasLauncherCategory(true);
@@ -462,14 +462,14 @@
          */
         private void processActivityNode(Attributes attributes) {
             // lets get the activity name, and add it to the list
-            String activityName = getAttributeValue(attributes, ManifestConstants.ATTRIBUTE_NAME,
+            String activityName = getAttributeValue(attributes, AndroidManifest.ATTRIBUTE_NAME,
                     true /* hasNamespace */);
             if (activityName != null) {
-                activityName = combinePackageAndClassName(mPackage, activityName);
+                activityName = AndroidManifest.combinePackageAndClassName(mPackage, activityName);
 
                 // get the exported flag.
                 String exportedStr = getAttributeValue(attributes,
-                        ManifestConstants.ATTRIBUTE_EXPORTED, true);
+                        AndroidManifest.ATTRIBUTE_EXPORTED, true);
                 boolean exported = exportedStr == null ||
                         exportedStr.toLowerCase().equals("true"); // $NON-NLS-1$
                 mCurrentActivity = new Activity(activityName, exported);
@@ -485,7 +485,7 @@
                 mCurrentActivity = null;
             }
 
-            String processName = getAttributeValue(attributes, ManifestConstants.ATTRIBUTE_PROCESS,
+            String processName = getAttributeValue(attributes, AndroidManifest.ATTRIBUTE_PROCESS,
                     true /* hasNamespace */);
             if (processName != null) {
                 addProcessName(processName);
@@ -500,17 +500,17 @@
          */
         private void processNode(Attributes attributes, String superClassName) {
             // lets get the class name, and check it if required.
-            String serviceName = getAttributeValue(attributes, ManifestConstants.ATTRIBUTE_NAME,
+            String serviceName = getAttributeValue(attributes, AndroidManifest.ATTRIBUTE_NAME,
                     true /* hasNamespace */);
             if (serviceName != null) {
-                serviceName = combinePackageAndClassName(mPackage, serviceName);
+                serviceName = AndroidManifest.combinePackageAndClassName(mPackage, serviceName);
 
                 if (mMarkErrors) {
                     checkClass(serviceName, superClassName, false /* testVisibility */);
                 }
             }
 
-            String processName = getAttributeValue(attributes, ManifestConstants.ATTRIBUTE_PROCESS,
+            String processName = getAttributeValue(attributes, AndroidManifest.ATTRIBUTE_PROCESS,
                     true /* hasNamespace */);
             if (processName != null) {
                 addProcessName(processName);
@@ -525,12 +525,13 @@
         private void processInstrumentationNode(Attributes attributes) {
             // lets get the class name, and check it if required.
             String instrumentationName = getAttributeValue(attributes,
-                    ManifestConstants.ATTRIBUTE_NAME,
+                    AndroidManifest.ATTRIBUTE_NAME,
                     true /* hasNamespace */);
             if (instrumentationName != null) {
-                String instrClassName = combinePackageAndClassName(mPackage, instrumentationName);
+                String instrClassName = AndroidManifest.combinePackageAndClassName(mPackage,
+                        instrumentationName);
                 String targetPackage = getAttributeValue(attributes,
-                        ManifestConstants.ATTRIBUTE_TARGET_PACKAGE,
+                        AndroidManifest.ATTRIBUTE_TARGET_PACKAGE,
                         true /* hasNamespace */);
                 mInstrumentations.add(new Instrumentation(instrClassName, targetPackage));
                 if (mMarkErrors) {
@@ -954,39 +955,6 @@
     }
 
     /**
-     * Combines a java package, with a class value from the manifest to make a fully qualified
-     * class name
-     * @param javaPackage the java package from the manifest.
-     * @param className the class name from the manifest.
-     * @return the fully qualified class name.
-     */
-    public static String combinePackageAndClassName(String javaPackage, String className) {
-        if (className == null || className.length() == 0) {
-            return javaPackage;
-        }
-        if (javaPackage == null || javaPackage.length() == 0) {
-            return className;
-        }
-
-        // the class name can be a subpackage (starts with a '.'
-        // char), a simple class name (no dot), or a full java package
-        boolean startWithDot = (className.charAt(0) == '.');
-        boolean hasDot = (className.indexOf('.') != -1);
-        if (startWithDot || hasDot == false) {
-
-            // add the concatenation of the package and class name
-            if (startWithDot) {
-                return javaPackage + className;
-            } else {
-                return javaPackage + '.' + className;
-            }
-        } else {
-            // just add the class as it should be a fully qualified java name.
-            return className;
-        }
-    }
-
-    /**
      * Given a fully qualified activity name (e.g. com.foo.test.MyClass) and given a project
      * package base name (e.g. com.foo), returns the relative activity name that would be used
      * the "name" attribute of an "activity" element.
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/properties/AndroidPropertyPage.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/properties/AndroidPropertyPage.java
index 7dc4ae2..d9d66e9 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/properties/AndroidPropertyPage.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/properties/AndroidPropertyPage.java
@@ -18,7 +18,7 @@
 
 import com.android.ide.eclipse.adt.internal.sdk.Sdk;
 import com.android.sdklib.IAndroidTarget;
-import com.android.sdkuilib.internal.widgets.ApkConfigWidget;
+import com.android.sdklib.internal.project.ApkSettings;
 import com.android.sdkuilib.internal.widgets.SdkTargetSelector;
 
 import org.eclipse.core.resources.IProject;
@@ -33,8 +33,6 @@
 import org.eclipse.ui.IWorkbenchPropertyPage;
 import org.eclipse.ui.dialogs.PropertyPage;
 
-import java.util.Map;
-
 /**
  * Property page for "Android" project.
  * This is accessible from the Package Explorer when right clicking a project and choosing
@@ -45,7 +43,8 @@
 
     private IProject mProject;
     private SdkTargetSelector mSelector;
-    private ApkConfigWidget mApkConfigWidget;
+    // APK-SPLIT: This is not yet supported, so we hide the UI
+//    private Button mSplitByDensity;
 
     public AndroidPropertyPage() {
         // pass
@@ -72,14 +71,17 @@
 
         mSelector = new SdkTargetSelector(top, targets);
 
-        l = new Label(top, SWT.SEPARATOR | SWT.HORIZONTAL);
-        l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        /*
+         * APK-SPLIT: This is not yet supported, so we hide the UI
+        Group g = new Group(top, SWT.NONE);
+        g.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        g.setLayout(new GridLayout(1, false));
+        g.setText("APK Generation");
 
-        l = new Label(top, SWT.NONE);
-        l.setText("Project APK Configurations");
+        mSplitByDensity = new Button(g, SWT.CHECK);
+        mSplitByDensity.setText("One APK per density");
 
-        mApkConfigWidget = new ApkConfigWidget(top);
-
+*/
         // fill the ui
         Sdk currentSdk = Sdk.getCurrent();
         if (currentSdk != null && mProject.isOpen()) {
@@ -89,9 +91,12 @@
                 mSelector.setSelection(target);
             }
 
-            // get the apk configurations
-            Map<String, String> configs = currentSdk.getProjectApkConfigs(mProject);
-            mApkConfigWidget.fillTable(configs);
+            /*
+             * APK-SPLIT: This is not yet supported, so we hide the UI
+            // get the project settings
+            ApkSettings settings = currentSdk.getApkSettings(mProject);
+            mSplitByDensity.setSelection(settings.isSplitByDpi());
+            */
         }
 
         mSelector.setSelectionListener(new SelectionAdapter() {
@@ -114,8 +119,13 @@
     public boolean performOk() {
         Sdk currentSdk = Sdk.getCurrent();
         if (currentSdk != null) {
-            currentSdk.setProject(mProject, mSelector.getSelected(),
-                    mApkConfigWidget.getApkConfigs());
+            ApkSettings apkSettings = new ApkSettings();
+            /*
+             * APK-SPLIT: This is not yet supported, so we hide the UI
+            apkSettings.setSplitByDensity(mSplitByDensity.getSelection());
+             */
+
+            currentSdk.setProject(mProject, mSelector.getSelected(), apkSettings);
         }
 
         return true;
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/extractstring/ExtractStringInputPage.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/extractstring/ExtractStringInputPage.java
index 072b1b8..a54f8b6 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/extractstring/ExtractStringInputPage.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/extractstring/ExtractStringInputPage.java
@@ -208,7 +208,7 @@
         label = new Label(group, SWT.NONE);
         label.setText("&Configuration:");
 
-        mConfigSelector = new ConfigurationSelector(group);
+        mConfigSelector = new ConfigurationSelector(group, false /*deviceMode*/);
         GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
         gd.horizontalSpan = 2;
         gd.widthHint = ConfigurationSelector.WIDTH_HINT;
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/extractstring/ExtractStringRefactoring.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/extractstring/ExtractStringRefactoring.java
index c37fb6b..20ef355 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/extractstring/ExtractStringRefactoring.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/extractstring/ExtractStringRefactoring.java
@@ -50,26 +50,7 @@
 import org.eclipse.jdt.core.dom.AST;
 import org.eclipse.jdt.core.dom.ASTNode;
 import org.eclipse.jdt.core.dom.ASTParser;
-import org.eclipse.jdt.core.dom.ASTVisitor;
-import org.eclipse.jdt.core.dom.ClassInstanceCreation;
 import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.IMethodBinding;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.IVariableBinding;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.MethodInvocation;
-import org.eclipse.jdt.core.dom.Modifier;
-import org.eclipse.jdt.core.dom.Name;
-import org.eclipse.jdt.core.dom.SimpleName;
-import org.eclipse.jdt.core.dom.SimpleType;
-import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.jdt.core.dom.StringLiteral;
-import org.eclipse.jdt.core.dom.Type;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
 import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
 import org.eclipse.jdt.core.dom.rewrite.ImportRewrite;
 import org.eclipse.jface.text.ITextSelection;
@@ -106,7 +87,6 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.TreeMap;
 
 /**
  * This refactoring extracts a string from a file and replaces it by an Android resource ID
@@ -402,7 +382,8 @@
             }
 
             if (!status.isOK()) {
-                status.addFatalError("Selection must be inside a Java source or an Android Layout XML file.");
+                status.addFatalError(
+                        "Selection must be inside a Java source or an Android Layout XML file.");
             }
 
         } finally {
@@ -521,7 +502,8 @@
                     }
 
                     if (node == null) {
-                        status.addFatalError("The selection does not match any element in the XML document.");
+                        status.addFatalError(
+                                "The selection does not match any element in the XML document.");
                         return status.isOK();
                     }
 
@@ -542,79 +524,10 @@
                             sdoc.getRegionAtCharacterOffset(selStart);
                         if (region != null &&
                                 DOMRegionContext.XML_TAG_NAME.equals(region.getType())) {
-                            // The region gives us the textual representation of the XML element
-                            // where the selection starts, split using sub-regions. We now just
-                            // need to iterate through the sub-regions to find which one
-                            // contains the actual selection. We're interested in an attribute
-                            // value however when we find one we want to memorize the attribute
-                            // name that was defined just before.
-
-                            int startInRegion = selStart - region.getStartOffset();
-
-                            int nb = region.getNumberOfRegions();
-                            ITextRegionList list = region.getRegions();
-                            String currAttrValue = null;
-
-                            for (int i = 0; i < nb; i++) {
-                                ITextRegion subRegion = list.get(i);
-                                String type = subRegion.getType();
-
-                                if (DOMRegionContext.XML_TAG_ATTRIBUTE_NAME.equals(type)) {
-                                    currAttrName = region.getText(subRegion);
-
-                                    // I like to select the attribute definition and invoke
-                                    // the extract string wizard. So if the selection is on
-                                    // the attribute name part, find the value that is just
-                                    // after and use it as if it were the selection.
-
-                                    if (subRegion.getStart() <= startInRegion &&
-                                            startInRegion < subRegion.getTextEnd()) {
-                                        // A well-formed attribute is composed of a name,
-                                        // an equal sign and the value. There can't be any space
-                                        // in between, which makes the parsing a lot easier.
-                                        if (i <= nb - 3 &&
-                                                DOMRegionContext.XML_TAG_ATTRIBUTE_EQUALS.equals(
-                                                                       list.get(i + 1).getType())) {
-                                            subRegion = list.get(i + 2);
-                                            type = subRegion.getType();
-                                            if (DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(
-                                                    type)) {
-                                                currAttrValue = region.getText(subRegion);
-                                            }
-                                        }
-                                    }
-
-                                } else if (subRegion.getStart() <= startInRegion &&
-                                        startInRegion < subRegion.getTextEnd() &&
-                                        DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(type)) {
-                                    currAttrValue = region.getText(subRegion);
-                                }
-
-                                if (currAttrValue != null) {
-                                    // We found the value. Only accept it if not empty
-                                    // and if we found an attribute name before.
-                                    String text = currAttrValue;
-
-                                    // The attribute value will contain the XML quotes. Remove them.
-                                    int len = text.length();
-                                    if (len >= 2 &&
-                                            text.charAt(0) == '"' &&
-                                            text.charAt(len - 1) == '"') {
-                                        text = text.substring(1, len - 1);
-                                    } else if (len >= 2 &&
-                                            text.charAt(0) == '\'' &&
-                                            text.charAt(len - 1) == '\'') {
-                                        text = text.substring(1, len - 1);
-                                    }
-                                    if (text.length() > 0 && currAttrName != null) {
-                                        // Setting mTokenString to non-null marks the fact we
-                                        // accept this attribute.
-                                        mTokenString = text;
-                                    }
-
-                                    break;
-                                }
-                            }
+                            // Find if any sub-region representing an attribute contains the
+                            // selection. If it does, returns the name of the attribute in
+                            // currAttrName and returns the value in the field mTokenString.
+                            currAttrName = findSelectionInRegion(region, selStart);
 
                             if (mTokenString == null) {
                                 status.addFatalError(
@@ -625,67 +538,10 @@
 
                     if (mTokenString != null && node != null && currAttrName != null) {
 
-                        UiElementNode rootUiNode = editor.getUiRootNode();
-                        UiElementNode currentUiNode =
-                            rootUiNode == null ? null : rootUiNode.findXmlNode(node);
-                        ReferenceAttributeDescriptor attrDesc = null;
-
-                        if (currentUiNode != null) {
-                            // remove any namespace prefix from the attribute name
-                            String name = currAttrName;
-                            int pos = name.indexOf(':');
-                            if (pos > 0 && pos < name.length() - 1) {
-                                name = name.substring(pos + 1);
-                            }
-
-                            for (UiAttributeNode attrNode : currentUiNode.getUiAttributes()) {
-                                if (attrNode.getDescriptor().getXmlLocalName().equals(name)) {
-                                    AttributeDescriptor desc = attrNode.getDescriptor();
-                                    if (desc instanceof ReferenceAttributeDescriptor) {
-                                        attrDesc = (ReferenceAttributeDescriptor) desc;
-                                    }
-                                    break;
-                                }
-                            }
-                        }
-
-                        // The attribute descriptor is a resource reference. It must either accept
-                        // of any resource type or specifically accept string types.
-                        if (attrDesc != null &&
-                                (attrDesc.getResourceType() == null ||
-                                 attrDesc.getResourceType() == ResourceType.STRING)) {
-                            // We have one more check to do: is the current string value already
-                            // an Android XML string reference? If so, we can't edit it.
-                            if (mTokenString.startsWith("@")) { //$NON-NLS-1$
-                                int pos1 = 0;
-                                if (mTokenString.length() > 1 && mTokenString.charAt(1) == '+') {
-                                    pos1++;
-                                }
-                                int pos2 = mTokenString.indexOf('/');
-                                if (pos2 > pos1) {
-                                    String kind = mTokenString.substring(pos1 + 1, pos2);
-                                    mTokenString = null;
-                                    status.addFatalError(String.format(
-                                            "The attribute %1$s already contains a %2$s reference.",
-                                            currAttrName,
-                                            kind));
-                                }
-                            }
-
-                            if (mTokenString != null) {
-                                // We're done with all our checks. mTokenString contains the
-                                // current attribute value. We don't memorize the region nor the
-                                // attribute, however we memorize the textual attribute name so
-                                // that we can offer replacement for all its occurrences.
-                                mXmlAttributeName = currAttrName;
-                            }
-
-                        } else {
-                            mTokenString = null;
-                            status.addFatalError(String.format(
-                                    "The attribute %1$s does not accept a string reference.",
-                                    currAttrName));
-                        }
+                        // Validate that the attribute accepts a string reference.
+                        // This sets mTokenString to null by side-effect when it fails and
+                        // adds a fatal error to the status as needed.
+                        validateSelectedAttribute(editor, node, currAttrName, status);
 
                     } else {
                         // We shouldn't get here: we're missing one of the token string, the node
@@ -708,6 +564,163 @@
     }
 
     /**
+     * The region gives us the textual representation of the XML element
+     * where the selection starts, split using sub-regions. We now just
+     * need to iterate through the sub-regions to find which one
+     * contains the actual selection. We're interested in an attribute
+     * value however when we find one we want to memorize the attribute
+     * name that was defined just before.
+     *
+     * @return When the cursor is on a valid attribute name or value, returns the string of
+     * attribute name. As a side-effect, returns the value of the attribute in {@link #mTokenString}
+     */
+    private String findSelectionInRegion(IStructuredDocumentRegion region, int selStart) {
+
+        String currAttrName = null;
+
+        int startInRegion = selStart - region.getStartOffset();
+
+        int nb = region.getNumberOfRegions();
+        ITextRegionList list = region.getRegions();
+        String currAttrValue = null;
+
+        for (int i = 0; i < nb; i++) {
+            ITextRegion subRegion = list.get(i);
+            String type = subRegion.getType();
+
+            if (DOMRegionContext.XML_TAG_ATTRIBUTE_NAME.equals(type)) {
+                currAttrName = region.getText(subRegion);
+
+                // I like to select the attribute definition and invoke
+                // the extract string wizard. So if the selection is on
+                // the attribute name part, find the value that is just
+                // after and use it as if it were the selection.
+
+                if (subRegion.getStart() <= startInRegion &&
+                        startInRegion < subRegion.getTextEnd()) {
+                    // A well-formed attribute is composed of a name,
+                    // an equal sign and the value. There can't be any space
+                    // in between, which makes the parsing a lot easier.
+                    if (i <= nb - 3 &&
+                            DOMRegionContext.XML_TAG_ATTRIBUTE_EQUALS.equals(
+                                                   list.get(i + 1).getType())) {
+                        subRegion = list.get(i + 2);
+                        type = subRegion.getType();
+                        if (DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(
+                                type)) {
+                            currAttrValue = region.getText(subRegion);
+                        }
+                    }
+                }
+
+            } else if (subRegion.getStart() <= startInRegion &&
+                    startInRegion < subRegion.getTextEnd() &&
+                    DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(type)) {
+                currAttrValue = region.getText(subRegion);
+            }
+
+            if (currAttrValue != null) {
+                // We found the value. Only accept it if not empty
+                // and if we found an attribute name before.
+                String text = currAttrValue;
+
+                // The attribute value will contain the XML quotes. Remove them.
+                int len = text.length();
+                if (len >= 2 &&
+                        text.charAt(0) == '"' &&
+                        text.charAt(len - 1) == '"') {
+                    text = text.substring(1, len - 1);
+                } else if (len >= 2 &&
+                        text.charAt(0) == '\'' &&
+                        text.charAt(len - 1) == '\'') {
+                    text = text.substring(1, len - 1);
+                }
+                if (text.length() > 0 && currAttrName != null) {
+                    // Setting mTokenString to non-null marks the fact we
+                    // accept this attribute.
+                    mTokenString = text;
+                }
+
+                break;
+            }
+        }
+
+        return currAttrName;
+    }
+
+    /**
+     * Validates that the attribute accepts a string reference.
+     * This sets mTokenString to null by side-effect when it fails and
+     * adds a fatal error to the status as needed.
+     */
+    private void validateSelectedAttribute(AndroidEditor editor, Node node,
+            String attrName, RefactoringStatus status) {
+        UiElementNode rootUiNode = editor.getUiRootNode();
+        UiElementNode currentUiNode =
+            rootUiNode == null ? null : rootUiNode.findXmlNode(node);
+        ReferenceAttributeDescriptor attrDesc = null;
+
+        if (currentUiNode != null) {
+            // remove any namespace prefix from the attribute name
+            String name = attrName;
+            int pos = name.indexOf(':');
+            if (pos > 0 && pos < name.length() - 1) {
+                name = name.substring(pos + 1);
+            }
+
+            for (UiAttributeNode attrNode : currentUiNode.getUiAttributes()) {
+                if (attrNode.getDescriptor().getXmlLocalName().equals(name)) {
+                    AttributeDescriptor desc = attrNode.getDescriptor();
+                    if (desc instanceof ReferenceAttributeDescriptor) {
+                        attrDesc = (ReferenceAttributeDescriptor) desc;
+                    }
+                    break;
+                }
+            }
+        }
+
+        // The attribute descriptor is a resource reference. It must either accept
+        // of any resource type or specifically accept string types.
+        if (attrDesc != null &&
+                (attrDesc.getResourceType() == null ||
+                 attrDesc.getResourceType() == ResourceType.STRING)) {
+            // We have one more check to do: is the current string value already
+            // an Android XML string reference? If so, we can't edit it.
+            if (mTokenString.startsWith("@")) {                             //$NON-NLS-1$
+                int pos1 = 0;
+                if (mTokenString.length() > 1 && mTokenString.charAt(1) == '+') {
+                    pos1++;
+                }
+                int pos2 = mTokenString.indexOf('/');
+                if (pos2 > pos1) {
+                    String kind = mTokenString.substring(pos1 + 1, pos2);
+                    if (ResourceType.STRING.getName().equals(kind)) {                            //$NON-NLS-1$
+                        mTokenString = null;
+                        status.addFatalError(String.format(
+                                "The attribute %1$s already contains a %2$s reference.",
+                                attrName,
+                                kind));
+                    }
+                }
+            }
+
+            if (mTokenString != null) {
+                // We're done with all our checks. mTokenString contains the
+                // current attribute value. We don't memorize the region nor the
+                // attribute, however we memorize the textual attribute name so
+                // that we can offer replacement for all its occurrences.
+                mXmlAttributeName = attrName;
+            }
+
+        } else {
+            mTokenString = null;
+            status.addFatalError(String.format(
+                    "The attribute %1$s does not accept a string reference.",
+                    attrName));
+        }
+    }
+
+    /**
      * Tests from org.eclipse.jdt.internal.corext.refactoringChecks#validateEdit()
      * Might not be useful.
      *
@@ -1373,412 +1386,6 @@
         return null;
     }
 
-    public class ReplaceStringsVisitor extends ASTVisitor {
-
-        private static final String CLASS_ANDROID_CONTEXT    = "android.content.Context"; //$NON-NLS-1$
-        private static final String CLASS_JAVA_CHAR_SEQUENCE = "java.lang.CharSequence";  //$NON-NLS-1$
-        private static final String CLASS_JAVA_STRING        = "java.lang.String";        //$NON-NLS-1$
-
-
-        private final AST mAst;
-        private final ASTRewrite mRewriter;
-        private final String mOldString;
-        private final String mRQualifier;
-        private final String mXmlId;
-        private final ArrayList<TextEditGroup> mEditGroups;
-
-        public ReplaceStringsVisitor(AST ast,
-                ASTRewrite astRewrite,
-                ArrayList<TextEditGroup> editGroups,
-                String oldString,
-                String rQualifier,
-                String xmlId) {
-            mAst = ast;
-            mRewriter = astRewrite;
-            mEditGroups = editGroups;
-            mOldString = oldString;
-            mRQualifier = rQualifier;
-            mXmlId = xmlId;
-        }
-
-        @SuppressWarnings("unchecked")    //$NON-NLS-1$
-        @Override
-        public boolean visit(StringLiteral node) {
-            if (node.getLiteralValue().equals(mOldString)) {
-
-                // We want to analyze the calling context to understand whether we can
-                // just replace the string literal by the named int constant (R.id.foo)
-                // or if we should generate a Context.getString() call.
-                boolean useGetResource = false;
-                useGetResource = examineVariableDeclaration(node) ||
-                                    examineMethodInvocation(node);
-
-                Name qualifierName = mAst.newName(mRQualifier + ".string");     //$NON-NLS-1$
-                SimpleName idName = mAst.newSimpleName(mXmlId);
-                ASTNode newNode = mAst.newQualifiedName(qualifierName, idName);
-                String title = "Replace string by ID";
-
-                if (useGetResource) {
-
-                    Expression context = methodHasContextArgument(node);
-                    if (context == null && !isClassDerivedFromContext(node)) {
-                        // if we don't have a class that derives from Context and
-                        // we don't have a Context method argument, then try a bit harder:
-                        // can we find a method or a field that will give us a context?
-                        context = findContextFieldOrMethod(node);
-
-                        if (context == null) {
-                            // If not, let's  write Context.getString(), which is technically
-                            // invalid but makes it a good clue on how to fix it.
-                            context = mAst.newSimpleName("Context");            //$NON-NLS-1$
-                        }
-                    }
-
-                    MethodInvocation mi2 = mAst.newMethodInvocation();
-                    mi2.setName(mAst.newSimpleName("getString"));               //$NON-NLS-1$
-                    mi2.setExpression(context);
-                    mi2.arguments().add(newNode);
-
-                    newNode = mi2;
-                    title = "Replace string by Context.getString(R.string...)";
-                }
-
-                TextEditGroup editGroup = new TextEditGroup(title);
-                mEditGroups.add(editGroup);
-                mRewriter.replace(node, newNode, editGroup);
-            }
-            return super.visit(node);
-        }
-
-        /**
-         * Examines if the StringLiteral is part of of an assignment to a string,
-         * e.g. String foo = id.
-         *
-         * The parent fragment is of syntax "var = expr" or "var[] = expr".
-         * We want the type of the variable, which is either held by a
-         * VariableDeclarationStatement ("type [fragment]") or by a
-         * VariableDeclarationExpression. In either case, the type can be an array
-         * but for us all that matters is to know whether the type is an int or
-         * a string.
-         */
-        private boolean examineVariableDeclaration(StringLiteral node) {
-            VariableDeclarationFragment fragment = findParentClass(node,
-                    VariableDeclarationFragment.class);
-
-            if (fragment != null) {
-                ASTNode parent = fragment.getParent();
-
-                Type type = null;
-                if (parent instanceof VariableDeclarationStatement) {
-                    type = ((VariableDeclarationStatement) parent).getType();
-                } else if (parent instanceof VariableDeclarationExpression) {
-                    type = ((VariableDeclarationExpression) parent).getType();
-                }
-
-                if (type instanceof SimpleType) {
-                    return isJavaString(type.resolveBinding());
-                }
-            }
-
-            return false;
-        }
-
-        /**
-         * If the expression is part of a method invocation (aka a function call) or a
-         * class instance creation (aka a "new SomeClass" constructor call), we try to
-         * find the type of the argument being used. If it is a String (most likely), we
-         * want to return true (to generate a getString() call). However if there might
-         * be a similar method that takes an int, in which case we don't want to do that.
-         *
-         * This covers the case of Activity.setTitle(int resId) vs setTitle(String str).
-         */
-        @SuppressWarnings("unchecked")  //$NON-NLS-1$
-        private boolean examineMethodInvocation(StringLiteral node) {
-
-            ASTNode parent = null;
-            List arguments = null;
-            IMethodBinding methodBinding = null;
-
-            MethodInvocation invoke = findParentClass(node, MethodInvocation.class);
-            if (invoke != null) {
-                parent = invoke;
-                arguments = invoke.arguments();
-                methodBinding = invoke.resolveMethodBinding();
-            } else {
-                ClassInstanceCreation newclass = findParentClass(node, ClassInstanceCreation.class);
-                if (newclass != null) {
-                    parent = newclass;
-                    arguments = newclass.arguments();
-                    methodBinding = newclass.resolveConstructorBinding();
-                }
-            }
-
-            if (parent != null && arguments != null && methodBinding != null) {
-                // We want to know which argument this is.
-                // Walk up the hierarchy again to find the immediate child of the parent,
-                // which should turn out to be one of the invocation arguments.
-                ASTNode child = null;
-                for (ASTNode n = node; n != parent; ) {
-                    ASTNode p = n.getParent();
-                    if (p == parent) {
-                        child = n;
-                        break;
-                    }
-                    n = p;
-                }
-                if (child == null) {
-                    // This can't happen: a parent of 'node' must be the child of 'parent'.
-                    return false;
-                }
-
-                // Find the index
-                int index = 0;
-                for (Object arg : arguments) {
-                    if (arg == child) {
-                        break;
-                    }
-                    index++;
-                }
-
-                if (index == arguments.size()) {
-                    // This can't happen: one of the arguments of 'invoke' must be 'child'.
-                    return false;
-                }
-
-                // Eventually we want to determine if the parameter is a string type,
-                // in which case a Context.getString() call must be generated.
-                boolean useStringType = false;
-
-                // Find the type of that argument
-                ITypeBinding[] types = methodBinding.getParameterTypes();
-                if (index < types.length) {
-                    ITypeBinding type = types[index];
-                    useStringType = isJavaString(type);
-                }
-
-                // Now that we know that this method takes a String parameter, can we find
-                // a variant that would accept an int for the same parameter position?
-                if (useStringType) {
-                    String name = methodBinding.getName();
-                    ITypeBinding clazz = methodBinding.getDeclaringClass();
-                    nextMethod: for (IMethodBinding mb2 : clazz.getDeclaredMethods()) {
-                        if (methodBinding == mb2 || !mb2.getName().equals(name)) {
-                            continue;
-                        }
-                        // We found a method with the same name. We want the same parameters
-                        // except that the one at 'index' must be an int type.
-                        ITypeBinding[] types2 = mb2.getParameterTypes();
-                        int len2 = types2.length;
-                        if (types.length == len2) {
-                            for (int i = 0; i < len2; i++) {
-                                if (i == index) {
-                                    ITypeBinding type2 = types2[i];
-                                    if (!("int".equals(type2.getQualifiedName()))) {   //$NON-NLS-1$
-                                        // The argument at 'index' is not an int.
-                                        continue nextMethod;
-                                    }
-                                } else if (!types[i].equals(types2[i])) {
-                                    // One of the other arguments do not match our original method
-                                    continue nextMethod;
-                                }
-                            }
-                            // If we got here, we found a perfect match: a method with the same
-                            // arguments except the one at 'index' is an int. In this case we
-                            // don't need to convert our R.id into a string.
-                            useStringType = false;
-                            break;
-                        }
-                    }
-                }
-
-                return useStringType;
-            }
-            return false;
-        }
-
-        /**
-         * Examines if the StringLiteral is part of a method declaration (a.k.a. a function
-         * definition) which takes a Context argument.
-         * If such, it returns the name of the variable as a {@link SimpleName}.
-         * Otherwise it returns null.
-         */
-        private SimpleName methodHasContextArgument(StringLiteral node) {
-            MethodDeclaration decl = findParentClass(node, MethodDeclaration.class);
-            if (decl != null) {
-                for (Object obj : decl.parameters()) {
-                    if (obj instanceof SingleVariableDeclaration) {
-                        SingleVariableDeclaration var = (SingleVariableDeclaration) obj;
-                        if (isAndroidContext(var.getType())) {
-                            return mAst.newSimpleName(var.getName().getIdentifier());
-                        }
-                    }
-                }
-            }
-            return null;
-        }
-
-        /**
-         * Walks up the node hierarchy to find the class (aka type) where this statement
-         * is used and returns true if this class derives from android.content.Context.
-         */
-        private boolean isClassDerivedFromContext(StringLiteral node) {
-            TypeDeclaration clazz = findParentClass(node, TypeDeclaration.class);
-            if (clazz != null) {
-                // This is the class that the user is currently writing, so it can't be
-                // a Context by itself, it has to be derived from it.
-                return isAndroidContext(clazz.getSuperclassType());
-            }
-            return false;
-        }
-
-        private Expression findContextFieldOrMethod(StringLiteral node) {
-            TypeDeclaration clazz = findParentClass(node, TypeDeclaration.class);
-            ITypeBinding clazzType = clazz == null ? null : clazz.resolveBinding();
-            return findContextFieldOrMethod(clazzType);
-        }
-
-        private Expression findContextFieldOrMethod(ITypeBinding clazzType) {
-            TreeMap<Integer, Expression> results = new TreeMap<Integer, Expression>();
-            findContextCandidates(results, clazzType, 0 /*superType*/);
-            if (results.size() > 0) {
-                Integer bestRating = results.keySet().iterator().next();
-                return results.get(bestRating);
-            }
-            return null;
-        }
-
-        /**
-         * Find all method or fields that are candidates for providing a Context.
-         * There can be various choices amongst this class or its super classes.
-         * Sort them by rating in the results map.
-         *
-         * The best ever choice is to find a method with no argument that returns a Context.
-         * The second suitable choice is to find a Context field.
-         * The least desirable choice is to find a method with arguments. It's not really
-         * desirable since we can't generate these arguments automatically.
-         *
-         * Methods and fields from supertypes are ignored if they are private.
-         *
-         * The rating is reversed: the lowest rating integer is used for the best candidate.
-         * Because the superType argument is actually a recursion index, this makes the most
-         * immediate classes more desirable.
-         *
-         * @param results The map that accumulates the rating=>expression results. The lower
-         *                rating number is the best candidate.
-         * @param clazzType The class examined.
-         * @param superType The recursion index.
-         *                  0 for the immediate class, 1 for its super class, etc.
-         */
-        private void findContextCandidates(TreeMap<Integer, Expression> results,
-                ITypeBinding clazzType,
-                int superType) {
-            for (IMethodBinding mb : clazzType.getDeclaredMethods()) {
-                // If we're looking at supertypes, we can't use private methods.
-                if (superType != 0 && Modifier.isPrivate(mb.getModifiers())) {
-                    continue;
-                }
-
-                if (isAndroidContext(mb.getReturnType())) {
-                    // We found a method that returns something derived from Context.
-
-                    int argsLen = mb.getParameterTypes().length;
-                    if (argsLen == 0) {
-                        // We'll favor any method that takes no argument,
-                        // That would be the best candidate ever, so we can stop here.
-                        MethodInvocation mi = mAst.newMethodInvocation();
-                        mi.setName(mAst.newSimpleName(mb.getName()));
-                        results.put(Integer.MIN_VALUE, mi);
-                        return;
-                    } else {
-                        // A method with arguments isn't as interesting since we wouldn't
-                        // know how to populate such arguments. We'll use it if there are
-                        // no other alternatives. We'll favor the one with the less arguments.
-                        Integer rating = Integer.valueOf(10000 + 1000 * superType + argsLen);
-                        if (!results.containsKey(rating)) {
-                            MethodInvocation mi = mAst.newMethodInvocation();
-                            mi.setName(mAst.newSimpleName(mb.getName()));
-                            results.put(rating, mi);
-                        }
-                    }
-                }
-            }
-
-            // A direct Context field would be more interesting than a method with
-            // arguments. Try to find one.
-            for (IVariableBinding var : clazzType.getDeclaredFields()) {
-                // If we're looking at supertypes, we can't use private field.
-                if (superType != 0 && Modifier.isPrivate(var.getModifiers())) {
-                    continue;
-                }
-
-                if (isAndroidContext(var.getType())) {
-                    // We found such a field. Let's use it.
-                    Integer rating = Integer.valueOf(superType);
-                    results.put(rating, mAst.newSimpleName(var.getName()));
-                    break;
-                }
-            }
-
-            // Examine the super class to see if we can locate a better match
-            clazzType = clazzType.getSuperclass();
-            if (clazzType != null) {
-                findContextCandidates(results, clazzType, superType + 1);
-            }
-        }
-
-        /**
-         * Walks up the node hierarchy and returns the first ASTNode of the requested class.
-         * Only look at parents.
-         *
-         * Implementation note: this is a generic method so that it returns the node already
-         * casted to the requested type.
-         */
-        @SuppressWarnings("unchecked")
-        private <T extends ASTNode> T findParentClass(ASTNode node, Class<T> clazz) {
-            for (node = node.getParent(); node != null; node = node.getParent()) {
-                if (node.getClass().equals(clazz)) {
-                    return (T) node;
-                }
-            }
-            return null;
-        }
-
-        /**
-         * Returns true if the given type is or derives from android.content.Context.
-         */
-        private boolean isAndroidContext(Type type) {
-            if (type != null) {
-                return isAndroidContext(type.resolveBinding());
-            }
-            return false;
-        }
-
-        /**
-         * Returns true if the given type is or derives from android.content.Context.
-         */
-        private boolean isAndroidContext(ITypeBinding type) {
-            for (; type != null; type = type.getSuperclass()) {
-                if (CLASS_ANDROID_CONTEXT.equals(type.getQualifiedName())) {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        /**
-         * Returns true if this type binding represents a String or CharSequence type.
-         */
-        private boolean isJavaString(ITypeBinding type) {
-            for (; type != null; type = type.getSuperclass()) {
-                if (CLASS_JAVA_STRING.equals(type.getQualifiedName()) ||
-                    CLASS_JAVA_CHAR_SEQUENCE.equals(type.getQualifiedName())) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
     /**
      * Step 3 of 3 of the refactoring: returns the {@link Change} that will be able to do the
      * work and creates a descriptor that can be used to replay that refactoring later.
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/extractstring/ReplaceStringsVisitor.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/extractstring/ReplaceStringsVisitor.java
new file mode 100755
index 0000000..dd0f9f4
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/extractstring/ReplaceStringsVisitor.java
@@ -0,0 +1,457 @@
+/*

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.eclipse.org/org/documents/epl-v10.php

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package com.android.ide.eclipse.adt.internal.refactorings.extractstring;

+

+import org.eclipse.jdt.core.dom.AST;

+import org.eclipse.jdt.core.dom.ASTNode;

+import org.eclipse.jdt.core.dom.ASTVisitor;

+import org.eclipse.jdt.core.dom.ClassInstanceCreation;

+import org.eclipse.jdt.core.dom.Expression;

+import org.eclipse.jdt.core.dom.IMethodBinding;

+import org.eclipse.jdt.core.dom.ITypeBinding;

+import org.eclipse.jdt.core.dom.IVariableBinding;

+import org.eclipse.jdt.core.dom.MethodDeclaration;

+import org.eclipse.jdt.core.dom.MethodInvocation;

+import org.eclipse.jdt.core.dom.Modifier;

+import org.eclipse.jdt.core.dom.Name;

+import org.eclipse.jdt.core.dom.SimpleName;

+import org.eclipse.jdt.core.dom.SimpleType;

+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;

+import org.eclipse.jdt.core.dom.StringLiteral;

+import org.eclipse.jdt.core.dom.Type;

+import org.eclipse.jdt.core.dom.TypeDeclaration;

+import org.eclipse.jdt.core.dom.VariableDeclarationExpression;

+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;

+import org.eclipse.jdt.core.dom.VariableDeclarationStatement;

+import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;

+import org.eclipse.text.edits.TextEditGroup;

+

+import java.util.ArrayList;

+import java.util.List;

+import java.util.TreeMap;

+

+/**

+ * Visitor used by {@link ExtractStringRefactoring} to extract a string from an existing

+ * Java source and replace it by an Android XML string reference.

+ *

+ * @see ExtractStringRefactoring#computeJavaChanges

+ */

+class ReplaceStringsVisitor extends ASTVisitor {

+

+    private static final String CLASS_ANDROID_CONTEXT    = "android.content.Context"; //$NON-NLS-1$

+    private static final String CLASS_JAVA_CHAR_SEQUENCE = "java.lang.CharSequence";  //$NON-NLS-1$

+    private static final String CLASS_JAVA_STRING        = "java.lang.String";        //$NON-NLS-1$

+

+

+    private final AST mAst;

+    private final ASTRewrite mRewriter;

+    private final String mOldString;

+    private final String mRQualifier;

+    private final String mXmlId;

+    private final ArrayList<TextEditGroup> mEditGroups;

+

+    public ReplaceStringsVisitor(AST ast,

+            ASTRewrite astRewrite,

+            ArrayList<TextEditGroup> editGroups,

+            String oldString,

+            String rQualifier,

+            String xmlId) {

+        mAst = ast;

+        mRewriter = astRewrite;

+        mEditGroups = editGroups;

+        mOldString = oldString;

+        mRQualifier = rQualifier;

+        mXmlId = xmlId;

+    }

+

+    @SuppressWarnings("unchecked")    //$NON-NLS-1$

+    @Override

+    public boolean visit(StringLiteral node) {

+        if (node.getLiteralValue().equals(mOldString)) {

+

+            // We want to analyze the calling context to understand whether we can

+            // just replace the string literal by the named int constant (R.id.foo)

+            // or if we should generate a Context.getString() call.

+            boolean useGetResource = false;

+            useGetResource = examineVariableDeclaration(node) ||

+                                examineMethodInvocation(node);

+

+            Name qualifierName = mAst.newName(mRQualifier + ".string");     //$NON-NLS-1$

+            SimpleName idName = mAst.newSimpleName(mXmlId);

+            ASTNode newNode = mAst.newQualifiedName(qualifierName, idName);

+            String title = "Replace string by ID";

+

+            if (useGetResource) {

+

+                Expression context = methodHasContextArgument(node);

+                if (context == null && !isClassDerivedFromContext(node)) {

+                    // if we don't have a class that derives from Context and

+                    // we don't have a Context method argument, then try a bit harder:

+                    // can we find a method or a field that will give us a context?

+                    context = findContextFieldOrMethod(node);

+

+                    if (context == null) {

+                        // If not, let's  write Context.getString(), which is technically

+                        // invalid but makes it a good clue on how to fix it.

+                        context = mAst.newSimpleName("Context");            //$NON-NLS-1$

+                    }

+                }

+

+                MethodInvocation mi2 = mAst.newMethodInvocation();

+                mi2.setName(mAst.newSimpleName("getString"));               //$NON-NLS-1$

+                mi2.setExpression(context);

+                mi2.arguments().add(newNode);

+

+                newNode = mi2;

+                title = "Replace string by Context.getString(R.string...)";

+            }

+

+            TextEditGroup editGroup = new TextEditGroup(title);

+            mEditGroups.add(editGroup);

+            mRewriter.replace(node, newNode, editGroup);

+        }

+        return super.visit(node);

+    }

+

+    /**

+     * Examines if the StringLiteral is part of of an assignment to a string,

+     * e.g. String foo = id.

+     *

+     * The parent fragment is of syntax "var = expr" or "var[] = expr".

+     * We want the type of the variable, which is either held by a

+     * VariableDeclarationStatement ("type [fragment]") or by a

+     * VariableDeclarationExpression. In either case, the type can be an array

+     * but for us all that matters is to know whether the type is an int or

+     * a string.

+     */

+    private boolean examineVariableDeclaration(StringLiteral node) {

+        VariableDeclarationFragment fragment = findParentClass(node,

+                VariableDeclarationFragment.class);

+

+        if (fragment != null) {

+            ASTNode parent = fragment.getParent();

+

+            Type type = null;

+            if (parent instanceof VariableDeclarationStatement) {

+                type = ((VariableDeclarationStatement) parent).getType();

+            } else if (parent instanceof VariableDeclarationExpression) {

+                type = ((VariableDeclarationExpression) parent).getType();

+            }

+

+            if (type instanceof SimpleType) {

+                return isJavaString(type.resolveBinding());

+            }

+        }

+

+        return false;

+    }

+

+    /**

+     * If the expression is part of a method invocation (aka a function call) or a

+     * class instance creation (aka a "new SomeClass" constructor call), we try to

+     * find the type of the argument being used. If it is a String (most likely), we

+     * want to return true (to generate a getString() call). However if there might

+     * be a similar method that takes an int, in which case we don't want to do that.

+     *

+     * This covers the case of Activity.setTitle(int resId) vs setTitle(String str).

+     */

+    @SuppressWarnings("unchecked")  //$NON-NLS-1$

+    private boolean examineMethodInvocation(StringLiteral node) {

+

+        ASTNode parent = null;

+        List arguments = null;

+        IMethodBinding methodBinding = null;

+

+        MethodInvocation invoke = findParentClass(node, MethodInvocation.class);

+        if (invoke != null) {

+            parent = invoke;

+            arguments = invoke.arguments();

+            methodBinding = invoke.resolveMethodBinding();

+        } else {

+            ClassInstanceCreation newclass = findParentClass(node, ClassInstanceCreation.class);

+            if (newclass != null) {

+                parent = newclass;

+                arguments = newclass.arguments();

+                methodBinding = newclass.resolveConstructorBinding();

+            }

+        }

+

+        if (parent != null && arguments != null && methodBinding != null) {

+            // We want to know which argument this is.

+            // Walk up the hierarchy again to find the immediate child of the parent,

+            // which should turn out to be one of the invocation arguments.

+            ASTNode child = null;

+            for (ASTNode n = node; n != parent; ) {

+                ASTNode p = n.getParent();

+                if (p == parent) {

+                    child = n;

+                    break;

+                }

+                n = p;

+            }

+            if (child == null) {

+                // This can't happen: a parent of 'node' must be the child of 'parent'.

+                return false;

+            }

+

+            // Find the index

+            int index = 0;

+            for (Object arg : arguments) {

+                if (arg == child) {

+                    break;

+                }

+                index++;

+            }

+

+            if (index == arguments.size()) {

+                // This can't happen: one of the arguments of 'invoke' must be 'child'.

+                return false;

+            }

+

+            // Eventually we want to determine if the parameter is a string type,

+            // in which case a Context.getString() call must be generated.

+            boolean useStringType = false;

+

+            // Find the type of that argument

+            ITypeBinding[] types = methodBinding.getParameterTypes();

+            if (index < types.length) {

+                ITypeBinding type = types[index];

+                useStringType = isJavaString(type);

+            }

+

+            // Now that we know that this method takes a String parameter, can we find

+            // a variant that would accept an int for the same parameter position?

+            if (useStringType) {

+                String name = methodBinding.getName();

+                ITypeBinding clazz = methodBinding.getDeclaringClass();

+                nextMethod: for (IMethodBinding mb2 : clazz.getDeclaredMethods()) {

+                    if (methodBinding == mb2 || !mb2.getName().equals(name)) {

+                        continue;

+                    }

+                    // We found a method with the same name. We want the same parameters

+                    // except that the one at 'index' must be an int type.

+                    ITypeBinding[] types2 = mb2.getParameterTypes();

+                    int len2 = types2.length;

+                    if (types.length == len2) {

+                        for (int i = 0; i < len2; i++) {

+                            if (i == index) {

+                                ITypeBinding type2 = types2[i];

+                                if (!("int".equals(type2.getQualifiedName()))) {   //$NON-NLS-1$

+                                    // The argument at 'index' is not an int.

+                                    continue nextMethod;

+                                }

+                            } else if (!types[i].equals(types2[i])) {

+                                // One of the other arguments do not match our original method

+                                continue nextMethod;

+                            }

+                        }

+                        // If we got here, we found a perfect match: a method with the same

+                        // arguments except the one at 'index' is an int. In this case we

+                        // don't need to convert our R.id into a string.

+                        useStringType = false;

+                        break;

+                    }

+                }

+            }

+

+            return useStringType;

+        }

+        return false;

+    }

+

+    /**

+     * Examines if the StringLiteral is part of a method declaration (a.k.a. a function

+     * definition) which takes a Context argument.

+     * If such, it returns the name of the variable as a {@link SimpleName}.

+     * Otherwise it returns null.

+     */

+    private SimpleName methodHasContextArgument(StringLiteral node) {

+        MethodDeclaration decl = findParentClass(node, MethodDeclaration.class);

+        if (decl != null) {

+            for (Object obj : decl.parameters()) {

+                if (obj instanceof SingleVariableDeclaration) {

+                    SingleVariableDeclaration var = (SingleVariableDeclaration) obj;

+                    if (isAndroidContext(var.getType())) {

+                        return mAst.newSimpleName(var.getName().getIdentifier());

+                    }

+                }

+            }

+        }

+        return null;

+    }

+

+    /**

+     * Walks up the node hierarchy to find the class (aka type) where this statement

+     * is used and returns true if this class derives from android.content.Context.

+     */

+    private boolean isClassDerivedFromContext(StringLiteral node) {

+        TypeDeclaration clazz = findParentClass(node, TypeDeclaration.class);

+        if (clazz != null) {

+            // This is the class that the user is currently writing, so it can't be

+            // a Context by itself, it has to be derived from it.

+            return isAndroidContext(clazz.getSuperclassType());

+        }

+        return false;

+    }

+

+    private Expression findContextFieldOrMethod(StringLiteral node) {

+        TypeDeclaration clazz = findParentClass(node, TypeDeclaration.class);

+        ITypeBinding clazzType = clazz == null ? null : clazz.resolveBinding();

+        return findContextFieldOrMethod(clazzType);

+    }

+

+    private Expression findContextFieldOrMethod(ITypeBinding clazzType) {

+        TreeMap<Integer, Expression> results = new TreeMap<Integer, Expression>();

+        findContextCandidates(results, clazzType, 0 /*superType*/);

+        if (results.size() > 0) {

+            Integer bestRating = results.keySet().iterator().next();

+            return results.get(bestRating);

+        }

+        return null;

+    }

+

+    /**

+     * Find all method or fields that are candidates for providing a Context.

+     * There can be various choices amongst this class or its super classes.

+     * Sort them by rating in the results map.

+     *

+     * The best ever choice is to find a method with no argument that returns a Context.

+     * The second suitable choice is to find a Context field.

+     * The least desirable choice is to find a method with arguments. It's not really

+     * desirable since we can't generate these arguments automatically.

+     *

+     * Methods and fields from supertypes are ignored if they are private.

+     *

+     * The rating is reversed: the lowest rating integer is used for the best candidate.

+     * Because the superType argument is actually a recursion index, this makes the most

+     * immediate classes more desirable.

+     *

+     * @param results The map that accumulates the rating=>expression results. The lower

+     *                rating number is the best candidate.

+     * @param clazzType The class examined.

+     * @param superType The recursion index.

+     *                  0 for the immediate class, 1 for its super class, etc.

+     */

+    private void findContextCandidates(TreeMap<Integer, Expression> results,

+            ITypeBinding clazzType,

+            int superType) {

+        for (IMethodBinding mb : clazzType.getDeclaredMethods()) {

+            // If we're looking at supertypes, we can't use private methods.

+            if (superType != 0 && Modifier.isPrivate(mb.getModifiers())) {

+                continue;

+            }

+

+            if (isAndroidContext(mb.getReturnType())) {

+                // We found a method that returns something derived from Context.

+

+                int argsLen = mb.getParameterTypes().length;

+                if (argsLen == 0) {

+                    // We'll favor any method that takes no argument,

+                    // That would be the best candidate ever, so we can stop here.

+                    MethodInvocation mi = mAst.newMethodInvocation();

+                    mi.setName(mAst.newSimpleName(mb.getName()));

+                    results.put(Integer.MIN_VALUE, mi);

+                    return;

+                } else {

+                    // A method with arguments isn't as interesting since we wouldn't

+                    // know how to populate such arguments. We'll use it if there are

+                    // no other alternatives. We'll favor the one with the less arguments.

+                    Integer rating = Integer.valueOf(10000 + 1000 * superType + argsLen);

+                    if (!results.containsKey(rating)) {

+                        MethodInvocation mi = mAst.newMethodInvocation();

+                        mi.setName(mAst.newSimpleName(mb.getName()));

+                        results.put(rating, mi);

+                    }

+                }

+            }

+        }

+

+        // A direct Context field would be more interesting than a method with

+        // arguments. Try to find one.

+        for (IVariableBinding var : clazzType.getDeclaredFields()) {

+            // If we're looking at supertypes, we can't use private field.

+            if (superType != 0 && Modifier.isPrivate(var.getModifiers())) {

+                continue;

+            }

+

+            if (isAndroidContext(var.getType())) {

+                // We found such a field. Let's use it.

+                Integer rating = Integer.valueOf(superType);

+                results.put(rating, mAst.newSimpleName(var.getName()));

+                break;

+            }

+        }

+

+        // Examine the super class to see if we can locate a better match

+        clazzType = clazzType.getSuperclass();

+        if (clazzType != null) {

+            findContextCandidates(results, clazzType, superType + 1);

+        }

+    }

+

+    /**

+     * Walks up the node hierarchy and returns the first ASTNode of the requested class.

+     * Only look at parents.

+     *

+     * Implementation note: this is a generic method so that it returns the node already

+     * casted to the requested type.

+     */

+    @SuppressWarnings("unchecked")

+    private <T extends ASTNode> T findParentClass(ASTNode node, Class<T> clazz) {

+        for (node = node.getParent(); node != null; node = node.getParent()) {

+            if (node.getClass().equals(clazz)) {

+                return (T) node;

+            }

+        }

+        return null;

+    }

+

+    /**

+     * Returns true if the given type is or derives from android.content.Context.

+     */

+    private boolean isAndroidContext(Type type) {

+        if (type != null) {

+            return isAndroidContext(type.resolveBinding());

+        }

+        return false;

+    }

+

+    /**

+     * Returns true if the given type is or derives from android.content.Context.

+     */

+    private boolean isAndroidContext(ITypeBinding type) {

+        for (; type != null; type = type.getSuperclass()) {

+            if (CLASS_ANDROID_CONTEXT.equals(type.getQualifiedName())) {

+                return true;

+            }

+        }

+        return false;

+    }

+

+    /**

+     * Returns true if this type binding represents a String or CharSequence type.

+     */

+    private boolean isJavaString(ITypeBinding type) {

+        for (; type != null; type = type.getSuperclass()) {

+            if (CLASS_JAVA_STRING.equals(type.getQualifiedName()) ||

+                CLASS_JAVA_CHAR_SEQUENCE.equals(type.getQualifiedName())) {

+                return true;

+            }

+        }

+        return false;

+    }

+}

diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/CountryCodeQualifier.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/CountryCodeQualifier.java
index f570bac..97028e9 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/CountryCodeQualifier.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/CountryCodeQualifier.java
@@ -33,7 +33,7 @@
 
     private final static Pattern sCountryCodePattern = Pattern.compile("^mcc(\\d{3})$");//$NON-NLS-1$
 
-    private int mCode = DEFAULT_CODE;
+    private final int mCode;
 
     public static final String NAME = "Mobile Country Code";
 
@@ -56,8 +56,7 @@
                 return null;
             }
 
-            CountryCodeQualifier qualifier = new CountryCodeQualifier();
-            qualifier.mCode = code;
+            CountryCodeQualifier qualifier = new CountryCodeQualifier(code);
             return qualifier;
         }
 
@@ -77,6 +76,14 @@
         return ""; //$NON-NLS-1$
     }
 
+    public CountryCodeQualifier() {
+        this(DEFAULT_CODE);
+    }
+
+    public CountryCodeQualifier(int code) {
+        mCode = code;
+    }
+
     public int getCode() {
         return mCode;
     }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/FolderConfiguration.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/FolderConfiguration.java
index 23a6440..f1ac8cf 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/FolderConfiguration.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/FolderConfiguration.java
@@ -49,12 +49,21 @@
     private final static int INDEX_COUNT              = 14;
 
     /**
+     * Returns the number of {@link ResourceQualifier} that make up a Folder configuration.
+     */
+    public static int getQualifierCount() {
+        return INDEX_COUNT;
+    }
+
+    /**
      * Sets the config from the qualifiers of a given <var>config</var>.
      * @param config
      */
     public void set(FolderConfiguration config) {
-        for (int i = 0 ; i < INDEX_COUNT ; i++) {
-            mQualifiers[i] = config.mQualifiers[i];
+        if (config != null) {
+            for (int i = 0 ; i < INDEX_COUNT ; i++) {
+                mQualifiers[i] = config.mQualifiers[i];
+            }
         }
     }
 
@@ -147,6 +156,16 @@
         }
     }
 
+    /**
+     * Returns a qualifier by its index. The total number of qualifiers can be accessed by
+     * {@link #getQualifierCount()}.
+     * @param index the index of the qualifier to return.
+     * @return the qualifier or null if there are none at the index.
+     */
+    public ResourceQualifier getQualifier(int index) {
+        return mQualifiers[index];
+    }
+
     public void setCountryCodeQualifier(CountryCodeQualifier qualifier) {
         mQualifiers[INDEX_COUNTRY_CODE] = qualifier;
     }
@@ -314,8 +333,11 @@
 
         for (ResourceQualifier qualifier : mQualifiers) {
             if (qualifier != null) {
-                result.append(QUALIFIER_SEP);
-                result.append(qualifier.getFolderSegment(target));
+                String segment = qualifier.getFolderSegment(target);
+                if (segment != null && segment.length() > 0) {
+                    result.append(QUALIFIER_SEP);
+                    result.append(segment);
+                }
             }
         }
 
@@ -443,37 +465,28 @@
     }
 
     /**
-     * Returns whether the configuration match the given reference config.
-     * <p/>A match means that:
+     * Returns whether the configuration is a match for the given reference config.
+     * <p/>A match means that, for each qualifier of this config
      * <ul>
-     * <li>This config does not use any qualifier not used by the reference config</li>
-     * <li>The qualifier used by this config have the same values as the qualifiers of
-     * the reference config.</li>
+     * <li>The reference config has no value set
+     * <li>or, the qualifier of the reference config is a match. Depending on the qualifier type
+     * this does not mean the same exact value.</li>
      * </ul>
      * @param referenceConfig The reference configuration to test against.
-     * @return the number of matching qualifiers or -1 if the configurations are not compatible.
+     * @return true if the configuration matches.
      */
-    public int match(FolderConfiguration referenceConfig) {
-        int matchCount = 0;
-
+    public boolean isMatchFor(FolderConfiguration referenceConfig) {
         for (int i = 0 ; i < INDEX_COUNT ; i++) {
             ResourceQualifier testQualifier = mQualifiers[i];
             ResourceQualifier referenceQualifier = referenceConfig.mQualifiers[i];
 
-            // we only care if testQualifier is non null. If it's null, it's a match but
-            // without increasing the matchCount.
-            if (testQualifier != null) {
-                if (referenceQualifier == null) {
-                    return -1;
-                } else if (testQualifier.equals(referenceQualifier) == false) {
-                    return -1;
-                }
-
-                // the qualifier match, increment the count
-                matchCount++;
+            // it's only a non match if both qualifiers are non-null, and they don't match.
+            if (testQualifier != null && referenceQualifier != null &&
+                        testQualifier.isMatchFor(referenceQualifier) == false) {
+                return false;
             }
         }
-        return matchCount;
+        return true;
     }
 
     /**
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/KeyboardStateQualifier.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/KeyboardStateQualifier.java
index 1aa9286..e00428e 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/KeyboardStateQualifier.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/KeyboardStateQualifier.java
@@ -37,7 +37,8 @@
      */
     public static enum KeyboardState {
         EXPOSED("keysexposed", "Exposed"), //$NON-NLS-1$
-        HIDDEN("keyshidden", "Hidden"); //$NON-NLS-1$
+        HIDDEN("keyshidden", "Hidden"),    //$NON-NLS-1$
+        SOFT("keyssoft", "Soft");          //$NON-NLS-1$
 
         private String mValue;
         private String mDisplayValue;
@@ -52,7 +53,7 @@
          * @param value The qualifier value.
          * @return the enum for the qualifier value or null if no matching was found.
          */
-        static KeyboardState getEnum(String value) {
+        public static KeyboardState getEnum(String value) {
             for (KeyboardState orient : values()) {
                 if (orient.mValue.equals(value)) {
                     return orient;
@@ -141,6 +142,42 @@
     }
 
     @Override
+    public boolean isMatchFor(ResourceQualifier qualifier) {
+        if (qualifier instanceof KeyboardStateQualifier) {
+            KeyboardStateQualifier referenceQualifier = (KeyboardStateQualifier)qualifier;
+
+            // special case where EXPOSED can be used for SOFT
+            if (referenceQualifier.mValue == KeyboardState.SOFT &&
+                    mValue == KeyboardState.EXPOSED) {
+                return true;
+            }
+
+            return referenceQualifier.mValue == mValue;
+        }
+
+        return false;
+    }
+
+    @Override
+    public boolean isBetterMatchThan(ResourceQualifier compareTo, ResourceQualifier reference) {
+        if (compareTo == null) {
+            return true;
+        }
+
+        KeyboardStateQualifier compareQualifier = (KeyboardStateQualifier)compareTo;
+        KeyboardStateQualifier referenceQualifier = (KeyboardStateQualifier)reference;
+        if (referenceQualifier.mValue == KeyboardState.SOFT) { // only case where there could be a
+                                                               // better qualifier
+            // only return true if it's a better value.
+            if (compareQualifier.mValue == KeyboardState.EXPOSED && mValue == KeyboardState.SOFT) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    @Override
     public boolean equals(Object qualifier) {
         if (qualifier instanceof KeyboardStateQualifier) {
             return mValue == ((KeyboardStateQualifier)qualifier).mValue;
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/LanguageQualifier.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/LanguageQualifier.java
index a098e44..50f5c52 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/LanguageQualifier.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/LanguageQualifier.java
@@ -63,6 +63,14 @@
         return null;
     }
 
+    public LanguageQualifier() {
+
+    }
+
+    public LanguageQualifier(String value) {
+        mValue = value;
+    }
+
     public String getValue() {
         if (mValue != null) {
             return mValue;
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NavigationMethodQualifier.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NavigationMethodQualifier.java
index 0a5c968..50cb9cb 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NavigationMethodQualifier.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NavigationMethodQualifier.java
@@ -54,7 +54,7 @@
          * @param value The qualifier value.
          * @return the enum for the qualifier value or null if no matching was found.
          */
-        static NavigationMethod getEnum(String value) {
+        public static NavigationMethod getEnum(String value) {
             for (NavigationMethod orient : values()) {
                 if (orient.mValue.equals(value)) {
                     return orient;
@@ -134,8 +134,7 @@
     public boolean checkAndSet(String value, FolderConfiguration config) {
         NavigationMethod method = NavigationMethod.getEnum(value);
         if (method != null) {
-            NavigationMethodQualifier qualifier = new NavigationMethodQualifier();
-            qualifier.mValue = method;
+            NavigationMethodQualifier qualifier = new NavigationMethodQualifier(method);
             config.setNavigationMethodQualifier(qualifier);
             return true;
         }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NetworkCodeQualifier.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NetworkCodeQualifier.java
index 32bd667..655fe4e 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NetworkCodeQualifier.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NetworkCodeQualifier.java
@@ -33,7 +33,7 @@
 
     private final static Pattern sNetworkCodePattern = Pattern.compile("^mnc(\\d{1,3})$"); //$NON-NLS-1$
 
-    private int mCode = DEFAULT_CODE;
+    private final int mCode;
 
     public final static String NAME = "Mobile Network Code";
 
@@ -56,8 +56,7 @@
                 return null;
             }
 
-            NetworkCodeQualifier qualifier = new NetworkCodeQualifier();
-            qualifier.mCode = code;
+            NetworkCodeQualifier qualifier = new NetworkCodeQualifier(code);
             return qualifier;
         }
 
@@ -77,6 +76,14 @@
         return ""; //$NON-NLS-1$
     }
 
+    public NetworkCodeQualifier() {
+        this(DEFAULT_CODE);
+    }
+
+    public NetworkCodeQualifier(int code) {
+        mCode = code;
+    }
+
     public int getCode() {
         return mCode;
     }
@@ -115,8 +122,7 @@
                 return false;
             }
 
-            NetworkCodeQualifier qualifier = new NetworkCodeQualifier();
-            qualifier.mCode = code;
+            NetworkCodeQualifier qualifier = new NetworkCodeQualifier(code);
             config.setNetworkCodeQualifier(qualifier);
             return true;
         }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/PixelDensityQualifier.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/PixelDensityQualifier.java
index f75e9cb..ed33994 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/PixelDensityQualifier.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/PixelDensityQualifier.java
@@ -17,6 +17,7 @@
 package com.android.ide.eclipse.adt.internal.resources.configurations;
 
 import com.android.ide.eclipse.adt.internal.editors.IconFactory;
+import com.android.layoutlib.api.IDensityBasedResourceValue;
 import com.android.sdklib.AndroidVersion;
 import com.android.sdklib.IAndroidTarget;
 
@@ -39,19 +40,20 @@
      * Screen Orientation enum.
      */
     public static enum Density {
-        HIGH("hdpi", 240, "High Density"), //$NON-NLS-1$
-        MEDIUM("mdpi", 160, "Medium Density"), //$NON-NLS-1$
-        LOW("ldpi", 120, "Low Density"), //$NON-NLS-1$
-        NODPI("nodpi", -1, "No Density"); //$NON-NLS-1$
+        HIGH("hdpi", "High Density", IDensityBasedResourceValue.Density.HIGH), //$NON-NLS-1$
+        MEDIUM("mdpi", "Medium Density", IDensityBasedResourceValue.Density.MEDIUM), //$NON-NLS-1$
+        LOW("ldpi", "Low Density", IDensityBasedResourceValue.Density.LOW), //$NON-NLS-1$
+        NODPI("nodpi", "No Density", IDensityBasedResourceValue.Density.NODPI); //$NON-NLS-1$
 
         private final String mValue;
         private final String mDisplayValue;
-        private final int mDpiValue;
+        private final IDensityBasedResourceValue.Density mDensity;
 
-        private Density(String value, int dpiValue, String displayValue) {
+        private Density(String value, String displayValue,
+                IDensityBasedResourceValue.Density density) {
             mValue = value;
-            mDpiValue = dpiValue;
             mDisplayValue = displayValue;
+            mDensity = density;
         }
 
         /**
@@ -59,7 +61,7 @@
          * @param value The qualifier value.
          * @return the enum for the qualifier value or null if no matching was found.
          */
-        static Density getEnum(String value) {
+        public static Density getEnum(String value) {
             for (Density orient : values()) {
                 if (orient.mValue.equals(value)) {
                     return orient;
@@ -77,7 +79,7 @@
                 try {
                     int density = Integer.parseInt(v);
                     for (Density orient : values()) {
-                        if (orient.mDpiValue == density) {
+                        if (orient.mDensity.getValue() == density) {
                             return orient;
                         }
                     }
@@ -94,12 +96,12 @@
         }
 
         public int getDpiValue() {
-            return mDpiValue;
+            return mDensity.getValue();
         }
 
         public String getLegacyValue() {
             if (this != NODPI) {
-                return String.format("%1$ddpi", mDpiValue);
+                return String.format("%1$ddpi", getDpiValue());
             }
 
             return "";
@@ -109,6 +111,14 @@
             return mDisplayValue;
         }
 
+        /**
+         * Returns the {@link com.android.layoutlib.api.IDensityBasedResourceValue.Density} value
+         * associated to this {@link Density}.
+         */
+        public IDensityBasedResourceValue.Density getDensity() {
+            return mDensity;
+        }
+
         public static int getIndex(Density value) {
             int i = 0;
             for (Density input : values()) {
@@ -184,6 +194,38 @@
     }
 
     @Override
+    public boolean isMatchFor(ResourceQualifier qualifier) {
+        if (qualifier instanceof PixelDensityQualifier) {
+            // as long as there's a density qualifier, it's always a match.
+            // The best match will be found later.
+            return true;
+        }
+
+        return false;
+    }
+
+    @Override
+    public boolean isBetterMatchThan(ResourceQualifier compareTo, ResourceQualifier reference) {
+        if (compareTo == null) {
+            return true;
+        }
+
+        PixelDensityQualifier compareQ = (PixelDensityQualifier)compareTo;
+        PixelDensityQualifier referenceQ = (PixelDensityQualifier)reference;
+
+        if (mValue == referenceQ.mValue && compareQ.mValue != referenceQ.mValue) {
+            // got exact value, this is the best!
+            return true;
+        } else {
+            // in all case we're going to prefer the higher dpi.
+            // if reference is high, we want highest dpi.
+            // if reference is medium, we'll prefer to scale down high dpi, than scale up low dpi
+            // if reference if low, we'll prefer to scale down high than medium (2:1 over 4:3)
+            return mValue.mDensity.getValue() > compareQ.mValue.mDensity.getValue();
+        }
+    }
+
+    @Override
     public boolean equals(Object qualifier) {
         if (qualifier instanceof PixelDensityQualifier) {
             return mValue == ((PixelDensityQualifier)qualifier).mValue;
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/RegionQualifier.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/RegionQualifier.java
index 3f3abcc..bf192c2 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/RegionQualifier.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/RegionQualifier.java
@@ -67,6 +67,14 @@
         return "";  //$NON-NLS-1$
     }
 
+    public RegionQualifier() {
+
+    }
+
+    public RegionQualifier(String value) {
+        mValue = value;
+    }
+
     public String getValue() {
         if (mValue != null) {
             return mValue;
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ResourceQualifier.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ResourceQualifier.java
index bfee8d2..ba54ad0 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ResourceQualifier.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ResourceQualifier.java
@@ -62,6 +62,32 @@
      */
     public abstract String getFolderSegment(IAndroidTarget target);
 
+    /**
+     * Returns whether the given qualifier is a match for the receiver.
+     * <p/>The default implementation returns the result of {@link #equals(Object)}.
+     * <p/>Children class that re-implements this must implement
+     * {@link #isBetterMatchThan(ResourceQualifier, ResourceQualifier)} too.
+     * @param qualifier the reference qualifier
+     * @return true if the receiver is a match.
+     */
+    public boolean isMatchFor(ResourceQualifier qualifier) {
+        return equals(qualifier);
+    }
+
+    /**
+     * Returns true if the receiver is a better match for the given <var>reference</var> than
+     * the given <var>compareTo</var> comparable.
+     * @param compareTo The {@link ResourceQualifier} to compare to. Can be null, in which
+     * case the method must return <code>true</code>.
+     * @param reference The reference qualifier value for which the match is.
+     * @return true if the receiver is a better match.
+     */
+    public boolean isBetterMatchThan(ResourceQualifier compareTo, ResourceQualifier reference) {
+        // the default is to always return false. This gives less overhead than always returning
+        // true, as it would only compare same values anyway.
+        return false;
+    }
+
     @Override
     public String toString() {
         return getFolderSegment(null);
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenDimensionQualifier.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenDimensionQualifier.java
index ff8a930..30929b2 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenDimensionQualifier.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenDimensionQualifier.java
@@ -48,6 +48,15 @@
      * Default value is <code>DEFAULT_SIZE</code> */
     private int mValue2 = DEFAULT_SIZE;
 
+    public ScreenDimensionQualifier() {
+        // pass
+    }
+
+    public ScreenDimensionQualifier(int value1, int value2) {
+        mValue1 = value1;
+        mValue2 = value2;
+    }
+
     public int getValue1() {
         return mValue1;
     }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenOrientationQualifier.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenOrientationQualifier.java
index 85d0c03..a78f217 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenOrientationQualifier.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenOrientationQualifier.java
@@ -51,7 +51,7 @@
          * @param value The qualifier value.
          * @return the enum for the qualifier value or null if no matching was found.
          */
-        static ScreenOrientation getEnum(String value) {
+        public static ScreenOrientation getEnum(String value) {
             for (ScreenOrientation orient : values()) {
                 if (orient.mValue.equals(value)) {
                     return orient;
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenRatioQualifier.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenRatioQualifier.java
index 55857fd..08bce4f 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenRatioQualifier.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenRatioQualifier.java
@@ -48,7 +48,7 @@
          * @param value The qualifier value.
          * @return the enum for the qualifier value or null if no matching was found.
          */
-        static ScreenRatio getEnum(String value) {
+        public static ScreenRatio getEnum(String value) {
             for (ScreenRatio orient : values()) {
                 if (orient.mValue.equals(value)) {
                     return orient;
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenSizeQualifier.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenSizeQualifier.java
index d148efc..f48f54d 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenSizeQualifier.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/ScreenSizeQualifier.java
@@ -52,7 +52,7 @@
          * @param value The qualifier value.
          * @return the enum for the qualifier value or null if no matching was found.
          */
-        static ScreenSize getEnum(String value) {
+        public static ScreenSize getEnum(String value) {
             for (ScreenSize orient : values()) {
                 if (orient.mValue.equals(value)) {
                     return orient;
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/TextInputMethodQualifier.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/TextInputMethodQualifier.java
index 6289147..b73776c 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/TextInputMethodQualifier.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/TextInputMethodQualifier.java
@@ -54,7 +54,7 @@
          * @param value The qualifier value.
          * @return the enum for the qualifier value or null if no matching was found.
          */
-        static TextInputMethod getEnum(String value) {
+        public static TextInputMethod getEnum(String value) {
             for (TextInputMethod orient : values()) {
                 if (orient.mValue.equals(value)) {
                     return orient;
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/TouchScreenQualifier.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/TouchScreenQualifier.java
index 758c87f..b3bad48 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/TouchScreenQualifier.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/TouchScreenQualifier.java
@@ -52,7 +52,7 @@
          * @param value The qualifier value.
          * @return the enum for the qualifier value or null if no matching was found.
          */
-        static TouchScreenType getEnum(String value) {
+        public static TouchScreenType getEnum(String value) {
             for (TouchScreenType orient : values()) {
                 if (orient.mValue.equals(value)) {
                     return orient;
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/MultiResourceFile.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/MultiResourceFile.java
index 7528441..2d2749d 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/MultiResourceFile.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/MultiResourceFile.java
@@ -45,7 +45,7 @@
 public final class MultiResourceFile extends ResourceFile implements IValueResourceRepository {
 
     private final static SAXParserFactory sParserFactory = SAXParserFactory.newInstance();
-    
+
     private final HashMap<ResourceType, HashMap<String, ResourceValue>> mResourceItems =
         new HashMap<ResourceType, HashMap<String, ResourceValue>>();
 
@@ -58,7 +58,7 @@
         update();
 
         Set<ResourceType> keys = mResourceItems.keySet();
-        
+
         return keys.toArray(new ResourceType[keys.size()]);
     }
 
@@ -69,21 +69,21 @@
         HashMap<String, ResourceValue> list = mResourceItems.get(type);
         return (list != null && list.size() > 0);
     }
-    
+
     @Override
     public Collection<ProjectResourceItem> getResources(ResourceType type,
             ProjectResources projectResources) {
         update();
 
         HashMap<String, ResourceValue> list = mResourceItems.get(type);
-        
+
         ArrayList<ProjectResourceItem> items = new ArrayList<ProjectResourceItem>();
-        
+
         if (list != null) {
             Collection<ResourceValue> values = list.values();
             for (ResourceValue res : values) {
                 ProjectResourceItem item = projectResources.findResourceItem(type, res.getName());
-                
+
                 if (item == null) {
                     if (type == ResourceType.ID) {
                         item = new IdResourceItem(res.getName(), false /* isDeclaredInline */);
@@ -99,7 +99,7 @@
 
         return items;
     }
-    
+
     /**
      * Updates the Resource items if necessary.
      */
@@ -110,7 +110,7 @@
 
             // need to parse the file and find the content.
             parseFile();
-            
+
             resetTouch();
         }
     }
@@ -128,7 +128,7 @@
         } catch (CoreException e) {
         }
     }
-    
+
     /**
      * Adds a resource item to the list
      * @param resType The type of the resource
@@ -138,7 +138,7 @@
         ResourceType type = ResourceType.getEnum(resType);
         if (type != null) {
             HashMap<String, ResourceValue> list = mResourceItems.get(type);
-    
+
             // if the list does not exist, create it.
             if (list == null) {
                 list = new HashMap<String, ResourceValue>();
@@ -146,13 +146,13 @@
             } else {
                 // look for a possible value already existing.
                 ResourceValue oldValue = list.get(value.getName());
-                
+
                 if (oldValue != null) {
                     oldValue.replaceWith(value);
                     return;
                 }
             }
-            
+
             // empty list or no match found? add the given resource
             list.put(value.getName(), value);
         }
@@ -168,7 +168,7 @@
         if (list != null) {
             return list.get(name);
         }
-        
+
         return null;
     }
 }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java
index e6f81e2..dce2622 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java
@@ -22,6 +22,7 @@
 import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
 import com.android.ide.eclipse.adt.internal.resources.configurations.LanguageQualifier;
 import com.android.ide.eclipse.adt.internal.resources.configurations.RegionQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ResourceQualifier;
 import com.android.ide.eclipse.adt.internal.resources.manager.files.IAbstractFolder;
 import com.android.layoutlib.api.IResourceValue;
 import com.android.layoutlib.utils.ResourceValue;
@@ -32,10 +33,11 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
 
 /**
  * Represents the resources of a project. This is a file view of the resources, with handling
@@ -44,30 +46,30 @@
 public class ProjectResources implements IResourceRepository {
     private final HashMap<ResourceFolderType, List<ResourceFolder>> mFolderMap =
         new HashMap<ResourceFolderType, List<ResourceFolder>>();
-    
+
     private final HashMap<ResourceType, List<ProjectResourceItem>> mResourceMap =
         new HashMap<ResourceType, List<ProjectResourceItem>>();
-    
+
     /** Map of (name, id) for resources of type {@link ResourceType#ID} coming from R.java */
     private Map<String, Map<String, Integer>> mResourceValueMap;
     /** Map of (id, [name, resType]) for all resources coming from R.java */
     private Map<Integer, String[]> mResIdValueToNameMap;
     /** Map of (int[], name) for styleable resources coming from R.java */
     private Map<IntArrayWrapper, String> mStyleableValueToNameMap;
-    
+
     /** Cached list of {@link IdResourceItem}. This is mix of IdResourceItem created by
      * {@link MultiResourceFile} for ids coming from XML files under res/values and
      * {@link IdResourceItem} created manually, from the list coming from R.java */
     private final ArrayList<IdResourceItem> mIdResourceList = new ArrayList<IdResourceItem>();
 
     private final boolean mIsFrameworkRepository;
-    
+
     private final IntArrayWrapper mWrapper = new IntArrayWrapper(null);
 
     public ProjectResources(boolean isFrameworkRepository) {
         mIsFrameworkRepository = isFrameworkRepository;
     }
-    
+
     public boolean isSystemRepository() {
         return mIsFrameworkRepository;
     }
@@ -83,7 +85,7 @@
             IAbstractFolder folder) {
         // get the list for the resource type
         List<ResourceFolder> list = mFolderMap.get(type);
-        
+
         if (list == null) {
             list = new ArrayList<ResourceFolder>();
 
@@ -91,7 +93,7 @@
             list.add(cf);
 
             mFolderMap.put(type, list);
-            
+
             return cf;
         }
 
@@ -109,7 +111,7 @@
         // So we add one.
         ResourceFolder cf = new ResourceFolder(type, config, folder, mIsFrameworkRepository);
         list.add(cf);
-        
+
         return cf;
     }
 
@@ -121,7 +123,7 @@
     protected void removeFolder(ResourceFolderType type, IFolder folder) {
         // get the list of folders for the resource type.
         List<ResourceFolder> list = mFolderMap.get(type);
-        
+
         if (list != null) {
             int count = list.size();
             for (int i = 0 ; i < count ; i++) {
@@ -129,7 +131,7 @@
                 if (resFolder.getFolder().getIFolder().equals(folder)) {
                     // we found the matching ResourceFolder. we need to remove it.
                     list.remove(i);
-                    
+
                     // we now need to invalidate this resource type.
                     // The easiest way is to touch one of the other folders of the same type.
                     if (list.size() > 0) {
@@ -146,23 +148,23 @@
                         // If we don't find a single folder to touch, then it's fine, as the top
                         // level items (the list of generated resource types) is not cached
                         // (for now)
-                        
+
                         // get the lists of ResourceTypes generated by this ResourceFolderType
                         ResourceType[] resTypes = FolderTypeRelationship.getRelatedResourceTypes(
                                 type);
-                        
+
                         // for each of those, make sure to find one folder to touch so that the
                         // list of ResourceItem associated with the type is rebuilt.
                         for (ResourceType resType : resTypes) {
                             // get the list of folder that can generate this type
                             ResourceFolderType[] folderTypes =
                                 FolderTypeRelationship.getRelatedFolders(resType);
-                            
+
                             // we only need to touch one folder in any of those (since it's one
                             // folder per type, not per folder type).
                             for (ResourceFolderType folderType : folderTypes) {
                                 List<ResourceFolder> resFolders = mFolderMap.get(folderType);
-                                
+
                                 if (resFolders != null && resFolders.size() > 0) {
                                     resFolders.get(0).touch();
                                     break;
@@ -170,7 +172,7 @@
                             }
                         }
                     }
-                    
+
                     // we're done updating/touching, we can stop
                     break;
                 }
@@ -178,7 +180,7 @@
         }
     }
 
-    
+
     /**
      * Returns a list of {@link ResourceFolder} for a specific {@link ResourceFolderType}.
      * @param type The {@link ResourceFolderType}
@@ -186,13 +188,13 @@
     public List<ResourceFolder> getFolders(ResourceFolderType type) {
         return mFolderMap.get(type);
     }
-    
+
     /* (non-Javadoc)
      * @see com.android.ide.eclipse.editors.resources.IResourceRepository#getAvailableResourceTypes()
      */
     public ResourceType[] getAvailableResourceTypes() {
         ArrayList<ResourceType> list = new ArrayList<ResourceType>();
-        
+
         // For each key, we check if there's a single ResourceType match.
         // If not, we look for the actual content to give us the resource type.
 
@@ -213,7 +215,7 @@
                 if (folders != null) {
                     for (ResourceFolder folder : folders) {
                         Collection<ResourceType> folderContent = folder.getResourceTypes();
-                        
+
                         // then we add them, but only if they aren't already in the list.
                         for (ResourceType folderResType : folderContent) {
                             if (list.indexOf(folderResType) == -1) {
@@ -224,7 +226,7 @@
                 }
             }
         }
-        
+
         // in case ResourceType.ID haven't been added yet because there's no id defined
         // in XML, we check on the list of compiled id resources.
         if (list.indexOf(ResourceType.ID) == -1 && mResourceValueMap != null) {
@@ -237,7 +239,7 @@
         // at this point the list is full of ResourceType defined in the files.
         // We need to sort it.
         Collections.sort(list);
-        
+
         return list.toArray(new ResourceType[list.size()]);
     }
 
@@ -246,15 +248,15 @@
      */
     public ProjectResourceItem[] getResources(ResourceType type) {
         checkAndUpdate(type);
-        
+
         if (type == ResourceType.ID) {
             synchronized (mIdResourceList) {
                 return mIdResourceList.toArray(new ProjectResourceItem[mIdResourceList.size()]);
             }
         }
-        
+
         List<ProjectResourceItem> items = mResourceMap.get(type);
-        
+
         return items.toArray(new ProjectResourceItem[items.size()]);
     }
 
@@ -287,10 +289,10 @@
                 }
             }
         }
-        
+
         return null;
     }
-    
+
     /**
      * Returns the {@link ResourceFile} matching the given name, {@link ResourceFolderType} and
      * configuration.
@@ -305,29 +307,29 @@
 
         // look for folders containing a file with the given name.
         ArrayList<ResourceFolder> matchingFolders = new ArrayList<ResourceFolder>();
-        
+
         // remove the folders that do not have a file with the given name, or if their config
         // is incompatible.
         for (int i = 0 ; i < folders.size(); i++) {
             ResourceFolder folder = folders.get(i);
-            
+
             if (folder.hasFile(name) == true) {
                 matchingFolders.add(folder);
             }
         }
-        
+
         // from those, get the folder with a config matching the given reference configuration.
         Resource match = findMatchingConfiguredResource(matchingFolders, config);
-        
+
         // do we have a matching folder?
         if (match instanceof ResourceFolder) {
             // get the ResourceFile from the filename
             return ((ResourceFolder)match).getFile(name);
         }
-        
+
         return null;
     }
-    
+
     /**
      * Returns the resources values matching a given {@link FolderConfiguration}.
      * @param referenceConfig the configuration that each value must match.
@@ -337,7 +339,7 @@
 
         Map<String, Map<String, IResourceValue>> map =
             new HashMap<String, Map<String, IResourceValue>>();
-        
+
         // special case for Id since there's a mix of compiled id (declared inline) and id declared
         // in the XML files.
         if (mIdResourceList.size() > 0) {
@@ -348,10 +350,10 @@
                 idMap.put(id.getName(), new ResourceValue(idType, id.getName(),
                         mIsFrameworkRepository));
             }
-            
+
             map.put(ResourceType.ID.getName(), idMap);
         }
-        
+
         Set<ResourceType> keys = mResourceMap.keySet();
         for (ResourceType key : keys) {
             // we don't process ID resources since we already did it above.
@@ -359,10 +361,10 @@
                 map.put(key.getName(), getConfiguredResource(key, referenceConfig));
             }
         }
-        
+
         return map;
     }
-    
+
     /**
      * Loads all the resources. Essentially this forces to load the values from the
      * {@link ResourceFile} objects to make sure they are up to date and loaded
@@ -371,13 +373,13 @@
     public void loadAll() {
         // gets all the resource types available.
         ResourceType[] types = getAvailableResourceTypes();
-        
+
         // loop on them and load them
         for (ResourceType type: types) {
             checkAndUpdate(type);
         }
     }
-    
+
     /**
      * Resolves a compiled resource id into the resource name and type
      * @param id
@@ -387,7 +389,7 @@
         if (mResIdValueToNameMap != null) {
             return mResIdValueToNameMap.get(id);
         }
-        
+
         return null;
     }
 
@@ -399,7 +401,7 @@
             mWrapper.set(id);
             return mStyleableValueToNameMap.get(mWrapper);
         }
-        
+
         return null;
     }
 
@@ -416,12 +418,12 @@
 
         return null;
     }
-    
+
     /**
-     * Returns the list of languages used in the resources.
+     * Returns the sorted list of languages used in the resources.
      */
-    public Set<String> getLanguages() {
-        Set<String> set = new HashSet<String>();
+    public SortedSet<String> getLanguages() {
+        SortedSet<String> set = new TreeSet<String>();
 
         Collection<List<ResourceFolder>> folderList = mFolderMap.values();
         for (List<ResourceFolder> folderSubList : folderList) {
@@ -433,22 +435,22 @@
                 }
             }
         }
-        
+
         return set;
     }
-    
+
     /**
-     * Returns the list of regions used in the resources with the given language.
+     * Returns the sorted list of regions used in the resources with the given language.
      * @param currentLanguage the current language the region must be associated with.
      */
-    public Set<String> getRegions(String currentLanguage) {
-        Set<String> set = new HashSet<String>();
+    public SortedSet<String> getRegions(String currentLanguage) {
+        SortedSet<String> set = new TreeSet<String>();
 
         Collection<List<ResourceFolder>> folderList = mFolderMap.values();
         for (List<ResourceFolder> folderSubList : folderList) {
             for (ResourceFolder folder : folderSubList) {
                 FolderConfiguration config = folder.getConfiguration();
-                
+
                 // get the language
                 LanguageQualifier lang = config.getLanguageQualifier();
                 if (lang != null && lang.getStringValue().equals(currentLanguage)) {
@@ -459,7 +461,7 @@
                 }
             }
         }
-        
+
         return set;
     }
 
@@ -474,23 +476,23 @@
             FolderConfiguration referenceConfig) {
         // get the resource item for the given type
         List<ProjectResourceItem> items = mResourceMap.get(type);
-        
+
         // create the map
         HashMap<String, IResourceValue> map = new HashMap<String, IResourceValue>();
-        
+
         for (ProjectResourceItem item : items) {
             // get the source files generating this resource
             List<ResourceFile> list = item.getSourceFileList();
-            
+
             // look for the best match for the given configuration
             Resource match = findMatchingConfiguredResource(list, referenceConfig);
-            
+
             if (match instanceof ResourceFile) {
                 ResourceFile matchResFile = (ResourceFile)match;
-                
+
                 // get the value of this configured resource.
                 IResourceValue value = matchResFile.getValue(type, item.getName());
-                
+
                 if (value != null) {
                     map.put(item.getName(), value);
                 }
@@ -501,87 +503,113 @@
     }
 
     /**
-     * Returns the best matching {@link Resource}. 
+     * Returns the best matching {@link Resource}.
      * @param resources the list of {@link Resource} to choose from.
      * @param referenceConfig the {@link FolderConfiguration} to match.
+     * @see http://d.android.com/guide/topics/resources/resources-i18n.html#best-match
      */
     private Resource findMatchingConfiguredResource(List<? extends Resource> resources,
             FolderConfiguration referenceConfig) {
-        // look for resources with the maximum number of qualifier match.
-        int currentMax = -1;
+        //
+        // 1: eliminate resources that contradict the reference configuration
+        // 2: pick next qualifier type
+        // 3: check if any resources use this qualifier, if no, back to 2, else move on to 4.
+        // 4: eliminate resources that don't use this qualifier.
+        // 5: if more than one resource left, go back to 2.
+        //
+        // The precedence of the qualifiers is more important than the number of qualifiers that
+        // exactly match the device.
+
+        // 1: eliminate resources that contradict
         ArrayList<Resource> matchingResources = new ArrayList<Resource>();
         for (int i = 0 ; i < resources.size(); i++) {
             Resource res = resources.get(i);
-            
-            int count = res.getConfiguration().match(referenceConfig);
-            if (count > currentMax) {
-                matchingResources.clear();
-                matchingResources.add(res);
-                currentMax = count;
-            } else if (count != -1 && count == currentMax) {
+
+            if (res.getConfiguration().isMatchFor(referenceConfig)) {
                 matchingResources.add(res);
             }
         }
-        
-        // if we have more than one match, we look for the match with the qualifiers with the
-        // highest priority.
-        Resource resMatch = null;
-        if (matchingResources.size() == 1) {
-            resMatch = matchingResources.get(0);
-        } else if (matchingResources.size() > 1) {
-            // More than one resource with the same number of qualifier match.
-            // We loop, looking for the resource with the highest priority qualifiers.
-            ArrayList<Resource> tmpResources = new ArrayList<Resource>();
-            int startIndex = 0;
-            while (matchingResources.size() > 1) {
-                int highest = -1;
-                for (int i = 0 ; i < matchingResources.size() ; i++) {
-                    Resource folder = matchingResources.get(i);
-                 
-                    // get highest priority qualifiers.
-                    int m = folder.getConfiguration().getHighestPriorityQualifier(startIndex);
 
-                    // add to the list if highest.
-                    if (m != -1) {
-                        if (highest == -1 || m == highest) {
-                            tmpResources.add(folder);
-                            highest = m;
-                        } else if (m < highest) { // highest priority == lowest index.
-                            tmpResources.clear();
-                            tmpResources.add(folder);
+        // if there is only one match, just take it
+        if (matchingResources.size() == 1) {
+            return matchingResources.get(0);
+        } else if (matchingResources.size() == 0) {
+            return null;
+        }
+
+        // 2. Loop on the qualifiers, and eliminate matches
+        final int count = FolderConfiguration.getQualifierCount();
+        for (int q = 0 ; q < count ; q++) {
+            // look to see if one resource has this qualifier.
+            // At the same time also record the best match value for the qualifier (if applicable).
+
+            // The reference value, to find the best match.
+            // Note that this qualifier could be null. In which case any qualifier found in the
+            // possible match, will all be considered best match.
+            ResourceQualifier referenceQualifier = referenceConfig.getQualifier(q);
+
+            boolean found = false;
+            ResourceQualifier bestMatch = null; // this is to store the best match.
+            for (Resource res : matchingResources) {
+                ResourceQualifier qualifier = res.getConfiguration().getQualifier(q);
+                if (qualifier != null) {
+                    // set the flag.
+                    found = true;
+
+                    // Now check for a best match. If the reference qualifier is null ,
+                    // any qualifier is a "best" match (we don't need to record all of them.
+                    // Instead the non compatible ones are removed below)
+                    if (referenceQualifier != null) {
+                        if (qualifier.isBetterMatchThan(bestMatch, referenceQualifier)) {
+                            bestMatch = qualifier;
                         }
                     }
                 }
-                
-                // at this point, we have a list with 1+ resources that all have the same highest
-                // priority qualifiers. Go through the list again looking for the next highest
-                // priority qualifier.
-                startIndex = highest + 1;
-                
-                // this should not happen, but it's better to check.
-                if (matchingResources.size() == tmpResources.size() && highest == -1) {
-                    // this means all the resources match with the same qualifiers
-                    // (highest == -1 means we reached the end of the qualifier list)
-                    // In this case, we arbitrarily take the first resource.
-                    matchingResources.clear();
-                    matchingResources.add(tmpResources.get(0));
-                } else {
-                    matchingResources.clear();
-                    matchingResources.addAll(tmpResources);
-                }
-                tmpResources.clear();
             }
-            
-            // we should have only one match here.
-            resMatch = matchingResources.get(0);
+
+            // 4. If a resources has a qualifier at the current index, remove all the resources that
+            // do not have one, or whose qualifier value does not equal the best match found above
+            // unless there's no reference qualifier, in which case they are all considered
+            // "best" match.
+            if (found) {
+                for (int i = 0 ; i < matchingResources.size(); ) {
+                    Resource res = matchingResources.get(i);
+                    ResourceQualifier qualifier = res.getConfiguration().getQualifier(q);
+
+                    if (qualifier == null) {
+                        // this resources has no qualifier of this type: rejected.
+                        matchingResources.remove(res);
+                    } else if (referenceQualifier != null && bestMatch != null &&
+                            bestMatch.equals(qualifier) == false) {
+                        // there's a reference qualifier and there is a better match for it than
+                        // this resource, so we reject it.
+                        matchingResources.remove(res);
+                    } else {
+                        // looks like we keep this resource, move on to the next one.
+                        i++;
+                    }
+                }
+
+                // at this point we may have run out of matching resources before going
+                // through all the qualifiers.
+                if (matchingResources.size() < 2) {
+                    break;
+                }
+            }
         }
 
-        return resMatch;
+        // Because we accept resources whose configuration have qualifiers where the reference 
+        // configuration doesn't, we can end up with more than one match. In this case, we just
+        // take the first one.
+        if (matchingResources.size() == 0) {
+            return null;
+        }
+        return matchingResources.get(0);
     }
 
     /**
      * Checks if the list of {@link ResourceItem}s for the specified {@link ResourceType} needs
-     * to be updated. 
+     * to be updated.
      * @param type the Resource Type.
      */
     private void checkAndUpdate(ResourceType type) {
@@ -590,7 +618,7 @@
 
         for (ResourceFolderType folderType : folderTypes) {
             List<ResourceFolder> folders = mFolderMap.get(folderType);
-            
+
             if (folders != null) {
                 for (ResourceFolder folder : folders) {
                     if (folder.isTouched()) {
@@ -618,7 +646,7 @@
         // get the cache list, and lets make a backup
         List<ProjectResourceItem> items = mResourceMap.get(type);
         List<ProjectResourceItem> backup = new ArrayList<ProjectResourceItem>();
-        
+
         if (items == null) {
             items = new ArrayList<ProjectResourceItem>();
             mResourceMap.put(type, items);
@@ -629,7 +657,7 @@
             // we reset the list itself.
             items.clear();
         }
-        
+
         // get the list of folder that can output this type
         ResourceFolderType[] folderTypes = FolderTypeRelationship.getRelatedFolders(type);
 
@@ -656,7 +684,7 @@
             for (int i = 0 ; i < count;) {
                 // get the "new" item
                 ProjectResourceItem item = items.get(i);
-                
+
                 // look for a similar item in the old list.
                 ProjectResourceItem foundOldItem = null;
                 for (ProjectResourceItem oldItem : backup) {
@@ -665,15 +693,15 @@
                         break;
                     }
                 }
-                
+
                 if (foundOldItem != null) {
                     // erase the data of the old item with the data from the new one.
                     foundOldItem.replaceWith(item);
-                    
+
                     // remove the old and new item from their respective lists
                     items.remove(i);
                     backup.remove(foundOldItem);
-                    
+
                     // add the old item to the new list
                     items.add(foundOldItem);
                 } else {
@@ -682,7 +710,7 @@
                 }
             }
         }
-        
+
         // if this is the ResourceType.ID, we create the actual list, from this list and
         // the compiled resource list.
         if (type == ResourceType.ID) {
@@ -694,20 +722,20 @@
     }
 
     /**
-     * Looks up an existing {@link ProjectResourceItem} by {@link ResourceType} and name. 
+     * Looks up an existing {@link ProjectResourceItem} by {@link ResourceType} and name.
      * @param type the Resource Type.
      * @param name the Resource name.
      * @return the existing ResourceItem or null if no match was found.
      */
     protected ProjectResourceItem findResourceItem(ResourceType type, String name) {
         List<ProjectResourceItem> list = mResourceMap.get(type);
-        
+
         for (ProjectResourceItem item : list) {
             if (name.equals(item.getName())) {
                 return item;
             }
         }
-        
+
         return null;
     }
 
@@ -745,13 +773,13 @@
 
             // empty the current list
             mIdResourceList.clear();
-            
+
             // get the list of compile id resources.
             Map<String, Integer> idMap = null;
             if (mResourceValueMap != null) {
                 idMap = mResourceValueMap.get(ResourceType.ID.getName());
             }
-            
+
             if (idMap == null) {
                 if (xmlIdResources != null) {
                     for (ProjectResourceItem resourceItem : xmlIdResources) {
@@ -764,21 +792,21 @@
             } else {
                 // loop on the full list of id, and look for a match in the old list,
                 // in the list coming from XML (in case a new XML item was created.)
-                
+
                 Set<String> idSet = idMap.keySet();
-                
+
                 idLoop: for (String idResource : idSet) {
                     // first look in the XML list in case an id went from inline to XML declared.
                     if (xmlIdResources != null) {
                         for (ProjectResourceItem resourceItem : xmlIdResources) {
-                            if (resourceItem instanceof IdResourceItem && 
+                            if (resourceItem instanceof IdResourceItem &&
                                     resourceItem.getName().equals(idResource)) {
                                 mIdResourceList.add((IdResourceItem)resourceItem);
                                 continue idLoop;
                             }
                         }
                     }
-                    
+
                     // if we haven't found it, look in the old items.
                     int count = oldItems.size();
                     for (int i = 0 ; i < count ; i++) {
@@ -789,14 +817,14 @@
                             continue idLoop;
                         }
                     }
-                    
+
                     // if we haven't found it, it looks like it's a new id that was
                     // declared inline.
                     mIdResourceList.add(new IdResourceItem(idResource,
                             true /* isDeclaredInline */));
                 }
             }
-            
+
             // now we sort the list
             Collections.sort(mIdResourceList);
         }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/SingleResourceFile.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/SingleResourceFile.java
index 51bd793..8900500 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/SingleResourceFile.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/SingleResourceFile.java
@@ -17,8 +17,10 @@
 package com.android.ide.eclipse.adt.internal.resources.manager;
 
 import com.android.ide.eclipse.adt.internal.resources.ResourceType;
+import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier;
 import com.android.ide.eclipse.adt.internal.resources.manager.files.IAbstractFile;
 import com.android.layoutlib.api.IResourceValue;
+import com.android.layoutlib.utils.DensityBasedResourceValue;
 import com.android.layoutlib.utils.ResourceValue;
 
 import java.util.ArrayList;
@@ -40,24 +42,24 @@
     static {
         sParserFactory.setNamespaceAware(true);
     }
-    
+
     private final static Pattern sXmlPattern = Pattern.compile("^(.+)\\.xml", //$NON-NLS-1$
             Pattern.CASE_INSENSITIVE);
-    
+
     private final static Pattern[] sDrawablePattern = new Pattern[] {
         Pattern.compile("^(.+)\\.9\\.png", Pattern.CASE_INSENSITIVE), //$NON-NLS-1$
         Pattern.compile("^(.+)\\.png", Pattern.CASE_INSENSITIVE), //$NON-NLS-1$
         Pattern.compile("^(.+)\\.jpg", Pattern.CASE_INSENSITIVE), //$NON-NLS-1$
         Pattern.compile("^(.+)\\.gif", Pattern.CASE_INSENSITIVE), //$NON-NLS-1$
     };
-    
+
     private String mResourceName;
     private ResourceType mType;
     private IResourceValue mValue;
 
     public SingleResourceFile(IAbstractFile file, ResourceFolder folder) {
         super(file, folder);
-        
+
         // we need to infer the type of the resource from the folder type.
         // This is easy since this is a single Resource file.
         ResourceType[] types = FolderTypeRelationship.getRelatedResourceTypes(folder.getType());
@@ -65,9 +67,17 @@
 
         // compute the resource name
         mResourceName = getResourceName(mType);
-        
-        mValue = new ResourceValue(mType.getName(), getResourceName(mType), file.getOsLocation(),
-                isFramework());
+
+        // test if there's a density qualifier associated with the resource
+        PixelDensityQualifier qualifier = folder.getConfiguration().getPixelDensityQualifier();
+
+        if (qualifier == null) {
+            mValue = new ResourceValue(mType.getName(), getResourceName(mType),
+                    file.getOsLocation(), isFramework());
+        } else {
+            mValue = new DensityBasedResourceValue(mType.getName(), getResourceName(mType),
+                    file.getOsLocation(), qualifier.getValue().getDensity(), isFramework());
+        }
     }
 
     @Override
@@ -83,27 +93,27 @@
     @Override
     public Collection<ProjectResourceItem> getResources(ResourceType type,
             ProjectResources projectResources) {
-        
+
         // looking for an existing ResourceItem with this name and type
         ProjectResourceItem item = projectResources.findResourceItem(type, mResourceName);
-        
+
         ArrayList<ProjectResourceItem> items = new ArrayList<ProjectResourceItem>();
 
         if (item == null) {
             item = new ConfigurableResourceItem(mResourceName);
             items.add(item);
         }
-        
+
         // add this ResourceFile to the ResourceItem
         item.add(this);
-        
+
         return items;
     }
 
     /*
      * (non-Javadoc)
      * @see com.android.ide.eclipse.editors.resources.manager.ResourceFile#getValue(com.android.ide.eclipse.common.resources.ResourceType, java.lang.String)
-     * 
+     *
      * This particular implementation does not care about the type or name since a
      * SingleResourceFile represents a file generating only one resource.
      * The value returned is the full absolute path of the file in OS form.
@@ -112,14 +122,14 @@
     public IResourceValue getValue(ResourceType type, String name) {
         return mValue;
     }
-    
+
     /**
      * Returns the name of the resources.
      */
     private String getResourceName(ResourceType type) {
         // get the name from the filename.
         String name = getFile().getName();
-        
+
         if (type == ResourceType.ANIM || type == ResourceType.LAYOUT || type == ResourceType.MENU ||
                 type == ResourceType.COLOR || type == ResourceType.XML) {
             Matcher m = sXmlPattern.matcher(name);
@@ -133,7 +143,7 @@
                     return m.group(1);
                 }
             }
-            
+
             // also try the Xml pattern for selector/shape based drawable.
             Matcher m = sXmlPattern.matcher(name);
             if (m.matches()) {
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetData.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetData.java
index 118fb4f..abd7cf8 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetData.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetData.java
@@ -36,7 +36,7 @@
  * This class contains the data of an Android Target as loaded from the SDK.
  */
 public class AndroidTargetData {
-    
+
     public final static int DESCRIPTOR_MANIFEST = 1;
     public final static int DESCRIPTOR_LAYOUT = 2;
     public final static int DESCRIPTOR_MENU = 3;
@@ -45,15 +45,15 @@
     public final static int DESCRIPTOR_SEARCHABLE = 6;
     public final static int DESCRIPTOR_PREFERENCES = 7;
     public final static int DESCRIPTOR_APPWIDGET_PROVIDER = 8;
-    
+
     public final static class LayoutBridge {
         /** Link to the layout bridge */
         public ILayoutBridge bridge;
 
         public LoadStatus status = LoadStatus.LOADING;
-        
+
         public ClassLoader classLoader;
-        
+
         public int apiLevel;
     }
 
@@ -67,12 +67,12 @@
      * The attribute namespace prefix must be:
      * - "android" for AndroidConstants.NS_RESOURCES
      * - "xmlns" for the XMLNS URI.
-     * 
+     *
      * This is used for attributes that do not have a unique name, but still need to be populated
      * with values in the UI. Uniquely named attributes have their values in {@link #mEnumValueMap}.
      */
     private Hashtable<String, String[]> mAttributeValues = new Hashtable<String, String[]>();
-    
+
     private IResourceRepository mSystemResourceRepository;
 
     private AndroidManifestDescriptors mManifestDescriptors;
@@ -90,15 +90,15 @@
     AndroidTargetData(IAndroidTarget androidTarget) {
         mTarget = androidTarget;
     }
-    
+
     void setDexWrapper(DexWrapper wrapper) {
         mDexWrapper = wrapper;
     }
-    
+
     /**
      * Creates an AndroidTargetData object.
-     * @param platformLibraries 
-     * @param optionalLibraries 
+     * @param platformLibraries
+     * @param optionalLibraries
      */
     void setExtraData(IResourceRepository systemResourceRepository,
             AndroidManifestDescriptors manifestDescriptors,
@@ -115,7 +115,7 @@
             IOptionalLibrary[] optionalLibraries,
             ProjectResources resources,
             LayoutBridge layoutBridge) {
-        
+
         mSystemResourceRepository = systemResourceRepository;
         mManifestDescriptors = manifestDescriptors;
         mLayoutDescriptors = layoutDescriptors;
@@ -134,11 +134,11 @@
     public DexWrapper getDexWrapper() {
         return mDexWrapper;
     }
-    
+
     public IResourceRepository getSystemResources() {
         return mSystemResourceRepository;
     }
-    
+
     /**
      * Returns an {@link IDescriptorProvider} from a given Id.
      * The Id can be one of {@link #DESCRIPTOR_MANIFEST}, {@link #DESCRIPTOR_LAYOUT},
@@ -168,21 +168,21 @@
                  throw new IllegalArgumentException();
         }
     }
-    
+
     /**
      * Returns the manifest descriptors.
      */
     public AndroidManifestDescriptors getManifestDescriptors() {
         return mManifestDescriptors;
     }
-    
+
     /**
      * Returns the layout Descriptors.
      */
     public LayoutDescriptors getLayoutDescriptors() {
         return mLayoutDescriptors;
     }
-    
+
     /**
      * Returns the menu descriptors.
      */
@@ -202,7 +202,7 @@
      * <p/>This should only be called for attributes for which possible values depend on the
      * parent element node.
      * <p/>For attributes that have the same values no matter the parent node, use
-     * {@link #getEnumValueMap()}.  
+     * {@link #getEnumValueMap()}.
      * @param elementName the name of the element containing the attribute.
      * @param attributeName the name of the attribute
      * @return an array of String with the possible values, or <code>null</code> if no values were
@@ -220,7 +220,7 @@
      * <p/>The typical example of this is for the 'name' attribute under
      * activity/intent-filter/action
      * <p/>For attributes that have the same values no matter the parent node, use
-     * {@link #getEnumValueMap()}.  
+     * {@link #getEnumValueMap()}.
      * @param elementName the name of the element containing the attribute.
      * @param attributeName the name of the attribute
      * @param greatGrandParentElementName the great-grand-parent node.
@@ -231,13 +231,13 @@
             String greatGrandParentElementName) {
         if (greatGrandParentElementName != null) {
             String key = String.format("(%1$s,%2$s,%3$s)", //$NON-NLS-1$
-                    greatGrandParentElementName, elementName, attributeName); 
+                    greatGrandParentElementName, elementName, attributeName);
             String[] values = mAttributeValues.get(key);
             if (values != null) {
                 return values;
             }
         }
-        
+
         return getAttributeValues(elementName, attributeName);
     }
 
@@ -250,14 +250,14 @@
     public Map<String, Map<String, Integer>> getEnumValueMap() {
         return mEnumValueMap;
     }
-    
+
     /**
      * Returns the {@link ProjectResources} containing the Framework Resources.
      */
     public ProjectResources getFrameworkResources() {
         return mFrameworkResources;
     }
-    
+
     /**
      * Returns a {@link LayoutBridge} object possibly containing a {@link ILayoutBridge} object.
      * <p/>If {@link LayoutBridge#bridge} is <code>null</code>, {@link LayoutBridge#status} will
@@ -272,7 +272,7 @@
         }
         return mLayoutBridge;
     }
-    
+
     /**
      * Sets the permission values
      * @param permissionValues the list of permissions
@@ -285,7 +285,7 @@
         setValues("(service,android:permission)", permissionValues);     //$NON-NLS-1$
         setValues("(provider,android:permission)", permissionValues);    //$NON-NLS-1$
     }
-    
+
     private void setIntentFilterActionsAndCategories(String[] activityIntentActions,
             String[] broadcastIntentActions, String[] serviceIntentActions,
             String[] intentCategoryValues) {
@@ -294,18 +294,18 @@
         setValues("(service,action,android:name)", serviceIntentActions);    //$NON-NLS-1$
         setValues("(category,android:name)", intentCategoryValues);          //$NON-NLS-1$
     }
-    
+
     private void setOptionalLibraries(String[] platformLibraries,
             IOptionalLibrary[] optionalLibraries) {
-        
+
         ArrayList<String> libs = new ArrayList<String>();
-        
+
         if (platformLibraries != null) {
             for (String name : platformLibraries) {
                 libs.add(name);
             }
         }
-        
+
         if (optionalLibraries != null) {
             for (int i = 0; i < optionalLibraries.length; i++) {
                 libs.add(optionalLibraries[i].getName());
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevice.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevice.java
new file mode 100644
index 0000000..9e80103
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevice.java
@@ -0,0 +1,263 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.sdk;
+
+import com.android.ide.eclipse.adt.internal.resources.configurations.CountryCodeQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
+import com.android.ide.eclipse.adt.internal.resources.configurations.KeyboardStateQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.NavigationMethodQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.NetworkCodeQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenDimensionQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenOrientationQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenRatioQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenSizeQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.TextInputMethodQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.TouchScreenQualifier;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * Class representing a layout device.
+ *
+ * A Layout device is a collection of {@link FolderConfiguration} that can be used to render Android
+ * layout files.
+ *
+ * It also contains a single xdpi/ydpi that is independent of the {@link FolderConfiguration}.
+ *
+ * If the device is meant to represent a true device, then most of the FolderConfigurations' content
+ * should be identical, with only a few qualifiers (orientation, keyboard state) that would differ.
+ * However it is simpler to reuse the FolderConfiguration class (with the non changing qualifiers
+ * duplicated in each configuration) as it's what's being used by the rendering library.
+ *
+ * To create, edit and delete LayoutDevice objects, see {@link LayoutDeviceManager}.
+ * The class is not technically immutable but behaves as such outside of its package.
+ */
+public class LayoutDevice {
+
+    private final String mName;
+
+    /** editable map of the config */
+    private Map<String, FolderConfiguration> mEditMap = new HashMap<String, FolderConfiguration>();
+    /** unmodifiable map returned by {@link #getConfigs()}. */
+    private Map<String, FolderConfiguration> mMap;
+    private float mXDpi = Float.NaN;
+    private float mYDpi = Float.NaN;
+
+    LayoutDevice(String name) {
+        mName = name;
+    }
+
+    /**
+     * Saves the Layout Device into a document under a given node
+     * @param doc the document.
+     * @param parentNode the parent node.
+     */
+    void saveTo(Document doc, Element parentNode) {
+        // create the device node
+        Element deviceNode = createNode(doc, parentNode, LayoutDevicesXsd.NODE_DEVICE);
+
+        // create the name attribute (no namespace on this one).
+        deviceNode.setAttribute(LayoutDevicesXsd.ATTR_NAME, mName);
+
+        // create a default with the x/y dpi
+        Element defaultNode = createNode(doc, deviceNode, LayoutDevicesXsd.NODE_DEFAULT);
+        if (Float.isNaN(mXDpi) == false) {
+            Element xdpiNode = createNode(doc, defaultNode, LayoutDevicesXsd.NODE_XDPI);
+            xdpiNode.setTextContent(Float.toString(mXDpi));
+        }
+        if (Float.isNaN(mYDpi) == false) {
+            Element xdpiNode = createNode(doc, defaultNode, LayoutDevicesXsd.NODE_YDPI);
+            xdpiNode.setTextContent(Float.toString(mYDpi));
+        }
+
+        // then save all the configs.
+        for (Entry<String, FolderConfiguration> entry : mEditMap.entrySet()) {
+            saveConfigTo(doc, deviceNode, entry.getKey(), entry.getValue());
+        }
+    }
+
+    /**
+     * Creates and returns a new NS-enabled node.
+     * @param doc the {@link Document}
+     * @param parentNode the parent node. The new node is appended to this one as a child.
+     * @param name the name of the node.
+     * @return the newly created node.
+     */
+    private Element createNode(Document doc, Element parentNode, String name) {
+        Element newNode = doc.createElementNS(
+                LayoutDevicesXsd.NS_LAYOUT_DEVICE_XSD, name);
+        newNode.setPrefix(doc.lookupPrefix(LayoutDevicesXsd.NS_LAYOUT_DEVICE_XSD));
+        parentNode.appendChild(newNode);
+
+        return newNode;
+    }
+
+    /**
+     * Saves a {@link FolderConfiguration} in a {@link Document}.
+     * @param doc the Document in which to save
+     * @param parent the parent node
+     * @param configName the name of the config
+     * @param config the config to save
+     */
+    private void saveConfigTo(Document doc, Element parent, String configName,
+            FolderConfiguration config) {
+        Element configNode = createNode(doc, parent, LayoutDevicesXsd.NODE_CONFIG);
+
+        // create the name attribute (no namespace on this one).
+        configNode.setAttribute(LayoutDevicesXsd.ATTR_NAME, configName);
+
+        // now do the qualifiers
+        CountryCodeQualifier ccq = config.getCountryCodeQualifier();
+        if (ccq != null) {
+            Element node = createNode(doc, configNode, LayoutDevicesXsd.NODE_COUNTRY_CODE);
+            node.setTextContent(Integer.toString(ccq.getCode()));
+        }
+
+        NetworkCodeQualifier ncq = config.getNetworkCodeQualifier();
+        if (ncq != null) {
+            Element node = createNode(doc, configNode, LayoutDevicesXsd.NODE_NETWORK_CODE);
+            node.setTextContent(Integer.toString(ncq.getCode()));
+        }
+
+        ScreenSizeQualifier ssq = config.getScreenSizeQualifier();
+        if (ssq != null) {
+            Element node = createNode(doc, configNode, LayoutDevicesXsd.NODE_SCREEN_SIZE);
+            node.setTextContent(ssq.getFolderSegment(null));
+        }
+
+        ScreenRatioQualifier srq = config.getScreenRatioQualifier();
+        if (srq != null) {
+            Element node = createNode(doc, configNode, LayoutDevicesXsd.NODE_SCREEN_RATIO);
+            node.setTextContent(srq.getFolderSegment(null));
+        }
+
+        ScreenOrientationQualifier soq = config.getScreenOrientationQualifier();
+        if (soq != null) {
+            Element node = createNode(doc, configNode, LayoutDevicesXsd.NODE_SCREEN_ORIENTATION);
+            node.setTextContent(soq.getFolderSegment(null));
+        }
+
+        PixelDensityQualifier pdq = config.getPixelDensityQualifier();
+        if (pdq != null) {
+            Element node = createNode(doc, configNode, LayoutDevicesXsd.NODE_PIXEL_DENSITY);
+            node.setTextContent(pdq.getFolderSegment(null));
+        }
+
+        TouchScreenQualifier ttq = config.getTouchTypeQualifier();
+        if (ttq != null) {
+            Element node = createNode(doc, configNode, LayoutDevicesXsd.NODE_TOUCH_TYPE);
+            node.setTextContent(ttq.getFolderSegment(null));
+        }
+
+        KeyboardStateQualifier ksq = config.getKeyboardStateQualifier();
+        if (ksq != null) {
+            Element node = createNode(doc, configNode, LayoutDevicesXsd.NODE_KEYBOARD_STATE);
+            node.setTextContent(ksq.getFolderSegment(null));
+        }
+
+        TextInputMethodQualifier timq = config.getTextInputMethodQualifier();
+        if (timq != null) {
+            Element node = createNode(doc, configNode, LayoutDevicesXsd.NODE_TEXT_INPUT_METHOD);
+            node.setTextContent(timq.getFolderSegment(null));
+        }
+
+        NavigationMethodQualifier nmq = config.getNavigationMethodQualifier();
+        if (nmq != null) {
+            Element node = createNode(doc, configNode, LayoutDevicesXsd.NODE_NAV_METHOD);
+            node.setTextContent(nmq.getFolderSegment(null));
+        }
+
+        ScreenDimensionQualifier sdq = config.getScreenDimensionQualifier();
+        if (sdq != null) {
+            Element sizeNode = createNode(doc, configNode, LayoutDevicesXsd.NODE_SCREEN_DIMENSION);
+
+            Element node = createNode(doc, sizeNode, LayoutDevicesXsd.NODE_SIZE);
+            node.setTextContent(Integer.toString(sdq.getValue1()));
+
+            node = createNode(doc, sizeNode, LayoutDevicesXsd.NODE_SIZE);
+            node.setTextContent(Integer.toString(sdq.getValue2()));
+        }
+    }
+
+    void addConfig(String name, FolderConfiguration config) {
+        mEditMap.put(name, config);
+        _seal();
+    }
+
+    void addConfigs(Map<String, FolderConfiguration> configs) {
+        mEditMap.putAll(configs);
+        _seal();
+    }
+
+    void removeConfig(String name) {
+        mEditMap.remove(name);
+        _seal();
+    }
+
+    /**
+     * Adds config to the LayoutDevice. This is to be used to add plenty of configurations.
+     * It must be followed by {@link #_seal()}.
+     * @param name the name of the config
+     * @param config the config.
+     */
+    void _addConfig(String name, FolderConfiguration config) {
+        mEditMap.put(name, config);
+    }
+
+    void _seal() {
+        mMap = Collections.unmodifiableMap(mEditMap);
+    }
+
+    void setXDpi(float xdpi) {
+        mXDpi = xdpi;
+    }
+
+    void setYDpi(float ydpi) {
+        mYDpi = ydpi;
+    }
+
+    public String getName() {
+        return mName;
+    }
+
+    public Map<String, FolderConfiguration> getConfigs() {
+        return mMap;
+    }
+
+    /**
+     * Returns the dpi of the Device screen in X.
+     * @return the dpi of screen or {@link Float#NaN} if it's not set.
+     */
+    public float getXDpi() {
+        return mXDpi;
+    }
+
+    /**
+     * Returns the dpi of the Device screen in Y.
+     * @return the dpi of screen or {@link Float#NaN} if it's not set.
+     */
+    public float getYDpi() {
+        return mYDpi;
+    }
+ }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceHandler.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceHandler.java
new file mode 100644
index 0000000..7ad4e5d
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceHandler.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.sdk;
+
+import com.android.ide.eclipse.adt.internal.resources.configurations.CountryCodeQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
+import com.android.ide.eclipse.adt.internal.resources.configurations.KeyboardStateQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.NavigationMethodQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.NetworkCodeQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenDimensionQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenOrientationQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenRatioQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenSizeQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.TextInputMethodQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.TouchScreenQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.KeyboardStateQualifier.KeyboardState;
+import com.android.ide.eclipse.adt.internal.resources.configurations.NavigationMethodQualifier.NavigationMethod;
+import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier.Density;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenOrientationQualifier.ScreenOrientation;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenRatioQualifier.ScreenRatio;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenSizeQualifier.ScreenSize;
+import com.android.ide.eclipse.adt.internal.resources.configurations.TextInputMethodQualifier.TextInputMethod;
+import com.android.ide.eclipse.adt.internal.resources.configurations.TouchScreenQualifier.TouchScreenType;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * {@link DefaultHandler} implementation to parse Layout Device XML file.
+ * @see LayoutDevicesXsd
+ * @see Layout-configs.xsd
+ */
+class LayoutDeviceHandler extends DefaultHandler {
+    /*
+     * The handler does most of the work in startElement and endElement.
+     * In startElement, it'll create DeviceConfiguration on <device>, as well as
+     * FolderConfiguration instances on <default> and <config>.
+     * Those objects are then filled as new nodes are discovered.
+     *
+     * For the qualifier values, the qualifier is created and added to the current config
+     * on the endElement, by using the content found in characters().
+     */
+
+    private List<LayoutDevice> mDevices = new ArrayList<LayoutDevice>();
+
+    private LayoutDevice mCurrentDevice;
+    private FolderConfiguration mDefaultConfig;
+    private FolderConfiguration mCurrentConfig;
+    private final StringBuilder mStringAccumulator = new StringBuilder();
+
+    private String mSize1, mSize2;
+
+    public List<LayoutDevice> getDevices() {
+        return mDevices;
+    }
+
+    @Override
+    public void startElement(String uri, String localName, String name, Attributes attributes)
+            throws SAXException {
+        if (LayoutDevicesXsd.NODE_DEVICE.equals(localName)) {
+            // get the deviceName, will not be null since we validated the XML.
+            String deviceName = attributes.getValue("", LayoutDevicesXsd.ATTR_NAME);
+
+            // create a device and add it to the list
+            mCurrentDevice = new LayoutDevice(deviceName);
+            mDevices.add(mCurrentDevice);
+        } else if (LayoutDevicesXsd.NODE_DEFAULT.equals(localName)) {
+            // create a new default config
+            mDefaultConfig = mCurrentConfig = new FolderConfiguration();
+        } else if (LayoutDevicesXsd.NODE_CONFIG.equals(localName)) {
+            // create a new config
+            mCurrentConfig = new FolderConfiguration();
+
+            // init with default config if applicable
+            if (mDefaultConfig != null) {
+                mCurrentConfig.set(mDefaultConfig);
+            }
+
+            // get the name of the config
+            String deviceName = attributes.getValue("", LayoutDevicesXsd.ATTR_NAME);
+
+            // give it to the current device.
+            mCurrentDevice.addConfig(deviceName, mCurrentConfig);
+        } else if (LayoutDevicesXsd.NODE_SCREEN_DIMENSION.equals(localName)) {
+            mSize1 = mSize2 = null;
+        }
+
+        mStringAccumulator.setLength(0);
+    }
+
+    @Override
+    public void characters(char[] ch, int start, int length) throws SAXException {
+        mStringAccumulator.append(ch, start, length);
+    }
+
+    @Override
+    public void endElement(String uri, String localName, String name) throws SAXException {
+        if (LayoutDevicesXsd.NODE_DEVICE.equals(localName)) {
+            mCurrentDevice = null;
+            mDefaultConfig = null;
+        } else if (LayoutDevicesXsd.NODE_CONFIG.equals(localName)) {
+            mCurrentConfig = null;
+        } else if (LayoutDevicesXsd.NODE_COUNTRY_CODE.equals(localName)) {
+            CountryCodeQualifier ccq = new CountryCodeQualifier(
+                    Integer.parseInt(mStringAccumulator.toString()));
+            mCurrentConfig.setCountryCodeQualifier(ccq);
+        } else if (LayoutDevicesXsd.NODE_NETWORK_CODE.equals(localName)) {
+            NetworkCodeQualifier ncq = new NetworkCodeQualifier(
+                    Integer.parseInt(mStringAccumulator.toString()));
+            mCurrentConfig.setNetworkCodeQualifier(ncq);
+        } else if (LayoutDevicesXsd.NODE_SCREEN_SIZE.equals(localName)) {
+            ScreenSizeQualifier ssq = new ScreenSizeQualifier(
+                    ScreenSize.getEnum(mStringAccumulator.toString()));
+            mCurrentConfig.setScreenSizeQualifier(ssq);
+        } else if (LayoutDevicesXsd.NODE_SCREEN_RATIO.equals(localName)) {
+            ScreenRatioQualifier srq = new ScreenRatioQualifier(
+                    ScreenRatio.getEnum(mStringAccumulator.toString()));
+            mCurrentConfig.setScreenRatioQualifier(srq);
+        } else if (LayoutDevicesXsd.NODE_SCREEN_ORIENTATION.equals(localName)) {
+            ScreenOrientationQualifier soq = new ScreenOrientationQualifier(
+                    ScreenOrientation.getEnum(mStringAccumulator.toString()));
+            mCurrentConfig.setScreenOrientationQualifier(soq);
+        } else if (LayoutDevicesXsd.NODE_PIXEL_DENSITY.equals(localName)) {
+            PixelDensityQualifier pdq = new PixelDensityQualifier(
+                    Density.getEnum(mStringAccumulator.toString()));
+            mCurrentConfig.setPixelDensityQualifier(pdq);
+        } else if (LayoutDevicesXsd.NODE_TOUCH_TYPE.equals(localName)) {
+            TouchScreenQualifier tsq = new TouchScreenQualifier(
+                    TouchScreenType.getEnum(mStringAccumulator.toString()));
+            mCurrentConfig.setTouchTypeQualifier(tsq);
+        } else if (LayoutDevicesXsd.NODE_KEYBOARD_STATE.equals(localName)) {
+            KeyboardStateQualifier ksq = new KeyboardStateQualifier(
+                    KeyboardState.getEnum(mStringAccumulator.toString()));
+            mCurrentConfig.setKeyboardStateQualifier(ksq);
+        } else if (LayoutDevicesXsd.NODE_TEXT_INPUT_METHOD.equals(localName)) {
+            TextInputMethodQualifier timq = new TextInputMethodQualifier(
+                    TextInputMethod.getEnum(mStringAccumulator.toString()));
+            mCurrentConfig.setTextInputMethodQualifier(timq);
+        } else if (LayoutDevicesXsd.NODE_NAV_METHOD.equals(localName)) {
+            NavigationMethodQualifier nmq = new NavigationMethodQualifier(
+                    NavigationMethod.getEnum(mStringAccumulator.toString()));
+            mCurrentConfig.setNavigationMethodQualifier(nmq);
+        } else if (LayoutDevicesXsd.NODE_SCREEN_DIMENSION.equals(localName)) {
+            ScreenDimensionQualifier qual = ScreenDimensionQualifier.getQualifier(mSize1, mSize2);
+            if (qual != null) {
+                mCurrentConfig.setScreenDimensionQualifier(qual);
+            }
+        } else if (LayoutDevicesXsd.NODE_XDPI.equals(localName)) {
+            mCurrentDevice.setXDpi(Float.parseFloat(mStringAccumulator.toString()));
+        } else if (LayoutDevicesXsd.NODE_YDPI.equals(localName)) {
+            mCurrentDevice.setYDpi(Float.parseFloat(mStringAccumulator.toString()));
+        } else if (LayoutDevicesXsd.NODE_SIZE.equals(localName)) {
+            if (mSize1 == null) {
+                mSize1 = mStringAccumulator.toString();
+            } else if (mSize2 == null) {
+                mSize2 = mStringAccumulator.toString();
+            }
+        }
+    }
+}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceManager.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceManager.java
new file mode 100644
index 0000000..3b19f17
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceManager.java
@@ -0,0 +1,396 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.sdk;
+
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
+import com.android.prefs.AndroidLocation;
+import com.android.prefs.AndroidLocation.AndroidLocationException;
+import com.android.sdklib.SdkConstants;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Validator;
+
+/**
+ * Manages the layout devices.
+ * They can come from 3 sources: built-in, add-ons, user.
+ */
+public class LayoutDeviceManager {
+
+    /**
+     * A SAX error handler that captures the errors and warnings.
+     * This allows us to capture *all* errors and just not get an exception on the first one.
+     */
+    private static class CaptureErrorHandler implements ErrorHandler {
+
+        private final String mSourceLocation;
+
+        private boolean mFoundError = false;
+
+        CaptureErrorHandler(String sourceLocation) {
+            mSourceLocation = sourceLocation;
+        }
+
+        public boolean foundError() {
+            return mFoundError;
+        }
+
+        /**
+         * @throws SAXException
+         */
+        public void error(SAXParseException ex) throws SAXException {
+            mFoundError = true;
+            AdtPlugin.log(ex, "Error validating %1$s", mSourceLocation);
+        }
+
+        /**
+         * @throws SAXException
+         */
+        public void fatalError(SAXParseException ex) throws SAXException {
+            mFoundError = true;
+            AdtPlugin.log(ex, "Error validating %1$s", mSourceLocation);
+        }
+
+        /**
+         * @throws SAXException
+         */
+        public void warning(SAXParseException ex) throws SAXException {
+            // ignore those for now.
+        }
+    }
+
+    private final SAXParserFactory mParserFactory;
+
+    private List<LayoutDevice> mDefaultLayoutDevices =
+        new ArrayList<LayoutDevice>();
+    private List<LayoutDevice> mAddOnLayoutDevices =
+        new ArrayList<LayoutDevice>();
+    private final List<LayoutDevice> mUserLayoutDevices =
+        new ArrayList<LayoutDevice>();
+    private List<LayoutDevice> mLayoutDevices;
+
+    LayoutDeviceManager() {
+        mParserFactory = SAXParserFactory.newInstance();
+        mParserFactory.setNamespaceAware(true);
+    }
+
+    public List<LayoutDevice> getCombinedList() {
+        return mLayoutDevices;
+    }
+
+    public List<LayoutDevice> getDefaultLayoutDevices() {
+        return mDefaultLayoutDevices;
+    }
+
+    public List<LayoutDevice> getAddOnLayoutDevice() {
+        return mAddOnLayoutDevices;
+    }
+
+    public List<LayoutDevice> getUserLayoutDevices() {
+        return mUserLayoutDevices;
+    }
+
+    public LayoutDevice getUserLayoutDevice(String name) {
+        for (LayoutDevice d : mUserLayoutDevices) {
+            if (d.getName().equals(name)) {
+                return d;
+            }
+        }
+
+        return null;
+    }
+
+    public LayoutDevice addUserDevice(String name, float xdpi, float ydpi) {
+        LayoutDevice d = new LayoutDevice(name);
+        d.setXDpi(xdpi);
+        d.setYDpi(ydpi);
+        mUserLayoutDevices.add(d);
+        combineLayoutDevices();
+
+        return d;
+    }
+
+    public void removeUserDevice(LayoutDevice device) {
+        if (mUserLayoutDevices.remove(device)) {
+            combineLayoutDevices();
+        }
+    }
+
+    /**
+     * Replaces a device with a new one with new name and/or x/y dpi, and return the new device.
+     * If the name and dpi values are identical the given device is returned an nothing is done
+     * @param device the {@link LayoutDevice} to replace
+     * @param newName the new name.
+     * @param newXDpi the new X dpi value
+     * @param newYDpi the new Y dpi value.
+     * @return the new LayoutDevice
+     */
+    public LayoutDevice replaceUserDevice(LayoutDevice device, String newName,
+            float newXDpi, float newYDpi) {
+        if (device.getName().equals(newName) && device.getXDpi() == newXDpi &&
+                device.getYDpi() == newYDpi) {
+            return device;
+        }
+
+        // else create a new device
+        LayoutDevice newDevice = new LayoutDevice(newName);
+        newDevice.setXDpi(newXDpi);
+        newDevice.setYDpi(newYDpi);
+
+        // and get the Folderconfiguration
+        Map<String, FolderConfiguration> configs = device.getConfigs();
+        newDevice.addConfigs(configs);
+
+        // replace the old device with the new
+        mUserLayoutDevices.remove(device);
+        mUserLayoutDevices.add(newDevice);
+        combineLayoutDevices();
+
+        return newDevice;
+    }
+
+
+    /**
+     * Adds or replaces a configuration in a given {@link LayoutDevice}.
+     * @param device the device to modify
+     * @param configName the configuration name to add or replace
+     * @param config the configuration to set
+     */
+    public void addUserConfiguration(LayoutDevice device, String configName,
+            FolderConfiguration config) {
+        // check that the device does belong to the user list.
+        // the main goal is to make sure that this does not belong to the default/addon list.
+        if (mUserLayoutDevices.contains(device)) {
+            device.addConfig(configName, config);
+        }
+    }
+
+    /**
+     * Replaces a configuration in a given {@link LayoutDevice}.
+     * @param device the device to modify
+     * @param oldConfigName the name of the config to replace. If null, the new config is simply
+     * added.
+     * @param newConfigName the configuration name to add or replace
+     * @param config the configuration to set
+     */
+    public void replaceUserConfiguration(LayoutDevice device, String oldConfigName,
+            String newConfigName, FolderConfiguration config) {
+        // check that the device does belong to the user list.
+        // the main goal is to make sure that this does not belong to the default/addon list.
+        if (mUserLayoutDevices.contains(device)) {
+            // if the old and new config name are different, remove the old one
+            if (oldConfigName != null && oldConfigName.equals(newConfigName) == false) {
+                device.removeConfig(oldConfigName);
+            }
+
+            // and then add the new one
+            device.addConfig(newConfigName, config);
+        }
+    }
+
+    /**
+     * Removes a configuration from a given user {@link LayoutDevice}
+     * @param device the device to modify
+     * @param configName the name of the config to remove
+     */
+    public void removeUserConfiguration(LayoutDevice device, String configName) {
+        // check that the device does belong to the user list.
+        // the main goal is to make sure that this does not belong to the default/addon list.
+        if (mUserLayoutDevices.contains(device)) {
+            device.removeConfig(configName);
+        }
+    }
+
+    /**
+     * Saves the user-made {@link LayoutDevice}s to disk.
+     */
+    public void save() {
+        try {
+            String userFolder = AndroidLocation.getFolder();
+            File deviceXml = new File(userFolder, SdkConstants.FN_DEVICES_XML);
+            if (deviceXml.isDirectory() == false) {
+                write(deviceXml, mUserLayoutDevices);
+            }
+        } catch (AndroidLocationException e) {
+            // no user folder? simply don't save the user layout device.
+            // we could display the error, but it's likely something else did before, as
+            // nothing will work w/o it.
+            AdtPlugin.log(e, "Unable to find user directory");
+        }
+    }
+
+    /**
+     * Loads the default built-in and user created Layout Devices.
+     * @param sdkOsLocation location of the SDK.
+     */
+    void loadDefaultAndUserDevices(String sdkOsLocation) {
+        // load the default devices
+        loadDefaultLayoutDevices(sdkOsLocation);
+
+        // load the user devices;
+        try {
+            String userFolder = AndroidLocation.getFolder();
+            File deviceXml = new File(userFolder, SdkConstants.FN_DEVICES_XML);
+            if (deviceXml.isFile()) {
+                parseLayoutDevices(deviceXml, mUserLayoutDevices);
+            }
+        } catch (AndroidLocationException e) {
+            // no user folder? simply don't load the user layout device
+            AdtPlugin.log(e, "Unable to find user directory");
+        }
+    }
+
+    void parseAddOnLayoutDevice(File deviceXml) {
+        parseLayoutDevices(deviceXml, mAddOnLayoutDevices);
+    }
+
+    void sealAddonLayoutDevices() {
+        mAddOnLayoutDevices = Collections.unmodifiableList(mAddOnLayoutDevices);
+
+        combineLayoutDevices();
+    }
+
+    /**
+     * Does the actual parsing of a devices.xml file.
+     * @param deviceXml the {@link File} to load/parse. This must be an existing file.
+     * @param list the list in which to write the parsed {@link LayoutDevice}.
+     */
+    private void parseLayoutDevices(File deviceXml, List<LayoutDevice> list) {
+        // first we validate the XML
+        try {
+            Source source = new StreamSource(new FileReader(deviceXml));
+
+            CaptureErrorHandler errorHandler = new CaptureErrorHandler(deviceXml.getAbsolutePath());
+
+            Validator validator = LayoutDevicesXsd.getValidator(errorHandler);
+            validator.validate(source);
+
+            if (errorHandler.foundError() == false) {
+                // do the actual parsing
+                LayoutDeviceHandler handler = new LayoutDeviceHandler();
+
+                SAXParser parser = mParserFactory.newSAXParser();
+                parser.parse(new InputSource(new FileInputStream(deviceXml)), handler);
+
+                // get the parsed devices
+                list.addAll(handler.getDevices());
+            }
+        } catch (SAXException e) {
+            AdtPlugin.log(e, "Error parsing %1$s", deviceXml.getAbsoluteFile());
+        } catch (FileNotFoundException e) {
+            // this shouldn't happen as we check above.
+        } catch (IOException e) {
+            AdtPlugin.log(e, "Error reading %1$s", deviceXml.getAbsoluteFile());
+        } catch (ParserConfigurationException e) {
+            AdtPlugin.log(e, "Error parsing %1$s", deviceXml.getAbsoluteFile());
+        }
+    }
+
+    /**
+     * Creates some built-it layout devices.
+     */
+    private void loadDefaultLayoutDevices(String sdkOsLocation) {
+        ArrayList<LayoutDevice> list = new ArrayList<LayoutDevice>();
+        File toolsFolder = new File(sdkOsLocation, SdkConstants.OS_SDK_TOOLS_LIB_FOLDER);
+        if (toolsFolder.isDirectory()) {
+            File deviceXml = new File(toolsFolder, SdkConstants.FN_DEVICES_XML);
+            if (deviceXml.isFile()) {
+                parseLayoutDevices(deviceXml, list);
+            }
+        }
+        mDefaultLayoutDevices = Collections.unmodifiableList(list);
+    }
+
+    private void combineLayoutDevices() {
+        ArrayList<LayoutDevice> list = new ArrayList<LayoutDevice>();
+        list.addAll(mDefaultLayoutDevices);
+        list.addAll(mAddOnLayoutDevices);
+        list.addAll(mUserLayoutDevices);
+
+        mLayoutDevices = Collections.unmodifiableList(list);
+    }
+
+    /**
+     * Writes the given {@link LayoutDevice}s into the given file.
+     * @param deviceXml the file to write.
+     * @param deviceList the LayoutDevice to write into the file.
+     */
+    private void write(File deviceXml, List<LayoutDevice> deviceList) {
+        try {
+            // create a new document
+            DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+            docFactory.setNamespaceAware(true);
+            DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
+            Document doc = docBuilder.newDocument();
+
+            // create a base node
+            Element baseNode = doc.createElementNS(
+                    LayoutDevicesXsd.NS_LAYOUT_DEVICE_XSD,
+                    LayoutDevicesXsd.NODE_LAYOUT_DEVICES);
+            // create the prefix for the namespace
+            baseNode.setPrefix("d");
+            doc.appendChild(baseNode);
+
+            // fill it with the layout devices.
+            for (LayoutDevice device : deviceList) {
+                device.saveTo(doc, baseNode);
+            }
+
+            // save the document to disk
+            // Prepare the DOM document for writing
+            Source source = new DOMSource(doc);
+
+            // Prepare the output file
+            File file = new File(deviceXml.getAbsolutePath());
+            Result result = new StreamResult(file);
+
+            // Write the DOM document to the file
+            Transformer xformer = TransformerFactory.newInstance().newTransformer();
+            xformer.transform(source, result);
+        } catch (Exception e) {
+            AdtPlugin.log(e, "Failed to write %s", deviceXml.getAbsolutePath());
+        }
+    }
+}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevicesXsd.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevicesXsd.java
new file mode 100755
index 0000000..67e9718
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevicesXsd.java
@@ -0,0 +1,134 @@
+/*

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.eclipse.org/org/documents/epl-v10.php

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package com.android.ide.eclipse.adt.internal.sdk;

+

+

+import org.xml.sax.ErrorHandler;

+import org.xml.sax.SAXException;

+

+import java.io.InputStream;

+

+import javax.xml.XMLConstants;

+import javax.xml.transform.stream.StreamSource;

+import javax.xml.validation.Schema;

+import javax.xml.validation.SchemaFactory;

+import javax.xml.validation.Validator;

+

+/**

+ * Public constants for the layout device description XML Schema.

+ */

+public class LayoutDevicesXsd {

+

+    /** The XML namespace of the layout-configs XML. */

+    public static final String NS_LAYOUT_DEVICE_XSD =

+        "http://schemas.android.com/sdk/android/layout-devices/1";                  //$NON-NLS-1$

+

+    /**

+     * The "layout-devices" element is the root element of this schema.

+     *

+     * It must contain one or more "device" elements that each define the configurations

+     * available for a given device.

+     *

+     * These definitions are used in the Graphical Layout Editor in the

+     * Android Development Tools (ADT) plugin for Eclipse.

+     */

+    public static final String NODE_LAYOUT_DEVICES = "layout-devices";              //$NON-NLS-1$

+

+    /**

+     * A device element must contain at most one "default" element followed

+     * by one or more ""config" elements.

+     *

+     * The "default" element defines all the default parameters inherited

+     * by the following "config" elements. Each "config" element can override

+     * the default values, if any.

+     *

+     * A "device" element also has a required "name" attribute that represents

+     * the user-interface name of this device.

+     */

+    public static final String NODE_DEVICE = "device";                              //$NON-NLS-1$

+

+    /**

+     * The "default" element contains zero or more of all the parameter elements

+     * listed below. It defines all the parameters that are common to all

+     * declared "config" elements.

+     */

+    public static final String NODE_DEFAULT = "default";                            //$NON-NLS-1$

+

+    /**

+     * The "config" element contains zero or more of all the parameter elements

+     * listed below. The parameters from the "default" element (if present) are

+     * automatically inherited and can be overridden.

+     */

+    public static final String NODE_CONFIG = "config";                              //$NON-NLS-1$

+

+

+    public static final String NODE_COUNTRY_CODE = "country-code";                  //$NON-NLS-1$

+

+    public static final String NODE_NETWORK_CODE = "network-code";                  //$NON-NLS-1$

+

+    public static final String NODE_SCREEN_SIZE = "screen-size";                    //$NON-NLS-1$

+

+    public static final String NODE_SCREEN_RATIO = "screen-ratio";                  //$NON-NLS-1$

+

+    public static final String NODE_SCREEN_ORIENTATION = "screen-orientation";      //$NON-NLS-1$

+

+    public static final String NODE_PIXEL_DENSITY = "pixel-density";                //$NON-NLS-1$

+

+    public static final String NODE_TOUCH_TYPE = "touch-type";                      //$NON-NLS-1$

+

+    public static final String NODE_KEYBOARD_STATE = "keyboard-state";              //$NON-NLS-1$

+

+    public static final String NODE_TEXT_INPUT_METHOD = "text-input-method";        //$NON-NLS-1$

+

+    public static final String NODE_NAV_METHOD = "nav-method";                      //$NON-NLS-1$

+

+    public static final String NODE_SCREEN_DIMENSION = "screen-dimension";          //$NON-NLS-1$

+

+    /** The screen-dimension element has 2 size element children. */

+    public static final String NODE_SIZE = "size";                                  //$NON-NLS-1$

+

+    public static final String NODE_XDPI = "xdpi";                                  //$NON-NLS-1$

+

+    public static final String NODE_YDPI = "ydpi";                                  //$NON-NLS-1$

+

+    /**

+     * The "name" attribute, used by both the "device" and the "config"

+     * elements. It represents the user-interface name of these objects.

+     */

+    public static final String ATTR_NAME = "name";                                  //$NON-NLS-1$

+

+    /**

+     * Helper to get an input stream of the layout config XML schema.

+     */

+    public static InputStream getXsdStream() {

+        return LayoutDevicesXsd.class.getResourceAsStream("layout-devices.xsd");    //$NON-NLS-1$

+    }

+

+    /** Helper method that returns a {@link Validator} for our XSD */

+    public static Validator getValidator(ErrorHandler handler) throws SAXException {

+        InputStream xsdStream = getXsdStream();

+        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);

+        Schema schema = factory.newSchema(new StreamSource(xsdStream));

+        Validator validator = schema.newValidator();

+        if (handler != null) {

+            validator.setErrorHandler(handler);

+        }

+

+        return validator;

+    }

+

+}

diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java
index f2e883d..45ff31f 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java
@@ -30,6 +30,7 @@
 import com.android.sdklib.SdkManager;
 import com.android.sdklib.internal.avd.AvdManager;
 import com.android.sdklib.internal.project.ApkConfigurationHelper;
+import com.android.sdklib.internal.project.ApkSettings;
 import com.android.sdklib.internal.project.ProjectProperties;
 import com.android.sdklib.internal.project.ProjectProperties.PropertyType;
 
@@ -68,10 +69,12 @@
             new HashMap<IProject, IAndroidTarget>();
     private final HashMap<IAndroidTarget, AndroidTargetData> mTargetDataMap =
             new HashMap<IAndroidTarget, AndroidTargetData>();
-    private final HashMap<IProject, Map<String, String>> mProjectApkConfigMap =
-            new HashMap<IProject, Map<String, String>>();
+    private final HashMap<IProject, ApkSettings> mApkSettingsMap =
+            new HashMap<IProject, ApkSettings>();
     private final String mDocBaseUrl;
 
+    private final LayoutDeviceManager mLayoutDeviceManager = new LayoutDeviceManager();
+
     /**
      * Classes implementing this interface will receive notification when targets are changed.
      */
@@ -193,11 +196,9 @@
      * apk configurations should not be updated.
      */
     public void setProject(IProject project, IAndroidTarget target,
-            Map<String, String> apkConfigMap) {
+            ApkSettings settings) {
         synchronized (AdtPlugin.getDefault().getSdkLockObject()) {
             boolean resolveProject = false;
-            boolean compileProject = false;
-            boolean cleanProject = false;
 
             ProjectProperties properties = ProjectProperties.load(
                     project.getLocation().toOSString(), PropertyType.DEFAULT);
@@ -222,16 +223,18 @@
                 }
             }
 
-            if (apkConfigMap != null) {
-                // save the apk configs in the project persistent property
-                cleanProject = ApkConfigurationHelper.setConfigs(properties, apkConfigMap);
-
-                // put it in a local map for easy access.
-                mProjectApkConfigMap.put(project, apkConfigMap);
-
-                compileProject = true;
+            // if there's no settings, force default values (to reset possibly changed
+            // values in a previous call.
+            if (settings == null) {
+                settings = new ApkSettings();
             }
 
+            // save the project settings into the project persistent property
+            ApkConfigurationHelper.setProperties(properties, settings);
+
+            // put it in a local map for easy access.
+            mApkSettingsMap.put(project, settings);
+
             // we are done with the modification. Save the property file.
             try {
                 properties.save();
@@ -242,17 +245,14 @@
 
             if (resolveProject) {
                 // force a resolve of the project by updating the classpath container.
+                // This will also force a recompile.
                 IJavaProject javaProject = JavaCore.create(project);
                 AndroidClasspathContainerInitializer.updateProjects(
                         new IJavaProject[] { javaProject });
-            } else if (compileProject) {
-                // If there was removed configs, we clean instead of build
-                // (to remove the obsolete ap_ and apk file from removed configs).
+            } else {
+                // always do a full clean/build.
                 try {
-                    project.build(cleanProject ?
-                                IncrementalProjectBuilder.CLEAN_BUILD :
-                                IncrementalProjectBuilder.FULL_BUILD,
-                            null);
+                    project.build(IncrementalProjectBuilder.CLEAN_BUILD, null);
                 } catch (CoreException e) {
                     // failed to build? force resolve instead.
                     IJavaProject javaProject = JavaCore.create(project);
@@ -316,10 +316,10 @@
 
         if (sdkStorage != null) {
             synchronized (AdtPlugin.getDefault().getSdkLockObject()) {
-                Map<String, String> configMap = ApkConfigurationHelper.getConfigs(properties);
+                ApkSettings settings = ApkConfigurationHelper.getSettings(properties);
 
-                if (configMap != null) {
-                    sdkStorage.mProjectApkConfigMap.put(project, configMap);
+                if (settings != null) {
+                    sdkStorage.mApkSettingsMap.put(project, settings);
                 }
             }
         }
@@ -392,13 +392,11 @@
     }
 
     /**
-     * Returns the configuration map for a given project.
-     * <p/>The Map key are name to be used in the apk filename, while the values are comma separated
-     * config values. The config value can be passed directly to aapt through the -c option.
+     * Returns the APK settings for a given project.
      */
-    public Map<String, String> getProjectApkConfigs(IProject project) {
+    public ApkSettings getApkSettings(IProject project) {
         synchronized (AdtPlugin.getDefault().getSdkLockObject()) {
-            return mProjectApkConfigMap.get(project);
+            return mApkSettingsMap.get(project);
         }
     }
 
@@ -425,6 +423,10 @@
         }
     }
 
+    public LayoutDeviceManager getLayoutDeviceManager() {
+        return mLayoutDeviceManager;
+    }
+
     private Sdk(SdkManager manager, AvdManager avdManager) {
         mManager = manager;
         mAvdManager = avdManager;
@@ -436,6 +438,11 @@
         // pre-compute some paths
         mDocBaseUrl = getDocumentationBaseUrl(mManager.getLocation() +
                 SdkConstants.OS_SDK_DOCS_FOLDER);
+
+        // load the built-in and user layout devices
+        mLayoutDeviceManager.loadDefaultAndUserDevices(mManager.getLocation());
+        // and the ones from the add-on
+        loadLayoutDevices();
     }
 
     /**
@@ -488,6 +495,24 @@
         return null;
     }
 
+    /**
+     * Parses the SDK add-ons to look for files called {@link SdkConstants#FN_DEVICES_XML} to
+     * load {@link LayoutDevice} from them.
+     */
+    private void loadLayoutDevices() {
+        IAndroidTarget[] targets = mManager.getTargets();
+        for (IAndroidTarget target : targets) {
+            if (target.isPlatform() == false) {
+                File deviceXml = new File(target.getLocation(), SdkConstants.FN_DEVICES_XML);
+                if (deviceXml.isFile()) {
+                    mLayoutDeviceManager.parseAddOnLayoutDevice(deviceXml);
+                }
+            }
+        }
+
+        mLayoutDeviceManager.sealAddonLayoutDevices();
+    }
+
     public void projectClosed(IProject project) {
         // get the target project
         synchronized (AdtPlugin.getDefault().getSdkLockObject()) {
@@ -505,7 +530,7 @@
 
             // now remove the project for the maps.
             mProjectTargetMap.remove(project);
-            mProjectApkConfigMap.remove(project);
+            mApkSettingsMap.remove(project);
         }
     }
 
@@ -524,4 +549,3 @@
     }
 }
 
-
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/layout-devices.xsd b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/layout-devices.xsd
new file mode 100755
index 0000000..8a58560
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/layout-devices.xsd
@@ -0,0 +1,325 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<xsd:schema
+    targetNamespace="http://schemas.android.com/sdk/android/layout-devices/1"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:c="http://schemas.android.com/sdk/android/layout-devices/1"
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified"
+    version="1">
+
+    <xsd:element name="layout-devices">
+        <xsd:annotation>
+            <xsd:documentation xml:lang="en">
+                The "layout-devices" element is the root element of this schema.
+
+                It must contain one or more "device" elements that each define the configurations
+                available for a given device.
+
+                These definitions are used in the Graphical Layout Editor in the
+                Android Development Tools (ADT) plugin for Eclipse.
+            </xsd:documentation>
+        </xsd:annotation>
+
+        <xsd:complexType>
+            <xsd:sequence>
+                <!-- layout-devices defines a sequence of 1..n device elements. -->
+                <xsd:element name="device" minOccurs="1" maxOccurs="unbounded">
+
+                    <xsd:annotation>
+                        <xsd:documentation xml:lang="en">
+                            A device element must contain at most one "default" element
+                            followed by one or more "config" elements.
+
+                            The "default" element defines all the default parameters
+                            inherited by the following "config" elements.
+                            Each "config" element can override the default values, if any.
+
+                            A "device" element also has a required "name" attribute that
+                            represents the user-interface name of this device.
+                        </xsd:documentation>
+                    </xsd:annotation>
+
+                    <xsd:complexType>
+                        <!-- device defines a choice of 0..1 default element
+                        and 1..n config elements. -->
+
+                        <xsd:sequence>
+                            <xsd:element name="default" type="c:parametersType"
+                                         minOccurs="0"  maxOccurs="1" />
+                            <xsd:element name="config"  type="c:configType"
+                                         minOccurs="1"  maxOccurs="unbounded" />
+                        </xsd:sequence>
+
+                        <xsd:attribute name="name" type="xsd:normalizedString" use="required" />
+                    </xsd:complexType>
+
+                </xsd:element>
+            </xsd:sequence>
+        </xsd:complexType>
+    </xsd:element>
+
+    <!-- The type of a device>default element.
+         This is overridden by configType below for the device>config element.
+    -->
+    <xsd:complexType name="parametersType">
+        <xsd:annotation>
+            <xsd:documentation xml:lang="en">
+                The parametersType define all the parameters that can happen either in a
+                "default" element or in a named "config" element.
+                Each parameter element can appear once at most.
+
+                Parameters here are the same as those used to specify alternate Android
+                resources, as documented by
+                http://d.android.com/guide/topics/resources/resources-i18n.html#AlternateResources
+            </xsd:documentation>
+        </xsd:annotation>
+
+        <xsd:all>
+            <!-- parametersType says that 0..1 of each of these elements must be declared. -->
+
+            <xsd:element name="country-code" minOccurs="0">
+                <xsd:annotation>
+                    <xsd:documentation xml:lang="en">
+                        Specifies the configuration is for a particular Mobile Country Code.
+                    </xsd:documentation>
+                </xsd:annotation>
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:float">
+                        <xsd:minInclusive value="100" />
+                        <xsd:maxInclusive value="999" />
+                    </xsd:restriction>
+                </xsd:simpleType>
+            </xsd:element>
+
+            <xsd:element name="network-code" minOccurs="0">
+                <xsd:annotation>
+                    <xsd:documentation xml:lang="en">
+                        Specifies the configuration is for a particular Mobile Network Code.
+                    </xsd:documentation>
+                </xsd:annotation>
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:float">
+                        <xsd:minExclusive value="0" />
+                        <xsd:maxExclusive value="1000" />
+                    </xsd:restriction>
+                </xsd:simpleType>
+            </xsd:element>
+
+            <xsd:element name="screen-size" minOccurs="0">
+                <xsd:annotation>
+                    <xsd:documentation xml:lang="en">
+                        Specifies that the configuration is for a particular class of screen.
+                    </xsd:documentation>
+                </xsd:annotation>
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:token">
+                        <xsd:enumeration value="small" />
+                        <xsd:enumeration value="normal" />
+                        <xsd:enumeration value="large" />
+                    </xsd:restriction>
+                </xsd:simpleType>
+            </xsd:element>
+
+            <xsd:element name="screen-ratio" minOccurs="0">
+                <xsd:annotation>
+                    <xsd:documentation xml:lang="en">
+                        Specifies that the configuration is for a taller/wider than traditional
+                        screen. This is based purely on the aspect ration of the screen: QVGA,
+                        HVGA, and VGA are notlong; WQVGA, WVGA, FWVGA are long. Note that long
+                        may mean either wide or tall, depending on the current orientation.
+                    </xsd:documentation>
+                </xsd:annotation>
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:token">
+                        <xsd:enumeration value="long" />
+                        <xsd:enumeration value="notlong" />
+                    </xsd:restriction>
+                </xsd:simpleType>
+            </xsd:element>
+
+            <xsd:element name="screen-orientation" minOccurs="0">
+                <xsd:annotation>
+                    <xsd:documentation xml:lang="en">
+                        Specifies that the configuration is for a screen that is tall (port) or
+                        wide (land).
+                    </xsd:documentation>
+                </xsd:annotation>
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:token">
+                        <xsd:enumeration value="port" />
+                        <xsd:enumeration value="land" />
+                        <xsd:enumeration value="square" />
+                    </xsd:restriction>
+                </xsd:simpleType>
+            </xsd:element>
+
+            <xsd:element name="pixel-density" minOccurs="0">
+                <xsd:annotation>
+                    <xsd:documentation xml:lang="en">
+                        Specifies the screen density the configuration is defined for. The medium
+                        density of traditional HVGA screens (mdpi) is defined to be approximately
+                        160dpi; low density (ldpi) is 120, and high density (hdpi) is 240. There
+                        is thus a 4:3 scaling factor between each density, so a 9x9 bitmap in ldpi
+                        would be 12x12 is mdpi and 16x16 in hdpi.
+                        The special nodpi density that can be used in resource qualifiers is not
+                        a valid keyword here.
+                    </xsd:documentation>
+                </xsd:annotation>
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:token">
+                        <xsd:enumeration value="ldpi" />
+                        <xsd:enumeration value="mdpi" />
+                        <xsd:enumeration value="hdpi" />
+                    </xsd:restriction>
+                </xsd:simpleType>
+            </xsd:element>
+
+            <xsd:element name="touch-type" minOccurs="0">
+                <xsd:annotation>
+                    <xsd:documentation xml:lang="en">
+                        Specifies the touch type the configuration is defined for.
+                    </xsd:documentation>
+                </xsd:annotation>
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:token">
+                        <xsd:enumeration value="notouch" />
+                        <xsd:enumeration value="stylus" />
+                        <xsd:enumeration value="finger" />
+                    </xsd:restriction>
+                </xsd:simpleType>
+            </xsd:element>
+
+            <xsd:element name="keyboard-state" minOccurs="0">
+                <xsd:annotation>
+                    <xsd:documentation xml:lang="en">
+                        If your configuration uses a soft keyboard, use the keyssoft value.
+                        If it doesn't and has a real keyboard, use keysexposed or keyshidden.
+                    </xsd:documentation>
+                </xsd:annotation>
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:token">
+                        <xsd:enumeration value="keysexposed" />
+                        <xsd:enumeration value="keyshidden" />
+                        <xsd:enumeration value="keyssoft" />
+                    </xsd:restriction>
+                </xsd:simpleType>
+            </xsd:element>
+
+            <xsd:element name="text-input-method" minOccurs="0">
+                <xsd:annotation>
+                    <xsd:documentation xml:lang="en">
+                        Specifies the primary text input method the configuration is designed for.
+                    </xsd:documentation>
+                </xsd:annotation>
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:token">
+                        <xsd:enumeration value="nokeys" />
+                        <xsd:enumeration value="qwerty" />
+                        <xsd:enumeration value="12key" />
+                    </xsd:restriction>
+                </xsd:simpleType>
+            </xsd:element>
+
+            <xsd:element name="nav-method" minOccurs="0">
+                <xsd:annotation>
+                    <xsd:documentation xml:lang="en">
+                        Specifies the primary non-touchscreen navigation method the configuration
+                        is designed for.
+                    </xsd:documentation>
+                </xsd:annotation>
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:token">
+                        <xsd:enumeration value="dpad" />
+                        <xsd:enumeration value="trackball" />
+                        <xsd:enumeration value="wheel" />
+                        <xsd:enumeration value="nonav" />
+                    </xsd:restriction>
+                </xsd:simpleType>
+            </xsd:element>
+
+            <xsd:element name="screen-dimension" minOccurs="0">
+                <xsd:annotation>
+                    <xsd:documentation xml:lang="en">
+                        Specifies the device screen resolution, in pixels.
+                    </xsd:documentation>
+                </xsd:annotation>
+                <xsd:complexType>
+                    <xsd:sequence minOccurs="2" maxOccurs="2">
+
+                        <xsd:element name="size">
+                            <xsd:simpleType>
+                                <xsd:restriction base="xsd:positiveInteger" />
+                            </xsd:simpleType>
+                        </xsd:element>
+
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+
+            <xsd:element name="xdpi" minOccurs="0">
+                <xsd:annotation>
+                    <xsd:documentation xml:lang="en">
+                        Specifies the actual density in X of the device screen.
+                    </xsd:documentation>
+                </xsd:annotation>
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:float">
+                        <xsd:minExclusive value="0" />
+                    </xsd:restriction>
+                </xsd:simpleType>
+            </xsd:element>
+
+            <xsd:element name="ydpi" minOccurs="0">
+                <xsd:annotation>
+                    <xsd:documentation xml:lang="en">
+                        Specifies the actual density in Y of the device screen.
+                    </xsd:documentation>
+                </xsd:annotation>
+                <xsd:simpleType>
+                    <xsd:restriction base="xsd:float">
+                        <xsd:minExclusive value="0" />
+                    </xsd:restriction>
+                </xsd:simpleType>
+            </xsd:element>
+
+        </xsd:all>
+    </xsd:complexType>
+
+    <!-- The type definition of a device>config element.
+         This type is basically all the element defined by parametersType and an extra
+         required "name" attribute for the user-interface configuration name.
+    -->
+    <xsd:complexType name="configType">
+        <xsd:annotation>
+            <xsd:documentation>
+                The configType defines the content of a "config" element in a "device" element.
+
+                A "config" element can have all the parameters elements defined by
+                "parameterType". It also has a required "name" attribute that indicates the
+                user-interface name for this configuration.
+            </xsd:documentation>
+        </xsd:annotation>
+
+        <xsd:complexContent>
+            <xsd:extension base="c:parametersType">
+                <xsd:attribute name="name" type="xsd:normalizedString" use="required" />
+            </xsd:extension>
+        </xsd:complexContent>
+    </xsd:complexType>
+
+</xsd:schema>
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java
index 358b6fd..c11f4b8 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java
@@ -77,6 +77,7 @@
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.Text;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 
 /**
@@ -108,7 +109,9 @@
 
     private final HashMap<Class<? extends ResourceQualifier>, QualifierEditBase> mUiMap =
         new HashMap<Class<? extends ResourceQualifier>, QualifierEditBase>();
+    private final boolean mDeviceMode;
     private Composite mQualifierEditParent;
+    private IQualifierFilter mQualifierFilter;
 
     /**
      * Basic of {@link VerifyListener} to only accept digits.
@@ -184,8 +187,31 @@
         OK, INVALID_CONFIG, REGION_WITHOUT_LANGUAGE;
     }
 
-    public ConfigurationSelector(Composite parent) {
+    /**
+     * A filter for {@link ResourceQualifier}.
+     * @see ConfigurationSelector#setQualifierFilter(IQualifierFilter)
+     */
+    public interface IQualifierFilter {
+        /**
+         * Returns true of the qualifier is accepted.
+         */
+        boolean accept(ResourceQualifier qualifier);
+    }
+
+    /**
+     * Creates the selector.
+     *
+     * If the device mode is <code>true</code> then the configuration selector only
+     * allows to create configuration that are valid on a device (as opposed to resource
+     * configuration).
+     * For instance {@link Density#NODPI} is a valid qualifier for a resource configuration but
+     * this is not valid on a device.
+     * @param parent the composite parent.
+     * @param deviceMode the device mode.
+     */
+    public ConfigurationSelector(Composite parent, boolean deviceMode) {
         super(parent, SWT.NONE);
+        mDeviceMode  = deviceMode;
 
         mBaseConfiguration.createDefault();
 
@@ -375,6 +401,15 @@
     }
 
     /**
+     * Sets a {@link IQualifierFilter}. If non null, this will restrict the qualifiers that
+     * can be chosen.
+     * @param filter the filter to set.
+     */
+    public void setQualifierFilter(IQualifierFilter filter) {
+        mQualifierFilter = filter;
+    }
+
+    /**
      * Sets a listener to be notified when the configuration changes.
      * @param listener A {@link Runnable} whose <code>run()</code> method is called when the
      * configuration is changed. The method is called from the UI thread.
@@ -492,7 +527,7 @@
     /**
      * Content provider around a {@link FolderConfiguration}.
      */
-    private static class QualifierContentProvider implements IStructuredContentProvider {
+    private class QualifierContentProvider implements IStructuredContentProvider {
 
         private FolderConfiguration mInput;
 
@@ -504,7 +539,20 @@
         }
 
         public Object[] getElements(Object inputElement) {
-            return mInput.getQualifiers();
+            // default easy case
+            if (mQualifierFilter == null) {
+                return mInput.getQualifiers();
+            }
+
+            // in this case we have to compute the list
+            ArrayList<ResourceQualifier> list = new ArrayList<ResourceQualifier>();
+            for (ResourceQualifier qual : mInput.getQualifiers()) {
+                if (mQualifierFilter.accept(qual)) {
+                    list.add(qual);
+                }
+            }
+
+            return list.toArray();
         }
 
         public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
@@ -1043,7 +1091,9 @@
             mDensity = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
             Density[] soValues = Density.values();
             for (Density value : soValues) {
-                mDensity.add(value.getDisplayValue());
+                if (mDeviceMode == false || value != Density.NODPI) {
+                    mDensity.add(value.getDisplayValue());
+                }
             }
 
             mDensity.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -1055,7 +1105,6 @@
                     onDensityChange();
                 }
             });
-
         }
 
         private void onDensityChange() {
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/export/KeyCheckPage.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/export/KeyCheckPage.java
index 0f630c4..5f8a8d5 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/export/KeyCheckPage.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/export/KeyCheckPage.java
@@ -19,6 +19,7 @@
 import com.android.ide.eclipse.adt.internal.project.ProjectHelper;
 import com.android.ide.eclipse.adt.internal.sdk.Sdk;
 import com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.ExportWizardPage;
+import com.android.sdklib.internal.project.ApkSettings;
 
 import org.eclipse.core.resources.IProject;
 import org.eclipse.swt.SWT;
@@ -68,17 +69,17 @@
     private Text mDestination;
     private boolean mFatalSigningError;
     private FormText mDetailText;
-    /** The Apk Config map for the current project */
-    private Map<String, String> mApkConfig;
     private ScrolledComposite mScrolledComposite;
-    
+
+    private ApkSettings mApkSettings;
+
     private String mKeyDetails;
     private String mDestinationDetails;
 
     protected KeyCheckPage(ExportWizard wizard, String pageName) {
         super(pageName);
         mWizard = wizard;
-        
+
         setTitle("Destination and key/certificate checks");
         setDescription(""); // TODO
     }
@@ -93,7 +94,7 @@
         GridLayout gl = new GridLayout(3, false);
         gl.verticalSpacing *= 3;
         composite.setLayout(gl);
-        
+
         GridData gd;
 
         new Label(composite, SWT.NONE).setText("Destination APK file:");
@@ -110,26 +111,26 @@
             @Override
             public void widgetSelected(SelectionEvent e) {
                 FileDialog fileDialog = new FileDialog(browseButton.getShell(), SWT.SAVE);
-                
+
                 fileDialog.setText("Destination file name");
                 // get a default apk name based on the project
                 String filename = ProjectHelper.getApkFilename(mWizard.getProject(),
                         null /*config*/);
                 fileDialog.setFileName(filename);
-        
+
                 String saveLocation = fileDialog.open();
                 if (saveLocation != null) {
                     mDestination.setText(saveLocation);
                 }
             }
         });
-        
+
         mScrolledComposite = new ScrolledComposite(composite, SWT.V_SCROLL);
         mScrolledComposite.setLayoutData(gd = new GridData(GridData.FILL_BOTH));
         gd.horizontalSpan = 3;
         mScrolledComposite.setExpandHorizontal(true);
         mScrolledComposite.setExpandVertical(true);
-        
+
         mDetailText = new FormText(mScrolledComposite, SWT.NONE);
         mScrolledComposite.setContent(mDetailText);
 
@@ -139,18 +140,18 @@
                 updateScrolling();
             }
         });
-        
+
         setControl(composite);
     }
-    
+
     @Override
     void onShow() {
         // fill the texts with information loaded from the project.
         if ((mProjectDataChanged & DATA_PROJECT) != 0) {
             // reset the destination from the content of the project
             IProject project = mWizard.getProject();
-            mApkConfig = Sdk.getCurrent().getProjectApkConfigs(project);
-            
+            mApkSettings = Sdk.getCurrent().getApkSettings(project);
+
             String destination = ProjectHelper.loadStringProperty(project,
                     ExportWizard.PROPERTY_DESTINATION);
             String filename = ProjectHelper.loadStringProperty(project,
@@ -159,7 +160,7 @@
                 mDestination.setText(destination + File.separator + filename);
             }
         }
-        
+
         // if anything change we basically reload the data.
         if (mProjectDataChanged != 0) {
             mFatalSigningError = false;
@@ -170,7 +171,7 @@
             mPrivateKey = null;
             mCertificate = null;
             mKeyDetails = null;
-    
+
             if (mWizard.getKeystoreCreationMode() || mWizard.getKeyCreationMode()) {
                 int validity = mWizard.getValidity();
                 StringBuilder sb = new StringBuilder(
@@ -196,13 +197,13 @@
                             mWizard.getKeyAlias(),
                             new KeyStore.PasswordProtection(
                                     mWizard.getKeyPassword().toCharArray()));
-                    
+
                     if (entry != null) {
                         mPrivateKey = entry.getPrivateKey();
                         mCertificate = (X509Certificate)entry.getCertificate();
                     } else {
                         setErrorMessage("Unable to find key.");
-                        
+
                         setPageComplete(false);
                     }
                 } catch (FileNotFoundException e) {
@@ -220,33 +221,33 @@
                 } catch (IOException e) {
                     onException(e);
                 }
-                
+
                 if (mPrivateKey != null && mCertificate != null) {
                     Calendar expirationCalendar = Calendar.getInstance();
                     expirationCalendar.setTime(mCertificate.getNotAfter());
                     Calendar today = Calendar.getInstance();
-                    
+
                     if (expirationCalendar.before(today)) {
                         mKeyDetails = String.format(
                                 "<p>Certificate expired on %s</p>",
                                 mCertificate.getNotAfter().toString());
-                        
+
                         // fatal error = nothing can make the page complete.
                         mFatalSigningError = true;
-        
+
                         setErrorMessage("Certificate is expired.");
                         setPageComplete(false);
                     } else {
                         // valid, key/cert: put it in the wizard so that it can be finished
                         mWizard.setSigningInfo(mPrivateKey, mCertificate);
-        
+
                         StringBuilder sb = new StringBuilder(String.format(
                                 "<p>Certificate expires on %s.</p>",
                                 mCertificate.getNotAfter().toString()));
-                        
+
                         int expirationYear = expirationCalendar.get(Calendar.YEAR);
                         int thisYear = today.get(Calendar.YEAR);
-                        
+
                         if (thisYear + 25 < expirationYear) {
                             // do nothing
                         } else {
@@ -258,14 +259,14 @@
                                         "<p>The Certificate expires in %1$s %2$s.</p>",
                                         count, count == 1 ? "year" : "years"));
                             }
-                            
+
                             sb.append("<p>Make sure the certificate is valid for the planned lifetime of the product.</p>");
                             sb.append("<p>If the certificate expires, you will be forced to sign your application with a different one.</p>");
                             sb.append("<p>Applications cannot be upgraded if their certificate changes from one version to another, ");
                             sb.append("forcing a full uninstall/install, which will make the user lose his/her data.</p>");
                             sb.append("<p>Android Market currently requires certificates to be valid until 2033.</p>");
                         }
-                        
+
                         mKeyDetails = sb.toString();
                     }
                 } else {
@@ -277,7 +278,7 @@
 
         onDestinationChange(true /*forceDetailUpdate*/);
     }
-    
+
     /**
      * Callback for destination field edition
      * @param forceDetailUpdate if true, the detail {@link FormText} is updated even if a fatal
@@ -319,12 +320,12 @@
 
             // display the list of files that will actually be created
             Map<String, String[]> apkFileMap = getApkFileMap(file);
-            
+
             // display them
             boolean fileExists = false;
             StringBuilder sb = new StringBuilder(String.format(
                     "<p>This will create the following files:</p>"));
-            
+
             Set<Entry<String, String[]>> set = apkFileMap.entrySet();
             for (Entry<String, String[]> entry : set) {
                 String[] apkArray = entry.getValue();
@@ -360,7 +361,7 @@
             updateDetailText();
         }
     }
-    
+
     /**
      * Updates the scrollbar to match the content of the {@link FormText} or the new size
      * of the {@link ScrolledComposite}.
@@ -372,41 +373,40 @@
             mScrolledComposite.layout();
         }
     }
-    
+
     private void updateDetailText() {
         StringBuilder sb = new StringBuilder("<form>");
         if (mKeyDetails != null) {
             sb.append(mKeyDetails);
         }
-        
+
         if (mDestinationDetails != null && mFatalSigningError == false) {
             sb.append(mDestinationDetails);
         }
-        
+
         sb.append("</form>");
-        
+
         mDetailText.setText(sb.toString(), true /* parseTags */,
                 true /* expandURLs */);
 
         mDetailText.getParent().layout();
 
         updateScrolling();
-
     }
 
     /**
      * Creates the list of destination filenames based on the content of the destination field
      * and the list of APK configurations for the project.
-     * 
+     *
      * @param file File name from the destination field
      * @return A list of destination filenames based <code>file</code> and the list of APK
      *         configurations for the project.
      */
     private Map<String, String[]> getApkFileMap(File file) {
         String filename = file.getName();
-        
+
         HashMap<String, String[]> map = new HashMap<String, String[]>();
-        
+
         // add the default APK filename
         String[] apkArray = new String[ExportWizard.APK_COUNT];
         apkArray[ExportWizard.APK_FILE_SOURCE] = ProjectHelper.getApkFilename(
@@ -415,29 +415,32 @@
         map.put(null, apkArray);
 
         // add the APKs for each APK configuration.
-        if (mApkConfig != null && mApkConfig.size() > 0) {
-            // remove the extension.
-            int index = filename.lastIndexOf('.');
-            String base = filename.substring(0, index);
-            String extension = filename.substring(index);
-            
-            Set<Entry<String, String>> set = mApkConfig.entrySet();
-            for (Entry<String, String> entry : set) {
-                apkArray = new String[ExportWizard.APK_COUNT];
-                apkArray[ExportWizard.APK_FILE_SOURCE] = ProjectHelper.getApkFilename(
-                        mWizard.getProject(), entry.getKey());
-                apkArray[ExportWizard.APK_FILE_DEST] = base + "-" + entry.getKey() + extension;
-                map.put(entry.getKey(), apkArray);
+        if (mApkSettings != null) {
+            Map<String, String> apkFilters = mApkSettings.getResourceFilters();
+            if (apkFilters.size() > 0) {
+                // remove the extension from the user-chosen filename
+                int index = filename.lastIndexOf('.');
+                String base = filename.substring(0, index);
+                String extension = filename.substring(index);
+
+                for (Entry<String, String> entry : apkFilters.entrySet()) {
+                    apkArray = new String[ExportWizard.APK_COUNT];
+                    apkArray[ExportWizard.APK_FILE_SOURCE] = ProjectHelper.getApkFilename(
+                            mWizard.getProject(), entry.getKey());
+                    apkArray[ExportWizard.APK_FILE_DEST] = base + "-" + //$NON-NLS-1$
+                            entry.getKey() + extension;
+                    map.put(entry.getKey(), apkArray);
+                }
             }
         }
-        
+
         return map;
     }
-    
+
     @Override
     protected void onException(Throwable t) {
         super.onException(t);
-        
+
         mKeyDetails = String.format("ERROR: %1$s", ExportWizard.getExceptionMessage(t));
     }
 }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreationPage.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreationPage.java
index 5067111..8d5cf27 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreationPage.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreationPage.java
@@ -54,6 +54,7 @@
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.DirectoryDialog;
 import org.eclipse.swt.widgets.Event;
@@ -65,6 +66,7 @@
 import java.io.File;
 import java.io.FileFilter;
 import java.net.URI;
+import java.util.ArrayList;
 import java.util.regex.Pattern;
 
 /**
@@ -90,9 +92,12 @@
     /** Initial value for all name fields (project, activity, application, package). Used
      * whenever a value is requested before controls are created. */
     private static final String INITIAL_NAME = "";  //$NON-NLS-1$
-    /** Initial value for the Create New Project radio; False means Create From Existing would be
-     * the default.*/
+    /** Initial value for the Create New Project radio. */
     private static final boolean INITIAL_CREATE_NEW_PROJECT = true;
+    /** Initial value for the Create Project From Sample. */
+    private static final boolean INITIAL_CREATE_FROM_SAMPLE = false;
+    /** Initial value for the Create Project From Existing Source. */
+    private static final boolean INITIAL_CREATE_FROM_SOURCE = false;
     /** Initial value for the Use Default Location check box. */
     private static final boolean INITIAL_USE_DEFAULT_LOCATION = true;
     /** Initial value for the Create Activity check box. */
@@ -127,6 +132,7 @@
     private Text mActivityNameField;
     private Text mApplicationNameField;
     private Button mCreateNewProjectRadio;
+    private Button mCreateFromSampleRadio;
     private Button mUseDefaultLocation;
     private Label mLocationLabel;
     private Text mLocationPathField;
@@ -145,6 +151,10 @@
     private boolean mApplicationNameModifiedByUser;
     private boolean mInternalMinSdkVersionUpdate;
 
+    private final ArrayList<String> mSamplesPaths = new ArrayList<String>();
+    private Combo mSamplesCombo;
+
+
 
     /**
      * Creates a new project creation wizard page.
@@ -249,6 +259,12 @@
                                                   : mCreateNewProjectRadio.getSelection();
         }
 
+        /** Returns the value of the "Create from Existing Sample" radio. */
+        public boolean isCreateFromSample() {
+            return mCreateFromSampleRadio == null ? INITIAL_CREATE_FROM_SAMPLE
+                                                  : mCreateFromSampleRadio.getSelection();
+        }
+
         /** Returns the value of the "Create Activity" checkbox. */
         public boolean isCreateActivity() {
             return mCreateActivityCheck == null ? INITIAL_CREATE_ACTIVITY
@@ -330,6 +346,7 @@
 
         // Update state the first time
         enableLocationWidgets();
+        loadSamplesForTarget(null /*target*/);
 
         // Show description the first time
         setErrorMessage(null);
@@ -407,9 +424,10 @@
         mCreateNewProjectRadio = new Button(group, SWT.RADIO);
         mCreateNewProjectRadio.setText("Create new project in workspace");
         mCreateNewProjectRadio.setSelection(INITIAL_CREATE_NEW_PROJECT);
+
         Button existing_project_radio = new Button(group, SWT.RADIO);
         existing_project_radio.setText("Create project from existing source");
-        existing_project_radio.setSelection(!INITIAL_CREATE_NEW_PROJECT);
+        existing_project_radio.setSelection(INITIAL_CREATE_FROM_SOURCE);
 
         mUseDefaultLocation = new Button(group, SWT.CHECK);
         mUseDefaultLocation.setText("Use default location");
@@ -462,6 +480,33 @@
                 onOpenDirectoryBrowser();
             }
         });
+
+        mCreateFromSampleRadio = new Button(group, SWT.RADIO);
+        mCreateFromSampleRadio.setText("Create project from existing sample");
+        mCreateFromSampleRadio.setSelection(INITIAL_CREATE_FROM_SAMPLE);
+        mCreateFromSampleRadio.addSelectionListener(location_listener);
+
+        Composite samples_group = new Composite(group, SWT.NONE);
+        samples_group.setLayout(new GridLayout(2, /* num columns */
+                false /* columns of not equal size */));
+        samples_group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        samples_group.setFont(parent.getFont());
+
+        new Label(samples_group, SWT.NONE).setText("Samples:");
+
+        mSamplesCombo = new Combo(samples_group, SWT.DROP_DOWN | SWT.READ_ONLY);
+        mSamplesCombo.setEnabled(false);
+        mSamplesCombo.select(0);
+        mSamplesCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        mSamplesCombo.setToolTipText("Select a sample");
+
+        mSamplesCombo.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                onSampleSelected();
+            }
+        });
+
     }
 
     /**
@@ -625,9 +670,22 @@
         return mLocationPathField == null ? "" : mLocationPathField.getText().trim();  //$NON-NLS-1$
     }
 
-    /** Returns the current project location, depending on the Use Default Location check box. */
+    /** Returns the current selected sample path,
+     * or an empty string if there's no valid selection. */
+    private String getSelectedSamplePath() {
+        int selIndex = mSamplesCombo.getSelectionIndex();
+        if (selIndex >= 0 && selIndex < mSamplesPaths.size()) {
+            return mSamplesPaths.get(selIndex);
+        }
+        return "";
+    }
+
+    /** Returns the current project location, depending on the Use Default Location check box
+     * or the Create From Sample check box. */
     private String getProjectLocation() {
-        if (mInfo.isNewProject() && mInfo.useDefaultLocation()) {
+        if (mInfo.isCreateFromSample()) {
+            return getSelectedSamplePath();
+        } else if (mInfo.isNewProject() && mInfo.useDefaultLocation()) {
             return Platform.getLocation().toString();
         } else {
             return getLocationPathFieldValue();
@@ -681,14 +739,25 @@
     }
 
     /**
+     * A sample was selected. Update the location field, manifest and validate.
+     */
+    private void onSampleSelected() {
+        // Note that getProjectLocation() is automatically updated to use the currently
+        // selected sample. We just need to refresh the manifest data & validate.
+        extractNamesFromAndroidManifest();
+        validatePageComplete();
+    }
+
+    /**
      * Enables or disable the location widgets depending on the user selection:
      * the location path is enabled when using the "existing source" mode (i.e. not new project)
      * or in new project mode with the "use default location" turned off.
      */
     private void enableLocationWidgets() {
         boolean is_new_project = mInfo.isNewProject();
-        boolean use_default = mInfo.useDefaultLocation();
-        boolean location_enabled = !is_new_project || !use_default;
+        boolean is_create_from_sample = mInfo.isCreateFromSample();
+        boolean use_default = mInfo.useDefaultLocation() && !is_create_from_sample;
+        boolean location_enabled = (!is_new_project || !use_default) && !is_create_from_sample;
         boolean create_activity = mInfo.isCreateActivity();
 
         mUseDefaultLocation.setEnabled(is_new_project);
@@ -697,6 +766,8 @@
         mLocationPathField.setEnabled(location_enabled);
         mBrowseButton.setEnabled(location_enabled);
 
+        mSamplesCombo.setEnabled(is_create_from_sample && mSamplesPaths.size() > 0);
+
         mPackageNameField.setEnabled(is_new_project);
         mCreateActivityCheck.setEnabled(is_new_project);
         mActivityNameField.setEnabled(is_new_project & create_activity);
@@ -718,6 +789,12 @@
      * @param abs_dir A new absolute directory path or null to use the default.
      */
     private void updateLocationPathField(String abs_dir) {
+
+        // We don't touch the location path if using the "Create From Sample" mode
+        if (mInfo.isCreateFromSample()) {
+            return;
+        }
+
         boolean is_new_project = mInfo.isNewProject();
         boolean use_default = mInfo.useDefaultLocation();
         boolean custom_location = !is_new_project || !use_default;
@@ -872,6 +949,10 @@
             mMinSdkVersionField.setText(target.getVersion().getApiString());
             mInternalMinSdkVersionUpdate = false;
         }
+
+        loadSamplesForTarget(target);
+        enableLocationWidgets();
+        onSampleSelected();
     }
 
     /**
@@ -969,15 +1050,15 @@
                 String[] ids = activityName.split(AndroidConstants.RE_DOT);
                 activityName = ids[ids.length - 1];
             }
-            if (mProjectNameField.getText().length() == 0 ||
-                    !mProjectNameModifiedByUser) {
+            if (mProjectNameField.getText().length() == 0 || !mProjectNameModifiedByUser) {
                 mInternalProjectNameUpdate = true;
+                mProjectNameModifiedByUser = false;
                 mProjectNameField.setText(activityName);
                 mInternalProjectNameUpdate = false;
             }
-            if (mApplicationNameField.getText().length() == 0 ||
-                    !mApplicationNameModifiedByUser) {
+            if (mApplicationNameField.getText().length() == 0 || !mApplicationNameModifiedByUser) {
                 mInternalApplicationNameUpdate = true;
+                mApplicationNameModifiedByUser = false;
                 mApplicationNameField.setText(activityName);
                 mInternalApplicationNameUpdate = false;
             }
@@ -1004,8 +1085,7 @@
 
                 // For the project name, remove any dots
                 packageName = packageName.replace('.', '_');
-                if (mProjectNameField.getText().length() == 0 ||
-                        !mProjectNameModifiedByUser) {
+                if (mProjectNameField.getText().length() == 0 || !mProjectNameModifiedByUser) {
                     mInternalProjectNameUpdate = true;
                     mProjectNameField.setText(packageName);
                     mInternalProjectNameUpdate = false;
@@ -1015,7 +1095,8 @@
         }
 
         // Select the target matching the manifest's sdk or build properties, if any
-        boolean foundTarget = false;
+        IAndroidTarget foundTarget = null;
+        IAndroidTarget currentTarget = mInfo.getSdkTarget();
 
         ProjectProperties p = ProjectProperties.create(projectLocation, null);
         if (p != null) {
@@ -1023,33 +1104,43 @@
             p.merge(PropertyType.BUILD).merge(PropertyType.DEFAULT);
             String v = p.getProperty(ProjectProperties.PROPERTY_TARGET);
             IAndroidTarget target = Sdk.getCurrent().getTargetFromHashString(v);
-            if (target != null) {
-                mSdkTargetSelector.setSelection(target);
-                foundTarget = true;
+            // We can change the current target if:
+            // - we found a new target
+            // - there is no current target
+            // - there is a current target but the new target is not <= to the current one.
+            if (target != null &&
+                    (currentTarget == null || !target.isCompatibleBaseFor(currentTarget))) {
+                foundTarget = target;
             }
         }
 
-        if (!foundTarget && minSdkVersion != null) {
+        if (foundTarget == null && minSdkVersion != null) {
+            // Otherwise try to match the requested sdk version
             for (IAndroidTarget target : mSdkTargetSelector.getTargets()) {
-                if (target.getVersion().equals(minSdkVersion)) {
-                    mSdkTargetSelector.setSelection(target);
-                    foundTarget = true;
+                if (target != null &&
+                        target.getVersion().equals(minSdkVersion) &&
+                        (currentTarget == null || !target.isCompatibleBaseFor(currentTarget))) {
+                    foundTarget = target;
                     break;
                 }
             }
         }
 
-        if (!foundTarget) {
+        if (foundTarget == null) {
+            // Or last attemp, try to match a sample project location
             for (IAndroidTarget target : mSdkTargetSelector.getTargets()) {
-                if (projectLocation.startsWith(target.getLocation())) {
-                    mSdkTargetSelector.setSelection(target);
-                    foundTarget = true;
+                if (target != null &&
+                        projectLocation.startsWith(target.getLocation()) &&
+                        (currentTarget == null || !target.isCompatibleBaseFor(currentTarget))) {
+                    foundTarget = target;
                     break;
                 }
             }
         }
 
-        if (!foundTarget) {
+        if (foundTarget != null) {
+            mSdkTargetSelector.setSelection(foundTarget);
+        } else {
             mInternalMinSdkVersionUpdate = true;
             if (minSdkVersion != null) {
                 mMinSdkVersionField.setText(minSdkVersion);
@@ -1059,6 +1150,104 @@
     }
 
     /**
+     * Updates the list of all samples for the given target SDK.
+     * The list is stored in mSamplesPaths as absolute directory paths.
+     * The combo is recreated to match this.
+     */
+    private void loadSamplesForTarget(IAndroidTarget target) {
+
+        // Keep the name of the old selection (if there were any samples)
+        String oldChoice = null;
+        if (mSamplesPaths.size() > 0) {
+            int selIndex = mSamplesCombo.getSelectionIndex();
+            if (selIndex > -1) {
+                oldChoice = mSamplesCombo.getItem(selIndex);
+            }
+        }
+
+        // Clear all current content
+        mSamplesCombo.removeAll();
+        mSamplesPaths.clear();
+
+        if (target != null) {
+            // Get the sample root path and recompute the list of samples
+            String samplesRootPath = target.getPath(IAndroidTarget.SAMPLES);
+
+            File samplesDir = new File(samplesRootPath);
+            findSamplesManifests(samplesDir, mSamplesPaths);
+
+            if (mSamplesPaths.size() == 0) {
+                // Odd, this target has no samples. Could happen with an addon.
+                mSamplesCombo.add("This target has no samples. Please select another target.");
+                mSamplesCombo.select(0);
+                return;
+            }
+
+            // Recompute the description of each sample (the relative path
+            // to the sample root). Also try to find the old selection.
+            int selIndex = 0;
+            int i = 0;
+            int n = samplesRootPath.length();
+            for (String path : mSamplesPaths) {
+                if (path.length() > n) {
+                    path = path.substring(n);
+                    if (path.charAt(0) == File.separatorChar) {
+                        path = path.substring(1);
+                    }
+                    if (path.endsWith(File.separator)) {
+                        path = path.substring(0, path.length() - 1);
+                    }
+                    path = path.replaceAll(Pattern.quote(File.separator), " > ");
+                }
+
+                if (oldChoice != null && oldChoice.equals(path)) {
+                    selIndex = i;
+                }
+
+                mSamplesCombo.add(path);
+                i++;
+            }
+
+            mSamplesCombo.select(selIndex);
+
+        } else {
+            mSamplesCombo.add("Please select a target.");
+            mSamplesCombo.select(0);
+        }
+    }
+
+    /**
+     * Recursively find potential sample directories under the given directory.
+     * Actually lists any directory that contains an android manifest.
+     * Paths found are added the samplesPaths list.
+     */
+    private void findSamplesManifests(File samplesDir, ArrayList<String> samplesPaths) {
+        if (!samplesDir.isDirectory()) {
+            return;
+        }
+
+        for (File f : samplesDir.listFiles()) {
+            if (f.isDirectory()) {
+                // Assume this is a sample if it contains an android manifest.
+                File manifestFile = new File(f, SdkConstants.FN_ANDROID_MANIFEST_XML);
+                if (manifestFile.isFile()) {
+                    samplesPaths.add(f.getPath());
+                }
+
+                // Recurse in the project, to find embedded tests sub-projects
+                // We can however skip this recursion for known android sub-dirs that
+                // can't have projects, namely for sources, assets and resources.
+                String leaf = f.getName();
+                if (!SdkConstants.FD_SOURCES.equals(leaf) &&
+                        !SdkConstants.FD_ASSETS.equals(leaf) &&
+                        !SdkConstants.FD_RES.equals(leaf)) {
+                    findSamplesManifests(f, samplesPaths);
+                }
+            }
+        }
+    }
+
+    /**
      * Returns whether this page's controls currently all contain valid values.
      *
      * @return <code>true</code> if all controls are valid, and
@@ -1069,10 +1258,10 @@
 
         int status = validateProjectField(workspace);
         if ((status & MSG_ERROR) == 0) {
-            status |= validateLocationPath(workspace);
+            status |= validateSdkTarget();
         }
         if ((status & MSG_ERROR) == 0) {
-            status |= validateSdkTarget();
+            status |= validateLocationPath(workspace);
         }
         if ((status & MSG_ERROR) == 0) {
             status |= validatePackageField();
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectWizard.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectWizard.java
index d8989c2..df333a5 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectWizard.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectWizard.java
@@ -20,6 +20,7 @@
 import com.android.ide.eclipse.adt.AndroidConstants;
 import com.android.ide.eclipse.adt.internal.project.AndroidNature;
 import com.android.ide.eclipse.adt.internal.project.ProjectHelper;
+import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier.Density;
 import com.android.ide.eclipse.adt.internal.sdk.Sdk;
 import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectCreationPage.IMainInfo;
 import com.android.ide.eclipse.adt.internal.wizards.newproject.NewTestProjectCreationPage.TestInfo;
@@ -132,6 +133,12 @@
         SdkConstants.FD_ASSETS + AndroidConstants.WS_SEP;
     private static final String DRAWABLE_DIRECTORY =
         SdkConstants.FD_DRAWABLE + AndroidConstants.WS_SEP;
+    private static final String DRAWABLE_HDPI_DIRECTORY =
+        SdkConstants.FD_DRAWABLE + "-" + Density.HIGH.getValue() + AndroidConstants.WS_SEP;   //$NON-NLS-1$
+    private static final String DRAWABLE_MDPI_DIRECTORY =
+        SdkConstants.FD_DRAWABLE + "-" + Density.MEDIUM.getValue() + AndroidConstants.WS_SEP; //$NON-NLS-1$
+    private static final String DRAWABLE_LDPI_DIRECTORY =
+        SdkConstants.FD_DRAWABLE + "-" + Density.LOW.getValue() + AndroidConstants.WS_SEP;    //$NON-NLS-1$
     private static final String LAYOUT_DIRECTORY =
         SdkConstants.FD_LAYOUT + AndroidConstants.WS_SEP;
     private static final String VALUES_DIRECTORY =
@@ -159,7 +166,10 @@
             + "strings.template"; //$NON-NLS-1$
     private static final String TEMPLATE_STRING = TEMPLATES_DIRECTORY
             + "string.template"; //$NON-NLS-1$
-    private static final String ICON = "icon.png"; //$NON-NLS-1$
+    private static final String PROJECT_ICON = "icon.png"; //$NON-NLS-1$
+    private static final String ICON_HDPI = "icon_hdpi.png"; //$NON-NLS-1$
+    private static final String ICON_MDPI = "icon_mdpi.png"; //$NON-NLS-1$
+    private static final String ICON_LDPI = "icon_ldpi.png"; //$NON-NLS-1$
 
     private static final String STRINGS_FILE = "strings.xml";       //$NON-NLS-1$
 
@@ -170,7 +180,10 @@
     private static final String[] DEFAULT_DIRECTORIES = new String[] {
             BIN_DIRECTORY, RES_DIRECTORY, ASSETS_DIRECTORY };
     private static final String[] RES_DIRECTORIES = new String[] {
-            DRAWABLE_DIRECTORY, LAYOUT_DIRECTORY, VALUES_DIRECTORY};
+            DRAWABLE_DIRECTORY, LAYOUT_DIRECTORY, VALUES_DIRECTORY };
+    private static final String[] RES_DENSITY_ENABLED_DIRECTORIES = new String[] {
+            DRAWABLE_HDPI_DIRECTORY, DRAWABLE_MDPI_DIRECTORY, DRAWABLE_LDPI_DIRECTORY,
+            LAYOUT_DIRECTORY, VALUES_DIRECTORY };
 
     private static final String PROJECT_LOGO_LARGE = "icons/android_large.png"; //$NON-NLS-1$
     private static final String JAVA_ACTIVITY_TEMPLATE = "java_file.template";  //$NON-NLS-1$
@@ -587,6 +600,10 @@
             Map<String, String> dictionary)
                 throws CoreException, IOException {
 
+        // get the project target
+        IAndroidTarget target = (IAndroidTarget) parameters.get(PARAM_SDK_TARGET);
+        boolean legacy = target.getVersion().getApiLevel() < 4;
+
         // Create project and open it
         project.create(description, new SubProgressMonitor(monitor, 10));
         if (monitor.isCanceled()) throw new OperationCanceledException();
@@ -605,7 +622,11 @@
         addDefaultDirectories(project, AndroidConstants.WS_ROOT, sourceFolders, monitor);
 
         // Create the resource folders in the project if they don't already exist.
-        addDefaultDirectories(project, RES_DIRECTORY, RES_DIRECTORIES, monitor);
+        if (legacy) {
+            addDefaultDirectories(project, RES_DIRECTORY, RES_DIRECTORIES, monitor);
+        } else {
+            addDefaultDirectories(project, RES_DIRECTORY, RES_DENSITY_ENABLED_DIRECTORIES, monitor);
+        }
 
         // Setup class path: mark folders as source folders
         IJavaProject javaProject = JavaCore.create(project);
@@ -624,7 +645,7 @@
             addManifest(project, parameters, dictionary, monitor);
 
             // add the default app icon
-            addIcon(project, monitor);
+            addIcon(project, legacy, monitor);
 
             // Create the default package components
             addSampleCode(project, sourceFolders[0], parameters, dictionary, monitor);
@@ -650,7 +671,8 @@
                 // the currently-empty current list.
                 desc.setReferencedProjects(new IProject[] { refProject });
 
-                project.setDescription(desc, IResource.KEEP_HISTORY, new SubProgressMonitor(monitor, 10));
+                project.setDescription(desc, IResource.KEEP_HISTORY,
+                        new SubProgressMonitor(monitor, 10));
 
                 IClasspathEntry entry = JavaCore.newProjectEntry(
                         refProject.getFullPath(), //path
@@ -664,8 +686,7 @@
             }
         }
 
-        Sdk.getCurrent().setProject(project, (IAndroidTarget) parameters.get(PARAM_SDK_TARGET),
-                null /* apkConfigMap*/);
+        Sdk.getCurrent().setProject(project, target, null /* apkConfigMap*/);
 
         // Fix the project to make sure all properties are as expected.
         // Necessary for existing projects and good for new ones to.
@@ -839,23 +860,58 @@
      * Adds default application icon to the project.
      *
      * @param project The Java Project to update.
+     * @param legacy whether we're running in legacy mode (no density support)
      * @param monitor An existing monitor.
      * @throws CoreException if the method fails to update the project.
      */
-    private void addIcon(IProject project, IProgressMonitor monitor)
+    private void addIcon(IProject project, boolean legacy, IProgressMonitor monitor)
             throws CoreException {
-        IFile file = project.getFile(RES_DIRECTORY + AndroidConstants.WS_SEP
-                                     + DRAWABLE_DIRECTORY + AndroidConstants.WS_SEP + ICON);
-        if (!file.exists()) {
-            // read the content from the template
-            byte[] buffer = AdtPlugin.readEmbeddedFile(TEMPLATES_DIRECTORY + ICON);
-
-            // if valid
-            if (buffer != null) {
-                // Save in the project
-                InputStream stream = new ByteArrayInputStream(buffer);
-                file.create(stream, false /* force */, new SubProgressMonitor(monitor, 10));
+        if (legacy) { // density support
+            // do medium density icon only, in the default drawable folder.
+            IFile file = project.getFile(RES_DIRECTORY + AndroidConstants.WS_SEP
+                    + DRAWABLE_DIRECTORY + AndroidConstants.WS_SEP + PROJECT_ICON);
+            if (!file.exists()) {
+                addFile(file, AdtPlugin.readEmbeddedFile(TEMPLATES_DIRECTORY + ICON_MDPI), monitor);
             }
+        } else {
+            // do all 3 icons.
+            IFile file;
+
+            // high density
+            file = project.getFile(RES_DIRECTORY + AndroidConstants.WS_SEP
+                    + DRAWABLE_HDPI_DIRECTORY + AndroidConstants.WS_SEP + PROJECT_ICON);
+            if (!file.exists()) {
+                addFile(file, AdtPlugin.readEmbeddedFile(TEMPLATES_DIRECTORY + ICON_HDPI), monitor);
+            }
+
+            // medium density
+            file = project.getFile(RES_DIRECTORY + AndroidConstants.WS_SEP
+                    + DRAWABLE_MDPI_DIRECTORY + AndroidConstants.WS_SEP + PROJECT_ICON);
+            if (!file.exists()) {
+                addFile(file, AdtPlugin.readEmbeddedFile(TEMPLATES_DIRECTORY + ICON_MDPI), monitor);
+            }
+
+            // low density
+            file = project.getFile(RES_DIRECTORY + AndroidConstants.WS_SEP
+                    + DRAWABLE_LDPI_DIRECTORY + AndroidConstants.WS_SEP + PROJECT_ICON);
+            if (!file.exists()) {
+                addFile(file, AdtPlugin.readEmbeddedFile(TEMPLATES_DIRECTORY + ICON_LDPI), monitor);
+            }
+        }
+    }
+
+    /**
+     * Creates a file from a data source.
+     * @param dest the file to write
+     * @param source the content of the file.
+     * @param monitor the progress monitor
+     * @throws CoreException
+     */
+    private void addFile(IFile dest, byte[] source, IProgressMonitor monitor) throws CoreException {
+        if (source != null) {
+            // Save in the project
+            InputStream stream = new ByteArrayInputStream(source);
+            dest.create(stream, false /* force */, new SubProgressMonitor(monitor, 10));
         }
     }
 
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/NewXmlFileCreationPage.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/NewXmlFileCreationPage.java
index bd4e7a3..1e3c0df 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/NewXmlFileCreationPage.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/NewXmlFileCreationPage.java
@@ -620,7 +620,7 @@
 
         // configuration selector
         emptyCell(parent);
-        mConfigSelector = new ConfigurationSelector(parent);
+        mConfigSelector = new ConfigurationSelector(parent, false /* deviceMode*/);
         GridData gd = newGridData(2, GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
         gd.widthHint = ConfigurationSelector.WIDTH_HINT;
         gd.heightHint = ConfigurationSelector.HEIGHT_HINT;
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/templates/icon.png b/tools/eclipse/plugins/com.android.ide.eclipse.adt/templates/icon.png
deleted file mode 100644
index 7502484..0000000
--- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/templates/icon.png
+++ /dev/null
Binary files differ
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/templates/icon_hdpi.png b/tools/eclipse/plugins/com.android.ide.eclipse.adt/templates/icon_hdpi.png
new file mode 100644
index 0000000..8074c4c
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/templates/icon_hdpi.png
Binary files differ
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/templates/icon_ldpi.png b/tools/eclipse/plugins/com.android.ide.eclipse.adt/templates/icon_ldpi.png
new file mode 100644
index 0000000..1095584
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/templates/icon_ldpi.png
Binary files differ
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/templates/icon_mdpi.png b/tools/eclipse/plugins/com.android.ide.eclipse.adt/templates/icon_mdpi.png
new file mode 100644
index 0000000..a07c69f
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/templates/icon_mdpi.png
Binary files differ
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/META-INF/MANIFEST.MF b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/META-INF/MANIFEST.MF
index 9f021ae..ee93981 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/META-INF/MANIFEST.MF
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/META-INF/MANIFEST.MF
@@ -2,13 +2,16 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Dalvik Debug Monitor Service
 Bundle-SymbolicName: com.android.ide.eclipse.ddms;singleton:=true
-Bundle-Version: 0.9.3.qualifier
+Bundle-Version: 0.9.5.qualifier
 Bundle-Activator: com.android.ide.eclipse.ddms.DdmsPlugin
 Bundle-Vendor: The Android Open Source Project
 Bundle-Localization: plugin
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
- org.eclipse.ui.console
+ org.eclipse.ui.console,
+ org.eclipse.core.resources,
+ org.eclipse.ui.ide,
+ org.eclipse.core.filesystem
 Eclipse-LazyStart: true
 Export-Package: com.android.ddmlib,
  com.android.ddmlib.log,
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/icons/.gitignore b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/icons/.gitignore
new file mode 100644
index 0000000..f432e88
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/icons/.gitignore
@@ -0,0 +1,31 @@
+add.png
+backward.png
+clear.png
+d.png
+debug-attach.png
+debug-error.png
+debug-wait.png
+delete.png
+device.png
+down.png
+e.png
+edit.png
+empty.png
+emulator.png
+forward.png
+gc.png
+halt.png
+heap.png
+i.png
+importBug.png
+load.png
+pause.png
+play.png
+pull.png
+push.png
+save.png
+thread.png
+up.png
+v.png
+w.png
+warning.png
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/libs/.gitignore b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/libs/.gitignore
new file mode 100644
index 0000000..d392f0e
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/libs/.gitignore
@@ -0,0 +1 @@
+*.jar
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/.gitignore b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/.gitignore
new file mode 100644
index 0000000..76d9981
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/.gitignore
@@ -0,0 +1,2 @@
+ddmlib
+ddmuilib
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java
index d559b0f..b59182b 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java
@@ -18,6 +18,7 @@
 
 import com.android.ddmlib.AndroidDebugBridge;
 import com.android.ddmlib.Client;
+import com.android.ddmlib.DdmConstants;
 import com.android.ddmlib.DdmPreferences;
 import com.android.ddmlib.IDevice;
 import com.android.ddmlib.Log;
@@ -46,6 +47,7 @@
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.Calendar;
 
@@ -55,6 +57,7 @@
 public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeListener,
         IUiSelectionListener {
 
+
     // The plug-in ID
     public static final String PLUGIN_ID = "com.android.ide.eclipse.ddms"; // $NON-NLS-1$
 
@@ -65,12 +68,15 @@
 
     /** Location of the adb command line executable */
     private static String sAdbLocation;
+    private static String sToolsFolder;
+    private static String sHprofConverter;
 
     /**
      * Debug Launcher for already running apps
      */
     private static IDebugLauncher sRunningAppDebugLauncher;
 
+
     /** Console for DDMS log message */
     private MessageConsole mDdmsConsole;
 
@@ -211,13 +217,16 @@
                 } else if (PreferenceInitializer.ATTR_LOG_LEVEL.equals(property)) {
                     DdmPreferences.setLogLevel(
                             eclipseStore.getString(PreferenceInitializer.ATTR_LOG_LEVEL));
+                } else if (PreferenceInitializer.ATTR_TIME_OUT.equals(property)) {
+                    DdmPreferences.setTimeOut(
+                            eclipseStore.getInt(PreferenceInitializer.ATTR_TIME_OUT));
                 }
             }
         });
 
         // read the adb location from the prefs to attempt to start it properly without
         // having to wait for ADT to start
-        sAdbLocation = eclipseStore.getString(ADB_LOCATION);
+        final boolean adbValid = setAdbLocation(eclipseStore.getString(ADB_LOCATION));
 
         // start it in a thread to return from start() asap.
         new Thread() {
@@ -227,7 +236,9 @@
                 getDefault().initDdmlib();
 
                 // create and start the first bridge
-                AndroidDebugBridge.createBridge(sAdbLocation, true /* forceNewBridge */);
+                if (adbValid) {
+                    AndroidDebugBridge.createBridge(sAdbLocation, true /* forceNewBridge */);
+                }
             }
         }.start();
     }
@@ -278,29 +289,63 @@
         return sAdbLocation;
     }
 
+    public static String getToolsFolder() {
+        return sToolsFolder;
+    }
+
+    public static String getHprofConverter() {
+        return sHprofConverter;
+    }
+
+    /**
+     * Stores the adb location. This returns true if the location is an existing file.
+     */
+    private static boolean setAdbLocation(String adbLocation) {
+        File adb = new File(adbLocation);
+        if (adb.isFile()) {
+            sAdbLocation = adbLocation;
+
+            File toolsFolder = adb.getParentFile();
+            sToolsFolder = toolsFolder.getAbsolutePath();
+
+            File hprofConverter = new File(toolsFolder, DdmConstants.FN_HPROF_CONVERTER);
+            sHprofConverter = hprofConverter.getAbsolutePath();
+
+            File traceview = new File(toolsFolder, DdmConstants.FN_TRACEVIEW);
+            DdmUiPreferences.setTraceviewLocation(traceview.getAbsolutePath());
+
+            return true;
+        }
+
+        return false;
+    }
+
     /**
      * Set the location of the adb executable and optionally starts adb
      * @param adb location of adb
      * @param startAdb flag to start adb
      */
     public static void setAdb(String adb, boolean startAdb) {
-        sAdbLocation = adb;
+        if (adb != null) {
+            if (setAdbLocation(adb)) {
+                // store the location for future ddms only start.
+                sPlugin.getPreferenceStore().setValue(ADB_LOCATION, sAdbLocation);
 
-        // store the location for future ddms only start.
-        sPlugin.getPreferenceStore().setValue(ADB_LOCATION, sAdbLocation);
+                // starts the server in a thread in case this is blocking.
+                if (startAdb) {
+                    new Thread() {
+                        @Override
+                        public void run() {
+                            // init ddmlib if needed
+                            getDefault().initDdmlib();
 
-        // starts the server in a thread in case this is blocking.
-        if (startAdb) {
-            new Thread() {
-                @Override
-                public void run() {
-                    // init ddmlib if needed
-                    getDefault().initDdmlib();
-
-                    // create and start the bridge
-                    AndroidDebugBridge.createBridge(sAdbLocation, false /* forceNewBridge */);
+                            // create and start the bridge
+                            AndroidDebugBridge.createBridge(sAdbLocation,
+                                    false /* forceNewBridge */);
+                        }
+                    }.start();
                 }
-            }.start();
+            }
         }
     }
 
@@ -560,6 +605,4 @@
 
         return String.format("[%1$tF %1$tT - %2$s]", c, tag);
     }
-
-
 }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/preferences/PreferenceInitializer.java b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/preferences/PreferenceInitializer.java
index b53d85c..751bc4f 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/preferences/PreferenceInitializer.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/preferences/PreferenceInitializer.java
@@ -17,6 +17,7 @@
 package com.android.ide.eclipse.ddms.preferences;
 
 import com.android.ide.eclipse.ddms.DdmsPlugin;
+import com.android.ide.eclipse.ddms.views.DeviceView.HProfHandler;
 import com.android.ddmlib.DdmPreferences;
 import com.android.ddmuilib.DdmUiPreferences;
 
@@ -29,7 +30,7 @@
  * Class used to initialize default preference values.
  */
 public class PreferenceInitializer extends AbstractPreferenceInitializer {
-    
+
     public final static String ATTR_LOG_LEVEL =
         DdmsPlugin.PLUGIN_ID + ".logLevel"; //$NON-NLS-1$
 
@@ -56,7 +57,13 @@
 
     public final static String ATTR_LOGCAT_FONT =
         DdmsPlugin.PLUGIN_ID + ".logcatFont"; //$NON-NLS-1$
-    
+
+    public final static String ATTR_HPROF_ACTION =
+        DdmsPlugin.PLUGIN_ID + ".hprofAction"; //$NON-NLS-1$
+
+    public final static String ATTR_TIME_OUT =
+        DdmsPlugin.PLUGIN_ID + ".timeOut"; //$NON-NLS-1$
+
     /*
      * (non-Javadoc)
      *
@@ -84,19 +91,24 @@
 
         store.setDefault(ATTR_LOGCAT_FONT,
                 new FontData("Courier", 10, SWT.NORMAL).toString()); //$NON-NLS-1$
+
+        store.setDefault(ATTR_HPROF_ACTION, HProfHandler.ACTION_OPEN);
+
+        store.setDefault(ATTR_TIME_OUT, DdmPreferences.DEFAULT_TIMEOUT);
     }
-    
+
     /**
-     * Initializes the preferences of ddmlib and ddmuilib with values from the eclipse store. 
+     * Initializes the preferences of ddmlib and ddmuilib with values from the eclipse store.
      */
     public synchronized static void setupPreferences() {
         IPreferenceStore store = DdmsPlugin.getDefault().getPreferenceStore();
-        
+
         DdmPreferences.setDebugPortBase(store.getInt(ATTR_DEBUG_PORT_BASE));
         DdmPreferences.setSelectedDebugPort(store.getInt(ATTR_SELECTED_DEBUG_PORT));
         DdmPreferences.setLogLevel(store.getString(ATTR_LOG_LEVEL));
         DdmPreferences.setInitialThreadUpdate(store.getBoolean(ATTR_DEFAULT_THREAD_UPDATE));
         DdmPreferences.setInitialHeapUpdate(store.getBoolean(ATTR_DEFAULT_HEAP_UPDATE));
         DdmUiPreferences.setThreadRefreshInterval(store.getInt(ATTR_THREAD_INTERVAL));
+        DdmPreferences.setTimeOut(store.getInt(ATTR_TIME_OUT));
     }
 }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/preferences/PreferencePage.java b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/preferences/PreferencePage.java
index 86e87c7..fb852f5 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/preferences/PreferencePage.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/preferences/PreferencePage.java
@@ -17,10 +17,12 @@
 package com.android.ide.eclipse.ddms.preferences;
 
 import com.android.ide.eclipse.ddms.DdmsPlugin;
+import com.android.ide.eclipse.ddms.views.DeviceView.HProfHandler;
 import com.android.ddmlib.Log.LogLevel;
 import com.android.ddmuilib.PortFieldEditor;
 
 import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.ComboFieldEditor;
 import org.eclipse.jface.preference.FieldEditorPreferencePage;
 import org.eclipse.jface.preference.IntegerFieldEditor;
 import org.eclipse.jface.preference.RadioGroupFieldEditor;
@@ -45,7 +47,7 @@
         IntegerFieldEditor ife;
 
         ife = new PortFieldEditor(PreferenceInitializer.ATTR_DEBUG_PORT_BASE,
-            "ADB debugger base port:", getFieldEditorParent());
+            "Base local debugger port:", getFieldEditorParent());
         addField(ife);
 
         BooleanFieldEditor bfe;
@@ -63,6 +65,17 @@
         ife.setValidRange(1, 60);
         addField(ife);
 
+        ComboFieldEditor cfe = new ComboFieldEditor(PreferenceInitializer.ATTR_HPROF_ACTION,
+                "HPROF Action:", new String[][] {
+                    { "Save to disk", HProfHandler.ACTION_SAVE },
+                    { "Open in Eclipse", HProfHandler.ACTION_OPEN },
+                }, getFieldEditorParent());
+        addField(cfe);
+
+        ife = new IntegerFieldEditor(PreferenceInitializer.ATTR_TIME_OUT,
+                "ADB connection time out (ms):", getFieldEditorParent());
+            addField(ife);
+
         RadioGroupFieldEditor rgfe = new RadioGroupFieldEditor(PreferenceInitializer.ATTR_LOG_LEVEL,
                 "Logging Level", 1, new String[][] {
                     { "Verbose", LogLevel.VERBOSE.getStringValue() },
@@ -74,7 +87,6 @@
                     },
                 getFieldEditorParent(), true);
         addField(rgfe);
-
     }
 
     public void init(IWorkbench workbench) {
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/DeviceView.java b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/DeviceView.java
index 30172f5..71efb50 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/DeviceView.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/DeviceView.java
@@ -17,38 +17,60 @@
 
 package com.android.ide.eclipse.ddms.views;
 
+import com.android.ddmlib.AndroidDebugBridge;
 import com.android.ddmlib.Client;
 import com.android.ddmlib.ClientData;
-import com.android.ddmlib.AndroidDebugBridge;
 import com.android.ddmlib.IDevice;
+import com.android.ddmlib.SyncService;
+import com.android.ddmlib.AndroidDebugBridge.IClientChangeListener;
+import com.android.ddmlib.ClientData.IHprofDumpHandler;
+import com.android.ddmlib.ClientData.MethodProfilingStatus;
+import com.android.ddmlib.SyncService.SyncResult;
+import com.android.ddmuilib.handler.BaseFileHandler;
+import com.android.ddmuilib.handler.MethodProfilingHandler;
 import com.android.ddmuilib.DevicePanel;
 import com.android.ddmuilib.ScreenShotDialog;
 import com.android.ddmuilib.DevicePanel.IUiSelectionListener;
 import com.android.ide.eclipse.ddms.DdmsPlugin;
 import com.android.ide.eclipse.ddms.DdmsPlugin.IDebugLauncher;
+import com.android.ide.eclipse.ddms.preferences.PreferenceInitializer;
 
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.IToolBarManager;
 import org.eclipse.jface.action.Separator;
 import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IActionBars;
 import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
 import org.eclipse.ui.part.ViewPart;
 
-public class DeviceView extends ViewPart implements IUiSelectionListener {
+import java.io.File;
+import java.io.IOException;
+
+public class DeviceView extends ViewPart implements IUiSelectionListener, IClientChangeListener {
 
     private final static boolean USE_SELECTED_DEBUG_PORT = true;
 
     public static final String ID =
         "com.android.ide.eclipse.ddms.views.DeviceView"; //$NON-NLS-1$
 
+    private static DeviceView sThis;
+
+    private Shell mParentShell;
     private DevicePanel mDeviceList;
+
     private Action mResetAdbAction;
     private Action mCaptureAction;
     private Action mUpdateThreadAction;
@@ -56,9 +78,117 @@
     private Action mGcAction;
     private Action mKillAppAction;
     private Action mDebugAction;
+    private Action mHprofAction;
+    private Action mTracingAction;
     private IDebugLauncher mDebugLauncher;
 
-    private static DeviceView sThis;
+    private ImageDescriptor mTracingStartImage;
+    private ImageDescriptor mTracingStopImage;
+
+    public class HProfHandler extends BaseFileHandler implements IHprofDumpHandler {
+        public final static String ACTION_SAVE ="hprof.save"; //$NON-NLS-1$
+        public final static String ACTION_OPEN = "hprof.open"; //$NON-NLS-1$
+
+        public final static String DOT_HPROF = ".hprof"; //$NON-NLS-1$
+
+        HProfHandler(Shell parentShell) {
+            super(parentShell);
+        }
+
+        public void onFailure(final Client client) {
+            mParentShell.getDisplay().asyncExec(new Runnable() {
+                public void run() {
+                    try {
+                        displayError("Unable to create HPROF file for application '%1$s'.\n" +
+                                "Check logcat for more information.",
+                                client.getClientData().getClientDescription());
+                    } finally {
+                        // this will make sure the dump hprof button is re-enabled for the
+                        // current selection. as the client is finished dumping an hprof file
+                        doSelectionChanged(mDeviceList.getSelectedClient());
+                    }
+                }
+            });
+        }
+
+        public void onSuccess(final String remoteFilePath, final Client client) {
+            mParentShell.getDisplay().asyncExec(new Runnable() {
+                public void run() {
+                    final IDevice device = client.getDevice();
+                    try {
+                        // get the sync service to pull the HPROF file
+                        final SyncService sync = client.getDevice().getSyncService();
+                        if (sync != null) {
+                            // get from the preference what action to take
+                            IPreferenceStore store = DdmsPlugin.getDefault().getPreferenceStore();
+                            String value = store.getString(PreferenceInitializer.ATTR_HPROF_ACTION);
+
+                            SyncResult result = null;
+                            if (ACTION_OPEN.equals(value)) {
+                                File temp = File.createTempFile("android", DOT_HPROF); //$NON-NLS-1$
+                                String tempPath = temp.getAbsolutePath();
+                                result = pull(sync, tempPath, remoteFilePath);
+                                if (result != null && result.getCode() == SyncService.RESULT_OK) {
+                                    open(tempPath);
+                                }
+                            } else {
+                                // default action is ACTION_SAVE
+                                result = promptAndPull(sync,
+                                        client.getClientData().getClientDescription() + DOT_HPROF,
+                                        remoteFilePath, "Save HPROF file");
+
+                            }
+
+                            if (result != null && result.getCode() != SyncService.RESULT_OK) {
+                                displayError(
+                                        "Unable to download HPROF file from device '%1$s'.\n\n%2$s",
+                                        device.getSerialNumber(), result.getMessage());
+                            }
+                        } else {
+                            displayError("Unable to download HPROF file from device '%1$s'.",
+                                    device.getSerialNumber());
+                        }
+                    } catch (Exception e) {
+                        displayError("Unable to download HPROF file from device '%1$s'.",
+                                device.getSerialNumber());
+
+                    } finally {
+                        // this will make sure the dump hprof button is re-enabled for the
+                        // current selection. as the client is finished dumping an hprof file
+                        doSelectionChanged(mDeviceList.getSelectedClient());
+                    }
+                }
+            });
+        }
+
+        private void open(String path) throws IOException, InterruptedException, PartInitException {
+            // make a temp file to convert the hprof into something
+            // readable by normal tools
+            File temp = File.createTempFile("android", DOT_HPROF);
+            String tempPath = temp.getAbsolutePath();
+
+            String[] command = new String[3];
+            command[0] = DdmsPlugin.getHprofConverter();
+            command[1] = path;
+            command[2] = tempPath;
+
+            Process p = Runtime.getRuntime().exec(command);
+            p.waitFor();
+
+            IFileStore fileStore =  EFS.getLocalFileSystem().getStore(new Path(tempPath));
+            if (!fileStore.fetchInfo().isDirectory() && fileStore.fetchInfo().exists()) {
+                IDE.openEditorOnFileStore(
+                        getSite().getWorkbenchWindow().getActivePage(),
+                        fileStore);
+            }
+        }
+
+        private void displayError(String format, Object... args) {
+            MessageDialog.openError(mParentShell, "HPROF Error",
+                    String.format(format, args));
+        }
+    }
+
 
     public DeviceView() {
         // the view is declared with allowMultiple="false" so we
@@ -86,6 +216,11 @@
 
     @Override
     public void createPartControl(Composite parent) {
+        mParentShell = parent.getShell();
+        ClientData.setHprofDumpHandler(new HProfHandler(mParentShell));
+        AndroidDebugBridge.addClientChangeListener(this);
+        ClientData.setMethodProfilingHandler(new MethodProfilingHandler(mParentShell));
+
         mDeviceList = new DevicePanel(DdmsPlugin.getImageLoader(), USE_SELECTED_DEBUG_PORT);
         mDeviceList.createPanel(parent);
         mDeviceList.addSelectionListener(this);
@@ -156,6 +291,18 @@
         mGcAction.setImageDescriptor(DdmsPlugin.getImageLoader()
                 .loadDescriptor(DevicePanel.ICON_GC));
 
+        mHprofAction = new Action() {
+            @Override
+            public void run() {
+                mDeviceList.dumpHprof();
+                doSelectionChanged(mDeviceList.getSelectedClient());
+            }
+        };
+        mHprofAction.setText("Dump HPROF file");
+        mHprofAction.setToolTipText("Dump HPROF file");
+        mHprofAction.setImageDescriptor(DdmsPlugin.getImageLoader()
+                .loadDescriptor(DevicePanel.ICON_HPROF));
+
         mUpdateHeapAction = new Action("Update Heap", IAction.AS_CHECK_BOX) {
             @Override
             public void run() {
@@ -178,6 +325,20 @@
         mUpdateThreadAction.setImageDescriptor(DdmsPlugin.getImageLoader()
                 .loadDescriptor(DevicePanel.ICON_THREAD));
 
+        mTracingAction = new Action() {
+            @Override
+            public void run() {
+                mDeviceList.toggleMethodProfiling();
+            }
+        };
+        mTracingAction.setText("Start Method Profiling");
+        mTracingAction.setToolTipText("Start Method Profiling");
+        mTracingStartImage = DdmsPlugin.getImageLoader().loadDescriptor(
+                DevicePanel.ICON_TRACING_START);
+        mTracingStopImage = DdmsPlugin.getImageLoader().loadDescriptor(
+                DevicePanel.ICON_TRACING_STOP);
+        mTracingAction.setImageDescriptor(mTracingStartImage);
+
         // check if there's already a debug launcher set up in the plugin class
         mDebugLauncher = DdmsPlugin.getRunningAppDebugLauncher();
 
@@ -191,14 +352,14 @@
 
                         // make sure the client can be debugged
                         switch (clientData.getDebuggerConnectionStatus()) {
-                            case ClientData.DEBUGGER_ERROR: {
+                            case ERROR: {
                                 Display display = DdmsPlugin.getDisplay();
                                 Shell shell = display.getActiveShell();
                                 MessageDialog.openError(shell, "Process Debug",
                                         "The process debug port is already in use!");
                                 return;
                             }
-                            case ClientData.DEBUGGER_ATTACHED: {
+                            case ATTACHED: {
                                 Display display = DdmsPlugin.getDisplay();
                                 Shell shell = display.getActiveShell();
                                 MessageDialog.openError(shell, "Process Debug",
@@ -270,6 +431,34 @@
 
             mUpdateThreadAction.setEnabled(true);
             mUpdateThreadAction.setChecked(selectedClient.isThreadUpdateEnabled());
+
+            ClientData data = selectedClient.getClientData();
+
+            if (data.hasFeature(ClientData.FEATURE_HPROF)) {
+                mHprofAction.setEnabled(data.hasPendingHprofDump() == false);
+                mHprofAction.setToolTipText("Dump HPROF file");
+            } else {
+                mHprofAction.setEnabled(false);
+                mHprofAction.setToolTipText("Dump HPROF file (not supported by this VM)");
+            }
+
+            if (data.hasFeature(ClientData.FEATURE_PROFILING)) {
+                mTracingAction.setEnabled(true);
+                if (data.getMethodProfilingStatus() == MethodProfilingStatus.ON) {
+                    mTracingAction.setToolTipText("Stop Method Profiling");
+                    mTracingAction.setText("Stop Method Profiling");
+                    mTracingAction.setImageDescriptor(mTracingStopImage);
+                } else {
+                    mTracingAction.setToolTipText("Start Method Profiling");
+                    mTracingAction.setImageDescriptor(mTracingStartImage);
+                    mTracingAction.setText("Start Method Profiling");
+                }
+            } else {
+                mTracingAction.setEnabled(false);
+                mTracingAction.setImageDescriptor(mTracingStartImage);
+                mTracingAction.setToolTipText("Start Method Profiling (not supported by this VM)");
+                mTracingAction.setText("Start Method Profiling");
+            }
         } else {
             if (USE_SELECTED_DEBUG_PORT) {
                 // set the client as the debug client
@@ -286,6 +475,15 @@
             mUpdateHeapAction.setEnabled(false);
             mUpdateThreadAction.setEnabled(false);
             mUpdateThreadAction.setChecked(false);
+            mHprofAction.setEnabled(false);
+
+            mHprofAction.setEnabled(false);
+            mHprofAction.setToolTipText("Dump HPROF file");
+
+            mTracingAction.setEnabled(false);
+            mTracingAction.setImageDescriptor(mTracingStartImage);
+            mTracingAction.setToolTipText("Start Method Profiling");
+            mTracingAction.setText("Start Method Profiling");
         }
     }
 
@@ -301,13 +499,16 @@
 
         // first in the menu
         IMenuManager menuManager = actionBars.getMenuManager();
+        menuManager.removeAll();
         menuManager.add(mDebugAction);
         menuManager.add(new Separator());
-        menuManager.add(mUpdateThreadAction);
         menuManager.add(mUpdateHeapAction);
-        menuManager.add(new Separator());
+        menuManager.add(mHprofAction);
         menuManager.add(mGcAction);
         menuManager.add(new Separator());
+        menuManager.add(mUpdateThreadAction);
+        menuManager.add(mTracingAction);
+        menuManager.add(new Separator());
         menuManager.add(mKillAppAction);
         menuManager.add(new Separator());
         menuManager.add(mCaptureAction);
@@ -316,14 +517,32 @@
 
         // and then in the toolbar
         IToolBarManager toolBarManager = actionBars.getToolBarManager();
+        toolBarManager.removeAll();
         toolBarManager.add(mDebugAction);
         toolBarManager.add(new Separator());
-        toolBarManager.add(mUpdateThreadAction);
         toolBarManager.add(mUpdateHeapAction);
+        toolBarManager.add(mHprofAction);
+        toolBarManager.add(mGcAction);
+        toolBarManager.add(new Separator());
+        toolBarManager.add(mUpdateThreadAction);
+        toolBarManager.add(mTracingAction);
         toolBarManager.add(new Separator());
         toolBarManager.add(mKillAppAction);
         toolBarManager.add(new Separator());
         toolBarManager.add(mCaptureAction);
     }
 
+    public void clientChanged(final Client client, int changeMask) {
+        if ((changeMask & Client.CHANGE_METHOD_PROFILING_STATUS) ==
+                Client.CHANGE_METHOD_PROFILING_STATUS) {
+            if (mDeviceList.getSelectedClient() == client) {
+                mParentShell.getDisplay().asyncExec(new Runnable() {
+                    public void run() {
+                        // force refresh of the button enabled state.
+                        doSelectionChanged(client);
+                    }
+                });
+            }
+        }
+    }
 }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/.classpath b/tools/eclipse/plugins/com.android.ide.eclipse.tests/.classpath
index 5762668..1209191 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/.classpath
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/.classpath
@@ -4,8 +4,11 @@
 	<classpathentry kind="src" path="unittests"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="lib" path="kxml2-2.3.0.jar"/>
 	<classpathentry kind="lib" path="/adt/sdklib.jar" sourcepath="/SdkLib"/>
+	<classpathentry kind="lib" path="/adt/sdkuilib.jar" sourcepath="/SdkUiLib"/>
 	<classpathentry kind="lib" path="/adt/layoutlib_api.jar" sourcepath="/layoutlib_api"/>
+	<classpathentry kind="lib" path="/adt/ninepatch.jar"/>
+	<classpathentry kind="lib" path="layoutlib.jar"/>
+	<classpathentry kind="lib" path="kxml2-2.3.0.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/.gitignore b/tools/eclipse/plugins/com.android.ide.eclipse.tests/.gitignore
new file mode 100644
index 0000000..d392f0e
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/.gitignore
@@ -0,0 +1 @@
+*.jar
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF b/tools/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
index a93bdef..fac3e99 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Android Plugin Tests
 Bundle-SymbolicName: com.android.ide.eclipse.tests
-Bundle-Version: 0.9.3.qualifier
+Bundle-Version: 0.9.5.qualifier
 Bundle-Activator: com.android.ide.eclipse.tests.AndroidTestPlugin
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
@@ -18,4 +18,5 @@
 Bundle-ClassPath: kxml2-2.3.0.jar,
  .,
  layoutlib_api.jar,
- sdklib.jar
+ sdklib.jar,
+ layoutlib.jar
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/build.properties b/tools/eclipse/plugins/com.android.ide.eclipse.tests/build.properties
index 8649a77..a97e147 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/build.properties
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/build.properties
@@ -7,6 +7,10 @@
                prefs.template,\
                unittest.xml,\
                kxml2-2.3.0.jar,\
-               unittests/data/,\
                sdklib.jar,\
-               layoutlib_api.jar
+               layoutlib_api.jar,\
+               layoutlib.jar,\
+               unittests/com/android/sdklib/testdata/,\
+               unittests/com/android/layoutlib/testdata/,\
+               unittests/com/android/ide/eclipse/testdata/
+
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/sdk/TestLayoutDevicesXsd.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/sdk/TestLayoutDevicesXsd.java
new file mode 100755
index 0000000..8aa8ee0
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/sdk/TestLayoutDevicesXsd.java
@@ -0,0 +1,332 @@
+/*

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.eclipse.org/org/documents/epl-v10.php

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package com.android.ide.eclipse.adt.internal.sdk;

+

+import org.xml.sax.ErrorHandler;

+import org.xml.sax.SAXException;

+import org.xml.sax.SAXParseException;

+

+import java.io.InputStream;

+import java.io.StringReader;

+

+import javax.xml.transform.Source;

+import javax.xml.transform.stream.StreamSource;

+import javax.xml.validation.Validator;

+

+import junit.framework.TestCase;

+

+/**

+ * Tests local validation of a Layout-Devices sample XMLs using an XML Schema validator.

+ */

+public class TestLayoutDevicesXsd extends TestCase {

+

+    @Override

+    protected void setUp() throws Exception {

+        super.setUp();

+    }

+

+    @Override

+    protected void tearDown() throws Exception {

+        super.tearDown();

+    }

+

+    /**

+     * A SAX error handler that captures the errors and warnings.

+     * This allows us to capture *all* errors and just not get an exception on the first one.

+     */

+    private static class CaptureErrorHandler implements ErrorHandler {

+

+        private String mWarnings = "";

+        private String mErrors = "";

+

+        @SuppressWarnings("unused")

+        public String getErrors() {

+            return mErrors;

+        }

+

+        @SuppressWarnings("unused")

+        public String getWarnings() {

+            return mWarnings;

+        }

+

+        /**

+         * Verifies if the handler captures some errors or warnings.

+         * Prints them on stderr.

+         * Also fails the unit test if any error was generated.

+         */

+        public void verify() {

+            if (mWarnings.length() > 0) {

+                System.err.println(mWarnings);

+            }

+

+            if (mErrors.length() > 0) {

+                System.err.println(mErrors);

+                fail(mErrors);

+            }

+        }

+

+        /**

+         * @throws SAXException

+         */

+        public void error(SAXParseException ex) throws SAXException {

+            mErrors += "Error: " + ex.getMessage() + "\n";

+        }

+

+        /**

+         * @throws SAXException

+         */

+        public void fatalError(SAXParseException ex) throws SAXException {

+            mErrors += "Fatal Error: " + ex.getMessage() + "\n";

+        }

+

+        /**

+         * @throws SAXException

+         */

+        public void warning(SAXParseException ex) throws SAXException {

+            mWarnings += "Warning: " + ex.getMessage() + "\n";

+        }

+

+    }

+

+    // --- Helpers ------------

+

+    /** An helper that validates a string against an expected regexp. */

+    private void assertRegex(String expectedRegexp, String actualString) {

+        assertNotNull(actualString);

+        assertTrue(

+                String.format("Regexp Assertion Failed:\nExpected: %s\nActual: %s\n",

+                        expectedRegexp, actualString),

+                actualString.matches(expectedRegexp));

+    }

+

+    public void checkFailure(String document, String regexp) throws Exception {

+        Source source = new StreamSource(new StringReader(document));

+

+        // don't capture the validator errors, we want it to fail and catch the exception

+        Validator validator = LayoutDevicesXsd.getValidator(null);

+        try {

+            validator.validate(source);

+        } catch (SAXParseException e) {

+            // We expect a parse expression referring to this grammar rule

+            assertRegex(regexp, e.getMessage());

+            return;

+        }

+        // If we get here, the validator has not failed as we expected it to.

+        fail();

+    }

+

+    public void checkSuccess(String document) throws Exception {

+        Source source = new StreamSource(new StringReader(document));

+

+        CaptureErrorHandler handler = new CaptureErrorHandler();

+        Validator validator = LayoutDevicesXsd.getValidator(null);

+        validator.validate(source);

+        handler.verify();

+    }

+

+    // --- Tests ------------

+

+    /** Validate a valid sample using an InputStream */

+    public void testValidateLocalRepositoryFile() throws Exception {

+

+        InputStream xmlStream =

+            TestLayoutDevicesXsd.class.getResourceAsStream("config_sample.xml");

+        Source source = new StreamSource(xmlStream);

+

+        CaptureErrorHandler handler = new CaptureErrorHandler();

+        Validator validator = LayoutDevicesXsd.getValidator(handler);

+        validator.validate(source);

+        handler.verify();

+    }

+

+    /** A document should at least have a root to be valid */

+    public void testEmptyXml() throws Exception {

+        checkFailure(

+                // document

+                "<?xml version=\"1.0\"?>",

+

+                // expected failure

+                "Premature end of file.*");

+    }

+

+    /** A document with an unknown element. */

+    public void testUnknownContentXml() throws Exception {

+        checkFailure(

+                // document

+                "<?xml version=\"1.0\"?>" +

+                "<d:layout-devices xmlns:d=\"http://schemas.android.com/sdk/android/layout-devices/1\" >" +

+                "<d:unknown />" +

+                "</d:layout-devices>",

+

+                // expected failure

+                "cvc-complex-type.2.4.a: Invalid content was found.*");

+    }

+

+    /** A document with an missing attribute in a device element. */

+    public void testIncompleteContentXml() throws Exception {

+        checkFailure(

+                // document

+                "<?xml version=\"1.0\"?>" +

+                "<d:layout-devices xmlns:d=\"http://schemas.android.com/sdk/android/layout-devices/1\" >" +

+                "<d:device />" +

+                "</d:layout-devices>",

+

+                // expected failure

+                "cvc-complex-type.4: Attribute 'name' must appear on element 'd:device'.");

+    }

+

+    /** A document with a root element containing no device element is not valid. */

+    public void testEmptyRootXml() throws Exception {

+        checkFailure(

+                // document

+                "<?xml version=\"1.0\"?>" +

+                "<d:layout-devices xmlns:d=\"http://schemas.android.com/sdk/android/layout-devices/1\" />",

+

+                // expected failure

+                "cvc-complex-type.2.4.b: The content of element 'd:layout-devices' is not complete.*");

+    }

+

+    /** A document with an empty device element is not valid. */

+    public void testEmptyDeviceXml() throws Exception {

+        checkFailure(

+                // document

+                "<?xml version=\"1.0\"?>" +

+                "<d:layout-devices xmlns:d=\"http://schemas.android.com/sdk/android/layout-devices/1\" >" +

+                "<d:device name=\"foo\"/>" +

+                "</d:layout-devices>",

+

+                // expected failure

+                "cvc-complex-type.2.4.b: The content of element 'd:device' is not complete.*");

+    }

+

+    /** A document with two default elements in a device element is not valid. */

+    public void testTwoDefaultsXml() throws Exception {

+        checkFailure(

+                // document

+                "<?xml version=\"1.0\"?>" +

+                "<d:layout-devices xmlns:d=\"http://schemas.android.com/sdk/android/layout-devices/1\" >" +

+                "<d:device name=\"foo\">" +

+                "  <d:default />" +

+                "  <d:default />" +

+                "</d:device>" +

+                "</d:layout-devices>",

+

+                // expected failure

+                "cvc-complex-type.2.4.a: Invalid content was found starting with element 'd:default'.*");

+    }

+

+    /** The default elements must be defined before the config one. It's invalid if after. */

+    public void testDefaultConfigOrderXml() throws Exception {

+        checkFailure(

+                // document

+                "<?xml version=\"1.0\"?>" +

+                "<d:layout-devices xmlns:d=\"http://schemas.android.com/sdk/android/layout-devices/1\" >" +

+                "<d:device name=\"foo\">" +

+                "  <d:config name=\"must-be-after-default\" />" +

+                "  <d:default />" +

+                "</d:device>" +

+                "</d:layout-devices>",

+

+                // expected failure

+                "cvc-complex-type.2.4.a: Invalid content was found starting with element 'd:default'.*");

+    }

+

+    /** Screen dimension cannot be 0. */

+    public void testScreenDimZeroXml() throws Exception {

+        checkFailure(

+                // document

+                "<?xml version=\"1.0\"?>" +

+                "<d:layout-devices xmlns:d=\"http://schemas.android.com/sdk/android/layout-devices/1\" >" +

+                "<d:device name=\"foo\">" +

+                "  <d:default>" +

+                "    <d:screen-dimension> <d:size>0</d:size> <d:size>1</d:size> </d:screen-dimension>" +

+                "  </d:default>" +

+                "</d:device>" +

+                "</d:layout-devices>",

+

+                // expected failure

+                "cvc-minInclusive-valid: Value '0' is not facet-valid with respect to minInclusive '1'.*");

+    }

+

+    /** Screen dimension cannot be negative. */

+    public void testScreenDimNegativeXml() throws Exception {

+        checkFailure(

+                // document

+                "<?xml version=\"1.0\"?>" +

+                "<d:layout-devices xmlns:d=\"http://schemas.android.com/sdk/android/layout-devices/1\" >" +

+                "<d:device name=\"foo\">" +

+                "  <d:default>" +

+                "    <d:screen-dimension> <d:size>-5</d:size> <d:size>1</d:size> </d:screen-dimension>" +

+                "  </d:default>" +

+                "</d:device>" +

+                "</d:layout-devices>",

+

+                // expected failure

+                "cvc-minInclusive-valid: Value '-5' is not facet-valid with respect to minInclusive '1'.*");

+    }

+

+    /** X/Y dpi cannot be 0. */

+    public void testXDpiZeroXml() throws Exception {

+        checkFailure(

+                // document

+                "<?xml version=\"1.0\"?>" +

+                "<d:layout-devices xmlns:d=\"http://schemas.android.com/sdk/android/layout-devices/1\" >" +

+                "<d:device name=\"foo\">" +

+                "  <d:default>" +

+                "    <d:xdpi>0</d:xdpi>" +

+                "  </d:default>" +

+                "</d:device>" +

+                "</d:layout-devices>",

+

+                // expected failure

+                "cvc-minExclusive-valid: Value '0' is not facet-valid with respect to minExclusive '0.0E1'.*");

+    }

+

+

+    /** X/Y dpi cannot be negative. */

+    public void testXDpiNegativeXml() throws Exception {

+        checkFailure(

+                // document

+                "<?xml version=\"1.0\"?>" +

+                "<d:layout-devices xmlns:d=\"http://schemas.android.com/sdk/android/layout-devices/1\" >" +

+                "<d:device name=\"foo\">" +

+                "  <d:default>" +

+                "    <d:xdpi>-3.1415926538</d:xdpi>" +

+                "  </d:default>" +

+                "</d:device>" +

+                "</d:layout-devices>",

+

+                // expected failure

+                "cvc-minExclusive-valid: Value '-3.1415926538' is not facet-valid with respect to minExclusive '0.0E1'.*");

+    }

+

+    /** WHitespace around token is accepted by the schema. */

+    public void testTokenWhitespaceXml() throws Exception {

+        checkSuccess(

+                // document

+                "<?xml version=\"1.0\"?>" +

+                "<d:layout-devices xmlns:d=\"http://schemas.android.com/sdk/android/layout-devices/1\" >" +

+                "<d:device name=\"foo\">" +

+                "  <d:config name='foo'>" +

+                "    <d:screen-ratio>  \n long \r </d:screen-ratio>" +

+                "  </d:config>" +

+                "</d:device>" +

+                "</d:layout-devices>");

+    }

+

+}

+

diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/sdk/config_sample.xml b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/sdk/config_sample.xml
new file mode 100755
index 0000000..56a753f
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/sdk/config_sample.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0"?>

+<!--

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.eclipse.org/org/documents/epl-v10.php

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+-->

+<d:layout-devices

+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+    xmlns:d="http://schemas.android.com/sdk/android/layout-devices/1">

+

+    <d:device name="MyDevice">        <!-- 1..n -->

+        <d:default>                   <!-- 0..1 -->

+            <d:screen-size>small</d:screen-size>

+            <d:screen-ratio>long</d:screen-ratio>

+            <d:screen-orientation>port</d:screen-orientation>

+            <d:pixel-density>ldpi</d:pixel-density>

+            <d:touch-type>notouch</d:touch-type>

+            <d:keyboard-state>keysexposed</d:keyboard-state>

+            <d:text-input-method>nokeys</d:text-input-method>

+            <d:nav-method>dpad</d:nav-method>

+            <d:screen-dimension>

+                <d:size>240</d:size>    <!-- 2 * int>0 -->

+                <d:size>480</d:size>

+            </d:screen-dimension>

+            <d:xdpi>180.81234</d:xdpi>

+            <d:ydpi>180.81234</d:ydpi>

+        </d:default>

+

+        <d:config name="Portrait">

+            <d:keyboard-state>keyshidden</d:keyboard-state>

+            <d:screen-orientation>port</d:screen-orientation>

+        </d:config>

+        <d:config name="Landscape, closed">

+            <d:keyboard-state>keyshidden</d:keyboard-state>

+            <d:screen-orientation>land</d:screen-orientation>

+        </d:config>

+        <d:config name="Landscape, open">

+            <d:keyboard-state>keysexposed</d:keyboard-state>

+            <d:screen-orientation>land</d:screen-orientation>

+        </d:config>

+

+        <d:config name="screen-size-small">

+            <d:screen-size>small</d:screen-size>

+        </d:config>

+        <d:config name="screen-size-normal">

+            <d:screen-size>normal</d:screen-size>

+        </d:config>

+        <d:config name="screen-size-large">

+            <d:screen-size>large</d:screen-size>

+        </d:config>

+

+        <d:config name="screen-ratio-long">

+            <d:screen-ratio>long</d:screen-ratio>

+        </d:config>

+        <d:config name="screen-ratio-notlong">

+            <d:screen-ratio>notlong</d:screen-ratio>

+        </d:config>

+

+        <d:config name="screen-orientation-port">

+            <d:screen-orientation>port</d:screen-orientation>

+        </d:config>

+        <d:config name="screen-orientation-land">

+            <d:screen-orientation>land</d:screen-orientation>

+        </d:config>

+        <d:config name="screen-orientation-square">

+            <d:screen-orientation>square</d:screen-orientation>

+        </d:config>

+

+        <d:config name="pixel-density-ldpi">

+            <d:pixel-density>ldpi</d:pixel-density>

+        </d:config>

+        <d:config name="pixel-density-mdpi">

+            <d:pixel-density>mdpi</d:pixel-density>

+        </d:config>

+        <d:config name="pixel-density-hdpi">

+            <d:pixel-density>hdpi</d:pixel-density>

+        </d:config>

+

+        <d:config name="touch-type-notouch">

+            <d:touch-type>notouch</d:touch-type>

+        </d:config>

+        <d:config name="touch-type-stylus">

+            <d:touch-type>stylus</d:touch-type>

+        </d:config>

+        <d:config name="touch-type-finger">

+            <d:touch-type>finger</d:touch-type>

+        </d:config>

+

+        <d:config name="text-input-method-nokeys">

+            <d:text-input-method>nokeys</d:text-input-method>

+        </d:config>

+        <d:config name="text-input-method-qwerty">

+            <d:text-input-method>qwerty</d:text-input-method>

+        </d:config>

+        <d:config name="text-input-method-12key">

+            <d:text-input-method>12key</d:text-input-method>

+        </d:config>

+

+        <d:config name="nav-method-dpad">

+            <d:nav-method>dpad</d:nav-method>

+        </d:config>

+        <d:config name="nav-method-trackball">

+            <d:nav-method>trackball</d:nav-method>

+        </d:config>

+        <d:config name="nav-method-wheel">

+            <d:nav-method>wheel</d:nav-method>

+        </d:config>

+        <d:config name="nav-method-nonav">

+            <d:nav-method>nonav</d:nav-method>

+        </d:config>

+

+        <d:config name="xdpi">

+            <d:xdpi>240</d:xdpi>

+        </d:config>

+        <d:config name="ydpi">

+            <d:ydpi>2800</d:ydpi>

+        </d:config>

+

+    </d:device>

+

+    <d:device name="SomePhone">       <!-- 1..n -->

+        <d:config name="screen-size-normal">

+            <d:screen-size>normal</d:screen-size>

+        </d:config>

+    </d:device>

+

+</d:layout-devices>

diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubProjectCreationPage.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubProjectCreationPage.java
new file mode 100644
index 0000000..0ed9ed4
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubProjectCreationPage.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * 
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License"); you
+ * may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ * 
+ *      http://www.eclipse.org/org/documents/epl-v10.php
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.android.ide.eclipse.adt.wizards.newproject;
+
+import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectCreationPage;
+import com.android.sdklib.IAndroidTarget;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * Stub class for project creation page.
+ * <p/>
+ * Returns canned responses for creating a sample project.
+ */
+public class StubProjectCreationPage extends NewProjectCreationPage {
+
+    private final String mProjectName;
+    private final String mLocation;
+    private final IAndroidTarget mTarget;
+
+    public StubProjectCreationPage(String projectName, String projectLocation, IAndroidTarget target) {
+        super();
+        this.mProjectName = projectName;
+        this.mLocation = projectLocation;
+        this.mTarget = target;
+        // don't set test project info
+        setTestInfo(null);
+    }
+
+    @Override
+    public IMainInfo getMainInfo() {
+        return new IMainInfo() {
+            public String getProjectName() {
+                return mProjectName;
+            }
+
+            public String getPackageName() {
+                return "com.android.samples";
+            }
+
+            public String getActivityName() {
+                return mProjectName;
+            }
+
+            public String getApplicationName() {
+                return mProjectName;
+            }
+
+            public boolean isNewProject() {
+                return false;
+            }
+
+            public String getSourceFolder() {
+                return "src";
+            }
+
+            public IPath getLocationPath() {
+                return new Path(mLocation);
+            }
+
+            public String getMinSdkVersion() {
+                return null;
+            }
+
+            public IAndroidTarget getSdkTarget() {
+                return mTarget;
+            }
+
+            public boolean isCreateActivity() {
+                return false;
+            }
+
+            public boolean useDefaultLocation() {
+                return false;
+            }
+        };
+    }
+}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubProjectWizard.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubProjectWizard.java
new file mode 100644
index 0000000..18a29cc
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubProjectWizard.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License"); you
+ * may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ *      http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.android.ide.eclipse.adt.wizards.newproject;
+
+import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectCreationPage;
+import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectWizard;
+import com.android.ide.eclipse.adt.internal.wizards.newproject.NewTestProjectCreationPage;
+import com.android.sdklib.IAndroidTarget;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.widgets.Shell;
+
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * Stub class for project creation wizard.
+ * <p/>
+ * Created so project creation logic can be run without UI creation/manipulation.
+ */
+public class StubProjectWizard extends NewProjectWizard {
+
+    private final String mProjectName;
+    private final String mProjectLocation;
+    private final IAndroidTarget mTarget;
+
+    /**
+     * Constructor
+     *
+     * @param projectName
+     * @param projectLocation
+     * @parama target
+     */
+    public StubProjectWizard(String projectName, String projectLocation, IAndroidTarget target) {
+        this.mProjectName = projectName;
+        this.mProjectLocation = projectLocation;
+        this.mTarget = target;
+    }
+
+    /**
+     * Override parent to return stub page
+     */
+    @Override
+    protected NewProjectCreationPage createMainPage() {
+        return new StubProjectCreationPage(mProjectName, mProjectLocation, mTarget);
+    }
+
+    /**
+     * Override parent to return null page
+     */
+    @Override
+    protected NewTestProjectCreationPage createTestPage() {
+        return null;
+    }
+
+    /**
+     * Overrides parent to return dummy wizard container
+     */
+    @Override
+    public IWizardContainer getContainer() {
+        return new IWizardContainer() {
+
+            public IWizardPage getCurrentPage() {
+                return null;
+            }
+
+            public Shell getShell() {
+                return null;
+            }
+
+            public void showPage(IWizardPage page) {
+                // pass
+            }
+
+            public void updateButtons() {
+                // pass
+            }
+
+            public void updateMessage() {
+                // pass
+            }
+
+            public void updateTitleBar() {
+                // pass
+            }
+
+            public void updateWindowTitle() {
+                // pass
+            }
+
+            /**
+             * Executes runnable on current thread
+             */
+            public void run(boolean fork, boolean cancelable,
+                    IRunnableWithProgress runnable)
+                    throws InvocationTargetException, InterruptedException {
+                runnable.run(new NullProgressMonitor());
+            }
+
+        };
+    }
+}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubSampleProjectCreationPage.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubSampleProjectCreationPage.java
deleted file mode 100644
index 75b6d9b..0000000
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubSampleProjectCreationPage.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * 
- * Licensed under the Eclipse Public License, Version 1.0 (the "License"); you
- * may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- * 
- *      http://www.eclipse.org/org/documents/epl-v10.php
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.android.ide.eclipse.adt.wizards.newproject;
-
-import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectCreationPage;
-import com.android.sdklib.IAndroidTarget;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
-import java.io.File;
-
-/**
- * Stub class for project creation page Returns canned responses for creating a
- * sample project
- */
-public class StubSampleProjectCreationPage extends NewProjectCreationPage {
-
-    private String mSampleProjectName;
-    private String mOsSdkLocation;
-
-    public StubSampleProjectCreationPage(String sampleProjectName, String osSdkLocation) {
-        super();
-        this.mSampleProjectName = sampleProjectName;
-        this.mOsSdkLocation = osSdkLocation;
-    }
-
-    @Override
-    public IMainInfo getMainInfo() {
-        return new IMainInfo() {
-            public String getProjectName() {
-                return mSampleProjectName;
-            }
-
-            public String getPackageName() {
-                return "com.android.samples";
-            }
-
-            public String getActivityName() {
-                return mSampleProjectName;
-            }
-
-            public String getApplicationName() {
-                return mSampleProjectName;
-            }
-
-            public boolean isNewProject() {
-                return false;
-            }
-
-            public String getSourceFolder() {
-                return "src";
-            }
-
-            public IPath getLocationPath() {
-                return new Path(mOsSdkLocation + File.separator +
-                        "samples" + File.separator +
-                        mSampleProjectName);
-            }
-
-            public String getMinSdkVersion() {
-                return null;
-            }
-
-            public IAndroidTarget getSdkTarget() {
-                return null;
-            }
-
-            public boolean isCreateActivity() {
-                return false;
-            }
-
-            public boolean useDefaultLocation() {
-                return false;
-            }
-        };
-    }
-}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubSampleProjectWizard.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubSampleProjectWizard.java
deleted file mode 100644
index 28c2c7e..0000000
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/wizards/newproject/StubSampleProjectWizard.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * 
- * Licensed under the Eclipse Public License, Version 1.0 (the "License"); you
- * may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- * 
- *      http://www.eclipse.org/org/documents/epl-v10.php
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.android.ide.eclipse.adt.wizards.newproject;
-
-import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectCreationPage;
-import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectWizard;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.IWizardContainer;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.swt.widgets.Shell;
-
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * Stub class for project creation wizard Created so project creation logic can
- * be run without UI creation/manipulation Returns canned responses for creating
- * a sample project
- */
-public class StubSampleProjectWizard extends NewProjectWizard {
-
-    private final String mSampleProjectName;
-    private final String mOsSdkLocation;
-
-    /**
-     * Constructor
-     * 
-     * @param sampleProjectName
-     * @param osSdkLocation
-     */
-    public StubSampleProjectWizard(String sampleProjectName, String osSdkLocation) {
-        this.mSampleProjectName = sampleProjectName;
-        this.mOsSdkLocation = osSdkLocation;
-    }
-
-    /**
-     * Override parent to return stub page
-     */
-    @Override
-    protected NewProjectCreationPage createMainPage() {
-        return new StubSampleProjectCreationPage(mSampleProjectName, mOsSdkLocation);
-    }
-
-    /**
-     * Overrides parent to return dummy wizard container
-     */
-    @Override
-    public IWizardContainer getContainer() {
-        return new IWizardContainer() {
-
-            public IWizardPage getCurrentPage() {
-                return null;
-            }
-
-            public Shell getShell() {
-                return null;
-            }
-
-            public void showPage(IWizardPage page) {
-                // pass
-            }
-
-            public void updateButtons() {
-                // pass
-            }
-
-            public void updateMessage() {
-                // pass
-            }
-
-            public void updateTitleBar() {
-                // pass
-            }
-
-            public void updateWindowTitle() {
-                // pass
-            }
-
-            /**
-             * Executes runnable on current thread
-             */
-            public void run(boolean fork, boolean cancelable,
-                    IRunnableWithProgress runnable)
-                    throws InvocationTargetException, InterruptedException {
-                runnable.run(new NullProgressMonitor());
-            }
-
-        };
-    }
-}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtTestData.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtTestData.java
index 6d13737..281170e 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtTestData.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/AdtTestData.java
@@ -1,12 +1,12 @@
 /*
  * Copyright (C) 2008 The Android Open Source Project
- * 
+ *
  * Licensed under the Eclipse Public License, Version 1.0 (the "License"); you
  * may not use this file except in compliance with the License. You may obtain a
  * copy of the License at
- * 
+ *
  * http://www.eclipse.org/org/documents/epl-v10.php
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -27,57 +27,53 @@
 
 /**
  * Helper class for retrieving test data
- * 
- * All tests which need to retrieve test data files should go through this class 
- *
+ * <p/>
+ * All tests which need to retrieve paths to test data files should go through this class.
  */
 public class AdtTestData {
 
     /** singleton instance */
     private static AdtTestData sInstance = null;
     private static final Logger sLogger = Logger.getLogger(AdtTestData.class.getName());
-    
-    /** the absolute file path to the /data directory in this test 
-     * environment. 
-     */
+
+    /** The absolute file path to the plugin's contents. */
     private String mOsRootDataPath;
-    
-   
+
     private AdtTestData() {
-        // can set test_data env variable to override default behavior of 
+        // can set test_data env variable to override default behavior of
         // finding data using class loader
-        // useful when running in plugin environment, where test data is inside 
-        // bundled jar, and must be extracted to temp filesystem location to be 
+        // useful when running in plugin environment, where test data is inside
+        // bundled jar, and must be extracted to temp filesystem location to be
         // accessed normally
         mOsRootDataPath = System.getProperty("test_data");
         if (mOsRootDataPath == null) {
             sLogger.info("Cannot find test_data environment variable, init to class loader");
-            URL url = this.getClass().getClassLoader().getResource("data");  //$NON-NLS-1$
+            URL url = this.getClass().getClassLoader().getResource(".");  //$NON-NLS-1$
 
-                if (Platform.isRunning()) {
-                    sLogger.info("Running as an Eclipse Plug-in JUnit test, using FileLocator");
-                    try {
-                        mOsRootDataPath = FileLocator.resolve(url).getFile();
-                    } catch (IOException e) {
-                        sLogger.warning("IOException while using FileLocator, reverting to url");
-                        mOsRootDataPath = url.getFile();
-                    }
-                } else {
-                    sLogger.info("Running as an plain JUnit test, using url as-is");
-                    mOsRootDataPath = url.getFile();                        
+            if (Platform.isRunning()) {
+                sLogger.info("Running as an Eclipse Plug-in JUnit test, using FileLocator");
+                try {
+                    mOsRootDataPath = FileLocator.resolve(url).getFile();
+                } catch (IOException e) {
+                    sLogger.warning("IOException while using FileLocator, reverting to url");
+                    mOsRootDataPath = url.getFile();
                 }
+            } else {
+                sLogger.info("Running as an plain JUnit test, using url as-is");
+                mOsRootDataPath = url.getFile();
+            }
         }
-        
-        if (mOsRootDataPath.equals(AndroidConstants.WS_SEP + "data")) {
+
+        if (mOsRootDataPath.equals(AndroidConstants.WS_SEP)) {
             sLogger.warning("Resource data not found using class loader!, Defaulting to no path");
         }
-        
+
         if (!mOsRootDataPath.endsWith(File.separator)) {
             sLogger.info("Fixing test_data env variable (does not end with path separator)");
             mOsRootDataPath = mOsRootDataPath.concat(File.separator);
         }
     }
-    
+
     /** Get the singleton instance of AdtTestData */
     public static AdtTestData getInstance() {
         if (sInstance == null) {
@@ -85,12 +81,14 @@
         }
         return sInstance;
     }
-    
-    /** Returns the absolute file path to a file located in this plugins
-     * "data" directory
-     * @param osRelativePath - string path to file contained in /data. Must 
+
+    /**
+     * Returns the absolute file path to a file located in this plugin.
+     *
+     * @param osRelativePath {@link String} path to file contained in plugin. Must
      * use path separators appropriate to host OS
-     * @return String
+     *
+     * @return absolute OS path to test file
      */
     public String getTestFilePath(String osRelativePath) {
         return mOsRootDataPath + osRelativePath;
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/FuncTestCase.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/FuncTestCase.java
deleted file mode 100644
index 4322727..0000000
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/FuncTestCase.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License"); you
- * may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.android.ide.eclipse.tests;
-
-import junit.framework.TestCase;
-
-/**
- * Generic superclass for Eclipse Android functional test cases, that provides
- * common facilities
- */
-public class FuncTestCase extends TestCase {
-
-    private String mOsSdkLocation;
-
-    /**
-     * Constructor
-     *
-     * @throws IllegalArgumentException if environment variable "sdk_home" is
-     *         not set
-     */
-    protected FuncTestCase() {
-        mOsSdkLocation = System.getProperty("sdk_home");
-        if (mOsSdkLocation == null) {
-            mOsSdkLocation = System.getenv("sdk_home");
-        }
-        if (mOsSdkLocation == null || mOsSdkLocation.length() < 1) {
-            throw new IllegalArgumentException(
-                    "Environment variable sdk_home is not set");
-        }
-    }
-
-    /**
-     * Returns the absolute file system path of the Android SDK location to use
-     * for this test
-     */
-    protected String getOsSdkLocation() {
-        return mOsSdkLocation;
-    }
-
-
-}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/FuncTests.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/FuncTests.java
index 02c9247..efa8801 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/FuncTests.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/FuncTests.java
@@ -16,7 +16,6 @@
 package com.android.ide.eclipse.tests;
 
 import com.android.ide.eclipse.tests.functests.layoutRendering.ApiDemosRenderingTest;
-import com.android.ide.eclipse.tests.functests.sampleProjects.SampleProjectTest;
 
 import junit.framework.TestSuite;
 
@@ -39,7 +38,8 @@
     public static TestSuite suite() {
         TestSuite suite = new TestSuite();
 
-        suite.addTestSuite(SampleProjectTest.class);
+        // TODO: uncomment this when 'gen' folder error on create is fixed
+        // suite.addTestSuite(SampleProjectTest.class);
         suite.addTestSuite(ApiDemosRenderingTest.class);
 
         return suite;
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkTestCase.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkTestCase.java
new file mode 100644
index 0000000..7f2eef6
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/SdkTestCase.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License"); you
+ * may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.android.ide.eclipse.tests;
+
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetParser;
+import com.android.ide.eclipse.adt.internal.sdk.LoadStatus;
+import com.android.ide.eclipse.adt.internal.sdk.Sdk;
+import com.android.sdklib.IAndroidTarget;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+import junit.framework.TestCase;
+
+/**
+ * A test case which uses the SDK loaded by the ADT plugin.
+ */
+public abstract class SdkTestCase extends TestCase {
+
+    private Sdk mSdk;
+
+    protected SdkTestCase() {
+    }
+
+    /**
+     * Retrieve the {@link Sdk} under test.
+     */
+    protected Sdk getSdk() {
+        if (mSdk == null) {
+            mSdk = loadSdk();
+            assertNotNull(mSdk);
+            validateSdk(mSdk);
+        }
+        return mSdk;
+    }
+
+    /**
+     * Gets the current SDK from ADT, waiting if necessary.
+     */
+    private Sdk loadSdk() {
+        AdtPlugin adt = AdtPlugin.getDefault();
+        Object sdkLock = adt.getSdkLockObject();
+        LoadStatus loadStatus = LoadStatus.LOADING;
+        // wait for ADT to load the SDK on a separate thread
+        // loop max of 600 times * 200 ms =  2 minutes
+        final int maxWait = 600;
+        for (int i=0; i < maxWait && loadStatus == LoadStatus.LOADING; i++) {
+            try {
+                Thread.sleep(200);
+            }
+            catch (InterruptedException e) {
+                // ignore
+            }
+            synchronized(sdkLock) {
+                loadStatus = adt.getSdkLoadStatus();
+            }
+        }
+        Sdk sdk = null;
+        synchronized(sdkLock) {
+            assertEquals(LoadStatus.LOADED, loadStatus);
+            sdk = Sdk.getCurrent();
+        }
+        assertNotNull(sdk);
+        return sdk;
+    }
+
+    /**
+     * Checks that the provided sdk contains one or more valid targets.
+     * @param sdk the {@link Sdk} to validate.
+     */
+    private void validateSdk(Sdk sdk) {
+        assertTrue("sdk has no targets", sdk.getTargets().length > 0);
+        for (IAndroidTarget target : sdk.getTargets()) {
+            IStatus status = new AndroidTargetParser(target).run(new NullProgressMonitor());
+            if (status.getCode() != IStatus.OK) {
+                fail("Failed to parse targets data");
+            }
+        }
+    }
+}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/UnitTests.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/UnitTests.java
index 67e7cb2..6c1510c 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/UnitTests.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/UnitTests.java
@@ -31,16 +31,17 @@
  * 
  */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
 public class UnitTests {
-    private static final String TEST_PACKAGE = "com.android.ide.eclipse";
+    private static final String TEST_PACKAGE = "com.android";
     
     public static Test suite() {
         TestSuite suite = new TestSuite();
-        
+
         UnitTestCollector collector = new UnitTestCollector();
         collector.addTestCases(suite, AndroidTestPlugin.getDefault(), TEST_PACKAGE);
+
         return suite;
     }
-    
+
     /**
      * Specialized test collector which will skip adding functional tests
      */
@@ -54,5 +55,4 @@
             !testClass.getPackage().getName().startsWith(FuncTests.FUNC_TEST_PACKAGE);
         }
     }
-
 }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
index 14e0080..1bbce87 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
@@ -17,14 +17,29 @@
 package com.android.ide.eclipse.tests.functests.layoutRendering;
 
 import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
+import com.android.ide.eclipse.adt.internal.resources.configurations.KeyboardStateQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.NavigationMethodQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenDimensionQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenOrientationQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenRatioQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenSizeQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.TextInputMethodQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.TouchScreenQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.KeyboardStateQualifier.KeyboardState;
+import com.android.ide.eclipse.adt.internal.resources.configurations.NavigationMethodQualifier.NavigationMethod;
+import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier.Density;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenOrientationQualifier.ScreenOrientation;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenRatioQualifier.ScreenRatio;
+import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenSizeQualifier.ScreenSize;
+import com.android.ide.eclipse.adt.internal.resources.configurations.TextInputMethodQualifier.TextInputMethod;
+import com.android.ide.eclipse.adt.internal.resources.configurations.TouchScreenQualifier.TouchScreenType;
 import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources;
 import com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager;
 import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
-import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetParser;
 import com.android.ide.eclipse.adt.internal.sdk.LoadStatus;
-import com.android.ide.eclipse.adt.internal.sdk.Sdk;
 import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData.LayoutBridge;
-import com.android.ide.eclipse.tests.FuncTestCase;
+import com.android.ide.eclipse.tests.SdkTestCase;
 import com.android.layoutlib.api.ILayoutResult;
 import com.android.layoutlib.api.IProjectCallback;
 import com.android.layoutlib.api.IResourceValue;
@@ -32,8 +47,6 @@
 import com.android.sdklib.IAndroidTarget;
 import com.android.sdklib.SdkConstants;
 
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
 import org.kxml2.io.KXmlParser;
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
@@ -46,7 +59,7 @@
 
 import javax.imageio.ImageIO;
 
-public class ApiDemosRenderingTest extends FuncTestCase {
+public class ApiDemosRenderingTest extends SdkTestCase {
 
     /**
      * Custom parser that implements {@link IXmlPullParser} (which itself extends
@@ -103,32 +116,12 @@
 
     }
 
-    private Sdk mSdk;
-
     public void testApiDemos() throws IOException, XmlPullParserException {
-        loadSdk();
         findApiDemos();
     }
 
-    /**
-     * Loads the {@link Sdk}.
-     */
-    private void loadSdk() {
-        mSdk = Sdk.loadSdk(this.getOsSdkLocation());
-
-        int n = mSdk.getTargets().length;
-        if (n > 0) {
-            for (IAndroidTarget target : mSdk.getTargets()) {
-                IStatus status = new AndroidTargetParser(target).run(new NullProgressMonitor());
-                if (status.getCode() != IStatus.OK) {
-                    fail("Failed to parse targets data");
-                }
-            }
-        }
-    }
-
     private void findApiDemos() throws IOException, XmlPullParserException {
-        IAndroidTarget[] targets = mSdk.getTargets();
+        IAndroidTarget[] targets = getSdk().getTargets();
 
         for (IAndroidTarget target : targets) {
             String path = target.getPath(IAndroidTarget.SAMPLES);
@@ -148,7 +141,7 @@
     }
 
     private void testSample(IAndroidTarget target, File sampleProject) throws IOException, XmlPullParserException {
-        AndroidTargetData data = mSdk.getTargetData(target);
+        AndroidTargetData data = getSdk().getTargetData(target);
         if (data == null) {
             fail("No AndroidData!");
         }
@@ -205,6 +198,7 @@
                     null /*projectKey*/,
                     320,
                     480,
+                    false, //renderFullSize
                     160, //density
                     160, //xdpi
                     160, // ydpi
@@ -234,9 +228,26 @@
         }
     }
 
+    /**
+     * Returns a config. This must be a valid config like a device would return. This is to
+     * prevent issues where some resources don't exist in all cases and not in the default
+     * (for instance only available in hdpi and mdpi but not in default).
+     * @return
+     */
     private FolderConfiguration getConfiguration() {
         FolderConfiguration config = new FolderConfiguration();
 
+        // this matches an ADP1.
+        config.addQualifier(new ScreenSizeQualifier(ScreenSize.NORMAL));
+        config.addQualifier(new ScreenRatioQualifier(ScreenRatio.NOTLONG));
+        config.addQualifier(new ScreenOrientationQualifier(ScreenOrientation.PORTRAIT));
+        config.addQualifier(new PixelDensityQualifier(Density.MEDIUM));
+        config.addQualifier(new TouchScreenQualifier(TouchScreenType.FINGER));
+        config.addQualifier(new KeyboardStateQualifier(KeyboardState.HIDDEN));
+        config.addQualifier(new TextInputMethodQualifier(TextInputMethod.QWERTY));
+        config.addQualifier(new NavigationMethodQualifier(NavigationMethod.TRACKBALL));
+        config.addQualifier(new ScreenDimensionQualifier(480, 320));
+
         return config;
     }
 }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/AndroidManifestWriter.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/AndroidManifestWriter.java
new file mode 100644
index 0000000..495c3be
--- /dev/null
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/AndroidManifestWriter.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License"); you
+ * may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ *      http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.android.ide.eclipse.tests.functests.sampleProjects;
+
+import com.android.ide.eclipse.adt.internal.project.AndroidManifestParser;
+import com.android.sdklib.SdkConstants;
+import com.android.sdklib.xml.AndroidManifest;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+/**
+ * Helper class for modifying an AndroidManifest.
+ * <p/>
+ * TODO: consider merging this with AndroidManifestParser.
+ */
+class AndroidManifestWriter {
+
+    private static final Logger sLogger = Logger.getLogger(AndroidManifestWriter.class.getName());
+
+    private final Document mDoc;
+    private final String mOsManifestFilePath;
+
+    private AndroidManifestWriter(Document doc, String osManifestFilePath) {
+        mDoc = doc;
+        mOsManifestFilePath = osManifestFilePath;
+    }
+
+    /**
+     * Sets the minimum SDK version for this manifest
+     * @param minSdkVersion - the minimim sdk version to use
+     * @returns <code>true</code> on success, false otherwise
+     */
+    public boolean setMinSdkVersion(String minSdkVersion) {
+        Element usesSdkElement = null;
+        NodeList nodeList = mDoc.getElementsByTagName(AndroidManifest.NODE_USES_SDK);
+        if (nodeList.getLength() > 0) {
+            usesSdkElement = (Element) nodeList.item(0);
+        } else {
+            usesSdkElement = mDoc.createElement(AndroidManifest.NODE_USES_SDK);
+            mDoc.getDocumentElement().appendChild(usesSdkElement);
+        }
+        Attr minSdkAttr = mDoc.createAttributeNS(SdkConstants.NS_RESOURCES,
+                AndroidManifest.ATTRIBUTE_MIN_SDK_VERSION);
+        String prefix = mDoc.lookupPrefix(SdkConstants.NS_RESOURCES);
+        minSdkAttr.setPrefix(prefix);
+        minSdkAttr.setValue(minSdkVersion);
+        usesSdkElement.setAttributeNodeNS(minSdkAttr);
+        return saveXmlToFile();
+    }
+
+    private boolean saveXmlToFile() {
+        try {
+            // Prepare the DOM document for writing
+            Source source = new DOMSource(mDoc);
+
+            // Prepare the output file
+            File file = new File(mOsManifestFilePath);
+            Result result = new StreamResult(file);
+
+            // Write the DOM document to the file
+            Transformer xformer = TransformerFactory.newInstance().newTransformer();
+            xformer.transform(source, result);
+        } catch (TransformerConfigurationException e) {
+            sLogger.log(Level.SEVERE, "Failed to write xml file", e);
+            return false;
+        } catch (TransformerException e) {
+            sLogger.log(Level.SEVERE, "Failed to write xml file", e);
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Parses the manifest file, and collects data.
+     *
+     * @param osManifestFilePath The OS path of the manifest file to parse.
+     * @return an {@link AndroidManifestParser} or null if parsing failed
+     */
+    public static AndroidManifestWriter parse(String osManifestFilePath) {
+        try {
+            DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+            docFactory.setNamespaceAware(true);
+            DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
+            Document doc = docBuilder.parse(osManifestFilePath);
+            return new AndroidManifestWriter(doc, osManifestFilePath);
+        } catch (ParserConfigurationException e) {
+            sLogger.log(Level.SEVERE, "Error parsing file", e);
+            return null;
+        } catch (SAXException e) {
+            sLogger.log(Level.SEVERE, "Error parsing file", e);
+            return null;
+        } catch (IOException e) {
+            sLogger.log(Level.SEVERE, "Error parsing file", e);
+            return null;
+        }
+    }
+}
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/SampleProjectTest.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/SampleProjectTest.java
index 54fcb99..d33b939 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/SampleProjectTest.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/sampleProjects/SampleProjectTest.java
@@ -1,12 +1,12 @@
 /*
  * Copyright (C) 2008 The Android Open Source Project
- * 
+ *
  * Licensed under the Eclipse Public License, Version 1.0 (the "License"); you
  * may not use this file except in compliance with the License. You may obtain a
  * copy of the License at
- * 
+ *
  *      http://www.eclipse.org/org/documents/epl-v10.php
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -15,85 +15,126 @@
  */
 package com.android.ide.eclipse.tests.functests.sampleProjects;
 
-import com.android.ide.eclipse.adt.internal.project.ProjectHelper;
-import com.android.ide.eclipse.adt.wizards.newproject.StubSampleProjectWizard;
-import com.android.ide.eclipse.tests.FuncTestCase;
+import com.android.ide.eclipse.adt.AndroidConstants;
+import com.android.ide.eclipse.adt.wizards.newproject.StubProjectWizard;
+import com.android.ide.eclipse.tests.SdkTestCase;
+import com.android.sdklib.IAndroidTarget;
 
+import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IResourceChangeEvent;
 import org.eclipse.core.resources.IResourceChangeListener;
 import org.eclipse.core.resources.IResourceDelta;
 import org.eclipse.core.resources.IResourceDeltaVisitor;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.swt.widgets.Display;
 
+import java.io.File;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 /**
- * Test case that verifies all SDK sample projects can be imported, built in
- * Eclipse
- * 
+ * Test case that verifies all SDK sample projects can be imported, and built in
+ * Eclipse.
+ * <p/>
  * TODO: add support for deploying apps onto emulator and verifying successful
  * execution there
- * 
+ *
  */
-public class SampleProjectTest extends FuncTestCase {
-    
+public class SampleProjectTest extends SdkTestCase {
+
     private static final Logger sLogger = Logger.getLogger(SampleProjectTest.class.getName());
 
     /**
-     * Tests the sample project with the given name
-     * 
-     * @param name - name of sample project to test
+     * Finds all samples projects in set SDK and verify they can be built in Eclipse.
+     * <p/>
+     * TODO: add install and run on emulator test
+     * @throws CoreException
      */
-    protected void doTestSampleProject(String name) {
-        try {
-
-            StubSampleProjectWizard newProjCreator = new StubSampleProjectWizard(
-                    name, getOsSdkLocation());
-            newProjCreator.init(null, null);
-            newProjCreator.performFinish();
-
-            IProject iproject = validateProjectExists(name);
-
-            validateNoProblems(iproject);
-
-        } 
-        catch (CoreException e) {
-            fail("Unexpected exception when creating sample project: " + e.toString());
+    public void testSamples() throws CoreException {
+        // TODO: For reporting purposes, it would be better if a separate test success or failure
+        // could be reported for each sample
+        IAndroidTarget[] targets = getSdk().getTargets();
+        for (IAndroidTarget target : targets) {
+            doTestSamplesForTarget(target);
         }
     }
 
-    public void testApiDemos() {
-        doTestSampleProject("ApiDemos");
+    private void doTestSamplesForTarget(IAndroidTarget target) throws CoreException {
+        String path = target.getPath(IAndroidTarget.SAMPLES);
+        File samples = new File(path);
+        if (samples.isDirectory()) {
+            File[] files = samples.listFiles();
+            for (File file : files) {
+                if (file.isDirectory()) {
+                    doTestSampleProject(file.getName(), file.getAbsolutePath(), target);
+                }
+            }
+        }
     }
 
-    public void testHelloActivity() {
-        doTestSampleProject("HelloActivity");
+    /**
+     * Tests the sample project with the given name
+     *
+     * @param target - SDK target of project
+     * @param name - name of sample project to test
+     * @param path - absolute file system path
+     * @throws CoreException
+     */
+    private void doTestSampleProject(String name, String path, IAndroidTarget target)
+             throws CoreException {
+        IProject iproject = null;
+        try {
+            sLogger.log(Level.INFO, String.format("Testing sample %s for target %s", name,
+                    target.getName()));
+
+            prepareProject(path, target);
+
+            final StubProjectWizard newProjCreator = new StubProjectWizard(
+                    name, path, target);
+            newProjCreator.init(null, null);
+            // need to run finish on ui thread since it invokes a perspective switch
+            Display.getDefault().syncExec(new Runnable() {
+                public void run() {
+                    newProjCreator.performFinish();
+                }
+            });
+
+            iproject = validateProjectExists(name);
+            validateNoProblems(iproject);
+        }
+        catch (CoreException e) {
+            sLogger.log(Level.SEVERE,
+                    String.format("Unexpected exception when creating sample project %s " +
+                            "for target %s", name, target.getName()));
+            throw e;
+        } finally {
+            if (iproject != null) {
+                iproject.delete(false, true, new NullProgressMonitor());
+            }
+        }
     }
 
-    public void testLunarLander() {
-        doTestSampleProject("LunarLander");
-    }
-
-    public void testNotePad() {
-        doTestSampleProject("NotePad");
-    }
-
-    public void testSkeletonApp() {
-        doTestSampleProject("SkeletonApp");
-    }
-
-    public void testSnake() {
-        doTestSampleProject("Snake");
+    private void prepareProject(String path, IAndroidTarget target) {
+        if (target.getVersion().isPreview()) {
+            // need to explicitly set preview's version in manifest for project to compile
+            final String manifestPath = path + File.separatorChar +
+                    AndroidConstants.FN_ANDROID_MANIFEST;
+            AndroidManifestWriter manifestWriter =
+                AndroidManifestWriter.parse(manifestPath);
+            assertNotNull(String.format("could not read manifest %s", manifestPath),
+                    manifestWriter);
+            assertTrue(manifestWriter.setMinSdkVersion(target.getVersion().getApiString()));
+        }
     }
 
     private IProject validateProjectExists(String name) {
         IProject iproject = getIProject(name);
-        assertTrue(iproject.exists());
-        assertTrue(iproject.isOpen());
+        assertTrue(String.format("%s project not created", name), iproject.exists());
+        assertTrue(String.format("%s project not opened", name), iproject.isOpen());
         return iproject;
     }
 
@@ -105,17 +146,34 @@
 
     private void validateNoProblems(IProject iproject) throws CoreException {
         waitForBuild(iproject);
-        assertFalse(ProjectHelper.hasError(iproject, true));
-    }
 
+        boolean hasErrors = false;
+        StringBuilder failureBuilder = new StringBuilder(String.format("%s project has errors:",
+                iproject.getName()));
+        IMarker[] markers = iproject.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
+        if (markers != null && markers.length > 0) {
+            // the project has marker(s). even though they are "problem" we
+            // don't know their severity. so we loop on them and figure if they
+            // are warnings or errors
+            for (IMarker m : markers) {
+                int s = m.getAttribute(IMarker.SEVERITY, -1);
+                if (s == IMarker.SEVERITY_ERROR) {
+                    hasErrors = true;
+                    failureBuilder.append("\n");
+                    failureBuilder.append(m.getAttribute(IMarker.MESSAGE, ""));
+                }
+            }
+        }
+        assertFalse(failureBuilder.toString(), hasErrors);
+    }
 
     /**
      * Waits for build to complete.
-     * 
+     *
      * @param iproject
      */
     private void waitForBuild(final IProject iproject) {
-       
+
         final BuiltProjectDeltaVisitor deltaVisitor = new BuiltProjectDeltaVisitor(iproject);
         IResourceChangeListener newBuildListener = new IResourceChangeListener() {
 
@@ -127,9 +185,9 @@
                     fail();
                 }
             }
-            
+
         };
-        iproject.getWorkspace().addResourceChangeListener(newBuildListener, 
+        iproject.getWorkspace().addResourceChangeListener(newBuildListener,
           IResourceChangeEvent.POST_BUILD);
 
         // poll build listener to determine when build is done
@@ -143,32 +201,31 @@
                 Thread.sleep(50);
             }
             catch (InterruptedException e) {
-                
+                // ignore
             }
            if (Display.getCurrent() != null) {
                Display.getCurrent().readAndDispatch();
            }
         }
-        
-        sLogger.log(Level.SEVERE, "expected build event never happened?");
-        fail("expected build event never happened for " + iproject.getName());
 
+        sLogger.log(Level.SEVERE, "expected build event never happened?");
+        fail(String.format("Expected build event never happened for %s", iproject.getName()));
     }
-    
+
     /**
      * Scans a given IResourceDelta looking for a "build event" change for given IProject
-     * 
+     *
      */
     private class BuiltProjectDeltaVisitor implements IResourceDeltaVisitor {
 
         private IProject mIProject;
         private boolean  mIsBuilt;
-        
+
         public BuiltProjectDeltaVisitor(IProject iproject) {
             mIProject = iproject;
             mIsBuilt = false;
         }
-        
+
         public boolean visit(IResourceDelta delta) {
             if (mIProject.equals(delta.getResource())) {
                 setBuilt(true);
@@ -176,7 +233,7 @@
             }
             return true;
         }
-        
+
         private synchronized void setBuilt(boolean b) {
             mIsBuilt = b;
         }
@@ -184,6 +241,5 @@
         public synchronized boolean isProjectBuilt() {
             return mIsBuilt;
         }
-        
     }
 }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/test.xml b/tools/eclipse/plugins/com.android.ide.eclipse.tests/test.xml
index 792ebc2..e5519b0 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/test.xml
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/test.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<!-- test launcher file for Android Eclipse functional tests -->
+<!-- test launcher file for Android Eclipse tests -->
 <project name="testsuite" default="run" basedir="."> 
     <!--The following properties should be passed into this script, set to some default value for now -->
     <property name="eclipse.home" value="/opt/eclipse" />
@@ -52,9 +52,9 @@
         <ant target="ui-test" antfile="${library-file}" dir="${eclipse.home}">
             <property name="data-dir" value="${test-folder}" />
             <property name="plugin-name" value="${plugin-name}" />
-            <property name="classname" value="com.android.ide.eclipse.tests.FuncTests" />
-            <!-- pass extra vm arg to set sdk_home env variable -->
-            <property name="extraVMargs" value="-Dsdk_home=${sdk_home}" />
+            <property name="classname" value="com.android.ide.eclipse.tests.AllTests" />
+            <!-- pass extra vm arg to set sdk_home env and test_data env variable -->
+            <property name="extraVMargs" value="-Dtest_data=${test_data}" />
         </ant>
     </target>
 
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/PixelDensityQualifierTest.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/PixelDensityQualifierTest.java
index 23107a1..658d4d2 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/PixelDensityQualifierTest.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/PixelDensityQualifierTest.java
@@ -18,6 +18,7 @@
 
 import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
 import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier.Density;
 
 import junit.framework.TestCase;
 
@@ -41,16 +42,16 @@
     }
 
     public void testCheckAndSet() {
-        assertEquals(true, pdq.checkAndSet("123dpi", config));//$NON-NLS-1$
+        assertEquals(true, pdq.checkAndSet("ldpi", config));//$NON-NLS-1$
         assertTrue(config.getPixelDensityQualifier() != null);
-        assertEquals(123, config.getPixelDensityQualifier().getValue());
-        assertEquals("123dpi", config.getPixelDensityQualifier().toString()); //$NON-NLS-1$
+        assertEquals(Density.LOW, config.getPixelDensityQualifier().getValue());
+        assertEquals("ldpi", config.getPixelDensityQualifier().toString()); //$NON-NLS-1$
     }
 
     public void testFailures() {
         assertEquals(false, pdq.checkAndSet("", config));//$NON-NLS-1$
         assertEquals(false, pdq.checkAndSet("dpi", config));//$NON-NLS-1$
-        assertEquals(false, pdq.checkAndSet("123DPI", config));//$NON-NLS-1$
+        assertEquals(false, pdq.checkAndSet("123dpi", config));//$NON-NLS-1$
         assertEquals(false, pdq.checkAndSet("123", config));//$NON-NLS-1$
         assertEquals(false, pdq.checkAndSet("sdfdpi", config));//$NON-NLS-1$
     }
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/ConfigMatchTest.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/ConfigMatchTest.java
index 7601648..c0533ed 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/ConfigMatchTest.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/ConfigMatchTest.java
@@ -88,13 +88,16 @@
                 null, // network code
                 null, // language
                 null, // region
+                null, // screen size
+                null, // screen ratio
                 null, // screen orientation
                 null, // dpi
                 null, // touch mode
                 null, // keyboard state
                 null, // text input
                 null, // navigation
-                null); // screen size
+                null, // screen dimension
+                null);// version
 
         addFolder(mResources, defaultConfig, validMemberList);
 
@@ -103,13 +106,16 @@
                 null, // network code
                 "en", // language
                 null, // region
+                null, // screen size
+                null, // screen ratio
                 null, // screen orientation
                 null, // dpi
                 null, // touch mode
                 KeyboardState.EXPOSED.getValue(), // keyboard state
                 null, // text input
                 null, // navigation
-                null); // screen size
+                null, // screen dimension
+                null);// version
 
         addFolder(mResources, config1, validMemberList);
 
@@ -118,13 +124,16 @@
                 null, // network code
                 "en", // language
                 null, // region
+                null, // screen size
+                null, // screen ratio
                 null, // screen orientation
                 null, // dpi
                 null, // touch mode
                 KeyboardState.HIDDEN.getValue(), // keyboard state
                 null, // text input
                 null, // navigation
-                null); // screen size
+                null, // screen dimension
+                null);// version
 
         addFolder(mResources, config2, validMemberList);
 
@@ -133,13 +142,16 @@
                 null, // network code
                 "en", // language
                 null, // region
+                null, // screen size
+                null, // screen ratio
                 ScreenOrientation.LANDSCAPE.getValue(), // screen orientation
                 null, // dpi
                 null, // touch mode
                 null, // keyboard state
                 null, // text input
                 null, // navigation
-                null); // screen size
+                null, // screen dimension
+                null);// version
 
         addFolder(mResources, config3, validMemberList);
 
@@ -148,13 +160,16 @@
                 "mnc435", // network code
                 "en", // language
                 "rUS", // region
+                "normal", // screen size
+                "notlong", // screen ratio
                 ScreenOrientation.LANDSCAPE.getValue(), // screen orientation
-                "160dpi", // dpi
+                "mdpi", // dpi
                 TouchScreenType.FINGER.getValue(), // touch mode
                 KeyboardState.EXPOSED.getValue(), // keyboard state
                 TextInputMethod.QWERTY.getValue(), // text input
                 NavigationMethod.DPAD.getValue(), // navigation
-                "480x320"); // screen size
+                "480x320", // screen dimension
+                "v3"); // version
 
         addFolder(mResources, config4, invalidMemberList);
     }
@@ -171,13 +186,16 @@
                 "mnc435", // network code
                 "en", // language
                 "rUS", // region
+                "normal", // screen size
+                "notlong", // screen ratio
                 ScreenOrientation.LANDSCAPE.getValue(), // screen orientation
-                "160dpi", // dpi
+                "mdpi", // dpi
                 TouchScreenType.FINGER.getValue(), // touch mode
                 KeyboardState.EXPOSED.getValue(), // keyboard state
                 TextInputMethod.QWERTY.getValue(), // text input
                 NavigationMethod.DPAD.getValue(), // navigation
-                "480x320"); // screen size
+                "480x320", // screen dimension
+                "v3"); // version
 
         ResourceFile result = mResources.getMatchingFile(SEARCHED_FILENAME,
                 ResourceFolderType.LAYOUT, testConfig);
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/project/AndroidManifestParserTest.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/project/AndroidManifestParserTest.java
index a28aacc..e05391c 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/project/AndroidManifestParserTest.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/project/AndroidManifestParserTest.java
@@ -28,58 +28,61 @@
 public class AndroidManifestParserTest extends TestCase {
     private AndroidManifestParser mManifestTestApp;
     private AndroidManifestParser mManifestInstrumentation;
-    
-    private static final String INSTRUMENTATION_XML = "AndroidManifest-instrumentation.xml";  //$NON-NLS-1$
-    private static final String TESTAPP_XML = "AndroidManifest-testapp.xml";  //$NON-NLS-1$
+
+    private static final String TESTDATA_PATH =
+        "com/android/ide/eclipse/testdata/";  //$NON-NLS-1$
+    private static final String INSTRUMENTATION_XML = TESTDATA_PATH +
+        "AndroidManifest-instrumentation.xml";  //$NON-NLS-1$
+    private static final String TESTAPP_XML = TESTDATA_PATH +
+        "AndroidManifest-testapp.xml";  //$NON-NLS-1$
     private static final String PACKAGE_NAME =  "com.android.testapp"; //$NON-NLS-1$
     private static final String ACTIVITY_NAME = "com.android.testapp.MainActivity"; //$NON-NLS-1$
     private static final String LIBRARY_NAME = "android.test.runner"; //$NON-NLS-1$
     private static final String INSTRUMENTATION_NAME = "android.test.InstrumentationTestRunner"; //$NON-NLS-1$
     private static final String INSTRUMENTATION_TARGET = "com.android.AndroidProject"; //$NON-NLS-1$
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
-        
-        String testFilePath = AdtTestData.getInstance().getTestFilePath(
-                TESTAPP_XML);
+
+        String testFilePath = AdtTestData.getInstance().getTestFilePath(TESTAPP_XML);
         mManifestTestApp = AndroidManifestParser.parseForData(testFilePath);
         assertNotNull(mManifestTestApp);
-        
-        testFilePath = AdtTestData.getInstance().getTestFilePath(
-                INSTRUMENTATION_XML);
+
+        testFilePath = AdtTestData.getInstance().getTestFilePath(INSTRUMENTATION_XML);
         mManifestInstrumentation = AndroidManifestParser.parseForData(testFilePath);
         assertNotNull(mManifestInstrumentation);
     }
 
     public void testGetInstrumentationInformation() {
         assertEquals(1, mManifestInstrumentation.getInstrumentations().length);
-        assertEquals(INSTRUMENTATION_NAME, 
+        assertEquals(INSTRUMENTATION_NAME,
                 mManifestInstrumentation.getInstrumentations()[0].getName());
-        assertEquals(INSTRUMENTATION_TARGET, 
+        assertEquals(INSTRUMENTATION_TARGET,
                 mManifestInstrumentation.getInstrumentations()[0].getTargetPackage());
     }
-    
+
     public void testGetPackage() {
         assertEquals(PACKAGE_NAME, mManifestTestApp.getPackage());
     }
 
     public void testGetActivities() {
         assertEquals(1, mManifestTestApp.getActivities().length);
-        Activity activity = new AndroidManifestParser.Activity(ACTIVITY_NAME, true);
-        activity.setHasAction(true);
-        activity.setHasLauncherCategory(true);
-        activity.setHasMainAction(true);
+        AndroidManifestParser.Activity activity = mManifestTestApp.getActivities()[0];
+        assertEquals(ACTIVITY_NAME, activity.getName());
+        assertTrue(activity.hasAction());
+        assertTrue(activity.isHomeActivity());
+        assertTrue(activity.hasAction());
         assertEquals(activity, mManifestTestApp.getActivities()[0]);
     }
 
     public void testGetLauncherActivity() {
-        Activity activity = new AndroidManifestParser.Activity(ACTIVITY_NAME, true);
-        activity.setHasAction(true);
-        activity.setHasLauncherCategory(true);
-        activity.setHasMainAction(true);
-        assertEquals(activity, mManifestTestApp.getLauncherActivity()); 
+        Activity activity = mManifestTestApp.getLauncherActivity();
+        assertEquals(ACTIVITY_NAME, activity.getName());
+        assertTrue(activity.hasAction());
+        assertTrue(activity.isHomeActivity());
     }
-    
+
     private void assertEquals(Activity lhs, Activity rhs) {
         assertTrue(lhs == rhs || (lhs != null && rhs != null));
         if (lhs != null && rhs != null) {
@@ -92,7 +95,7 @@
 
     public void testGetUsesLibraries() {
         assertEquals(1, mManifestTestApp.getUsesLibraries().length);
-        assertEquals(LIBRARY_NAME, mManifestTestApp.getUsesLibraries()[0]); 
+        assertEquals(LIBRARY_NAME, mManifestTestApp.getUsesLibraries()[0]);
     }
 
     public void testGetPackageName() {
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/AttrsXmlParserTest.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/AttrsXmlParserTest.java
index ac6ebf5..f5c16e7 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/AttrsXmlParserTest.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/resources/AttrsXmlParserTest.java
@@ -17,9 +17,6 @@
 package com.android.ide.eclipse.adt.internal.resources;
 
 
-import com.android.ide.eclipse.adt.internal.resources.AttrsXmlParser;
-import com.android.ide.eclipse.adt.internal.resources.DeclareStyleableInfo;
-import com.android.ide.eclipse.adt.internal.resources.ViewClassInfo;
 import com.android.ide.eclipse.adt.internal.resources.DeclareStyleableInfo.AttributeInfo;
 import com.android.ide.eclipse.adt.internal.resources.DeclareStyleableInfo.AttributeInfo.Format;
 import com.android.ide.eclipse.tests.AdtTestData;
@@ -32,20 +29,23 @@
 import junit.framework.TestCase;
 
 public class AttrsXmlParserTest extends TestCase {
-    
+
     private AttrsXmlParser mParser;
     private String mFilePath;
 
+    private static final String MOCK_DATA_PATH =
+        "com/android/ide/eclipse/testdata/mock_attrs.xml"; //$NON-NLS-1$
+
     @Override
     public void setUp() throws Exception {
-        mFilePath = AdtTestData.getInstance().getTestFilePath("mock_attrs.xml"); //$NON-NLS-1$
+        mFilePath = AdtTestData.getInstance().getTestFilePath(MOCK_DATA_PATH); //$NON-NLS-1$
         mParser = new AttrsXmlParser(mFilePath);
     }
 
     @Override
     public void tearDown() throws Exception {
     }
-    
+
     public final void testGetDocument() throws Exception {
         assertNotNull(_getDocument());
     }
@@ -53,12 +53,12 @@
     public void testGetOsAttrsXmlPath() throws Exception {
         assertEquals(mFilePath, mParser.getOsAttrsXmlPath());
     }
-    
+
     public final void testPreload() throws Exception {
         assertSame(mParser, mParser.preload());
     }
-    
-    
+
+
     public final void testLoadViewAttributes() throws Exception {
         mParser.preload();
         ViewClassInfo info = new ViewClassInfo(
@@ -66,7 +66,7 @@
                 "mock_android.something.Theme",      //$NON-NLS-1$
                 "Theme");                            //$NON-NLS-1$
         mParser.loadViewAttributes(info);
-        
+
         assertEquals("These are the standard attributes that make up a complete theme.", //$NON-NLS-1$
                 info.getJavaDoc());
         AttributeInfo[] attrs = info.getAttributes();
@@ -75,7 +75,7 @@
         assertEquals(1, info.getAttributes()[0].getFormats().length);
         assertEquals(Format.DIMENSION, info.getAttributes()[0].getFormats()[0]);
     }
-    
+
     public final void testEnumFlagValues() throws Exception {
         /* The XML being read contains:
             <!-- Standard orientation constant. -->
@@ -90,32 +90,32 @@
         mParser.preload();
         Map<String, Map<String, Integer>> attrMap = mParser.getEnumFlagValues();
         assertTrue(attrMap.containsKey("orientation"));
-        
+
         Map<String, Integer> valueMap = attrMap.get("orientation");
         assertTrue(valueMap.containsKey("horizontal"));
         assertTrue(valueMap.containsKey("vertical"));
         assertEquals(Integer.valueOf(0), valueMap.get("horizontal"));
         assertEquals(Integer.valueOf(1), valueMap.get("vertical"));
     }
-    
+
     public final void testDeprecated() throws Exception {
         mParser.preload();
-        
+
         DeclareStyleableInfo dep = mParser.getDeclareStyleableList().get("DeprecatedTest");
         assertNotNull(dep);
-        
+
         AttributeInfo[] attrs = dep.getAttributes();
         assertEquals(4, attrs.length);
 
         assertEquals("deprecated-inline", attrs[0].getName());
         assertEquals("In-line deprecated.", attrs[0].getDeprecatedDoc());
         assertEquals("Deprecated comments using delimiters.", attrs[0].getJavaDoc());
-        
+
         assertEquals("deprecated-multiline", attrs[1].getName());
         assertEquals("Multi-line version of deprecated that works till the next tag.",
                 attrs[1].getDeprecatedDoc());
         assertEquals("Deprecated comments on their own line.", attrs[1].getJavaDoc());
-        
+
         assertEquals("deprecated-not", attrs[2].getName());
         assertEquals(null, attrs[2].getDeprecatedDoc());
         assertEquals("This attribute is not deprecated.", attrs[2].getJavaDoc());
@@ -126,7 +126,7 @@
     }
 
     //---- access to private methods
-    
+
     private Document _getDocument() throws Exception {
         Method method = AttrsXmlParser.class.getDeclaredMethod("getDocument"); //$NON-NLS-1$
         method.setAccessible(true);
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/sdk/AndroidJarLoaderTest.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/sdk/AndroidJarLoaderTest.java
index 71c79be..f9178f1 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/sdk/AndroidJarLoaderTest.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/sdk/AndroidJarLoaderTest.java
@@ -40,7 +40,8 @@
     /** Creates an instance of {@link AndroidJarLoader} on our test data JAR */ 
     @Override
     public void setUp() throws Exception {
-        String jarfilePath = AdtTestData.getInstance().getTestFilePath("jar_example.jar");  //$NON-NLS-1$
+        String jarfilePath = AdtTestData.getInstance().getTestFilePath(
+                "com/android/ide/eclipse/testdata/jar_example.jar");  //$NON-NLS-1$
         mFrameworkClassLoader = new AndroidJarLoader(jarfilePath);
     }
 
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/sdk/LayoutParamsParserTest.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/sdk/LayoutParamsParserTest.java
index cf5f194..166b63d 100644
--- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/sdk/LayoutParamsParserTest.java
+++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/sdk/LayoutParamsParserTest.java
@@ -19,15 +19,12 @@
 import com.android.ide.eclipse.adt.internal.resources.AttrsXmlParser;
 import com.android.ide.eclipse.adt.internal.resources.ViewClassInfo;
 import com.android.ide.eclipse.adt.internal.resources.ViewClassInfo.LayoutParamsInfo;
-import com.android.ide.eclipse.adt.internal.sdk.AndroidJarLoader;
-import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetParser;
-import com.android.ide.eclipse.adt.internal.sdk.LayoutParamsParser;
 import com.android.ide.eclipse.adt.internal.sdk.AndroidJarLoader.ClassWrapper;
 import com.android.ide.eclipse.adt.internal.sdk.IAndroidClassLoader.IClassDescriptor;
+import com.android.ide.eclipse.tests.AdtTestData;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.TreeMap;
@@ -36,7 +33,7 @@
 
 /**
  * Test the inner private methods of PlatformDataParser.
- * 
+ *
  * Convention: method names that start with an underscore are actually local wrappers
  * that call private methods from {@link AndroidTargetParser} using reflection.
  * This is inspired by the Python coding rule which mandates underscores prefixes for
@@ -44,30 +41,26 @@
  */
 public class LayoutParamsParserTest extends TestCase {
 
+    private static final String MOCK_DATA_PATH =
+        "com/android/ide/eclipse/testdata/mock_attrs.xml"; //$NON-NLS-1$
+
     private static class MockFrameworkClassLoader extends AndroidJarLoader {
         MockFrameworkClassLoader() {
             super(null /* osFrameworkLocation */);
         }
-        
+
         @Override
         public HashMap<String, ArrayList<IClassDescriptor>> findClassesDerivingFrom(
                 String rootPackage, String[] superClasses) throws ClassFormatError {
             return new HashMap<String, ArrayList<IClassDescriptor>>();
         }
     }
-    
-    private static class MockAttrsXmlPath {
-        public String getPath() {
-            ClassLoader cl = this.getClass().getClassLoader();
-            URL res = cl.getResource("data/mock_attrs.xml");  //$NON-NLS-1$
-            return res.getFile();
-        }
-    }
-    
+
     private static class MockLayoutParamsParser extends LayoutParamsParser {
         public MockLayoutParamsParser() {
             super(new MockFrameworkClassLoader(),
-                  new AttrsXmlParser(new MockAttrsXmlPath().getPath()).preload());
+                  new AttrsXmlParser(
+                          AdtTestData.getInstance().getTestFilePath(MOCK_DATA_PATH)).preload());
 
             mTopViewClass = new ClassWrapper(mock_android.view.View.class);
             mTopGroupClass = new ClassWrapper(mock_android.view.ViewGroup.class);
@@ -82,7 +75,7 @@
     }
 
     private MockLayoutParamsParser mParser;
-    
+
     @Override
     public void setUp() throws Exception {
         mParser = new MockLayoutParamsParser();
@@ -91,7 +84,7 @@
     @Override
     public void tearDown() throws Exception {
     }
-    
+
     public final void testFindLayoutParams() throws Exception {
         assertEquals(mock_android.view.ViewGroup.LayoutParams.class,
             ((ClassWrapper)_findLayoutParams(mock_android.view.ViewGroup.class)).wrappedClass());
@@ -102,7 +95,7 @@
         assertEquals(mock_android.widget.TableLayout.LayoutParams.class,
             ((ClassWrapper)_findLayoutParams(mock_android.widget.TableLayout.class)).wrappedClass());
     }
-    
+
     public final void testGetLayoutParamsInfo() throws Exception {
         LayoutParamsInfo info1 = _getLayoutParamsInfo(
                 mock_android.view.ViewGroup.LayoutParams.class);
@@ -115,7 +108,7 @@
         assertNotNull(info2);
         // LinearLayout.LayoutData links to ViewGroup.LayoutParams
         assertSame(info1, info2.getSuperClass());
-        
+
         LayoutParamsInfo info3 = _getLayoutParamsInfo(
                 mock_android.widget.TableLayout.LayoutParams.class);
         assertNotNull(info3);
@@ -124,7 +117,7 @@
         assertNotSame(info1, info3.getSuperClass());
         assertNotSame(info2, info3.getSuperClass());
         // TableLayout.LayoutParams => ViewGroup.MarginLayoutParams => ViewGroup.LayoutParams
-        assertSame(info1, info3.getSuperClass().getSuperClass());        
+        assertSame(info1, info3.getSuperClass().getSuperClass());
     }
 
     public final void testGetLayoutClasses() throws Exception {
@@ -132,7 +125,7 @@
     }
 
     //---- access to private methods
-    
+
     /** Calls the private constructor of the parser */
     @SuppressWarnings("unused")
     private AndroidTargetParser _Constructor(String osJarPath) throws Exception {
@@ -141,7 +134,7 @@
         constructor.setAccessible(true);
         return constructor.newInstance(osJarPath);
     }
-    
+
     /** calls the private getLayoutClasses() of the parser */
     @SuppressWarnings("unused")
     private void _getLayoutClasses() throws Exception {
@@ -149,7 +142,7 @@
         method.setAccessible(true);
         method.invoke(mParser);
     }
-    
+
     /** calls the private addGroup() of the parser */
     @SuppressWarnings("unused")
     private ViewClassInfo _addGroup(Class<?> groupClass) throws Exception {
@@ -175,7 +168,7 @@
         method.setAccessible(true);
         return (LayoutParamsInfo) method.invoke(mParser, new ClassWrapper(layoutParamsClass));
     }
-    
+
     /** calls the private findLayoutParams() of the parser */
     private IClassDescriptor _findLayoutParams(Class<?> groupClass) throws Exception {
         Method method = LayoutParamsParser.class.getDeclaredMethod("findLayoutParams",  //$NON-NLS-1$
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/AndroidManifest-instrumentation.xml b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/AndroidManifest-instrumentation.xml
similarity index 100%
rename from tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/AndroidManifest-instrumentation.xml
rename to tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/AndroidManifest-instrumentation.xml
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/AndroidManifest-testapp.xml b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/AndroidManifest-testapp.xml
similarity index 100%
rename from tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/AndroidManifest-testapp.xml
rename to tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/AndroidManifest-testapp.xml
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/jar_example.jar b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/jar_example.jar
similarity index 100%
rename from tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/jar_example.jar
rename to tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/jar_example.jar
Binary files differ
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/jar_example.jardesc b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/jar_example.jardesc
similarity index 100%
rename from tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/jar_example.jardesc
rename to tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/jar_example.jardesc
diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/mock_attrs.xml b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/mock_attrs.xml
similarity index 100%
rename from tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/data/mock_attrs.xml
rename to tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/mock_attrs.xml
diff --git a/tools/eclipse/scripts/create_ddms_symlinks.sh b/tools/eclipse/scripts/create_ddms_symlinks.sh
index 276cf9b..87cdf68 100755
--- a/tools/eclipse/scripts/create_ddms_symlinks.sh
+++ b/tools/eclipse/scripts/create_ddms_symlinks.sh
@@ -65,12 +65,12 @@
     e.png edit.png empty.png emulator.png \
     forward.png \
     gc.png \
-    heap.png halt.png \
+    heap.png halt.png hprof.png \
     i.png importBug.png \
     load.png \
     pause.png play.png pull.png push.png \
     save.png \
-    thread.png \
+    thread.png tracing_start.png tracing_stop.png \
     up.png \
     v.png \
     w.png warning.png ; do
diff --git a/tools/eclipse/scripts/create_test_symlinks.sh b/tools/eclipse/scripts/create_test_symlinks.sh
index 931dce8..c52e3ab 100755
--- a/tools/eclipse/scripts/create_test_symlinks.sh
+++ b/tools/eclipse/scripts/create_test_symlinks.sh
@@ -15,6 +15,7 @@
 if [ "${HOST:0:6}" == "CYGWIN" ]; then
     # We can't use symlinks under Cygwin
     function cpdir() { # $1=dest $2=source
+        echo "rsync $2 => $1"
         rsync -avW --delete-after $2 $1
     }
 
@@ -32,23 +33,46 @@
 HOST=`uname`
 if [ "$HOST" == "Linux" ]; then
     ln -svf $BACK/out/host/linux-x86/framework/kxml2-2.3.0.jar "$DEST/"
+    ln -svf $BACK/out/host/linux-x86/framework/layoutlib.jar   "$DEST/"
 
 elif [ "$HOST" == "Darwin" ]; then
     ln -svf $BACK/out/host/darwin-x86/framework/kxml2-2.3.0.jar "$DEST/"
+    ln -svf $BACK/out/host/darwin-x86/framework/layoutlib.jar   "$DEST/"
 
 elif [ "${HOST:0:6}" == "CYGWIN" ]; then
-
     if [ ! -f "$DEST/kxml2-2.3.0.jar" ]; then
         cp -v "prebuilt/common/kxml2/kxml2-2.3.0.jar" "$DEST/"
-        chmod -v a+rx "$DEST"/*.jar
     fi
 
+    LIBS="layoutlib.jar"
+    NEED_MAKE="yes"
+    for LIB in $LIBS ; do
+        SRCJAR="out/host/windows-x86/framework/$LIB"
+        DSTJAR="$DEST/$LIB"
+        if [[ $NEED_MAKE ]] && ! diff -q "$SRCJAR" "$DSTJAR" >/dev/null ; then
+            MAKE_LIBS="${LIBS//.jar/}"
+            echo "Make java libs: $MAKE_LIBS"
+            make -j3 showcommands $MAKE_LIBS || die "adt-tests: Failed to build one of $LIBS."
+            NEED_MAKE=""
+        fi
+        
+        cp -v "$SRCJAR" "$DSTJAR"
+    done
+
+    chmod -v a+rx "$DEST"/*.jar
 else
     echo "Unsupported platform ($HOST). Nothing done."
 fi
 
 # create link to ddmlib tests
 DEST=$BASE/unittests/com/android
-BACK=`back $DEST`
 cpdir $DEST development/tools/ddms/libs/ddmlib/tests/src/com/android/ddmlib
+cpdir $DEST development/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib
 
+# Cleanup old obsolete symlink
+[[ -e $DEST/sdkuilib || -L $DEST/sdkuilib ]] && rm -rfv $DEST/sdkuilib
+
+DEST=$BASE/unittests/com/android/layoutlib
+mkdir -p $DEST
+cpdir $DEST frameworks/base/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge
+cpdir $DEST frameworks/base/tools/layoutlib/bridge/tests/com/android/layoutlib/testdata
diff --git a/tools/eclipse/sites/external/site.xml b/tools/eclipse/sites/external/site.xml
index a00d1a4..5956c3d 100644
--- a/tools/eclipse/sites/external/site.xml
+++ b/tools/eclipse/sites/external/site.xml
@@ -3,10 +3,10 @@
    <description url="https://dl-ssl.google.com/android/eclipse/">
       Update Site for Android Development Toolkit
    </description>
-   <feature url="features/com.android.ide.eclipse.adt_0.9.3.qualifier.jar" id="com.android.ide.eclipse.adt" version="0.9.3.qualifier">
+   <feature url="features/com.android.ide.eclipse.adt_0.9.5.qualifier.jar" id="com.android.ide.eclipse.adt" version="0.9.5.qualifier">
       <category name="developer"/>
    </feature>
-   <feature url="features/com.android.ide.eclipse.ddms_0.9.3.qualifier.jar" id="com.android.ide.eclipse.ddms" version="0.9.3.qualifier">
+   <feature url="features/com.android.ide.eclipse.ddms_0.9.5.qualifier.jar" id="com.android.ide.eclipse.ddms" version="0.9.5.qualifier">
       <category name="developer"/>
    </feature>
    <category-def name="developer" label="Developer Tools">
diff --git a/tools/eclipse/sites/internal/site.xml b/tools/eclipse/sites/internal/site.xml
index e19c119..3c71c10 100644
--- a/tools/eclipse/sites/internal/site.xml
+++ b/tools/eclipse/sites/internal/site.xml
@@ -3,13 +3,13 @@
    <description url="https://android.corp.google.com/adt/">
       Update Site for Android Development Toolkit
    </description>
-   <feature url="features/com.android.ide.eclipse.adt_0.9.3.qualifier.jar" id="com.android.ide.eclipse.adt" version="0.9.3.qualifier">
+   <feature url="features/com.android.ide.eclipse.adt_0.9.5.qualifier.jar" id="com.android.ide.eclipse.adt" version="0.9.5.qualifier">
       <category name="developer"/>
    </feature>
-   <feature url="features/com.android.ide.eclipse.ddms_0.9.3.qualifier.jar" id="com.android.ide.eclipse.ddms" version="0.9.3.qualifier">
+   <feature url="features/com.android.ide.eclipse.ddms_0.9.5.qualifier.jar" id="com.android.ide.eclipse.ddms" version="0.9.5.qualifier">
       <category name="developer"/>
    </feature>
-   <feature url="features/com.android.ide.eclipse.tests_0.9.3.qualifier.jar" id="com.android.ide.eclipse.tests" version="0.9.3.qualifier">
+   <feature url="features/com.android.ide.eclipse.tests_0.9.5.qualifier.jar" id="com.android.ide.eclipse.tests" version="0.9.5.qualifier">
       <category name="test"/>
    </feature>
    <category-def name="developer" label="Application Developer Tools">
diff --git a/tools/findunused/findunusedresources b/tools/findunused/findunusedresources
index 748139a..54b1596 100755
--- a/tools/findunused/findunusedresources
+++ b/tools/findunused/findunusedresources
@@ -26,11 +26,15 @@
 for app in $apps
 do
     echo '-----------------------------------------------------------'
+    if [ "$app" == "." ]
+    then
+        app=$(pwd)
+    fi
     if [ -d $app/res ]
     then
         appname=$(basename $app)
         resources=
-        for res in $(echo $app/res/*)
+        for res in $(echo $app/res/* $(find $ANDROID_BUILD_TOP/vendor -type d -wholename $ANDROID_BUILD_TOP/vendor/*/$appname/res | grep overlay))
         do
             resources="$resources $(echo $res | grep -v '\-mcc\|[a-z]*-[a-z][a-z]$\|[a-z]*-[a-z][a-z]-.*')"
         done
@@ -45,19 +49,25 @@
         fi
 
         # find the R.java file that contains all the generated resource identifiers
-        rDotJava=$(find out/target/common/obj/APPS/${appname}_intermediates/ -name R.java)
+        rDotJava=$(find $ANDROID_BUILD_TOP/out/target/common/obj/APPS/${appname}_intermediates/ -name R.java)
 
         # Simplistically process the content of the file to get the names of all the constants,
         # and try to find a reference to each constant.
+
+        # First take all the input files and concatenate them, removing newlines. This allows us to
+        # find expressions that are broken up over multiple lines, i.e. R.drawable.\nsomeconstant
+        find $resources $sources $app/AndroidManifest.xml -type f -print |xargs cat | tr -d '\n ' > /tmp/everything$$
+
+        # Now look for each of the constants in the contatenated file.
         for i in $(cat $rDotJava | grep "\w*=0x\d*" | sed 's/ *public static final int //' | sed 's/=0x.*//')
         do
             # Since periods in the names get translated to underscores in R.java, and you can actually
             # refer to such constants from java by using an underscore instead of a period, we also
             # replace all underscores with a pattern that will match periods and underscores.
             p=$(echo $i | sed 's/_/[\\._]/g')
-            echo $i $(grep -Rw R\\..*\\.$i\\\|@style/$p\\\|@drawable/$p\\\|@anim/$p\\\|@color/$p\\\|@xml/$p\\\|@layout/$p\\\|@menu/$p\\\|@+id/$p\\\|@array/$p\\\|@string/$p\\\|@dimen/$p $resources $sources $app/AndroidManifest.xml | wc -l)
+            echo $i $(grep -cw R\\..*\\.$i\\\|@style/$p\\\|@drawable/$p\\\|@anim/$p\\\|@color/$p\\\|@xml/$p\\\|@layout/$p\\\|@menu/$p\\\|@+id/$p\\\|@array/$p\\\|@string/$p\\\|@dimen/$p\\\|\[a-z\]\*:$p\\\|enumname=\"$p\\\|\<item\>$p\< < /tmp/everything$$)
         done | grep " 0$" | {
-            # this block gets as its input a list of constants which no references were found, one per line
+            # this block gets as its input a list of constants for which no references were found, one per line
             if [ "$showall" == "yes" ]
             then
                 echo $app
@@ -70,5 +80,6 @@
                 fi
             fi
         }
+        rm /tmp/everything$$
     fi
 done
diff --git a/tools/findunused/removeunusedresources b/tools/findunused/removeunusedresources
new file mode 100755
index 0000000..0c38494
--- /dev/null
+++ b/tools/findunused/removeunusedresources
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+if ! which xmlstarlet > /dev/null
+then
+    echo "You need to have the 'xmlstarlet' command in your path"
+    exit
+fi
+
+apps=$1
+CWD=$(pwd)/
+if [ "$apps" = "" ]
+then
+    echo "Please specify the path to an application, or '--all' to process all applications"
+    exit
+elif [ "$apps" = "--all" ]
+then
+    apps=$ANDROID_BUILD_TOP/packages/apps/*
+fi
+
+BASE=$(pwd)/$(dirname $0)
+
+for app in $apps
+do
+    pushd $app
+    $BASE/findunusedresources -p . | {
+        read LINE NUM
+        while [ "$LINE" != "" ]
+        do
+            if [ "Z$LINE" = "Z-----------------------------------------------------------" ]
+            then
+                # skip
+                true
+            elif [ "$LINE" = "$app" ]
+            then
+                # skip
+                true
+            else
+                # try to find the missing resource
+                find res | grep -w $LINE  | {
+                    read RESLINE
+                    while [ "$RESLINE" != "" ]
+                    do
+                        if [ -f $RESLINE ]
+                        then
+                            echo REMOVING FILE: $RESLINE
+                            git rm $RESLINE > /dev/null
+                        else
+                            echo WARNING unexpected result for $LINE
+                        fi
+                        read RESLINE
+                    done
+                }
+                grep -Rwl $LINE res | {
+                    read RESLINE
+                    while [ "$RESLINE" != "" ]
+                    do
+                        ISSTRING=$(echo "$RESLINE" | grep -w "strings\.xml")
+                        if [ -n "$ISSTRING" ]
+                        then
+                            echo REMOVING STRING $LINE from $RESLINE
+                            xmlstarlet ed -P -S -d "/resources/string[@name='$LINE']" $RESLINE > tf$$
+                            mv tf$$ $RESLINE
+                            git add $RESLINE
+                        else
+                            echo REMOVING $LINE from $RESLINE
+                            xmlstarlet ed -P -S -d "/resources/*[@name='$LINE']" $RESLINE > tf$$
+                            mv tf$$ $RESLINE
+                            git add $RESLINE
+                        fi
+                        read RESLINE
+                    done
+                }
+            fi
+            read LINE NUM
+        done
+    }
+    popd
+done
+echo
+echo "Done."
+echo "Please rebuild the updated applications to make sure that everything still builds."
+echo "After rebuilding, rerun 'findunusedresources' or 'removeunusedresources' to see if any more resources are now unused."
+echo "When you're done, you can 'git commit' the change."
+echo
diff --git a/tools/idegen/src/Configuration.java b/tools/idegen/src/Configuration.java
index 392cb5d..2f800b1 100644
--- a/tools/idegen/src/Configuration.java
+++ b/tools/idegen/src/Configuration.java
@@ -123,7 +123,11 @@
          */
 
         boolean firstJavaFile = true;
-        for (File file : directory.listFiles()) {
+	File[] files = directory.listFiles();
+	if (files == null) {
+	    return;
+	}
+        for (File file : files) {
             // Trim preceding "./" from path.
             String path = file.getPath().substring(2);
 
diff --git a/tools/jarutils/src/com/android/jarutils/JavaResourceFilter.java b/tools/jarutils/src/com/android/jarutils/JavaResourceFilter.java
index d9f8da6..8678510 100644
--- a/tools/jarutils/src/com/android/jarutils/JavaResourceFilter.java
+++ b/tools/jarutils/src/com/android/jarutils/JavaResourceFilter.java
@@ -45,10 +45,10 @@
 
         // get the file name from the path
         String fileName = segments[segments.length-1];
-        
+
         return checkFileForPackaging(fileName);
     }
-    
+
     /**
      * Checks whether a folder and its content is valid for packaging into the .apk as
      * standard Java resource.
@@ -83,14 +83,21 @@
      * @param extension the extension of the file (excluding '.')
      * @return true if the file should be packaged as standard java resources.
      */
-    public static boolean checkFileForPackaging(String fileName, String extension) {
-        return "aidl".equalsIgnoreCase(extension) == false &&
-            "java".equalsIgnoreCase(extension) == false &&
-            "class".equalsIgnoreCase(extension) == false &&
-            "package.html".equalsIgnoreCase(fileName) == false &&
-            "overview.html".equalsIgnoreCase(fileName) == false &&
-            ".cvsignore".equalsIgnoreCase(fileName) == false &&
-            ".DS_Store".equals(fileName) == false && 
-            fileName.charAt(fileName.length()-1) != '~';
+    public  static boolean checkFileForPackaging(String fileName, String extension) {
+        // Note: this method is used by com.android.ide.eclipse.adt.internal.build.ApkBuilder
+        if (fileName.charAt(0) == '.') { // ignore hidden files.
+            return false;
+        }
+
+        return "aidl".equalsIgnoreCase(extension) == false &&       // Aidl files
+            "java".equalsIgnoreCase(extension) == false &&          // Java files
+            "class".equalsIgnoreCase(extension) == false &&         // Java class files
+            "scc".equalsIgnoreCase(extension) == false &&           // VisualSourceSafe
+            "swp".equalsIgnoreCase(extension) == false &&           // vi swap file
+            "package.html".equalsIgnoreCase(fileName) == false &&   // Javadoc
+            "overview.html".equalsIgnoreCase(fileName) == false &&  // Javadoc
+            ".cvsignore".equalsIgnoreCase(fileName) == false &&     // CVS
+            ".DS_Store".equals(fileName) == false &&                // Mac resources
+            fileName.charAt(fileName.length()-1) != '~';            // Backup files
     }
 }
diff --git a/tools/layoutlib_utils/src/com/android/layoutlib/utils/DensityBasedResourceValue.java b/tools/layoutlib_utils/src/com/android/layoutlib/utils/DensityBasedResourceValue.java
new file mode 100644
index 0000000..59de463
--- /dev/null
+++ b/tools/layoutlib_utils/src/com/android/layoutlib/utils/DensityBasedResourceValue.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.layoutlib.utils;
+
+import com.android.layoutlib.api.IDensityBasedResourceValue;
+
+public class DensityBasedResourceValue extends ResourceValue implements IDensityBasedResourceValue {
+
+    private Density mDensity;
+
+    public DensityBasedResourceValue(String type, String name, String value, Density density,
+            boolean isFramework) {
+        super(type, name, value, isFramework);
+        mDensity = density;
+    }
+
+    public Density getDensity() {
+        return mDensity;
+    }
+}
diff --git a/tools/layoutopt/Android.mk b/tools/layoutopt/Android.mk
new file mode 100644
index 0000000..43b2dcf
--- /dev/null
+++ b/tools/layoutopt/Android.mk
@@ -0,0 +1,5 @@
+# Copyright 2009 The Android Open Source Project
+#
+LAYOUTOPT_LOCAL_DIR := $(call my-dir)
+include $(LAYOUTOPT_LOCAL_DIR)/libs/Android.mk
+include $(LAYOUTOPT_LOCAL_DIR)/app/Android.mk
diff --git a/ndk/build/platforms/android-3/common/include/cstddef b/tools/layoutopt/MODULE_LICENSE_APACHE2
similarity index 100%
copy from ndk/build/platforms/android-3/common/include/cstddef
copy to tools/layoutopt/MODULE_LICENSE_APACHE2
diff --git a/tools/layoutopt/app/Android.mk b/tools/layoutopt/app/Android.mk
new file mode 100644
index 0000000..3fae340
--- /dev/null
+++ b/tools/layoutopt/app/Android.mk
@@ -0,0 +1,5 @@
+# Copyright 2009 The Android Open Source Project
+#
+LAYOUTOPT_LOCAL_DIR := $(call my-dir)
+include $(LAYOUTOPT_LOCAL_DIR)/etc/Android.mk
+include $(LAYOUTOPT_LOCAL_DIR)/src/Android.mk
diff --git a/tools/layoutopt/app/README b/tools/layoutopt/app/README
new file mode 100644
index 0000000..c118022
--- /dev/null
+++ b/tools/layoutopt/app/README
@@ -0,0 +1,3 @@
+Layout optimizer.
+
+Simple command line front end for the uix library.
\ No newline at end of file
diff --git a/tools/layoutopt/app/etc/Android.mk b/tools/layoutopt/app/etc/Android.mk
new file mode 100644
index 0000000..ae08f9d
--- /dev/null
+++ b/tools/layoutopt/app/etc/Android.mk
@@ -0,0 +1,8 @@
+# Copyright 2009 The Android Open Source Project
+#
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_PREBUILT_EXECUTABLES := layoutopt
+include $(BUILD_HOST_PREBUILT)
+
diff --git a/tools/layoutopt/app/etc/layoutopt b/tools/layoutopt/app/etc/layoutopt
new file mode 100755
index 0000000..22ebb67
--- /dev/null
+++ b/tools/layoutopt/app/etc/layoutopt
@@ -0,0 +1,63 @@
+#!/bin/sh
+# Copyright 2009, The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Set up prog to be the path of this script, including following symlinks,
+# and set up progdir to be the fully-qualified pathname of its directory.
+prog="$0"
+while [ -h "${prog}" ]; do
+    newProg=`/bin/ls -ld "${prog}"`
+    newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
+    if expr "x${newProg}" : 'x/' >/dev/null; then
+        prog="${newProg}"
+    else
+        progdir=`dirname "${prog}"`
+        prog="${progdir}/${newProg}"
+    fi
+done
+oldwd=`pwd`
+progdir=`dirname "${prog}"`
+cd "${progdir}"
+progdir=`pwd`
+prog="${progdir}"/`basename "${prog}"`
+cd "${oldwd}"
+
+jarfile=layoutopt.jar
+frameworkdir="$progdir"
+if [ ! -r "$frameworkdir/$jarfile" ]
+then
+    frameworkdir=`dirname "$progdir"`/tools/lib
+    libdir=`dirname "$progdir"`/tools/lib
+fi
+if [ ! -r "$frameworkdir/$jarfile" ]
+then
+    frameworkdir=`dirname "$progdir"`/framework
+    libdir=`dirname "$progdir"`/lib
+fi
+if [ ! -r "$frameworkdir/$jarfile" ]
+then
+    echo `basename "$prog"`": can't find $jarfile"
+    exit 1
+fi
+
+if [ "$OSTYPE" = "cygwin" ] ; then
+    jarpath=`cygpath -w  "$frameworkdir/$jarfile"`
+    progdir=`cygpath -w  "$progdir"`
+else
+    jarpath="$frameworkdir/$jarfile"
+fi
+
+# need to use "java.ext.dirs" because "-jar" causes classpath to be ignored
+# might need more memory, e.g. -Xmx128M
+exec java -Djava.ext.dirs="$frameworkdir" -jar "$jarpath" "$@"
diff --git a/tools/layoutopt/app/etc/layoutopt.bat b/tools/layoutopt/app/etc/layoutopt.bat
new file mode 100755
index 0000000..e1eb7b3
--- /dev/null
+++ b/tools/layoutopt/app/etc/layoutopt.bat
@@ -0,0 +1,48 @@
+@echo off
+rem Copyright (C) 2009 The Android Open Source Project
+rem
+rem Licensed under the Apache License, Version 2.0 (the "License");
+rem you may not use this file except in compliance with the License.
+rem You may obtain a copy of the License at
+rem
+rem      http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+
+rem don't modify the caller's environment
+setlocal
+
+rem Set up prog to be the path of this script, including following symlinks,
+rem and set up progdir to be the fully-qualified pathname of its directory.
+set prog=%~f0
+
+rem Change current directory and drive to where the script is, to avoid
+rem issues with directories containing whitespaces.
+cd /d %~dp0
+
+set jarfile=layoutopt.jar
+set frameworkdir=
+
+if exist %frameworkdir%%jarfile% goto JarFileOk
+    set frameworkdir=lib\
+
+if exist %frameworkdir%%jarfile% goto JarFileOk
+    set frameworkdir=..\framework\
+
+:JarFileOk
+
+if debug NEQ "%1" goto NoDebug
+    set java_debug=-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y
+    shift 1
+:NoDebug
+
+set jarpath=%frameworkdir%%jarfile%
+
+set javaextdirs=%swt_path%;%frameworkdir%
+
+call java %java_debug% -Djava.ext.dirs=%javaextdirs% %jarpath% %*
+
diff --git a/tools/layoutopt/app/etc/manifest.txt b/tools/layoutopt/app/etc/manifest.txt
new file mode 100644
index 0000000..5d0afdf
--- /dev/null
+++ b/tools/layoutopt/app/etc/manifest.txt
@@ -0,0 +1,2 @@
+Main-Class: com.android.layoutopt.cli.Main
+Class-Path: groovy-all-1.6.5.jar
diff --git a/tools/layoutopt/app/src/Android.mk b/tools/layoutopt/app/src/Android.mk
new file mode 100644
index 0000000..131addd
--- /dev/null
+++ b/tools/layoutopt/app/src/Android.mk
@@ -0,0 +1,15 @@
+# Copyright 2009 The Android Open Source Project
+#
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+LOCAL_JAVA_RESOURCE_DIRS := resources
+
+LOCAL_JAR_MANIFEST := ../etc/manifest.txt
+LOCAL_JAVA_LIBRARIES := \
+	uix
+LOCAL_MODULE := layoutopt
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
diff --git a/tools/layoutopt/app/src/com/android/layoutopt/cli/Main.java b/tools/layoutopt/app/src/com/android/layoutopt/cli/Main.java
new file mode 100644
index 0000000..0275aa0
--- /dev/null
+++ b/tools/layoutopt/app/src/com/android/layoutopt/cli/Main.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.layoutopt.cli;
+
+import com.android.layoutopt.uix.LayoutAnalyzer;
+import com.android.layoutopt.uix.LayoutAnalysis;
+
+import java.io.File;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Command line utility for the uix library.
+ *
+ * This is a simple CLI front-end for the uix library, used to
+ * analyze and optimize Android layout files.
+ */
+public class Main {
+    /**
+     * Main entry point of the application.
+     *
+     * @param args One mandatory parameter, a path (absolute or relative)
+     *             to an Android XML layout file
+     */
+    public static void main(String[] args) {
+        Parameters p = checkParameters(args);
+        if (!p.valid) {
+            displayHelpMessage();
+            exit();
+        }
+
+        analyzeFiles(p.files);
+    }
+
+    private static void analyzeFiles(File[] files) {
+        LayoutAnalyzer analyzer = new LayoutAnalyzer();
+        for (File file : files) {
+            if (file.isFile() && file.getName().endsWith(".xml")) {
+                analyze(analyzer, file);
+            } else if (file.isDirectory()) {
+                analyzeFiles(file.listFiles());
+            }
+        }
+    }
+
+    private static void analyze(LayoutAnalyzer analyzer, File file) {
+        LayoutAnalysis analysis = analyzer.analyze(file);
+        System.out.println(analysis.getName());
+        for (LayoutAnalysis.Issue issue : analysis.getIssues()) {
+            System.out.print(String.format("\t%d:%d ", issue.getStartLine(), issue.getEndLine()));
+            System.out.println(issue.getDescription());
+        }
+    }
+
+    /**
+     * Exits the tool.
+     */
+    private static void exit() {
+        System.exit(0);
+    }
+
+    /**
+     * Displays this tool's help message on the standard output.
+     */
+    private static void displayHelpMessage() {
+        System.out.println("usage: layoutopt <directories/files to analyze>");
+    }
+
+    /**
+     * Builds a valid Parameters object. Parses the paramters if necessary
+     * and checks for errors.
+     *
+     * @param args The parameters passed from the CLI.
+     */
+    private static Parameters checkParameters(String[] args) {
+        Parameters p = new Parameters();
+
+        if (args.length < 1) {
+            p.valid = false;
+        } else {
+            List<File> files = new ArrayList<File>();
+            for (String path : args) {
+                File file = new File(path);
+                if (file.exists() && (file.isDirectory() || file.getName().endsWith(".xml"))) {
+                    files.add(file);
+                }
+            }
+            p.files = files.toArray(new File[files.size()]);
+            p.valid = true;
+        }
+
+        return p;
+    }
+
+    /**
+     * Parameters parsed from the CLI.
+     */
+    private static class Parameters {
+        /**
+         * True if this list of parameters is valid, false otherwise.
+         */
+        boolean valid;
+
+        /**
+         * Paths (absolute or relative) to the files to be analyzed.
+         */
+        File[] files;
+    }
+}
diff --git a/tools/layoutopt/libs/Android.mk b/tools/layoutopt/libs/Android.mk
new file mode 100644
index 0000000..058299a
--- /dev/null
+++ b/tools/layoutopt/libs/Android.mk
@@ -0,0 +1,5 @@
+# Copyright 2009 The Android Open Source Project
+#
+UIX_LOCAL_DIR := $(call my-dir)
+include $(UIX_LOCAL_DIR)/uix/Android.mk
+
diff --git a/tools/layoutopt/libs/uix/Android.mk b/tools/layoutopt/libs/uix/Android.mk
new file mode 100644
index 0000000..8344e57
--- /dev/null
+++ b/tools/layoutopt/libs/uix/Android.mk
@@ -0,0 +1,4 @@
+# Copyright 2009 The Android Open Source Project
+#
+UIX_LOCAL_DIR := $(call my-dir)
+include $(UIX_LOCAL_DIR)/src/Android.mk
diff --git a/tools/layoutopt/libs/uix/src/Android.mk b/tools/layoutopt/libs/uix/src/Android.mk
new file mode 100644
index 0000000..65abcbc
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/Android.mk
@@ -0,0 +1,13 @@
+# Copyright 2009 The Android Open Source Project
+#
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+LOCAL_JAVA_RESOURCE_DIRS := resources
+
+LOCAL_MODULE := uix
+LOCAL_JAVA_LIBRARIES := \
+	groovy-all-1.6.5
+
+include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/LayoutAnalysis.java b/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/LayoutAnalysis.java
new file mode 100644
index 0000000..bc6f0b6
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/LayoutAnalysis.java
@@ -0,0 +1,200 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.layoutopt.uix;
+
+import org.w3c.dom.Node;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import com.android.layoutopt.uix.groovy.LayoutAnalysisCategory;
+
+/**
+ * Contains the results of a layout analysis. Instances of this class are
+ * generated by {@link com.android.layoutopt.uix.LayoutAnalyzer}.
+ *
+ * @see com.android.layoutopt.uix.LayoutAnalyzer
+ */
+public class LayoutAnalysis {
+    /**
+     * Default layout analysis used to describe a problem with the
+     * analysis process.
+     */
+    static final LayoutAnalysis ERROR = new LayoutAnalysis("");
+    static {
+        ERROR.mAnalyzed = false;
+        ERROR.addIssue("The layout could not be analyzed. Check if you specified a valid "
+                + "XML layout, if the specified file exists, etc.");
+    }
+
+    private final List<Issue> mIssues = new ArrayList<Issue>();
+    private String mName;
+    private boolean mAnalyzed;
+    private Node mNode;
+
+    /**
+     * Creates a new analysis. An analysis is always considered invalid by default.
+     *
+     * @see #validate()
+     * @see #isValid() 
+     */
+    LayoutAnalysis(String name) {
+        mName = name;
+    }
+
+    /**
+     * Returns the name of this analysis.
+     */
+    public String getName() {
+        return mName;
+    }
+
+    void setName(String name) {
+        mName = name;
+    }
+    
+    /**
+     * Adds an issue to the layout analysis.
+     *
+     * @param issue The issue to add.
+     */
+    public void addIssue(Issue issue) {
+        mIssues.add(issue);
+    }
+
+    /**
+     * Adds an issue to the layout analysis.
+     *
+     * @param description Description of the issue.
+     */
+    public void addIssue(String description) {
+        mIssues.add(new Issue(mNode, description));
+    }
+
+    /**
+     * Adds an issue to the layout analysis.
+     *
+     * @param node The node containing the issue.
+     * @param description Description of the issue.
+     */
+    public void addIssue(Node node, String description) {
+        mIssues.add(new Issue(node, description));
+    }
+
+    /**
+     * Returns the list of issues found during the analysis.
+     *
+     * @return A non-null array of {@link com.android.layoutopt.uix.LayoutAnalysis.Issue}.
+     */
+    public Issue[] getIssues() {
+        return mIssues.toArray(new Issue[mIssues.size()]);
+    }
+
+    /**
+     * Indicates whether the layout was analyzed. If this method returns false,
+     * a probleme occured during the analysis (missing file, invalid document, etc.)
+     *
+     * @return True if the layout was analyzed, false otherwise.
+     */
+    public boolean isValid() {
+        return mAnalyzed;
+    }
+
+    /**
+     * Validates the analysis. This must be call before this analysis can
+     * be considered valid. Calling this method resets the current node to null.
+     * 
+     * @see #setCurrentNode(org.w3c.dom.Node) 
+     */
+    void validate() {
+        mAnalyzed = true;
+        mNode = null;
+    }
+
+    /**
+     * Sets the current node to be automatically added to created issues.
+     * 
+     * @param node An XML node.
+     */
+    void setCurrentNode(Node node) {
+        mNode = node;
+    }
+
+    /**
+     * Represents an issue discovered during the analysis process.
+     * An issue provides a human-readable description as well as optional solutions.
+     */
+    public static class Issue {
+        private final String mDescription;
+        private final Node mNode;
+
+        /**
+         * Creates a new issue with the specified description.
+         * 
+         * @param description The description of the issue.
+         */
+        public Issue(String description) {
+            mNode = null;
+            if (description == null) {
+                throw new IllegalArgumentException("The description must be non-null");
+            }
+            mDescription = description;
+        }
+
+        /**
+         * Creates a new issue with the specified description.
+         * 
+         * @param node The node in which the issue was found.
+         * @param description The description of the issue.
+         */
+        public Issue(Node node, String description) {
+            mNode = node;
+            if (description == null) {
+                throw new IllegalArgumentException("The description must be non-null");
+            }
+            mDescription = description;
+        }
+
+        /**
+         * Describes this issue to the user.
+         *
+         * @return A String describing the issue, always non-null.
+         */
+        public String getDescription() {
+            return mDescription;
+        }
+
+
+        /**
+         * Returns the start line of this node.
+         *
+         * @return The start line or -1 if the line is unknown.
+         */
+        public int getStartLine() {
+            return LayoutAnalysisCategory.getStartLine(mNode);
+        }
+
+        /**
+         * Returns the end line of this node.
+         *
+         * @return The end line or -1 if the line is unknown.
+         */
+        public int getEndLine() {
+            return LayoutAnalysisCategory.getEndLine(mNode);
+        }
+    }
+}
diff --git a/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/LayoutAnalyzer.java b/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/LayoutAnalyzer.java
new file mode 100644
index 0000000..da27414
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/LayoutAnalyzer.java
@@ -0,0 +1,249 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.layoutopt.uix;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipEntry;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.ArrayList;
+
+import com.android.layoutopt.uix.xml.XmlDocumentBuilder;
+import com.android.layoutopt.uix.rules.Rule;
+import com.android.layoutopt.uix.rules.GroovyRule;
+import com.android.layoutopt.uix.util.IOUtilities;
+import groovy.lang.GroovyClassLoader;
+import groovy.lang.GroovyShell;
+import groovy.lang.Script;
+
+/**
+ * Analysis engine used to discover inefficiencies in Android XML
+ * layout documents.
+ *
+ * Anaylizing an Android XML layout produces a list of explicit messages
+ * as well as possible solutions. 
+ */
+public class LayoutAnalyzer {
+    private static final String RULES_PREFIX = "rules/";
+
+    private final XmlDocumentBuilder mBuilder = new XmlDocumentBuilder();
+    private final List<Rule> mRules = new ArrayList<Rule>();
+
+    /**
+     * Creates a new layout analyzer. This constructor takes no argument
+     * and will use the default options.
+     */
+    public LayoutAnalyzer() {
+        loadRules();
+    }
+
+    private void loadRules() {
+        ClassLoader parent = getClass().getClassLoader();
+        GroovyClassLoader loader = new GroovyClassLoader(parent);
+        GroovyShell shell = new GroovyShell(loader);
+
+        URL jar = getClass().getProtectionDomain().getCodeSource().getLocation();
+        ZipFile zip = null;
+        try {
+            zip = new ZipFile(new File(jar.toURI()));
+            Enumeration<? extends ZipEntry> entries = zip.entries();
+            while (entries.hasMoreElements()) {
+                ZipEntry entry = entries.nextElement();
+                if (!entry.isDirectory() && entry.getName().startsWith(RULES_PREFIX)) {
+                    loadRule(shell, entry.getName(), zip.getInputStream(entry));
+                }
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (URISyntaxException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (zip != null) zip.close();
+            } catch (IOException e) {
+                // Ignore
+            }
+        }
+    }
+
+    private void loadRule(GroovyShell shell, String name, InputStream stream) {
+        try {
+            Script script = shell.parse(stream);
+            mRules.add(new GroovyRule(name, script));
+        } catch (Exception e) {
+            System.err.println("Could not load rule " + name + ":");
+            e.printStackTrace();
+        } finally {
+            IOUtilities.close(stream);
+        }
+    }
+
+    public void addRule(Rule rule) {
+        if (rule == null) {
+            throw new IllegalArgumentException("A rule must be non-null");
+        }
+        mRules.add(rule);
+    }
+
+    /**
+     * Analyzes the specified file.
+     *
+     * @param file The file to analyze.
+     *
+     * @return A {@link com.android.layoutopt.uix.LayoutAnalysis} which
+     *         cannot be null.
+     */
+    public LayoutAnalysis analyze(File file) {
+        if (file != null && file.exists()) {
+            InputStream in = null;
+            try {
+                in = new FileInputStream(file);
+                return analyze(file.getPath(), in);
+            } catch (FileNotFoundException e) {
+                // Ignore, cannot happen
+            } finally {
+                IOUtilities.close(in);
+            }
+        }
+
+        return LayoutAnalysis.ERROR;
+    }
+
+    /**
+     * Analyzes the specified XML stream.
+     *
+     * @param stream The stream to analyze.
+     * @return A {@link com.android.layoutopt.uix.LayoutAnalysis} which
+     *         cannot be null.
+     */
+    public LayoutAnalysis analyze(InputStream stream) {
+        return analyze("<unknown>", stream);
+    }
+
+    private LayoutAnalysis analyze(String name, InputStream stream) {
+         try {
+             Document document = mBuilder.parse(stream);
+             return analyze(name, document);
+         } catch (SAXException e) {
+             // Ignore
+         } catch (IOException e) {
+             // Ignore
+         }
+         return LayoutAnalysis.ERROR;
+    }
+
+    /**
+     * Analyzes the specified XML document.
+     *
+     * @param content The XML document to analyze.
+     *
+     * @return A {@link com.android.layoutopt.uix.LayoutAnalysis} which
+     *         cannot be null.
+     */
+    public LayoutAnalysis analyze(String content) {
+         return analyze("<unknown>", content);
+    }
+
+    /**
+     * Analyzes the specified XML document.
+     *
+     * @param name The name of the document.
+     * @param content The XML document to analyze.
+     *
+     * @return A {@link com.android.layoutopt.uix.LayoutAnalysis} which
+     *         cannot be null.
+     */
+    public LayoutAnalysis analyze(String name, String content) {
+         try {
+             Document document = mBuilder.parse(content);
+             return analyze(name, document);
+         } catch (SAXException e) {
+             // Ignore
+         } catch (IOException e) {
+             // Ignore
+         }
+         return LayoutAnalysis.ERROR;
+    }
+
+    /**
+     * Analyzes the specified XML document.
+     *
+     * @param document The XML document to analyze.
+     *
+     * @return A {@link com.android.layoutopt.uix.LayoutAnalysis} which
+     *         cannot be null.
+     */
+    public LayoutAnalysis analyze(Document document) {
+        return analyze("<unknown>", document);
+    }
+
+    /**
+     * Analyzes the specified XML document.
+     *
+     * @param name The name of the document.
+     * @param document The XML document to analyze.
+     *
+     * @return A {@link com.android.layoutopt.uix.LayoutAnalysis} which
+     *         cannot be null.
+     */
+    public LayoutAnalysis analyze(String name, Document document) {
+        LayoutAnalysis analysis = new LayoutAnalysis(name);
+
+        try {
+            Element root = document.getDocumentElement();
+            analyze(analysis, root);
+        } finally {
+            analysis.validate();
+        }
+
+        return analysis;        
+    }
+
+    private void analyze(LayoutAnalysis analysis, Node node) {
+        NodeList list = node.getChildNodes();
+        int count = list.getLength();
+
+        applyRules(analysis, node);
+
+        for (int i = 0; i < count; i++) {
+            Node child = list.item(i);
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                analyze(analysis, child);
+            }
+        }
+    }
+
+    private void applyRules(LayoutAnalysis analysis, Node node) {
+        analysis.setCurrentNode(node);
+        for (Rule rule : mRules) {
+            rule.run(analysis, node);
+        }
+    }
+}
diff --git a/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/groovy/LayoutAnalysisCategory.java b/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/groovy/LayoutAnalysisCategory.java
new file mode 100644
index 0000000..a70086d
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/groovy/LayoutAnalysisCategory.java
@@ -0,0 +1,212 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.layoutopt.uix.groovy;
+
+import com.android.layoutopt.uix.LayoutAnalysis;
+import com.android.layoutopt.uix.xml.XmlDocumentBuilder;
+
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import groovy.lang.GString;
+import groovy.xml.dom.DOMCategory;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Element;
+
+/**
+ * Support class for Groovy rules. This class adds new Groovy capabilities
+ * to {@link com.android.layoutopt.uix.LayoutAnalysis} and {@link org.w3c.dom.Node}.
+ */
+public class LayoutAnalysisCategory {
+    private static final String ANDROID_PADDING = "android:padding";
+    private static final String ANDROID_PADDING_LEFT = "android:paddingLeft";
+    private static final String ANDROID_PADDING_TOP = "android:paddingTop";
+    private static final String ANDROID_PADDING_RIGHT = "android:paddingRight";
+    private static final String ANDROID_PADDING_BOTTOM = "android:paddingBottom";
+    private static final String ANDROID_LAYOUT_WIDTH = "android:layout_width";
+    private static final String ANDROID_LAYOUT_HEIGHT = "android:layout_height";
+    private static final String VALUE_FILL_PARENT = "fill_parent";
+    private static final String VALUE_WRAP_CONTENT = "wrap_content";
+    
+    private static final String[] sContainers = new String[] {
+            "FrameLayout", "LinearLayout", "RelativeLayout", "SlidingDrawer",
+            "AbsoluteLayout", "TableLayout", "Gallery", "GridView", "ListView",
+            "RadioGroup", "ScrollView", "HorizontalScrollView", "Spinner",
+            "ViewSwitcher", "ViewFlipper", "ViewAnimator", "ImageSwitcher",
+            "TextSwitcher", "android.gesture.GestureOverlayView", "TabHost"
+    };
+    static {
+        Arrays.sort(sContainers);
+    }
+
+    /**
+     * xmlNode.isContainer()
+     * 
+     * @return True if the specified node corresponds to a container widget.
+     */
+    public static boolean isContainer(Element element) {
+        return Arrays.binarySearch(sContainers, element.getNodeName()) >= 0;
+    }
+
+    /**
+     * xmlNode.all()
+     * 
+     * Same as xmlNode.'**' but excludes xmlNode from the results.
+     * 
+     * @return All descendants, this node excluded.
+     */
+    public static List<Node> all(Element element) {
+        NodeList list = DOMCategory.depthFirst(element);
+        int count = list.getLength();
+        List<Node> nodes = new ArrayList<Node>(count - 1);
+        for (int i = 1; i < count; i++) {
+            nodes.add(list.item(i));
+        }
+        return nodes;
+    }
+
+    /**
+     * Returns the start line of this node.
+     *
+     * @return The start line or -1 if the line is unknown.
+     */
+    public static int getStartLine(Node node) {
+        final Object data = node == null ? null :
+                node.getUserData(XmlDocumentBuilder.NODE_START_LINE);
+        return data == null ? -1 : (Integer) data;
+    }
+
+    /**
+     * Returns the end line of this node.
+     *
+     * @return The end line or -1 if the line is unknown.
+     */
+    public static int getEndLine(Node node) {
+        final Object data = node == null ? null :
+                node.getUserData(XmlDocumentBuilder.NODE_END_LINE);
+        return data == null ? -1 : (Integer) data;
+    }
+
+    /**
+     * xmlNode.hasPadding()
+     * 
+     * @return True if the node has one ore more padding attributes.
+     */
+    public static boolean hasPadding(Element element) {
+        return element.getAttribute(ANDROID_PADDING).length() > 0 ||
+                element.getAttribute(ANDROID_PADDING_LEFT).length() > 0 ||
+                element.getAttribute(ANDROID_PADDING_TOP).length() > 0 ||
+                element.getAttribute(ANDROID_PADDING_BOTTOM).length() > 0 ||
+                element.getAttribute(ANDROID_PADDING_RIGHT).length() > 0;
+    }
+
+    /**
+     * Returns whether this node's width is fill_parent.
+     */
+    public static boolean isWidthFillParent(Element element) {
+        return element.getAttribute(ANDROID_LAYOUT_WIDTH).equals(VALUE_FILL_PARENT);
+    }
+
+    /**
+     * Returns whether this node's width is wrap_content.
+     */
+    public static boolean isWidthWrapContent(Element element) {
+        return element.getAttribute(ANDROID_LAYOUT_WIDTH).equals(VALUE_WRAP_CONTENT);
+    }
+
+    /**
+     * Returns whether this node's height is fill_parent.
+     */
+    public static boolean isHeightFillParent(Element element) {
+        return element.getAttribute(ANDROID_LAYOUT_HEIGHT).equals(VALUE_FILL_PARENT);
+    }
+
+    /**
+     * Returns whether this node's height is wrap_content.
+     */
+    public static boolean isHeightWrapContent(Element element) {
+        return element.getAttribute(ANDROID_LAYOUT_HEIGHT).equals(VALUE_WRAP_CONTENT);
+    }
+
+    /**
+     * xmlNode.isRoot()
+     * 
+     * @return True if xmlNode is the root of the document, false otherwise
+     */
+    public static boolean isRoot(Node node) {
+        return node.getOwnerDocument().getDocumentElement() == node;
+    }
+
+    /**
+     * xmlNode.is("tagName")
+     * 
+     * @return True if xmlNode.getNodeName().equals(name), false otherwise.
+     */
+    public static boolean is(Node node, String name) {
+        return node.getNodeName().equals(name);
+    }
+
+    /**
+     * xmlNode.depth()
+     * 
+     * @return The maximum depth of the node.
+     */
+    public static int depth(Node node) {
+        int maxDepth = 0;
+        NodeList list = node.getChildNodes();
+        int count = list.getLength();
+
+        for (int i = 0; i < count; i++) {
+            maxDepth = Math.max(maxDepth, depth(list.item(i)));
+        }
+
+        return maxDepth + 1;
+    }
+
+    /**
+     * analysis << "The issue"
+     * 
+     * @return The analysis itself to chain calls.
+     */
+    public static LayoutAnalysis leftShift(LayoutAnalysis analysis, GString description) {
+        analysis.addIssue(description.toString());
+        return analysis;
+    }
+
+    /**
+     * analysis << "The issue"
+     * 
+     * @return The analysis itself to chain calls.
+     */
+    public static LayoutAnalysis leftShift(LayoutAnalysis analysis, String description) {
+        analysis.addIssue(description);
+        return analysis;
+    }
+
+    /**
+     * analysis << [node: node, description: "The issue"]
+     * 
+     * @return The analysis itself to chain calls.
+     */
+    public static LayoutAnalysis leftShift(LayoutAnalysis analysis, Map issue) {
+        analysis.addIssue((Node) issue.get("node"), issue.get("description").toString());
+        return analysis;
+    }
+}
diff --git a/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/rules/GroovyRule.java b/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/rules/GroovyRule.java
new file mode 100644
index 0000000..785b8f4
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/rules/GroovyRule.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.layoutopt.uix.rules;
+
+import groovy.lang.Script;
+import groovy.lang.Binding;
+import groovy.lang.Closure;
+import groovy.xml.dom.DOMCategory;
+import com.android.layoutopt.uix.LayoutAnalysis;
+import com.android.layoutopt.uix.groovy.LayoutAnalysisCategory;
+import org.w3c.dom.Node;
+import org.codehaus.groovy.runtime.GroovyCategorySupport;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
+
+/**
+ * Implementation of a rule using a Groovy script.
+ */
+public class GroovyRule implements Rule {
+    private final String mName;
+    private final Script mScript;
+    private final Binding mBinding;
+    private final Closure mClosure;
+    private final List<Class> mCategories;
+
+    public GroovyRule(String name, Script script) {
+        mName = name;
+        mScript = script;
+        mBinding = new Binding();
+        mScript.setBinding(mBinding);
+        mClosure = new Closure(this) {
+            @Override
+            public Object call() {
+                return mScript.run();
+            }
+        };
+        mCategories = new ArrayList<Class>();
+        Collections.addAll(mCategories, DOMCategory.class, LayoutAnalysisCategory.class);
+    }
+
+    public String getName() {
+        return mName;
+    }
+
+    public void run(LayoutAnalysis analysis, Node node) {
+        mBinding.setVariable("analysis", analysis);
+        mBinding.setVariable("node", node);
+
+        GroovyCategorySupport.use(mCategories, mClosure);
+    }
+}
diff --git a/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/rules/Rule.java b/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/rules/Rule.java
new file mode 100644
index 0000000..0168992
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/rules/Rule.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.layoutopt.uix.rules;
+
+import com.android.layoutopt.uix.LayoutAnalysis;
+import org.w3c.dom.Node;
+
+/**
+ * Interface that define an analysis rule.
+ */
+public interface Rule {
+    /**
+     * Returns the name of the rule.
+     *
+     * @return A non-null String.
+     */
+    String getName();
+
+    /**
+     * Runs the rule for the specified node. The rule must add any detected
+     * issue to the analysis.
+     *
+     * @param analysis The resulting analysis.
+     * @param node The original XML node.
+     */
+    void run(LayoutAnalysis analysis, Node node);
+}
diff --git a/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/util/IOUtilities.java b/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/util/IOUtilities.java
new file mode 100644
index 0000000..69ac30f
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/util/IOUtilities.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.layoutopt.uix.util;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * Various utilities related to I/O operations.
+ */
+public class IOUtilities {
+    private IOUtilities() {
+    }
+
+    /**
+     * Safely close a Closeable object, like an InputStream.
+     *
+     * @param stream The object to close.
+     *
+     * @return True if the object is null or was closed properly,
+     *         false otherwise.
+     */
+    public static boolean close(Closeable stream) {
+        if (stream != null) {
+            try {
+                stream.close();
+            } catch (IOException e) {
+                return false;
+            }
+        }
+        return true;
+    }
+}
diff --git a/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/xml/XmlDocumentBuilder.java b/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/xml/XmlDocumentBuilder.java
new file mode 100644
index 0000000..f5779ff
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/com/android/layoutopt/uix/xml/XmlDocumentBuilder.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.layoutopt.uix.xml;
+
+import com.sun.org.apache.xerces.internal.parsers.DOMParser;
+import com.sun.org.apache.xerces.internal.xni.XMLLocator;
+import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
+import com.sun.org.apache.xerces.internal.xni.Augmentations;
+import com.sun.org.apache.xerces.internal.xni.XNIException;
+import com.sun.org.apache.xerces.internal.xni.QName;
+import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.SAXException;
+import org.xml.sax.InputSource;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.LinkedList;
+
+/**
+ * Parses XML documents. This class tries to add meta-data in the resulting DOM
+ * trees to indicate the start and end line numbers of each node.
+ */
+public class XmlDocumentBuilder {
+    /**
+     * Name of the node user data containing the start line number of the node.
+     * 
+     * @see Node#getUserData(String)
+     */
+    public static final String NODE_START_LINE = "startLine";
+
+    /**
+     * Name of the node user data containing the end line number of the node.
+     *
+     * @see Node#getUserData(String)
+     */
+    public static final String NODE_END_LINE = "endLine";
+
+    private final DocumentBuilder mBuilder;
+    private boolean mHasLineNumbersSupport;
+
+    /**
+     * Creates a new XML document builder.
+     */
+    public XmlDocumentBuilder() {
+        try {
+            Class.forName("com.sun.org.apache.xerces.internal.parsers.DOMParser");
+            mHasLineNumbersSupport = true;
+        } catch (ClassNotFoundException e) {
+            // Ignore
+        }
+
+        if (!mHasLineNumbersSupport) {
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            try {
+                mBuilder = factory.newDocumentBuilder();
+            } catch (ParserConfigurationException e) {
+                throw new IllegalStateException("Could not initialize the XML parser");
+            }
+        } else {
+            mBuilder = null;
+        }
+    }
+
+    /**
+     * Indicates whether the XML documents created by this class are annotated
+     * with line numbers.
+     *
+     * @return True if the parsed documents contain line numbers meta-data,
+     *         false otherwise.
+     *
+     * @see #NODE_START_LINE
+     * @see #NODE_END_LINE
+     */
+    public boolean isHasLineNumbersSupport() {
+        return mHasLineNumbersSupport;
+    }
+
+    public Document parse(InputStream inputStream) throws SAXException, IOException {
+        if (!mHasLineNumbersSupport) {
+            return mBuilder.parse(inputStream);
+        } else {
+            DOMParser parser = new LineNumberDOMParser();
+            parser.parse(new InputSource(inputStream));
+            return parser.getDocument();
+        }
+    }
+
+    public Document parse(String content) throws SAXException, IOException {
+        if (!mHasLineNumbersSupport) {
+            return mBuilder.parse(content);
+        } else {
+            DOMParser parser = new LineNumberDOMParser();
+            parser.parse(content);
+            return parser.getDocument();
+        }
+    }
+
+    public Document parse(File file) throws SAXException, IOException {
+        return parse(new FileInputStream(file));
+    }
+
+    private static class LineNumberDOMParser extends DOMParser {
+        private static final String FEATURE_NODE_EXPANSION =
+                "http://apache.org/xml/features/dom/defer-node-expansion";
+        private static final String CURRENT_NODE =
+                "http://apache.org/xml/properties/dom/current-element-node";
+
+        private XMLLocator mLocator;
+        private LinkedList<Node> mStack = new LinkedList<Node>();
+
+        private LineNumberDOMParser() {
+            try {
+                setFeature(FEATURE_NODE_EXPANSION, false);
+            } catch (SAXNotRecognizedException e) {
+                e.printStackTrace();
+            } catch (SAXNotSupportedException e) {
+                e.printStackTrace();
+            }
+        }
+
+        @Override
+        public void startDocument(XMLLocator xmlLocator, String s,
+                NamespaceContext namespaceContext, Augmentations augmentations)
+                throws XNIException {
+            super.startDocument(xmlLocator, s, namespaceContext, augmentations);
+
+            mLocator = xmlLocator;
+            mStack.add(setNodeLineNumber(NODE_START_LINE));
+        }
+
+        private Node setNodeLineNumber(String tag) {
+            Node node = null;
+            try {
+                node = (Node) getProperty(CURRENT_NODE);
+            } catch (SAXNotRecognizedException e) {
+                e.printStackTrace();
+            } catch (SAXNotSupportedException e) {
+                e.printStackTrace();
+            }
+
+            if (node != null) {
+                node.setUserData(tag, mLocator.getLineNumber(), null);
+            }
+
+            return node;
+        }
+
+        @Override
+        public void startElement(QName qName, XMLAttributes xmlAttributes,
+                Augmentations augmentations) throws XNIException {
+            super.startElement(qName, xmlAttributes, augmentations);
+            mStack.add(setNodeLineNumber(NODE_START_LINE));            
+        }
+
+        @Override
+        public void endElement(QName qName, Augmentations augmentations) throws XNIException {
+            super.endElement(qName, augmentations);
+            Node node = mStack.removeLast();
+            if (node != null) {
+                node.setUserData(NODE_END_LINE, mLocator.getLineNumber(), null);
+            }
+        }
+    }
+}
diff --git a/tools/layoutopt/libs/uix/src/resources/rules/IncorrectHeightInScrollView.rule b/tools/layoutopt/libs/uix/src/resources/rules/IncorrectHeightInScrollView.rule
new file mode 100644
index 0000000..d29ebd5
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/resources/rules/IncorrectHeightInScrollView.rule
@@ -0,0 +1,11 @@
+// Rule: IncorrectHeightInScrollView
+//
+// Description: Checks whether a scrollview's child has the wrong dimension.
+//
+// Conditions:
+// - The node has a ScrollView parent
+// - The node has a height set to fill_parent
+
+if (node.'..'.is("ScrollView") && node.isHeightFillParent()) {
+    analysis << "This ${node.name()} tag should use android:layout_height=\"wrap_content\""
+}
diff --git a/tools/layoutopt/libs/uix/src/resources/rules/IncorrectWidthInHorizontalScrollView.rule b/tools/layoutopt/libs/uix/src/resources/rules/IncorrectWidthInHorizontalScrollView.rule
new file mode 100644
index 0000000..17da843
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/resources/rules/IncorrectWidthInHorizontalScrollView.rule
@@ -0,0 +1,11 @@
+// Rule: IncorrectWidthInScrollView
+//
+// Description: Checks whether a scrollview's child has the wrong dimension.
+//
+// Conditions:
+// - The node has a HorizontalScrollView parent
+// - The node has a width set to fill_parent
+
+if (node.'..'.is("HorizontalScrollView") && node.isWidthFillParent()) {
+    analysis << "This ${node.name()} tag should use android:layout_width=\"wrap_content\""
+}
diff --git a/tools/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule b/tools/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule
new file mode 100644
index 0000000..928d7a1
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule
@@ -0,0 +1,19 @@
+// Rule: InefficientWeight
+//
+// Description: Checks whether a layout_weight is declared inefficiently.
+//
+// Conditions:
+// - The node has a LinearLayout parent
+// - The node is the only sibling with a weight
+// - The node has a height/width != 0
+
+def parent = node.'..'
+if (parent.is("LinearLayout") && node.'@android:layout_weight' &&
+        parent.'*'.findAll{ it.'@android:layout_weight' }.size() == 1) {
+    def dimension = parent.'@android:orientation' == "vertical" ?
+        "android:layout_height" : "android:layout_width"
+    if (node."@${dimension}"[0] != '0') {
+        analysis << "Use an ${dimension} of 0dip instead of ${node."@${dimension}"} " +
+                "for better performance"
+    }
+}
diff --git a/tools/layoutopt/libs/uix/src/resources/rules/MergeRootFrameLayout.rule b/tools/layoutopt/libs/uix/src/resources/rules/MergeRootFrameLayout.rule
new file mode 100644
index 0000000..d3fc3d9
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/resources/rules/MergeRootFrameLayout.rule
@@ -0,0 +1,18 @@
+// Rule: MergeRootFrameLayout
+//
+// Description: Checks whether the root node of the XML document can be
+//              replaced with a <merge /> tag.
+//
+// Conditions:
+// - The node is the root of the document
+// - The node is a FrameLayout
+// - The node is fill_parent in both orientation *or* it has no layout_gravity
+// - The node does not have a background nor a foreground
+// - The node does not have padding
+
+if (node.isRoot() && node.is("FrameLayout") && !node.'@android:background' &&
+        !node.'@android:foreground' && ((node.isWidthFillParent() &&
+                node.isHeightFillParent()) || !node.'@android:layout_gravity') &&
+        !node.hasPadding()) {
+    analysis << "The root-level <FrameLayout/> can be replaced with <merge/>"
+}
diff --git a/tools/layoutopt/libs/uix/src/resources/rules/NestedScrollingWidgets.rule b/tools/layoutopt/libs/uix/src/resources/rules/NestedScrollingWidgets.rule
new file mode 100644
index 0000000..f48c24e
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/resources/rules/NestedScrollingWidgets.rule
@@ -0,0 +1,19 @@
+// Rule: NestedScrollingWidgets
+//
+// Description: Checks whether a scrolling widget has nested scrolling widgets.
+//
+// Conditions:
+// - The node is a scrolling widget
+// - The node has a descendant who is also a scrolling widget
+
+def widgets = ["ScrollView", "ListView", "GridView"]
+if (node.name() in widgets && node.all().any{ it.name() in widgets }) {
+    analysis << "The vertically scrolling ${node.name()} should not contain another " +
+            "vertically scrolling widget"
+}
+
+widgets = ["HorizontalScrollView", "Gallery"]
+if (node.name() in widgets && node.all().any{ it.name() in widgets }) {
+    analysis << "The horizontally scrolling ${node.name()} should not contain another " +
+            "horizontally scrolling widget"
+}
diff --git a/tools/layoutopt/libs/uix/src/resources/rules/TooManyChildren.rule b/tools/layoutopt/libs/uix/src/resources/rules/TooManyChildren.rule
new file mode 100644
index 0000000..516d91f
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/resources/rules/TooManyChildren.rule
@@ -0,0 +1,15 @@
+// Rule: TooManyChildren
+//
+// Description: Checks whether the layout has too many children.
+//
+// Conditions:
+// - The layout is a ScrollView and has more than 1 child
+// - The layout is a list or grid ans has at least 1 child
+
+if (node.name() in ["ScrollView", "HorizontalScrollView"] && node.'*'.size() > 1) {
+    analysis << "A scroll view can have only one child"
+}
+
+if (node.name() in ["ListView", "GridView"] && node.'*'.size() > 0) {
+    analysis << "A list/grid should have no children declared in node"
+}
diff --git a/tools/layoutopt/libs/uix/src/resources/rules/TooManyLevels.rule b/tools/layoutopt/libs/uix/src/resources/rules/TooManyLevels.rule
new file mode 100644
index 0000000..f04e082
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/resources/rules/TooManyLevels.rule
@@ -0,0 +1,11 @@
+// Rule: TooManyLevels
+//
+// Description: Checks whether the layout has too many nested groups.
+//
+// Conditions:
+// - The depth of the layout is > 10
+
+if (node.isRoot() && (depth = node.depth()) > 10) {
+    analysis << [node: null, description: "This layout has too many nested layouts: " +
+            "${depth} levels, it should have <= 10!"]
+}
diff --git a/tools/layoutopt/libs/uix/src/resources/rules/TooManyViews.rule b/tools/layoutopt/libs/uix/src/resources/rules/TooManyViews.rule
new file mode 100644
index 0000000..544a888
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/resources/rules/TooManyViews.rule
@@ -0,0 +1,11 @@
+// Rule: TooManyViews
+//
+// Description: Checks whether the layout has too many views.
+//
+// Conditions:
+// - The document contains more than 80 views
+
+if (node.isRoot && (size = node.'**'.size()) > 80) {
+    analysis << [node: null,
+            description: "This layout has too many views: ${size} views, it should have <= 80!"]
+}
diff --git a/tools/layoutopt/libs/uix/src/resources/rules/UseCompoundDrawables.rule b/tools/layoutopt/libs/uix/src/resources/rules/UseCompoundDrawables.rule
new file mode 100644
index 0000000..4e4a6ba
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/resources/rules/UseCompoundDrawables.rule
@@ -0,0 +1,15 @@
+// Rule: UseCompoundDrawables
+//
+// Description: Checks whether the current node can be replaced by a TextView
+//              using compound drawables.
+//
+// Conditions:
+// - The node is a LinearLayout
+// - The node has two children, ImageView and TextView
+// - The ImageView does not have a weight
+
+if (node.is("LinearLayout") && node.'*'.size() == 2 && node.'TextView'.size() == 1 &&
+        node.'ImageView'.size() == 1 && !node.'ImageView'[0].'@android:layout_weight') {
+    analysis << "This tag and its children can be replaced by one <TextView/> and " +
+            "a compound drawable"
+}
diff --git a/tools/layoutopt/libs/uix/src/resources/rules/UselessLayout.rule b/tools/layoutopt/libs/uix/src/resources/rules/UselessLayout.rule
new file mode 100644
index 0000000..9326333
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/resources/rules/UselessLayout.rule
@@ -0,0 +1,19 @@
+// Rule: UselessLayout
+//
+// Description: Checks whether current node can be removed.
+//
+// Conditions:
+// - The node has children
+// - The node does not have siblings
+// - The node's parent is not a scroll view (horizontal or vertical)
+// - The node does not have a background or its parent does not have a
+//   background or neither the node and its parent have a background
+// - The parent is not a <merge/>
+
+if (!node.isRoot() && !(node['..'].name() in ["ScrollView", "HorizontalScrollView"]) &&
+        node['..']['*'].size() == 1 && node['*'].size() > 0 && ((node.'@android:background' ||
+        node['..'].'@android:background') || (!node.'@android:background' &&
+        !node['..'].'@android:background'))) {
+    analysis << "This ${node.name()} layout or its ${node['..'].name()} parent is " +
+            "${node['..'].'@android:id' ? "possibly useless" : "useless"}"
+}
diff --git a/tools/layoutopt/libs/uix/src/resources/rules/UselessView.rule b/tools/layoutopt/libs/uix/src/resources/rules/UselessView.rule
new file mode 100644
index 0000000..c3a77e5
--- /dev/null
+++ b/tools/layoutopt/libs/uix/src/resources/rules/UselessView.rule
@@ -0,0 +1,14 @@
+// Rule: UselessView
+//
+// Description: Checks whether a container view can be removed.
+//
+// Conditions:
+// - The node is a container view (LinearLayout, etc.)
+// - The node has no id
+// - The node has no background
+// - The node has no children
+
+if (node.isContainer() && node.'*'.size() == 0 && !node.'@android:id' &&
+        !node.'@android:background') {
+    analysis << "This ${node.name()} view is useless (no children, no background, no id)"
+}
diff --git a/tools/layoutopt/samples/compound.xml b/tools/layoutopt/samples/compound.xml
new file mode 100644
index 0000000..176089b
--- /dev/null
+++ b/tools/layoutopt/samples/compound.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+
+    <ImageView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+</LinearLayout>
diff --git a/tools/layoutopt/samples/has_children.xml b/tools/layoutopt/samples/has_children.xml
new file mode 100644
index 0000000..f216db5
--- /dev/null
+++ b/tools/layoutopt/samples/has_children.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<ListView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+
+	<ListView 
+	    android:layout_width="fill_parent"
+	    android:layout_height="fill_parent" />
+	
+</ListView>
\ No newline at end of file
diff --git a/tools/layoutopt/samples/inefficient_weight.xml b/tools/layoutopt/samples/inefficient_weight.xml
new file mode 100644
index 0000000..785350a
--- /dev/null
+++ b/tools/layoutopt/samples/inefficient_weight.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+
+	<Button 
+	    android:layout_width="fill_parent"
+	    android:layout_height="wrap_content"
+	 	android:layout_weight="1.0" />
+	
+	<LinearLayout
+	    xmlns:android="http://schemas.android.com/apk/res/android"
+
+	    android:layout_width="fill_parent"
+	    android:layout_height="fill_parent"
+	
+		android:orientation="vertical">
+
+		<Button 
+		    android:layout_width="fill_parent"
+		    android:layout_height="wrap_content"
+		 	android:layout_weight="1.0" />
+
+	</LinearLayout>
+	
+	<LinearLayout
+	    xmlns:android="http://schemas.android.com/apk/res/android"
+
+	    android:layout_width="fill_parent"
+	    android:layout_height="fill_parent"
+	
+		android:orientation="vertical">
+
+		<Button 
+		    android:layout_width="fill_parent"
+		    android:layout_height="0dip"
+		 	android:layout_weight="1.0" />
+
+	</LinearLayout>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/tools/layoutopt/samples/scrolling.xml b/tools/layoutopt/samples/scrolling.xml
new file mode 100644
index 0000000..534289c
--- /dev/null
+++ b/tools/layoutopt/samples/scrolling.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<ScrollView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+
+	<LinearLayout
+	    android:layout_width="fill_parent"
+	    android:layout_height="fill_parent">
+
+		<ListView 
+		    android:layout_width="fill_parent"
+		    android:layout_height="fill_parent" />
+
+	</LinearLayout>
+
+</ScrollView>
diff --git a/tools/layoutopt/samples/simple.xml b/tools/layoutopt/samples/simple.xml
new file mode 100644
index 0000000..1fd36e2
--- /dev/null
+++ b/tools/layoutopt/samples/simple.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<FrameLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent" />
diff --git a/tools/layoutopt/samples/too_deep.xml b/tools/layoutopt/samples/too_deep.xml
new file mode 100644
index 0000000..7317362
--- /dev/null
+++ b/tools/layoutopt/samples/too_deep.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Ok" />
+        
+    <LinearLayout
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
+
+        <LinearLayout
+            android:layout_width="fill_parent"
+            android:layout_height="fill_parent">
+
+            <LinearLayout
+                android:layout_width="fill_parent"
+                android:layout_height="fill_parent">
+
+                <LinearLayout
+                    android:layout_width="fill_parent"
+                    android:layout_height="fill_parent">
+
+                    <LinearLayout
+                        android:layout_width="fill_parent"
+                        android:layout_height="fill_parent">
+
+                        <LinearLayout
+                            android:layout_width="fill_parent"
+                            android:layout_height="fill_parent">
+
+                            <LinearLayout
+                                android:layout_width="fill_parent"
+                                android:layout_height="fill_parent">
+
+                                <LinearLayout
+                                    android:layout_width="fill_parent"
+                                    android:layout_height="fill_parent">
+
+                                    <LinearLayout
+                                        android:layout_width="fill_parent"
+                                        android:layout_height="fill_parent">
+
+                                        <LinearLayout
+                                            android:layout_width="fill_parent"
+                                            android:layout_height="fill_parent">
+
+                                            <LinearLayout
+                                                android:layout_width="fill_parent"
+                                                android:layout_height="fill_parent">
+
+                                                <Button
+                                                    android:layout_width="wrap_content"
+                                                    android:layout_height="wrap_content"
+                                                    android:text="Ok" />
+
+                                            </LinearLayout>
+
+                                        </LinearLayout>
+
+                                    </LinearLayout>
+
+                                </LinearLayout>
+
+                            </LinearLayout>
+
+                        </LinearLayout>
+
+                    </LinearLayout>
+
+                </LinearLayout>
+
+            </LinearLayout>
+
+        </LinearLayout>
+
+    </LinearLayout>
+
+</LinearLayout>
diff --git a/tools/layoutopt/samples/too_many.xml b/tools/layoutopt/samples/too_many.xml
new file mode 100644
index 0000000..41c18ff
--- /dev/null
+++ b/tools/layoutopt/samples/too_many.xml
@@ -0,0 +1,413 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<FrameLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+    
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Ok" />
+
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Ok" />
+
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Ok" />
+
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Ok" />
+
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Ok" />
+
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Ok" />
+
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Ok" />
+
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Ok" />
+
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Ok" />
+
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Ok" />
+
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Ok" />
+
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Ok" />
+
+    <LinearLayout
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+            <LinearLayout
+                android:layout_width="fill_parent"
+                android:layout_height="fill_parent">
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+            </LinearLayout>
+
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent">
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Ok" />
+
+            <LinearLayout
+                android:layout_width="fill_parent"
+                android:layout_height="fill_parent">
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+                <Button
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="Ok" />
+
+            </LinearLayout>
+
+    </LinearLayout>
+
+</FrameLayout>
diff --git a/tools/layoutopt/samples/useless.xml b/tools/layoutopt/samples/useless.xml
new file mode 100644
index 0000000..1c2d5d8
--- /dev/null
+++ b/tools/layoutopt/samples/useless.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<FrameLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+
+	<LinearLayout
+		android:layout_width="fill_parent"
+	    android:layout_height="fill_parent">
+	
+		<TextView
+			android:layout_width="wrap_content"
+		    android:layout_height="wrap_content" />
+	
+	</LinearLayout>
+
+</FrameLayout>
diff --git a/tools/layoutopt/samples/wrong_dimension.xml b/tools/layoutopt/samples/wrong_dimension.xml
new file mode 100644
index 0000000..c0b292b
--- /dev/null
+++ b/tools/layoutopt/samples/wrong_dimension.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<HorizontalScrollView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+
+	<LinearLayout
+	    android:layout_width="fill_parent"
+	    android:layout_height="fill_parent" />
+
+</HorizontalScrollView>
diff --git a/tools/monkeyrunner/src/Android.mk b/tools/monkeyrunner/src/Android.mk
index 576025a..fb6b9c1 100644
--- a/tools/monkeyrunner/src/Android.mk
+++ b/tools/monkeyrunner/src/Android.mk
@@ -21,9 +21,31 @@
 LOCAL_JAR_MANIFEST := ../etc/manifest.txt
 LOCAL_JAVA_LIBRARIES := \
 	ddmlib \
-	jython
+	jython \
+	xmlwriter
 
 
 LOCAL_MODULE := monkeyrunner
 
 include $(BUILD_HOST_JAVA_LIBRARY)
+
+# Build ext.jar
+# ============================================================
+
+ext_dirs := 	../../../../external/xmlwriter/src
+
+ext_src_files := $(call all-java-files-under,$(ext_dirs))
+
+# ====  the library  =========================================
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(ext_src_files)
+
+LOCAL_NO_STANDARD_LIBRARIES := true
+#LOCAL_JAVA_LIBRARIES := core
+#LOCAL_STATIC_JAVA_LIBRARIES := libgoogleclient
+
+LOCAL_MODULE := xmlwriter
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
diff --git a/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRecorder.java b/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRecorder.java
new file mode 100644
index 0000000..efc002b
--- /dev/null
+++ b/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRecorder.java
@@ -0,0 +1,312 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.monkeyrunner;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.jheer.XMLWriter;
+
+/**
+ *  MonkeyRecorder is a host side class that records the output of scripts that are run. 
+ *  It creates a unique directory, puts in an xml file that records each cmd and result.
+ *  It stores every screenshot in this directory.
+ *  When finished, it zips this all up.
+ *
+ *  Calling Sequence:
+ *    mr = new MonkeyRecorder(scriptName);
+ *    mr.startCommand();
+ *    [mr.addAttribute(name, value);]
+ *    ...
+ *    [mr.addInput(cmd);]
+ *    [mr.addResults(result, filename);]   // filename = "" if no screenshot
+ *    mr.endCommand();
+ *    mr.addComment(comment);
+ *    mr.startCommand();
+ *    ...
+ *    mr.endCommand();
+ *    ...
+ *    mr.close();
+ *
+ *  With MonkeyRunner this should output an xml file, <script_name>-yyyyMMdd-HH:mm:ss.xml, into the
+ *  directory out/<script_name>-yyyyMMdd-HH:mm:ss with the contents:
+ *
+ *  <?xml version="1.0" encoding='UTF-8'?>
+ *  <script_run>
+ *    script_name="filename"
+ *    monkeyRunnerVersion="0.2"
+ *    <!-- Device specific variables -->
+ *    <device_var var_name="name" var_value="value" />
+ *    <device_var name="build.display" value="opal-userdebug 1.6 DRC79 14207 test-keys"/>
+ *    ...
+ *    <!-- Script commands -->
+ *    <command>
+ *      dateTime="20090921-17:08:43"
+ *      <input cmd="Pressing: menu"/>
+ *      <response result="OK" dateTime="20090921-17:08:43"/>
+ *    </command>
+ *    ...
+ *    <command>
+ *      dateTime="20090921-17:09:44"
+ *      <input cmd="grabscreen"/>
+ *      <response result="OK" dateTime="20090921-17:09:45" screenshot="home_screen-20090921-17:09:45.png"/>
+ *    </command>
+ *    ...
+ *  </script_run>
+ *  
+ *  And then zip it up with all the screenshots in the file: <script_name>-yyyyMMdd-HH:mm:ss.zip.
+ */
+ 
+public class MonkeyRecorder {
+
+  // xml file to store output results in
+  private static String mXmlFilename;
+  private static FileWriter mXmlFile;
+  private static XMLWriter mXmlWriter;
+  
+  // unique subdirectory to put results in (screenshots and xml file)
+  private static String mDirname;
+  private static List<String> mScreenShotNames = new ArrayList<String>();
+  
+  // where we store all the results for all the script runs
+  private static final String ROOT_DIR = "out";
+  
+  // for getting the date and time in now()
+  private static final SimpleDateFormat SIMPLE_DATE_TIME_FORMAT = new SimpleDateFormat("yyyyMMdd-HH:mm:ss");
+  
+  /**
+   * Create a new MonkeyRecorder that records commands and zips up screenshots for submittal
+   * 
+   * @param scriptName filepath of the monkey script we are running
+   */
+  public MonkeyRecorder(String scriptName) throws IOException {
+    // Create directory structure to store xml file, images and zips
+    File scriptFile = new File(scriptName);
+    scriptName = scriptFile.getName();  // Get rid of path
+    mDirname = ROOT_DIR + "/" + stripType(scriptName) + "-" + now();
+    new File(mDirname).mkdirs();
+    
+    // Initialize xml file
+    mXmlFilename = stampFilename(stripType(scriptName) + ".xml");
+    initXmlFile(scriptName);
+  }
+
+  // Get the current date and time in a simple string format (used for timestamping filenames)
+  private static String now() {
+    return SIMPLE_DATE_TIME_FORMAT.format(Calendar.getInstance().getTime());     
+  }
+  
+  /**
+   * Initialize the xml file writer
+   * 
+   * @param scriptName filename (not path) of the monkey script, stored as attribute in the xml file
+   */
+  private static void initXmlFile(String scriptName) throws IOException {
+    mXmlFile = new FileWriter(mDirname + "/" + mXmlFilename);
+    mXmlWriter = new XMLWriter(mXmlFile);
+    mXmlWriter.begin();
+    mXmlWriter.comment("Monkey Script Results");
+    mXmlWriter.start("script_run");
+    mXmlWriter.addAttribute("script_name", scriptName);
+  }
+  
+  /**
+   * Add a comment to the xml file.
+   * 
+   * @param comment comment to add to the xml file
+   */
+  public static void addComment(String comment) throws IOException {
+    mXmlWriter.comment(comment);
+  }
+    
+  /**
+   * Begin writing a command xml element
+   */
+  public static void startCommand() throws IOException {
+    mXmlWriter.start("command");
+    mXmlWriter.addAttribute("dateTime", now());
+  }
+  
+  /**
+   * Write a command name attribute in a command xml element.  
+   * It's add as a sinlge script command could be multiple monkey commands.
+   * 
+   * @param cmd command sent to the monkey
+   */
+  public static void addInput(String cmd)  throws IOException {
+    String name = "cmd";
+    String value = cmd;
+    mXmlWriter.tag("input", name, value);
+  }
+  
+  /**
+   * Write a response xml element in a command.  
+   * Attributes include the monkey result, datetime, and possibly screenshot filename
+   * 
+   * @param result response of the monkey to the command
+   * @param filename filename of the screen shot (or other file to be included)
+   */
+  public static void addResult(String result, String filename) throws IOException {
+    int num_args = 2;
+    String[] names = new String[3];
+    String[] values = new String[3];
+    names[0] = "result";
+    values[0] = result;
+    names[1] = "dateTime";
+    values[1] = now();
+    if (filename.length() != 0) {
+      names[2] = "screenshot";
+      values[2] = stampFilename(filename); 
+      addScreenShot(filename);
+      num_args = 3;
+    }
+    mXmlWriter.tag("response", names, values, num_args); 
+  }
+  
+  /**
+   * Add an attribut to an xml element. name="escaped_value"
+   * 
+   * @param name name of the attribute
+   * @param value value of the attribute
+   */
+  public static void addAttribute(String name, String value) throws IOException {
+    mXmlWriter.addAttribute(name, value);
+  }
+
+   /**
+   * Add an xml device variable element. name="escaped_value"
+   * 
+   * @param name name of the variable
+   * @param value value of the variable
+   */
+  public static void addDeviceVar(String name, String value) throws IOException {
+    String[] names = {"name", "value"};
+    String[] values = {name, value};
+    mXmlWriter.tag("device_var", names, values, names.length);
+  }
+ 
+  /**
+   * Move the screenshot to storage and remember you did it so it can be zipped up later.
+   * 
+   * @param filename file name of the screenshot to be stored (Not path name)
+   */
+  private static void addScreenShot(String filename) {
+    File file = new File(filename);
+    String screenShotName = stampFilename(filename);
+    file.renameTo(new File(mDirname, screenShotName));
+    mScreenShotNames.add(screenShotName);
+  }
+
+  /**
+   * Finish writing a command xml element
+   */
+  public static void endCommand() throws IOException {
+    mXmlWriter.end();
+  }
+  
+  /**
+   * Add datetime in front of filetype (the stuff after and including the last infamous '.')
+   *
+   * @param filename path of file to be stamped
+   */
+  private static String stampFilename(String filename) {
+    // 
+    int typeIndex = filename.lastIndexOf('.');
+    if (typeIndex == -1) {
+      return filename + "-" + now();
+    }  
+    return filename.substring(0, typeIndex) + "-" + now() + filename.substring(typeIndex);
+  }
+  
+  /**
+   * Strip out the file type (the stuff after and including the last infamous '.')
+   *
+   * @param filename path of file to be stripped of type information
+   */
+   private static String stripType(String filename) {
+    // 
+    int typeIndex = filename.lastIndexOf('.');
+    if (typeIndex == -1)
+      return filename;
+    return filename.substring(0, typeIndex);
+  }
+  
+   /**
+   * Add a signature element
+   *
+   * @param filename path of file to be signatured
+   */
+   private static void addMD5Signature(String filename) throws IOException {
+      String signature = "";
+      // find signature... MD5 sig = new MD5(filename); signature = sig.toString();
+      String[] names = new String[] { "type", "filename", "signature" };
+      String[] values = new String[] { "md5", filename, signature };
+      mXmlWriter.tag("Signature", names, values, values.length);
+   }
+ 
+
+  /**
+   * Close the monkeyRecorder by closing the xml file and zipping it up with the screenshots.
+   *
+   * @param filename path of file to be stripped of type information
+   */ 
+  public static void close() throws IOException {
+    // zip up xml file and screenshots into ROOT_DIR.
+    byte[] buf = new byte[1024];
+    String zipFileName = mXmlFilename + ".zip";
+    endCommand();
+    mXmlFile.close();
+    FileOutputStream zipFile = new FileOutputStream(ROOT_DIR + "/" + zipFileName);
+    ZipOutputStream out = new ZipOutputStream(zipFile);
+
+    // add the xml file
+    addFileToZip(out, mDirname + "/" + mXmlFilename, buf);
+    
+    // Add the screenshots
+    for (String filename : mScreenShotNames) {
+      addFileToZip(out, mDirname + "/" + filename, buf);
+    }
+    out.close();
+  }
+  
+  /**
+   * Helper function to zip up a file into an open zip archive.
+   *
+   * @param zip the stream of the zip archive
+   * @param filepath the filepath of the file to be added to the zip archive
+   * @param buf storage place to stage reads of file before zipping
+   */ 
+  private static void addFileToZip(ZipOutputStream zip, String filepath, byte[] buf) throws IOException {
+    FileInputStream in = new FileInputStream(filepath);
+    zip.putNextEntry(new ZipEntry(filepath));
+    int len;
+    while ((len = in.read(buf)) > 0) {
+      zip.write(buf, 0, len);
+    }
+    zip.closeEntry();
+    in.close();
+  }
+}
diff --git a/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRunner.java b/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRunner.java
index cbc881c..07a4739 100644
--- a/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRunner.java
+++ b/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRunner.java
@@ -30,18 +30,21 @@
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
 import java.net.InetAddress;
 import java.net.Socket;
 import java.net.UnknownHostException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import javax.imageio.ImageIO;
 
 /**
  *  MonkeyRunner is a host side application to control a monkey instance on a
- * device. MonkeyRunner provides some useful helper functions to control the
- * device as well as various other methods to help script tests. 
+ *  device. MonkeyRunner provides some useful helper functions to control the
+ *  device as well as various other methods to help script tests. 
  */
 public class MonkeyRunner {
 
@@ -50,27 +53,46 @@
   static Socket monkeySocket = null;
 
   static IDevice monkeyDevice;
-  
+
   static BufferedReader monkeyReader;
   static BufferedWriter monkeyWriter;
+  static String monkeyResponse;
+
+  static MonkeyRecorder monkeyRecorder;
 
   static String scriptName = null;
+  
+  // Obtain a suitable logger.
+  private static Logger logger = Logger.getLogger("com.android.monkeyrunner");
 
   // delay between key events
   final static int KEY_INPUT_DELAY = 1000;
+  
+  // version of monkey runner
+  final static String monkeyRunnerVersion = "0.31";
 
-  public static void main(String[] args) {
+  // TODO: interface cmd; class xml tags; fix logger; test class/script
 
+  public static void main(String[] args) throws IOException {
+
+    // haven't figure out how to get below INFO...bad parent.  Pass -v INFO to turn on logging 
+    logger.setLevel(Level.parse("WARNING"));  
     processOptions(args);
     
+    logger.info("initAdb");
     initAdbConnection();
+    logger.info("openMonkeyConnection");
     openMonkeyConnection();
 
+    logger.info("start_script");
     start_script();
     
+    logger.info("ScriptRunner.run");
     ScriptRunner.run(scriptName);
    
+    logger.info("end_script");
     end_script();
+    logger.info("closeMonkeyConnection");
     closeMonkeyConnection();  
   }
 
@@ -166,13 +188,15 @@
     try {
       InetAddress addr = InetAddress.getByName(monkeyServer);
       monkeySocket = new Socket(addr, monkeyPort);
+      monkeyWriter = new BufferedWriter(new OutputStreamWriter(monkeySocket.getOutputStream()));
+      monkeyReader = new BufferedReader(new InputStreamReader(monkeySocket.getInputStream()));
     } catch (UnknownHostException e) {
       e.printStackTrace();
     } catch(IOException e) {
       e.printStackTrace();
     }
   }
-
+  
   /** 
    * Close tcp session with the monkey on the device
    * 
@@ -189,47 +213,59 @@
   }
 
   /** 
-   * This is a house cleaning type routine to run before starting a script. Puts
-   * the device in a known state.
+   * This is a house cleaning routine to run before starting a script. Puts
+   * the device in a known state and starts recording interesting info.
    */
-  public static void start_script() {
-    press("menu");
-    press("menu");
-    press("home");
+  public static void start_script() throws IOException {
+    press("menu", false);
+    press("menu", false);
+    press("home", false);
+    
+    // Start recording the script output, might want md5 signature of file for completeness
+    monkeyRecorder = new MonkeyRecorder(scriptName);
+
+    // Record what device and version of software we are running on
+    monkeyRecorder.addAttribute("monkeyRunnerVersion", monkeyRunnerVersion);
+    addDeviceVars();
+    monkeyRecorder.addComment("Script commands");
   }
 
-  public static void end_script() {
-    String command = "END";
-    sendMonkeyEvent(command);
+  /** 
+   * This is a house cleaning routine to run after finishing a script.
+   * Puts the monkey server in a known state and closes the recording.
+   */
+  public static void end_script() throws IOException {
+    String command = "done";
+    sendMonkeyEvent(command, false, false);
+    
+    // Stop the recording and zip up the results
+    monkeyRecorder.close();
   }
 
   /** This is a method for scripts to launch an activity on the device
    * 
    * @param name The name of the activity to launch 
    */
-  public static void launch_activity(String name) {
-    try {
-      System.out.println("Launching: " + name);
-      monkeyDevice.executeShellCommand("am start -a android.intent.action.MAIN -n " 
-          + name, new NullOutputReceiver());
-    } catch (Exception e) {
-      e.printStackTrace();
-    }
-  }
+  public static void launch_activity(String name) throws IOException {
+    System.out.println("Launching: " + name);
+    recordCommand("Launching: " + name);
+    monkeyDevice.executeShellCommand("am start -a android.intent.action.MAIN -n " 
+        + name, new NullOutputReceiver());
+    // void return, so no response given, just close the command element in the xml file.
+    monkeyRecorder.endCommand();
+   }
 
   /**
    * Grabs the current state of the screen stores it as a png
    * 
    * @param tag filename or tag descriptor of the screenshot
    */
-  public static void grabscreen(String tag) {
+  public static void grabscreen(String tag) throws IOException {
     tag += ".png";
 
     try {
       Thread.sleep(1000);
       getDeviceImage(monkeyDevice, tag, false);
-    } catch (IOException e) {
-      e.printStackTrace();
     } catch (InterruptedException e) {
     }
   }
@@ -239,9 +275,11 @@
    * 
    * @param msec msecs to sleep for
    */
-  public static void sleep(int msec) {
+  public static void sleep(int msec) throws IOException {
     try {
+      recordCommand("sleep: " + msec);
       Thread.sleep(msec);
+      recordResponse("OK");
     } catch (InterruptedException e) {
       e.printStackTrace();
     }
@@ -253,12 +291,10 @@
    * @param x x-coordinate
    * @param y y-coordinate
    */
-  public static boolean tap(int x, int y) {
-    String command = "touch down " + x + "  " + y + "\r\n" +
-    "touch up " + x + " " + y + "\r\n";
-
-    System.out.println("Tapping: " + x + ", " + y);
-    return sendMonkeyEvent(command);
+  public static boolean tap(int x, int y) throws IOException {
+    String command = "tap " + x + " " + y;
+    boolean result = sendMonkeyEvent(command);
+    return result;
   }
 
   /** 
@@ -266,25 +302,33 @@
    * 
    * @param key key to press
    */
-  public static boolean press(String key) {
-    String command = "key down " + key + "\r\n" +
-    "key up " + key + "\r\n";
+  public static boolean press(String key) throws IOException {
+    return press(key, true);
+  }
 
-    System.out.println("Pressing: " + key);
-    return sendMonkeyEvent(command);
+  /** 
+   * Press function for scripts to call on a particular button or key
+   * 
+   * @param key key to press
+   * @param print whether to send output to user
+   */
+  private static boolean press(String key, boolean print) throws IOException {
+    String command = "press " + key;
+    boolean result = sendMonkeyEvent(command, print, true);
+    return result;
   }
 
   /**
    * dpad down function
    */
-  public static boolean down() {
+  public static boolean down() throws IOException {
     return press("dpad_down");
   }
 
   /**
    * dpad up function
    */
-  public static boolean up() {
+  public static boolean up() throws IOException {
     return press("dpad_up");
   }
 
@@ -293,69 +337,173 @@
    * 
    * @param text text to type
    */
-  public static boolean type(String text) {
-    System.out.println("Typing: " + text);
-    for (int i=0; i<text.length(); i++) {
-      String command = "key down ";
-      char c = text.charAt(i);
-      if(Character.isDigit(c)) {
-        command += "KEYCODE_" + c + "\n" + "key up KEYCODE_" + c + "\n";
-      } else {
-        command = "key down " + c + "\n" + "key up " + c + "\n";
-      }
-
-      if(!sendMonkeyEvent(command)) {
-        System.out.println("\nERROR: Key not set \n");
-      }
-
-      // lets delay a bit after each input to ensure accuracy
-      try {
-        Thread.sleep(KEY_INPUT_DELAY);
-      } catch (InterruptedException e) {
-      }
+  public static boolean type(String text) throws IOException {
+    boolean result = false;
+    // text might have line ends, which signal new monkey command, so we have to eat and reissue
+    String[] lines = text.split("[\\r\\n]+");
+    for (String line: lines) {
+      result = sendMonkeyEvent("type " + line + "\n");
     }
+    // return last result.  Should never fail..?
+    return result;
+  }
+  
+  /**
+   * Function to get a static variable from the device
+   * 
+   * @param name name of static variable to get
+   */
+  public static boolean getvar(String name) throws IOException {
+    return sendMonkeyEvent("getvar " + name + "\n");
+  }
 
-    return true;
+  /**
+   * Function to get the list of static variables from the device
+   */
+  public static boolean listvar() throws IOException {
+    return sendMonkeyEvent("listvar \n");
   }
 
   /**
    * This function is the communication bridge between the host and the device.
    * It sends monkey events and waits for responses over the adb tcp socket.
+   * This version if for all scripted events so that they get recorded and reported to user.
    * 
    * @param command the monkey command to send to the device
    */
-  private static boolean sendMonkeyEvent(String command) {
-    try {
-      monkeyWriter = new BufferedWriter(
-          new OutputStreamWriter(monkeySocket.getOutputStream()));
-      monkeyWriter.write(command);
-      monkeyWriter.flush();
+  private static boolean sendMonkeyEvent(String command) throws IOException {
+    return sendMonkeyEvent(command, true, true);
+  }
 
-      monkeyReader = new BufferedReader(
-          new InputStreamReader(monkeySocket.getInputStream()));
-      String response = monkeyReader.readLine();
+  /**
+   * This function allows the communication bridge between the host and the device
+   * to be invisible to the script for internal needs.
+   * It splits a command into monkey events and waits for responses for each over an adb tcp socket.
+   * Returns on an error, else continues and sets up last response.
+   * 
+   * @param command the monkey command to send to the device
+   * @param print whether to print out the responses to the user
+   * @param record whether to put the command in the xml file that stores test outputs
+   */
+  private static boolean sendMonkeyEvent(String command, Boolean print, Boolean record) throws IOException {
+    command = command.trim();
+    if (print)
+      System.out.println("MonkeyCommand: " + command);
+    if (record)
+      recordCommand(command);
+    logger.info("Monkey Command: " + command + ".");
+      
+    // send a single command and get the response
+    monkeyWriter.write(command + "\n");
+    monkeyWriter.flush();
+    monkeyResponse = monkeyReader.readLine();
 
-      sleep(1000);
-      System.out.println("MonkeyServer: " + response);
-      if(response.equals("OK"))
-        return true;
-      if(response.equals("ERROR"))
+    if(monkeyResponse != null) {
+      // if a command returns with a response
+      if (print)
+        System.out.println("MonkeyServer: " + monkeyResponse);
+      if (record)
+        recordResponse(monkeyResponse);
+      logger.info("Monkey Response: " + monkeyResponse + ".");
+
+      // return on error
+      if (monkeyResponse.startsWith("ERROR"))
         return false;
 
-    } catch (IOException e) {
-      e.printStackTrace();
-    }
+      // return on ok
+      if(monkeyResponse.startsWith("OK"))
+        return true;
 
+      // return on something else?
+      return false;
+    }
+    // didn't get a response...
+    if (print)
+      System.out.println("MonkeyServer: ??no response");
+    if (record)
+      recordResponse("??no response");
+    logger.info("Monkey Response: ??no response.");
+
+    //return on no response
     return false;
   }
 
-
+  /**
+   * Record the command in the xml file
+   *
+   * @param command the command sent to the monkey server
+   */
+  private static void recordCommand(String command) throws IOException {
+    if (monkeyRecorder != null) {                       // don't record setup junk
+      monkeyRecorder.startCommand();
+      monkeyRecorder.addInput(command);
+    }
+  }
+  
+  /**
+   * Record the response in the xml file
+   *
+   * @param response the response sent by the monkey server
+   */
+  private static void recordResponse(String response) throws IOException {
+    recordResponse(response, "");
+  } 
+  
+  /**
+   * Record the response and the filename in the xml file, store the file (to be zipped up later)
+   *
+   * @param response the response sent by the monkey server
+   * @param filename the filename of a file to be time stamped, recorded in the xml file and stored
+   */
+  private static void recordResponse(String response, String filename) throws IOException {
+    if (monkeyRecorder != null) {                    // don't record setup junk
+      monkeyRecorder.addResult(response, filename);  // ignores file if filename empty
+      monkeyRecorder.endCommand();
+    }
+  }
+    
+  /**
+   * Add the device variables to the xml file in monkeyRecorder.
+   * The results get added as device_var tags in the script_run tag
+   */
+  private static void addDeviceVars() throws IOException {
+    monkeyRecorder.addComment("Device specific variables");
+    sendMonkeyEvent("listvar \n", false, false);
+    if (monkeyResponse.startsWith("OK:")) {
+      // peel off "OK:" string and get the individual var names  
+      String[] varNames = monkeyResponse.substring(3).split("\\s+");
+      // grab all the individual var values
+      for (String name: varNames) {
+        sendMonkeyEvent("getvar " + name, false, false);
+        if(monkeyResponse != null) {
+          if (monkeyResponse.startsWith("OK") ) {
+            if (monkeyResponse.length() > 2) {
+              monkeyRecorder.addDeviceVar(name, monkeyResponse.substring(3));
+            } else { 
+              // only got OK - good variable but no value
+              monkeyRecorder.addDeviceVar(name, "null");
+            }
+          } else { 
+            // error returned - couldn't get var value for name... include error return
+            monkeyRecorder.addDeviceVar(name, monkeyResponse);
+          }
+        } else { 
+          // no monkeyResponse - bad variable with no value
+          monkeyRecorder.addDeviceVar(name, "null");
+        }
+      }
+    } else {
+      // it's an error, can't find variable names...
+      monkeyRecorder.addAttribute("listvar", monkeyResponse);
+    }
+  }
+  
   /**
    * Process the command-line options
    *
    * @return Returns true if options were parsed with no apparent errors.
    */
-  public static void processOptions(String[] args) {
+  private static void processOptions(String[] args) {
     // parse command line parameters.
     int index = 0;
 
@@ -364,7 +512,7 @@
 
       if ("-s".equals(argument)) {
         if(index == args.length) {
-          printAndExit("Missing Server after -s", false);
+          printUsageAndQuit("Missing Server after -s");
         }
 
         monkeyServer = args[index++];
@@ -372,18 +520,32 @@
       } else if ("-p".equals(argument)) {
         // quick check on the next argument.
         if (index == args.length) {
-          printAndExit("Missing Server IP after -p", false /* terminate */);
+          printUsageAndQuit("Missing Server port after -p");
         }
 
         monkeyPort = Integer.parseInt(args[index++]);
-      } else {
-        // get the filepath of the script to run.
-        scriptName = argument;
 
-        // should not be any other device.
-        //if (index < args.length) {
-        //    printAndExit("Too many arguments!", false /* terminate */);
-        //}
+      } else if ("-v".equals(argument)) {
+        // quick check on the next argument.
+        if (index == args.length) {
+          printUsageAndQuit("Missing Log Level after -v");
+        }
+
+        Level level = Level.parse(args[index++]);
+        logger.setLevel(level);
+        level = logger.getLevel();
+        System.out.println("Log level set to: " + level + "(" + level.intValue() + ").");
+        System.out.println("Warning: Log levels below INFO(800) not working currently... parent issues");
+        
+      } else if (argument.startsWith("-")) {
+        // we have an unrecognized argument.
+        printUsageAndQuit("Unrecognized argument: " + argument + ".");
+
+        monkeyPort = Integer.parseInt(args[index++]);
+
+      } else {
+        // get the filepath of the script to run.  This will be the last undashed argument.
+        scriptName = argument;
       }
     } while (index < args.length);
   }
@@ -394,22 +556,29 @@
   private static void getDeviceImage(IDevice device, String filepath, boolean landscape)
   throws IOException {
     RawImage rawImage;
+    recordCommand("grabscreen");
+    System.out.println("Grabbing Screeshot: " + filepath + ".");
 
     try {
       rawImage = device.getScreenshot();
     }
     catch (IOException ioe) {
+      recordResponse("No frame buffer", "");
       printAndExit("Unable to get frame buffer: " + ioe.getMessage(), true /* terminate */);
       return;
     }
 
     // device/adb not available?
-    if (rawImage == null)
+    if (rawImage == null) {
+      recordResponse("No image", "");
       return;
-
+    }
+    
     assert rawImage.bpp == 16;
 
     BufferedImage image;
+    
+    logger.info("Raw Image - height: " + rawImage.height + ", width: " + rawImage.width);
 
     if (landscape) {
       // convert raw data to an Image
@@ -458,16 +627,20 @@
     }
 
     if (!ImageIO.write(image, "png", new File(filepath))) {
+      recordResponse("No png writer", "");
       throw new IOException("Failed to find png writer");
     }
+    recordResponse("OK", filepath);
   }
 
-  private static void printUsageAndQuit() {
+  private static void printUsageAndQuit(String message) {
     // 80 cols marker:  01234567890123456789012345678901234567890123456789012345678901234567890123456789
+    System.out.println(message);
     System.out.println("Usage: monkeyrunner [options] SCRIPT_FILE");
     System.out.println("");
     System.out.println("    -s      MonkeyServer IP Address.");
     System.out.println("    -p      MonkeyServer TCP Port.");
+    System.out.println("    -v      MonkeyServer Logging level (ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE, OFF)");
     System.out.println("");
     System.out.println("");
 
diff --git a/tools/ninepatch/.classpath b/tools/ninepatch/.classpath
new file mode 100644
index 0000000..fb50116
--- /dev/null
+++ b/tools/ninepatch/.classpath
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tools/ninepatch/.gitignore b/tools/ninepatch/.gitignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/tools/ninepatch/.gitignore
@@ -0,0 +1 @@
+bin
diff --git a/tools/ninepatch/.project b/tools/ninepatch/.project
new file mode 100644
index 0000000..192f000
--- /dev/null
+++ b/tools/ninepatch/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>ninepatch</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/tools/ninepatch/src/com/android/ninepatch/GraphicsUtilities.java b/tools/ninepatch/src/com/android/ninepatch/GraphicsUtilities.java
index 7a823ec..e8d71d6 100644
--- a/tools/ninepatch/src/com/android/ninepatch/GraphicsUtilities.java
+++ b/tools/ninepatch/src/com/android/ninepatch/GraphicsUtilities.java
@@ -25,6 +25,7 @@
 import java.awt.Transparency;
 import java.net.URL;
 import java.io.IOException;
+import java.io.InputStream;
 
 public class GraphicsUtilities {
     public static BufferedImage loadCompatibleImage(URL resource) throws IOException {
@@ -32,6 +33,11 @@
         return toCompatibleImage(image);
     }
 
+    public static BufferedImage loadCompatibleImage(InputStream stream) throws IOException {
+        BufferedImage image = ImageIO.read(stream);
+        return toCompatibleImage(image);
+    }
+
     public static BufferedImage createCompatibleImage(int width, int height) {
         return getGraphicsConfiguration().createCompatibleImage(width, height);
     }
diff --git a/tools/ninepatch/src/com/android/ninepatch/NinePatch.java b/tools/ninepatch/src/com/android/ninepatch/NinePatch.java
index 35a1824..7484fd8 100644
--- a/tools/ninepatch/src/com/android/ninepatch/NinePatch.java
+++ b/tools/ninepatch/src/com/android/ninepatch/NinePatch.java
@@ -21,6 +21,7 @@
 import java.awt.RenderingHints;
 import java.awt.image.BufferedImage;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -33,7 +34,7 @@
     public static final String EXTENSION_9PATCH = ".9.png";
 
     private BufferedImage mImage;
-    
+
     private int mMinWidth;
     private int mMinHeight;
 
@@ -50,7 +51,7 @@
 
     private Pair<Integer> mHorizontalPadding;
     private Pair<Integer> mVerticalPadding;
-    
+
     private float mHorizontalPatchesSum;
     private float mVerticalPatchesSum;
 
@@ -58,12 +59,10 @@
 
     private int mRemainderVertical;
 
-    private final URL mFileUrl;
-
     /**
      * Loads a 9 patch or regular bitmap.
      * @param fileUrl the URL of the file to load.
-     * @param convert if <code>true</code>, non 9-patch bitmpa will be converted into a 9 patch.
+     * @param convert if <code>true</code>, non 9-patch bitmap will be converted into a 9 patch.
      * If <code>false</code> and the bitmap is not a 9 patch, the method will return
      * <code>null</code>.
      * @return a {@link NinePatch} or <code>null</code>.
@@ -77,9 +76,46 @@
             // really this shouldn't be happening since we're not creating the URL manually.
             return null;
         }
-        
+
         boolean is9Patch = fileUrl.getPath().toLowerCase().endsWith(EXTENSION_9PATCH);
-        
+
+        return load(image, is9Patch, convert);
+    }
+
+    /**
+     * Loads a 9 patch or regular bitmap.
+     * @param stream the {@link InputStream} of the file to load.
+     * @param is9Patch whether the file represents a 9-patch
+     * @param convert if <code>true</code>, non 9-patch bitmap will be converted into a 9 patch.
+     * If <code>false</code> and the bitmap is not a 9 patch, the method will return
+     * <code>null</code>.
+     * @return a {@link NinePatch} or <code>null</code>.
+     * @throws IOException
+     */
+    public static NinePatch load(InputStream stream, boolean is9Patch, boolean convert)
+            throws IOException {
+        BufferedImage image = null;
+        try {
+            image  = GraphicsUtilities.loadCompatibleImage(stream);
+        } catch (MalformedURLException e) {
+            // really this shouldn't be happening since we're not creating the URL manually.
+            return null;
+        }
+
+        return load(image, is9Patch, convert);
+    }
+
+    /**
+     * Loads a 9 patch or regular bitmap.
+     * @param image the source {@link BufferedImage}.
+     * @param is9Patch whether the file represents a 9-patch
+     * @param convert if <code>true</code>, non 9-patch bitmap will be converted into a 9 patch.
+     * If <code>false</code> and the bitmap is not a 9 patch, the method will return
+     * <code>null</code>.
+     * @return a {@link NinePatch} or <code>null</code>.
+     * @throws IOException
+     */
+    public static NinePatch load(BufferedImage image, boolean is9Patch, boolean convert) {
         if (is9Patch == false) {
             if (convert) {
                 image = convertTo9Patch(image);
@@ -90,10 +126,9 @@
             ensure9Patch(image);
         }
 
-        
-        return new NinePatch(fileUrl, image);
+        return new NinePatch(image);
     }
-    
+
     public int getWidth() {
         return mImage.getWidth() - 2;
     }
@@ -101,9 +136,9 @@
     public int getHeight() {
         return mImage.getHeight() - 2;
     }
-    
+
     /**
-     * 
+     *
      * @param padding array of left, top, right, bottom padding
      * @return
      */
@@ -124,7 +159,7 @@
         Graphics2D g = (Graphics2D)graphics2D.create();
         g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                 RenderingHints.VALUE_INTERPOLATION_BILINEAR);
-        
+
 
         try {
             if (mPatches.size() == 0) {
@@ -134,30 +169,30 @@
 
             g.translate(x, y);
             x = y = 0;
-            
+
             computePatches(scaledWidth, scaledHeight);
-    
+
             int fixedIndex = 0;
             int horizontalIndex = 0;
             int verticalIndex = 0;
             int patchIndex = 0;
-    
+
             boolean hStretch;
             boolean vStretch;
-    
+
             float vWeightSum = 1.0f;
             float vRemainder = mRemainderVertical;
-    
+
             vStretch = mVerticalStartWithPatch;
             while (y < scaledHeight - 1) {
                 hStretch = mHorizontalStartWithPatch;
-    
+
                 int height = 0;
                 float vExtra = 0.0f;
-    
+
                 float hWeightSum = 1.0f;
                 float hRemainder = mRemainderHorizontal;
-    
+
                 while (x < scaledWidth - 1) {
                     Rectangle r;
                     if (!vStretch) {
@@ -197,7 +232,7 @@
                                     r.x + r.width, r.y + r.height, null);
                             x += r.width;
                         }
-                        
+
                     }
                     hStretch = !hStretch;
                 }
@@ -209,12 +244,12 @@
                 }
                 vStretch = !vStretch;
             }
-    
+
         } finally {
             g.dispose();
         }
     }
-    
+
     void computePatches(int scaledWidth, int scaledHeight) {
         boolean measuredWidth = false;
         boolean endRow = true;
@@ -283,14 +318,13 @@
         }
     }
 
-    
-    private NinePatch(URL fileUrl, BufferedImage image) {
-        mFileUrl = fileUrl;
+
+    private NinePatch(BufferedImage image) {
         mImage = image;
-        
+
         findPatches();
     }
-    
+
     private void findPatches() {
         int width = mImage.getWidth();
         int height = mImage.getHeight();
@@ -462,7 +496,7 @@
 
         return buffer;
     }
-    
+
     static class Pair<E> {
         E mFirst;
         E mSecond;
diff --git a/tools/screenshot/src/com/android/screenshot/Screenshot.java b/tools/screenshot/src/com/android/screenshot/Screenshot.java
index 06e1f6b..a3fe520 100644
--- a/tools/screenshot/src/com/android/screenshot/Screenshot.java
+++ b/tools/screenshot/src/com/android/screenshot/Screenshot.java
@@ -208,53 +208,21 @@
         if (rawImage == null)
             return;
 
-        assert rawImage.bpp == 16;
-
-        BufferedImage image;
-
         if (landscape) {
-            // convert raw data to an Image
-            image = new BufferedImage(rawImage.height, rawImage.width,
-                    BufferedImage.TYPE_INT_ARGB);
+            rawImage = rawImage.getRotated();
+        }
 
-            byte[] buffer = rawImage.data;
-            int index = 0;
-            for (int y = 0 ; y < rawImage.height ; y++) {
-                for (int x = 0 ; x < rawImage.width ; x++) {
+        // convert raw data to an Image
+        BufferedImage image = new BufferedImage(rawImage.width, rawImage.height,
+                BufferedImage.TYPE_INT_ARGB);
 
-                    int value = buffer[index++] & 0x00FF;
-                    value |= (buffer[index++] << 8) & 0x0FF00;
-
-                    int r = ((value >> 11) & 0x01F) << 3;
-                    int g = ((value >> 5) & 0x03F) << 2;
-                    int b = ((value >> 0) & 0x01F) << 3;
-
-                    value = 0xFF << 24 | r << 16 | g << 8 | b;
-
-                    image.setRGB(y, rawImage.width - x - 1, value);
-                }
-            }
-        } else {
-            // convert raw data to an Image
-            image = new BufferedImage(rawImage.width, rawImage.height,
-                    BufferedImage.TYPE_INT_ARGB);
-
-            byte[] buffer = rawImage.data;
-            int index = 0;
-            for (int y = 0 ; y < rawImage.height ; y++) {
-                for (int x = 0 ; x < rawImage.width ; x++) {
-
-                    int value = buffer[index++] & 0x00FF;
-                    value |= (buffer[index++] << 8) & 0x0FF00;
-
-                    int r = ((value >> 11) & 0x01F) << 3;
-                    int g = ((value >> 5) & 0x03F) << 2;
-                    int b = ((value >> 0) & 0x01F) << 3;
-
-                    value = 0xFF << 24 | r << 16 | g << 8 | b;
-
-                    image.setRGB(x, y, value);
-                }
+        int index = 0;
+        int IndexInc = rawImage.bpp >> 3;
+        for (int y = 0 ; y < rawImage.height ; y++) {
+            for (int x = 0 ; x < rawImage.width ; x++) {
+                int value = rawImage.getARGB(index);
+                index += IndexInc;
+                image.setRGB(x, y, value);
             }
         }
 
diff --git a/tools/scripts/AndroidManifest.template b/tools/scripts/AndroidManifest.template
index 2b06e76..f14f147 100644
--- a/tools/scripts/AndroidManifest.template
+++ b/tools/scripts/AndroidManifest.template
@@ -3,8 +3,8 @@
       package="PACKAGE"
       android:versionCode="1"
       android:versionName="1.0">
-    <application android:label="@string/app_name">
-        <activity android:name=".ACTIVITY_NAME"
+    <application android:label="@string/app_name" ICON>
+        <activity android:name="ACTIVITY_ENTRY_NAME"
                   android:label="@string/app_name">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
diff --git a/tools/scripts/AndroidManifest.tests.template b/tools/scripts/AndroidManifest.tests.template
index 1f7d827..c74ff6d 100644
--- a/tools/scripts/AndroidManifest.tests.template
+++ b/tools/scripts/AndroidManifest.tests.template
@@ -17,5 +17,5 @@
     -->
     <instrumentation android:name="android.test.InstrumentationTestRunner"
                      android:targetPackage="PACKAGE"
-                     android:label="Tests for ACTIVITY_NAME"/>
+                     android:label="Tests for PACKAGE"/>
 </manifest>
diff --git a/tools/scripts/alias_rules.xml b/tools/scripts/alias_rules.xml
index 5702461..273da45 100644
--- a/tools/scripts/alias_rules.xml
+++ b/tools/scripts/alias_rules.xml
@@ -5,22 +5,22 @@
 -->
 <project name="alias_rules" default="package">
 
-    <!-- No user servicable parts below. -->
+    <!-- No user serviceable parts below. -->
 
     <!-- Input directories -->
-    <property name="resource-dir" value="res" />
+    <property name="resource.dir" value="res" />
 
     <!-- The final package file to generate -->
-    <property name="out-package" value="${ant.project.name}.apk" />
+    <property name="out.package" value="${ant.project.name}.apk" />
 
     <!-- Tools -->
-    <condition property="aapt" value="${android-tools}/aapt.exe" else="${android-tools}/aapt" >
-        <os family="windows"/>
+    <condition property="aapt" value="${android.tools.dir}/aapt.exe" else="${android.tools.dir}/aapt">
+        <os family="windows" />
     </condition>
-    <condition property="adb" value="${android-tools}/adb.exe" else="${android-tools}/adb" >
-        <os family="windows"/>
+    <condition property="adb" value="${android.tools.dir}/adb.exe" else="${android.tools.dir}/adb">
+        <os family="windows" />
     </condition>
-    <property name="android-jar" value="${sdk-folder}/android.jar" />
+    <property name="android.jar" value="${sdk.dir}/android.jar" />
 
     <!-- Rules -->
 
@@ -33,11 +33,11 @@
             <arg value="-M" />
             <arg value="AndroidManifest.xml" />
             <arg value="-S" />
-            <arg value="${resource-dir}" />
+            <arg value="${resource.dir}" />
             <arg value="-I" />
-            <arg value="${android-jar}" />
+            <arg value="${android.jar}" />
             <arg value="-F" />
-            <arg value="${out-package}" />
+            <arg value="${out.package}" />
         </exec>
     </target>
 
@@ -49,7 +49,7 @@
         <echo>Sending package to default emulator...</echo>
         <exec executable="${adb}" failonerror="true">
             <arg value="install" />
-            <arg value="${out-package}" />
+            <arg value="${out.package}" />
         </exec>
     </target>
 
diff --git a/tools/scripts/android_rules.xml b/tools/scripts/android_rules.xml
index ad36cbe..675017c 100644
--- a/tools/scripts/android_rules.xml
+++ b/tools/scripts/android_rules.xml
@@ -6,7 +6,7 @@
             com.android.ant.AndroidInitTask
 
         The following properties are put in place by the importing task:
-            android-jar, android-aidl, aapt, aidl, and dx
+            android.jar, android.aidl, aapt, aidl, and dx
 
         Additionnaly, the task sets up the following classpath reference:
             android.target.classpath
@@ -16,184 +16,291 @@
     <!-- Custom tasks -->
     <taskdef name="aaptexec"
         classname="com.android.ant.AaptExecLoopTask"
-        classpathref="android.antlibs"/>
+        classpathref="android.antlibs" />
 
     <taskdef name="apkbuilder"
         classname="com.android.ant.ApkBuilderTask"
-        classpathref="android.antlibs"/>
+        classpathref="android.antlibs" />
+
+    <taskdef name="xpath"
+        classname="com.android.ant.XPathTask"
+        classpathref="android.antlibs" />
 
     <!-- Properties -->
 
-    <property name="android-tools" value="${sdk-location}/tools" />
+    <!-- Tells adb which device to target. You can change this from the command line
+         by invoking "ant -Dadb.device.arg=-d" for device "ant -Dadb.device.arg=-e" for
+         the emulator. -->
+    <property name="adb.device.arg" value="" />
+
+    <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="manifest.package" />
 
     <!-- Input directories -->
-    <property name="source-folder" value="src" />
-    <property name="gen-folder" value="gen" />
-    <property name="resource-folder" value="res" />
-    <property name="asset-folder" value="assets" />
-    <property name="source-location" value="${basedir}/${source-folder}" />
+    <property name="source.dir" value="src" />
+    <property name="source.absolute.dir" location="${source.dir}" />
+    <property name="gen.dir" value="gen" />
+    <property name="gen.absolute.dir" location="${gen.dir}" />
+    <property name="resource.dir" value="res" />
+    <property name="resource.absolute.dir" location="${resource.dir}" />
+    <property name="asset.dir" value="assets" />
+    <property name="asset.absolute.dir" location="${asset.dir}" />
 
-    <!-- folder for the 3rd party java libraries -->
-    <property name="external-libs-folder" value="libs" />
+    <!-- Directory for the third party java libraries -->
+    <property name="external.libs.dir" value="libs" />
+    <property name="external.libs.absolute.dir" location="${external.libs.dir}" />
 
-    <!-- folder for the native libraries -->
-    <property name="native-libs-folder" value="libs" />
+    <!-- Directory for the native libraries -->
+    <property name="native.libs.dir" value="libs" />
+    <property name="native.libs.absolute.dir" location="${native.libs.dir}" />
 
     <!-- Output directories -->
-    <property name="gen-folder" value="gen" />
-    <property name="out-folder" value="bin" />
-    <property name="out-classes" value="${out-folder}/classes" />
-    <property name="out-classes-location" value="${basedir}/${out-classes}"/>
-    <!-- out folders for a parent project if this project is an instrumentation project -->
-    <property name="main-out-folder" value="../${out-folder}" />
-    <property name="main-out-classes" value="${main-out-folder}/classes"/>
+    <property name="out.dir" value="bin" />
+    <property name="out.absolute.dir" location="${out.dir}" />
+    <property name="out.classes.dir" value="${out.absolute.dir}/classes" />
+    <property name="out.classes.absolute.dir" location="${out.classes.dir}" />
 
     <!-- Intermediate files -->
-    <property name="dex-file" value="classes.dex" />
-    <property name="intermediate-dex" value="${out-folder}/${dex-file}" />
-    <!-- dx does not properly support incorrect / or \ based on the platform
-         and Ant cannot convert them because the parameter is not a valid path.
-         Because of this we have to compute different paths depending on the platform. -->
-    <condition property="intermediate-dex-location"
-            value="${basedir}\${intermediate-dex}"
-            else="${basedir}/${intermediate-dex}" >
-        <os family="windows"/>
-    </condition>
+    <property name="dex.file.name" value="classes.dex" />
+    <property name="intermediate.dex.file" location="${out.absolute.dir}/${dex.file.name}" />
 
     <!-- The final package file to generate -->
-    <property name="out-debug-unaligned-package" value="${out-folder}/${ant.project.name}-debug-unaligned.apk"/>
-    <property name="out-debug-package" value="${out-folder}/${ant.project.name}-debug.apk"/>
-    <property name="out-unsigned-package" value="${out-folder}/${ant.project.name}-unsigned.apk"/>
-    <property name="out-unaligned-package" value="${out-folder}/${ant.project.name}-unaligned.apk"/>
-    <property name="out-release-package" value="${out-folder}/${ant.project.name}-release.apk"/>
+    <property name="out.debug.unaligned.package"
+                  location="${out.absolute.dir}/${ant.project.name}-debug-unaligned.apk" />
+    <property name="out.debug.package"
+                  location="${out.absolute.dir}/${ant.project.name}-debug.apk" />
+    <property name="out.unsigned.package"
+                  location="${out.absolute.dir}/${ant.project.name}-unsigned.apk" />
+    <property name="out.unaligned.package"
+                  location="${out.absolute.dir}/${ant.project.name}-unaligned.apk" />
+    <property name="out.release.package"
+                  location="${out.absolute.dir}/${ant.project.name}-release.apk" />
+
+    <!-- Verbosity -->
+    <property name="verbose" value="false" />
+    <!-- This is needed by emma as it uses multilevel verbosity instead of simple 'true' or 'false'
+         The property 'verbosity' is not user configurable and depends exclusively on 'verbose'
+         value.-->
+    <condition property="verbosity" value="verbose" else="quiet">
+        <istrue value="${verbose}" />
+    </condition>
+    <!-- This is needed to switch verbosity of zipalign and aapt. Depends exclusively on 'verbose'
+         -->
+    <condition property="v.option" value="-v" else="">
+        <istrue value="${verbose}" />
+    </condition>
+    <!-- This is needed to switch verbosity of dx. Depends exclusively on 'verbose' -->
+    <condition property="verbose.option" value="--verbose" else="">
+        <istrue value="${verbose}" />
+    </condition>
 
     <!-- Tools -->
-    <condition property="exe" value=".exe" else=""><os family="windows"/></condition>
-    <property name="adb" value="${android-tools}/adb${exe}"/>
-    <property name="zipalign" value="${android-tools}/zipalign${exe}" />
+    <condition property="exe" value=".exe" else=""><os family="windows" /></condition>
+    <property name="adb" location="${android.tools.dir}/adb${exe}" />
+    <property name="zipalign" location="${android.tools.dir}/zipalign${exe}" />
 
-    <!-- rules -->
+    <!-- Emma configuration -->
+    <property name="emma.dir" value="${sdk.dir}/tools/lib" />
+        <path id="emma.lib">
+            <pathelement location="${emma.dir}/emma.jar" />
+            <pathelement location="${emma.dir}/emma_ant.jar" />
+        </path>
+    <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
+    <!-- End of emma configuration -->
 
-    <!-- Create the output directories if they don't exist yet. -->
-    <target name="dirs">
+    <!-- Macros -->
+
+    <!-- Configurable macro, which allows to pass as parameters output directory,
+         output dex filename and external libraries to dex (optional) -->
+    <macrodef name="dex-helper">
+       <element name="external-libs" optional="yes" />
+       <element name="extra-parameters" optional="yes" />
+       <sequential>
+         <echo>Converting compiled files and external libraries into ${intermediate.dex.file}...
+         </echo>
+         <apply executable="${dx}" failonerror="true" parallel="true">
+             <arg value="--dex" />
+             <arg value="--output=${intermediate.dex.file}" />
+             <extra-parameters />
+             <arg line="${verbose.option}" />
+             <arg path="${out.classes.absolute.dir}" />
+             <fileset dir="${external.libs.absolute.dir}" includes="*.jar" />
+             <external-libs />
+         </apply>
+       </sequential>
+    </macrodef>
+
+    <!-- This is macro that enable passing variable list of external jar files to ApkBuilder
+         Example of use:
+         <package-helper>
+             <extra-jars>
+                <jarfolder path="my_jars" />
+                <jarfile path="foo/bar.jar" />
+                <jarfolder path="your_jars" />
+             </extra-jars>
+         </package-helper> -->
+    <macrodef name="package-helper">
+        <attribute name="sign.package" />
+        <element name="extra-jars" optional="yes" />
+        <sequential>
+            <apkbuilder
+                    outfolder="${out.absolute.dir}"
+                    basename="${ant.project.name}"
+                    signed="@{sign.package}"
+                    verbose="${verbose}">
+                <file path="${intermediate.dex.file}" />
+                <sourcefolder path="${source.absolute.dir}" />
+                <nativefolder path="${native.libs.absolute.dir}" />
+                <jarfolder path="${external.libs.absolute.dir}" />
+                <extra-jars/>
+            </apkbuilder>
+        </sequential>
+    </macrodef>
+
+    <!-- This is macro which zipaligns in.package and outputs it to out.package. Used by targets
+         debug, -debug-with-emma and release.-->
+    <macrodef name="zipalign-helper">
+        <attribute name="in.package" />
+        <attribute name="out.package" />
+        <sequential>
+            <echo>Running zip align on final apk...</echo>
+            <exec executable="${zipalign}" failonerror="true">
+                <arg line="${v.option}" />
+                <arg value="-f" />
+                <arg value="4" />
+                <arg path="@{in.package}" />
+                <arg path="@{out.package}" />
+            </exec>
+        </sequential>
+    </macrodef>
+
+    <!-- This is macro used only for sharing code among two targets, -install and
+         -install-with-emma which do exactly the same but differ in dependencies -->
+    <macrodef name="install-helper">
+        <sequential>
+            <echo>Installing ${out.debug.package} onto default emulator or device...</echo>
+            <exec executable="${adb}" failonerror="true">
+                <arg line="${adb.device.arg}" />
+                <arg value="install" />
+                <arg value="-r" />
+                <arg path="${out.debug.package}" />
+            </exec>
+        </sequential>
+    </macrodef>
+
+    <!-- Rules -->
+
+    <!-- Creates the output directories if they don't exist yet. -->
+    <target name="-dirs">
         <echo>Creating output directories if needed...</echo>
-        <mkdir dir="${resource-folder}" />
-        <mkdir dir="${external-libs-folder}" />
-        <mkdir dir="${gen-folder}" />
-        <mkdir dir="${out-folder}" />
-        <mkdir dir="${out-classes}" />
+        <mkdir dir="${resource.absolute.dir}" />
+        <mkdir dir="${external.libs.absolute.dir}" />
+        <mkdir dir="${gen.absolute.dir}" />
+        <mkdir dir="${out.absolute.dir}" />
+        <mkdir dir="${out.classes.absolute.dir}" />
     </target>
 
-    <!-- Generate the R.java file for this project's resources. -->
-    <target name="resource-src" depends="dirs">
+    <!-- Generates the R.java file for this project's resources. -->
+    <target name="-resource-src" depends="-dirs">
         <echo>Generating R.java / Manifest.java from the resources...</echo>
         <exec executable="${aapt}" failonerror="true">
             <arg value="package" />
+            <arg line="${v.option}" />
             <arg value="-m" />
             <arg value="-J" />
-            <arg path="${gen-folder}" />
+            <arg path="${gen.absolute.dir}" />
             <arg value="-M" />
             <arg path="AndroidManifest.xml" />
             <arg value="-S" />
-            <arg path="${resource-folder}" />
+            <arg path="${resource.absolute.dir}" />
             <arg value="-I" />
-            <arg path="${android-jar}" />
+            <arg path="${android.jar}" />
         </exec>
     </target>
 
-    <!-- Generate java classes from .aidl files. -->
-    <target name="aidl" depends="dirs">
+    <!-- Generates java classes from .aidl files. -->
+    <target name="-aidl" depends="-dirs">
         <echo>Compiling aidl files into Java classes...</echo>
         <apply executable="${aidl}" failonerror="true">
-            <arg value="-p${android-aidl}" />
-            <arg value="-I${source-folder}" />
-            <arg value="-o${gen-folder}" />
-            <fileset dir="${source-folder}">
-                <include name="**/*.aidl"/>
+            <arg value="-p${android.aidl}" />
+            <arg value="-I${source.absolute.dir}" />
+            <arg value="-o${gen.absolute.dir}" />
+            <fileset dir="${source.absolute.dir}">
+                <include name="**/*.aidl" />
             </fileset>
         </apply>
     </target>
 
-    <!-- Compile this project's .java files into .class files. -->
-    <target name="compile" depends="resource-src, aidl">
+    <!-- Compiles this project's .java files into .class files. -->
+    <target name="compile" depends="-resource-src, -aidl"
+                description="Compiles project's .java files into .class files">
+        <!-- If android rules are used for a test project, its classpath should include
+             tested project's location -->
+        <condition property="extensible.classpath"
+                           value="${tested.project.absolute.dir}/bin/classes" else=".">
+            <isset property="tested.project.absolute.dir" />
+        </condition>
         <javac encoding="ascii" target="1.5" debug="true" extdirs=""
-                destdir="${out-classes}"
-                bootclasspathref="android.target.classpath">
-            <src path="${source-folder}" />
-            <src path="${gen-folder}" />
+                destdir="${out.classes.absolute.dir}"
+                bootclasspathref="android.target.classpath"
+                verbose="${verbose}" classpath="${extensible.classpath}">
+            <src path="${source.absolute.dir}" />
+            <src path="${gen.absolute.dir}" />
             <classpath>
-                <fileset dir="${external-libs-folder}" includes="*.jar"/>
-                <pathelement path="${main-out-classes}"/>
+                <fileset dir="${external.libs.absolute.dir}" includes="*.jar" />
             </classpath>
-         </javac>
+        </javac>
     </target>
 
-    <!-- Convert this project's .class files into .dex files. -->
-    <target name="dex" depends="compile">
-        <echo>Converting compiled files and external libraries into ${out-folder}/${dex-file}...</echo>
-        <apply executable="${dx}" failonerror="true" parallel="true">
-            <arg value="--dex" />
-            <arg value="--output=${intermediate-dex-location}" />
-            <arg path="${out-classes-location}" />
-            <fileset dir="${external-libs-folder}" includes="*.jar"/>
-        </apply>
+    <!-- Converts this project's .class files into .dex files -->
+    <target name="-dex" depends="compile">
+        <dex-helper />
     </target>
 
-    <!-- Put the project's resources into the output package file
+    <!-- Puts the project's resources into the output package file
          This actually can create multiple resource package in case
          Some custom apk with specific configuration have been
          declared in default.properties.
          -->
-    <target name="package-resources">
+    <target name="-package-resources">
         <echo>Packaging resources</echo>
         <aaptexec executable="${aapt}"
                 command="package"
                 manifest="AndroidManifest.xml"
-                resources="${resource-folder}"
-                assets="${asset-folder}"
-                androidjar="${android-jar}"
-                outfolder="${out-folder}"
+                resources="${resource.absolute.dir}"
+                assets="${asset.absolute.dir}"
+                androidjar="${android.jar}"
+                outfolder="${out.absolute.dir}"
                 basename="${ant.project.name}" />
     </target>
 
-    <!-- Package the application and (maybe) sign it with a debug key.
-         This requires the property sign.package to be set to true or false. -->
-    <target name="package">
-        <apkbuilder
-                outfolder="${out-folder}"
-                basename="${ant.project.name}"
-                signed="${sign.package}"
-                verbose="true">
-            <file path="${intermediate-dex}" />
-            <sourcefolder path="${source-folder}" />
-            <jarfolder path="${external-libs-folder}" />
-            <nativefolder path="${native-libs-folder}" />
-        </apkbuilder>
+    <!-- Packages the application and sign it with a debug key. -->
+    <target name="-package-debug-sign" depends="-dex, -package-resources">
+        <package-helper sign.package="true" />
     </target>
 
-    <target name="no-sign">
-       <property name="sign.package" value="false" />
+    <!-- Packages the application without signing it. -->
+    <target name="-package-no-sign" depends="-dex, -package-resources">
+        <package-helper sign.package="false" />
     </target>
 
-    <target name="debug-sign">
-       <property name="sign.package" value="true" />
+    <target name="-compile-tested-if-test" if="tested.project.dir" unless="do.not.compile.again">
+       <subant target="compile">
+            <fileset dir="${tested.project.absolute.dir}" includes="build.xml" />
+       </subant>
     </target>
 
-    <target name="debug" depends="dex, package-resources, debug-sign, package">
-        <echo>Running zip align on final apk...</echo>
-        <exec executable="${zipalign}" failonerror="true">
-            <arg value="-f" />
-            <arg value="4" />
-            <arg path="${out-debug-unaligned-package}" />
-            <arg path="${out-debug-package}" />
-        </exec>
-        <echo>Debug Package: ${out-debug-package}</echo>
+    <!-- Builds debug output package, provided all the necessary files are already dexed -->
+    <target name="debug" depends="-compile-tested-if-test, -package-debug-sign"
+                description="Builds the application and signs it with a debug key.">
+        <zipalign-helper in.package="${out.debug.unaligned.package}"
+                                   out.package="${out.debug.package}" />
+        <echo>Debug Package: ${out.debug.package}</echo>
     </target>
 
-    <target name="release-package" depends="dex, package-resources, no-sign, package">
-    </target>
-
-    <target name="release.check">
+    <target name="-release-check">
         <condition property="release.sign">
             <and>
                 <isset property="key.store" />
@@ -201,80 +308,140 @@
             </and>
         </condition>
     </target>
-    <target name="release.nosign" depends="release.check" unless="release.sign">
+
+    <target name="-release-nosign" depends="-release-check" unless="release.sign">
         <echo>No key.store and key.alias properties found in build.properties.</echo>
-        <echo>Please sign ${out-unsigned-package} manually</echo>
+        <echo>Please sign ${out.unsigned.package} manually</echo>
         <echo>and run zipalign from the Android SDK tools.</echo>
     </target>
 
-    <target name="release" depends="release-package, release.nosign" if="release.sign">
-        <!-- get passwords -->
+    <target name="release" depends="-package-no-sign, -release-nosign" if="release.sign"
+                description="Builds the application. The generated apk file must be signed before
+                            it is published.">
+        <!-- Gets passwords -->
         <input
                 message="Please enter keystore password (store:${key.store}):"
-                addproperty="key.store.password"/>
+                addproperty="key.store.password" />
         <input
                 message="Please enter password for alias '${key.alias}':"
-                addproperty="key.alias.password"/>
-        <!-- sign the APK -->
+                addproperty="key.alias.password" />
+
+        <!-- Signs the APK -->
         <echo>Signing final apk...</echo>
         <signjar
-                jar="${out-unsigned-package}"
-                signedjar="${out-unaligned-package}"
+                jar="${out.unsigned.package}"
+                signedjar="${out.unaligned.package}"
                 keystore="${key.store}"
                 storepass="${key.store.password}"
                 alias="${key.alias}"
-                keypass="${key.alias.password}"/>
-        <!-- zip align the APK -->
-        <echo>Running zip align on final apk...</echo>
-        <exec executable="${zipalign}" failonerror="true">
-            <arg value="-f" />
-            <arg value="4" />
-            <arg path="${out-unaligned-package}" />
-            <arg path="${out-release-package}" />
-        </exec>
-        <echo>Release Package: ${out-release-package}</echo>
+                keypass="${key.alias.password}"
+                verbose="${verbose}" />
+
+        <!-- Zip aligns the APK -->
+        <zipalign-helper in.package="${out.unaligned.package}"
+                                   out.package="${out.release.package}" />
+        <echo>Release Package: ${out.release.package}</echo>
     </target>
 
-    <!-- Install the package on the default emulator -->
-    <target name="install" depends="debug">
-        <echo>Installing ${out-debug-package} onto default emulator...</echo>
-        <exec executable="${adb}" failonerror="true">
-            <arg value="install" />
-            <arg value="-r" />
-            <arg path="${out-debug-package}" />
-        </exec>
+    <target name="install" depends="debug"
+                description="Installs/reinstalls the debug package onto a running
+                            emulator or device. If the application was previously installed,
+                            the signatures must match." >
+        <install-helper />
     </target>
 
-    <!-- Uinstall the package from the default emulator -->
-    <target name="uninstall.check">
+    <target name="-uninstall-check">
         <condition property="uninstall.run">
-           <isset property="application-package" />
+           <isset property="manifest.package" />
         </condition>
     </target>
-    <target name="uninstall.error" depends="uninstall.check" unless="uninstall.run">
-        <echo>Unable to run 'ant unintall', application-package is not defined in build.properties</echo>
+
+    <target name="-uninstall-error" depends="-uninstall-check" unless="uninstall.run">
+        <echo>Unable to run 'ant uninstall', manifest.package property is not defined.
+        </echo>
     </target>
-    <target name="uninstall" depends="uninstall.error" if="uninstall.run">
-        <echo>Uninstalling ${application-package} from the default emulator...</echo>
+
+    <!-- Uninstalls the package from the default emulator/device -->
+    <target name="uninstall" depends="-uninstall-error" if="uninstall.run"
+                description="Uninstalls the application from a running emulator or device.">
+        <echo>Uninstalling ${manifest.package} from the default emulator or device...</echo>
         <exec executable="${adb}" failonerror="true">
+            <arg line="${adb.device.arg}" />
             <arg value="uninstall" />
-            <arg value="${application-package}" />
+            <arg value="${manifest.package}" />
         </exec>
     </target>
-    
+
+    <target name="clean" description="Removes output files created by other targets.">
+        <delete dir="${out.absolute.dir}" verbose="${verbose}" />
+        <delete dir="${gen.absolute.dir}" verbose="${verbose}" />
+    </target>
+
+    <!-- Targets for code-coverage measurement purposes, invoked from external file -->
+
+    <!-- Emma-instruments tested project classes (compiles the tested project if necessary)
+             and writes instrumented classes to ${instrumentation.absolute.dir}/classes -->
+    <target name="-emma-instrument" depends="compile">
+        <echo>Instrumenting classes from ${out.absolute.dir}/classes...</echo>
+        <!-- It only instruments class files, not any external libs -->
+        <emma enabled="true">
+            <instr verbosity="${verbosity}"
+                   mode="overwrite"
+                   instrpath="${out.absolute.dir}/classes"
+                   outdir="${out.absolute.dir}/classes">
+            </instr>
+            <!-- TODO: exclusion filters on R*.class and allowing custom exclusion from
+                 user defined file -->
+        </emma>
+    </target>
+
+    <target name="-dex-instrumented" depends="-emma-instrument">
+       <dex-helper>
+          <extra-parameters>
+            <arg value="--no-locals" />
+          </extra-parameters>
+          <external-libs>
+            <fileset file="${emma.dir}/emma_device.jar" />
+          </external-libs>
+       </dex-helper>
+    </target>
+
+    <!-- Invoked from external files for code coverage purposes -->
+    <target name="-package-with-emma" depends="-dex-instrumented, -package-resources">
+        <package-helper sign.package="true">
+            <extra-jars>
+                <!-- Injected from external file -->
+                <jarfile path="${emma.dir}/emma_device.jar" />
+            </extra-jars>
+        </package-helper>
+    </target>
+
+    <target name="-debug-with-emma" depends="-package-with-emma">
+        <zipalign-helper in.package="${out.debug.unaligned.package}"
+                                   out.package="${out.debug.package}" />
+    </target>
+
+    <target name="-install-with-emma" depends="-debug-with-emma">
+        <install-helper />
+    </target>
+
+    <!-- End of targets for code-coverage measurement purposes -->
+
     <target name="help">
         <!-- displays starts at col 13
               |13                                                              80| -->
         <echo>Android Ant Build. Available targets:</echo>
         <echo>   help:      Displays this help.</echo>
-        <echo>   debug:     Builds the application and sign it with a debug key.</echo>
+        <echo>   clean:     Removes output files created by other targets.</echo>
+        <echo>   compile:   Compiles project's .java files into .class files.</echo>
+        <echo>   debug:     Builds the application and signs it with a debug key.</echo>
         <echo>   release:   Builds the application. The generated apk file must be</echo>
         <echo>              signed before it is published.</echo>
-        <echo>   install:   Installs/reinstall the debug package onto a running</echo>
+        <echo>   install:   Installs/reinstalls the debug package onto a running</echo>
         <echo>              emulator or device.</echo>
         <echo>              If the application was previously installed, the</echo>
         <echo>              signatures must match.</echo>
-        <echo>   uninstall: uninstall the application from a running emulator or</echo>
+        <echo>   uninstall: Uninstalls the application from a running emulator or</echo>
         <echo>              device.</echo>
     </target>
 </project>
diff --git a/tools/scripts/android_test_rules.xml b/tools/scripts/android_test_rules.xml
new file mode 100644
index 0000000..78503ae
--- /dev/null
+++ b/tools/scripts/android_test_rules.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="android_test_rules" default="run-tests">
+
+    <import file="android_rules.xml" />
+
+    <property name="tested.project.absolute.dir" location="${tested.project.dir}" />
+    <property name="instrumentation.dir" value="instrumented" />
+    <property name="instrumentation.absolute.dir" location="${instrumentation.dir}" />
+
+    <property name="test.runner" value="android.test.InstrumentationTestRunner" />
+    <!-- Application package of the tested project extracted from its manifest file -->
+    <xpath input="${tested.project.absolute.dir}/AndroidManifest.xml"
+                expression="/manifest/@package" output="tested.manifest.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/${tested.manifest.package}/files/coverage.ec" />
+
+    <macrodef name="run-tests-helper">
+        <attribute name="emma.enabled" default="false" />
+        <element name="extra-instrument-args" optional="yes" />
+        <sequential>
+            <echo>Running tests ...</echo>
+            <exec executable="${adb}" failonerror="true">
+                <arg value="shell" />
+                <arg value="am" />
+                   <arg value="instrument" />
+                <arg value="-w" />
+                <arg value="-e" />
+                   <arg value="coverage" />
+                   <arg value="@{emma.enabled}" />
+                <extra-instrument-args />
+                <arg value="${manifest.package}/${test.runner}" />
+            </exec>
+        </sequential>
+    </macrodef>
+
+    <!-- Invoking this target sets the value of extensible.classpath, which is being added to javac
+         classpath in target 'compile' (android_rules.xml) -->
+    <target name="-set-coverage-classpath">
+        <property name="extensible.classpath"
+                      location="${instrumentation.absolute.dir}/classes" />
+    </target>
+
+    <!-- Ensures that tested project is installed on the device before we run the tests.
+         Used for ordinary tests, without coverage measurement -->
+    <target name="-install-tested-project">
+        <property name="do.not.compile.again" value="true" />
+        <subant target="install">
+            <fileset dir="${tested.project.absolute.dir}" includes="build.xml" />
+        </subant>
+    </target>
+
+    <target name="run-tests" depends="-install-tested-project, install"
+                description="Runs tests from the package defined in test.package property">
+        <run-tests-helper />
+    </target>
+
+    <target name="-install-instrumented">
+        <property name="do.not.compile.again" value="true" />
+        <subant target="-install-with-emma">
+            <property name="out.absolute.dir" value="${instrumentation.absolute.dir}" />
+            <fileset dir="${tested.project.absolute.dir}" includes="build.xml" />
+        </subant>
+    </target>
+
+    <target name="coverage" depends="-set-coverage-classpath, -install-instrumented, install"
+                description="Runs the tests against the instrumented code and generates
+                            code coverage report">
+        <run-tests-helper emma.enabled="true">
+            <extra-instrument-args>
+                <arg value="-e" />
+                   <arg value="coverageFile" />
+                   <arg value="${emma.dump.file}" />
+            </extra-instrument-args>
+        </run-tests-helper>
+        <echo>Downloading coverage file into project directory...</echo>
+        <exec executable="${adb}" failonerror="true">
+            <arg value="pull" />
+            <arg value="${emma.dump.file}" />
+            <arg value="coverage.ec" />
+        </exec>
+        <echo>Extracting coverage report...</echo>
+        <emma>
+            <report sourcepath="${tested.project.absolute.dir}/${source.dir}"
+                              verbosity="${verbosity}">
+                <!-- TODO: report.dir or something like should be introduced if necessary -->
+                <infileset dir=".">
+                    <include name="coverage.ec" />
+                    <include name="coverage.em" />
+                </infileset>
+                <!-- TODO: reports in other, indicated by user formats -->
+                <html outfile="coverage.html" />
+           </report>
+        </emma>
+        <echo>Cleaning up temporary files...</echo>
+        <delete dir="${instrumentation.absolute.dir}" />
+        <delete file="coverage.ec" />
+        <delete file="coverage.em" />
+        <echo>Saving the report file in ${basedir}/coverage/coverage.html</echo>
+    </target>
+
+</project>
diff --git a/tools/scripts/app_engine_server/memcache_zipserve.py b/tools/scripts/app_engine_server/memcache_zipserve.py
index e11cfc5..43826b0 100644
--- a/tools/scripts/app_engine_server/memcache_zipserve.py
+++ b/tools/scripts/app_engine_server/memcache_zipserve.py
@@ -37,7 +37,7 @@
 from google.appengine.api import memcache
 from google.appengine.ext import webapp
 from google.appengine.ext.webapp import util
-
+from time import localtime, strftime
 
 def create_handler(zip_files, max_age=None, public=None):
   """Factory method to create a MemcachedZipHandler instance.
@@ -57,7 +57,6 @@
   """
   # verify argument integrity. If the argument is passed in list format,
   # convert it to list of lists format
-  
   if zip_files and type(zip_files).__name__ == 'list':
     num_items = len(zip_files)
     while num_items > 0:
@@ -72,7 +71,6 @@
 
     I'm still not sure why this is needed
     """
-    
     def get(self, name):
       self.zipfilenames = zip_files
       self.TrueGet(name)
@@ -96,12 +94,15 @@
   PUBLIC = True                     # public cache setting
   CACHE_PREFIX = 'cache://'         # memcache key prefix for actual URLs
   NEG_CACHE_PREFIX = 'noncache://'  # memcache key prefix for non-existant URL
-
-  def TrueGet(self, name):
+  intlString = 'intl/'
+  validLangs = ['en', 'de', 'es', 'fr','it','ja','zh-CN','zh-TW']
+  
+  def TrueGet(self, reqUri):
     """The top-level entry point to serving requests.
 
     Called 'True' get because it does the work when called from the wrapper
-    class' get method
+    class' get method. Some logic is applied to the request to serve files
+    from an intl/<lang>/... directory or fall through to the default language.
 
     Args:
       name: URL requested
@@ -109,37 +110,88 @@
     Returns:
       None
     """
-    name = self.PreprocessUrl(name)
+    langName = 'en'
+    resetLangCookie = False
+    urlLangName = None
+    retry = False
+    isValidIntl = False
 
-    # see if we have the page in the memcache
-    resp_data = self.GetFromCache(name)
-    if resp_data is None:
-      logging.info('Cache miss for %s', name)
-      resp_data = self.GetFromNegativeCache(name)
-      if resp_data is None:
-        resp_data = self.GetFromStore(name)
+    # Try to retrieve the user's lang pref from the cookie. If there is no
+    # lang pref cookie in the request, add set-cookie to the response with the 
+    # default value of 'en'.
+    try:
+      langName = self.request.cookies['android_developer_pref_lang']
+    except KeyError:
+      resetLangCookie = True
+      #logging.info('==========================EXCEPTION: NO LANG COOKIE FOUND, USING [%s]', langName)
+    logging.info('==========================REQ INIT name [%s] langName [%s]', reqUri, langName)
 
-        # IF we have the file, put it in the memcache
-        # ELSE put it in the negative cache
-        if resp_data is not None:
-          self.StoreOrUpdateInCache(name, resp_data)
-        else:
-          logging.info('Adding %s to negative cache, serving 404', name)
-          self.StoreInNegativeCache(name)
-          self.Write404Error()
-          return
+    # Preprocess the req url. If it references a directory or the domain itself,
+    # append '/index.html' to the url and 302 redirect. Otherwise, continue
+    # processing the request below.
+    name = self.PreprocessUrl(reqUri, langName)
+    if name:
+      # Do some prep for handling intl requests. Parse the url and validate
+      # the intl/lang substring, extract the url lang code (urlLangName) and the
+      # the uri that follows the intl/lang substring(contentUri)
+      sections = name.split("/", 2)
+      contentUri = 0
+      isIntl = len(sections) > 1 and (sections[0] == "intl")
+      if isIntl:
+        isValidIntl = sections[1] in self.validLangs
+        if isValidIntl:
+          urlLangName = sections[1]
+          contentUri = sections[2]
+          if (langName != urlLangName):
+            # if the lang code in the request is different from that in 
+            # the cookie, reset the cookie to the url lang value.
+            langName = urlLangName
+            resetLangCookie = True
+            #logging.info('INTL PREP resetting langName to urlLangName [%s]', langName)
+          #else: 
+          #  logging.info('INTL PREP no need to reset langName')
+
+      # Send for processing
+      if self.isCleanUrl(name, langName, isValidIntl):
+        # handle a 'clean' request.
+        # Try to form a response using the actual request url.
+        if not self.CreateResponse(name, langName, isValidIntl, resetLangCookie):
+          # If CreateResponse returns False, there was no such document
+          # in the intl/lang tree. Before going to 404, see if there is an
+          # English-language version of the doc in the default
+          # default tree and return it, else go to 404.
+          self.CreateResponse(contentUri, langName, False, resetLangCookie)
+
+      elif isIntl:
+        # handle the case where we need to pass through an invalid intl req 
+        # for processing (so as to get 404 as appropriate). This is needed
+        # because intl urls are passed through clean and retried in English,
+        # if necessary.
+        logging.info('  Handling an invalid intl request...')
+        self.CreateResponse(name, langName, isValidIntl, resetLangCookie)
+
       else:
-        self.Write404Error()
-        return
+        # handle the case where we have a non-clean url (usually a non-intl
+        # url) that we need to interpret in the context of any lang pref
+        # that is set. Prepend an intl/lang string to the request url and
+        # send it as a 302 redirect. After the redirect, the subsequent
+        # request will be handled as a clean url.
+        self.RedirToIntl(name, self.intlString, langName)
 
-    content_type, encoding = mimetypes.guess_type(name)
-    if content_type:
-      self.response.headers['Content-Type'] = content_type
-    self.SetCachingHeaders()
-    self.response.out.write(resp_data)
+  def isCleanUrl(self, name, langName, isValidIntl):
+    """Determine whether to pass an incoming url straight to processing. 
 
-  def PreprocessUrl(self, name):
-    """Any preprocessing work on the URL when it comes it.
+       Args:
+         name: The incoming URL
+
+       Returns:
+         boolean: Whether the URL should be sent straight to processing
+    """
+    if (langName == 'en') or isValidIntl or not ('.html' in name) or (not isValidIntl and not langName):
+      return True
+
+  def PreprocessUrl(self, name, langName):
+    """Any preprocessing work on the URL when it comes in.
 
     Put any work related to interpretting the incoming URL here. For example,
     this is used to redirect requests for a directory to the index.html file
@@ -150,12 +202,9 @@
       name: The incoming URL
 
     Returns:
-      The processed URL
+      False if the request was redirected to '/index.html', or
+      The processed URL, otherwise
     """
-    # handle special case of requesting the domain itself
-    if not name:
-      name = 'index.html'
-
     # determine if this is a request for a directory
     final_path_segment = name
     final_slash_offset = name.rfind('/')
@@ -164,12 +213,123 @@
       if final_path_segment.find('.') == -1:
         name = ''.join([name, '/'])
 
-    # if this is a directory, redirect to index.html
-    if name[len(name) - 1:] == '/':
-      return '%s%s' % (name, 'index.html')
+    # if this is a directory or the domain itself, redirect to /index.html
+    if not name or (name[len(name) - 1:] == '/'):
+      uri = ''.join(['/', name, 'index.html'])
+      logging.info('--->PREPROCESSING REDIRECT [%s] to [%s] with langName [%s]', name, uri, langName)
+      self.redirect(uri, False)
+      return False
     else:
       return name
 
+  def RedirToIntl(self, name, intlString, langName):
+    """Redirect an incoming request to the appropriate intl uri.
+
+       Builds the intl/lang string from a base (en) string
+       and redirects (302) the request to look for a version 
+       of the file in the language that matches the client-
+       supplied cookie value.
+
+    Args:
+      name: The incoming, preprocessed URL
+
+    Returns:
+      The lang-specific URL
+    """
+    builtIntlLangUri = ''.join([intlString, langName, '/', name, '?', self.request.query_string])
+    uri = ''.join(['/', builtIntlLangUri])
+    logging.info('-->>REDIRECTING %s to  %s', name, uri)
+    self.redirect(uri, False)
+    return uri
+
+  def CreateResponse(self, name, langName, isValidIntl, resetLangCookie):
+    """Process the url and form a response, if appropriate.
+
+       Attempts to retrieve the requested file (name) from cache, 
+       negative cache, or store (zip) and form the response. 
+       For intl requests that are not found (in the localized tree), 
+       returns False rather than forming a response, so that
+       the request can be retried with the base url (this is the 
+       fallthrough to default language). 
+
+       For requests that are found, forms the headers and
+       adds the content to the response entity. If the request was
+       for an intl (localized) url, also resets the language cookie 
+       to the language specified in the url if needed, to ensure that 
+       the client language and response data remain harmonious. 
+
+    Args:
+      name: The incoming, preprocessed URL
+      langName: The language id. Used as necessary to reset the
+                language cookie in the response.
+      isValidIntl: If present, indicates whether the request is
+                   for a language-specific url
+      resetLangCookie: Whether the response should reset the
+                       language cookie to 'langName'
+
+    Returns:
+      True: A response was successfully created for the request
+      False: No response was created.
+    """
+    # see if we have the page in the memcache
+    logging.info('PROCESSING %s langName [%s] isValidIntl [%s] resetLang [%s]', 
+      name, langName, isValidIntl, resetLangCookie)
+    resp_data = self.GetFromCache(name)
+    if resp_data is None:
+      logging.info('  Cache miss for %s', name)
+      resp_data = self.GetFromNegativeCache(name)
+      if resp_data is None:
+        resp_data = self.GetFromStore(name)
+
+        # IF we have the file, put it in the memcache
+        # ELSE put it in the negative cache
+        if resp_data is not None:
+          self.StoreOrUpdateInCache(name, resp_data)
+        elif isValidIntl:
+          # couldn't find the intl doc. Try to fall through to English.
+          #logging.info('  Retrying with base uri...')
+          return False
+        else:
+          logging.info('  Adding %s to negative cache, serving 404', name)
+          self.StoreInNegativeCache(name)
+          self.Write404Error()
+          return True
+      else:
+        # found it in negative cache
+        self.Write404Error()
+        return True
+
+    # found content from cache or store
+    logging.info('FOUND CLEAN')
+    if resetLangCookie:
+      logging.info('  Resetting android_developer_pref_lang cookie to [%s]',
+      langName)
+      expireDate = time.mktime(localtime()) + 60 * 60 * 24 * 365 * 10
+      self.response.headers.add_header('Set-Cookie', 
+      'android_developer_pref_lang=%s; path=/; expires=%s' % 
+      (langName, strftime("%a, %d %b %Y %H:%M:%S", localtime(expireDate))))
+    mustRevalidate = False
+    if ('.html' in name):
+      # revalidate html files -- workaround for cache inconsistencies for 
+      # negotiated responses
+      mustRevalidate = True
+      logging.info('  Adding [Vary: Cookie] to response...')
+      self.response.headers.add_header('Vary', 'Cookie')
+    content_type, encoding = mimetypes.guess_type(name)
+    if content_type:
+      self.response.headers['Content-Type'] = content_type
+      self.SetCachingHeaders(mustRevalidate)
+      self.response.out.write(resp_data)
+    elif (name == 'favicon.ico'):
+      self.response.headers['Content-Type'] = 'image/x-icon'
+      self.SetCachingHeaders(mustRevalidate)
+      self.response.out.write(resp_data)
+    elif name.endswith('.psd'):
+      self.response.headers['Content-Type'] = 'application/octet-stream'
+      self.SetCachingHeaders(mustRevalidate)
+      self.response.out.write(resp_data)
+    return True
+
   def GetFromStore(self, file_path):
     """Retrieve file from zip files.
 
@@ -192,7 +352,7 @@
     archive_name = self.MapFileToArchive(file_path)
     if not archive_name:
       archive_name = file_itr.next()[0]
-    
+
     while resp_data is None and archive_name:
       zip_archive = self.LoadZipFile(archive_name)
       if zip_archive:
@@ -326,15 +486,17 @@
         else:
           return 0
 
-  def SetCachingHeaders(self):
+  def SetCachingHeaders(self, revalidate):
     """Set caching headers for the request."""
     max_age = self.MAX_AGE
-    self.response.headers['Expires'] = email.Utils.formatdate(
-        time.time() + max_age, usegmt=True)
-    cache_control = []
+    #self.response.headers['Expires'] = email.Utils.formatdate(
+    #    time.time() + max_age, usegmt=True)
+	cache_control = []
     if self.PUBLIC:
       cache_control.append('public')
     cache_control.append('max-age=%d' % max_age)
+    if revalidate:
+      cache_control.append('must-revalidate')
     self.response.headers['Cache-Control'] = ', '.join(cache_control)
 
   def GetFromCache(self, filename):
@@ -401,7 +563,6 @@
     """
     return memcache.get('%s%s' % (self.NEG_CACHE_PREFIX, filename))
 
-
 def main():
   application = webapp.WSGIApplication([('/([^/]+)/(.*)',
                                          MemcachedZipHandler)])
diff --git a/tools/scripts/build.alias.template b/tools/scripts/build.alias.template
index 1043af1..d051405 100644
--- a/tools/scripts/build.alias.template
+++ b/tools/scripts/build.alias.template
@@ -8,16 +8,16 @@
     <!-- The build.properties file can be created by you and is never touched
          by activitycreator. If you want to manually set properties, this is
          the best place to set them. -->
-    <property file="build.properties"/>
+    <property file="build.properties" />
 
     <!-- The default.properties file is created and updated by activitycreator.
          It will set any properties not already defined by build.properties. -->
-    <property file="default.properties"/>
+    <property file="default.properties" />
 
     <!-- ************************************************************************************* -->
-    <!-- Import the default Android build rules. 
+    <!-- Import the default Android build rules.
          This requires ant 1.6.0 or above. -->
 
-    <import file="${sdk-folder}/tools/lib/alias_rules.xml" />
+    <import file="${sdk.dir}/tools/lib/alias_rules.xml" />
 
 </project>
diff --git a/tools/scripts/build.template b/tools/scripts/build.template
index 1ed3853..3959c57 100644
--- a/tools/scripts/build.template
+++ b/tools/scripts/build.template
@@ -2,22 +2,22 @@
 <project name="PROJECT_NAME" default="help">
 
     <!-- The local.properties file is created and updated by the 'android' tool.
-         It contain the path to the SDK. It should *NOT* be checked in in Version
+         It contains the path to the SDK. It should *NOT* be checked in in Version
          Control Systems. -->
-    <property file="local.properties"/>
+    <property file="local.properties" />
 
     <!-- The build.properties file can be created by you and is never touched
          by the 'android' tool. This is the place to change some of the default property values
          used by the Ant rules.
          Here are some properties you may want to change/update:
 
-         application-package
+         application.package
              the name of your application package as defined in the manifest. Used by the
              'uninstall' rule.
-         source-folder
-             the name of the source folder. Default is 'src'.
-         out-folder
-             the name of the output folder. Default is 'bin'.
+         source.dir
+             the name of the source directory. Default is 'src'.
+         out.dir
+             the name of the output directory. Default is 'bin'.
 
          Properties related to the SDK location or the project target should be updated
           using the 'android' tool with the 'update' action.
@@ -26,27 +26,27 @@
          should be checked in in Version Control Systems.
 
          -->
-    <property file="build.properties"/>
+    <property file="build.properties" />
 
     <!-- The default.properties file is created and updated by the 'android' tool, as well
-         as ADT. 
+         as ADT.
          This file is an integral part of the build system for your application and
          should be checked in in Version Control Systems. -->
-    <property file="default.properties"/>
+    <property file="default.properties" />
 
     <!-- Custom Android task to deal with the project target, and import the proper rules.
          This requires ant 1.6.0 or above. -->
     <path id="android.antlibs">
-        <pathelement path="${sdk-location}/tools/lib/anttasks.jar" />
-        <pathelement path="${sdk-location}/tools/lib/sdklib.jar" />
-        <pathelement path="${sdk-location}/tools/lib/androidprefs.jar" />
-        <pathelement path="${sdk-location}/tools/lib/apkbuilder.jar" />
-        <pathelement path="${sdk-location}/tools/lib/jarutils.jar" />
+        <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
+        <pathelement path="${sdk.dir}/tools/lib/sdklib.jar" />
+        <pathelement path="${sdk.dir}/tools/lib/androidprefs.jar" />
+        <pathelement path="${sdk.dir}/tools/lib/apkbuilder.jar" />
+        <pathelement path="${sdk.dir}/tools/lib/jarutils.jar" />
     </path>
 
     <taskdef name="setup"
         classname="com.android.ant.SetupTask"
-        classpathref="android.antlibs"/>
+        classpathref="android.antlibs" />
 
     <!-- Execute the Android Setup task that will setup some properties specific to the target,
          and import the build rules files.
@@ -58,9 +58,10 @@
          - copy the content of the main node <project> from android_rules.xml
          - paste it in this build.xml below the <setup /> task.
          - disable the import by changing the setup task below to <setup import="false" />
-         
+
          This will ensure that the properties are setup correctly but that your customized
          build steps are used.
     -->
     <setup />
+
 </project>
diff --git a/tools/scripts/devices.xml b/tools/scripts/devices.xml
new file mode 100644
index 0000000..2d10b89
--- /dev/null
+++ b/tools/scripts/devices.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<d:layout-devices
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:d="http://schemas.android.com/sdk/android/layout-devices/1">
+
+    <d:device name="ADP1">
+        <d:default>
+            <d:screen-size>normal</d:screen-size>
+            <d:screen-ratio>notlong</d:screen-ratio>
+            <d:screen-orientation>port</d:screen-orientation>
+            <d:pixel-density>mdpi</d:pixel-density>
+            <d:touch-type>finger</d:touch-type>
+            <d:text-input-method>qwerty</d:text-input-method>
+            <d:nav-method>trackball</d:nav-method>
+            <d:screen-dimension>
+                <d:size>320</d:size>
+                <d:size>480</d:size>
+            </d:screen-dimension>
+            <d:xdpi>180.6</d:xdpi>
+            <d:ydpi>182</d:ydpi>
+        </d:default>
+
+        <d:config name="Portrait">
+            <d:keyboard-state>keyssoft</d:keyboard-state>
+            <d:screen-orientation>port</d:screen-orientation>
+        </d:config>
+        <d:config name="Landscape, closed">
+            <d:keyboard-state>keyssoft</d:keyboard-state>
+            <d:screen-orientation>land</d:screen-orientation>
+        </d:config>
+        <d:config name="Landscape, open">
+            <d:keyboard-state>keysexposed</d:keyboard-state>
+            <d:screen-orientation>land</d:screen-orientation>
+        </d:config>
+    </d:device>
+
+    <d:device name="Ion">
+        <d:default>
+            <d:screen-size>normal</d:screen-size>
+            <d:screen-ratio>notlong</d:screen-ratio>
+            <d:screen-orientation>port</d:screen-orientation>
+            <d:pixel-density>mdpi</d:pixel-density>
+            <d:touch-type>finger</d:touch-type>
+            <d:keyboard-state>keyssoft</d:keyboard-state>
+            <d:text-input-method>nokeys</d:text-input-method>
+            <d:nav-method>trackball</d:nav-method>
+            <d:screen-dimension>
+                <d:size>320</d:size>
+                <d:size>480</d:size>
+            </d:screen-dimension>
+            <d:xdpi>180.6</d:xdpi>
+            <d:ydpi>182</d:ydpi>
+        </d:default>
+
+        <d:config name="Portrait">
+            <d:screen-orientation>port</d:screen-orientation>
+        </d:config>
+        <d:config name="Landscape">
+            <d:screen-orientation>land</d:screen-orientation>
+        </d:config>
+    </d:device>
+</d:layout-devices>
diff --git a/tools/scripts/doc_source.properties b/tools/scripts/doc_source.properties
index 9382836..bdf9bd5 100644
--- a/tools/scripts/doc_source.properties
+++ b/tools/scripts/doc_source.properties
@@ -1,4 +1,5 @@
 Pkg.UserSrc=false
-Platform.Version=1.6
+Platform.Version=2.1
 Pkg.Revision=1
-AndroidVersion.ApiLevel=4
+AndroidVersion.ApiLevel=6
+
diff --git a/tools/scripts/icon_hdpi.png b/tools/scripts/icon_hdpi.png
new file mode 100644
index 0000000..8074c4c
--- /dev/null
+++ b/tools/scripts/icon_hdpi.png
Binary files differ
diff --git a/tools/scripts/icon_ldpi.png b/tools/scripts/icon_ldpi.png
new file mode 100644
index 0000000..1095584
--- /dev/null
+++ b/tools/scripts/icon_ldpi.png
Binary files differ
diff --git a/tools/scripts/icon_mdpi.png b/tools/scripts/icon_mdpi.png
new file mode 100644
index 0000000..a07c69f
--- /dev/null
+++ b/tools/scripts/icon_mdpi.png
Binary files differ
diff --git a/tools/scripts/iml.template b/tools/scripts/iml.template
deleted file mode 100644
index c4fe3a3..0000000
--- a/tools/scripts/iml.template
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
-  <component name="ModuleRootManager" />
-  <component name="NewModuleRootManager" inherit-compiler-output="true">
-    <exclude-output />
-    <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
-    </content>
-    <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="library" name="android" level="project" />
-    <orderEntry type="inheritedJdk" />
-    <orderEntryProperties />
-  </component>
-</module>
diff --git a/tools/scripts/ipr.template b/tools/scripts/ipr.template
deleted file mode 100644
index cb3d65e..0000000
--- a/tools/scripts/ipr.template
+++ /dev/null
@@ -1,232 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4" relativePaths="false">
-  <component name="AntConfiguration">
-    <defaultAnt bundledAnt="true" />
-    <buildFile url="file://$PROJECT_DIR$/build.xml">
-      <additionalClassPath />
-      <antReference projectDefault="true" />
-      <customJdkName value="" />
-      <maximumHeapSize value="128" />
-      <properties />
-    </buildFile>
-  </component>
-  <component name="BuildJarProjectSettings">
-    <option name="BUILD_JARS_ON_MAKE" value="false" />
-  </component>
-  <component name="CodeStyleProjectProfileManger">
-    <option name="PROJECT_PROFILE" />
-    <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
-  </component>
-  <component name="CodeStyleSettingsManager">
-    <option name="PER_PROJECT_SETTINGS" />
-    <option name="USE_PER_PROJECT_SETTINGS" value="false" />
-  </component>
-  <component name="CompilerConfiguration">
-    <option name="DEFAULT_COMPILER" value="Javac" />
-    <option name="DEPLOY_AFTER_MAKE" value="0" />
-    <resourceExtensions>
-      <entry name=".+\.(properties|xml|html|dtd|tld)" />
-      <entry name=".+\.(gif|png|jpeg|jpg)" />
-    </resourceExtensions>
-    <wildcardResourcePatterns>
-      <entry name="?*.properties" />
-      <entry name="?*.xml" />
-      <entry name="?*.gif" />
-      <entry name="?*.png" />
-      <entry name="?*.jpeg" />
-      <entry name="?*.jpg" />
-      <entry name="?*.html" />
-      <entry name="?*.dtd" />
-      <entry name="?*.tld" />
-    </wildcardResourcePatterns>
-  </component>
-  <component name="DataSourceManagerImpl" />
-  <component name="DependenciesAnalyzeManager">
-    <option name="myForwardDirection" value="false" />
-  </component>
-  <component name="DependencyValidationManager" />
-  <component name="EclipseCompilerSettings">
-    <option name="DEBUGGING_INFO" value="true" />
-    <option name="GENERATE_NO_WARNINGS" value="true" />
-    <option name="DEPRECATION" value="false" />
-    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
-    <option name="MAXIMUM_HEAP_SIZE" value="128" />
-  </component>
-  <component name="EclipseEmbeddedCompilerSettings">
-    <option name="DEBUGGING_INFO" value="true" />
-    <option name="GENERATE_NO_WARNINGS" value="true" />
-    <option name="DEPRECATION" value="false" />
-    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
-    <option name="MAXIMUM_HEAP_SIZE" value="128" />
-  </component>
-  <component name="EntryPointsManager">
-    <entry_points />
-  </component>
-  <component name="ExportToHTMLSettings">
-    <option name="PRINT_LINE_NUMBERS" value="false" />
-    <option name="OPEN_IN_BROWSER" value="false" />
-    <option name="OUTPUT_DIRECTORY" />
-  </component>
-  <component name="GUI Designer component loader factory" />
-  <component name="IdProvider" IDEtalkID="F6EC4D80E2C03FEF19EDD201903A6DFE" />
-  <component name="InspectionProjectProfileManager">
-    <option name="PROJECT_PROFILE" value="Project Default" />
-    <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
-    <scopes />
-    <profiles>
-      <profile version="1.0" is_locked="false">
-        <option name="myName" value="Project Default" />
-        <option name="myLocal" value="false" />
-        <used_levels>
-          <error>
-            <option name="myName" value="ERROR" />
-            <option name="myVal" value="400" />
-          </error>
-          <warning>
-            <option name="myName" value="WARNING" />
-            <option name="myVal" value="300" />
-          </warning>
-          <information>
-            <option name="myName" value="INFO" />
-            <option name="myVal" value="200" />
-          </information>
-          <server>
-            <option name="myName" value="SERVER PROBLEM" />
-            <option name="myVal" value="100" />
-          </server>
-        </used_levels>
-        <inspection_tool class="ClassReferencesSubclass" level="WARNING" enabled="true" />
-        <inspection_tool class="MissingOverrideAnnotation" level="WARNING" enabled="true" />
-        <inspection_tool class="Finalize" level="WARNING" enabled="true" />
-        <inspection_tool class="UnusedImport" level="WARNING" enabled="true" />
-        <inspection_tool class="StaticInheritance" level="WARNING" enabled="true" />
-        <inspection_tool class="RedundantMethodOverride" level="WARNING" enabled="true" />
-        <inspection_tool class="AbstractMethodCallInConstructor" level="WARNING" enabled="true" />
-        <inspection_tool class="RawUseOfParameterizedType" level="WARNING" enabled="true">
-          <option name="ignoreObjectConstruction" value="true" />
-          <option name="ignoreTypeCasts" value="false" />
-        </inspection_tool>
-        <inspection_tool class="SystemGC" level="WARNING" enabled="true" />
-        <inspection_tool class="ConstantNamingConvention" level="WARNING" enabled="true">
-          <option name="m_regex" value="[A-Z_\d]*" />
-          <option name="m_minLength" value="5" />
-          <option name="m_maxLength" value="32" />
-        </inspection_tool>
-        <inspection_tool class="EnumeratedConstantNamingConvention" level="WARNING" enabled="true">
-          <option name="m_regex" value="[A-Z][A-Za-z\d]*" />
-          <option name="m_minLength" value="5" />
-          <option name="m_maxLength" value="32" />
-        </inspection_tool>
-        <inspection_tool class="DivideByZero" level="WARNING" enabled="true" />
-        <inspection_tool class="CloneCallsConstructors" level="WARNING" enabled="true" />
-        <inspection_tool class="CloneDeclaresCloneNotSupported" level="WARNING" enabled="false" />
-        <inspection_tool class="CloneInNonCloneableClass" level="WARNING" enabled="true" />
-        <inspection_tool class="UtilityClassWithoutPrivateConstructor" level="WARNING" enabled="true">
-          <option name="ignoreClassesWithOnlyMain" value="false" />
-        </inspection_tool>
-        <inspection_tool class="UtilityClassWithPublicConstructor" level="WARNING" enabled="true" />
-        <inspection_tool class="ConditionalExpressionWithIdenticalBranches" level="WARNING" enabled="true" />
-        <inspection_tool class="CanBeFinal" level="WARNING" enabled="false">
-          <option name="REPORT_CLASSES" value="false" />
-          <option name="REPORT_METHODS" value="false" />
-          <option name="REPORT_FIELDS" value="true" />
-        </inspection_tool>
-        <inspection_tool class="ThisEscapedInConstructor" level="WARNING" enabled="true" />
-        <inspection_tool class="NonThreadSafeLazyInitialization" level="WARNING" enabled="true" />
-        <inspection_tool class="FieldMayBeStatic" level="WARNING" enabled="true" />
-        <inspection_tool class="InnerClassMayBeStatic" level="WARNING" enabled="true" />
-        <inspection_tool class="MethodMayBeStatic" level="WARNING" enabled="true">
-          <option name="m_onlyPrivateOrFinal" value="false" />
-          <option name="m_ignoreEmptyMethods" value="true" />
-        </inspection_tool>
-        <inspection_tool class="ComponentRegistrationProblems" level="ERROR" enabled="false">
-          <option name="CHECK_PLUGIN_XML" value="true" />
-          <option name="CHECK_JAVA_CODE" value="true" />
-          <option name="CHECK_ACTIONS" value="true" />
-        </inspection_tool>
-        <inspection_tool class="ComponentNotRegistered" level="WARNING" enabled="false">
-          <option name="CHECK_ACTIONS" value="true" />
-          <option name="IGNORE_NON_PUBLIC" value="true" />
-        </inspection_tool>
-        <inspection_tool class="BusyWait" level="WARNING" enabled="true" />
-        <inspection_tool class="UnconditionalWait" level="WARNING" enabled="true" />
-        <inspection_tool class="WaitNotInLoop" level="WARNING" enabled="true" />
-      </profile>
-    </profiles>
-  </component>
-  <component name="JavacSettings">
-    <option name="DEBUGGING_INFO" value="true" />
-    <option name="GENERATE_NO_WARNINGS" value="false" />
-    <option name="DEPRECATION" value="true" />
-    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
-    <option name="MAXIMUM_HEAP_SIZE" value="128" />
-  </component>
-  <component name="JavadocGenerationManager">
-    <option name="OUTPUT_DIRECTORY" />
-    <option name="OPTION_SCOPE" value="protected" />
-    <option name="OPTION_HIERARCHY" value="true" />
-    <option name="OPTION_NAVIGATOR" value="true" />
-    <option name="OPTION_INDEX" value="true" />
-    <option name="OPTION_SEPARATE_INDEX" value="true" />
-    <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
-    <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
-    <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
-    <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
-    <option name="OPTION_DEPRECATED_LIST" value="true" />
-    <option name="OTHER_OPTIONS" value="" />
-    <option name="HEAP_SIZE" />
-    <option name="LOCALE" />
-    <option name="OPEN_IN_BROWSER" value="true" />
-  </component>
-  <component name="JikesSettings">
-    <option name="JIKES_PATH" value="" />
-    <option name="DEBUGGING_INFO" value="true" />
-    <option name="DEPRECATION" value="true" />
-    <option name="GENERATE_NO_WARNINGS" value="false" />
-    <option name="IS_EMACS_ERRORS_MODE" value="true" />
-    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
-  </component>
-  <component name="LogConsolePreferences">
-    <option name="FILTER_ERRORS" value="false" />
-    <option name="FILTER_WARNINGS" value="false" />
-    <option name="FILTER_INFO" value="true" />
-    <option name="CUSTOM_FILTER" />
-  </component>
-  <component name="ProjectModuleManager">
-    <modules>
-      <module fileurl="file://$PROJECT_DIR$/ACTIVITY_NAME.iml" filepath="$PROJECT_DIR$/ACTIVITY_NAME.iml" />
-    </modules>
-  </component>
-  <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="1.5" project-jdk-type="JavaSDK">
-    <output url="file://$PROJECT_DIR$/bin" />
-  </component>
-  <component name="ProjectRunConfigurationManager" />
-  <component name="RmicSettings">
-    <option name="IS_EANABLED" value="false" />
-    <option name="DEBUGGING_INFO" value="true" />
-    <option name="GENERATE_NO_WARNINGS" value="false" />
-    <option name="GENERATE_IIOP_STUBS" value="false" />
-    <option name="ADDITIONAL_OPTIONS_STRING" value="" />
-  </component>
-  <component name="StarteamVcsAdapter" />
-  <component name="XSLT-Support.FileAssociationsManager" />
-  <component name="com.intellij.jsf.UserDefinedFacesConfigs">
-    <option name="USER_DEFINED_CONFIGS">
-      <value>
-        <list size="0" />
-      </value>
-    </option>
-  </component>
-  <component name="libraryTable">
-    <library name="android">
-      <CLASSES>
-        <root url="jar://ANDROID_SDK_FOLDER/android.jar!/" />
-      </CLASSES>
-      <JAVADOC>
-        <root url="file://ANDROID_SDK_FOLDER/docs/reference" />
-      </JAVADOC>
-      <SOURCES />
-    </library>
-  </component>
-  <UsedPathMacros />
-</project>
diff --git a/tools/scripts/iws.template b/tools/scripts/iws.template
deleted file mode 100644
index 67d2053..0000000
--- a/tools/scripts/iws.template
+++ /dev/null
@@ -1,470 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4" relativePaths="false">
-  <component name="AntConfiguration">
-    <defaultAnt bundledAnt="true" />
-    <buildFile url="file://$PROJECT_DIR$/build.xml">
-      <additionalClassPath />
-      <antReference projectDefault="true" />
-      <customJdkName value="" />
-      <maximumHeapSize value="128" />
-      <properties />
-    </buildFile>
-  </component>
-  <component name="BookmarkManager" />
-  <component name="ChangeBrowserSettings">
-    <option name="MAIN_SPLITTER_PROPORTION" value="0.3" />
-    <option name="MESSAGES_SPLITTER_PROPORTION" value="0.8" />
-    <option name="USE_DATE_BEFORE_FILTER" value="false" />
-    <option name="USE_DATE_AFTER_FILTER" value="false" />
-    <option name="USE_CHANGE_BEFORE_FILTER" value="false" />
-    <option name="USE_CHANGE_AFTER_FILTER" value="false" />
-    <option name="DATE_BEFORE" value="" />
-    <option name="DATE_AFTER" value="" />
-    <option name="CHANGE_BEFORE" value="" />
-    <option name="CHANGE_AFTER" value="" />
-    <option name="USE_USER_FILTER" value="false" />
-    <option name="USER" value="" />
-  </component>
-  <component name="ChangeListManager">
-    <list default="true" name="Default" comment="" />
-  </component>
-  <component name="ChangeListSynchronizer" />
-  <component name="ChangesViewManager" flattened_view="true" />
-  <component name="CheckinPanelState" />
-  <component name="Commander">
-    <leftPanel />
-    <rightPanel />
-    <splitter proportion="0.5" />
-  </component>
-  <component name="CompilerWorkspaceConfiguration">
-    <option name="COMPILE_IN_BACKGROUND" value="false" />
-    <option name="AUTO_SHOW_ERRORS_IN_EDITOR" value="true" />
-    <option name="CLOSE_MESSAGE_VIEW_IF_SUCCESS" value="true" />
-    <option name="COMPILE_DEPENDENT_FILES" value="false" />
-    <option name="CLEAR_OUTPUT_DIRECTORY" value="false" />
-    <option name="ASSERT_NOT_NULL" value="true" />
-  </component>
-  <component name="CoverageDataManager" />
-  <component name="Cvs2Configuration">
-    <option name="PRUNE_EMPTY_DIRECTORIES" value="true" />
-    <option name="MERGING_MODE" value="0" />
-    <option name="MERGE_WITH_BRANCH1_NAME" value="HEAD" />
-    <option name="MERGE_WITH_BRANCH2_NAME" value="HEAD" />
-    <option name="RESET_STICKY" value="false" />
-    <option name="CREATE_NEW_DIRECTORIES" value="true" />
-    <option name="DEFAULT_TEXT_FILE_SUBSTITUTION" value="kv" />
-    <option name="PROCESS_UNKNOWN_FILES" value="false" />
-    <option name="PROCESS_DELETED_FILES" value="false" />
-    <option name="PROCESS_IGNORED_FILES" value="false" />
-    <option name="RESERVED_EDIT" value="false" />
-    <option name="CHECKOUT_DATE_OR_REVISION_SETTINGS">
-      <value>
-        <option name="BRANCH" value="" />
-        <option name="DATE" value="" />
-        <option name="USE_BRANCH" value="false" />
-        <option name="USE_DATE" value="false" />
-      </value>
-    </option>
-    <option name="UPDATE_DATE_OR_REVISION_SETTINGS">
-      <value>
-        <option name="BRANCH" value="" />
-        <option name="DATE" value="" />
-        <option name="USE_BRANCH" value="false" />
-        <option name="USE_DATE" value="false" />
-      </value>
-    </option>
-    <option name="SHOW_CHANGES_REVISION_SETTINGS">
-      <value>
-        <option name="BRANCH" value="" />
-        <option name="DATE" value="" />
-        <option name="USE_BRANCH" value="false" />
-        <option name="USE_DATE" value="false" />
-      </value>
-    </option>
-    <option name="SHOW_OUTPUT" value="false" />
-    <option name="ADD_WATCH_INDEX" value="0" />
-    <option name="REMOVE_WATCH_INDEX" value="0" />
-    <option name="UPDATE_KEYWORD_SUBSTITUTION" />
-    <option name="MAKE_NEW_FILES_READONLY" value="false" />
-    <option name="SHOW_CORRUPTED_PROJECT_FILES" value="0" />
-    <option name="TAG_AFTER_PROJECT_COMMIT" value="false" />
-    <option name="OVERRIDE_EXISTING_TAG_FOR_PROJECT" value="true" />
-    <option name="TAG_AFTER_PROJECT_COMMIT_NAME" value="" />
-    <option name="CLEAN_COPY" value="false" />
-  </component>
-  <component name="DaemonCodeAnalyzer">
-    <disable_hints />
-  </component>
-  <component name="DebuggerManager">
-    <breakpoint_any>
-      <breakpoint>
-        <option name="NOTIFY_CAUGHT" value="true" />
-        <option name="NOTIFY_UNCAUGHT" value="true" />
-        <option name="ENABLED" value="false" />
-        <option name="SUSPEND_POLICY" value="SuspendAll" />
-        <option name="LOG_ENABLED" value="false" />
-        <option name="LOG_EXPRESSION_ENABLED" value="false" />
-        <option name="COUNT_FILTER_ENABLED" value="false" />
-        <option name="COUNT_FILTER" value="0" />
-        <option name="CONDITION_ENABLED" value="false" />
-        <option name="CLASS_FILTERS_ENABLED" value="false" />
-        <option name="INSTANCE_FILTERS_ENABLED" value="false" />
-        <option name="CONDITION" value="" />
-        <option name="LOG_MESSAGE" value="" />
-      </breakpoint>
-      <breakpoint>
-        <option name="NOTIFY_CAUGHT" value="true" />
-        <option name="NOTIFY_UNCAUGHT" value="true" />
-        <option name="ENABLED" value="false" />
-        <option name="SUSPEND_POLICY" value="SuspendAll" />
-        <option name="LOG_ENABLED" value="false" />
-        <option name="LOG_EXPRESSION_ENABLED" value="false" />
-        <option name="COUNT_FILTER_ENABLED" value="false" />
-        <option name="COUNT_FILTER" value="0" />
-        <option name="CONDITION_ENABLED" value="false" />
-        <option name="CLASS_FILTERS_ENABLED" value="false" />
-        <option name="INSTANCE_FILTERS_ENABLED" value="false" />
-        <option name="CONDITION" value="" />
-        <option name="LOG_MESSAGE" value="" />
-      </breakpoint>
-    </breakpoint_any>
-    <breakpoint_rules />
-    <ui_properties />
-  </component>
-  <component name="ErrorTreeViewConfiguration">
-    <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
-    <option name="HIDE_WARNINGS" value="false" />
-  </component>
-  <component name="FavoritesManager">
-    <favorites_list name="LunarLander" />
-  </component>
-  <component name="FavoritesProjectViewPane" />
-	<component name="FileEditorManager">
-    <leaf>
-      <file leaf-file-name="ACTIVITY_NAME.java" pinned="false" current="true" current-in-tab="true">
-        <entry file="file://$PROJECT_DIR$/src/PACKAGE_PATH/ACTIVITY_NAME.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.08211144">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-    </leaf>
-  </component>
-  <component name="FindManager">
-    <FindUsagesManager>
-      <setting name="OPEN_NEW_TAB" value="false" />
-    </FindUsagesManager>
-  </component>
-  <component name="HierarchyBrowserManager">
-    <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
-    <option name="SORT_ALPHABETICALLY" value="false" />
-    <option name="HIDE_CLASSES_WHERE_METHOD_NOT_IMPLEMENTED" value="false" />
-  </component>
-  <component name="InspectionManager">
-    <option name="AUTOSCROLL_TO_SOURCE" value="false" />
-    <option name="SPLITTER_PROPORTION" value="0.5" />
-    <option name="GROUP_BY_SEVERITY" value="false" />
-    <option name="FILTER_RESOLVED_ITEMS" value="true" />
-    <option name="ANALYZE_TEST_SOURCES" value="true" />
-    <option name="SHOW_DIFF_WITH_PREVIOUS_RUN" value="false" />
-    <option name="SCOPE_TYPE" value="1" />
-    <option name="CUSTOM_SCOPE_NAME" value="" />
-    <option name="SHOW_ONLY_DIFF" value="false" />
-    <option name="myCurrentProfileName" value="Default" />
-  </component>
-  <component name="J2EEProjectPane" />
-  <component name="JspContextManager" />
-  <component name="ModuleEditorState">
-    <option name="LAST_EDITED_MODULE_NAME" />
-    <option name="LAST_EDITED_TAB_NAME" />
-  </component>
-  <component name="NamedScopeManager" />
-  <component name="PackagesPane">
-    <subPane>
-      <PATH>
-        <PATH_ELEMENT>
-          <option name="myItemId" value="ACTIVITY_NAME.ipr" />
-          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode" />
-        </PATH_ELEMENT>
-        <PATH_ELEMENT>
-          <option name="myItemId" value="ACTIVITY_NAME" />
-          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" />
-        </PATH_ELEMENT>
-      </PATH>
-    </subPane>
-  </component>
-  <component name="PerforceChangeBrowserSettings">
-    <option name="USE_CLIENT_FILTER" value="true" />
-    <option name="CLIENT" value="" />
-  </component>
-  <component name="PerforceDirect.Settings">
-    <option name="useP4CONFIG" value="true" />
-    <option name="port" value="&lt;perforce_server&gt;:1666" />
-    <option name="client" value="" />
-    <option name="user" value="" />
-    <option name="passwd" value="" />
-    <option name="showCmds" value="false" />
-    <option name="useNativeApi" value="false" />
-    <option name="pathToExec" value="p4" />
-    <option name="useCustomPathToExec" value="false" />
-    <option name="SYNC_FORCE" value="false" />
-    <option name="SYNC_RUN_RESOLVE" value="true" />
-    <option name="REVERT_UNCHANGED_FILES" value="true" />
-    <option name="CHARSET" value="none" />
-    <option name="SHOW_BRANCHES_HISTORY" value="true" />
-    <option name="ENABLED" value="true" />
-    <option name="USE_LOGIN" value="false" />
-    <option name="LOGIN_SILENTLY" value="false" />
-    <option name="INTEGRATE_RUN_RESOLVE" value="true" />
-    <option name="INTEGRATE_REVERT_UNCHANGED" value="true" />
-    <option name="SERVER_TIMEOUT" value="20000" />
-  </component>
-  <component name="ProjectLevelVcsManager">
-    <OptionsSetting value="true" id="Add" />
-    <OptionsSetting value="true" id="Remove" />
-    <OptionsSetting value="true" id="Checkin" />
-    <OptionsSetting value="true" id="Checkout" />
-    <OptionsSetting value="true" id="Update" />
-    <OptionsSetting value="true" id="Status" />
-    <OptionsSetting value="true" id="Edit" />
-    <ConfirmationsSetting value="0" id="Add" />
-    <ConfirmationsSetting value="0" id="Remove" />
-  </component>
-  <component name="ProjectPane">
-    <subPane>
-      <PATH>
-        <PATH_ELEMENT>
-          <option name="myItemId" value="ACTIVITY_NAME.ipr" />
-          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
-        </PATH_ELEMENT>
-        <PATH_ELEMENT>
-          <option name="myItemId" value="ACTIVITY_NAME" />
-          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
-        </PATH_ELEMENT>
-      </PATH>
-    </subPane>
-  </component>
-  <component name="ProjectReloadState">
-    <option name="STATE" value="0" />
-  </component>
-  <component name="ProjectView">
-    <navigator currentView="ProjectPane" proportions="0.1" version="1" splitterProportion="0.5">
-      <flattenPackages />
-      <showMembers />
-      <showModules />
-      <showLibraryContents />
-      <hideEmptyPackages />
-      <abbreviatePackageNames />
-      <showStructure PackagesPane="false" ProjectPane="false" />
-      <autoscrollToSource />
-      <autoscrollFromSource />
-      <sortByType />
-    </navigator>
-  </component>
-  <component name="PropertiesComponent">
-    <property name="MemberChooser.copyJavadoc" value="false" />
-    <property name="GoToClass.includeLibraries" value="false" />
-    <property name="MemberChooser.showClasses" value="true" />
-    <property name="MemberChooser.sorted" value="false" />
-    <property name="GoToFile.includeJavaFiles" value="false" />
-    <property name="GoToClass.toSaveIncludeLibraries" value="false" />
-  </component>
-  <component name="ReadonlyStatusHandler">
-    <option name="SHOW_DIALOG" value="true" />
-  </component>
-  <component name="RecentsManager" />
-  <component name="RestoreUpdateTree" />
-  <component name="RunManager">
-    <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
-      <option name="MAIN_CLASS_NAME" />
-      <option name="VM_PARAMETERS" />
-      <option name="PROGRAM_PARAMETERS" />
-      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
-      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
-      <option name="ALTERNATIVE_JRE_PATH" />
-      <option name="ENABLE_SWING_INSPECTOR" value="false" />
-      <module name="" />
-    </configuration>
-    <configuration default="true" type="Applet" factoryName="Applet">
-      <module name="" />
-      <option name="MAIN_CLASS_NAME" />
-      <option name="HTML_FILE_NAME" />
-      <option name="HTML_USED" value="false" />
-      <option name="WIDTH" value="400" />
-      <option name="HEIGHT" value="300" />
-      <option name="POLICY_FILE" value="/Developer/Applications/IntelliJ IDEA 6.0.4.app/bin/appletviewer.policy" />
-      <option name="VM_PARAMETERS" />
-      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
-      <option name="ALTERNATIVE_JRE_PATH" />
-    </configuration>
-    <configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
-      <module name="" />
-      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
-      <option name="ALTERNATIVE_JRE_PATH" />
-      <option name="PACKAGE_NAME" />
-      <option name="MAIN_CLASS_NAME" />
-      <option name="METHOD_NAME" />
-      <option name="TEST_OBJECT" value="class" />
-      <option name="VM_PARAMETERS" />
-      <option name="PARAMETERS" />
-      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
-      <option name="ADDITIONAL_CLASS_PATH" />
-      <option name="TEST_SEARCH_SCOPE">
-        <value defaultName="wholeProject" />
-      </option>
-    </configuration>
-    <configuration default="true" type="Remote" factoryName="Remote">
-      <option name="USE_SOCKET_TRANSPORT" value="true" />
-      <option name="SERVER_MODE" value="false" />
-      <option name="SHMEM_ADDRESS" value="javadebug" />
-      <option name="HOST" value="localhost" />
-      <option name="PORT" value="5005" />
-    </configuration>
-  </component>
-  <component name="ScopeViewComponent" />
-  <component name="SelectInManager" />
-  <component name="StarteamConfiguration">
-    <option name="SERVER" value="" />
-    <option name="PORT" value="49201" />
-    <option name="USER" value="" />
-    <option name="PASSWORD" value="" />
-    <option name="PROJECT" value="" />
-    <option name="VIEW" value="" />
-    <option name="ALTERNATIVE_WORKING_PATH" value="" />
-    <option name="LOCK_ON_CHECKOUT" value="false" />
-    <option name="UNLOCK_ON_CHECKIN" value="false" />
-  </component>
-  <component name="StructuralSearchPlugin" />
-  <component name="StructureViewFactory">
-    <option name="AUTOSCROLL_MODE" value="true" />
-    <option name="AUTOSCROLL_FROM_SOURCE" value="false" />
-    <option name="ACTIVE_ACTIONS" value="" />
-  </component>
-  <component name="Struts Assistant">
-    <option name="showInputs" value="true" />
-    <option name="resources">
-      <value>
-        <option name="strutsPath" />
-        <option name="strutsHelp" />
-      </value>
-    </option>
-    <option name="selectedTaglibs" />
-    <option name="selectedTaglibs" />
-    <option name="myStrutsValidationEnabled" value="true" />
-    <option name="myTilesValidationEnabled" value="true" />
-    <option name="myValidatorValidationEnabled" value="true" />
-    <option name="myReportErrorsAsWarnings" value="true" />
-  </component>
-  <component name="SvnChangesBrowserSettings">
-    <option name="USE_AUTHOR_FIELD" value="true" />
-    <option name="AUTHOR" value="" />
-    <option name="LOCATION" value="" />
-    <option name="USE_PROJECT_SETTINGS" value="true" />
-    <option name="USE_ALTERNATE_LOCATION" value="false" />
-  </component>
-  <component name="SvnConfiguration">
-    <option name="USER" value="" />
-    <option name="PASSWORD" value="" />
-    <option name="PROCESS_UNRESOLVED" value="false" />
-    <option name="LAST_MERGED_REVISION" />
-    <option name="UPDATE_RUN_STATUS" value="false" />
-    <option name="UPDATE_RECURSIVELY" value="true" />
-    <option name="MERGE_DRY_RUN" value="false" />
-    <upgradeMode>auto</upgradeMode>
-  </component>
-  <component name="TodoView" selected-index="0">
-    <todo-panel id="selected-file">
-      <are-packages-shown value="false" />
-      <are-modules-shown value="false" />
-      <flatten-packages value="false" />
-      <is-autoscroll-to-source value="true" />
-    </todo-panel>
-    <todo-panel id="all">
-      <are-packages-shown value="true" />
-      <are-modules-shown value="false" />
-      <flatten-packages value="false" />
-      <is-autoscroll-to-source value="true" />
-    </todo-panel>
-  </component>
-  <component name="ToolWindowManager">
-    <frame x="0" y="22" width="1440" height="834" extended-state="0" />
-    <editor active="false" />
-    <layout>
-      <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="-1" />
-      <window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="-1" />
-      <window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="-1" />
-      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="7" />
-      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24946082" order="0" />
-      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="1" />
-      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="1" />
-      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="-1" />
-      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="6" />
-      <window_info id="Module Dependencies" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="-1" />
-      <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="-1" />
-      <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="-1" />
-      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="1" />
-      <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="-1" />
-      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="2" />
-      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="2" />
-      <window_info id="File View" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="-1" />
-      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="4" />
-      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="0" />
-      <window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="-1" />
-      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="-1" />
-      <window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="2" />
-      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="0" />
-      <window_info id="EJB" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="3" />
-      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="5" />
-    </layout>
-  </component>
-  <component name="VCS.FileViewConfiguration">
-    <option name="SELECTED_STATUSES" value="DEFAULT" />
-    <option name="SELECTED_COLUMNS" value="DEFAULT" />
-    <option name="SHOW_FILTERS" value="true" />
-    <option name="CUSTOMIZE_VIEW" value="true" />
-    <option name="SHOW_FILE_HISTORY_AS_TREE" value="true" />
-  </component>
-  <component name="VcsManagerConfiguration">
-    <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
-    <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
-    <option name="PERFORM_UPDATE_IN_BACKGROUND" value="false" />
-    <option name="PERFORM_COMMIT_IN_BACKGROUND" value="false" />
-    <option name="PUT_FOCUS_INTO_COMMENT" value="false" />
-    <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
-    <option name="LAST_COMMIT_MESSAGE" />
-    <option name="SAVE_LAST_COMMIT_MESSAGE" value="true" />
-    <option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" />
-    <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
-    <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
-    <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
-    <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
-    <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
-    <option name="ERROR_OCCURED" value="false" />
-    <option name="ACTIVE_VCS_NAME" value="CVS" />
-    <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
-    <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
-    <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
-  </component>
-  <component name="XPathView.XPathProjectComponent">
-    <history />
-    <find-history />
-  </component>
-  <component name="XSLT-Support.FileAssociationsSettings" />
-  <component name="antWorkspaceConfiguration">
-    <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
-    <option name="FILTER_TARGETS" value="false" />
-  </component>
-  <component name="com.intellij.ide.util.scopeChooser.ScopeChooserConfigurable" proportions="" version="1">
-    <option name="myLastEditedConfigurable" />
-  </component>
-  <component name="com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectRootMasterDetailsConfigurable" proportions="0.1" version="1">
-    <option name="myPlainMode" value="false" />
-    <option name="myLastEditedConfigurable" value="android" />
-  </component>
-  <component name="com.intellij.profile.ui.ErrorOptionsConfigurable" proportions="" version="1">
-    <option name="myLastEditedConfigurable" />
-  </component>
-  <component name="editorHistoryManager" />
-</project>
\ No newline at end of file
diff --git a/tools/scripts/java_file.template b/tools/scripts/java_file.template
index aeb541f..19714a8 100644
--- a/tools/scripts/java_file.template
+++ b/tools/scripts/java_file.template
@@ -3,7 +3,7 @@
 import android.app.Activity;
 import android.os.Bundle;
 
-public class ACTIVITY_NAME extends Activity
+public class ACTIVITY_CLASS_NAME extends Activity
 {
     /** Called when the activity is first created. */
     @Override
diff --git a/tools/scripts/java_tests_file.template b/tools/scripts/java_tests_file.template
index c6fa873..08d6f9b 100644
--- a/tools/scripts/java_tests_file.template
+++ b/tools/scripts/java_tests_file.template
@@ -9,13 +9,13 @@
  * <p/>
  * To run this test, you can type:
  * adb shell am instrument -w \
- * -e class PACKAGE.ACTIVITY_NAMETest \
+ * -e class ACTIVITY_FQ_NAME \
  * PACKAGE.tests/android.test.InstrumentationTestRunner
  */
-public class ACTIVITY_NAMETest extends ActivityInstrumentationTestCase2<ACTIVITY_NAME> {
+public class ACTIVITY_CLASS_NAME extends ActivityInstrumentationTestCase2<ACTIVITY_TESTED_CLASS_NAME> {
 
-    public ACTIVITY_NAMETest() {
-        super("PACKAGE", ACTIVITY_NAME.class);
+    public ACTIVITY_CLASS_NAME() {
+        super("PACKAGE", ACTIVITY_TESTED_CLASS_NAME.class);
     }
 
 }
\ No newline at end of file
diff --git a/tools/scripts/layout.template b/tools/scripts/layout.template
index 864e997..f5e367c 100644
--- a/tools/scripts/layout.template
+++ b/tools/scripts/layout.template
@@ -7,7 +7,7 @@
 <TextView  
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
-    android:text="Hello World, ACTIVITY_NAME"
+    android:text="Hello World, ACTIVITY_ENTRY_NAME"
     />
 </LinearLayout>
 
diff --git a/tools/scripts/platform_source.properties b/tools/scripts/platform_source.properties
index 49dc3ae..a5268c5 100644
--- a/tools/scripts/platform_source.properties
+++ b/tools/scripts/platform_source.properties
@@ -1,5 +1,5 @@
-Pkg.Desc=Android SDK Platform 1.6_r1
+Pkg.Desc=Android SDK Platform 2.1_r1
 Pkg.UserSrc=false
-Platform.Version=1.6
+Platform.Version=2.1
 Pkg.Revision=1
-AndroidVersion.ApiLevel=4
+AndroidVersion.ApiLevel=6
diff --git a/tools/scripts/plugin.prop b/tools/scripts/plugin.prop
index af9613e..39a8c42 100644
--- a/tools/scripts/plugin.prop
+++ b/tools/scripts/plugin.prop
@@ -1,4 +1,3 @@
 # begin plugin.prop
-plugin.version=0.9.2
-plugin.platform=android
+plugin.version=0.9.4
 # end plugin.prop
\ No newline at end of file
diff --git a/tools/scripts/strings.template b/tools/scripts/strings.template
index acc28e2..ee5af40 100644
--- a/tools/scripts/strings.template
+++ b/tools/scripts/strings.template
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <string name="app_name">ACTIVITY_NAME</string>
+    <string name="app_name">ACTIVITY_ENTRY_NAME</string>
 </resources>
diff --git a/tools/scripts/tools_source.properties b/tools/scripts/tools_source.properties
index 9528e79..f8de7ce 100644
--- a/tools/scripts/tools_source.properties
+++ b/tools/scripts/tools_source.properties
@@ -1,2 +1,2 @@
 Pkg.UserSrc=false
-Pkg.Revision=2
+Pkg.Revision=5
diff --git a/tools/scripts/usbdriver_source.properties b/tools/scripts/usbdriver_source.properties
new file mode 100755
index 0000000..1984dca
--- /dev/null
+++ b/tools/scripts/usbdriver_source.properties
@@ -0,0 +1,4 @@
+Pkg.Revision=2

+Archive.Os=WINDOWS

+Archive.Arch=ANY

+Extra.Path=usb_driver

diff --git a/tools/sdklauncher/.gitignore b/tools/sdklauncher/.gitignore
new file mode 100644
index 0000000..0c25b2a
--- /dev/null
+++ b/tools/sdklauncher/.gitignore
@@ -0,0 +1 @@
+images/android_icon.o
diff --git a/tools/sdklauncher/Android.mk b/tools/sdklauncher/Android.mk
new file mode 100644
index 0000000..3e92ea8
--- /dev/null
+++ b/tools/sdklauncher/Android.mk
@@ -0,0 +1,43 @@
+# Copyright 2009 The Android Open Source Project
+#
+# Android.mk for sdklauncher
+#
+# The "SDK Launcher" is for Windows only.
+# This simple .exe will sit at the root of the Windows SDK
+# and currently simply executes tools\android.bat.
+# Eventually it should simply replace the batch file.
+
+ifeq ($(HOST_OS),windows)
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+	sdklauncher.c
+
+LOCAL_CFLAGS += -Wall -Wno-unused-parameter
+LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE -DSH_HISTORY
+LOCAL_MODULE := sdklauncher
+
+# Link the Windows icon file as well into the executable, based on the technique
+# used in external/qemu/Makefile.android.
+#
+INTERMEDIATE     := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true)
+ANDROID_ICON_OBJ := android_icon.o
+ANDROID_ICON_PATH := $(LOCAL_PATH)/images
+$(ANDROID_ICON_PATH)/$(ANDROID_ICON_OBJ): $(ANDROID_ICON_PATH)/android_icon.rc
+	windres $< -I $(ANDROID_ICON_PATH) -o $@
+
+# seems to be the only way to add an object file that was not generated from
+# a C/C++/Java source file to our build system. and very unfortunately,
+# $(TOPDIR)/$(LOCALPATH) will always be prepended to this value, which forces
+# us to put the object file in the source directory...
+#
+LOCAL_PREBUILT_OBJ_FILES += images/$(ANDROID_ICON_OBJ)
+
+include $(BUILD_HOST_EXECUTABLE)
+
+$(call dist-for-goals,droid,$(LOCAL_BUILT_MODULE))
+
+endif
diff --git a/tools/sdklauncher/images/android_icon.ico b/tools/sdklauncher/images/android_icon.ico
new file mode 100644
index 0000000..bd25179
--- /dev/null
+++ b/tools/sdklauncher/images/android_icon.ico
Binary files differ
diff --git a/tools/sdklauncher/images/android_icon.rc b/tools/sdklauncher/images/android_icon.rc
new file mode 100644
index 0000000..df468ac
--- /dev/null
+++ b/tools/sdklauncher/images/android_icon.rc
@@ -0,0 +1,3 @@
+1 ICON "../images/android_icon.ico"

+

+

diff --git a/tools/sdklauncher/sdklauncher.c b/tools/sdklauncher/sdklauncher.c
new file mode 100644
index 0000000..d052284
--- /dev/null
+++ b/tools/sdklauncher/sdklauncher.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * The "SDK Launcher" is for Windows only.
+ * This simple .exe will sit at the root of the Windows SDK
+ * and currently simply executes tools\android.bat.
+ * Eventually it should simply replace the batch file.
+ *
+ * TODO:
+ * - detect that java is installed; error dialog if not, explaning where to get it.
+ * - create temp dir, always copy *.jar there, exec android.jar
+ * - get jars to copy from some file
+ * - use a version number to copy jars only if needed (tools.revision?)
+ */
+
+#ifdef _WIN32
+
+#include <stdio.h>
+#include <windows.h>
+
+int sdk_launcher() {
+    STARTUPINFO           startup;
+    PROCESS_INFORMATION   pinfo;
+    char                  program_path[MAX_PATH];
+    int                   ret;
+
+    ZeroMemory(&startup, sizeof(startup));
+    startup.cb = sizeof(startup);
+
+    ZeroMemory(&pinfo, sizeof(pinfo));
+
+    /* get path of current program */
+    GetModuleFileName(NULL, program_path, sizeof(program_path));
+
+    ret = CreateProcess(
+            NULL,                                  /* program path */
+            "tools\\android.bat update sdk",         /* command-line */
+            NULL,                  /* process handle is not inheritable */
+            NULL,                   /* thread handle is not inheritable */
+            TRUE,                          /* yes, inherit some handles */
+            CREATE_NO_WINDOW,                /* we don't want a console */
+            NULL,                     /* use parent's environment block */
+            NULL,                    /* use parent's starting directory */
+            &startup,                 /* startup info, i.e. std handles */
+            &pinfo);
+
+    if (!ret) {
+        DWORD err = GetLastError();
+        fprintf(stderr, "CreateProcess failure, error %ld\n", err);
+
+        LPSTR s;
+        if (FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | /* dwFlags */
+                          FORMAT_MESSAGE_FROM_SYSTEM,
+                          NULL,                             /* lpSource */
+                          err,                              /* dwMessageId */
+                          0,                                /* dwLanguageId */
+                          (LPSTR)&s,                        /* lpBuffer */
+                          0,                                /* nSize */
+                          NULL) != 0) {                     /* va_list args */
+            fprintf(stderr, "%s", s);
+            LocalFree(s);
+        }
+
+        return -1;
+    }
+
+    return 0;
+}
+
+int main(int argc, char **argv) {
+    return sdk_launcher();
+}
+
+#endif /* _WIN32 */
diff --git a/tools/sdkmanager/app/.classpath b/tools/sdkmanager/app/.classpath
index 4f2e142..3380ba1 100644
--- a/tools/sdkmanager/app/.classpath
+++ b/tools/sdkmanager/app/.classpath
@@ -7,5 +7,6 @@
 	<classpathentry combineaccessrules="false" kind="src" path="/AndroidPrefs"/>

 	<classpathentry combineaccessrules="false" kind="src" path="/SdkUiLib"/>

 	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/ANDROID_SWT"/>

 	<classpathentry kind="output" path="bin"/>

 </classpath>

diff --git a/tools/sdkmanager/app/etc/android b/tools/sdkmanager/app/etc/android
index ee21b0e..8feb5f2 100755
--- a/tools/sdkmanager/app/etc/android
+++ b/tools/sdkmanager/app/etc/android
@@ -62,14 +62,17 @@
     java_debug=
 fi
 
+java_cmd="java"
+
 # Mac OS X needs an additional arg, or you get an "illegal thread" complaint.
 if [ `uname` = "Darwin" ]; then
     os_opts="-XstartOnFirstThread"
-    #because Java 1.6 is 64 bits only and SWT doesn't support this, we force the usage of java 1.5
-    java_cmd="/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/java"
 else
     os_opts=
-    java_cmd="java"
+fi
+
+if [ `uname` = "Linux" ]; then
+    export GDK_NATIVE_WINDOWS=true
 fi
 
 if [ "$OSTYPE" = "cygwin" ] ; then
@@ -87,7 +90,7 @@
 if [ -n "$ANDROID_SWT" ]; then
     swtpath="$ANDROID_SWT"
 else
-    vmarch=`java -jar "${frameworkdir}"/archquery.jar`
+    vmarch=`${java_cmd} -jar "${frameworkdir}"/archquery.jar`
     if [ -n "$ANDROID_BUILD_TOP" ]; then
         osname=`uname -s | tr A-Z a-z`
         swtpath="${ANDROID_BUILD_TOP}/prebuilt/${osname}-${vmarch}/swt"
@@ -105,6 +108,10 @@
     exit 1
 fi
 
+if [ -z "$1" ]; then
+    echo "Starting Android SDK and AVD Manager"
+fi
+
 # need to use "java.ext.dirs" because "-jar" causes classpath to be ignored
 # might need more memory, e.g. -Xmx128M
 exec "$java_cmd" -Xmx256M $os_opts $java_debug -Djava.ext.dirs="$frameworkdir" -Dcom.android.sdkmanager.toolsdir="$progdir" -jar "$jarpath" "$@"
diff --git a/tools/sdkmanager/app/etc/android.bat b/tools/sdkmanager/app/etc/android.bat
index 032985d..58790ce 100755
--- a/tools/sdkmanager/app/etc/android.bat
+++ b/tools/sdkmanager/app/etc/android.bat
@@ -32,8 +32,10 @@
 rem Set SWT.Jar path based on current architecture (x86 or x86_64)
 for /f %%a in ('java -jar lib\archquery.jar') do set swt_path=lib\%%a
 
+if "%1 %2"=="update sdk" goto StartUi
 if not "%1"=="" goto EndTempCopy
-    echo Starting Android SDK Updater
+:StartUi
+    echo Starting Android SDK and AVD Manager
 
     rem We're now going to create a temp dir to hold all the Jar files needed
     rem to run the android tool, copy them in the temp dir and finally execute
@@ -42,7 +44,7 @@
     rem update the tools directory where the updater itself is located.
 
     set tmpdir=%TEMP%\temp-android-tool
-    xcopy lib\x86 %tmpdir%\lib\x86 /I /E /C /G /R /O /Y /Q > nul
+    xcopy lib\x86 %tmpdir%\lib\x86 /I /E /C /G /R /Y /Q > nul
     copy /B /D /Y lib\androidprefs.jar   %tmpdir%\lib\       > nul
     copy /B /D /Y lib\org.eclipse.*      %tmpdir%\lib\       > nul
     copy /B /D /Y lib\sdk*               %tmpdir%\lib\       > nul
diff --git a/tools/sdkmanager/app/src/com/android/sdkmanager/CommandLineProcessor.java b/tools/sdkmanager/app/src/com/android/sdkmanager/CommandLineProcessor.java
index 50fe5c6..ab105ec 100644
--- a/tools/sdkmanager/app/src/com/android/sdkmanager/CommandLineProcessor.java
+++ b/tools/sdkmanager/app/src/com/android/sdkmanager/CommandLineProcessor.java
@@ -34,7 +34,17 @@
  * To use, call {@link #parseArgs(String[])} and then
  * call {@link #getValue(String, String, String)}.
  */
-public class CommandLineProcessor {
+class CommandLineProcessor {
+
+    /*
+     * Steps needed to add a new action:
+     * - Each action is defined as a "verb object" followed by parameters.
+     * - Either reuse a VERB_ constant or define a new one.
+     * - Either reuse an OBJECT_ constant or define a new one.
+     * - Add a new entry to mAction with a one-line help summary.
+     * - In the constructor, add a define() call for each parameter (either mandatory
+     *   or optional) for the given action.
+     */
 
     /** Internal verb name for internally hidden flags. */
     public final static String GLOBAL_FLAG_VERB = "@@internal@@";
@@ -57,10 +67,14 @@
     /**
      * Action definitions.
      * <p/>
+     * This list serves two purposes: first it is used to know which verb/object
+     * actions are acceptable on the command-line; second it provides a summary
+     * for each action that is printed in the help.
+     * <p/>
      * Each entry is a string array with:
      * <ul>
      * <li> the verb.
-     * <li> a direct object (use #NO_VERB_OBJECT if there's no object).
+     * <li> a direct object (use {@link #NO_VERB_OBJECT} if there's no object).
      * <li> a description.
      * <li> an alternate form for the object (e.g. plural).
      * </ul>
@@ -81,6 +95,15 @@
     /** Logger */
     private final ISdkLog mLog;
 
+    /**
+     * Constructs a new command-line processor.
+     *
+     * @param logger An SDK logger object. Must not be null.
+     * @param actions The list of actions recognized on the command-line.
+     *                See the javadoc of {@link #mActions} for more details.
+     *
+     * @see #mActions
+     */
     public CommandLineProcessor(ISdkLog logger, String[][] actions) {
         mLog = logger;
         mActions = actions;
@@ -460,7 +483,7 @@
             stdout("\nValid actions are composed of a verb and an optional direct object:");
             for (String[] action : mActions) {
 
-                stdout("- %1$6s %2$-7s: %3$s",
+                stdout("- %1$6s %2$-12s: %3$s",
                         action[ACTION_VERB_INDEX],
                         action[ACTION_OBJECT_INDEX],
                         action[ACTION_DESC_INDEX]);
diff --git a/tools/sdkmanager/app/src/com/android/sdkmanager/Main.java b/tools/sdkmanager/app/src/com/android/sdkmanager/Main.java
index 11fc508..55d4357 100644
--- a/tools/sdkmanager/app/src/com/android/sdkmanager/Main.java
+++ b/tools/sdkmanager/app/src/com/android/sdkmanager/Main.java
@@ -28,28 +28,41 @@
 import com.android.sdklib.internal.avd.AvdManager.AvdInfo;
 import com.android.sdklib.internal.avd.HardwareProperties.HardwareProperty;
 import com.android.sdklib.internal.project.ProjectCreator;
+import com.android.sdklib.internal.project.ProjectProperties;
 import com.android.sdklib.internal.project.ProjectCreator.OutputLevel;
+import com.android.sdklib.internal.project.ProjectProperties.PropertyType;
+import com.android.sdklib.xml.AndroidXPathFactory;
 import com.android.sdkmanager.internal.repository.AboutPage;
 import com.android.sdkmanager.internal.repository.SettingsPage;
+import com.android.sdkuilib.internal.repository.LocalPackagesPage;
 import com.android.sdkuilib.repository.UpdaterWindow;
 
+import org.xml.sax.InputSource;
+
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpressionException;
+
 /**
  * Main class for the 'android' application.
  */
-class Main {
+public class Main {
 
     /** Java property that defines the location of the sdk/tools directory. */
-    private final static String TOOLSDIR = "com.android.sdkmanager.toolsdir";
+    public final static String TOOLSDIR = "com.android.sdkmanager.toolsdir";
     /** Java property that defines the working directory. On Windows the current working directory
      *  is actually the tools dir, in which case this is used to get the original CWD. */
     private final static String WORKDIR = "com.android.sdkmanager.workdir";
 
+    /** Value returned by {@link #resolveTargetName(String)} when the target id does not match. */
+    private final static int INVALID_TARGET_ID = 0;
+
     private final static String[] BOOLEAN_YES_REPLIES = new String[] { "yes", "y" };
     private final static String[] BOOLEAN_NO_REPLIES = new String[] { "no", "n" };
 
@@ -218,12 +231,24 @@
                 SdkCommandLine.OBJECT_PROJECT.equals(directObject)) {
             createProject();
 
+        } else if (SdkCommandLine.VERB_CREATE.equals(verb) &&
+                SdkCommandLine.OBJECT_TEST_PROJECT.equals(directObject)) {
+            createTestProject();
+
         } else if (SdkCommandLine.VERB_UPDATE.equals(verb) &&
                 SdkCommandLine.OBJECT_PROJECT.equals(directObject)) {
             updateProject();
 
+        } else if (SdkCommandLine.VERB_UPDATE.equals(verb) &&
+                SdkCommandLine.OBJECT_TEST_PROJECT.equals(directObject)) {
+            updateTestProject();
+
         } else if (verb == null && directObject == null) {
-            showMainWindow();
+            showMainWindow(false /*autoUpdate*/);
+
+        } else if (SdkCommandLine.VERB_UPDATE.equals(verb) &&
+                SdkCommandLine.OBJECT_SDK.equals(directObject)) {
+            showMainWindow(true /*autoUpdate*/);
 
         } else if (SdkCommandLine.VERB_UPDATE.equals(verb) &&
                 SdkCommandLine.OBJECT_ADB.equals(directObject)) {
@@ -237,7 +262,7 @@
     /**
      * Display the main SdkManager app window
      */
-    private void showMainWindow() {
+    private void showMainWindow(boolean autoUpdate) {
         try {
             // display a message talking about the command line version
             System.out.printf("No command line parameters provided, launching UI.\n" +
@@ -249,6 +274,10 @@
                     false /*userCanChangeSdkRoot*/);
             window.registerPage("Settings", SettingsPage.class);
             window.registerPage("About", AboutPage.class);
+            if (autoUpdate) {
+                window.setInitialPage(LocalPackagesPage.class);
+                window.setRequestAutoUpdate(true);
+            }
             window.open();
         } catch (Exception e) {
             e.printStackTrace();
@@ -260,13 +289,13 @@
      */
     private void createProject() {
         // get the target and try to resolve it.
-        int targetId = mSdkCommandLine.getParamTargetId();
+        int targetId = resolveTargetName(mSdkCommandLine.getParamTargetId());
         IAndroidTarget[] targets = mSdkManager.getTargets();
-        if (targetId < 1 || targetId > targets.length) {
+        if (targetId == INVALID_TARGET_ID || targetId > targets.length) {
             errorAndExit("Target id is not valid. Use '%s list targets' to get the target ids.",
                     SdkConstants.androidCmdName());
         }
-        IAndroidTarget target = targets[targetId - 1];
+        IAndroidTarget target = targets[targetId - 1];  // target id is 1-based
 
         ProjectCreator creator = new ProjectCreator(mOsSdkFolder,
                 mSdkCommandLine.isVerbose() ? OutputLevel.VERBOSE :
@@ -311,23 +340,140 @@
                 packageName,
                 activityName,
                 target,
-                false /* isTestProject*/);
+                null /*pathToMain*/);
     }
 
     /**
+     * Creates a new Android test project based on command-line parameters
+     */
+    private void createTestProject() {
+
+        String projectDir = getProjectLocation(mSdkCommandLine.getParamLocationPath());
+
+        // first check the path of the parent project, and make sure it's valid.
+        String pathToMainProject = mSdkCommandLine.getParamTestProjectMain();
+
+        File parentProject = new File(pathToMainProject);
+        if (parentProject.isAbsolute() == false) {
+            // if the path is not absolute, we need to resolve it based on the
+            // destination path of the project
+            try {
+                parentProject = new File(projectDir, pathToMainProject).getCanonicalFile();
+            } catch (IOException e) {
+                errorAndExit("Unable to resolve Main project's directory: %1$s",
+                        pathToMainProject);
+                return; // help Eclipse static analyzer understand we'll never execute the rest.
+            }
+        }
+
+        if (parentProject.isDirectory() == false) {
+            errorAndExit("Main project's directory does not exist: %1$s",
+                    pathToMainProject);
+            return;
+        }
+
+        // now look for a manifest in there
+        File manifest = new File(parentProject, SdkConstants.FN_ANDROID_MANIFEST_XML);
+        if (manifest.isFile() == false) {
+            errorAndExit("No AndroidManifest.xml file found in the main project directory: %1$s",
+                    parentProject.getAbsolutePath());
+            return;
+        }
+
+        // now query the manifest for the package file.
+        XPath xpath = AndroidXPathFactory.newXPath();
+        String packageName, activityName;
+
+        try {
+            packageName = xpath.evaluate("/manifest/@package",
+                    new InputSource(new FileInputStream(manifest)));
+
+            mSdkLog.printf("Found main project package: %1$s\n", packageName);
+
+            // now get the name of the first activity we find
+            activityName = xpath.evaluate("/manifest/application/activity[1]/@android:name",
+                    new InputSource(new FileInputStream(manifest)));
+            // xpath will return empty string when there's no match
+            if (activityName == null || activityName.length() == 0) {
+                activityName = null;
+            } else {
+                mSdkLog.printf("Found main project activity: %1$s\n", activityName);
+            }
+        } catch (FileNotFoundException e) {
+            // this shouldn't happen as we test it above.
+            errorAndExit("No AndroidManifest.xml file found in main project.");
+            return; // this is not strictly needed because errorAndExit will stop the execution,
+            // but this makes the java compiler happy, wrt to uninitialized variables.
+        } catch (XPathExpressionException e) {
+            // looks like the main manifest is not valid.
+            errorAndExit("Unable to parse main project manifest to get information.");
+            return; // this is not strictly needed because errorAndExit will stop the execution,
+                    // but this makes the java compiler happy, wrt to uninitialized variables.
+        }
+
+        // now get the target hash
+        ProjectProperties p = ProjectProperties.load(parentProject.getAbsolutePath(),
+                PropertyType.DEFAULT);
+        String targetHash = p.getProperty(ProjectProperties.PROPERTY_TARGET);
+        if (targetHash == null) {
+            errorAndExit("Couldn't find the main project target");
+            return;
+        }
+
+        // and resolve it.
+        IAndroidTarget target = mSdkManager.getTargetFromHashString(targetHash);
+        if (target == null) {
+            errorAndExit(
+                    "Unable to resolve main project target '%1$s'. You may want to install the platform in your SDK.",
+                    targetHash);
+            return;
+        }
+
+        mSdkLog.printf("Found main project target: %1$s\n", target.getFullName());
+
+        ProjectCreator creator = new ProjectCreator(mOsSdkFolder,
+                mSdkCommandLine.isVerbose() ? OutputLevel.VERBOSE :
+                    mSdkCommandLine.isSilent() ? OutputLevel.SILENT :
+                        OutputLevel.NORMAL,
+                mSdkLog);
+
+        String projectName = mSdkCommandLine.getParamName();
+
+        if (projectName != null &&
+                !ProjectCreator.RE_PROJECT_NAME.matcher(projectName).matches()) {
+            errorAndExit(
+                "Project name '%1$s' contains invalid characters.\nAllowed characters are: %2$s",
+                projectName, ProjectCreator.CHARS_PROJECT_NAME);
+            return;
+        }
+
+        creator.createProject(projectDir,
+                projectName,
+                packageName,
+                activityName,
+                target,
+                pathToMainProject);
+    }
+
+
+    /**
      * Updates an existing Android project based on command-line parameters
      */
     private void updateProject() {
         // get the target and try to resolve it.
         IAndroidTarget target = null;
-        int targetId = mSdkCommandLine.getParamTargetId();
-        if (targetId >= 0) {
+        String targetStr = mSdkCommandLine.getParamTargetId();
+        // For "update project" the target parameter is optional so having null is acceptable.
+        // However if there's a value, it must be valid.
+        if (targetStr != null) {
             IAndroidTarget[] targets = mSdkManager.getTargets();
-            if (targetId < 1 || targetId > targets.length) {
-                errorAndExit("Target id is not valid. Use '%s list targets' to get the target ids.",
+            int targetId = resolveTargetName(targetStr);
+            if (targetId == INVALID_TARGET_ID || targetId > targets.length) {
+                errorAndExit("Target id '%1$s' is not valid. Use '%2$s list targets' to get the target ids.",
+                        targetStr,
                         SdkConstants.androidCmdName());
             }
-            target = targets[targetId - 1];
+            target = targets[targetId - 1];  // target id is 1-based
         }
 
         ProjectCreator creator = new ProjectCreator(mOsSdkFolder,
@@ -371,6 +517,21 @@
     }
 
     /**
+     * Updates an existing test project with a new path to the main project.
+     */
+    private void updateTestProject() {
+        ProjectCreator creator = new ProjectCreator(mOsSdkFolder,
+                mSdkCommandLine.isVerbose() ? OutputLevel.VERBOSE :
+                    mSdkCommandLine.isSilent() ? OutputLevel.SILENT :
+                        OutputLevel.NORMAL,
+                mSdkLog);
+
+        String projectDir = getProjectLocation(mSdkCommandLine.getParamLocationPath());
+
+        creator.updateTestProject(projectDir, mSdkCommandLine.getParamTestProjectMain());
+    }
+
+    /**
      * Adjusts the project location to make it absolute & canonical relative to the
      * working directory, if any.
      *
@@ -412,7 +573,7 @@
 
         int index = 1;
         for (IAndroidTarget target : mSdkManager.getTargets()) {
-            mSdkLog.printf("id: %d\n", index);
+            mSdkLog.printf("id: %1$d or \"%2$s\"\n", index, target.hashString());
             mSdkLog.printf("     Name: %s\n", target.getName());
             if (target.isPlatform()) {
                 mSdkLog.printf("     Type: Platform\n");
@@ -557,16 +718,16 @@
      */
     private void createAvd() {
         // find a matching target
-        int targetId = mSdkCommandLine.getParamTargetId();
-        IAndroidTarget target = null;
+        int targetId = resolveTargetName(mSdkCommandLine.getParamTargetId());
+        IAndroidTarget[] targets = mSdkManager.getTargets();
 
-        if (targetId >= 1 && targetId <= mSdkManager.getTargets().length) {
-            target = mSdkManager.getTargets()[targetId-1]; // target it is 1-based
-        } else {
+        if (targetId == INVALID_TARGET_ID || targetId > targets.length) {
             errorAndExit("Target id is not valid. Use '%s list targets' to get the target ids.",
                     SdkConstants.androidCmdName());
         }
 
+        IAndroidTarget target = targets[targetId-1]; // target id is 1-based
+
         try {
             boolean removePrevious = mSdkCommandLine.getFlagForce();
             AvdManager avdManager = new AvdManager(mSdkManager, mSdkLog);
@@ -587,7 +748,9 @@
                             "Android Virtual Device '%s' already exists and will be replaced.",
                             avdName);
                 } else {
-                    errorAndExit("Android Virtual Device '%s' already exists.", avdName);
+                    errorAndExit("Android Virtual Device '%s' already exists.\n" +
+                                 "Use --force if you want to replace it.",
+                                 avdName);
                     return;
                 }
             }
@@ -607,7 +770,8 @@
             if (skin != null && skin.length() == 0) {
                 skin = null;
             }
-            if (skin != null) {
+
+            if (skin != null && target != null) {
                 boolean valid = false;
                 // Is it a know skin name for this target?
                 for (String s : target.getSkins()) {
@@ -639,7 +803,7 @@
             }
 
             Map<String, String> hardwareConfig = null;
-            if (target.isPlatform()) {
+            if (target != null && target.isPlatform()) {
                 try {
                     hardwareConfig = promptForHardware(target, skinHardwareConfig);
                 } catch (IOException e) {
@@ -647,11 +811,13 @@
                 }
             }
 
+            @SuppressWarnings("unused") // oldAvdInfo is never read, yet useful for debugging
             AvdInfo oldAvdInfo = null;
             if (removePrevious) {
                 oldAvdInfo = avdManager.getAvd(avdName, false /*validAvdOnly*/);
             }
 
+            @SuppressWarnings("unused") // newAvdInfo is never read, yet useful for debugging
             AvdInfo newAvdInfo = avdManager.createAvd(avdFolder,
                     avdName,
                     target,
@@ -845,13 +1011,16 @@
         // get the list of possible hardware properties
         File hardwareDefs = new File (mOsSdkFolder + File.separator +
                 SdkConstants.OS_SDK_TOOLS_LIB_FOLDER, SdkConstants.FN_HARDWARE_INI);
-        List<HardwareProperty> list = HardwareProperties.parseHardwareDefinitions(hardwareDefs,
-                null /*sdkLog*/);
+        Map<String, HardwareProperty> hwMap = HardwareProperties.parseHardwareDefinitions(
+                hardwareDefs, null /*sdkLog*/);
 
         HashMap<String, String> map = new HashMap<String, String>();
 
-        for (int i = 0 ; i < list.size() ;) {
-            HardwareProperty property = list.get(i);
+        // we just want to loop on the HardwareProperties
+        HardwareProperty[] hwProperties = hwMap.values().toArray(
+                new HardwareProperty[hwMap.size()]);
+        for (int i = 0 ; i < hwProperties.length ;) {
+            HardwareProperty property = hwProperties[i];
 
             String description = property.getDescription();
             if (description != null) {
@@ -978,4 +1147,43 @@
         mSdkLog.error(null, format, args);
         System.exit(1);
     }
+
+    /**
+     * Converts a symbolic target name (such as those accepted by --target on the command-line)
+     * to an internal target index id. A valid target name is either a numeric target id (> 0)
+     * or a target hash string.
+     * <p/>
+     * If the given target can't be mapped, {@link #INVALID_TARGET_ID} (0) is returned.
+     * It's up to the caller to output an error.
+     * <p/>
+     * On success, returns a value > 0.
+     */
+    private int resolveTargetName(String targetName) {
+
+        if (targetName == null) {
+            return INVALID_TARGET_ID;
+        }
+
+        targetName = targetName.trim();
+
+        // Case of an integer number
+        if (targetName.matches("[0-9]*")) {
+            try {
+                int n = Integer.parseInt(targetName);
+                return n < 1 ? INVALID_TARGET_ID : n;
+            } catch (NumberFormatException e) {
+                // Ignore. Should not happen.
+            }
+        }
+
+        // Let's try to find a platform or addon name.
+        IAndroidTarget[] targets = mSdkManager.getTargets();
+        for (int i = 0; i < targets.length; i++) {
+            if (targetName.equals(targets[i].hashString())) {
+                return i + 1;
+            }
+        }
+
+        return INVALID_TARGET_ID;
+    }
 }
diff --git a/tools/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java b/tools/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java
index c48a386..80ee5dd 100644
--- a/tools/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java
+++ b/tools/sdkmanager/app/src/com/android/sdkmanager/SdkCommandLine.java
@@ -23,7 +23,17 @@
 /**
  * Specific command-line flags for the {@link SdkManager}.
  */
-public class SdkCommandLine extends CommandLineProcessor {
+class SdkCommandLine extends CommandLineProcessor {
+
+    /*
+     * Steps needed to add a new action:
+     * - Each action is defined as a "verb object" followed by parameters.
+     * - Either reuse a VERB_ constant or define a new one.
+     * - Either reuse an OBJECT_ constant or define a new one.
+     * - Add a new entry to mAction with a one-line help summary.
+     * - In the constructor, add a define() call for each parameter (either mandatory
+     *   or optional) for the given action.
+     */
 
     public final static String VERB_LIST   = "list";
     public final static String VERB_CREATE = "create";
@@ -31,32 +41,39 @@
     public final static String VERB_DELETE = "delete";
     public final static String VERB_UPDATE = "update";
 
-    public static final String OBJECT_AVD      = "avd";
-    public static final String OBJECT_AVDS     = "avds";
-    public static final String OBJECT_TARGET   = "target";
-    public static final String OBJECT_TARGETS  = "targets";
-    public static final String OBJECT_PROJECT  = "project";
-    public static final String OBJECT_ADB      = "adb";
+    public static final String OBJECT_SDK          = "sdk";
+    public static final String OBJECT_AVD          = "avd";
+    public static final String OBJECT_AVDS         = "avds";
+    public static final String OBJECT_TARGET       = "target";
+    public static final String OBJECT_TARGETS      = "targets";
+    public static final String OBJECT_PROJECT      = "project";
+    public static final String OBJECT_TEST_PROJECT = "test-project";
+    public static final String OBJECT_ADB          = "adb";
 
-    public static final String ARG_ALIAS       = "alias";
-    public static final String ARG_ACTIVITY    = "activity";
+    public static final String ARG_ALIAS        = "alias";
+    public static final String ARG_ACTIVITY     = "activity";
 
-    public static final String KEY_ACTIVITY    = ARG_ACTIVITY;
-    public static final String KEY_PACKAGE     = "package";
-    public static final String KEY_MODE        = "mode";
-    public static final String KEY_TARGET_ID   = OBJECT_TARGET;
-    public static final String KEY_NAME        = "name";
-    public static final String KEY_PATH        = "path";
-    public static final String KEY_FILTER      = "filter";
-    public static final String KEY_SKIN        = "skin";
-    public static final String KEY_SDCARD      = "sdcard";
-    public static final String KEY_FORCE       = "force";
-    public static final String KEY_RENAME      = "rename";
-    public static final String KEY_SUBPROJECTS = "subprojects";
+    public static final String KEY_ACTIVITY     = ARG_ACTIVITY;
+    public static final String KEY_PACKAGE      = "package";
+    public static final String KEY_MODE         = "mode";
+    public static final String KEY_TARGET_ID    = OBJECT_TARGET;
+    public static final String KEY_NAME         = "name";
+    public static final String KEY_PATH         = "path";
+    public static final String KEY_FILTER       = "filter";
+    public static final String KEY_SKIN         = "skin";
+    public static final String KEY_SDCARD       = "sdcard";
+    public static final String KEY_FORCE        = "force";
+    public static final String KEY_RENAME       = "rename";
+    public static final String KEY_SUBPROJECTS  = "subprojects";
+    public static final String KEY_MAIN_PROJECT = "main";
 
     /**
      * Action definitions for SdkManager command line.
      * <p/>
+     * This list serves two purposes: first it is used to know which verb/object
+     * actions are acceptable on the command-line; second it provides a summary
+     * for each action that is printed in the help.
+     * <p/>
      * Each entry is a string array with:
      * <ul>
      * <li> the verb.
@@ -89,13 +106,23 @@
             { VERB_UPDATE, OBJECT_PROJECT,
                 "Updates an Android Project (must have an AndroidManifest.xml)." },
 
+            { VERB_CREATE, OBJECT_TEST_PROJECT,
+                "Creates a new Android Test Project." },
+            { VERB_UPDATE, OBJECT_TEST_PROJECT,
+                "Updates an Android Test Project (must have an AndroidManifest.xml)." },
+
             { VERB_UPDATE, OBJECT_ADB,
                 "Updates adb to support the USB devices declared in the SDK add-ons." },
+
+            { VERB_UPDATE, OBJECT_SDK,
+                "Updates the SDK by suggesting new platforms to install if available." }
         };
 
     public SdkCommandLine(ISdkLog logger) {
         super(logger, ACTIONS);
 
+        // The following defines the parameters of the actions defined in mAction.
+
         // --- create avd ---
 
         define(Mode.STRING, false,
@@ -104,7 +131,7 @@
         define(Mode.STRING, true,
                 VERB_CREATE, OBJECT_AVD, "n", KEY_NAME,
                 "Name of the new AVD", null);
-        define(Mode.INTEGER, true,
+        define(Mode.STRING, true,
                 VERB_CREATE, OBJECT_AVD, "t", KEY_TARGET_ID,
                 "Target id of the new AVD", null);
         define(Mode.STRING, false,
@@ -154,7 +181,7 @@
                 VERB_CREATE, OBJECT_PROJECT,
                 "p", KEY_PATH,
                 "Location path of new project", null);
-        define(Mode.INTEGER, true,
+        define(Mode.STRING, true,
                 VERB_CREATE, OBJECT_PROJECT, "t", KEY_TARGET_ID,
                 "Target id of the new project", null);
         define(Mode.STRING, true,
@@ -167,16 +194,29 @@
                 VERB_CREATE, OBJECT_PROJECT, "n", KEY_NAME,
                 "Project name", null);
 
+        // --- create test-project ---
+
+        define(Mode.STRING, true,
+                VERB_CREATE, OBJECT_TEST_PROJECT,
+                "p", KEY_PATH,
+                "Location path of new project", null);
+        define(Mode.STRING, false,
+                VERB_CREATE, OBJECT_TEST_PROJECT, "n", KEY_NAME,
+                "Project name", null);
+        define(Mode.STRING, true,
+                VERB_CREATE, OBJECT_TEST_PROJECT, "m", KEY_MAIN_PROJECT,
+                "Location path of the project to test, relative to the new project", null);
+
         // --- update project ---
 
         define(Mode.STRING, true,
                 VERB_UPDATE, OBJECT_PROJECT,
                 "p", KEY_PATH,
                 "Location path of the project", null);
-        define(Mode.INTEGER, true,
+        define(Mode.STRING, false,
                 VERB_UPDATE, OBJECT_PROJECT,
                 "t", KEY_TARGET_ID,
-                "Target id to set for the project", -1);
+                "Target id to set for the project", null);
         define(Mode.STRING, false,
                 VERB_UPDATE, OBJECT_PROJECT,
                 "n", KEY_NAME,
@@ -185,6 +225,17 @@
                 VERB_UPDATE, OBJECT_PROJECT,
                 "s", KEY_SUBPROJECTS,
                 "Also update any projects in sub-folders, such as test projects.", false);
+
+        // --- update test project ---
+
+        define(Mode.STRING, true,
+                VERB_UPDATE, OBJECT_TEST_PROJECT,
+                "p", KEY_PATH,
+                "Location path of the project", null);
+        define(Mode.STRING, true,
+                VERB_UPDATE, OBJECT_TEST_PROJECT,
+                "m", KEY_MAIN_PROJECT,
+                "Location path of the project to test, relative to the new project", null);
     }
 
     @Override
@@ -196,27 +247,34 @@
 
     /** Helper to retrieve the --path value. */
     public String getParamLocationPath() {
-        return ((String) getValue(null, null, KEY_PATH));
+        return (String) getValue(null, null, KEY_PATH);
     }
 
-    /** Helper to retrieve the --target id value. */
-    public int getParamTargetId() {
-        return ((Integer) getValue(null, null, KEY_TARGET_ID)).intValue();
+    /**
+     * Helper to retrieve the --target id value.
+     * The id is a string. It can be one of:
+     * - an integer, in which case it's the index of the target (cf "android list targets")
+     * - a symbolic name such as android-N for platforn API N
+     * - a symbolic add-on name such as written in the avd/*.ini files,
+     *   e.g. "Google Inc.:Google APIs:3"
+     */
+    public String getParamTargetId() {
+        return (String) getValue(null, null, KEY_TARGET_ID);
     }
 
     /** Helper to retrieve the --name value. */
     public String getParamName() {
-        return ((String) getValue(null, null, KEY_NAME));
+        return (String) getValue(null, null, KEY_NAME);
     }
 
     /** Helper to retrieve the --skin value. */
     public String getParamSkin() {
-        return ((String) getValue(null, null, KEY_SKIN));
+        return (String) getValue(null, null, KEY_SKIN);
     }
 
     /** Helper to retrieve the --sdcard value. */
     public String getParamSdCard() {
-        return ((String) getValue(null, null, KEY_SDCARD));
+        return (String) getValue(null, null, KEY_SDCARD);
     }
 
     /** Helper to retrieve the --force flag. */
@@ -228,7 +286,7 @@
 
     /** Helper to retrieve the --rename value for a move verb. */
     public String getParamMoveNewName() {
-        return ((String) getValue(VERB_MOVE, null, KEY_RENAME));
+        return (String) getValue(VERB_MOVE, null, KEY_RENAME);
     }
 
 
@@ -248,4 +306,11 @@
     public boolean getParamSubProject() {
         return ((Boolean) getValue(null, OBJECT_PROJECT, KEY_SUBPROJECTS)).booleanValue();
     }
+
+    // -- some helpers for test-project action flags
+
+    /** Helper to retrieve the --main value. */
+    public String getParamTestProjectMain() {
+        return ((String) getValue(null, null, KEY_MAIN_PROJECT));
+    }
 }
diff --git a/tools/sdkmanager/app/src/com/android/sdkmanager/internal/repository/AboutPage.java b/tools/sdkmanager/app/src/com/android/sdkmanager/internal/repository/AboutPage.java
index 49aad29..742a065 100755
--- a/tools/sdkmanager/app/src/com/android/sdkmanager/internal/repository/AboutPage.java
+++ b/tools/sdkmanager/app/src/com/android/sdkmanager/internal/repository/AboutPage.java
@@ -17,16 +17,20 @@
 package com.android.sdkmanager.internal.repository;

 

 

+import com.android.sdkmanager.*;

 import org.eclipse.swt.SWT;

+import org.eclipse.swt.graphics.Image;

 import org.eclipse.swt.layout.GridData;

 import org.eclipse.swt.layout.GridLayout;

 import org.eclipse.swt.widgets.Composite;

 import org.eclipse.swt.widgets.Label;

 

-/*

- * TODO list

- * - Change version to be a constant pulled from somewhere.

- */

+import java.io.File;

+import java.io.FileInputStream;

+import java.io.FileNotFoundException;

+import java.io.IOException;

+import java.io.InputStream;

+import java.util.Properties;

 

 public class AboutPage extends Composite {

 

@@ -45,11 +49,21 @@
     }

 

     private void createContents(Composite parent) {

-        parent.setLayout(new GridLayout(1, false));

+        parent.setLayout(new GridLayout(2, false));

+

+        Label logo = new Label(parent, SWT.NONE);

+        InputStream imageStream = this.getClass().getResourceAsStream("logo.png");

+

+        if (imageStream != null) {

+            Image img = new Image(parent.getShell().getDisplay(), imageStream);

+            logo.setImage(img);

+        }

 

         mLabel = new Label(parent, SWT.NONE);

-        mLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true, 1, 1));

-        mLabel.setText("Android SDK Updater.\n\nVersion 0.1.\n\nCopyright (C) 2009 The Android Open Source Project.");

+        mLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));

+        mLabel.setText(String.format(

+                "Android SDK Updater.\nRevision %1$s\nCopyright (C) 2009 The Android Open Source Project.",

+                getRevision()));

     }

 

     @Override

@@ -69,4 +83,28 @@
 

     // End of hiding from SWT Designer

     //$hide<<$

+

+    private String getRevision() {

+        Properties p = new Properties();

+        try{

+            String toolsdir = System.getProperty(Main.TOOLSDIR);

+            File sourceProp;

+            if (toolsdir == null || toolsdir.length() == 0) {

+                sourceProp = new File("source.properties"); //$NON-NLS-1$

+            } else {

+                sourceProp = new File(toolsdir, "source.properties"); //$NON-NLS-1$

+            }

+            p.load(new FileInputStream(sourceProp));

+            String revision = p.getProperty("Pkg.Revision"); //$NON-NLS-1$

+            if (revision != null) {

+                return revision;

+            }

+        } catch (FileNotFoundException e) {

+            // couldn't find the file? don't ping.

+        } catch (IOException e) {

+            // couldn't find the file? don't ping.

+        }

+

+        return "?";

+    }

 }

diff --git a/tools/sdkmanager/app/src/com/android/sdkmanager/internal/repository/logo.png b/tools/sdkmanager/app/src/com/android/sdkmanager/internal/repository/logo.png
new file mode 100644
index 0000000..0f1670d
--- /dev/null
+++ b/tools/sdkmanager/app/src/com/android/sdkmanager/internal/repository/logo.png
Binary files differ
diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/AndroidVersion.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/AndroidVersion.java
index ef62f6e..13c3ea1 100644
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/AndroidVersion.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/AndroidVersion.java
@@ -40,13 +40,14 @@
 public class AndroidVersion {
 
     private static final String PROP_API_LEVEL = "AndroidVersion.ApiLevel";  //$NON-NLS-1$
-    private static final String PROP_CODENAME = "AndroidVersion.CodeName";  //$NON-NLS-1$
+    private static final String PROP_CODENAME = "AndroidVersion.CodeName";   //$NON-NLS-1$
 
     private final int mApiLevel;
     private final String mCodename;
 
     /**
      * Creates an {@link AndroidVersion} with the given api level and codename.
+     * Codename should be null for a release version, otherwise it's a preview codename.
      */
     public AndroidVersion(int apiLevel, String codename) {
         mApiLevel = apiLevel;
diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java
index 4ef3468..b276ae3 100644
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java
@@ -78,6 +78,8 @@
     public final static String FN_PLUGIN_PROP = "plugin.prop";
     /** add-on manifest file */
     public final static String FN_MANIFEST_INI = "manifest.ini";
+    /** add-on layout device XML file. */
+    public final static String FN_DEVICES_XML = "devices.xml";
     /** hardware properties definition file */
     public final static String FN_HARDWARE_INI = "hardware-properties.ini";
 
diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java
index b23d1bd..9009274 100644
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java
@@ -89,6 +89,16 @@
     private IAndroidTarget[] mTargets;
 
     /**
+     * Create a new {@link SdkManager} instance.
+     * External users should use {@link #createManager(String, ISdkLog)}.
+     *
+     * @param sdkLocation the location of the SDK.
+     */
+    private SdkManager(String sdkLocation) {
+        mSdkLocation = sdkLocation;
+    }
+
+    /**
      * Creates an {@link SdkManager} for a given sdk location.
      * @param sdkLocation the location of the SDK.
      * @param log the ISdkLog object receiving warning/error from the parsing.
@@ -125,12 +135,24 @@
 
     /**
      * Returns the targets that are available in the SDK.
+     * <p/>
+     * The array can be empty but not null.
      */
     public IAndroidTarget[] getTargets() {
         return mTargets;
     }
 
     /**
+     * Sets the targets that are available in the SDK.
+     * <p/>
+     * The array can be empty but not null.
+     */
+    private void setTargets(IAndroidTarget[] targets) {
+        assert targets != null;
+        mTargets = targets;
+    }
+
+    /**
      * Returns a target from a hash that was generated by {@link IAndroidTarget#hashString()}.
      *
      * @param hash the {@link IAndroidTarget} hash string.
@@ -202,14 +224,6 @@
         setTargets(list.toArray(new IAndroidTarget[list.size()]));
     }
 
-    private SdkManager(String sdkLocation) {
-        mSdkLocation = sdkLocation;
-    }
-
-    private void setTargets(IAndroidTarget[] targets) {
-        mTargets = targets;
-    }
-
     /**
      * Loads the Platforms from the SDK.
      * @param location Location of the SDK
@@ -591,8 +605,10 @@
                     if (m.matches()) {
                         map.put(m.group(1), m.group(2));
                     } else {
-                        log.warning("Error parsing '%1$s': \"%2$s\" is not a valid syntax",
-                                buildProp.getAbsolutePath(), line);
+                        if (log != null) {
+                            log.warning("Error parsing '%1$s': \"%2$s\" is not a valid syntax",
+                                    buildProp.getAbsolutePath(), line);
+                        }
                         return null;
                     }
                 }
diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdManager.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdManager.java
index 954da17..36b3b7f 100644
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdManager.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/AvdManager.java
@@ -110,7 +110,7 @@
     /**
      * Pattern to match pixel-sized skin "names", e.g. "320x480".
      */
-    public final static Pattern NUMERIC_SKIN_SIZE = Pattern.compile("[0-9]{2,}x[0-9]{2,}"); //$NON-NLS-1$
+    public final static Pattern NUMERIC_SKIN_SIZE = Pattern.compile("([0-9]{2,})x([0-9]{2,})"); //$NON-NLS-1$
 
     private final static String USERDATA_IMG = "userdata.img"; //$NON-NLS-1$
     private final static String CONFIG_INI = "config.ini"; //$NON-NLS-1$
@@ -1044,7 +1044,13 @@
         }
 
         if (configIniFile != null) {
-            properties = SdkManager.parsePropertyFile(configIniFile, log);
+            if (!configIniFile.isFile()) {
+                if (log != null) {
+                    log.warning("Missing file '%1$s'.",  configIniFile.getPath());
+                }
+            } else {
+                properties = SdkManager.parsePropertyFile(configIniFile, log);
+            }
         }
 
         // get name
diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/HardwareProperties.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/HardwareProperties.java
index 81acfef..77142b1 100644
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/HardwareProperties.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/avd/HardwareProperties.java
@@ -24,43 +24,52 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 public class HardwareProperties {
     private final static Pattern PATTERN_PROP = Pattern.compile(
     "^([a-zA-Z0-9._-]+)\\s*=\\s*(.*)\\s*$");
-    
+
     private final static String HW_PROP_NAME = "name";
     private final static String HW_PROP_TYPE = "type";
     private final static String HW_PROP_DEFAULT = "default";
     private final static String HW_PROP_ABSTRACT = "abstract";
     private final static String HW_PROP_DESC = "description";
-    
+
+    private final static String BOOLEAN_YES = "yes";
+    private final static String BOOLEAN_NO = "no";
+    public final static String[] BOOLEAN_VALUES = new String[] { BOOLEAN_YES, BOOLEAN_NO };
+    public final static Pattern DISKSIZE_PATTERN = Pattern.compile("\\d+[MK]B");
+
     public enum ValueType {
         INTEGER("integer"),
         BOOLEAN("boolean"),
         DISKSIZE("diskSize");
-        
+
         private String mValue;
 
         ValueType(String value) {
             mValue = value;
         }
-        
+
+        public String getValue() {
+            return mValue;
+        }
+
         public static ValueType getEnum(String value) {
             for (ValueType type : values()) {
                 if (type.mValue.equals(value)) {
                     return type;
                 }
             }
-            
+
             return null;
         }
     }
-    
+
     public static final class HardwareProperty {
         private String mName;
         private ValueType mType;
@@ -68,40 +77,40 @@
         private String mDefault;
         private String mAbstract;
         private String mDescription;
-        
+
         public String getName() {
             return mName;
         }
-        
+
         public ValueType getType() {
             return mType;
         }
-        
+
         public String getDefault() {
             return mDefault;
         }
-        
+
         public String getAbstract() {
             return mAbstract;
         }
-        
+
         public String getDescription() {
             return mDescription;
         }
     }
-    
+
     /**
      * Parses the hardware definition file.
      * @param file the property file to parse
      * @param log the ISdkLog object receiving warning/error from the parsing.
      * @return the map of (key,value) pairs, or null if the parsing failed.
      */
-    public static List<HardwareProperty> parseHardwareDefinitions(File file, ISdkLog log) {
+    public static Map<String, HardwareProperty> parseHardwareDefinitions(File file, ISdkLog log) {
         try {
             FileInputStream fis = new FileInputStream(file);
             BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
 
-            List<HardwareProperty> map = new ArrayList<HardwareProperty>();
+            Map<String, HardwareProperty> map = new HashMap<String, HardwareProperty>();
 
             String line = null;
             HardwareProperty prop = null;
@@ -115,15 +124,15 @@
                         if (HW_PROP_NAME.equals(valueName)) {
                             prop = new HardwareProperty();
                             prop.mName = value;
-                            map.add(prop);
+                            map.put(prop.mName, prop);
                         }
-                        
+
                         if (prop == null) {
                             log.warning("Error parsing '%1$s': missing '%2$s'",
                                     file.getAbsolutePath(), HW_PROP_NAME);
                             return null;
                         }
-                        
+
                         if (HW_PROP_TYPE.equals(valueName)) {
                             prop.mType = ValueType.getEnum(value);
                         } else if (HW_PROP_DEFAULT.equals(valueName)) {
@@ -140,7 +149,7 @@
                     }
                 }
             }
-            
+
             return map;
         } catch (FileNotFoundException e) {
             // this should not happen since we usually test the file existence before
@@ -156,4 +165,16 @@
         return null;
     }
 
+    /**
+     * Returns the index of <var>value</var> in {@link #BOOLEAN_VALUES}.
+     */
+    public static int getBooleanValueIndex(String value) {
+        if (BOOLEAN_YES.equals(value)) {
+            return 0;
+        } else if (BOOLEAN_NO.equals(value)) {
+            return 1;
+        }
+
+        return -1;
+    }
 }
diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ApkConfigurationHelper.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ApkConfigurationHelper.java
index eeab46a..4ba6fa6 100644
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ApkConfigurationHelper.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ApkConfigurationHelper.java
@@ -16,91 +16,33 @@
 
 package com.android.sdklib.internal.project;
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
 
 /**
  * Helper class to read and write Apk Configuration into a {@link ProjectProperties} file.
  */
 public class ApkConfigurationHelper {
-    /** Prefix for property names for config definition. This prevents having config named
-     * after other valid properties such as "target". */
-    final static String CONFIG_PREFIX = "apk-config-";
-
     /**
-     * Reads the Apk Configurations from a {@link ProjectProperties} file and returns them as a map.
-     * <p/>If there are no defined configurations, the returned map will be empty.
-     * @return a map of apk configurations. The map contains (name, filter) where name is
-     * the name of the configuration (a-zA-Z0-9 only), and filter is the comma separated list of
-     * resource configuration to include in the apk (see aapt -c) 
+     * Reads the project settings from a {@link ProjectProperties} file and returns them as a
+     * {@link ApkSettings} object.
      */
-    public static Map<String, String> getConfigs(ProjectProperties properties) {
-        HashMap<String, String> configMap = new HashMap<String, String>();
+    public static ApkSettings getSettings(ProjectProperties properties) {
+        ApkSettings apkSettings = new ApkSettings();
 
-        // get the list of configs.
-        String configList = properties.getProperty(ProjectProperties.PROPERTY_APK_CONFIGS);
-        if (configList != null) {
-            // this is a comma separated list
-            String[] configs = configList.split(","); //$NON-NLS-1$
-            
-            // read the value of each config and store it in a map
-            for (String config : configs) {
-                config = config.trim();
-                String configValue = properties.getProperty(CONFIG_PREFIX + config);
-                if (configValue != null) {
-                    configMap.put(config, configValue);
-                }
-            }
-        }
-        
-        return configMap;
+        boolean splitByDensity = Boolean.parseBoolean(properties.getProperty(
+                ProjectProperties.PROPERTY_SPLIT_BY_DENSITY));
+        apkSettings.setSplitByDensity(splitByDensity);
+
+
+        return apkSettings;
     }
-    
+
     /**
-     * Writes the Apk Configurations from a given map into a {@link ProjectProperties}.
-     * @param properties the {@link ProjectProperties} in which to store the apk configurations. 
-     * @param configMap a map of apk configurations. The map contains (name, filter) where name is
-     * the name of the configuration (a-zA-Z0-9 only), and filter is the comma separated list of
-     * resource configuration to include in the apk (see aapt -c) 
-     * @return true if the {@link ProjectProperties} contained Apk Configuration that were not
-     * present in the map. 
+     * Sets the content of a {@link ApkSettings} into a {@link ProjectProperties}.
+     * @param properties the {@link ProjectProperties} in which to store the settings.
+     * @param settings the project settings to store.
      */
-    public static boolean setConfigs(ProjectProperties properties, Map<String, String> configMap) {
-        // load the current configs, in order to remove the value properties for each of them
-        // in case a config was removed.
-        
-        // get the list of configs.
-        String configList = properties.getProperty(ProjectProperties.PROPERTY_APK_CONFIGS);
-
-        boolean hasRemovedConfig = false;
-
-        if (configList != null) {
-            // this is a comma separated list
-            String[] configs = configList.split(","); //$NON-NLS-1$
-            
-            for (String config : configs) {
-                config = config.trim();
-                if (configMap.containsKey(config) == false) {
-                    hasRemovedConfig = true;
-                    properties.removeProperty(CONFIG_PREFIX + config);
-                }
-            }
-        }
-        
-        // now add the properties.
-        Set<Entry<String, String>> entrySet = configMap.entrySet();
-        StringBuilder sb = new StringBuilder();
-        for (Entry<String, String> entry : entrySet) {
-            if (sb.length() > 0) {
-                sb.append(",");
-            }
-            sb.append(entry.getKey());
-            properties.setProperty(CONFIG_PREFIX + entry.getKey(), entry.getValue());
-        }
-        properties.setProperty(ProjectProperties.PROPERTY_APK_CONFIGS, sb.toString());
-        
-        return hasRemovedConfig;
+    public static void setProperties(ProjectProperties properties, ApkSettings settings) {
+        properties.setProperty(ProjectProperties.PROPERTY_SPLIT_BY_DENSITY,
+                Boolean.toString(settings.isSplitByDpi()));
     }
 }
diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ApkSettings.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ApkSettings.java
new file mode 100644
index 0000000..c96e223
--- /dev/null
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ApkSettings.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sdklib.internal.project;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Settings for multiple APK generation.
+ */
+public class ApkSettings {
+    private boolean mSplitByDpi = false;
+
+    public ApkSettings() {
+    }
+
+    /**
+     * Returns a map of configuration filters to be used by the -c option of aapt.
+     * <p/>The map stores (key, value) pairs where the keys is a filename modifier and the value
+     * is the parameter to pass to aapt through the -c option.
+     * @return a map, always. It can however be empty.
+     */
+    public Map<String, String> getResourceFilters() {
+        Map<String, String> map = new HashMap<String, String>();
+        if (mSplitByDpi) {
+            map.put("hdpi", "hdpi,nodpi");
+            map.put("mdpi", "mdpi,nodpi");
+            map.put("ldpi", "ldpi,nodpi");
+        }
+
+        return map;
+    }
+
+    /**
+     * Indicates whether APKs should be generate for each dpi level.
+     */
+    public boolean isSplitByDpi() {
+        return mSplitByDpi;
+    }
+
+    public void setSplitByDensity(boolean split) {
+        mSplitByDpi = split;
+    }
+}
diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java
index 916fa7c..e9e5999 100644
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectCreator.java
@@ -20,6 +20,8 @@
 import com.android.sdklib.ISdkLog;
 import com.android.sdklib.SdkConstants;
 import com.android.sdklib.internal.project.ProjectProperties.PropertyType;
+import com.android.sdklib.xml.AndroidManifest;
+import com.android.sdklib.xml.AndroidXPathFactory;
 
 import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
@@ -27,25 +29,22 @@
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.regex.Pattern;
 
-import javax.xml.XMLConstants;
-import javax.xml.namespace.NamespaceContext;
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
 
 /**
- * Creates the basic files needed to get an Android project up and running. Also
- * allows creation of IntelliJ project files.
+ * Creates the basic files needed to get an Android project up and running.
  *
  * @hide
  */
@@ -55,12 +54,23 @@
     private final static String PH_JAVA_FOLDER = "PACKAGE_PATH";
     /** Package name substitution string used in template files, i.e. "PACKAGE" */
     private final static String PH_PACKAGE = "PACKAGE";
-    /** Activity name substitution string used in template files, i.e. "ACTIVITY_NAME". */
+    /** Activity name substitution string used in template files, i.e. "ACTIVITY_NAME".
+     * @deprecated This is only used for older templates. For new ones see
+     * {@link #PH_ACTIVITY_ENTRY_NAME}, and {@link #PH_ACTIVITY_CLASS_NAME}. */
     private final static String PH_ACTIVITY_NAME = "ACTIVITY_NAME";
+    /** Activity name substitution string used in manifest templates, i.e. "ACTIVITY_ENTRY_NAME".*/
+    private final static String PH_ACTIVITY_ENTRY_NAME = "ACTIVITY_ENTRY_NAME";
+    /** Activity name substitution string used in class templates, i.e. "ACTIVITY_CLASS_NAME".*/
+    private final static String PH_ACTIVITY_CLASS_NAME = "ACTIVITY_CLASS_NAME";
+    /** Activity FQ-name substitution string used in class templates, i.e. "ACTIVITY_FQ_NAME".*/
+    private final static String PH_ACTIVITY_FQ_NAME = "ACTIVITY_FQ_NAME";
+    /** Original Activity class name substitution string used in class templates, i.e.
+     * "ACTIVITY_TESTED_CLASS_NAME".*/
+    private final static String PH_ACTIVITY_TESTED_CLASS_NAME = "ACTIVITY_TESTED_CLASS_NAME";
     /** Project name substitution string used in template files, i.e. "PROJECT_NAME". */
     private final static String PH_PROJECT_NAME = "PROJECT_NAME";
-
-    private final static String FOLDER_TESTS = "tests";
+    /** Application icon substitution string used in the manifest template */
+    private final static String PH_ICON = "ICON";
 
     /** Pattern for characters accepted in a project name. Since this will be used as a
      * directory name, we're being a bit conservative on purpose: dot and space cannot be used. */
@@ -101,6 +111,7 @@
         /** default UID. This will not be serialized anyway. */
         private static final long serialVersionUID = 1L;
 
+        @SuppressWarnings("unused")
         ProjectCreateException(String message) {
             super(message);
         }
@@ -135,17 +146,16 @@
      *          {@link #RE_PROJECT_NAME} regex.
      * @param packageName the package of the project. The name must match the
      *          {@link #RE_PACKAGE_NAME} regex.
-     * @param activityName the activity of the project as it will appear in the manifest. Can be
+     * @param activityEntry the activity of the project as it will appear in the manifest. Can be
      *          null if no activity should be created. The name must match the
      *          {@link #RE_ACTIVITY_NAME} regex.
      * @param target the project target.
-     * @param isTestProject whether the project to create is a test project. Caller should
-     *        initially call this will false. The method will call itself back to create
-     *        a test project as needed.
+     * @param pathToMainProject if non-null the project will be setup to test a main project
+     * located at the given path.
      */
     public void createProject(String folderPath, String projectName,
-            String packageName, String activityName, IAndroidTarget target,
-            boolean isTestProject) {
+            String packageName, String activityEntry, IAndroidTarget target,
+            String pathToMainProject) {
 
         // create project folder if it does not exist
         File projectFolder = new File(folderPath);
@@ -185,6 +195,8 @@
         }
 
         try {
+            boolean isTestProject = pathToMainProject != null;
+
             // first create the project properties.
 
             // location of the SDK goes in localProperty
@@ -202,7 +214,18 @@
             // create a build.properties file with just the application package
             ProjectProperties buildProperties = ProjectProperties.create(folderPath,
                     PropertyType.BUILD);
-            buildProperties.setProperty(ProjectProperties.PROPERTY_APP_PACKAGE, packageName);
+
+            // only put application.package for older target where the rules file didn't.
+            // grab it through xpath
+            if (target.getVersion().getApiLevel() < 4) {
+                buildProperties.setProperty(ProjectProperties.PROPERTY_APP_PACKAGE, packageName);
+            }
+
+            if (isTestProject) {
+                buildProperties.setProperty(ProjectProperties.PROPERTY_TESTED_PROJECT,
+                        pathToMainProject);
+            }
+
             buildProperties.save();
 
             // create the map for place-holders of values to replace in the templates
@@ -217,19 +240,76 @@
             // put this path in the place-holder map for project files that needs to list
             // files manually.
             keywords.put(PH_JAVA_FOLDER, packagePath);
-
             keywords.put(PH_PACKAGE, packageName);
-            if (activityName != null) {
-                keywords.put(PH_ACTIVITY_NAME, activityName);
+
+
+            // compute some activity related information
+            String fqActivityName = null, activityPath = null, activityClassName = null;
+            String originalActivityEntry = activityEntry;
+            String originalActivityClassName = null;
+            if (activityEntry != null) {
+                if (isTestProject) {
+                    // append Test so that it doesn't collide with the main project activity.
+                    activityEntry += "Test";
+
+                    // get the classname from the original activity entry.
+                    int pos = originalActivityEntry.lastIndexOf('.');
+                    if (pos != -1) {
+                        originalActivityClassName = originalActivityEntry.substring(pos + 1);
+                    } else {
+                        originalActivityClassName = originalActivityEntry;
+                    }
+                }
+
+                // get the fully qualified name of the activity
+                fqActivityName = AndroidManifest.combinePackageAndClassName(packageName,
+                        activityEntry);
+
+                // get the activity path (replace the . to /)
+                activityPath = stripString(fqActivityName.replace(".", File.separator),
+                        File.separatorChar);
+
+                // remove the last segment, so that we only have the path to the activity, but
+                // not the activity filename itself.
+                activityPath = activityPath.substring(0,
+                        activityPath.lastIndexOf(File.separatorChar));
+
+                // finally, get the class name for the activity
+                activityClassName = fqActivityName.substring(fqActivityName.lastIndexOf('.') + 1);
+            }
+
+            // at this point we have the following for the activity:
+            // activityEntry: this is the manifest entry. For instance .MyActivity
+            // fqActivityName: full-qualified class name: com.foo.MyActivity
+            // activityClassName: only the classname: MyActivity
+            // originalActivityClassName: the classname of the activity being tested (if applicable)
+
+            // Add whatever activity info is needed in the place-holder map.
+            // Older templates only expect ACTIVITY_NAME to be the same (and unmodified for tests).
+            if (target.getVersion().getApiLevel() < 4) { // legacy
+                if (originalActivityEntry != null) {
+                    keywords.put(PH_ACTIVITY_NAME, originalActivityEntry);
+                }
+            } else {
+                // newer templates make a difference between the manifest entries, classnames,
+                // as well as the main and test classes.
+                if (activityEntry != null) {
+                    keywords.put(PH_ACTIVITY_ENTRY_NAME, activityEntry);
+                    keywords.put(PH_ACTIVITY_CLASS_NAME, activityClassName);
+                    keywords.put(PH_ACTIVITY_FQ_NAME, fqActivityName);
+                    if (originalActivityClassName != null) {
+                        keywords.put(PH_ACTIVITY_TESTED_CLASS_NAME, originalActivityClassName);
+                    }
+                }
             }
 
             // Take the project name from the command line if there's one
             if (projectName != null) {
                 keywords.put(PH_PROJECT_NAME, projectName);
             } else {
-                if (activityName != null) {
-                    // Use the activity as project name
-                    keywords.put(PH_PROJECT_NAME, activityName);
+                if (activityClassName != null) {
+                    // Use the activity class name as project name
+                    keywords.put(PH_PROJECT_NAME, activityClassName);
                 } else {
                     // We need a project name. Just pick up the basename of the project
                     // directory.
@@ -238,36 +318,43 @@
                 }
             }
 
-            // create the source folder and the java package folders.
-            String srcFolderPath = SdkConstants.FD_SOURCES + File.separator + packagePath;
-            File sourceFolder = createDirs(projectFolder, srcFolderPath);
-            String javaTemplate = "java_file.template";
-            String activityFileName = activityName + ".java";
-            if (isTestProject) {
-                javaTemplate = "java_tests_file.template";
-                activityFileName = activityName + "Test.java";
-            }
-            installTemplate(javaTemplate, new File(sourceFolder, activityFileName),
-                    keywords, target);
+            // create the source folder for the activity
+            if (activityClassName != null) {
+                String srcActivityFolderPath = SdkConstants.FD_SOURCES + File.separator + activityPath;
+                File sourceFolder = createDirs(projectFolder, srcActivityFolderPath);
 
-            // create the generate source folder
-            srcFolderPath = SdkConstants.FD_GEN_SOURCES + File.separator + packagePath;
-            sourceFolder = createDirs(projectFolder, srcFolderPath);
+                String javaTemplate = isTestProject ? "java_tests_file.template"
+                        : "java_file.template";
+                String activityFileName = activityClassName + ".java";
+
+                installTemplate(javaTemplate, new File(sourceFolder, activityFileName),
+                        keywords, target);
+            } else {
+                // we should at least create 'src'
+                createDirs(projectFolder, SdkConstants.FD_SOURCES);
+            }
 
             // create other useful folders
-            File resourceFodler = createDirs(projectFolder, SdkConstants.FD_RESOURCES);
+            File resourceFolder = createDirs(projectFolder, SdkConstants.FD_RESOURCES);
             createDirs(projectFolder, SdkConstants.FD_OUTPUT);
             createDirs(projectFolder, SdkConstants.FD_NATIVE_LIBS);
 
             if (isTestProject == false) {
                 /* Make res files only for non test projects */
-                File valueFolder = createDirs(resourceFodler, SdkConstants.FD_VALUES);
+                File valueFolder = createDirs(resourceFolder, SdkConstants.FD_VALUES);
                 installTemplate("strings.template", new File(valueFolder, "strings.xml"),
                         keywords, target);
 
-                File layoutFolder = createDirs(resourceFodler, SdkConstants.FD_LAYOUT);
+                File layoutFolder = createDirs(resourceFolder, SdkConstants.FD_LAYOUT);
                 installTemplate("layout.template", new File(layoutFolder, "main.xml"),
                         keywords, target);
+
+                // create the icons
+                if (installIcons(resourceFolder, target)) {
+                    keywords.put(PH_ICON, "android:icon=\"@drawable/icon\"");
+                } else {
+                    keywords.put(PH_ICON, "");
+                }
             }
 
             /* Make AndroidManifest.xml and build.xml files */
@@ -283,16 +370,6 @@
             installTemplate("build.template",
                     new File(projectFolder, SdkConstants.FN_BUILD_XML),
                     keywords);
-
-            // if this is not a test project, then we create one.
-            if (isTestProject == false) {
-                // create the test project folder.
-                createDirs(projectFolder, FOLDER_TESTS);
-                File testProjectFolder = new File(folderPath, FOLDER_TESTS);
-
-                createProject(testProjectFolder.getAbsolutePath(), projectName, packageName,
-                        activityName, target, true /*isTestProject*/);
-            }
         } catch (ProjectCreateException e) {
             mLog.error(e, null);
         } catch (IOException e) {
@@ -317,23 +394,14 @@
      * @param projectName The project name from --name. Can be null.
      */
     public void updateProject(String folderPath, IAndroidTarget target, String projectName) {
-        // project folder must exist and be a directory, since this is an update
-        File projectFolder = new File(folderPath);
-        if (!projectFolder.isDirectory()) {
-            mLog.error(null, "Project folder '%1$s' is not a valid directory, this is not an Android project you can update.",
-                    projectFolder);
+        // since this is an update, check the folder does point to a project
+        File androidManifest = checkProjectFolder(folderPath);
+        if (androidManifest == null) {
             return;
         }
 
-        // Check AndroidManifest.xml is present
-        File androidManifest = new File(projectFolder, SdkConstants.FN_ANDROID_MANIFEST_XML);
-        if (!androidManifest.isFile()) {
-            mLog.error(null,
-                    "%1$s not found in '%2$s', this is not an Android project you can update.",
-                    SdkConstants.FN_ANDROID_MANIFEST_XML,
-                    folderPath);
-            return;
-        }
+        // get the parent File.
+        File projectFolder = androidManifest.getParentFile();
 
         // Check there's a default.properties with a target *or* --target was specified
         ProjectProperties props = ProjectProperties.load(folderPath, PropertyType.DEFAULT);
@@ -415,9 +483,16 @@
                 keywords.put(PH_PROJECT_NAME, projectName);
             } else {
                 extractPackageFromManifest(androidManifest, keywords);
-                if (keywords.containsKey(PH_ACTIVITY_NAME)) {
+                if (keywords.containsKey(PH_ACTIVITY_ENTRY_NAME)) {
+                    String activity = keywords.get(PH_ACTIVITY_ENTRY_NAME);
+                    // keep only the last segment if applicable
+                    int pos = activity.lastIndexOf('.');
+                    if (pos != -1) {
+                        activity = activity.substring(pos + 1);
+                    }
+
                     // Use the activity as project name
-                    keywords.put(PH_PROJECT_NAME, keywords.get(PH_ACTIVITY_NAME));
+                    keywords.put(PH_PROJECT_NAME, activity);
                 } else {
                     // We need a project name. Just pick up the basename of the project
                     // directory.
@@ -443,6 +518,84 @@
     }
 
     /**
+     * Updates a test project with a new path to the main (tested) project.
+     * @param folderPath the path of the test project.
+     * @param pathToMainProject the path to the main project, relative to the test project.
+     */
+    public void updateTestProject(final String folderPath, final String pathToMainProject) {
+        // since this is an update, check the folder does point to a project
+        if (checkProjectFolder(folderPath) == null) {
+            return;
+        }
+
+        // check the path to the main project is valid.
+        File mainProject = new File(pathToMainProject);
+        String resolvedPath;
+        if (mainProject.isAbsolute() == false) {
+            mainProject = new File(folderPath, pathToMainProject);
+            try {
+                resolvedPath = mainProject.getCanonicalPath();
+            } catch (IOException e) {
+                mLog.error(e, "Unable to resolve path to main project: %1$s", pathToMainProject);
+                return;
+            }
+        } else {
+            resolvedPath = mainProject.getAbsolutePath();
+        }
+
+        println("Resolved location of main project to: %1$s", resolvedPath);
+
+        // check the main project exists
+        if (checkProjectFolder(resolvedPath) == null) {
+            return;
+        }
+
+        ProjectProperties props = ProjectProperties.create(folderPath, PropertyType.BUILD);
+
+        // set or replace the path to the main project
+        props.setProperty(ProjectProperties.PROPERTY_TESTED_PROJECT, pathToMainProject);
+        try {
+            props.save();
+            println("Updated %1$s", PropertyType.BUILD.getFilename());
+        } catch (IOException e) {
+            mLog.error(e, "Failed to write %1$s file in '%2$s'",
+                    PropertyType.BUILD.getFilename(),
+                    folderPath);
+            return;
+        }
+    }
+
+    /**
+     * Checks whether the give <var>folderPath</var> is a valid project folder, and returns
+     * a {@link File} to the AndroidManifest.xml file.
+     * <p/>This checks that the folder exists and contains an AndroidManifest.xml file in it.
+     * <p/>Any error are output using {@link #mLog}.
+     * @param folderPath the folder to check
+     * @return a {@link File} to the AndroidManifest.xml file, or null otherwise.
+     */
+    private File checkProjectFolder(String folderPath) {
+        // project folder must exist and be a directory, since this is an update
+        File projectFolder = new File(folderPath);
+        if (!projectFolder.isDirectory()) {
+            mLog.error(null, "Project folder '%1$s' is not a valid directory, this is not an Android project you can update.",
+                    projectFolder);
+            return null;
+        }
+
+        // Check AndroidManifest.xml is present
+        File androidManifest = new File(projectFolder, SdkConstants.FN_ANDROID_MANIFEST_XML);
+        if (!androidManifest.isFile()) {
+            mLog.error(null,
+                    "%1$s not found in '%2$s', this is not an Android project you can update.",
+                    SdkConstants.FN_ANDROID_MANIFEST_XML,
+                    folderPath);
+            return null;
+        }
+
+        return androidManifest;
+    }
+
+    /**
      * Returns true if any line of the input file contains the requested regexp.
      */
     private boolean checkFileContainsRegexp(File file, String regexp) {
@@ -470,7 +623,7 @@
      * Extracts a "full" package & activity name from an AndroidManifest.xml.
      * <p/>
      * The keywords dictionary is always filed the package name under the key {@link #PH_PACKAGE}.
-     * If an activity name can be found, it is filed under the key {@link #PH_ACTIVITY_NAME}.
+     * If an activity name can be found, it is filed under the key {@link #PH_ACTIVITY_ENTRY_NAME}.
      * When no activity is found, this key is not created.
      *
      * @param manifestFile The AndroidManifest.xml file
@@ -480,37 +633,7 @@
     private boolean extractPackageFromManifest(File manifestFile,
             Map<String, String> outKeywords) {
         try {
-            final String nsPrefix = "android";
-            final String nsURI = SdkConstants.NS_RESOURCES;
-
-            XPath xpath = XPathFactory.newInstance().newXPath();
-
-            xpath.setNamespaceContext(new NamespaceContext() {
-                public String getNamespaceURI(String prefix) {
-                    if (nsPrefix.equals(prefix)) {
-                        return nsURI;
-                    }
-                    return XMLConstants.NULL_NS_URI;
-                }
-
-                public String getPrefix(String namespaceURI) {
-                    if (nsURI.equals(namespaceURI)) {
-                        return nsPrefix;
-                    }
-                    return null;
-                }
-
-                @SuppressWarnings("unchecked")
-                public Iterator getPrefixes(String namespaceURI) {
-                    if (nsURI.equals(namespaceURI)) {
-                        ArrayList<String> list = new ArrayList<String>();
-                        list.add(nsPrefix);
-                        return list.iterator();
-                    }
-                    return null;
-                }
-
-            });
+            XPath xpath = AndroidXPathFactory.newXPath();
 
             InputSource source = new InputSource(new FileReader(manifestFile));
             String packageName = xpath.evaluate("/manifest/@package", source);
@@ -524,7 +647,7 @@
             String expression = String.format("/manifest/application/activity" +
                     "[intent-filter/action/@%1$s:name='android.intent.action.MAIN' and " +
                     "intent-filter/category/@%1$s:name='android.intent.category.LAUNCHER']" +
-                    "/@%1$s:name", nsPrefix);
+                    "/@%1$s:name", AndroidXPathFactory.DEFAULT_NS_PREFIX);
 
             NodeList activityNames = (NodeList) xpath.evaluate(expression, source,
                     XPathConstants.NODESET);
@@ -564,9 +687,9 @@
             if (activityName.length() == 0) {
                 mLog.warning("Missing <activity %1$s:name=\"...\"> in '%2$s'.\n" +
                         "No activity will be generated.",
-                        nsPrefix, manifestFile.getName());
+                        AndroidXPathFactory.DEFAULT_NS_PREFIX, manifestFile.getName());
             } else {
-                outKeywords.put(PH_ACTIVITY_NAME, activityName);
+                outKeywords.put(PH_ACTIVITY_ENTRY_NAME, activityName);
             }
 
             outKeywords.put(PH_PACKAGE, packageName);
@@ -666,8 +789,10 @@
             String line;
 
             while ((line = in.readLine()) != null) {
-                for (String key : placeholderMap.keySet()) {
-                    line = line.replace(key, placeholderMap.get(key));
+                if (placeholderMap != null) {
+                    for (String key : placeholderMap.keySet()) {
+                        line = line.replace(key, placeholderMap.get(key));
+                    }
                 }
 
                 out.write(line);
@@ -687,6 +812,85 @@
     }
 
     /**
+     * Installs the project icons.
+     * @param resourceFolder the resource folder
+     * @param target the target of the project.
+     * @return true if any icon was installed.
+     */
+    private boolean installIcons(File resourceFolder, IAndroidTarget target)
+            throws ProjectCreateException {
+        // query the target for its template directory
+        String templateFolder = target.getPath(IAndroidTarget.TEMPLATES);
+
+        boolean installedIcon = false;
+
+        installedIcon |= installIcon(templateFolder, "icon_hdpi.png", resourceFolder, "drawable-hdpi");
+        installedIcon |= installIcon(templateFolder, "icon_mdpi.png", resourceFolder, "drawable-mdpi");
+        installedIcon |= installIcon(templateFolder, "icon_ldpi.png", resourceFolder, "drawable-ldpi");
+
+        return installedIcon;
+    }
+
+    /**
+     * Installs an Icon in the project.
+     * @return true if the icon was installed.
+     */
+    private boolean installIcon(String templateFolder, String iconName, File resourceFolder,
+            String folderName) throws ProjectCreateException {
+        File icon = new File(templateFolder, iconName);
+        if (icon.exists()) {
+            File drawable = createDirs(resourceFolder, folderName);
+            installBinaryFile(icon, new File(drawable, "icon.png"));
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * Installs a binary file
+     * @param source the source file to copy
+     * @param destination the destination file to write
+     */
+    private void installBinaryFile(File source, File destination) {
+        byte[] buffer = new byte[8192];
+
+        FileInputStream fis = null;
+        FileOutputStream fos = null;
+        try {
+            fis = new FileInputStream(source);
+            fos = new FileOutputStream(destination);
+
+            int read;
+            while ((read = fis.read(buffer)) != -1) {
+                fos.write(buffer, 0, read);
+            }
+
+        } catch (FileNotFoundException e) {
+            // shouldn't happen since we check before.
+        } catch (IOException e) {
+            new ProjectCreateException(e, "Failed to read binary file: %1$s",
+                    source.getAbsolutePath());
+        } finally {
+            if (fis != null) {
+                try {
+                    fis.close();
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+            if (fos != null) {
+                try {
+                    fos.close();
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+        }
+        
+    }
+
+    /**
      * Prints a message unless silence is enabled.
      * <p/>
      * This is just a convenience wrapper around {@link ISdkLog#printf(String, Object...)} from
diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java
index f2b73c0..6e29e5a 100644
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java
@@ -35,9 +35,18 @@
 public final class ProjectProperties {
     /** The property name for the project target */
     public final static String PROPERTY_TARGET = "target";
-    public final static String PROPERTY_APK_CONFIGS = "apk-configurations";
-    public final static String PROPERTY_SDK = "sdk-location";
-    public final static String PROPERTY_APP_PACKAGE = "application-package";
+
+    public final static String PROPERTY_SDK = "sdk.dir";
+    // LEGACY - compatibility with 1.6 and before
+    public final static String PROPERTY_SDK_LEGACY = "sdk-location";
+
+    public final static String PROPERTY_APP_PACKAGE = "application.package";
+    // LEGACY - compatibility with 1.6 and before
+    public final static String PROPERTY_APP_PACKAGE_LEGACY = "application-package";
+
+    public final static String PROPERTY_SPLIT_BY_DENSITY = "split.density";
+
+    public final static String PROPERTY_TESTED_PROJECT = "tested.project.dir";
 
     public static enum PropertyType {
         BUILD("build.properties", BUILD_HEADER),
@@ -88,8 +97,8 @@
            "# This file is only used by the Ant script.\n" +
            "\n" +
            "# You can use this to override default values such as\n" +
-           "#  'source-folder' for the location of your java source folder and\n" +
-           "#  'out-folder' for the location of your output folder.\n" +
+           "#  'source.dir' for the location of your java source folder and\n" +
+           "#  'out.dir' for the location of your output folder.\n" +
            "\n" +
            "# You can also use it define how the release builds are signed by declaring\n" +
            "# the following properties:\n" +
@@ -103,17 +112,8 @@
 //               1-------10--------20--------30--------40--------50--------60--------70--------80
         COMMENT_MAP.put(PROPERTY_TARGET,
                 "# Project target.\n");
-        COMMENT_MAP.put(PROPERTY_APK_CONFIGS,
-                "# apk configurations. This property allows creation of APK files with limited\n" +
-                "# resources. For example, if your application contains many locales and\n" +
-                "# you wish to release multiple smaller apks instead of a large one, you can\n" +
-                "# define configuration to create apks with limited language sets.\n" +
-                "# Format is a comma separated list of configuration names. For each\n" +
-                "# configuration, a property will declare the resource configurations to\n" +
-                "# include. Example:\n" +
-                "#     " + PROPERTY_APK_CONFIGS +"=european,northamerica\n" +
-                "#     " + ApkConfigurationHelper.CONFIG_PREFIX + "european=en,fr,it,de,es\n" +
-                "#     " + ApkConfigurationHelper.CONFIG_PREFIX + "northamerica=en,es\n");
+        COMMENT_MAP.put(PROPERTY_SPLIT_BY_DENSITY,
+                "# Indicates whether an apk should be generated for each density.\n");
         COMMENT_MAP.put(PROPERTY_SDK,
                 "# location of the SDK. This is only used by Ant\n" +
                 "# For customization when using a Version Control System, please read the\n" +
@@ -251,8 +251,10 @@
                 writer.write(comment);
             }
             String value = entry.getValue();
-            value = value.replaceAll("\\\\", "\\\\\\\\");
-            writer.write(String.format("%s=%s\n", entry.getKey(), value));
+            if (value != null) {
+                value = value.replaceAll("\\\\", "\\\\\\\\");
+                writer.write(String.format("%s=%s\n", entry.getKey(), value));
+            }
         }
 
         // close the file to flush
diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java
index b28019f..f1cdf1d 100755
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java
@@ -35,7 +35,7 @@
 /**

  * Represents an add-on XML node in an SDK repository.

  */

-public class AddonPackage extends Package {

+public class AddonPackage extends Package implements IPackageVersion {

 

     private static final String PROP_NAME      = "Addon.Name";      //$NON-NLS-1$

     private static final String PROP_VENDOR    = "Addon.Vendor";    //$NON-NLS-1$

@@ -89,6 +89,8 @@
      * {@link IAndroidTarget#isPlatform()} false) from the {@link SdkManager}.

      * This is used to list local SDK folders in which case there is one archive which

      * URL is the actual target location.

+     * <p/>

+     * By design, this creates a package with one and only one archive.

      */

     AddonPackage(IAndroidTarget target, Properties props) {

         super(  null,                       //source

@@ -187,18 +189,33 @@
     /** Returns a short description for an {@link IDescription}. */

     @Override

     public String getShortDescription() {

-        return String.format("%1$s by %2$s for Android API %3$s",

+        return String.format("%1$s by %2$s, Android API %3$s, revision %4$s",

                 getName(),

                 getVendor(),

-                mVersion.getApiString());

+                mVersion.getApiString(),

+                getRevision());

     }

 

-    /** Returns a long description for an {@link IDescription}. */

+    /**

+     * Returns a long description for an {@link IDescription}.

+     *

+     * The long description is whatever the XML contains for the &lt;description&gt; field,

+     * or the short description if the former is empty.

+     */

     @Override

     public String getLongDescription() {

-        return String.format("%1$s,\nRevision %2$d.",

-                getShortDescription(),

-                getRevision());

+        String s = getDescription();

+        if (s == null || s.length() == 0) {

+            s = getShortDescription();

+        }

+

+        if (s.indexOf("revision") == -1) {

+            s += String.format("\nRevision %1$d", getRevision());

+        }

+

+        s += String.format("\nRequires SDK Platform Android API %1$s",

+                mVersion.getApiString());

+        return s;

     }

 

     /**

diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Archive.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Archive.java
index d7c5625..e314bbe 100755
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Archive.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Archive.java
@@ -23,6 +23,7 @@
 import org.apache.commons.compress.archivers.zip.ZipFile;

 

 import java.io.File;

+import java.io.FileInputStream;

 import java.io.FileNotFoundException;

 import java.io.FileOutputStream;

 import java.io.IOException;

@@ -369,42 +370,38 @@
         Package pkg = getParentPackage();

 

         File archiveFile = null;

-        try {

-            String name = pkg.getShortDescription();

+        String name = pkg.getShortDescription();

 

-            if (pkg instanceof ExtraPackage && !((ExtraPackage) pkg).isPathValid()) {

-                monitor.setResult("Skipping %1$s: %2$s is not a valid install path.",

-                        name,

-                        ((ExtraPackage) pkg).getPath());

-                return false;

+        if (pkg instanceof ExtraPackage && !((ExtraPackage) pkg).isPathValid()) {

+            monitor.setResult("Skipping %1$s: %2$s is not a valid install path.",

+                    name,

+                    ((ExtraPackage) pkg).getPath());

+            return false;

+        }

+

+        if (isLocal()) {

+            // This should never happen.

+            monitor.setResult("Skipping already installed archive: %1$s for %2$s",

+                    name,

+                    getOsDescription());

+            return false;

+        }

+

+        if (!isCompatible()) {

+            monitor.setResult("Skipping incompatible archive: %1$s for %2$s",

+                    name,

+                    getOsDescription());

+            return false;

+        }

+

+        archiveFile = downloadFile(osSdkRoot, monitor, forceHttp);

+        if (archiveFile != null) {

+            if (unarchive(osSdkRoot, archiveFile, sdkManager, monitor)) {

+                monitor.setResult("Installed %1$s", name);

+                // Delete the temp archive if it exists, only on success

+                deleteFileOrFolder(archiveFile);

+                return true;

             }

-

-            if (isLocal()) {

-                // This should never happen.

-                monitor.setResult("Skipping already installed archive: %1$s for %2$s",

-                        name,

-                        getOsDescription());

-                return false;

-            }

-

-            if (!isCompatible()) {

-                monitor.setResult("Skipping incompatible archive: %1$s for %2$s",

-                        name,

-                        getOsDescription());

-                return false;

-            }

-

-            archiveFile = downloadFile(monitor, forceHttp);

-            if (archiveFile != null) {

-                if (unarchive(osSdkRoot, archiveFile, sdkManager, monitor)) {

-                    monitor.setResult("Installed: %1$s", name);

-                    return true;

-                }

-            }

-

-        } finally {

-            // Delete the temp archive if it exists

-            deleteFileOrFolder(archiveFile);

         }

 

         return false;

@@ -414,56 +411,134 @@
      * Downloads an archive and returns the temp file with it.

      * Caller is responsible with deleting the temp file when done.

      */

-    private File downloadFile(ITaskMonitor monitor, boolean forceHttp) {

+    private File downloadFile(String osSdkRoot, ITaskMonitor monitor, boolean forceHttp) {

 

-        File tmpFileToDelete = null;

-        try {

-            File tmpFile = File.createTempFile("sdkupload", ".bin"); //$NON-NLS-1$ //$NON-NLS-2$

-            tmpFileToDelete = tmpFile;

+        String name = getParentPackage().getShortDescription();

+        String desc = String.format("Downloading %1$s", name);

+        monitor.setDescription(desc);

+        monitor.setResult(desc);

 

-            String name = getParentPackage().getShortDescription();

-            String desc = String.format("Downloading %1$s", name);

-            monitor.setDescription(desc);

-

-            String link = getUrl();

-            if (!link.startsWith("http://")                          //$NON-NLS-1$

-                    && !link.startsWith("https://")                  //$NON-NLS-1$

-                    && !link.startsWith("ftp://")) {                 //$NON-NLS-1$

-                // Make the URL absolute by prepending the source

-                Package pkg = getParentPackage();

-                RepoSource src = pkg.getParentSource();

-                if (src == null) {

-                    monitor.setResult("Internal error: no source for archive %1$s", name);

-                    return null;

-                }

-

-                // take the URL to the repository.xml and remove the last component

-                // to get the base

-                String repoXml = src.getUrl();

-                int pos = repoXml.lastIndexOf('/');

-                String base = repoXml.substring(0, pos + 1);

-

-                link = base + link;

+        String link = getUrl();

+        if (!link.startsWith("http://")                          //$NON-NLS-1$

+                && !link.startsWith("https://")                  //$NON-NLS-1$

+                && !link.startsWith("ftp://")) {                 //$NON-NLS-1$

+            // Make the URL absolute by prepending the source

+            Package pkg = getParentPackage();

+            RepoSource src = pkg.getParentSource();

+            if (src == null) {

+                monitor.setResult("Internal error: no source for archive %1$s", name);

+                return null;

             }

 

-            if (forceHttp) {

-                link = link.replaceAll("https://", "http://");  //$NON-NLS-1$ //$NON-NLS-2$

-            }

+            // take the URL to the repository.xml and remove the last component

+            // to get the base

+            String repoXml = src.getUrl();

+            int pos = repoXml.lastIndexOf('/');

+            String base = repoXml.substring(0, pos + 1);

 

-            if (fetchUrl(tmpFile, link, desc, monitor)) {

-                // Fetching was successful, don't delete the temp file here!

-                tmpFileToDelete = null;

+            link = base + link;

+        }

+

+        if (forceHttp) {

+            link = link.replaceAll("https://", "http://");  //$NON-NLS-1$ //$NON-NLS-2$

+        }

+

+        // Get the basename of the file we're downloading, i.e. the last component

+        // of the URL

+        int pos = link.lastIndexOf('/');

+        String base = link.substring(pos + 1);

+

+        // Rather than create a real temp file in the system, we simply use our

+        // temp folder (in the SDK base folder) and use the archive name for the

+        // download. This allows us to reuse or continue downloads.

+

+        File tmpFile = new File(getTempFolder(osSdkRoot), base);

+

+        // if the file exists, check if its checksum & size. Use it if complete

+        if (tmpFile.exists()) {

+            if (tmpFile.length() == getSize() &&

+                    fileChecksum(tmpFile, monitor).equalsIgnoreCase(getChecksum())) {

+                // File is good, let's use it.

                 return tmpFile;

             }

 

-        } catch (IOException e) {

+            // Existing file is either of different size or content.

+            // TODO: continue download when we support continue mode.

+            // Right now, let's simply remove the file and start over.

+            deleteFileOrFolder(tmpFile);

+        }

+

+        if (fetchUrl(tmpFile, link, desc, monitor)) {

+            // Fetching was successful, let's use this file.

+            return tmpFile;

+        } else {

+            // Delete the temp file if we aborted the download

+            // TODO: disable this when we want to support partial downloads!

+            deleteFileOrFolder(tmpFile);

+            return null;

+        }

+    }

+

+    /**

+     * Computes the SHA-1 checksum of the content of the given file.

+     * Returns an empty string on error (rather than null).

+     */

+    private String fileChecksum(File tmpFile, ITaskMonitor monitor) {

+        InputStream is = null;

+        try {

+            is = new FileInputStream(tmpFile);

+

+            MessageDigest digester = getChecksumType().getMessageDigest();

+

+            byte[] buf = new byte[65536];

+            int n;

+

+            while ((n = is.read(buf)) >= 0) {

+                if (n > 0) {

+                    digester.update(buf, 0, n);

+                }

+            }

+

+            return getDigestChecksum(digester);

+

+        } catch (FileNotFoundException e) {

+            // The FNF message is just the URL. Make it a bit more useful.

+            monitor.setResult("File not found: %1$s", e.getMessage());

+

+        } catch (Exception e) {

             monitor.setResult(e.getMessage());

 

         } finally {

-            deleteFileOrFolder(tmpFileToDelete);

+            if (is != null) {

+                try {

+                    is.close();

+                } catch (IOException e) {

+                    // pass

+                }

+            }

         }

 

-        return null;

+        return "";  //$NON-NLS-1$

+    }

+

+    /**

+     * Returns the SHA-1 from a {@link MessageDigest} as an hex string

+     * that can be compared with {@link #getChecksum()}.

+     */

+    private String getDigestChecksum(MessageDigest digester) {

+        int n;

+        // Create an hex string from the digest

+        byte[] digest = digester.digest();

+        n = digest.length;

+        String hex = "0123456789abcdef";                     //$NON-NLS-1$

+        char[] hexDigest = new char[n * 2];

+        for (int i = 0; i < n; i++) {

+            int b = digest[i] & 0x0FF;

+            hexDigest[i*2 + 0] = hex.charAt(b >>> 4);

+            hexDigest[i*2 + 1] = hex.charAt(b & 0x0f);

+        }

+

+        return new String(hexDigest);

     }

 

     /**

@@ -553,18 +628,8 @@
             }

 

             // Create an hex string from the digest

-            byte[] digest = digester.digest();

-            n = digest.length;

-            String hex = "0123456789abcdef";                     //$NON-NLS-1$

-            char[] hexDigest = new char[n * 2];

-            for (int i = 0; i < n; i++) {

-                int b = digest[i] & 0x0FF;

-                hexDigest[i*2 + 0] = hex.charAt(b >>> 4);

-                hexDigest[i*2 + 1] = hex.charAt(b & 0x0f);

-            }

-

+            String actual   = getDigestChecksum(digester);

             String expected = getChecksum();

-            String actual   = new String(hexDigest);

             if (!actual.equalsIgnoreCase(expected)) {

                 monitor.setResult("Download finished with wrong checksum. Expected %1$s, got %2$s.",

                         expected, actual);

@@ -611,6 +676,7 @@
         String pkgName = getParentPackage().getShortDescription();

         String pkgDesc = String.format("Installing %1$s", pkgName);

         monitor.setDescription(pkgDesc);

+        monitor.setResult(pkgDesc);

 

         // We always unzip in a temp folder which name depends on the package type

         // (e.g. addon, tools, etc.) and then move the folder to the destination folder.

@@ -625,7 +691,7 @@
 

         try {

             // Find a new temp folder that doesn't exist yet

-            unzipDestFolder = findTempFolder(osSdkRoot, pkgKind, "new");  //$NON-NLS-1$

+            unzipDestFolder = createTempFolder(osSdkRoot, pkgKind, "new");  //$NON-NLS-1$

 

             if (unzipDestFolder == null) {

                 // this should not seriously happen.

@@ -660,39 +726,72 @@
             }

 

             // Swap the old folder by the new one.

-            File renameFailedForDir = null;

-            if (destFolder.isDirectory()) {

-                renamedDestFolder = findTempFolder(osSdkRoot, pkgKind, "old");  //$NON-NLS-1$

-                if (renamedDestFolder == null) {

-                    // this should not seriously happen.

-                    monitor.setResult("Failed to find a temp directory in %1$s.", osSdkRoot);

+            // We have 2 "folder rename" (aka moves) to do.

+            // They must both succeed in the right order.

+            boolean move1done = false;

+            boolean move2done = false;

+            while (!move1done || !move2done) {

+                File renameFailedForDir = null;

+

+                // Case where the dest dir already exists

+                if (!move1done) {

+                    if (destFolder.isDirectory()) {

+                        // Create a new temp/old dir

+                        if (renamedDestFolder == null) {

+                            renamedDestFolder = createTempFolder(osSdkRoot, pkgKind, "old");  //$NON-NLS-1$

+                        }

+                        if (renamedDestFolder == null) {

+                            // this should not seriously happen.

+                            monitor.setResult("Failed to find a temp directory in %1$s.", osSdkRoot);

+                            return false;

+                        }

+

+                        // try to move the current dest dir to the temp/old one

+                        if (!destFolder.renameTo(renamedDestFolder)) {

+                            monitor.setResult("Failed to rename directory %1$s to %2$s.",

+                                    destFolder.getPath(), renamedDestFolder.getPath());

+                            renameFailedForDir = destFolder;

+                        }

+                    }

+

+                    move1done = (renameFailedForDir == null);

+                }

+

+                // Case where there's no dest dir or we successfully moved it to temp/old

+                // We not try to move the temp/unzip to the dest dir

+                if (move1done && !move2done) {

+                    if (renameFailedForDir == null && !unzipDestFolder.renameTo(destFolder)) {

+                        monitor.setResult("Failed to rename directory %1$s to %2$s",

+                                unzipDestFolder.getPath(), destFolder.getPath());

+                        renameFailedForDir = unzipDestFolder;

+                    }

+

+                    move2done = (renameFailedForDir == null);

+                }

+

+                if (renameFailedForDir != null) {

+                    if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_WINDOWS) {

+

+                        String msg = String.format(

+                                "-= Warning ! =-\n" +

+                                "A folder failed to be renamed or moved. On Windows this " +

+                                "typically means that a program is using that folder (for example " +

+                                "Windows Explorer or your anti-virus software.)\n" +

+                                "Please momentarily deactivate your anti-virus software.\n" +

+                                "Please also close any running programs that may be accessing " +

+                                "the directory '%1$s'.\n" +

+                                "When ready, press YES to try again.",

+                                renameFailedForDir.getPath());

+

+                        if (monitor.displayPrompt("SDK Manager: failed to install", msg)) {

+                            // loop, trying to rename the temp dir into the destination

+                            continue;

+                        }

+

+                    }

                     return false;

                 }

-

-                if (!destFolder.renameTo(renamedDestFolder)) {

-                    monitor.setResult("Failed to rename directory %1$s to %2$s",

-                            destFolder.getPath(), renamedDestFolder.getPath());

-                    renameFailedForDir = destFolder;

-                }

-            }

-

-            if (renameFailedForDir == null && !unzipDestFolder.renameTo(destFolder)) {

-                monitor.setResult("Failed to rename directory %1$s to %2$s",

-                        unzipDestFolder.getPath(), destFolder.getPath());

-                renameFailedForDir = unzipDestFolder;

-            }

-

-            if (renameFailedForDir != null) {

-                if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_WINDOWS) {

-                    monitor.setResult(

-                            "-= Warning ! =-\n" +

-                            "A folder failed to be renamed or moved. On Windows this " +

-                            "typically means that a program is using that folder (for example " +

-                            "Windows Explorer.) Please close all running programs that may be " +

-                            "locking the directory '%1$s' and try again.",

-                            renameFailedForDir.getPath());

-                }

-                return false;

+                break;

             }

 

             unzipDestFolder = null;

@@ -805,8 +904,12 @@
                 }

 

                 // if needed set the permissions.

-                if (usingUnixPerm) {

-                    setPermission(destFile, entry.getUnixMode());

+                if (usingUnixPerm && destFile.isFile()) {

+                    // get the mode and test if it contains the executable bit

+                    int mode = entry.getUnixMode();

+                    if ((mode & 0111) != 0) {

+                        setExecutablePermission(destFile);

+                    }

                 }

 

                 // Increment progress bar to match. We update only between files.

@@ -844,7 +947,7 @@
     }

 

     /**

-     * Finds a temp folder in the form of osBasePath/temp/prefix.suffixNNN.

+     * Creates a temp folder in the form of osBasePath/temp/prefix.suffixNNN.

      * <p/>

      * This operation is not atomic so there's no guarantee the folder can't get

      * created in between. This is however unlikely and the caller can assume the

@@ -853,8 +956,8 @@
      * Returns null if no such folder can be found (e.g. if all candidates exist,

      * which is rather unlikely) or if the base temp folder cannot be created.

      */

-    private File findTempFolder(String osBasePath, String prefix, String suffix) {

-        File baseTempFolder = new File(osBasePath, "temp");

+    private File createTempFolder(String osBasePath, String prefix, String suffix) {

+        File baseTempFolder = getTempFolder(osBasePath);

 

         if (!baseTempFolder.isDirectory()) {

             if (!baseTempFolder.mkdirs()) {

@@ -873,6 +976,15 @@
     }

 

     /**

+     * Returns the temp folder used by the SDK Manager.

+     * This folder is always at osBasePath/temp.

+     */

+    private File getTempFolder(String osBasePath) {

+        File baseTempFolder = new File(osBasePath, "temp");     //$NON-NLS-1$

+        return baseTempFolder;

+    }

+

+    /**

      * Deletes a file or a directory.

      * Directories are deleted recursively.

      * The argument can be null.

@@ -926,19 +1038,14 @@
     }

 

     /**

-     * Sets the Unix permission on a file or folder.

+     * Sets the executable Unix permission (0777) on a file or folder.

      * @param file The file to set permissions on.

      * @param unixMode the permissions as received from {@link ZipArchiveEntry#getUnixMode()}.

      * @throws IOException

      */

-    private void setPermission(File file, int unixMode) throws IOException {

-        // permissions contains more than user/group/all, and we need the 777 display mode, so we

-        // convert it in octal string and take the last 3 digits.

-        String permission = String.format("%o", unixMode);

-        permission = permission.substring(permission.length() - 3, permission.length());

-

+    private void setExecutablePermission(File file) throws IOException {

         Runtime.getRuntime().exec(new String[] {

-           "chmod", permission, file.getAbsolutePath()

+           "chmod", "777", file.getAbsolutePath()

         });

     }

 }

diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DocPackage.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DocPackage.java
index 75879b8..edc4276 100755
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DocPackage.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DocPackage.java
@@ -32,7 +32,7 @@
 /**

  * Represents a doc XML node in an SDK repository.

  */

-public class DocPackage extends Package {

+public class DocPackage extends Package implements IPackageVersion {

 

     private final AndroidVersion mVersion;

 

@@ -56,6 +56,8 @@
      * Manually create a new package with one archive and the given attributes.

      * This is used to create packages from local directories in which case there must be

      * one archive which URL is the actual target location.

+     * <p/>

+     * By design, this creates a package with one and only one archive.

      */

     DocPackage(RepoSource source,

             Properties props,

@@ -101,21 +103,34 @@
     @Override

     public String getShortDescription() {

         if (mVersion.isPreview()) {

-            return String.format("Documentation for Android '%1$s' Preview SDK",

-                    mVersion.getCodename());

-        } else if (mVersion.getApiLevel() != 0) {

-            return String.format("Documentation for Android SDK, API %1$d", mVersion.getApiLevel());

+            return String.format("Documentation for Android '%1$s' Preview SDK, revision %2$s",

+                    mVersion.getCodename(),

+                    getRevision());

         } else {

-            return String.format("Documentation for Android SDK");

+            return String.format("Documentation for Android SDK, API %1$d, revision %2$s",

+                    mVersion.getApiLevel(),

+                    getRevision());

         }

     }

 

-    /** Returns a long description for an {@link IDescription}. */

+    /**

+     * Returns a long description for an {@link IDescription}.

+     *

+     * The long description is whatever the XML contains for the &lt;description&gt; field,

+     * or the short description if the former is empty.

+     */

     @Override

     public String getLongDescription() {

-        return String.format("%1$s,\nRevision %2$d.",

-                getShortDescription(),

-                getRevision());

+        String s = getDescription();

+        if (s == null || s.length() == 0) {

+            s = getShortDescription();

+        }

+

+        if (s.indexOf("revision") == -1) {

+            s += String.format("\nRevision %1$d", getRevision());

+        }

+

+        return s;

     }

 

     /**

diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ExtraPackage.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ExtraPackage.java
index 74e1c59..7f3d0e7 100755
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ExtraPackage.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ExtraPackage.java
@@ -31,10 +31,9 @@
 /**

  * Represents a extra XML node in an SDK repository.

  */

-public class ExtraPackage extends Package {

+public class ExtraPackage extends MinToolsPackage {

 

     private static final String PROP_PATH          = "Extra.Path";         //$NON-NLS-1$

-    private static final String PROP_MIN_TOOLS_REV = "Extra.MinToolsRev";  //$NON-NLS-1$

 

     /**

      * The install folder name. It must be a single-segment path.

@@ -45,33 +44,22 @@
     private final String mPath;

 

     /**

-     * The minimal revision of the tools package required by this extra package, if > 0,

-     * or {@link #MIN_TOOLS_REV_NOT_SPECIFIED} if there is no such requirement.

-     */

-    private final int mMinToolsRevision;

-

-    /**

-     * The value of {@link #mMinToolsRevision} when the {@link SdkRepository#NODE_MIN_TOOLS_REV}

-     * was not specified in the XML source.

-     */

-    public static final int MIN_TOOLS_REV_NOT_SPECIFIED = 0;

-

-    /**

      * Creates a new tool package from the attributes and elements of the given XML node.

      * <p/>

      * This constructor should throw an exception if the package cannot be created.

      */

     ExtraPackage(RepoSource source, Node packageNode, Map<String,String> licenses) {

         super(source, packageNode, licenses);

+

         mPath = XmlParserUtils.getXmlString(packageNode, SdkRepository.NODE_PATH);

-        mMinToolsRevision = XmlParserUtils.getXmlInt(packageNode, SdkRepository.NODE_MIN_TOOLS_REV,

-                MIN_TOOLS_REV_NOT_SPECIFIED);

     }

 

     /**

      * Manually create a new package with one archive and the given attributes or properties.

      * This is used to create packages from local directories in which case there must be

      * one archive which URL is the actual target location.

+     * <p/>

+     * By design, this creates a package with one and only one archive.

      */

     ExtraPackage(RepoSource source,

             Properties props,

@@ -92,11 +80,9 @@
                 archiveOs,

                 archiveArch,

                 archiveOsPath);

+

         // The path argument comes before whatever could be in the properties

         mPath = path != null ? path : getProperty(props, PROP_PATH, path);

-

-        mMinToolsRevision = Integer.parseInt(getProperty(props, PROP_MIN_TOOLS_REV,

-                Integer.toString(MIN_TOOLS_REV_NOT_SPECIFIED)));

     }

 

     /**

@@ -109,8 +95,8 @@
 

         props.setProperty(PROP_PATH, mPath);

 

-        if (mMinToolsRevision != MIN_TOOLS_REV_NOT_SPECIFIED) {

-            props.setProperty(PROP_MIN_TOOLS_REV, Integer.toString(mMinToolsRevision));

+        if (getMinToolsRevision() != MIN_TOOLS_REV_NOT_SPECIFIED) {

+            props.setProperty(PROP_MIN_TOOLS_REV, Integer.toString(getMinToolsRevision()));

         }

     }

 

@@ -137,14 +123,6 @@
         return mPath;

     }

 

-    /**

-     * The minimal revision of the tools package required by this extra package, if > 0,

-     * or {@link #MIN_TOOLS_REV_NOT_SPECIFIED} if there is no such requirement.

-     */

-    public int getMinToolsRevision() {

-        return mMinToolsRevision;

-    }

-

     /** Returns a short description for an {@link IDescription}. */

     @Override

     public String getShortDescription() {

@@ -174,25 +152,29 @@
                 name,

                 getRevision());

 

-        if (mMinToolsRevision != MIN_TOOLS_REV_NOT_SPECIFIED) {

-            s += String.format(" (tools rev: %1$d)", mMinToolsRevision);

-        }

-

         return s;

     }

 

-    /** Returns a long description for an {@link IDescription}. */

+    /**

+     * Returns a long description for an {@link IDescription}.

+     *

+     * The long description is whatever the XML contains for the &lt;description&gt; field,

+     * or the short description if the former is empty.

+     */

     @Override

     public String getLongDescription() {

-        String s = String.format("Extra %1$s package, revision %2$d",

-                getPath(),

-                getRevision());

-

-        if (mMinToolsRevision != MIN_TOOLS_REV_NOT_SPECIFIED) {

-            s += String.format(" (min tools rev.: %1$d)", mMinToolsRevision);

+        String s = getDescription();

+        if (s == null || s.length() == 0) {

+            s = String.format("Extra %1$s package", getPath());

         }

 

-        s += ".";

+        if (s.indexOf("revision") == -1) {

+            s += String.format("\nRevision %1$d", getRevision());

+        }

+

+        if (getMinToolsRevision() != MIN_TOOLS_REV_NOT_SPECIFIED) {

+            s += String.format("\nRequires tools revision %1$d", getMinToolsRevision());

+        }

 

         return s;

     }

diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/IPackageVersion.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/IPackageVersion.java
new file mode 100755
index 0000000..46d7b5d
--- /dev/null
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/IPackageVersion.java
@@ -0,0 +1,31 @@
+/*

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package com.android.sdklib.internal.repository;

+

+import com.android.sdklib.AndroidVersion;

+

+/**

+ * Interface for packages that provide an {@link AndroidVersion}.

+ */

+public interface IPackageVersion {

+

+    /**

+     * Returns the version, for platform, add-on and doc packages.

+     * Can be 0 if this is a local package of unknown api-level.

+     */

+    public abstract AndroidVersion getVersion();

+}

diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ITaskMonitor.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ITaskMonitor.java
index 85596ba..e08e27c 100755
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ITaskMonitor.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ITaskMonitor.java
@@ -81,4 +81,17 @@
      * tickCount must be 1 or more.

      */

     public ITaskMonitor createSubMonitor(int tickCount);

+

+    /**

+     * Display a yes/no question dialog box.

+     *

+     * Implementations MUST allow this to be called from any thread, e.g. by

+     * making sure the dialog is opened synchronously in the ui thread.

+     *

+     * @param title The title of the dialog box

+     * @param message The error message

+     * @return true if YES was clicked.

+     */

+    public boolean displayPrompt(final String title, final String message);

+

 }

diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/MinToolsPackage.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/MinToolsPackage.java
new file mode 100755
index 0000000..d5892f3
--- /dev/null
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/MinToolsPackage.java
@@ -0,0 +1,93 @@
+/*

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package com.android.sdklib.internal.repository;

+

+import com.android.sdklib.internal.repository.Archive.Arch;

+import com.android.sdklib.internal.repository.Archive.Os;

+import com.android.sdklib.repository.SdkRepository;

+

+import org.w3c.dom.Node;

+

+import java.util.Map;

+import java.util.Properties;

+

+/**

+ * Represents an XML node in an SDK repository that has a min-tools-rev requirement.

+ * This is either a {@link PlatformPackage} or an {@link ExtraPackage}.

+ */

+public abstract class MinToolsPackage extends Package {

+

+    protected static final String PROP_MIN_TOOLS_REV = "Platform.MinToolsRev";  //$NON-NLS-1$

+

+    /**

+     * The minimal revision of the tools package required by this extra package, if > 0,

+     * or {@link #MIN_TOOLS_REV_NOT_SPECIFIED} if there is no such requirement.

+     */

+    private final int mMinToolsRevision;

+

+    /**

+     * The value of {@link #mMinToolsRevision} when the {@link SdkRepository#NODE_MIN_TOOLS_REV}

+     * was not specified in the XML source.

+     */

+    public static final int MIN_TOOLS_REV_NOT_SPECIFIED = 0;

+

+    /**

+     * Creates a new package from the attributes and elements of the given XML node.

+     * <p/>

+     * This constructor should throw an exception if the package cannot be created.

+     */

+    MinToolsPackage(RepoSource source, Node packageNode, Map<String,String> licenses) {

+        super(source, packageNode, licenses);

+

+        mMinToolsRevision = XmlParserUtils.getXmlInt(packageNode, SdkRepository.NODE_MIN_TOOLS_REV,

+                MIN_TOOLS_REV_NOT_SPECIFIED);

+    }

+

+    /**

+     * Manually create a new package with one archive and the given attributes.

+     * This is used to create packages from local directories in which case there must be

+     * one archive which URL is the actual target location.

+     * <p/>

+     * Properties from props are used first when possible, e.g. if props is non null.

+     * <p/>

+     * By design, this creates a package with one and only one archive.

+     */

+    public MinToolsPackage(

+            RepoSource source,

+            Properties props,

+            int revision,

+            String license,

+            String description,

+            String descUrl,

+            Os archiveOs,

+            Arch archiveArch,

+            String archiveOsPath) {

+        super(source, props, revision, license, description, descUrl,

+                archiveOs, archiveArch, archiveOsPath);

+

+        mMinToolsRevision = Integer.parseInt(getProperty(props, PROP_MIN_TOOLS_REV,

+                Integer.toString(MIN_TOOLS_REV_NOT_SPECIFIED)));

+    }

+

+    /**

+     * The minimal revision of the tools package required by this extra package, if > 0,

+     * or {@link #MIN_TOOLS_REV_NOT_SPECIFIED} if there is no such requirement.

+     */

+    public int getMinToolsRevision() {

+        return mMinToolsRevision;

+    }

+}

diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Package.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Package.java
index 69d526b..657bb14 100755
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Package.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Package.java
@@ -96,8 +96,10 @@
      * Manually create a new package with one archive and the given attributes.

      * This is used to create packages from local directories in which case there must be

      * one archive which URL is the actual target location.

-     *

+     * <p/>

      * Properties from props are used first when possible, e.g. if props is non null.

+     * <p/>

+     * By design, this creates a package with one and only one archive.

      */

     public Package(

             RepoSource source,

diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformPackage.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformPackage.java
index e95656a..c8d79a0 100755
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformPackage.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformPackage.java
@@ -33,10 +33,9 @@
 /**

  * Represents a platform XML node in an SDK repository.

  */

-public class PlatformPackage extends Package {

+public class PlatformPackage extends MinToolsPackage implements IPackageVersion {

 

-    private static final String PROP_VERSION       = "Platform.Version";      //$NON-NLS-1$

-    private static final String PROP_MIN_TOOLS_REV = "Platform.MinToolsRev";  //$NON-NLS-1$

+    protected static final String PROP_VERSION       = "Platform.Version";      //$NON-NLS-1$

 

     /** The package version, for platform, add-on and doc packages. */

     private final AndroidVersion mVersion;

@@ -45,24 +44,13 @@
     private final String mVersionName;

 

     /**

-     * The minimal revision of the tools package required by this extra package, if > 0,

-     * or {@link #MIN_TOOLS_REV_NOT_SPECIFIED} if there is no such requirement.

-     */

-    private final int mMinToolsRevision;

-

-    /**

-     * The value of {@link #mMinToolsRevision} when the {@link SdkRepository#NODE_MIN_TOOLS_REV}

-     * was not specified in the XML source.

-     */

-    public static final int MIN_TOOLS_REV_NOT_SPECIFIED = 0;

-

-    /**

      * Creates a new platform package from the attributes and elements of the given XML node.

      * <p/>

      * This constructor should throw an exception if the package cannot be created.

      */

     PlatformPackage(RepoSource source, Node packageNode, Map<String,String> licenses) {

         super(source, packageNode, licenses);

+

         mVersionName = XmlParserUtils.getXmlString(packageNode, SdkRepository.NODE_VERSION);

         int apiLevel = XmlParserUtils.getXmlInt   (packageNode, SdkRepository.NODE_API_LEVEL, 0);

         String codeName = XmlParserUtils.getXmlString(packageNode, SdkRepository.NODE_CODENAME);

@@ -70,9 +58,6 @@
             codeName = null;

         }

         mVersion = new AndroidVersion(apiLevel, codeName);

-

-        mMinToolsRevision = XmlParserUtils.getXmlInt(packageNode, SdkRepository.NODE_MIN_TOOLS_REV,

-                MIN_TOOLS_REV_NOT_SPECIFIED);

     }

 

     /**

@@ -80,6 +65,8 @@
      * must have {@link IAndroidTarget#isPlatform()} true) from the {@link SdkManager}.

      * This is used to list local SDK folders in which case there is one archive which

      * URL is the actual target location.

+     * <p/>

+     * By design, this creates a package with one and only one archive.

      */

     PlatformPackage(IAndroidTarget target, Properties props) {

         super(  null,                       //source

@@ -95,9 +82,6 @@
 

         mVersion = target.getVersion();

         mVersionName  = target.getVersionName();

-

-        mMinToolsRevision = Integer.parseInt(getProperty(props, PROP_MIN_TOOLS_REV,

-                Integer.toString(MIN_TOOLS_REV_NOT_SPECIFIED)));

     }

 

     /**

@@ -114,8 +98,8 @@
             props.setProperty(PROP_VERSION, mVersionName);

         }

 

-        if (mMinToolsRevision != MIN_TOOLS_REV_NOT_SPECIFIED) {

-            props.setProperty(PROP_MIN_TOOLS_REV, Integer.toString(mMinToolsRevision));

+        if (getMinToolsRevision() != MIN_TOOLS_REV_NOT_SPECIFIED) {

+            props.setProperty(PROP_MIN_TOOLS_REV, Integer.toString(getMinToolsRevision()));

         }

     }

 

@@ -129,38 +113,43 @@
         return mVersion;

     }

 

-    /**

-     * The minimal revision of the tools package required by this extra package, if > 0,

-     * or {@link #MIN_TOOLS_REV_NOT_SPECIFIED} if there is no such requirement.

-     */

-    public int getMinToolsRevision() {

-        return mMinToolsRevision;

-    }

-

     /** Returns a short description for an {@link IDescription}. */

     @Override

     public String getShortDescription() {

         String s;

 

         if (mVersion.isPreview()) {

-            s = String.format("SDK Platform Android %1$s (Preview)", getVersionName());

+            s = String.format("SDK Platform Android %1$s Preview, revision %2$s",

+                    getVersionName(),

+                    getRevision());

         } else {

-            s = String.format("SDK Platform Android %1$s, API %2$d",

+            s = String.format("SDK Platform Android %1$s, API %2$d, revision %3$s",

                 getVersionName(),

-                mVersion.getApiLevel());

-        }

-

-        if (mMinToolsRevision != MIN_TOOLS_REV_NOT_SPECIFIED) {

-            s += String.format(" (tools rev: %1$d)", mMinToolsRevision);

+                mVersion.getApiLevel(),

+                getRevision());

         }

 

         return s;

     }

 

-    /** Returns a long description for an {@link IDescription}. */

+    /**

+     * Returns a long description for an {@link IDescription}.

+     *

+     * The long description is whatever the XML contains for the &lt;description&gt; field,

+     * or the short description if the former is empty.

+     */

     @Override

     public String getLongDescription() {

-        return getShortDescription() + ".";

+        String s = getDescription();

+        if (s == null || s.length() == 0) {

+            s = getShortDescription();

+        }

+

+        if (s.indexOf("revision") == -1) {

+            s += String.format("\nRevision %1$d", getRevision());

+        }

+

+        return s;

     }

 

     /**

diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/RepoSource.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/RepoSource.java
index d86859d..573454d 100755
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/RepoSource.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/RepoSource.java
@@ -185,23 +185,34 @@
             }

         }

 

-        if (!validated) {

+        // If any exception was handled during the URL fetch, display it now.

+        if (exception[0] != null) {

             mFetchError = "Failed to fetch URL";

 

-            String reason = "Unknown";

-            if (exception[0] != null) {

-                if (exception[0] instanceof FileNotFoundException) {

-                    reason = "File not found";

-                } else if (exception[0] instanceof SSLKeyException) {

-                    reason = "SSL error. You might want to force download through http in the settings.";

-                } else if (exception[0].getMessage() != null) {

-                    reason = exception[0].getMessage();

-                }

+            String reason = null;

+            if (exception[0] instanceof FileNotFoundException) {

+                // FNF has no useful getMessage, so we need to special handle it.

+                reason = "File not found";

+                mFetchError += ": " + reason;

+            } else if (exception[0] instanceof SSLKeyException) {

+                // That's a common error and we have a pref for it.

+                reason = "HTTPS SSL error. You might want to force download through HTTP in the settings.";

+                mFetchError += ": HTTPS SSL error";

+            } else if (exception[0].getMessage() != null) {

+                reason = exception[0].getMessage();

+            } else {

+                // We don't know what's wrong. Let's give the exception class at least.

+                reason = String.format("Unknown (%1$s)", exception[0].getClass().getName());

             }

 

             monitor.setResult("Failed to fetch URL %1$s, reason: %2$s", url, reason);

         }

 

+        // Stop here if we failed to validate the XML. We don't want to load it.

+        if (!validated) {

+            return;

+        }

+

         monitor.incProgress(1);

 

         if (xml != null) {

@@ -274,7 +285,7 @@
                 }

             }

 

-        } catch (IOException e) {

+        } catch (Exception e) {

             outException[0] = e;

         }

 

@@ -289,14 +300,26 @@
 

         try {

             Validator validator = getValidator();

+

+            if (validator == null) {

+                monitor.setResult(

+                        "XML verification failed for %1$s.\nNo suitable XML Schema Validator could be found in your Java environment. Please consider updating your version of Java.",

+                        url);

+                return false;

+            }

+

             xml.reset();

             validator.validate(new StreamSource(xml));

             return true;

 

         } catch (Exception e) {

+            String s = e.getMessage();

+            if (s == null) {

+                s = e.getClass().getName();

+            }

             monitor.setResult("XML verification failed for %1$s.\nError: %2$s",

                     url,

-                    e.getMessage());

+                    s);

         }

 

         return false;

@@ -309,10 +332,14 @@
         InputStream xsdStream = SdkRepository.getXsdStream();

         SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);

 

+        if (factory == null) {

+            return null;

+        }

+

         // This may throw a SAX Exception if the schema itself is not a valid XSD

         Schema schema = factory.newSchema(new StreamSource(xsdStream));

 

-        Validator validator = schema.newValidator();

+        Validator validator = schema == null ? null : schema.newValidator();

 

         return validator;

     }

diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ToolPackage.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ToolPackage.java
index ee13379..bf70f91 100755
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ToolPackage.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ToolPackage.java
@@ -45,6 +45,8 @@
      * Manually create a new package with one archive and the given attributes or properties.

      * This is used to create packages from local directories in which case there must be

      * one archive which URL is the actual target location.

+     * <p/>

+     * By design, this creates a package with one and only one archive.

      */

     ToolPackage(

             RepoSource source,

@@ -76,7 +78,16 @@
     /** Returns a long description for an {@link IDescription}. */

     @Override

     public String getLongDescription() {

-        return getShortDescription() + ".";

+        String s = getDescription();

+        if (s == null || s.length() == 0) {

+            s = getShortDescription();

+        }

+

+        if (s.indexOf("revision") == -1) {

+            s += String.format("\nRevision %1$d", getRevision());

+        }

+

+        return s;

     }

 

     /**

diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifest.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifest.java
new file mode 100644
index 0000000..c4fa8bc
--- /dev/null
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifest.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sdklib.xml;
+
+/**
+ * Helper and Constants for the AndroidManifest.xml file.
+ *
+ */
+public final class AndroidManifest {
+
+    public final static String NODE_MANIFEST = "manifest"; //$NON-NLS-1$
+    public final static String NODE_APPLICATION = "application"; //$NON-NLS-1$
+    public final static String NODE_ACTIVITY = "activity"; //$NON-NLS-1$
+    public final static String NODE_SERVICE = "service"; //$NON-NLS-1$
+    public final static String NODE_RECEIVER = "receiver"; //$NON-NLS-1$
+    public final static String NODE_PROVIDER = "provider"; //$NON-NLS-1$
+    public final static String NODE_INTENT = "intent-filter"; //$NON-NLS-1$
+    public final static String NODE_ACTION = "action"; //$NON-NLS-1$
+    public final static String NODE_CATEGORY = "category"; //$NON-NLS-1$
+    public final static String NODE_USES_SDK = "uses-sdk"; //$NON-NLS-1$
+    public final static String NODE_INSTRUMENTATION = "instrumentation"; //$NON-NLS-1$
+    public final static String NODE_USES_LIBRARY = "uses-library"; //$NON-NLS-1$
+
+    public final static String ATTRIBUTE_PACKAGE = "package"; //$NON-NLS-1$
+    public final static String ATTRIBUTE_NAME = "name"; //$NON-NLS-1$
+    public final static String ATTRIBUTE_PROCESS = "process"; //$NON-NLS-$
+    public final static String ATTRIBUTE_DEBUGGABLE = "debuggable"; //$NON-NLS-$
+    public final static String ATTRIBUTE_MIN_SDK_VERSION = "minSdkVersion"; //$NON-NLS-$
+    public final static String ATTRIBUTE_TARGET_PACKAGE = "targetPackage"; //$NON-NLS-1$
+    public final static String ATTRIBUTE_EXPORTED = "exported"; //$NON-NLS-1$
+
+
+    /**
+     * Combines a java package, with a class value from the manifest to make a fully qualified
+     * class name
+     * @param javaPackage the java package from the manifest.
+     * @param className the class name from the manifest.
+     * @return the fully qualified class name.
+     */
+    public static String combinePackageAndClassName(String javaPackage, String className) {
+        if (className == null || className.length() == 0) {
+            return javaPackage;
+        }
+        if (javaPackage == null || javaPackage.length() == 0) {
+            return className;
+        }
+
+        // the class name can be a subpackage (starts with a '.'
+        // char), a simple class name (no dot), or a full java package
+        boolean startWithDot = (className.charAt(0) == '.');
+        boolean hasDot = (className.indexOf('.') != -1);
+        if (startWithDot || hasDot == false) {
+
+            // add the concatenation of the package and class name
+            if (startWithDot) {
+                return javaPackage + className;
+            } else {
+                return javaPackage + '.' + className;
+            }
+        } else {
+            // just add the class as it should be a fully qualified java name.
+            return className;
+        }
+    }
+
+}
diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java
index fc34aeb..641cd81 100644
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java
+++ b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java
@@ -18,7 +18,9 @@
 
 import com.android.sdklib.SdkConstants;
 
+import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
 import javax.xml.XMLConstants;
 import javax.xml.namespace.NamespaceContext;
@@ -39,7 +41,8 @@
         private final static AndroidNamespaceContext sThis = new AndroidNamespaceContext(
                 DEFAULT_NS_PREFIX);
 
-        private String mAndroidPrefix;
+        private final String mAndroidPrefix;
+        private final List<String> mAndroidPrefixes = new ArrayList<String>();
 
         /**
          * Returns the default {@link AndroidNamespaceContext}.
@@ -54,6 +57,7 @@
          */
         public AndroidNamespaceContext(String androidPrefix) {
             mAndroidPrefix = androidPrefix;
+            mAndroidPrefixes.add(mAndroidPrefix);
         }
 
         public String getNamespaceURI(String prefix) {
@@ -67,14 +71,18 @@
         }
 
         public String getPrefix(String namespaceURI) {
-            // This isn't necessary for our use.
-            assert false;
+            if (SdkConstants.NS_RESOURCES.equals(namespaceURI)) {
+                return mAndroidPrefix;
+            }
+
             return null;
         }
 
         public Iterator<?> getPrefixes(String namespaceURI) {
-            // This isn't necessary for our use.
-            assert false;
+            if (SdkConstants.NS_RESOURCES.equals(namespaceURI)) {
+                return mAndroidPrefixes.iterator();
+            }
+
             return null;
         }
     }
diff --git a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/ManifestConstants.java b/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/ManifestConstants.java
deleted file mode 100644
index 2e20f02..0000000
--- a/tools/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/ManifestConstants.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.sdklib.xml;
-
-/**
- * Constants for nodes and attributes of the AndroidManifest.xml file.
- *
- */
-public final class ManifestConstants {
-
-    public final static String NODE_MANIFEST = "manifest"; //$NON-NLS-1$
-    public final static String NODE_APPLICATION = "application"; //$NON-NLS-1$
-    public final static String NODE_ACTIVITY = "activity"; //$NON-NLS-1$
-    public final static String NODE_SERVICE = "service"; //$NON-NLS-1$
-    public final static String NODE_RECEIVER = "receiver"; //$NON-NLS-1$
-    public final static String NODE_PROVIDER = "provider"; //$NON-NLS-1$
-    public final static String NODE_INTENT = "intent-filter"; //$NON-NLS-1$
-    public final static String NODE_ACTION = "action"; //$NON-NLS-1$
-    public final static String NODE_CATEGORY = "category"; //$NON-NLS-1$
-    public final static String NODE_USES_SDK = "uses-sdk"; //$NON-NLS-1$
-    public final static String NODE_INSTRUMENTATION = "instrumentation"; //$NON-NLS-1$
-    public final static String NODE_USES_LIBRARY = "uses-library"; //$NON-NLS-1$
-
-    public final static String ATTRIBUTE_PACKAGE = "package"; //$NON-NLS-1$
-    public final static String ATTRIBUTE_NAME = "name"; //$NON-NLS-1$
-    public final static String ATTRIBUTE_PROCESS = "process"; //$NON-NLS-$
-    public final static String ATTRIBUTE_DEBUGGABLE = "debuggable"; //$NON-NLS-$
-    public final static String ATTRIBUTE_MIN_SDK_VERSION = "minSdkVersion"; //$NON-NLS-$
-    public final static String ATTRIBUTE_TARGET_PACKAGE = "targetPackage"; //$NON-NLS-1$
-    public final static String ATTRIBUTE_EXPORTED = "exported"; //$NON-NLS-1$
-}
diff --git a/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/internal/repository/MockAddonPackage.java b/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/internal/repository/MockAddonPackage.java
new file mode 100755
index 0000000..4d4199f
--- /dev/null
+++ b/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/internal/repository/MockAddonPackage.java
@@ -0,0 +1,136 @@
+/*

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package com.android.sdklib.internal.repository;

+

+import com.android.sdklib.AndroidVersion;

+import com.android.sdklib.IAndroidTarget;

+

+/**

+ * A mock {@link AddonPackage} for testing.

+ *

+ * By design, this package contains one and only one archive.

+ */

+public class MockAddonPackage extends AddonPackage {

+

+    /**

+     * Creates a {@link MockAddonTarget} with the requested base platform and addon revision

+     * and then a {@link MockAddonPackage} wrapping it.

+     *

+     * By design, this package contains one and only one archive.

+     */

+    public MockAddonPackage(MockPlatformPackage basePlatform, int revision) {

+        super(new MockAddonTarget(basePlatform.getTarget(), revision), null /*props*/);

+    }

+

+    /**

+     * A mock AddonTarget.

+     * This reimplements the minimum needed from the interface for our limited testing needs.

+     */

+    static class MockAddonTarget implements IAndroidTarget {

+

+        private final IAndroidTarget mParentTarget;

+        private final int mRevision;

+

+        public MockAddonTarget(IAndroidTarget parentTarget, int revision) {

+            mParentTarget = parentTarget;

+            mRevision = revision;

+        }

+

+        public String getClasspathName() {

+            return null;

+        }

+

+        public String getDefaultSkin() {

+            return null;

+        }

+

+        public String getDescription() {

+            return "mock addon target";

+        }

+

+        public String getFullName() {

+            return "mock addon target";

+        }

+

+        public String getLocation() {

+            return "";

+        }

+

+        public String getName() {

+            return "mock addon target";

+        }

+

+        public IOptionalLibrary[] getOptionalLibraries() {

+            return null;

+        }

+

+        public IAndroidTarget getParent() {

+            return mParentTarget;

+        }

+

+        public String getPath(int pathId) {

+            return null;

+        }

+

+        public String[] getPlatformLibraries() {

+            return null;

+        }

+

+        public int getRevision() {

+            return mRevision;

+        }

+

+        public String[] getSkins() {

+            return null;

+        }

+

+        public int getUsbVendorId() {

+            return 0;

+        }

+

+        public String getVendor() {

+            return null;

+        }

+

+        public AndroidVersion getVersion() {

+            return mParentTarget.getVersion();

+        }

+

+        public String getVersionName() {

+            return String.format("mock-addon-%1$d", getVersion().getApiLevel());

+        }

+

+        public String hashString() {

+            return getVersionName();

+        }

+

+        /** Returns false for an addon. */

+        public boolean isPlatform() {

+            return false;

+        }

+

+        public boolean isCompatibleBaseFor(IAndroidTarget target) {

+            throw new UnsupportedOperationException("Implement this as needed for tests");

+        }

+

+        public int compareTo(IAndroidTarget o) {

+            throw new UnsupportedOperationException("Implement this as needed for tests");

+        }

+

+    }

+

+}

diff --git a/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/internal/repository/MockPlatformPackage.java b/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/internal/repository/MockPlatformPackage.java
new file mode 100755
index 0000000..b840b82
--- /dev/null
+++ b/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/internal/repository/MockPlatformPackage.java
@@ -0,0 +1,169 @@
+/*

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package com.android.sdklib.internal.repository;

+

+import com.android.sdklib.AndroidVersion;

+import com.android.sdklib.IAndroidTarget;

+

+import java.util.Properties;

+

+/**

+ * A mock {@link PlatformPackage} for testing.

+ *

+ * By design, this package contains one and only one archive.

+ */

+public class MockPlatformPackage extends PlatformPackage {

+

+    private final IAndroidTarget mTarget;

+

+    /**

+     * Creates a {@link MockPlatformTarget} with the requested API and revision

+     * and then a {@link MockPlatformPackage} wrapping it.

+     *

+     * By design, this package contains one and only one archive.

+     */

+    public MockPlatformPackage(int apiLevel, int revision) {

+        this(new MockPlatformTarget(apiLevel, revision), null /*props*/);

+    }

+

+    /**

+     * Creates a {@link MockPlatformTarget} with the requested API and revision

+     * and then a {@link MockPlatformPackage} wrapping it.

+     *

+     * Also sets the min-tools-rev of the platform.

+     *

+     * By design, this package contains one and only one archive.

+     */

+    public MockPlatformPackage(int apiLevel, int revision, int min_tools_rev) {

+        this(new MockPlatformTarget(apiLevel, revision), createProps(min_tools_rev));

+    }

+

+    /** A little trick to be able to capture the target new after passing it to the super. */

+    private MockPlatformPackage(IAndroidTarget target, Properties props) {

+        super(target, props);

+        mTarget = target;

+    }

+

+    private static Properties createProps(int min_tools_rev) {

+        Properties props = new Properties();

+        props.setProperty(PlatformPackage.PROP_MIN_TOOLS_REV, Integer.toString((min_tools_rev)));

+        return props;

+    }

+

+    public IAndroidTarget getTarget() {

+        return mTarget;

+    }

+

+    /**

+     * A mock PlatformTarget.

+     * This reimplements the minimum needed from the interface for our limited testing needs.

+     */

+    static class MockPlatformTarget implements IAndroidTarget {

+

+        private final int mApiLevel;

+        private final int mRevision;

+

+        public MockPlatformTarget(int apiLevel, int revision) {

+            mApiLevel = apiLevel;

+            mRevision = revision;

+

+        }

+

+        public String getClasspathName() {

+            return null;

+        }

+

+        public String getDefaultSkin() {

+            return null;

+        }

+

+        public String getDescription() {

+            return "mock platform target";

+        }

+

+        public String getFullName() {

+            return "mock platform target";

+        }

+

+        public String getLocation() {

+            return "";

+        }

+

+        public String getName() {

+            return "mock platform target";

+        }

+

+        public IOptionalLibrary[] getOptionalLibraries() {

+            return null;

+        }

+

+        public IAndroidTarget getParent() {

+            return null;

+        }

+

+        public String getPath(int pathId) {

+            return null;

+        }

+

+        public String[] getPlatformLibraries() {

+            return null;

+        }

+

+        public int getRevision() {

+            return mRevision;

+        }

+

+        public String[] getSkins() {

+            return null;

+        }

+

+        public int getUsbVendorId() {

+            return 0;

+        }

+

+        public String getVendor() {

+            return null;

+        }

+

+        public AndroidVersion getVersion() {

+            return new AndroidVersion(mApiLevel, null /*codename*/);

+        }

+

+        public String getVersionName() {

+            return String.format("android-%1$d", mApiLevel);

+        }

+

+        public String hashString() {

+            return getVersionName();

+        }

+

+        /** Returns true for a platform. */

+        public boolean isPlatform() {

+            return true;

+        }

+

+        public boolean isCompatibleBaseFor(IAndroidTarget target) {

+            throw new UnsupportedOperationException("Implement this as needed for tests");

+        }

+

+        public int compareTo(IAndroidTarget o) {

+            throw new UnsupportedOperationException("Implement this as needed for tests");

+        }

+

+    }

+

+}

diff --git a/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/internal/repository/MockToolPackage.java b/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/internal/repository/MockToolPackage.java
new file mode 100755
index 0000000..e1ce621
--- /dev/null
+++ b/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/internal/repository/MockToolPackage.java
@@ -0,0 +1,48 @@
+/*

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package com.android.sdklib.internal.repository;

+

+import com.android.sdklib.internal.repository.Archive.Arch;

+import com.android.sdklib.internal.repository.Archive.Os;

+

+/**

+ * A mock {@link ToolPackage} for testing.

+ *

+ * By design, this package contains one and only one archive.

+ */

+public class MockToolPackage extends ToolPackage {

+

+    /**

+     * Creates a {@link MockToolPackage} with the given revision and hardcoded defaults

+     * for everything else.

+     * <p/>

+     * By design, this creates a package with one and only one archive.

+     */

+    public MockToolPackage(int revision) {

+        super(

+            null, // source,

+            null, // props,

+            revision,

+            null, // license,

+            "desc", // description,

+            "url", // descUrl,

+            Os.getCurrentOs(), // archiveOs,

+            Arch.getCurrentArch(), // archiveArch,

+            "foo" // archiveOsPath

+            );

+    }

+}

diff --git a/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/repository/TestSdkRepository.java b/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/repository/TestSdkRepository.java
index b059e41..de50b6e 100755
--- a/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/repository/TestSdkRepository.java
+++ b/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/repository/TestSdkRepository.java
@@ -123,9 +123,9 @@
 

     /** Validate a valid sample using an InputStream */

     public void testValidateLocalRepositoryFile() throws Exception {

-

         InputStream xmlStream =

-            TestSdkRepository.class.getResourceAsStream("repository_sample.xml");

+            this.getClass().getClassLoader().getResourceAsStream(

+                             "com/android/sdklib/testdata/repository_sample.xml");

         Source source = new StreamSource(xmlStream);

 

         CaptureErrorHandler handler = new CaptureErrorHandler();

diff --git a/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/repository/repository_sample.xml b/tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/testdata/repository_sample.xml
similarity index 100%
rename from tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/repository/repository_sample.xml
rename to tools/sdkmanager/libs/sdklib/tests/com/android/sdklib/testdata/repository_sample.xml
diff --git a/tools/sdkmanager/libs/sdkuilib/.classpath b/tools/sdkmanager/libs/sdkuilib/.classpath
index 5a1790f..73592c4 100644
--- a/tools/sdkmanager/libs/sdkuilib/.classpath
+++ b/tools/sdkmanager/libs/sdkuilib/.classpath
@@ -1,9 +1,11 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/ANDROID_SWT"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/SdkLib"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/AndroidPrefs"/>
-	<classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src"/>

+	<classpathentry kind="src" path="tests"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

+	<classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/ANDROID_SWT"/>

+	<classpathentry combineaccessrules="false" kind="src" path="/SdkLib"/>

+	<classpathentry combineaccessrules="false" kind="src" path="/AndroidPrefs"/>

+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>

+	<classpathentry kind="output" path="bin"/>

+</classpath>

diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/ArchiveInfo.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/ArchiveInfo.java
new file mode 100755
index 0000000..83dc8ca
--- /dev/null
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/ArchiveInfo.java
@@ -0,0 +1,141 @@
+/*

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package com.android.sdkuilib.internal.repository;

+

+import com.android.sdklib.internal.repository.Archive;

+

+import java.util.ArrayList;

+import java.util.Collection;

+

+/**

+ * Represents an archive that we want to install.

+ * Note that the installer deals with archives whereas the user mostly sees packages

+ * but as far as we are concerned for installation there's a 1-to-1 mapping.

+ * <p/>

+ * A new archive is always a remote archive that needs to be downloaded and then

+ * installed. It can replace an existing local one. It can also depends on another

+ * (new or local) archive, which means the dependent archive needs to be successfully

+ * installed first. Finally this archive can also be a dependency for another one.

+ *

+ * @see ArchiveInfo#ArchiveInfo(Archive, Archive, ArchiveInfo)

+ */

+class ArchiveInfo {

+

+    private final Archive mNewArchive;

+    private final Archive mReplaced;

+    private final ArchiveInfo mDependsOn;

+    private final ArrayList<ArchiveInfo> mDependencyFor = new ArrayList<ArchiveInfo>();

+    private boolean mAccepted;

+    private boolean mRejected;

+

+    /**

+     *

+     * @param newArchive A "new archive" to be installed. This is always an archive

+     *          that comes from a remote site. This can not be null.

+     * @param replaced An optional local archive that the new one will replace.

+     *          Can be null if this archive does not replace anything.

+     * @param dependsOn An optional new or local dependency, that is an archive that

+     *          <em>this</em> archive depends upon. In other words, we can only install

+     *          this archive if the dependency has been successfully installed. It also

+     *          means we need to install the dependency first.

+     */

+    public ArchiveInfo(Archive newArchive, Archive replaced, ArchiveInfo dependsOn) {

+        mNewArchive = newArchive;

+        mReplaced = replaced;

+        mDependsOn = dependsOn;

+    }

+

+    /**

+     * Returns the "new archive" to be installed.

+     * This is always an archive that comes from a remote site.

+     */

+    public Archive getNewArchive() {

+        return mNewArchive;

+    }

+

+    /**

+     * Returns an optional local archive that the new one will replace.

+     * Can be null if this archive does not replace anything.

+     */

+    public Archive getReplaced() {

+        return mReplaced;

+    }

+

+    /**

+     * Returns an optional new or local dependency, that is an archive that <em>this</em>

+     * archive depends upon. In other words, we can only install this archive if the

+     * dependency has been successfully installed. It also means we need to install the

+     * dependency first.

+     */

+    public ArchiveInfo getDependsOn() {

+        return mDependsOn;

+    }

+

+    /**

+     * Returns true if this new archive is a dependency for <em>another</em> one that we

+     * want to install.

+     */

+    public boolean isDependencyFor() {

+        return mDependencyFor.size() > 0;

+    }

+

+    /**

+     * Adds an {@link ArchiveInfo} for which <em>this</em> package is a dependency.

+     * This means the package added here depends on this package.

+     */

+    public void addDependencyFor(ArchiveInfo dependencyFor) {

+        if (!mDependencyFor.contains(dependencyFor)) {

+            mDependencyFor.add(dependencyFor);

+        }

+    }

+

+    public Collection<ArchiveInfo> getDependenciesFor() {

+        return mDependencyFor;

+    }

+

+    /**

+     * Sets whether this archive was accepted (either manually by the user or

+     * automatically if it doesn't have a license) for installation.

+     */

+    public void setAccepted(boolean accepted) {

+        mAccepted = accepted;

+    }

+

+    /**

+     * Returns whether this archive was accepted (either manually by the user or

+     * automatically if it doesn't have a license) for installation.

+     */

+    public boolean isAccepted() {

+        return mAccepted;

+    }

+

+    /**

+     * Sets whether this archive was rejected manually by the user.

+     * An archive can neither accepted nor rejected.

+     */

+    public void setRejected(boolean rejected) {

+        mRejected = rejected;

+    }

+

+    /**

+     * Returns whether this archive was rejected manually by the user.

+     * An archive can neither accepted nor rejected.

+     */

+    public boolean isRejected() {

+        return mRejected;

+    }

+}

diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/AvdManagerPage.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/AvdManagerPage.java
index 5716edf..6cd0996 100755
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/AvdManagerPage.java
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/AvdManagerPage.java
@@ -56,6 +56,7 @@
                 mUpdaterData.getOsSdkRoot(),

                 mUpdaterData.getAvdManager(),

                 DisplayMode.MANAGER);

+        mAvdSelector.setSettingsController(mUpdaterData.getSettingsController());

     }

 

     @Override

diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/ISettingsPage.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/ISettingsPage.java
index 0d7179c..739c479 100755
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/ISettingsPage.java
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/ISettingsPage.java
@@ -52,6 +52,12 @@
      * Default: True.

      */

     public static final String KEY_ASK_ADB_RESTART = "sdkman.ask.adb.restart";   //$NON-NLS-1$

+    /**

+     * Setting to set the density of the monitor.

+     * Type: Integer.

+     * Default: -1

+     */

+    public static final String KEY_MONITOR_DENSITY = "sdkman.monitor.density"; //$NON-NLS-1$

 

     /** Loads settings from the given {@link Properties} container and update the page UI. */

     public abstract void loadSettings(Properties in_settings);

diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/LocalPackagesPage.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/LocalPackagesPage.java
index d4ab86f..833baac 100755
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/LocalPackagesPage.java
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/LocalPackagesPage.java
@@ -124,7 +124,7 @@
         mUpdateButton.addSelectionListener(new SelectionAdapter() {

             @Override

             public void widgetSelected(SelectionEvent e) {

-                onUpdateInstalledPackage();  //$hide$ (hide from SWT designer)

+                onUpdateSelected();  //$hide$ (hide from SWT designer)

             }

         });

 

@@ -255,7 +255,7 @@
         mDescriptionLabel.setText("");  //$NON-NLS1-$

     }

 

-    private void onUpdateInstalledPackage() {

+    private void onUpdateSelected() {

         mUpdaterData.updateOrInstallAll(null /*selectedArchives*/);

     }

 

diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/RemotePackagesPage.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/RemotePackagesPage.java
index 1898f66..861389f 100755
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/RemotePackagesPage.java
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/RemotePackagesPage.java
@@ -103,7 +103,7 @@
 

         mColumnSource = new TreeColumn(mTreeSources, SWT.NONE);

         mColumnSource.setWidth(289);

-        mColumnSource.setText("Sources, Packages and Archives");

+        mColumnSource.setText("Sites, Packages and Archives");

 

         mDescriptionContainer = new Group(parent, SWT.NONE);

         mDescriptionContainer.setLayout(new GridLayout(1, false));

@@ -272,7 +272,6 @@
     }

 

     private void selectCompatibleArchives(Object pkg, ITreeContentProvider provider) {

-        mTreeViewerSources.setExpandedState(pkg, true);

         for (Object archive : provider.getChildren(pkg)) {

             if (archive instanceof Archive) {

                 mTreeViewerSources.setChecked(archive, ((Archive) archive).isCompatible());

@@ -284,7 +283,32 @@
         SettingsController controller = mUpdaterData.getSettingsController();

         controller.setShowUpdateOnly(mUpdateOnlyCheckBox.getSelection());

         controller.saveSettings();

+

+        // Get the list of selected archives

+        ArrayList<Archive> archives = new ArrayList<Archive>();

+        for (Object element : mTreeViewerSources.getCheckedElements()) {

+            if (element instanceof Archive) {

+                archives.add((Archive) element);

+            }

+            // Deselect them all

+            mTreeViewerSources.setChecked(element, false);

+        }

+

         mTreeViewerSources.refresh();

+

+        // Now reselect those that still exist in the tree but only if they

+        // are compatible archives

+        for (Archive a : archives) {

+            if (a.isCompatible() && mTreeViewerSources.setChecked(a, true)) {

+                // If we managed to select the archive, also select the parent package.

+                // Technically we should only select the parent package if *all* the

+                // compatible archives children are selected. In practice we'll rarely

+                // have more than one compatible archive per package.

+                mTreeViewerSources.setChecked(a.getParentPackage(), true);

+            }

+        }

+

+        updateButtonsState();

     }

 

     private void onInstallSelectedArchives() {

diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/RepoSourcesAdapter.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/RepoSourcesAdapter.java
index de12666..fafa9c1 100755
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/RepoSourcesAdapter.java
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/RepoSourcesAdapter.java
@@ -208,7 +208,7 @@
                 packages = null;

             }

 

-            if (packages != null && source.getFetchError() != null) {

+            if (packages == null && source.getFetchError() != null) {

                 // Return a dummy entry to display the fetch error

                 return new Object[] { new RepoSourceError(source) };

             }

@@ -252,6 +252,9 @@
 

             } else if (element instanceof Package) {

                 return ((Package) element).getParentSource();

+

+            } else if (element instanceof Archive) {

+                return ((Archive) element).getParentPackage();

             }

             return null;

         }

diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SettingsController.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SettingsController.java
index a4b1a05..7c793e4 100755
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SettingsController.java
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SettingsController.java
@@ -18,9 +18,13 @@
 

 import com.android.prefs.AndroidLocation;

 import com.android.prefs.AndroidLocation.AndroidLocationException;

+import com.android.sdklib.ISdkLog;

+

+import org.eclipse.jface.dialogs.MessageDialog;

 

 import java.io.File;

 import java.io.FileInputStream;

+import java.io.FileNotFoundException;

 import java.io.FileOutputStream;

 import java.io.IOException;

 import java.util.Properties;

@@ -40,13 +44,16 @@
 

     private ISettingsPage mSettingsPage;

 

-    public SettingsController() {

+    private final UpdaterData mUpdaterData;

+

+    public SettingsController(UpdaterData updaterData) {

+        mUpdaterData = updaterData;

     }

 

     //--- Access to settings ------------

 

     /**

-     * Returns the value of the ISettingsPage#KEY_FORCE_HTTP setting.

+     * Returns the value of the {@link ISettingsPage#KEY_FORCE_HTTP} setting.

      * @see ISettingsPage#KEY_FORCE_HTTP

      */

     public boolean getForceHttp() {

@@ -54,7 +61,7 @@
     }

 

     /**

-     * Returns the value of the ISettingsPage#KEY_ASK_ADB_RESTART setting.

+     * Returns the value of the {@link ISettingsPage#KEY_ASK_ADB_RESTART} setting.

      * @see ISettingsPage#KEY_ASK_ADB_RESTART

      */

     public boolean getAskBeforeAdbRestart() {

@@ -66,7 +73,7 @@
     }

 

     /**

-     * Returns the value of the ISettingsPage#KEY_SHOW_UPDATE_ONLY setting.

+     * Returns the value of the {@link ISettingsPage#KEY_SHOW_UPDATE_ONLY} setting.

      * @see ISettingsPage#KEY_SHOW_UPDATE_ONLY

      */

     public boolean getShowUpdateOnly() {

@@ -78,7 +85,7 @@
     }

 

     /**

-     * Sets the value of the ISettingsPage#KEY_SHOW_UPDATE_ONLY setting.

+     * Sets the value of the {@link ISettingsPage#KEY_SHOW_UPDATE_ONLY} setting.

      * @param enabled True if only compatible update items should be shown.

      * @see ISettingsPage#KEY_SHOW_UPDATE_ONLY

      */

@@ -87,6 +94,32 @@
     }

 

     /**

+     * Returns the value of the {@link ISettingsPage#KEY_MONITOR_DENSITY} setting

+     * @see ISettingsPage#KEY_MONITOR_DENSITY

+     */

+    public int getMonitorDensity() {

+        String value = mProperties.getProperty(ISettingsPage.KEY_MONITOR_DENSITY, null);

+        if (value == null) {

+            return -1;

+        }

+

+        try {

+            return Integer.parseInt(value);

+        } catch (NumberFormatException e) {

+            return -1;

+        }

+    }

+

+    /**

+     * Sets the value of the {@link ISettingsPage#KEY_MONITOR_DENSITY} setting.

+     * @param density the density of the monitor

+     * @see ISettingsPage#KEY_MONITOR_DENSITY

+     */

+    public void setMonitorDensity(int density) {

+        mProperties.setProperty(ISettingsPage.KEY_MONITOR_DENSITY, Integer.toString(density));

+    }

+

+    /**

      * Internal helper to set a boolean setting.

      */

     private void setSetting(String key, boolean value) {

@@ -118,9 +151,11 @@
      */

     public void loadSettings() {

         FileInputStream fis = null;

+        String path = null;

         try {

             String folder = AndroidLocation.getFolder();

             File f = new File(folder, SETTINGS_FILENAME);

+            path = f.getPath();

             if (f.exists()) {

                 fis = new FileInputStream(f);

 

@@ -131,10 +166,11 @@
                 setSetting(ISettingsPage.KEY_ASK_ADB_RESTART, getAskBeforeAdbRestart());

             }

 

-        } catch (AndroidLocationException e) {

-            e.printStackTrace();

-        } catch (IOException e) {

-            e.printStackTrace();

+        } catch (Exception e) {

+            ISdkLog log = mUpdaterData.getSdkLog();

+            if (log != null) {

+                log.error(e, "Failed to load settings from '%1$s'", path);

+            }

         } finally {

             if (fis != null) {

                 try {

@@ -151,18 +187,42 @@
     public void saveSettings() {

 

         FileOutputStream fos = null;

+        String path = null;

         try {

             String folder = AndroidLocation.getFolder();

             File f = new File(folder, SETTINGS_FILENAME);

+            path = f.getPath();

 

             fos = new FileOutputStream(f);

 

             mProperties.store( fos, "## Settings for Android Tool");  //$NON-NLS-1$

 

-        } catch (AndroidLocationException e) {

-            e.printStackTrace();

-        } catch (IOException e) {

-            e.printStackTrace();

+        } catch (Exception e) {

+            ISdkLog log = mUpdaterData.getSdkLog();

+

+            if (log != null) {

+                log.error(e, "Failed to save settings at '%1$s'", path);

+            }

+

+            // This is important enough that we want to really nag the user about it

+            String reason = null;

+

+            if (e instanceof FileNotFoundException) {

+                reason = "File not found";

+            } else if (e instanceof AndroidLocationException) {

+                reason = ".android folder not found, please define ANDROID_SDK_HOME";

+            } else if (e.getMessage() != null) {

+                reason = String.format("%1$s: %2$s", e.getClass().getSimpleName(), e.getMessage());

+            } else {

+                reason = e.getClass().getName();

+            }

+

+            MessageDialog.openInformation(mUpdaterData.getWindowShell(),

+                    "SDK Manager Settings",

+                    String.format(

+                        "The Android SDK and AVD Manager failed to save its settings (%1$s) at %2$s",

+                        reason, path));

+

         } finally {

             if (fos != null) {

                 try {

@@ -176,7 +236,7 @@
     /**

      * When settings have changed: retrieve the new settings, apply them and save them.

      *

-     * This updats Java system properties for the HTTP proxy.

+     * This updates Java system properties for the HTTP proxy.

      */

     private void onSettingsChanged() {

         if (mSettingsPage == null) {

@@ -186,6 +246,10 @@
         mSettingsPage.retrieveSettings(mProperties);

         applySettings();

         saveSettings();

+

+        // In case the HTTP/HTTPS setting change, force sources to be reloaded

+        // (this only refreshes sources that the user has already tried to open.)

+        mUpdaterData.refreshSources(false /*forceFetching*/);

     }

 

     /**

diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdateChooserDialog.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdateChooserDialog.java
index d7d3a90..6a139de 100755
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdateChooserDialog.java
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdateChooserDialog.java
Binary files differ
diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterData.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterData.java
index bec00f8..ed6c6e2 100755
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterData.java
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterData.java
@@ -30,7 +30,6 @@
 import com.android.sdklib.internal.repository.RepoSource;

 import com.android.sdklib.internal.repository.RepoSources;

 import com.android.sdklib.internal.repository.ToolPackage;

-import com.android.sdklib.internal.repository.Package.UpdateInfo;

 import com.android.sdkuilib.internal.repository.icons.ImageFactory;

 import com.android.sdkuilib.repository.UpdaterWindow.ISdkListener;

 

@@ -42,8 +41,7 @@
 import java.io.PrintStream;

 import java.util.ArrayList;

 import java.util.Collection;

-import java.util.HashMap;

-import java.util.Map;

+import java.util.HashSet;

 

 /**

  * Data shared between {@link UpdaterWindowImpl} and its pages.

@@ -66,7 +64,7 @@
 

     private ImageFactory mImageFactory;

 

-    private final SettingsController mSettingsController = new SettingsController();

+    private final SettingsController mSettingsController;

 

     private final ArrayList<ISdkListener> mListeners = new ArrayList<ISdkListener>();

 

@@ -76,6 +74,8 @@
         mOsSdkRoot = osSdkRoot;

         mSdkLog = sdkLog;

 

+        mSettingsController = new SettingsController(this);

+

         initSdk();

     }

 

@@ -148,12 +148,14 @@
         return mSettingsController;

     }

 

+    /** Adds a listener ({@link ISdkListener}) that is notified when the SDK is reloaded. */

     public void addListeners(ISdkListener listener) {

         if (mListeners.contains(listener) == false) {

             mListeners.add(listener);

         }

     }

 

+    /** Removes a listener ({@link ISdkListener}) that is notified when the SDK is reloaded. */

     public void removeListener(ISdkListener listener) {

         mListeners.remove(listener);

     }

@@ -268,9 +270,9 @@
      * Install the list of given {@link Archive}s. This is invoked by the user selecting some

      * packages in the remote page and then clicking "install selected".

      *

-     * @param archives The archives to install. Incompatible ones will be skipped.

+     * @param result The archives to install. Incompatible ones will be skipped.

      */

-    public void installArchives(final Collection<Archive> archives) {

+    public void installArchives(final ArrayList<ArchiveInfo> result) {

         if (mTaskFactory == null) {

             throw new IllegalArgumentException("Task Factory is null");

         }

@@ -281,14 +283,23 @@
             public void run(ITaskMonitor monitor) {

 

                 final int progressPerArchive = 2 * Archive.NUM_MONITOR_INC;

-                monitor.setProgressMax(archives.size() * progressPerArchive);

+                monitor.setProgressMax(result.size() * progressPerArchive);

                 monitor.setDescription("Preparing to install archives");

 

                 boolean installedAddon = false;

                 boolean installedTools = false;

 

+                // Mark all current local archives as already installed.

+                HashSet<Archive> installedArchives = new HashSet<Archive>();

+                for (Package p : getInstalledPackage()) {

+                    for (Archive a : p.getArchives()) {

+                        installedArchives.add(a);

+                    }

+                }

+

                 int numInstalled = 0;

-                for (Archive archive : archives) {

+                for (ArchiveInfo ai : result) {

+                    Archive archive = ai.getNewArchive();

 

                     int nextProgress = monitor.getProgress() + progressPerArchive;

                     try {

@@ -296,9 +307,24 @@
                             break;

                         }

 

+                        ArchiveInfo adep = ai.getDependsOn();

+                        if (adep != null && !installedArchives.contains(adep.getNewArchive())) {

+                            // This archive depends on another one that was not installed.

+                            // Skip it.

+                            monitor.setResult("Skipping '%1$s'; it depends on '%2$s' which was not installed.",

+                                    archive.getParentPackage().getShortDescription(),

+                                    adep.getNewArchive().getParentPackage().getShortDescription());

+                        }

+

                         if (archive.install(mOsSdkRoot, forceHttp, mSdkManager, monitor)) {

+                            // We installed this archive.

+                            installedArchives.add(archive);

                             numInstalled++;

 

+                            // If this package was replacing an existing one, the old one

+                            // is no longer installed.

+                            installedArchives.remove(ai.getReplaced());

+

                             // Check if we successfully installed a tool or add-on package.

                             if (archive.getParentPackage() instanceof AddonPackage) {

                                 installedAddon = true;

@@ -411,8 +437,8 @@
             public void run() {

                 MessageDialog.openInformation(mWindowShell,

                         "Android Tools Updated",

-                        "The Android SDK tool that you are currently using has been updated. " +

-                        "It is recommended that you now close the Android SDK window and re-open it. " +

+                        "The Android SDK and AVD Manager that you are currently using has been updated. " +

+                        "It is recommended that you now close the manager window and re-open it. " +

                         "If you started this window from Eclipse, please check if the Android " +

                         "plug-in needs to be updated.");

             }

@@ -422,9 +448,15 @@
 

     /**

      * Tries to update all the *existing* local packages.

-     * This first refreshes all sources, then compares the available remote packages with

-     * the current local ones and suggest updates to be done to the user. Finally all

-     * selected updates are installed.

+     * <p/>

+     * There are two modes of operation:

+     * <ul>

+     * <li>If selectedArchives is null, refreshes all sources, compares the available remote

+     * packages with the current local ones and suggest updates to be done to the user (including

+     * new platforms that the users doesn't have yet).

+     * <li>If selectedArchives is not null, this represents a list of archives/packages that

+     * the user wants to install or update, so just process these.

+     * </ul>

      *

      * @param selectedArchives The list of remote archive to consider for the update.

      *  This can be null, in which case a list of remote archive is fetched from all

@@ -435,28 +467,27 @@
             refreshSources(true);

         }

 

-        final Map<Archive, Archive> updates = findUpdates(selectedArchives);

+        UpdaterLogic ul = new UpdaterLogic();

+        ArrayList<ArchiveInfo> archives = ul.computeUpdates(

+                selectedArchives,

+                getSources(),

+                getLocalSdkParser().getPackages());

 

-        if (selectedArchives != null) {

-            // Not only we want to perform updates but we also want to install the

-            // selected archives. If they do not match an update, list them anyway

-            // except they map themselves to null (no "old" archive)

-            for (Archive a : selectedArchives) {

-                if (!updates.containsKey(a)) {

-                    updates.put(a, null);

-                }

-            }

+        if (selectedArchives == null) {

+            ul.addNewPlatforms(archives, getSources(), getLocalSdkParser().getPackages());

         }

 

-        UpdateChooserDialog dialog = new UpdateChooserDialog(getWindowShell(), this, updates);

+        // TODO if selectedArchives is null and archives.len==0, find if there's

+        // any new platform we can suggest to install instead.

+

+        UpdateChooserDialog dialog = new UpdateChooserDialog(getWindowShell(), this, archives);

         dialog.open();

 

-        Collection<Archive> result = dialog.getResult();

+        ArrayList<ArchiveInfo> result = dialog.getResult();

         if (result != null && result.size() > 0) {

             installArchives(result);

         }

     }

-

     /**

      * Refresh all sources. This is invoked either internally (reusing an existing monitor)

      * or as a UI callback on the remote page "Refresh" button (in which case the monitor is

@@ -485,108 +516,4 @@
             }

         });

     }

-

-    /**

-     * Check the local archives vs the remote available packages to find potential updates.

-     * Return a map [remote archive => local archive] of suitable update candidates.

-     * Returns null if there's an unexpected error. Otherwise returns a map that can be

-     * empty but not null.

-     *

-     * @param selectedArchives The list of remote archive to consider for the update.

-     *  This can be null, in which case a list of remote archive is fetched from all

-     *  available sources.

-     */

-    private Map<Archive, Archive> findUpdates(Collection<Archive> selectedArchives) {

-        // Map [remote archive => local archive] of suitable update candidates

-        Map<Archive, Archive> result = new HashMap<Archive, Archive>();

-

-        // First go thru all sources and make a list of all available remote archives

-        // sorted by package class.

-        HashMap<Class<? extends Package>, ArrayList<Archive>> availablePkgs =

-            new HashMap<Class<? extends Package>, ArrayList<Archive>>();

-

-        if (selectedArchives != null) {

-            // Only consider the archives given

-

-            for (Archive a : selectedArchives) {

-                // Only add compatible archives

-                if (a.isCompatible()) {

-                    Class<? extends Package> clazz = a.getParentPackage().getClass();

-

-                    ArrayList<Archive> list = availablePkgs.get(clazz);

-                    if (list == null) {

-                        availablePkgs.put(clazz, list = new ArrayList<Archive>());

-                    }

-

-                    list.add(a);

-                }

-            }

-

-        } else {

-            // Get all the available archives from all loaded sources

-            RepoSource[] remoteSources = getSources().getSources();

-

-            for (RepoSource remoteSrc : remoteSources) {

-                Package[] remotePkgs = remoteSrc.getPackages();

-                if (remotePkgs != null) {

-                    for (Package remotePkg : remotePkgs) {

-                        Class<? extends Package> clazz = remotePkg.getClass();

-

-                        ArrayList<Archive> list = availablePkgs.get(clazz);

-                        if (list == null) {

-                            availablePkgs.put(clazz, list = new ArrayList<Archive>());

-                        }

-

-                        for (Archive a : remotePkg.getArchives()) {

-                            // Only add compatible archives

-                            if (a.isCompatible()) {

-                                list.add(a);

-                            }

-                        }

-                    }

-                }

-            }

-        }

-

-        Package[] localPkgs = getLocalSdkParser().getPackages();

-        if (localPkgs == null) {

-            // This is unexpected. The local sdk parser should have been called first.

-            return null;

-        }

-

-        for (Package localPkg : localPkgs) {

-            // get the available archive list for this package type

-            ArrayList<Archive> list = availablePkgs.get(localPkg.getClass());

-

-            // if this list is empty, we'll never find anything that matches

-            if (list == null || list.size() == 0) {

-                continue;

-            }

-

-            // local packages should have one archive at most

-            Archive[] localArchives = localPkg.getArchives();

-            if (localArchives != null && localArchives.length > 0) {

-                Archive localArchive = localArchives[0];

-                // only consider archives compatible with the current platform

-                if (localArchive != null && localArchive.isCompatible()) {

-

-                    // We checked all this archive stuff because that's what eventually gets

-                    // installed, but the "update" mechanism really works on packages. So now

-                    // the real question: is there a remote package that can update this

-                    // local package?

-

-                    for (Archive availArchive : list) {

-                        UpdateInfo info = localPkg.canBeUpdatedBy(availArchive.getParentPackage());

-                        if (info == UpdateInfo.UPDATE) {

-                            // Found one!

-                            result.put(availArchive, localArchive);

-                            break;

-                        }

-                    }

-                }

-            }

-        }

-

-        return result;

-    }

 }

diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterLogic.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterLogic.java
new file mode 100755
index 0000000..4478448
--- /dev/null
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterLogic.java
@@ -0,0 +1,490 @@
+/*

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package com.android.sdkuilib.internal.repository;

+

+import com.android.sdklib.AndroidVersion;

+import com.android.sdklib.internal.repository.AddonPackage;

+import com.android.sdklib.internal.repository.Archive;

+import com.android.sdklib.internal.repository.DocPackage;

+import com.android.sdklib.internal.repository.ExtraPackage;

+import com.android.sdklib.internal.repository.IPackageVersion;

+import com.android.sdklib.internal.repository.MinToolsPackage;

+import com.android.sdklib.internal.repository.Package;

+import com.android.sdklib.internal.repository.PlatformPackage;

+import com.android.sdklib.internal.repository.RepoSource;

+import com.android.sdklib.internal.repository.RepoSources;

+import com.android.sdklib.internal.repository.ToolPackage;

+import com.android.sdklib.internal.repository.Package.UpdateInfo;

+

+import java.util.ArrayList;

+import java.util.Collection;

+import java.util.HashMap;

+

+/**

+ * The logic to compute which packages to install, based on the choices

+ * made by the user. This adds dependent packages as needed.

+ * <p/>

+ * When the user doesn't provide a selection, looks at local package to find

+ * those that can be updated and compute dependencies too.

+ */

+class UpdaterLogic {

+

+    /**

+     * Compute which packages to install by taking the user selection

+     * and adding dependent packages as needed.

+     *

+     * When the user doesn't provide a selection, looks at local package to find

+     * those that can be updated and compute dependencies too.

+     */

+    public ArrayList<ArchiveInfo> computeUpdates(

+            Collection<Archive> selectedArchives,

+            RepoSources sources,

+            Package[] localPkgs) {

+

+        ArrayList<ArchiveInfo> archives = new ArrayList<ArchiveInfo>();

+        ArrayList<Package> remotePkgs = new ArrayList<Package>();

+        RepoSource[] remoteSources = sources.getSources();

+

+        if (selectedArchives == null) {

+            selectedArchives = findUpdates(localPkgs, remotePkgs, remoteSources);

+        }

+

+        for (Archive a : selectedArchives) {

+            insertArchive(a,

+                    archives,

+                    selectedArchives,

+                    remotePkgs,

+                    remoteSources,

+                    localPkgs,

+                    false /*automated*/);

+        }

+

+        return archives;

+    }

+

+    /**

+     * Finds new platforms that the user does not have in his/her local SDK

+     * and adds them to the list of archives to install.

+     */

+    public void addNewPlatforms(ArrayList<ArchiveInfo> archives,

+            RepoSources sources,

+            Package[] localPkgs) {

+

+        // Find the highest platform installed

+        float currentPlatformScore = 0;

+        float currentAddonScore = 0;

+        float currentDocScore = 0;

+        HashMap<String, Float> currentExtraScore = new HashMap<String, Float>();

+        for (Package p : localPkgs) {

+            int rev = p.getRevision();

+            int api = 0;

+            boolean isPreview = false;

+            if (p instanceof  IPackageVersion) {

+                AndroidVersion vers = ((IPackageVersion) p).getVersion();

+                api = vers.getApiLevel();

+                isPreview = vers.isPreview();

+            }

+

+            // The score is 10*api + (1 if preview) + rev/100

+            // This allows previews to rank above a non-preview and

+            // allows revisions to rank appropriately.

+            float score = api * 10 + (isPreview ? 1 : 0) + rev/100.f;

+

+            if (p instanceof PlatformPackage) {

+                currentPlatformScore = Math.max(currentPlatformScore, score);

+            } else if (p instanceof AddonPackage) {

+                currentAddonScore = Math.max(currentAddonScore, score);

+            } else if (p instanceof ExtraPackage) {

+                currentExtraScore.put(((ExtraPackage) p).getPath(), score);

+            } else if (p instanceof DocPackage) {

+                currentDocScore = Math.max(currentDocScore, score);

+            }

+        }

+

+        RepoSource[] remoteSources = sources.getSources();

+        ArrayList<Package> remotePkgs = new ArrayList<Package>();

+        fetchRemotePackages(remotePkgs, remoteSources);

+

+        Package suggestedDoc = null;

+

+        for (Package p : remotePkgs) {

+            int rev = p.getRevision();

+            int api = 0;

+            boolean isPreview = false;

+            if (p instanceof  IPackageVersion) {

+                AndroidVersion vers = ((IPackageVersion) p).getVersion();

+                api = vers.getApiLevel();

+                isPreview = vers.isPreview();

+            }

+

+            float score = api * 10 + (isPreview ? 1 : 0) + rev/100.f;

+

+            boolean shouldAdd = false;

+            if (p instanceof PlatformPackage) {

+                shouldAdd = score > currentPlatformScore;

+            } else if (p instanceof AddonPackage) {

+                shouldAdd = score > currentAddonScore;

+            } else if (p instanceof ExtraPackage) {

+                String key = ((ExtraPackage) p).getPath();

+                shouldAdd = !currentExtraScore.containsKey(key) ||

+                    score > currentExtraScore.get(key).floatValue();

+            } else if (p instanceof DocPackage) {

+                // We don't want all the doc, only the most recent one

+                if (score > currentDocScore) {

+                    suggestedDoc = p;

+                    currentDocScore = score;

+                }

+            }

+

+            if (shouldAdd) {

+                // We should suggest this package for installation.

+                for (Archive a : p.getArchives()) {

+                    if (a.isCompatible()) {

+                        insertArchive(a,

+                                archives,

+                                null /*selectedArchives*/,

+                                remotePkgs,

+                                remoteSources,

+                                localPkgs,

+                                true /*automated*/);

+                    }

+                }

+            }

+        }

+

+        if (suggestedDoc != null) {

+            // We should suggest this package for installation.

+            for (Archive a : suggestedDoc.getArchives()) {

+                if (a.isCompatible()) {

+                    insertArchive(a,

+                            archives,

+                            null /*selectedArchives*/,

+                            remotePkgs,

+                            remoteSources,

+                            localPkgs,

+                            true /*automated*/);

+                }

+            }

+        }

+

+    }

+

+    /**

+     * Find suitable updates to all current local packages.

+     */

+    private Collection<Archive> findUpdates(Package[] localPkgs,

+            ArrayList<Package> remotePkgs,

+            RepoSource[] remoteSources) {

+        ArrayList<Archive> updates = new ArrayList<Archive>();

+

+        fetchRemotePackages(remotePkgs, remoteSources);

+

+        for (Package localPkg : localPkgs) {

+            for (Package remotePkg : remotePkgs) {

+                if (localPkg.canBeUpdatedBy(remotePkg) == UpdateInfo.UPDATE) {

+                    // Found a suitable update. Only accept the remote package

+                    // if it provides at least one compatible archive.

+

+                    for (Archive a : remotePkg.getArchives()) {

+                        if (a.isCompatible()) {

+                            updates.add(a);

+                            break;

+                        }

+                    }

+                }

+            }

+        }

+

+        return updates;

+    }

+

+    private ArchiveInfo insertArchive(Archive archive,

+            ArrayList<ArchiveInfo> outArchives,

+            Collection<Archive> selectedArchives,

+            ArrayList<Package> remotePkgs,

+            RepoSource[] remoteSources,

+            Package[] localPkgs,

+            boolean automated) {

+        Package p = archive.getParentPackage();

+

+        // Is this an update?

+        Archive updatedArchive = null;

+        for (Package lp : localPkgs) {

+            assert lp.getArchives().length == 1;

+            if (lp.getArchives().length > 0 && lp.canBeUpdatedBy(p) == UpdateInfo.UPDATE) {

+                updatedArchive = lp.getArchives()[0];

+            }

+        }

+

+        // find dependencies

+        ArchiveInfo dep = findDependency(p,

+                outArchives,

+                selectedArchives,

+                remotePkgs,

+                remoteSources,

+                localPkgs);

+

+        // Make sure it's not a dup

+        ArchiveInfo ai = null;

+

+        for (ArchiveInfo ai2 : outArchives) {

+            if (ai2.getNewArchive().getParentPackage().sameItemAs(archive.getParentPackage())) {

+                ai = ai2;

+                break;

+            }

+        }

+

+        if (ai == null) {

+            ai = new ArchiveInfo(

+                archive, //newArchive

+                updatedArchive, //replaced

+                dep //dependsOn

+                );

+            outArchives.add(ai);

+        }

+

+        if (dep != null) {

+            dep.addDependencyFor(ai);

+        }

+

+        return ai;

+    }

+

+    private ArchiveInfo findDependency(Package pkg,

+            ArrayList<ArchiveInfo> outArchives,

+            Collection<Archive> selectedArchives,

+            ArrayList<Package> remotePkgs,

+            RepoSource[] remoteSources,

+            Package[] localPkgs) {

+

+        // Current dependencies can be:

+        // - addon: *always* depends on platform of same API level

+        // - platform: *might* depends on tools of rev >= min-tools-rev

+

+        if (pkg instanceof AddonPackage) {

+            AddonPackage addon = (AddonPackage) pkg;

+

+            return findPlatformDependency(

+                    addon,

+                    outArchives,

+                    selectedArchives,

+                    remotePkgs,

+                    remoteSources,

+                    localPkgs);

+

+        } else if (pkg instanceof MinToolsPackage) {

+            MinToolsPackage platformOrExtra = (MinToolsPackage) pkg;

+

+            return findToolsDependency(

+                    platformOrExtra,

+                    outArchives,

+                    selectedArchives,

+                    remotePkgs,

+                    remoteSources,

+                    localPkgs);

+        }

+

+        return null;

+    }

+

+    /**

+     * Resolves dependencies on tools.

+     *

+     * A platform or an extra package can both have a min-tools-rev, in which case it

+     * depends on having a tools package of the requested revision.

+     * Finds the tools dependency. If found, add it to the list of things to install.

+     * Returns the archive info dependency, if any.

+     */

+    protected ArchiveInfo findToolsDependency(MinToolsPackage platformOrExtra,

+            ArrayList<ArchiveInfo> outArchives,

+            Collection<Archive> selectedArchives,

+            ArrayList<Package> remotePkgs,

+            RepoSource[] remoteSources,

+            Package[] localPkgs) {

+        // This is the requirement to match.

+        int rev = platformOrExtra.getMinToolsRevision();

+

+        if (rev == MinToolsPackage.MIN_TOOLS_REV_NOT_SPECIFIED) {

+            // Well actually there's no requirement.

+            return null;

+        }

+

+        // First look in local packages.

+        for (Package p : localPkgs) {

+            if (p instanceof ToolPackage) {

+                if (((ToolPackage) p).getRevision() >= rev) {

+                    // We found one already installed. We don't report this dependency

+                    // as the UI only cares about resolving "newly added dependencies".

+                    return null;

+                }

+            }

+        }

+

+        // Look in archives already scheduled for install

+        for (ArchiveInfo ai : outArchives) {

+            Package p = ai.getNewArchive().getParentPackage();

+            if (p instanceof ToolPackage) {

+                if (((ToolPackage) p).getRevision() >= rev) {

+                    // The dependency is already scheduled for install, nothing else to do.

+                    return ai;

+                }

+            }

+        }

+

+        // Otherwise look in the selected archives.

+        if (selectedArchives != null) {

+            for (Archive a : selectedArchives) {

+                Package p = a.getParentPackage();

+                if (p instanceof ToolPackage) {

+                    if (((ToolPackage) p).getRevision() >= rev) {

+                        // It's not already in the list of things to install, so add it now

+                        return insertArchive(a, outArchives,

+                                selectedArchives, remotePkgs, remoteSources, localPkgs,

+                                true /*automated*/);

+                    }

+                }

+            }

+        }

+

+        // Finally nothing matched, so let's look at all available remote packages

+        fetchRemotePackages(remotePkgs, remoteSources);

+        for (Package p : remotePkgs) {

+            if (p instanceof ToolPackage) {

+                if (((ToolPackage) p).getRevision() >= rev) {

+                    // It's not already in the list of things to install, so add the

+                    // first compatible archive we can find.

+                    for (Archive a : p.getArchives()) {

+                        if (a.isCompatible()) {

+                            return insertArchive(a, outArchives,

+                                    selectedArchives, remotePkgs, remoteSources, localPkgs,

+                                    true /*automated*/);

+                        }

+                    }

+                }

+            }

+        }

+

+        // We end up here if nothing matches. We don't have a good tools to match.

+        // Seriously, that can't happens unless we totally screwed our repo manifest.

+        // We'll let this one go through anyway.

+        return null;

+    }

+

+    /**

+     * Resolves dependencies on platform.

+     *

+     * An addon depends on having a platform with the same API version.

+     * Finds the platform dependency. If found, add it to the list of things to install.

+     * Returns the archive info dependency, if any.

+     */

+    protected ArchiveInfo findPlatformDependency(AddonPackage addon,

+            ArrayList<ArchiveInfo> outArchives,

+            Collection<Archive> selectedArchives,

+            ArrayList<Package> remotePkgs,

+            RepoSource[] remoteSources,

+            Package[] localPkgs) {

+        // This is the requirement to match.

+        AndroidVersion v = addon.getVersion();

+

+        // Find a platform that would satisfy the requirement.

+

+        // First look in local packages.

+        for (Package p : localPkgs) {

+            if (p instanceof PlatformPackage) {

+                if (v.equals(((PlatformPackage) p).getVersion())) {

+                    // We found one already installed. We don't report this dependency

+                    // as the UI only cares about resolving "newly added dependencies".

+                    return null;

+                }

+            }

+        }

+

+        // Look in archives already scheduled for install

+        for (ArchiveInfo ai : outArchives) {

+            Package p = ai.getNewArchive().getParentPackage();

+            if (p instanceof PlatformPackage) {

+                if (v.equals(((PlatformPackage) p).getVersion())) {

+                    // The dependency is already scheduled for install, nothing else to do.

+                    return ai;

+                }

+            }

+        }

+

+        // Otherwise look in the selected archives.

+        if (selectedArchives != null) {

+            for (Archive a : selectedArchives) {

+                Package p = a.getParentPackage();

+                if (p instanceof PlatformPackage) {

+                    if (v.equals(((PlatformPackage) p).getVersion())) {

+                        // It's not already in the list of things to install, so add it now

+                        return insertArchive(a, outArchives,

+                                selectedArchives, remotePkgs, remoteSources, localPkgs,

+                                true /*automated*/);

+                    }

+                }

+            }

+        }

+

+        // Finally nothing matched, so let's look at all available remote packages

+        fetchRemotePackages(remotePkgs, remoteSources);

+        for (Package p : remotePkgs) {

+            if (p instanceof PlatformPackage) {

+                if (v.equals(((PlatformPackage) p).getVersion())) {

+                    // It's not already in the list of things to install, so add the

+                    // first compatible archive we can find.

+                    for (Archive a : p.getArchives()) {

+                        if (a.isCompatible()) {

+                            return insertArchive(a, outArchives,

+                                    selectedArchives, remotePkgs, remoteSources, localPkgs,

+                                    true /*automated*/);

+                        }

+                    }

+                }

+            }

+        }

+

+        // We end up here if nothing matches. We don't have a good platform to match.

+        // Seriously, that can't happens unless the repository contains a bogus addon

+        // entry that does not match any existing platform API level.

+        // It's conceivable that a 3rd part addon repo might have error, in which case

+        // we'll let this one go through anyway.

+        return null;

+    }

+

+    /** Fetch all remote packages only if really needed. */

+    protected void fetchRemotePackages(ArrayList<Package> remotePkgs, RepoSource[] remoteSources) {

+        if (remotePkgs.size() > 0) {

+            return;

+        }

+

+        for (RepoSource remoteSrc : remoteSources) {

+            Package[] pkgs = remoteSrc.getPackages();

+            if (pkgs != null) {

+                nextPackage: for (Package pkg : pkgs) {

+                    for (Archive a : pkg.getArchives()) {

+                        // Only add a package if it contains at least one compatible archive

+                        if (a.isCompatible()) {

+                            remotePkgs.add(pkg);

+                            continue nextPackage;

+                        }

+                    }

+                }

+            }

+        }

+    }

+

+}

diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterWindowImpl.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterWindowImpl.java
index b9cf0a4..6e24af4 100755
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterWindowImpl.java
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterWindowImpl.java
@@ -60,7 +60,11 @@
     private ArrayList<Object[]> mExtraPages;

     /** A factory to create progress task dialogs. */

     private ProgressTaskFactory mTaskFactory;

-

+    /** The initial page to display. If null or not a know class, the first page will be displayed.

+     * Must be set before the first call to {@link #open()}. */

+    private Class<? extends Composite> mInitialPage;

+    /** Sets whether the auto-update wizard will be shown when opening the window. */

+    private boolean mRequestAutoUpdate;

 

     // --- UI members ---

 

@@ -121,7 +125,7 @@
         fl.marginHeight = fl.marginWidth = 5;

         mAndroidSdkUpdater.setMinimumSize(new Point(200, 50));

         mAndroidSdkUpdater.setSize(745, 433);

-        mAndroidSdkUpdater.setText("Android SDK");

+        mAndroidSdkUpdater.setText("Android SDK and AVD Manager");

 

         mSashForm = new SashForm(mAndroidSdkUpdater, SWT.NONE);

 

@@ -148,7 +152,7 @@
     // Hide everything down-below from SWT designer

     //$hide>>$

 

-    // --- UI Callbacks -----------

+    // --- Public API -----------

 

 

     /**

@@ -169,14 +173,42 @@
         mExtraPages.add(new Object[]{ title, pageClass });

     }

 

+    /**

+     * Indicate the initial page that should be selected when the window opens.

+     * This must be called before the call to {@link #open()}.

+     * If null or if the page class is not found, the first page will be selected.

+     */

+    public void setInitialPage(Class<? extends Composite> pageClass) {

+        mInitialPage = pageClass;

+    }

+

+    /**

+     * Sets whether the auto-update wizard will be shown when opening the window.

+     * <p/>

+     * This must be called before the call to {@link #open()}.

+     */

+    public void setRequestAutoUpdate(boolean requestAutoUpdate) {

+        mRequestAutoUpdate = requestAutoUpdate;

+    }

+

+    /**

+     * Adds a new listener to be notified when a change is made to the content of the SDK.

+     */

     public void addListeners(ISdkListener listener) {

         mUpdaterData.addListeners(listener);

     }

 

+    /**

+     * Removes a new listener to be notified anymore when a change is made to the content of

+     * the SDK.

+     */

     public void removeListener(ISdkListener listener) {

         mUpdaterData.removeListener(listener);

     }

 

+    // --- Internals & UI Callbacks -----------

+

+

     /**

      * Helper to return the SWT shell.

      */

@@ -230,12 +262,25 @@
         addPage(mRemotePackagesPage, "Available Packages");

         addExtraPages();

 

-        displayPage(0);

-        mPageList.setSelection(0);

+        int pageIndex = 0;

+        int i = 0;

+        for (Composite p : mPages) {

+            if (p.getClass().equals(mInitialPage)) {

+                pageIndex = i;

+                break;

+            }

+            i++;

+        }

+        displayPage(pageIndex);

+        mPageList.setSelection(pageIndex);

 

         setupSources();

         initializeSettings();

         mUpdaterData.notifyListeners();

+

+        if (mRequestAutoUpdate) {

+            mUpdaterData.updateOrInstallAll(null /*selectedArchives*/);

+        }

     }

 

     /**

diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/tasks/ProgressTask.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/tasks/ProgressTask.java
index 9ed8a01..f958a40 100755
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/tasks/ProgressTask.java
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/tasks/ProgressTask.java
@@ -19,6 +19,8 @@
 import com.android.sdklib.internal.repository.ITask;

 import com.android.sdklib.internal.repository.ITaskMonitor;

 

+import org.eclipse.jface.dialogs.MessageDialog;

+import org.eclipse.swt.widgets.Display;

 import org.eclipse.swt.widgets.ProgressBar;

 import org.eclipse.swt.widgets.Shell;

 

@@ -143,6 +145,30 @@
     }

 

     /**

+     * Display a yes/no question dialog box.

+     *

+     * This implementation allow this to be called from any thread, it

+     * makes sure the dialog is opened synchronously in the ui thread.

+     *

+     * @param title The title of the dialog box

+     * @param message The error message

+     * @return true if YES was clicked.

+     */

+    public boolean displayPrompt(final String title, final String message) {

+        final Shell shell = mDialog.getParent();

+        Display display = shell.getDisplay();

+

+        // we need to ask the user what he wants to do.

+        final boolean[] result = new boolean[] { false };

+        display.syncExec(new Runnable() {

+            public void run() {

+                result[0] = MessageDialog.openQuestion(shell, title, message);

+            }

+        });

+        return result[0];

+    }

+

+    /**

      * Creates a sub-monitor that will use up to tickCount on the progress bar.

      * tickCount must be 1 or more.

      */

@@ -222,6 +248,10 @@
             }

         }

 

+        public boolean displayPrompt(String title, String message) {

+            return mRoot.displayPrompt(title, message);

+        }

+

         public ITaskMonitor createSubMonitor(int tickCount) {

             assert mSubCoef > 0;

             assert tickCount > 0;

diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/ApkConfigEditDialog.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/ApkConfigEditDialog.java
deleted file mode 100644
index be241a5..0000000
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/ApkConfigEditDialog.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.sdkuilib.internal.widgets;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Edit dialog to create/edit APK configuration. The dialog displays 2 text fields for the config
- * name and its filter.
- */
-class ApkConfigEditDialog extends Dialog implements ModifyListener, VerifyListener {
-
-    private String mName;
-    private String mFilter;
-    private Text mNameField;
-    private Text mFilterField;
-    private Button mOkButton;
-    
-    /**
-     * Creates an edit dialog with optional initial values for the name and filter.
-     * @param name optional value for the name. Can be null.
-     * @param filter optional value for the filter. Can be null.
-     * @param parentShell the parent shell.
-     */
-    protected ApkConfigEditDialog(String name, String filter, Shell parentShell) {
-        super(parentShell);
-        mName = name;
-        mFilter = filter;
-    }
-    
-    /**
-     * Returns the name of the config. This is only valid if the user clicked OK and {@link #open()}
-     * returned {@link Window#OK}
-     */
-    public String getName() {
-        return mName;
-    }
-    
-    /**
-     * Returns the filter for the config. This is only valid if the user clicked OK and
-     * {@link #open()} returned {@link Window#OK}
-     */
-    public String getFilter() {
-        return mFilter;
-    }
-    
-    @Override
-    protected Control createContents(Composite parent) {
-        Control control = super.createContents(parent);
-
-        mOkButton = getButton(IDialogConstants.OK_ID);
-        validateButtons();
-
-        return control;
-    }
-    
-    @Override
-    protected Control createDialogArea(Composite parent) {
-        Composite composite = new Composite(parent, SWT.NONE);
-        GridLayout layout;
-        composite.setLayout(layout = new GridLayout(2, false));
-        layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
-        layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
-        layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
-        layout.horizontalSpacing = convertHorizontalDLUsToPixels(
-                IDialogConstants.HORIZONTAL_SPACING);
-
-        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-        
-        Label l = new Label(composite, SWT.NONE);
-        l.setText("Name");
-        
-        mNameField = new Text(composite, SWT.BORDER);
-        mNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-        mNameField.addVerifyListener(this);
-        if (mName != null) {
-            mNameField.setText(mName);
-        }
-        mNameField.addModifyListener(this);
-
-        l = new Label(composite, SWT.NONE);
-        l.setText("Filter");
-        
-        mFilterField = new Text(composite, SWT.BORDER);
-        mFilterField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-        if (mFilter != null) {
-            mFilterField.setText(mFilter);
-        }
-        mFilterField.addVerifyListener(this);
-        mFilterField.addModifyListener(this);
-        
-        applyDialogFont(composite);
-        return composite;
-    }
-    
-    /**
-     * Validates the OK button based on the content of the 2 text fields.
-     */
-    private void validateButtons() {
-        mOkButton.setEnabled(mNameField.getText().trim().length() > 0 &&
-                mFilterField.getText().trim().length() > 0);
-    }
-
-    @Override
-    protected void okPressed() {
-        mName = mNameField.getText();
-        mFilter = mFilterField.getText().trim();
-        super.okPressed();
-    }
-
-    /**
-     * Callback for text modification in the 2 text fields.
-     */
-    public void modifyText(ModifyEvent e) {
-        validateButtons();
-    }
-
-    /**
-     * Callback to ensure the content of the text field are proper.
-     */
-    public void verifyText(VerifyEvent e) {
-        Text source = ((Text)e.getSource());
-        if (source == mNameField) {
-            // check for a-zA-Z0-9.
-            final String text = e.text;
-            final int len = text.length();
-            for (int i = 0 ; i < len; i++) {
-                char letter = text.charAt(i);
-                if (letter > 255 || Character.isLetterOrDigit(letter) == false) {
-                    e.doit = false;
-                    return;
-                }
-            }
-        } else if (source == mFilterField) {
-            // we can't validate the content as its typed, but we can at least ensure the characters
-            // are valid. Same as mNameFiled + the comma.
-            final String text = e.text;
-            final int len = text.length();
-            for (int i = 0 ; i < len; i++) {
-                char letter = text.charAt(i);
-                if (letter > 255 || (Character.isLetterOrDigit(letter) == false && letter != ',')) {
-                    e.doit = false;
-                    return;
-                }
-            }
-        }
-    }
-}
diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/ApkConfigWidget.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/ApkConfigWidget.java
deleted file mode 100644
index a05f9bd..0000000
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/ApkConfigWidget.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.sdkuilib.internal.widgets;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * The APK Configuration widget is a table that is added to the given parent composite.
- * <p/>
- * To use, create it using {@link #ApkConfigWidget(Composite)} then
- * call {@link #fillTable(Map)} to set the initial list of configurations.
- */
-public class ApkConfigWidget {
-    private final static int INDEX_NAME = 0;
-    private final static int INDEX_FILTER = 1;
-    
-    private Table mApkConfigTable;
-    private Button mEditButton;
-    private Button mDelButton;
-
-    public ApkConfigWidget(final Composite parent) {
-        final Composite apkConfigComp = new Composite(parent, SWT.NONE);
-        apkConfigComp.setLayoutData(new GridData(GridData.FILL_BOTH));
-        apkConfigComp.setLayout(new GridLayout(2, false));
-        
-        mApkConfigTable = new Table(apkConfigComp, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER);
-        mApkConfigTable.setHeaderVisible(true);
-        mApkConfigTable.setLinesVisible(true);
-
-        GridData data = new GridData();
-        data.grabExcessVerticalSpace = true;
-        data.grabExcessHorizontalSpace = true;
-        data.horizontalAlignment = GridData.FILL;
-        data.verticalAlignment = GridData.FILL;
-        mApkConfigTable.setLayoutData(data);
-
-        // create the table columns
-        final TableColumn column0 = new TableColumn(mApkConfigTable, SWT.NONE);
-        column0.setText("Name");
-        column0.setWidth(100);
-        final TableColumn column1 = new TableColumn(mApkConfigTable, SWT.NONE);
-        column1.setText("Configuration");
-        column1.setWidth(100);
-
-        Composite buttonComp = new Composite(apkConfigComp, SWT.NONE);
-        buttonComp.setLayoutData(new GridData(GridData.FILL_VERTICAL));
-        GridLayout gl;
-        buttonComp.setLayout(gl = new GridLayout(1, false));
-        gl.marginHeight = gl.marginWidth = 0;
-
-        Button newButton = new Button(buttonComp, SWT.PUSH | SWT.FLAT);
-        newButton.setText("New...");
-        newButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
-        mEditButton = new Button(buttonComp, SWT.PUSH | SWT.FLAT);
-        mEditButton.setText("Edit...");
-        mEditButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
-        mDelButton = new Button(buttonComp, SWT.PUSH | SWT.FLAT);
-        mDelButton.setText("Delete");
-        mDelButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-        
-        newButton.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                ApkConfigEditDialog dlg = new ApkConfigEditDialog(null /*name*/, null /*filter*/,
-                        apkConfigComp.getShell());
-                if (dlg.open() == Dialog.OK) {
-                    TableItem item = new TableItem(mApkConfigTable, SWT.NONE);
-                    item.setText(INDEX_NAME, dlg.getName());
-                    item.setText(INDEX_FILTER, dlg.getFilter());
-                    
-                    onSelectionChanged();
-                }
-            }
-        });
-        
-        mEditButton.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                // get the current selection (single mode so we don't care about any item beyond
-                // index 0).
-                TableItem[] items = mApkConfigTable.getSelection();
-                if (items.length != 0) {
-                    ApkConfigEditDialog dlg = new ApkConfigEditDialog(
-                            items[0].getText(INDEX_NAME), items[0].getText(INDEX_FILTER),
-                            apkConfigComp.getShell());
-                    if (dlg.open() == Dialog.OK) {
-                        items[0].setText(INDEX_NAME, dlg.getName());
-                        items[0].setText(INDEX_FILTER, dlg.getFilter());
-                    }
-                }
-            }
-        });
-        
-        mDelButton.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                // get the current selection (single mode so we don't care about any item beyond
-                // index 0).
-                int[] indices = mApkConfigTable.getSelectionIndices();
-                if (indices.length != 0) {
-                    TableItem item = mApkConfigTable.getItem(indices[0]);
-                    if (MessageDialog.openQuestion(parent.getShell(),
-                            "Apk Configuration deletion",
-                            String.format(
-                                    "Are you sure you want to delete configuration '%1$s'?",
-                                    item.getText(INDEX_NAME)))) {
-                        // delete the item.
-                        mApkConfigTable.remove(indices[0]);
-                        
-                        onSelectionChanged();
-                    }
-                }
-            }
-        });
-        
-        // Add a listener to resize the column to the full width of the table
-        mApkConfigTable.addControlListener(new ControlAdapter() {
-            @Override
-            public void controlResized(ControlEvent e) {
-                Rectangle r = mApkConfigTable.getClientArea();
-                column0.setWidth(r.width * 30 / 100); // 30%  
-                column1.setWidth(r.width * 70 / 100); // 70%
-            }
-        });
-        
-        // add a selection listener on the table, to enable/disable buttons.
-        mApkConfigTable.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                onSelectionChanged();
-            }
-        });
-    }
-    
-    public void fillTable(Map<String, String> apkConfigMap) {
-        // get the names in a list so that we can sort them.
-        if (apkConfigMap != null) {
-            Set<String> keys = apkConfigMap.keySet();
-            String[] keyArray = keys.toArray(new String[keys.size()]);
-            Arrays.sort(keyArray);
-            
-            for (String key : keyArray) {
-                TableItem item = new TableItem(mApkConfigTable, SWT.NONE);
-                item.setText(INDEX_NAME, key);
-                item.setText(INDEX_FILTER, apkConfigMap.get(key));
-            }
-        }
-        
-        onSelectionChanged();
-    }
-
-    public Map<String, String> getApkConfigs() {
-        // go through all the items from the table and fill a new map
-        HashMap<String, String> map = new HashMap<String, String>();
-        
-        TableItem[] items = mApkConfigTable.getItems();
-        for (TableItem item : items) {
-            map.put(item.getText(INDEX_NAME), item.getText(INDEX_FILTER));
-        }
-
-        return map;
-    }
-    
-    /**
-     * Handles table selection changes.
-     */
-    private void onSelectionChanged() {
-        if (mApkConfigTable.getSelectionCount() > 0) {
-            mEditButton.setEnabled(true);
-            mDelButton.setEnabled(true);
-        } else {
-            mEditButton.setEnabled(false);
-            mDelButton.setEnabled(false);
-        }
-    }
-}
diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdCreationDialog.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdCreationDialog.java
index 3c0369f..20bdfad 100644
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdCreationDialog.java
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdCreationDialog.java
@@ -19,19 +19,39 @@
 import com.android.prefs.AndroidLocation;
 import com.android.prefs.AndroidLocation.AndroidLocationException;
 import com.android.sdklib.IAndroidTarget;
+import com.android.sdklib.SdkConstants;
 import com.android.sdklib.SdkManager;
 import com.android.sdklib.internal.avd.AvdManager;
+import com.android.sdklib.internal.avd.HardwareProperties;
 import com.android.sdklib.internal.avd.AvdManager.AvdInfo;
+import com.android.sdklib.internal.avd.HardwareProperties.HardwareProperty;
 import com.android.sdkuilib.internal.repository.icons.ImageFactory;
 import com.android.sdkuilib.internal.widgets.AvdSelector.SdkLog;
+import com.android.sdkuilib.ui.GridDialog;
 
-import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.jface.window.Window;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
@@ -40,35 +60,60 @@
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.Text;
 
 import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.TreeMap;
+import java.util.Map.Entry;
 
 /**
  * AVD creator dialog.
  *
  * TODO:
- * - support custom hardware properties
  * - use SdkTargetSelector instead of Combo
- * - Better UI for the sdcard (radio button for K or M, info about what is valid value)
- * - Support for ###x### skins
  * - tooltips on widgets.
  *
  */
-final class AvdCreationDialog extends Dialog {
+final class AvdCreationDialog extends GridDialog {
 
     private final AvdManager mAvdManager;
     private final TreeMap<String, IAndroidTarget> mCurrentTargets =
         new TreeMap<String, IAndroidTarget>();
 
+    private final Map<String, HardwareProperty> mHardwareMap;
+    private final Map<String, String> mProperties = new HashMap<String, String>();
+    // a list of user-edited properties.
+    private final ArrayList<String> mEditedProperties = new ArrayList<String>();
+
     private Text mAvdName;
     private Combo mTargetCombo;
-    private Text mSdCard;
+
+    private Button mSdCardSizeRadio;
+    private Text mSdCardSize;
+    private Combo mSdCardSizeCombo;
+
+    private Text mSdCardFile;
     private Button mBrowseSdCard;
+    private Button mSdCardFileRadio;
+
+    private Button mSkinListRadio;
     private Combo mSkinCombo;
+
+    private Button mSkinSizeRadio;
+    private Text mSkinSizeWidth;
+    private Text mSkinSizeHeight;
+
+    private TableViewer mHardwareViewer;
+    private Button mDeleteHardwareProp;
+
     private Button mForceCreation;
     private Button mOkButton;
     private Label mStatusIcon;
@@ -77,11 +122,26 @@
     private final ImageFactory mImageFactory;
 
     /**
+     * {@link VerifyListener} for {@link Text} widgets that should only contains numbers.
+     */
+    private final VerifyListener mDigitVerifier = new VerifyListener() {
+        public void verifyText(VerifyEvent event) {
+            int count = event.text.length();
+            for (int i = 0 ; i < count ; i++) {
+                char c = event.text.charAt(i);
+                if (c < '0' || c > '9') {
+                    event.doit = false;
+                    return;
+                }
+            }
+        }
+    };
+
+    /**
      * Callback when the AVD name is changed.
      * Enables the force checkbox if the name is a duplicate.
      */
     private class CreateNameModifyListener implements ModifyListener {
-
         public void modifyText(ModifyEvent e) {
             String name = mAvdName.getText().trim();
             AvdInfo avdMatch = mAvdManager.getAvd(name, false /*validAvdOnly*/);
@@ -96,8 +156,10 @@
         }
     }
 
+    /**
+     * {@link ModifyListener} used for live-validation of the fields content.
+     */
     private class ValidateListener extends SelectionAdapter implements ModifyListener {
-
         public void modifyText(ModifyEvent e) {
             validatePage();
         }
@@ -111,9 +173,14 @@
 
     protected AvdCreationDialog(Shell parentShell, AvdManager avdManager,
             ImageFactory imageFactory) {
-        super(parentShell);
+        super(parentShell, 2, false);
         mAvdManager = avdManager;
         mImageFactory = imageFactory;
+
+        File hardwareDefs = new File (avdManager.getSdkManager().getLocation() + File.separator +
+                SdkConstants.OS_SDK_TOOLS_LIB_FOLDER, SdkConstants.FN_HARDWARE_INI);
+        mHardwareMap = HardwareProperties.parseHardwareDefinitions(
+                hardwareDefs, null /*sdkLog*/);
     }
 
     @Override
@@ -139,25 +206,22 @@
     }
 
     @Override
-    protected Control createDialogArea(Composite parent) {
-        Composite top = new Composite(parent, SWT.NONE);
-        top.setLayoutData(new GridData(GridData.FILL_BOTH));
-        top.setLayout(new GridLayout(3, false));
+    public void createDialogContent(final Composite parent) {
+        GridData gd;
+        GridLayout gl;
 
-        Label label = new Label(top, SWT.NONE);
+        Label label = new Label(parent, SWT.NONE);
         label.setText("Name:");
 
-        mAvdName = new Text(top, SWT.BORDER);
-        mAvdName.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
-                true, false, 2, 1));
+        mAvdName = new Text(parent, SWT.BORDER);
+        mAvdName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
         mAvdName.addModifyListener(new CreateNameModifyListener());
 
-        label = new Label(top, SWT.NONE);
+        label = new Label(parent, SWT.NONE);
         label.setText("Target:");
 
-        mTargetCombo = new Combo(top, SWT.READ_ONLY | SWT.DROP_DOWN);
-        mTargetCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
-                true, false, 2, 1));
+        mTargetCombo = new Combo(parent, SWT.READ_ONLY | SWT.DROP_DOWN);
+        mTargetCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
         mTargetCombo.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
@@ -167,18 +231,46 @@
             }
         });
 
-        label = new Label(top, SWT.NONE);
+        // --- sd card group
+        label = new Label(parent, SWT.NONE);
         label.setText("SD Card:");
-        label.setToolTipText("Either a path to an existing SD card image\n" +
-                "or an image size in K or M (e.g. 512K, 10M).");
+        label.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING,
+                false, false));
+
+        final Group sdCardGroup = new Group(parent, SWT.NONE);
+        sdCardGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        sdCardGroup.setLayout(new GridLayout(3, false));
+
+        mSdCardSizeRadio = new Button(sdCardGroup, SWT.RADIO);
+        mSdCardSizeRadio.setText("Size:");
+        mSdCardSizeRadio.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent arg0) {
+                boolean sizeMode = mSdCardSizeRadio.getSelection();
+                enableSdCardWidgets(sizeMode);
+                validatePage();
+            }
+        });
 
         ValidateListener validateListener = new ValidateListener();
 
-        mSdCard = new Text(top, SWT.BORDER);
-        mSdCard.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-        mSdCard.addModifyListener(validateListener);
+        mSdCardSize = new Text(sdCardGroup, SWT.BORDER);
+        mSdCardSize.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        mSdCardSize.addVerifyListener(mDigitVerifier);
 
-        mBrowseSdCard = new Button(top, SWT.PUSH);
+        mSdCardSizeCombo = new Combo(sdCardGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
+        mSdCardSizeCombo.add("KiB");
+        mSdCardSizeCombo.add("MiB");
+        mSdCardSizeCombo.select(1);
+
+        mSdCardFileRadio = new Button(sdCardGroup, SWT.RADIO);
+        mSdCardFileRadio.setText("File:");
+
+        mSdCardFile = new Text(sdCardGroup, SWT.BORDER);
+        mSdCardFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        mSdCardFile.addModifyListener(validateListener);
+
+        mBrowseSdCard = new Button(sdCardGroup, SWT.PUSH);
         mBrowseSdCard.setText("Browse...");
         mBrowseSdCard.addSelectionListener(new SelectionAdapter() {
            @Override
@@ -188,32 +280,128 @@
             }
         });
 
-        label = new Label(top, SWT.NONE);
-        label.setText("Skin");
+        mSdCardSizeRadio.setSelection(true);
+        enableSdCardWidgets(true);
 
-        mSkinCombo = new Combo(top, SWT.READ_ONLY | SWT.DROP_DOWN);
-        mSkinCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
-                true, false, 2, 1));
+        // --- skin group
+        label = new Label(parent, SWT.NONE);
+        label.setText("Skin:");
+        label.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING,
+                false, false));
 
-        // dummies for alignment
-        label = new Label(top, SWT.NONE);
+        final Group skinGroup = new Group(parent, SWT.NONE);
+        skinGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        skinGroup.setLayout(new GridLayout(4, false));
 
-        mForceCreation = new Button(top, SWT.CHECK);
-        mForceCreation.setText("Force");
-        mForceCreation.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
+        mSkinListRadio = new Button(skinGroup, SWT.RADIO);
+        mSkinListRadio.setText("Built-in:");
+        mSkinListRadio.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent arg0) {
+                boolean listMode = mSkinListRadio.getSelection();
+                enableSkinWidgets(listMode);
+                validatePage();
+            }
+        });
+
+        mSkinCombo = new Combo(skinGroup, SWT.READ_ONLY | SWT.DROP_DOWN);
+        mSkinCombo.setLayoutData(gd = new GridData(GridData.FILL_HORIZONTAL));
+        gd.horizontalSpan = 3;
+        mSkinCombo.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent arg0) {
+                // get the skin info
+                loadSkin();
+            }
+        });
+
+        mSkinSizeRadio = new Button(skinGroup, SWT.RADIO);
+        mSkinSizeRadio.setText("Resolution:");
+
+        mSkinSizeWidth = new Text(skinGroup, SWT.BORDER);
+        mSkinSizeWidth.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        mSkinSizeWidth.addVerifyListener(mDigitVerifier);
+        mSkinSizeWidth.addModifyListener(validateListener);
+
+        new Label(skinGroup, SWT.NONE).setText("x");
+
+        mSkinSizeHeight = new Text(skinGroup, SWT.BORDER);
+        mSkinSizeHeight.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        mSkinSizeHeight.addVerifyListener(mDigitVerifier);
+        mSkinSizeHeight.addModifyListener(validateListener);
+
+        mSkinListRadio.setSelection(true);
+        enableSkinWidgets(true);
+
+        // --- hardware group
+        label = new Label(parent, SWT.NONE);
+        label.setText("Hardware:");
+        label.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING,
+                false, false));
+
+        final Group hwGroup = new Group(parent, SWT.NONE);
+        hwGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        hwGroup.setLayout(new GridLayout(2, false));
+
+        createHardwareTable(hwGroup);
+
+        // composite for the side buttons
+        Composite hwButtons = new Composite(hwGroup, SWT.NONE);
+        hwButtons.setLayoutData(new GridData(GridData.FILL_VERTICAL));
+        hwButtons.setLayout(gl = new GridLayout(1, false));
+        gl.marginHeight = gl.marginWidth = 0;
+
+        Button b = new Button(hwButtons, SWT.PUSH | SWT.FLAT);
+        b.setText("New...");
+        b.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        b.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent event) {
+                HardwarePropertyChooser dialog = new HardwarePropertyChooser(parent.getShell(),
+                        mHardwareMap, mProperties.keySet());
+                if (dialog.open() == Window.OK) {
+                    HardwareProperty choice = dialog.getProperty();
+                    if (choice != null) {
+                        mProperties.put(choice.getName(), choice.getDefault());
+                        mHardwareViewer.refresh();
+                    }
+                }
+            }
+        });
+        mDeleteHardwareProp = new Button(hwButtons, SWT.PUSH | SWT.FLAT);
+        mDeleteHardwareProp.setText("Delete");
+        mDeleteHardwareProp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        mDeleteHardwareProp.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent arg0) {
+                ISelection selection = mHardwareViewer.getSelection();
+                if (selection instanceof IStructuredSelection) {
+                    String hwName = (String)((IStructuredSelection)selection).getFirstElement();
+                    mProperties.remove(hwName);
+                    mHardwareViewer.refresh();
+                }
+            }
+        });
+        mDeleteHardwareProp.setEnabled(false);
+
+        // --- end hardware group
+
+        mForceCreation = new Button(parent, SWT.CHECK);
+        mForceCreation.setText("Force create");
+        mForceCreation.setToolTipText("Select this to override any existing AVD");
+        mForceCreation.setLayoutData(new GridData(GridData.END, GridData.CENTER,
                 true, false, 2, 1));
         mForceCreation.setEnabled(false);
         mForceCreation.addSelectionListener(validateListener);
 
         // add a separator to separate from the ok/cancel button
-        label = new Label(top, SWT.SEPARATOR | SWT.HORIZONTAL);
+        label = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
         label.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1));
 
         // add stuff for the error display
-        mStatusComposite = new Composite(top, SWT.NONE);
+        mStatusComposite = new Composite(parent, SWT.NONE);
         mStatusComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
                 true, false, 3, 1));
-        GridLayout gl;
         mStatusComposite.setLayout(gl = new GridLayout(2, false));
         gl.marginHeight = gl.marginWidth = 0;
 
@@ -225,8 +413,141 @@
         mStatusLabel.setText(" \n "); //$NON-NLS-1$
 
         reloadTargetCombo();
+    }
 
-        return top;
+    /**
+     * Creates the UI for the hardware properties table.
+     * This creates the {@link Table}, and several viewers ({@link TableViewer},
+     * {@link TableViewerColumn}) and adds edit support for the 2nd column
+     */
+    private void createHardwareTable(Composite parent) {
+        final Table hardwareTable = new Table(parent, SWT.SINGLE | SWT.FULL_SELECTION);
+        GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
+        gd.widthHint = 200;
+        gd.heightHint = 100;
+        hardwareTable.setLayoutData(gd);
+        hardwareTable.setHeaderVisible(true);
+        hardwareTable.setLinesVisible(true);
+
+        // -- Table viewer
+        mHardwareViewer = new TableViewer(hardwareTable);
+        mHardwareViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+            public void selectionChanged(SelectionChangedEvent event) {
+                // it's a single selection mode, we can just access the selection index
+                // from the table directly.
+                mDeleteHardwareProp.setEnabled(hardwareTable.getSelectionIndex() != -1);
+            }
+        });
+
+        // only a content provider. Use viewers per column below (for editing support)
+        mHardwareViewer.setContentProvider(new IStructuredContentProvider() {
+            public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+                // we can just ignore this. we just use mProperties directly.
+            }
+
+            public Object[] getElements(Object arg0) {
+                return mProperties.keySet().toArray();
+            }
+
+            public void dispose() {
+                // pass
+            }
+        });
+
+        // -- column 1: prop abstract name
+        TableColumn col1 = new TableColumn(hardwareTable, SWT.LEFT);
+        col1.setText("Property");
+        col1.setWidth(150);
+        TableViewerColumn tvc1 = new TableViewerColumn(mHardwareViewer, col1);
+        tvc1.setLabelProvider(new CellLabelProvider() {
+            @Override
+            public void update(ViewerCell cell) {
+                HardwareProperty prop = mHardwareMap.get(cell.getElement());
+                cell.setText(prop != null ? prop.getAbstract() : "");
+            }
+        });
+
+        // -- column 2: prop value
+        TableColumn col2 = new TableColumn(hardwareTable, SWT.LEFT);
+        col2.setText("Value");
+        col2.setWidth(50);
+        TableViewerColumn tvc2 = new TableViewerColumn(mHardwareViewer, col2);
+        tvc2.setLabelProvider(new CellLabelProvider() {
+            @Override
+            public void update(ViewerCell cell) {
+                String value = mProperties.get(cell.getElement());
+                cell.setText(value != null ? value : "");
+            }
+        });
+
+        // add editing support to the 2nd column
+        tvc2.setEditingSupport(new EditingSupport(mHardwareViewer) {
+            @Override
+            protected void setValue(Object element, Object value) {
+                String hardwareName = (String)element;
+                HardwareProperty property = mHardwareMap.get(hardwareName);
+                switch (property.getType()) {
+                    case INTEGER:
+                        mProperties.put((String)element, (String)value);
+                        break;
+                    case DISKSIZE:
+                        if (HardwareProperties.DISKSIZE_PATTERN.matcher((String)value).matches()) {
+                            mProperties.put((String)element, (String)value);
+                        }
+                        break;
+                    case BOOLEAN:
+                        int index = (Integer)value;
+                        mProperties.put((String)element, HardwareProperties.BOOLEAN_VALUES[index]);
+                        break;
+                }
+                mHardwareViewer.refresh(element);
+            }
+
+            @Override
+            protected Object getValue(Object element) {
+                String hardwareName = (String)element;
+                HardwareProperty property = mHardwareMap.get(hardwareName);
+                String value = mProperties.get(hardwareName);
+                switch (property.getType()) {
+                    case INTEGER:
+                        // intended fall-through.
+                    case DISKSIZE:
+                        return value;
+                    case BOOLEAN:
+                        return HardwareProperties.getBooleanValueIndex(value);
+                }
+
+                return null;
+            }
+
+            @Override
+            protected CellEditor getCellEditor(Object element) {
+                String hardwareName = (String)element;
+                HardwareProperty property = mHardwareMap.get(hardwareName);
+                switch (property.getType()) {
+                    // TODO: custom TextCellEditor that restrict input.
+                    case INTEGER:
+                        // intended fall-through.
+                    case DISKSIZE:
+                        return new TextCellEditor(hardwareTable);
+                    case BOOLEAN:
+                        return new ComboBoxCellEditor(hardwareTable,
+                                HardwareProperties.BOOLEAN_VALUES,
+                                SWT.READ_ONLY | SWT.DROP_DOWN);
+                }
+                return null;
+            }
+
+            @Override
+            protected boolean canEdit(Object element) {
+                String hardwareName = (String)element;
+                HardwareProperty property = mHardwareMap.get(hardwareName);
+                return property != null;
+            }
+        });
+
+
+        mHardwareViewer.setInput(mProperties);
     }
 
     @Override
@@ -240,18 +561,44 @@
 
     @Override
     protected void okPressed() {
-        if (onCreate()) {
+        if (createAvd()) {
             super.okPressed();
         }
     }
 
+    /**
+     * Enable or disable the sd card widgets.
+     * @param sizeMode if true the size-based widgets are to be enabled, and the file-based ones
+     * disabled.
+     */
+    private void enableSdCardWidgets(boolean sizeMode) {
+        mSdCardSize.setEnabled(sizeMode);
+        mSdCardSizeCombo.setEnabled(sizeMode);
+
+        mSdCardFile.setEnabled(!sizeMode);
+        mBrowseSdCard.setEnabled(!sizeMode);
+    }
+
+    /**
+     * Enable or disable the skin widgets.
+     * @param listMode if true the list-based widgets are to be enabled, and the size-based ones
+     * disabled.
+     */
+    private void enableSkinWidgets(boolean listMode) {
+        mSkinCombo.setEnabled(listMode);
+
+        mSkinSizeWidth.setEnabled(!listMode);
+        mSkinSizeHeight.setEnabled(!listMode);
+    }
+
+
     private void onBrowseSdCard() {
         FileDialog dlg = new FileDialog(getContents().getShell(), SWT.OPEN);
         dlg.setText("Choose SD Card image file.");
 
         String fileName = dlg.open();
         if (fileName != null) {
-            mSdCard.setText(fileName);
+            mSdCardFile.setText(fileName);
         }
     }
 
@@ -335,6 +682,7 @@
                     mSkinCombo.select(index);
                 } else {
                     mSkinCombo.select(0);  // default
+                    loadSkin();
                 }
             }
         }
@@ -363,12 +711,29 @@
 
         // Validate SDCard path or value
         if (error == null) {
-            String sdName = mSdCard.getText().trim();
+            // get the mode. We only need to check the file since the
+            // verifier on the size Text will prevent invalid input
+            boolean sdcardFileMode = mSdCardFileRadio.getSelection();
+            if (sdcardFileMode) {
+                String sdName = mSdCardFile.getText().trim();
+                if (sdName.length() > 0 && !new File(sdName).isFile()) {
+                    error = "SD Card path isn't valid.";
+                }
+            }
+        }
 
-            if (sdName.length() > 0 &&
-                    !new File(sdName).isFile() &&
-                    !AvdManager.SDCARD_SIZE_PATTERN.matcher(sdName).matches()) {
-                error = "SD Card must be either a file path or a size\nsuch as 128K or 64M.";
+        // validate the skin
+        if (error == null) {
+            // get the mode, we should only check if it's in size mode since
+            // the built-in list mode is always valid.
+            if (mSkinSizeRadio.getSelection()) {
+                // need both with and heigh to be non null
+                String width = mSkinSizeWidth.getText();   // no need for trim, since the verifier
+                String height = mSkinSizeHeight.getText(); // rejects non digit.
+
+                if (width.length() == 0 || height.length() == 0) {
+                    error = "Skin size is incorrect.\nBoth dimensions must be > 0";
+                }
             }
         }
 
@@ -378,7 +743,7 @@
             if (avdMatch != null && !mForceCreation.getSelection()) {
                 error = String.format(
                         "The AVD name '%s' is already used.\n" +
-                        "Check \"Force\" to override existing AVD.",
+                        "Check \"Force create\" to override existing AVD.",
                         avdName);
             }
         }
@@ -402,30 +767,135 @@
         mStatusComposite.pack(true);
     }
 
+    private void loadSkin() {
+        int targetIndex = mTargetCombo.getSelectionIndex();
+        if (targetIndex < 0) {
+            return;
+        }
+
+        // resolve the target.
+        String targetName = mTargetCombo.getItem(targetIndex);
+        IAndroidTarget target = mCurrentTargets.get(targetName);
+        if (target == null) {
+            return;
+        }
+
+        // get the skin name
+        String skinName = null;
+        int skinIndex = mSkinCombo.getSelectionIndex();
+        if (skinIndex < 0) {
+            return;
+        } else if (skinIndex == 0) { // default skin for the target
+            skinName = target.getDefaultSkin();
+        } else {
+            skinName = mSkinCombo.getItem(skinIndex);
+        }
+
+        // load the skin properties
+        String path = target.getPath(IAndroidTarget.SKINS);
+        File skin = new File(path, skinName);
+        if (skin.isDirectory() == false && target.isPlatform() == false) {
+            // it's possible the skin is in the parent target
+            path = target.getParent().getPath(IAndroidTarget.SKINS);
+            skin = new File(path, skinName);
+        }
+
+        if (skin.isDirectory() == false) {
+            return;
+        }
+
+        // now get the hardware.ini from the add-on (if applicable) and from the skin
+        // (if applicable)
+        HashMap<String, String> hardwareValues = new HashMap<String, String>();
+        if (target.isPlatform() == false) {
+            File targetHardwareFile = new File(target.getLocation(), AvdManager.HARDWARE_INI);
+            if (targetHardwareFile.isFile()) {
+                Map<String, String> targetHardwareConfig = SdkManager.parsePropertyFile(
+                        targetHardwareFile, null /*log*/);
+                if (targetHardwareConfig != null) {
+                    hardwareValues.putAll(targetHardwareConfig);
+                }
+            }
+        }
+
+        // from the skin
+        File skinHardwareFile = new File(skin, AvdManager.HARDWARE_INI);
+        if (skinHardwareFile.isFile()) {
+            Map<String, String> skinHardwareConfig = SdkManager.parsePropertyFile(
+                    skinHardwareFile, null /*log*/);
+            if (skinHardwareConfig != null) {
+                hardwareValues.putAll(skinHardwareConfig);
+            }
+        }
+
+        // now set those values in the list of properties for the AVD.
+        // We just check that none of those properties have been edited by the user yet.
+        for (Entry<String, String> entry : hardwareValues.entrySet()) {
+            if (mEditedProperties.contains(entry.getKey()) == false) {
+                mProperties.put(entry.getKey(), entry.getValue());
+            }
+        }
+
+        mHardwareViewer.refresh();
+    }
+
     /**
      * Creates an AVD from the values in the UI. Called when the user presses the OK button.
      */
-    private boolean onCreate() {
+    private boolean createAvd() {
         String avdName = mAvdName.getText().trim();
-        String sdName = mSdCard.getText().trim();
         int targetIndex = mTargetCombo.getSelectionIndex();
-        int skinIndex = mSkinCombo.getSelectionIndex();
-        boolean force = mForceCreation.getSelection();
 
+        // quick check on the name and the target selection
         if (avdName.length() == 0 || targetIndex < 0) {
             return false;
         }
 
+        // resolve the target.
         String targetName = mTargetCombo.getItem(targetIndex);
         IAndroidTarget target = mCurrentTargets.get(targetName);
         if (target == null) {
             return false;
         }
 
+        // get the SD card data from the UI.
+        String sdName = null;
+        if (mSdCardSizeRadio.getSelection()) {
+            // size mode
+            String value = mSdCardSize.getText().trim();
+            if (value.length() > 0) {
+                sdName = value;
+                // add the unit
+                switch (mSdCardSizeCombo.getSelectionIndex()) {
+                    case 0:
+                        sdName += "K";
+                        break;
+                    case 1:
+                        sdName += "M";
+                        break;
+                    default:
+                        // shouldn't be here
+                        assert false;
+                }
+            }
+        } else {
+            // file mode.
+            sdName = mSdCardFile.getText().trim();
+        }
+
+        // get the Skin data from the UI
         String skinName = null;
-        if (skinIndex > 0) {
-            // index 0 is the default, we don't use it
-            skinName = mSkinCombo.getItem(skinIndex);
+        if (mSkinListRadio.getSelection()) {
+            // built-in list provides the skin
+            int skinIndex = mSkinCombo.getSelectionIndex();
+            if (skinIndex > 0) {
+                // index 0 is the default, we don't use it
+                skinName = mSkinCombo.getItem(skinIndex);
+            }
+        } else {
+            // size mode. get both size and writes it as a skin name
+            // thanks to validatePage() we know the content of the fields is correct
+            skinName = mSkinSizeWidth.getText() + "x" + mSkinSizeHeight.getText(); //$NON-NLS-1$
         }
 
         SdkLog log = new SdkLog(String.format("Result of creating AVD '%s':", avdName),
@@ -440,6 +910,8 @@
             return false;
         }
 
+        boolean force = mForceCreation.getSelection();
+
         boolean success = false;
         AvdInfo avdInfo = mAvdManager.createAvd(
                 avdFolder,
@@ -447,14 +919,13 @@
                 target,
                 skinName,
                 sdName,
-                null, // hardwareConfig,
+                mProperties,
                 force,
                 log);
 
         success = avdInfo != null;
 
         log.displayResult(success);
-
         return success;
     }
 }
diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdSelector.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdSelector.java
index ba1bb4c..5338717 100644
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdSelector.java
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdSelector.java
@@ -26,6 +26,7 @@
 import com.android.sdklib.internal.avd.AvdManager.AvdInfo.AvdStatus;
 import com.android.sdklib.internal.repository.ITask;
 import com.android.sdklib.internal.repository.ITaskMonitor;
+import com.android.sdkuilib.internal.repository.SettingsController;
 import com.android.sdkuilib.internal.repository.icons.ImageFactory;
 import com.android.sdkuilib.internal.tasks.ProgressTask;
 import com.android.sdkuilib.repository.UpdaterWindow;
@@ -95,6 +96,8 @@
     private Image mOkImage;
     private Image mBrokenImage;
 
+    private SettingsController mController;
+
 
     /**
      * The display mode of the AVD Selector.
@@ -380,6 +383,14 @@
             DisplayMode displayMode) {
         this(parent, osSdkPath, manager, new TargetBasedFilter(filter), displayMode);
     }
+
+    /**
+     * Sets an optional SettingsController.
+     * @param controller the controller.
+     */
+    public void setSettingsController(SettingsController controller) {
+        mController = controller;
+    }
     /**
      * Sets the table grid layout data.
      *
@@ -898,52 +909,70 @@
             return;
         }
 
-        String path = mOsSdkPath +
-            File.separator +
-            SdkConstants.OS_SDK_TOOLS_FOLDER +
-            SdkConstants.FN_EMULATOR;
+        AvdStartDialog dialog = new AvdStartDialog(mTable.getShell(), avdInfo, mOsSdkPath,
+                mController);
+        if (dialog.open() == Window.OK) {
+            String path = mOsSdkPath +
+                File.separator +
+                SdkConstants.OS_SDK_TOOLS_FOLDER +
+                SdkConstants.FN_EMULATOR;
 
-        final String avdName = avdInfo.getName();
+            final String avdName = avdInfo.getName();
 
-        // build the command line based on the available parameters.
-        ArrayList<String> list = new ArrayList<String>();
-        list.add(path);
-        list.add("-avd");   //$NON-NLS-1$
-        list.add(avdName);
+            // build the command line based on the available parameters.
+            ArrayList<String> list = new ArrayList<String>();
+            list.add(path);
+            list.add("-avd");                             //$NON-NLS-1$
+            list.add(avdName);
+            if (dialog.getWipeData()) {
+                list.add("-wipe-data");                   //$NON-NLS-1$
+            }
+            float scale = dialog.getScale();
+            if (scale != 0.f) {
+                // do the rounding ourselves. This is because %.1f will write .4899 as .4
+                scale = Math.round(scale * 100);
+                scale /=  100.f;
+                list.add("-scale");                       //$NON-NLS-1$
+                list.add(String.format("%.2f", scale));   //$NON-NLS-1$
+            }
 
-        // convert the list into an array for the call to exec.
-        final String[] command = list.toArray(new String[list.size()]);
+            // convert the list into an array for the call to exec.
+            final String[] command = list.toArray(new String[list.size()]);
 
-        // launch the emulator
-        new ProgressTask(mTable.getShell(),
-                "Starting Android Emulator",
-                new ITask() {
-                    public void run(ITaskMonitor monitor) {
-                        try {
-                            monitor.setDescription("Starting emulator for AVD '%1$s'", avdName);
-                            int n = 10;
-                            monitor.setProgressMax(n);
-                            Process process = Runtime.getRuntime().exec(command);
-                            grabEmulatorOutput(process, monitor);
+            // launch the emulator
+            new ProgressTask(mTable.getShell(),
+                    "Starting Android Emulator",
+                    new ITask() {
+                        public void run(ITaskMonitor monitor) {
+                            try {
+                                monitor.setDescription("Starting emulator for AVD '%1$s'",
+                                        avdName);
+                                int n = 10;
+                                monitor.setProgressMax(n);
+                                Process process = Runtime.getRuntime().exec(command);
+                                grabEmulatorOutput(process, monitor);
 
-                            // This small wait prevents the dialog from closing too fast:
-                            // When it works, the emulator returns immediately, even if no UI
-                            // is shown yet. And when it fails (because the AVD is locked/running)
-                            // if we don't have a wait we don't capture the error for some reason.
-                            for (int i = 0; i < n; i++) {
-                                try {
-                                    Thread.sleep(100);
-                                    monitor.incProgress(1);
-                                } catch (InterruptedException e) {
-                                    // ignore
+                                // This small wait prevents the dialog from closing too fast:
+                                // When it works, the emulator returns immediately, even if
+                                // no UI is shown yet. And when it fails (because the AVD is
+                                // locked/running)
+                                // if we don't have a wait we don't capture the error for
+                                // some reason.
+                                for (int i = 0; i < n; i++) {
+                                    try {
+                                        Thread.sleep(100);
+                                        monitor.incProgress(1);
+                                    } catch (InterruptedException e) {
+                                        // ignore
+                                    }
                                 }
+                            } catch (IOException e) {
+                                monitor.setResult("Failed to start emulator: %1$s",
+                                        e.getMessage());
                             }
-                        } catch (IOException e) {
-                            monitor.setResult("Failed to start emulator: %1$s", e.getMessage());
                         }
-                    }
-        });
-
+            });
+        }
     }
 
     /**
diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdStartDialog.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdStartDialog.java
new file mode 100644
index 0000000..a2a9218
--- /dev/null
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/AvdStartDialog.java
@@ -0,0 +1,523 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sdkuilib.internal.widgets;
+
+import com.android.sdklib.internal.avd.AvdManager;
+import com.android.sdklib.internal.avd.AvdManager.AvdInfo;
+import com.android.sdkuilib.internal.repository.SettingsController;
+import com.android.sdkuilib.ui.GridDialog;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import java.awt.Toolkit;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Dialog dealing with emulator launch options. The following options are supported:
+ * <ul>
+ * <li>-wipe-data</li>
+ * <li>-scale</li>
+ * </ul>
+ *
+ * Values are stored (in the class as static field) to be reused while the app is still running.
+ * The Monitor dpi is stored in the settings if availabe.
+ */
+final class AvdStartDialog extends GridDialog {
+    // static field to reuse values during the same session.
+    private static boolean sWipeData = false;
+    private static int sMonitorDpi = 72; // used if there's no setting controller.
+    private static final Map<String, String> sSkinScaling = new HashMap<String, String>();
+
+    private static final Pattern sScreenSizePattern = Pattern.compile("\\d*(\\.\\d?)?");
+
+    private final AvdInfo mAvd;
+    private final String mSdkLocation;
+    private final SettingsController mSettingsController;
+
+    private Text mScreenSize;
+    private Text mMonitorDpi;
+    private Button mScaleButton;
+
+    private float mScale = 0.f;
+    private boolean mWipeData = false;
+    private int mDensity = 160; // medium density
+    private int mSize1 = -1;
+    private int mSize2 = -1;
+    private String mSkinDisplay;
+    private boolean mEnableScaling = true;
+    private Label mScaleField;
+
+    AvdStartDialog(Shell parentShell, AvdInfo avd, String sdkLocation,
+            SettingsController settingsController) {
+        super(parentShell, 2, false);
+        mAvd = avd;
+        mSdkLocation = sdkLocation;
+        mSettingsController = settingsController;
+        if (mAvd == null) {
+            throw new IllegalArgumentException("avd cannot be null");
+        }
+        if (mSdkLocation == null) {
+            throw new IllegalArgumentException("sdkLocation cannot be null");
+        }
+
+        computeSkinData();
+    }
+
+    public boolean getWipeData() {
+        return mWipeData;
+    }
+
+    /**
+     * Returns the scaling factor, or 0.f if none are set.
+     */
+    public float getScale() {
+        return mScale;
+    }
+
+    @Override
+    public void createDialogContent(final Composite parent) {
+        GridData gd;
+
+        Label l = new Label(parent, SWT.NONE);
+        l.setText("Skin:");
+
+        l = new Label(parent, SWT.NONE);
+        l.setText(mSkinDisplay == null ? "None" : mSkinDisplay);
+        l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+        l = new Label(parent, SWT.NONE);
+        l.setText("Density:");
+
+        l = new Label(parent, SWT.NONE);
+        l.setText(getDensityText());
+        l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+        mScaleButton = new Button(parent, SWT.CHECK);
+        mScaleButton.setText("Scale display to real size");
+        mScaleButton.setEnabled(mEnableScaling);
+        boolean defaultState = mEnableScaling && sSkinScaling.get(mAvd.getName()) != null;
+        mScaleButton.setSelection(defaultState);
+        mScaleButton.setLayoutData(gd = new GridData(GridData.FILL_HORIZONTAL));
+        gd.horizontalSpan = 2;
+        final Group scaleGroup = new Group(parent, SWT.NONE);
+        scaleGroup.setLayoutData(gd = new GridData(GridData.FILL_HORIZONTAL));
+        gd.horizontalIndent = 30;
+        gd.horizontalSpan = 2;
+        scaleGroup.setLayout(new GridLayout(3, false));
+
+        l = new Label(scaleGroup, SWT.NONE);
+        l.setText("Screen Size (in):");
+        mScreenSize = new Text(scaleGroup, SWT.BORDER);
+        mScreenSize.setText(getScreenSize());
+        mScreenSize.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        mScreenSize.addVerifyListener(new VerifyListener() {
+            public void verifyText(VerifyEvent event) {
+                // combine the current content and the new text
+                String text = mScreenSize.getText();
+                text = text.substring(0, event.start) + event.text + text.substring(event.end);
+
+                // now make sure it's a match for the regex
+                event.doit = sScreenSizePattern.matcher(text).matches();
+            }
+        });
+        mScreenSize.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent event) {
+                onScaleChange();
+            }
+        });
+
+        // empty composite, only 2 widgets on this line.
+        new Composite(scaleGroup, SWT.NONE).setLayoutData(gd = new GridData());
+        gd.widthHint = gd.heightHint = 0;
+
+        l = new Label(scaleGroup, SWT.NONE);
+        l.setText("Monitor dpi:");
+        mMonitorDpi = new Text(scaleGroup, SWT.BORDER);
+        mMonitorDpi.setText(Integer.toString(getMonitorDpi()));
+        mMonitorDpi.setLayoutData(gd = new GridData(GridData.FILL_HORIZONTAL));
+        gd.widthHint = 50;
+        mMonitorDpi.addVerifyListener(new VerifyListener() {
+            public void verifyText(VerifyEvent event) {
+                // check for digit only.
+                for (int i = 0 ; i < event.text.length(); i++) {
+                    char letter = event.text.charAt(i);
+                    if (letter < '0' || letter > '9') {
+                        event.doit = false;
+                        return;
+                    }
+                }
+            }
+        });
+        mMonitorDpi.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent event) {
+                onScaleChange();
+            }
+        });
+
+        Button button = new Button(scaleGroup, SWT.PUSH | SWT.FLAT);
+        button.setText("?");
+        button.setToolTipText("Click to figure out your monitor's pixel density");
+        button.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent arg0) {
+                ResolutionChooserDialog dialog = new ResolutionChooserDialog(parent.getShell());
+                if (dialog.open() == Window.OK) {
+                    mMonitorDpi.setText(Integer.toString(dialog.getDensity()));
+                }
+            }
+        });
+
+        l = new Label(scaleGroup, SWT.NONE);
+        l.setText("Scale:");
+        mScaleField = new Label(scaleGroup, SWT.NONE);
+        mScaleField.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
+                true /*grabExcessHorizontalSpace*/,
+                true /*grabExcessVerticalSpace*/,
+                2 /*horizontalSpan*/,
+                1 /*verticalSpan*/));
+        setScale(mScale); // set initial text value
+
+        enableGroup(scaleGroup, defaultState);
+
+        mScaleButton.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent event) {
+                boolean enabled = mScaleButton.getSelection();
+                enableGroup(scaleGroup, enabled);
+                if (enabled) {
+                    onScaleChange();
+                } else {
+                    setScale(0);
+                }
+            }
+        });
+
+        final Button wipeButton = new Button(parent, SWT.CHECK);
+        wipeButton.setLayoutData(gd = new GridData(GridData.FILL_HORIZONTAL));
+        gd.horizontalSpan = 2;
+        wipeButton.setText("Wipe user data");
+        wipeButton.setSelection(mWipeData = sWipeData);
+        wipeButton.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent arg0) {
+                mWipeData = wipeButton.getSelection();
+            }
+        });
+
+        l = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
+        l.setLayoutData(gd = new GridData(GridData.FILL_HORIZONTAL));
+        gd.horizontalSpan = 2;
+
+        // if the scaling is enabled by default, we must initialize the value of mScale
+        if (defaultState) {
+            onScaleChange();
+        }
+    }
+
+    /** On Windows we need to manually enable/disable the children of a group */
+    private void enableGroup(final Group group, boolean enabled) {
+        group.setEnabled(enabled);
+        for (Control c : group.getChildren()) {
+            c.setEnabled(enabled);
+        }
+    }
+
+    @Override
+    protected void configureShell(Shell newShell) {
+        super.configureShell(newShell);
+        newShell.setText("Launch Options");
+    }
+
+    @Override
+    protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
+        if (id == IDialogConstants.OK_ID) {
+            label = "Launch";
+        }
+
+        return super.createButton(parent, id, label, defaultButton);
+    }
+
+    @Override
+    protected void okPressed() {
+        // override ok to store some info
+        // first the monitor dpi
+        String dpi = mMonitorDpi.getText();
+        if (dpi.length() > 0) {
+            sMonitorDpi = Integer.parseInt(dpi);
+
+            // if there is a setting controller, save it
+            if (mSettingsController != null) {
+                mSettingsController.setMonitorDensity(sMonitorDpi);
+                mSettingsController.saveSettings();
+            }
+        }
+
+        // now the scale factor
+        String key = mAvd.getName();
+        sSkinScaling.remove(key);
+        if (mScaleButton.getSelection()) {
+            String size = mScreenSize.getText();
+            if (size.length() > 0) {
+                sSkinScaling.put(key, size);
+            }
+        }
+
+        // and then the wipe-data checkbox
+        sWipeData = mWipeData;
+
+        // finally continue with the ok action
+        super.okPressed();
+    }
+
+    private void computeSkinData() {
+        Map<String, String> prop = mAvd.getProperties();
+        String dpi = prop.get("hw.lcd.density");
+        if (dpi != null && dpi.length() > 0) {
+            mDensity  = Integer.parseInt(dpi);
+        }
+
+        findSkinResolution();
+    }
+
+    private void onScaleChange() {
+        String sizeStr = mScreenSize.getText();
+        if (sizeStr.length() == 0) {
+            setScale(0);
+            return;
+        }
+
+        String dpiStr = mMonitorDpi.getText();
+        if (dpiStr.length() == 0) {
+            setScale(0);
+            return;
+        }
+
+        int dpi = Integer.parseInt(dpiStr);
+        float size = Float.parseFloat(sizeStr);
+        /*
+         * We are trying to emulate the following device:
+         * resolution: 'mSize1'x'mSize2'
+         * density: 'mDensity'
+         * screen diagonal: 'size'
+         * ontop a monitor running at 'dpi'
+         */
+        // We start by computing the screen diagonal in pixels, if the density was really mDensity
+        float diagonalPx = (float)Math.sqrt(mSize1*mSize1+mSize2*mSize2);
+        // Now we would convert this in actual inches:
+        //    diagonalIn = diagonal / mDensity
+        // the scale factor is a mix of adapting to the new density and to the new size.
+        //    (size/diagonalIn) * (dpi/mDensity)
+        // this can be simplified to:
+        setScale((size * dpi) / diagonalPx);
+    }
+
+    private void setScale(float scale) {
+        mScale = scale;
+
+        // Do the rounding exactly like AvdSelector will do.
+        scale = Math.round(scale * 100);
+        scale /=  100.f;
+
+        if (scale == 0.f) {
+            mScaleField.setText("default");  //$NON-NLS-1$
+        } else {
+            mScaleField.setText(String.format("%.2f", scale));  //$NON-NLS-1$
+        }
+    }
+
+    /**
+     * Returns the monitor dpi to start with.
+     * This can be coming from the settings, the session-based storage, or the from whatever Java
+     * can tell us.
+     */
+    private int getMonitorDpi() {
+        if (mSettingsController != null) {
+            sMonitorDpi = mSettingsController.getMonitorDensity();
+        }
+
+        if (sMonitorDpi == -1) { // first time? try to get a value
+            sMonitorDpi = Toolkit.getDefaultToolkit().getScreenResolution();
+        }
+
+        return sMonitorDpi;
+    }
+
+    /**
+     * Returns the screen size to start with.
+     * <p/>If an emulator with the same skin was already launched, scaled, the size used is reused.
+     * <p/>Otherwise the default is returned (3)
+     */
+    private String getScreenSize() {
+        String size = sSkinScaling.get(mAvd.getName());
+        if (size != null) {
+            return size;
+        }
+
+        return "3";
+    }
+
+    /**
+     * Returns a display string for the density.
+     */
+    private String getDensityText() {
+        switch (mDensity) {
+            case 120:
+                return "Low (120)";
+            case 160:
+                return "Medium (160)";
+            case 240:
+                return "High (240)";
+        }
+
+        return Integer.toString(mDensity);
+    }
+
+    /**
+     * Finds the skin resolution and sets it in {@link #mSize1} and {@link #mSize2}.
+     */
+    private void findSkinResolution() {
+        Map<String, String> prop = mAvd.getProperties();
+        String skinName = prop.get(AvdManager.AVD_INI_SKIN_NAME);
+
+        if (skinName != null) {
+            Matcher m = AvdManager.NUMERIC_SKIN_SIZE.matcher(skinName);
+            if (m != null && m.matches()) {
+                mSize1 = Integer.parseInt(m.group(1));
+                mSize2 = Integer.parseInt(m.group(2));
+                mSkinDisplay = skinName;
+                mEnableScaling = true;
+                return;
+            }
+        }
+
+        // The resolution is inside the layout file of the skin.
+        mEnableScaling = false; // default to false for now.
+
+        // path to the skin layout file.
+        String skinPath = prop.get(AvdManager.AVD_INI_SKIN_PATH);
+        if (skinPath != null) {
+            File skinFolder = new File(mSdkLocation, skinPath);
+            if (skinFolder.isDirectory()) {
+                File layoutFile = new File(skinFolder, "layout");
+                if (layoutFile.isFile()) {
+                    if (parseLayoutFile(layoutFile)) {
+                        mSkinDisplay = String.format("%1$s (%2$dx%3$d)", skinName, mSize1, mSize2);
+                        mEnableScaling = true;
+                    } else {
+                        mSkinDisplay = skinName;
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Parses a layout file.
+     * <p/>
+     * the format is relatively easy. It's a collection of items defined as
+     * &lg;name&gt; {
+     *     &lg;content&gt;
+     * }
+     *
+     * content is either 1+ items or 1+ properties
+     * properties are defined as
+     * &lg;name&gt;&lg;whitespace&gt;&lg;value&gt;
+     *
+     * We're going to look for an item called display, with 2 properties height and width.
+     * This is very basic parser.
+     *
+     * @param layoutFile the file to parse
+     * @return true if both sizes where found.
+     */
+    private boolean parseLayoutFile(File layoutFile) {
+        try {
+            BufferedReader input = new BufferedReader(new FileReader(layoutFile));
+            String line;
+
+            while ((line = input.readLine()) != null) {
+                // trim to remove whitespace
+                line = line.trim();
+                int len = line.length();
+                if (len == 0) continue;
+
+                // check if this is a new item
+                if (line.charAt(len-1) == '{') {
+                    // this is the start of a node
+                    String[] tokens = line.split(" ");
+                    if ("display".equals(tokens[0])) {
+                        // this is the one we're looking for!
+                        while ((mSize1 == -1 || mSize2 == -1) &&
+                                (line = input.readLine()) != null) {
+                            // trim to remove whitespace
+                            line = line.trim();
+                            len = line.length();
+                            if (len == 0) continue;
+
+                            if ("}".equals(line)) { // looks like we're done with the item.
+                                break;
+                            }
+
+                            tokens = line.split(" ");
+                            if (tokens.length >= 2) {
+                                // there can be multiple space between the name and value
+                                // in which case we'll get an extra empty token in the middle.
+                                if ("width".equals(tokens[0])) {
+                                    mSize1 = Integer.parseInt(tokens[tokens.length-1]);
+                                } else if ("height".equals(tokens[0])) {
+                                    mSize2 = Integer.parseInt(tokens[tokens.length-1]);
+                                }
+                            }
+                        }
+
+                        return mSize1 != -1 && mSize2 != -1;
+                    }
+                }
+
+            }
+            // if it reaches here, display was not found.
+            // false is returned below.
+        } catch (IOException e) {
+            // ignore.
+        }
+
+        return false;
+    }
+}
diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/HardwarePropertyChooser.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/HardwarePropertyChooser.java
new file mode 100644
index 0000000..5184442
--- /dev/null
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/HardwarePropertyChooser.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sdkuilib.internal.widgets;
+
+import com.android.sdklib.internal.avd.HardwareProperties.HardwareProperty;
+import com.android.sdkuilib.ui.GridDialog;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * Dialog to choose a hardware property
+ */
+class HardwarePropertyChooser extends GridDialog {
+
+    private final Map<String, HardwareProperty> mProperties;
+    private final Collection<String> mExceptProperties;
+    private HardwareProperty mChosenProperty;
+    private Label mTypeLabel;
+    private Label mDescriptionLabel;
+
+    HardwarePropertyChooser(Shell parentShell, Map<String, HardwareProperty> properties,
+            Collection<String> exceptProperties) {
+        super(parentShell, 2, false);
+        mProperties = properties;
+        mExceptProperties = exceptProperties;
+    }
+
+    public HardwareProperty getProperty() {
+        return mChosenProperty;
+    }
+
+    @Override
+    public void createDialogContent(Composite parent) {
+        Label l = new Label(parent, SWT.NONE);
+        l.setText("Property:");
+
+        final Combo c = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
+        // simple list for index->name resolution.
+        final ArrayList<String> indexToName = new ArrayList<String>();
+        for (Entry<String, HardwareProperty> entry : mProperties.entrySet()) {
+            if (mExceptProperties.contains(entry.getKey()) == false) {
+                c.add(entry.getValue().getAbstract());
+                indexToName.add(entry.getKey());
+            }
+        }
+        boolean hasValues = true;
+        if (indexToName.size() == 0) {
+            hasValues = false;
+            c.add("No properties");
+            c.select(0);
+            c.setEnabled(false);
+        }
+
+        c.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent event) {
+                int index = c.getSelectionIndex();
+                String name = indexToName.get(index);
+                processSelection(name, true /* pack */);
+            }
+        });
+
+        l = new Label(parent, SWT.NONE);
+        l.setText("Type:");
+
+        mTypeLabel = new Label(parent, SWT.NONE);
+
+        l = new Label(parent, SWT.NONE);
+        l.setText("Description:");
+
+        mDescriptionLabel = new Label(parent, SWT.NONE);
+
+        if (hasValues) {
+            c.select(0);
+            processSelection(indexToName.get(0), false /* pack */);
+        }
+    }
+
+    private void processSelection(String name, boolean pack) {
+        mChosenProperty = mProperties.get(name);
+        mTypeLabel.setText(mChosenProperty.getType().getValue());
+        String desc = mChosenProperty.getDescription();
+        if (desc != null) {
+            mDescriptionLabel.setText(mChosenProperty.getDescription());
+        } else {
+            mDescriptionLabel.setText("N/A");
+        }
+
+        if (pack) {
+            getShell().pack();
+        }
+    }
+
+}
diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/ResolutionChooserDialog.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/ResolutionChooserDialog.java
new file mode 100644
index 0000000..60888e6
--- /dev/null
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/widgets/ResolutionChooserDialog.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sdkuilib.internal.widgets;
+
+import com.android.sdkuilib.ui.GridDialog;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Monitor;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Small dialog to let a user choose a screen size (from a fixed list) and a resolution
+ * (as returned by {@link Display#getMonitors()}).
+
+ * After the dialog as returned, one can query {@link #getDensity()} to get the chosen monitor
+ * pixel density.
+ */
+class ResolutionChooserDialog extends GridDialog {
+    public final static float[] MONITOR_SIZES = new float[] {
+            13.3f, 14, 15.4f, 15.6f, 17, 19, 20, 21, 24, 30,
+    };
+
+    private Button mButton;
+    private Combo mScreenSizeCombo;
+    private Combo mMonitorCombo;
+
+    private Monitor[] mMonitors;
+    private int mScreenSizeIndex = -1;
+    private int mMonitorIndex = 0;
+
+    ResolutionChooserDialog(Shell parentShell) {
+        super(parentShell, 2, false);
+    }
+
+    /**
+     * Returns the pixel density of the user-chosen monitor.
+     */
+    int getDensity() {
+        float size = MONITOR_SIZES[mScreenSizeIndex];
+        Rectangle rect = mMonitors[mMonitorIndex].getBounds();
+
+        // compute the density
+        double d = Math.sqrt(rect.width * rect.width + rect.height * rect.height) / size;
+        return (int)Math.round(d);
+    }
+
+    @Override
+    protected void configureShell(Shell newShell) {
+        newShell.setText("Monitor Density");
+        super.configureShell(newShell);
+    }
+
+    @Override
+    protected Control createContents(Composite parent) {
+        Control control = super.createContents(parent);
+        mButton = getButton(IDialogConstants.OK_ID);
+        mButton.setEnabled(false);
+        return control;
+    }
+
+    @Override
+    public void createDialogContent(Composite parent) {
+        Label l = new Label(parent, SWT.NONE);
+        l.setText("Screen Size:");
+
+        mScreenSizeCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
+        for (float size : MONITOR_SIZES) {
+            if (Math.round(size) == size) {
+                mScreenSizeCombo.add(String.format("%.0f\"", size));
+            } else {
+                mScreenSizeCombo.add(String.format("%.1f\"", size));
+            }
+        }
+        mScreenSizeCombo.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent arg0) {
+                mScreenSizeIndex = mScreenSizeCombo.getSelectionIndex();
+                mButton.setEnabled(mScreenSizeIndex != -1);
+            }
+        });
+
+        l = new Label(parent, SWT.NONE);
+        l.setText("Resolution:");
+
+        mMonitorCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
+        mMonitors = parent.getDisplay().getMonitors();
+        for (Monitor m : mMonitors) {
+            Rectangle r = m.getBounds();
+            mMonitorCombo.add(String.format("%d x %d", r.width, r.height));
+        }
+        mMonitorCombo.select(mMonitorIndex);
+        mMonitorCombo.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetDefaultSelected(SelectionEvent arg0) {
+                mMonitorIndex = mMonitorCombo.getSelectionIndex();
+            }
+        });
+    }
+}
diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/UpdaterWindow.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/UpdaterWindow.java
index 94881dc..7b56067 100755
--- a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/UpdaterWindow.java
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/repository/UpdaterWindow.java
@@ -70,6 +70,25 @@
     }

 

     /**

+     * Indicate the initial page that should be selected when the window opens.

+     * <p/>

+     * This must be called before the call to {@link #open()}.

+     * If null or if the page class is not found, the first page will be selected.

+     */

+    public void setInitialPage(Class<? extends Composite> pageClass) {

+        mWindow.setInitialPage(pageClass);

+    }

+

+    /**

+     * Sets whether the auto-update wizard will be shown when opening the window.

+     * <p/>

+     * This must be called before the call to {@link #open()}.

+     */

+    public void setRequestAutoUpdate(boolean requestAutoUpdate) {

+        mWindow.setRequestAutoUpdate(requestAutoUpdate);

+    }

+

+    /**

      * Adds a new listener to be notified when a change is made to the content of the SDK.

      */

     public void addListeners(ISdkListener listener) {

diff --git a/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/ui/GridDialog.java b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/ui/GridDialog.java
new file mode 100644
index 0000000..8329fd6
--- /dev/null
+++ b/tools/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/ui/GridDialog.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sdkuilib.ui;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * jface-based dialog that properly sets up a {@link GridLayout} top composite with the proper
+ * margin.
+ *
+ * Implementing dialog must create the content of the dialog in
+ * {@link #createDialogContent(Composite)}.
+ *
+ */
+public abstract class GridDialog extends Dialog {
+
+    private final int mNumColumns;
+    private final boolean mMakeColumnsEqualWidth;
+
+    /**
+     * Creates the dialog
+     * @param parentShell the parent {@link Shell}.
+     * @param numColumns the number of columns in the grid
+     * @param makeColumnsEqualWidth whether or not the columns will have equal width
+     */
+    public GridDialog(Shell parentShell, int numColumns, boolean makeColumnsEqualWidth) {
+        super(parentShell);
+        mNumColumns = numColumns;
+        mMakeColumnsEqualWidth = makeColumnsEqualWidth;
+    }
+
+    /**
+     * Creates the content of the dialog. The <var>parent</var> composite is a {@link GridLayout}
+     * created with the <var>numColumn</var> and <var>makeColumnsEqualWidth</var> parameters
+     * passed to {@link #GridDialog(Shell, int, boolean)}.
+     * @param parent the parent composite.
+     */
+    public abstract void createDialogContent(Composite parent);
+
+    @Override
+    protected Control createDialogArea(Composite parent) {
+        Composite top = new Composite(parent, SWT.NONE);
+        GridLayout layout = new GridLayout(mNumColumns, mMakeColumnsEqualWidth);
+        layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+        layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+        layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+        layout.horizontalSpacing = convertHorizontalDLUsToPixels(
+                IDialogConstants.HORIZONTAL_SPACING);
+        top.setLayout(layout);
+        top.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+        createDialogContent(top);
+
+        applyDialogFont(top);
+        return top;
+    }
+}
diff --git a/tools/sdkmanager/libs/sdkuilib/tests/com/android/sdkuilib/internal/repository/UpdaterLogicTest.java b/tools/sdkmanager/libs/sdkuilib/tests/com/android/sdkuilib/internal/repository/UpdaterLogicTest.java
new file mode 100755
index 0000000..3e22b35
--- /dev/null
+++ b/tools/sdkmanager/libs/sdkuilib/tests/com/android/sdkuilib/internal/repository/UpdaterLogicTest.java
@@ -0,0 +1,107 @@
+/*

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package com.android.sdkuilib.internal.repository;

+

+import com.android.sdklib.internal.repository.Archive;

+import com.android.sdklib.internal.repository.MockAddonPackage;

+import com.android.sdklib.internal.repository.MockPlatformPackage;

+import com.android.sdklib.internal.repository.MockToolPackage;

+import com.android.sdklib.internal.repository.Package;

+import com.android.sdklib.internal.repository.RepoSource;

+

+import java.util.ArrayList;

+import java.util.Arrays;

+

+import junit.framework.TestCase;

+

+public class UpdaterLogicTest extends TestCase {

+

+    private static class MockUpdaterLogic extends UpdaterLogic {

+        private final Package[] mRemotePackages;

+

+        public MockUpdaterLogic(Package[] remotePackages) {

+            mRemotePackages = remotePackages;

+        }

+

+        @Override

+        protected void fetchRemotePackages(ArrayList<Package> remotePkgs,

+                RepoSource[] remoteSources) {

+            // Ignore remoteSources and instead uses the remotePackages list given to the

+            // constructor.

+            if (mRemotePackages != null) {

+                remotePkgs.addAll(Arrays.asList(mRemotePackages));

+            }

+        }

+    }

+

+    public void testFindAddonDependency() throws Exception {

+        MockUpdaterLogic mul = new MockUpdaterLogic(null);

+

+        MockPlatformPackage p1 = new MockPlatformPackage(1, 1);

+        MockPlatformPackage p2 = new MockPlatformPackage(2, 1);

+

+        MockAddonPackage a1 = new MockAddonPackage(p1, 1);

+        MockAddonPackage a2 = new MockAddonPackage(p2, 2);

+

+        ArrayList<ArchiveInfo> out = new ArrayList<ArchiveInfo>();

+        ArrayList<Archive> selected = new ArrayList<Archive>();

+        ArrayList<Package> remote = new ArrayList<Package>();

+

+        // a2 depends on p2, which is not in the locals

+        Package[] locals = { p1, a1 };

+        RepoSource[] sources = null;

+        assertNull(mul.findPlatformDependency(a2, out, selected, remote, sources, locals));

+        assertEquals(0, out.size());

+

+        // p2 is now selected, and should be scheduled for install in out

+        Archive p2_archive = p2.getArchives()[0];

+        selected.add(p2_archive);

+        ArchiveInfo ai2 = mul.findPlatformDependency(a2, out, selected, remote, sources, locals);

+        assertNotNull(ai2);

+        assertSame(p2_archive, ai2.getNewArchive());

+        assertEquals(1, out.size());

+        assertSame(p2_archive, out.get(0).getNewArchive());

+    }

+

+    public void testFindPlatformDependency() throws Exception {

+        MockUpdaterLogic mul = new MockUpdaterLogic(null);

+

+        MockToolPackage t1 = new MockToolPackage(1);

+        MockToolPackage t2 = new MockToolPackage(2);

+

+        MockPlatformPackage p2 = new MockPlatformPackage(2, 1, 2);

+

+        ArrayList<ArchiveInfo> out = new ArrayList<ArchiveInfo>();

+        ArrayList<Archive> selected = new ArrayList<Archive>();

+        ArrayList<Package> remote = new ArrayList<Package>();

+

+        // p2 depends on t2, which is not locally installed

+        Package[] locals = { t1 };

+        RepoSource[] sources = null;

+        assertNull(mul.findToolsDependency(p2, out, selected, remote, sources, locals));

+        assertEquals(0, out.size());

+

+        // t2 is now selected and can be used as a dependency

+        Archive t2_archive = t2.getArchives()[0];

+        selected.add(t2_archive);

+        ArchiveInfo ai2 = mul.findToolsDependency(p2, out, selected, remote, sources, locals);

+        assertNotNull(ai2);

+        assertSame(t2_archive, ai2.getNewArchive());

+        assertEquals(1, out.size());

+        assertSame(t2_archive, out.get(0).getNewArchive());

+    }

+}

diff --git a/tools/traceview/etc/traceview b/tools/traceview/etc/traceview
index fc7d8c0..065cd0f 100755
--- a/tools/traceview/etc/traceview
+++ b/tools/traceview/etc/traceview
@@ -14,27 +14,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# This script assumes that the path to this script is something like:
-#
-# /somepath/outdir/archdir/hostdir/bindir/traceview
-#
-# where "somepath" is some pathname (like "/work/android/device/")
-#       "outdir"   is a subdirectory (like "out")
-#       "archdir"  is a subdirectory (like "linux-x86-release")
-#       "hostdir"  is a subdirectory (like "host")
-#       "bindir"   is a subdirectory (like "bin")
-#
-# e.g. /work/android/device/out/linux-x86-release/host/bin/traceview
-#
-# and that the following directories also exist:
-#
-# /somepath/outdir/archdir/hostdir/lib/
-# /somepath/outdir/archdir/hostdir/framework/
-#
-# where:
-#       "lib", and "framework" are at the same level as "bindir",
-#        and are the literal names.
-
 # Set up prog to be the path of this script, including following symlinks,
 # and set up progdir to be the fully-qualified pathname of its directory.
 prog="$0"
@@ -75,13 +54,17 @@
     exit 1
 fi
 
+javaCmd="java"
+
 os=`uname`
 if [ $os == 'Darwin' ]; then
   javaOpts="-Xmx1600M -XstartOnFirstThread"
-  javaCmd="/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/java"
 else
   javaOpts="-Xmx1600M"
-  javaCmd="java"
+fi
+
+if [ `uname` = "Linux" ]; then
+    export GDK_NATIVE_WINDOWS=true
 fi
 
 while expr "x$1" : 'x-J' >/dev/null; do
@@ -90,12 +73,7 @@
     shift
 done
 
-if [ "$OSTYPE" = "cygwin" ] ; then
-    jarpath=`cygpath -w  "$frameworkdir/$jarfile"`
-    progdir=`cygpath -w  "$progdir"`
-else
-    jarpath="$frameworkdir/$jarfile"
-fi
+jarpath="$frameworkdir/$jarfile"
 
 # Figure out the path to the swt.jar for the current architecture.
 # if ANDROID_SWT is defined, then just use this.
@@ -105,7 +83,7 @@
 if [ -n "$ANDROID_SWT" ]; then
     swtpath="$ANDROID_SWT"
 else
-    vmarch=`java -jar "${frameworkdir}"/archquery.jar`
+    vmarch=`${javaCmd} -jar "${frameworkdir}"/archquery.jar`
     if [ -n "$ANDROID_BUILD_TOP" ]; then
         osname=`uname -s | tr A-Z a-z`
         swtpath="${ANDROID_BUILD_TOP}/prebuilt/${osname}-${vmarch}/swt"
@@ -123,4 +101,4 @@
     exit 1
 fi
 
-exec "$javaCmd" $javaOpts -Djava.ext.dirs="$frameworkdir" -jar "$jarpath" "$@"
+exec "${javaCmd}" $javaOpts -Djava.ext.dirs="$frameworkdir" -Dcom.android.traceview.toolsdir="$progdir" -jar "$jarpath" "$@"
diff --git a/tools/traceview/etc/traceview.bat b/tools/traceview/etc/traceview.bat
index 2da8a3b..02fbe85 100755
--- a/tools/traceview/etc/traceview.bat
+++ b/tools/traceview/etc/traceview.bat
@@ -55,4 +55,4 @@
 :SetPath
 set javaextdirs=%swt_path%;%frameworkdir%
 
-call java -Djava.ext.dirs=%javaextdirs% -jar %jarpath% %*
+call java -Djava.ext.dirs=%javaextdirs% -Dcom.android.traceview.toolsdir= -jar %jarpath% %*
diff --git a/tools/traceview/src/com/android/traceview/MainWindow.java b/tools/traceview/src/com/android/traceview/MainWindow.java
index 5800f81..00fcc8b 100644
--- a/tools/traceview/src/com/android/traceview/MainWindow.java
+++ b/tools/traceview/src/com/android/traceview/MainWindow.java
@@ -30,14 +30,16 @@
 import org.eclipse.swt.widgets.Shell;
 
 import java.io.File;
-import java.io.IOException;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.nio.channels.FileChannel;
 import java.util.HashMap;
+import java.util.Properties;
 
 public class MainWindow extends ApplicationWindow {
-    
+
     private final static String PING_NAME = "Traceview";
     private final static String PING_VERSION = "1.0";
 
@@ -99,10 +101,10 @@
 
     /**
      * Convert the old two-file format into the current concatenated one.
-     * 
+     *
      * @param base Base path of the two files, i.e. base.key and base.data
      * @return Path to a temporary file that will be deleted on exit.
-     * @throws IOException 
+     * @throws IOException
      */
     private static String makeTempTraceFile(String base) throws IOException {
         // Make a temporary file that will go away on exit and prepare to
@@ -127,13 +129,45 @@
         // Return the path of the temp file.
         return temp.getPath();
     }
-    
+
+    /**
+     * Returns the tools revision number.
+     */
+    private static String getRevision() {
+        Properties p = new Properties();
+        try{
+            String toolsdir = System.getProperty("com.android.traceview.toolsdir"); //$NON-NLS-1$
+            File sourceProp;
+            if (toolsdir == null || toolsdir.length() == 0) {
+                sourceProp = new File("source.properties"); //$NON-NLS-1$
+            } else {
+                sourceProp = new File(toolsdir, "source.properties"); //$NON-NLS-1$
+            }
+            p.load(new FileInputStream(sourceProp));
+            String revision = p.getProperty("Pkg.Revision"); //$NON-NLS-1$
+            if (revision != null && revision.length() > 0) {
+                return revision;
+            }
+        } catch (FileNotFoundException e) {
+            // couldn't find the file? don't ping.
+        } catch (IOException e) {
+            // couldn't find the file? don't ping.
+        }
+
+        return null;
+    }
+
+
     public static void main(String[] args) {
         TraceReader reader = null;
         boolean regression = false;
-        
+
         // ping the usage server
-        SdkStatsService.ping(PING_NAME, PING_VERSION, null);
+
+        String revision = getRevision();
+        if (revision != null) {
+            SdkStatsService.ping(PING_NAME, revision, null);
+        }
 
         // Process command line arguments
         int argc = 0;