Revert "Merge downstream branch 'developers-dev' into 'klp-dev'"

Undoing recent merge to get a clean klp-dev samples release without
template code. Will un-revert for followup release with templates after
that build has been cut.

This reverts commit bc6fe0f65025563ab50af193b099a8fca95ff0a2.

Change-Id: Icd2b9772986de7c4978a92e7e22bb2c2cef20bd0
diff --git a/.gitignore b/.gitignore
index 627e46f..2dd1573 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,9 +11,7 @@
 # generated files
 bin/
 out/
-src/common
-src/template
-_index.jd
+gen/
 
 # Libraries used by the app
 # Can explicitly add if we want, but shouldn't do so blindly.  Licenses, bloat, etc.
@@ -21,8 +19,10 @@
 
 
 # Build stuff (auto-generated by android update project ...)
+build.xml
 ant.properties
 local.properties
+project.properties
 
 # Eclipse project files
 .classpath
@@ -35,7 +35,5 @@
 *.ipr
 *.iws
 
-##Gradle-based build
-.gradle
-build/
-
+#gitignore file
+.gitignore
diff --git a/background/alarms/repeatingAlarm/Scheduler/AndroidManifest.xml b/background/alarms/repeatingAlarm/Scheduler/AndroidManifest.xml
deleted file mode 100755
index 1e43d63..0000000
--- a/background/alarms/repeatingAlarm/Scheduler/AndroidManifest.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<!--
-  Copyright 2013 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.scheduler"
-    android:versionCode="1"
-    android:versionName="1.0">
-
-    <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" />
-    <uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
-    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>
-    <uses-permission android:name="android.permission.INTERNET" />
-
-    <application android:label="@string/app_name"
-        android:icon="@drawable/ic_launcher"
-        android:theme="@style/Theme.Sample">
-
-        <activity android:name=".MainActivity"
-            android:label="@string/app_name"
-            android:uiOptions="splitActionBarWhenNarrow">
-
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-
-        <receiver android:name=".SampleAlarmReceiver"></receiver>
-
-        <receiver android:name=".SampleBootReceiver"
-                android:enabled="false">
-            <intent-filter>
-            <action android:name="android.intent.action.BOOT_COMPLETED"></action>
-            </intent-filter>
-        </receiver>
-        <service android:name=".SampleSchedulingService" />
-    </application>
-
-</manifest>
diff --git a/background/alarms/repeatingAlarm/Scheduler/res/drawable-hdpi/ic_launcher.png b/background/alarms/repeatingAlarm/Scheduler/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 015d248..0000000
--- a/background/alarms/repeatingAlarm/Scheduler/res/drawable-hdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/background/alarms/repeatingAlarm/Scheduler/res/drawable-mdpi/ic_launcher.png b/background/alarms/repeatingAlarm/Scheduler/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index 605a256..0000000
--- a/background/alarms/repeatingAlarm/Scheduler/res/drawable-mdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/background/alarms/repeatingAlarm/Scheduler/res/drawable-xhdpi/ic_launcher.png b/background/alarms/repeatingAlarm/Scheduler/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index c08bafa..0000000
--- a/background/alarms/repeatingAlarm/Scheduler/res/drawable-xhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/background/alarms/repeatingAlarm/Scheduler/res/drawable-xxhdpi/ic_launcher.png b/background/alarms/repeatingAlarm/Scheduler/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644
index 1224b39..0000000
--- a/background/alarms/repeatingAlarm/Scheduler/res/drawable-xxhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/background/alarms/repeatingAlarm/Scheduler/res/layout/activity_main.xml b/background/alarms/repeatingAlarm/Scheduler/res/layout/activity_main.xml
deleted file mode 100755
index 8ba99cd..0000000
--- a/background/alarms/repeatingAlarm/Scheduler/res/layout/activity_main.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<!--
-  Copyright 2013 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.
-  -->
-
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
-
-    <TextView android:id="@+id/sample_output"
-        style="@style/Widget.SampleOutput"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:text="@string/intro_message" />
-
-</ScrollView>
diff --git a/background/alarms/repeatingAlarm/Scheduler/res/menu/main.xml b/background/alarms/repeatingAlarm/Scheduler/res/menu/main.xml
deleted file mode 100644
index f961a64..0000000
--- a/background/alarms/repeatingAlarm/Scheduler/res/menu/main.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  Copyright 2013 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.
-  -->
-
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:id="@+id/start_action"
-        android:showAsAction="ifRoom|withText"
-        android:title="@string/start_text" />
-    <item android:id="@+id/cancel_action"
-        android:showAsAction="ifRoom|withText"
-        android:title="@string/cancel_text" />
-</menu>
diff --git a/background/alarms/repeatingAlarm/Scheduler/res/values/strings.xml b/background/alarms/repeatingAlarm/Scheduler/res/values/strings.xml
deleted file mode 100755
index 9caa7a8..0000000
--- a/background/alarms/repeatingAlarm/Scheduler/res/values/strings.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--
-  Copyright 2013 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="app_name">Scheduler</string>
-    <string name="intro_message">Welcome to <b>Scheduler</b>!
-        This sample demonstrates how you can schedule an alarm that causes a service to
-        be started. This is useful when you want to schedule alarms that initiate
-        long-running operations. Click START ALARM to activate an alarm to check
-        the Google home page for a custom doodle once a day. If the app finds a doodle,
-        it posts a \"Doodle Alert\" as a notification. Click CANCEL ALARM to cancel the
-        alarm. Once the alarm is active, it automatically restarts when the device is
-        rebooted.</string>
-    <string name="start_text">Start Alarm</string>
-    <string name="cancel_text">Cancel Alarm</string>
-    <string name="doodle_alert">Doodle Alert</string>
-    <string name="doodle_found">There is a Google doodle today!!</string>
-    <string name="no_doodle">No Google doodle today.</string>
-    <string name="connection_error">Connection error.</string>
-</resources>
diff --git a/background/alarms/repeatingAlarm/Scheduler/res/values/styles.xml b/background/alarms/repeatingAlarm/Scheduler/res/values/styles.xml
deleted file mode 100644
index b1461dd..0000000
--- a/background/alarms/repeatingAlarm/Scheduler/res/values/styles.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
-  Copyright 2013 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>
-
-    <!-- Activity themes -->
-
-    <style name="Theme.Base" parent="android:Theme.Light" />
-
-    <style name="Theme.Sample" parent="Theme.Base" />
-
-    <!-- Widget styling -->
-
-    <style name="Widget" />
-
-    <style name="Widget.SampleOutput">
-        <item name="android:padding">@dimen/margin_medium</item>
-        <item name="android:textAppearance">?android:textAppearanceMedium</item>
-        <item name="android:lineSpacingMultiplier">1.1</item>
-    </style>
-
-</resources>
diff --git a/background/alarms/repeatingAlarm/Scheduler/src/com/example/android/scheduler/MainActivity.java b/background/alarms/repeatingAlarm/Scheduler/src/com/example/android/scheduler/MainActivity.java
deleted file mode 100755
index efb8e52..0000000
--- a/background/alarms/repeatingAlarm/Scheduler/src/com/example/android/scheduler/MainActivity.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2013 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.scheduler;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.MenuItem;
-
-
-/**
- * This sample demonstrates how to schedule an alarm that causes a service to
- * be started. This is useful when you want to schedule alarms that initiate
- * long-running operations, such as retrieving a daily forecast.
- * This particular sample retrieves content from the Google home page once a day and
- * checks it for the search string "doodle". If it finds this string, that indicates
- * that the page contains a custom doodle instead of the standard Google logo.
- */
-public class MainActivity extends Activity {
-    SampleAlarmReceiver alarm = new SampleAlarmReceiver();
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_main);
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        getMenuInflater().inflate(R.menu.main, menu);
-        return true;
-    }
-
-    // Menu options to set and cancel the alarm.
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            // When the user clicks START ALARM, set the alarm.
-            case R.id.start_action:
-                alarm.setAlarm(this);
-                return true;
-            // When the user clicks CANCEL ALARM, cancel the alarm.
-            case R.id.cancel_action:
-                alarm.cancelAlarm(this);
-                return true;
-        }
-        return false;
-    }
-}
diff --git a/background/alarms/repeatingAlarm/Scheduler/src/com/example/android/scheduler/SampleAlarmReceiver.java b/background/alarms/repeatingAlarm/Scheduler/src/com/example/android/scheduler/SampleAlarmReceiver.java
deleted file mode 100644
index 3a8cce1..0000000
--- a/background/alarms/repeatingAlarm/Scheduler/src/com/example/android/scheduler/SampleAlarmReceiver.java
+++ /dev/null
@@ -1,134 +0,0 @@
-package com.example.android.scheduler;
-
-import android.app.AlarmManager;
-import android.app.PendingIntent;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.support.v4.content.WakefulBroadcastReceiver;
-
-import java.util.Calendar;
-
-/**
- * When the alarm fires, this WakefulBroadcastReceiver receives the broadcast Intent
- * and then starts the IntentService {@code SampleSchedulingService} to do some work.
- */
-public class SampleAlarmReceiver extends WakefulBroadcastReceiver {
-    // The app's AlarmManager, which provides access to the system alarm services.
-    private AlarmManager alarmMgr;
-
-    // The pending intent that is triggered when the alarm fires.
-    private PendingIntent alarmIntent;
-
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        // BEGIN_INCLUDE(alarm_onreceive)
-        /*
-         * If your receiver intent includes extras that need to be passed along to the
-         * service, use setComponent() to indicate that the service should handle the
-         * receiver's intent. For example:
-         *
-         * ComponentName comp = new ComponentName(context.getPackageName(),
-         *      MyService.class.getName());
-         *
-         * // This intent passed in this call will include the wake lock extra as well as
-         * // the receiver intent contents.
-         * startWakefulService(context, (intent.setComponent(comp)));
-         *
-         * In this example, we simply create a new intent to deliver to the service.
-         * This intent holds an extra identifying the wake lock.
-         */
-        Intent service = new Intent(context, SampleSchedulingService.class);
-
-        // Start the service, keeping the device awake while it is launching.
-        startWakefulService(context, service);
-        // END_INCLUDE(alarm_onreceive)
-    }
-
-    // BEGIN_INCLUDE(set_alarm)
-    /**
-     * Sets a repeating alarm that runs once a day at approximately 8:30 a.m. When the
-     * alarm fires, the app broadcasts an Intent to this WakefulBroadcastReceiver.
-     * @param context
-     */
-    public void setAlarm(Context context) {
-        alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
-        Intent intent = new Intent(context, SampleAlarmReceiver.class);
-        alarmIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
-
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTimeInMillis(System.currentTimeMillis());
-        // Set the alarm's trigger time to 8:30 a.m.
-        calendar.set(Calendar.HOUR_OF_DAY, 8);
-        calendar.set(Calendar.MINUTE, 30);
-
-        /*
-         * If you don't have precise time requirements, use an inexact repeating alarm
-         * to minimize the drain on the device battery.
-         *
-         * The call below specifies the alarm type, the trigger time, the interval at
-         * which the alarm is fired, and the alarm's associated PendingIntent.
-         * It uses the alarm type RTC_WAKEUP ("Real Time Clock" wake up), which wakes up
-         * the device and triggers the alarm according to the time of the device's clock.
-         *
-         * Alternatively, you can use the alarm type ELAPSED_REALTIME_WAKEUP to trigger
-         * an alarm based on how much time has elapsed since the device was booted. This
-         * is the preferred choice if your alarm is based on elapsed time--for example, if
-         * you simply want your alarm to fire every 60 minutes. You only need to use
-         * RTC_WAKEUP if you want your alarm to fire at a particular date/time. Remember
-         * that clock-based time may not translate well to other locales, and that your
-         * app's behavior could be affected by the user changing the device's time setting.
-         *
-         * Here are some examples of ELAPSED_REALTIME_WAKEUP:
-         *
-         * // Wake up the device to fire a one-time alarm in one minute.
-         * alarmMgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
-         *         SystemClock.elapsedRealtime() +
-         *         60*1000, alarmIntent);
-         *
-         * // Wake up the device to fire the alarm in 30 minutes, and every 30 minutes
-         * // after that.
-         * alarmMgr.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
-         *         AlarmManager.INTERVAL_HALF_HOUR,
-         *         AlarmManager.INTERVAL_HALF_HOUR, alarmIntent);
-         */
-
-        // Set the alarm to fire at approximately 8:30 a.m., according to the device's
-        // clock, and to repeat once a day.
-        alarmMgr.setInexactRepeating(AlarmManager.RTC_WAKEUP,
-                calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, alarmIntent);
-
-        // Enable {@code SampleBootReceiver} to automatically restart the alarm when the
-        // device is rebooted.
-        ComponentName receiver = new ComponentName(context, SampleBootReceiver.class);
-        PackageManager pm = context.getPackageManager();
-
-        pm.setComponentEnabledSetting(receiver,
-                PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
-                PackageManager.DONT_KILL_APP);
-    }
-    // END_INCLUDE(set_alarm)
-
-    /**
-     * Cancels the alarm.
-     * @param context
-     */
-    // BEGIN_INCLUDE(cancel_alarm)
-    public void cancelAlarm(Context context) {
-        // If the alarm has been set, cancel it.
-        if (alarmMgr!= null) {
-            alarmMgr.cancel(alarmIntent);
-        }
-
-        // Disable {@code SampleBootReceiver} so that it doesn't automatically restart the
-        // alarm when the device is rebooted.
-        ComponentName receiver = new ComponentName(context, SampleBootReceiver.class);
-        PackageManager pm = context.getPackageManager();
-
-        pm.setComponentEnabledSetting(receiver,
-                PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
-                PackageManager.DONT_KILL_APP);
-    }
-    // END_INCLUDE(cancel_alarm)
-}
diff --git a/background/alarms/repeatingAlarm/Scheduler/src/com/example/android/scheduler/SampleBootReceiver.java b/background/alarms/repeatingAlarm/Scheduler/src/com/example/android/scheduler/SampleBootReceiver.java
deleted file mode 100644
index 16464da..0000000
--- a/background/alarms/repeatingAlarm/Scheduler/src/com/example/android/scheduler/SampleBootReceiver.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.example.android.scheduler;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-
-/**
- * This BroadcastReceiver automatically (re)starts the alarm when the device is
- * rebooted. This receiver is set to be disabled (android:enabled="false") in the
- * application's manifest file. When the user sets the alarm, the receiver is enabled.
- * When the user cancels the alarm, the receiver is disabled, so that rebooting the
- * device will not trigger this receiver.
- */
-// BEGIN_INCLUDE(autostart)
-public class SampleBootReceiver extends BroadcastReceiver {
-    SampleAlarmReceiver alarm = new SampleAlarmReceiver();
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED"))
-        {
-            alarm.setAlarm(context);
-        }
-    }
-}
-//END_INCLUDE(autostart)
diff --git a/background/alarms/repeatingAlarm/Scheduler/src/com/example/android/scheduler/SampleSchedulingService.java b/background/alarms/repeatingAlarm/Scheduler/src/com/example/android/scheduler/SampleSchedulingService.java
deleted file mode 100644
index d99fe0c..0000000
--- a/background/alarms/repeatingAlarm/Scheduler/src/com/example/android/scheduler/SampleSchedulingService.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package com.example.android.scheduler;
-
-import android.app.IntentService;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.Intent;
-import android.support.v4.app.NotificationCompat;
-import android.util.Log;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-/**
- * This {@code IntentService} does the app's actual work.
- * {@code SampleAlarmReceiver} (a {@code WakefulBroadcastReceiver}) holds a
- * partial wake lock for this service while the service does its work. When the
- * service is finished, it calls {@code completeWakefulIntent()} to release the
- * wake lock.
- */
-public class SampleSchedulingService extends IntentService {
-    public SampleSchedulingService() {
-        super("SchedulingService");
-    }
-
-    public static final String TAG = "Scheduling Demo";
-    // An ID used to post the notification.
-    public static final int NOTIFICATION_ID = 1;
-    // The string the app searches for in the Google home page content. If the app finds
-    // the string, it indicates the presence of a doodle.
-    public static final String SEARCH_STRING = "doodle";
-    // The Google home page URL from which the app fetches content.
-    // You can find a list of other Google domains with possible doodles here:
-    // http://en.wikipedia.org/wiki/List_of_Google_domains
-    public static final String URL = "http://www.google.com";
-    private NotificationManager mNotificationManager;
-    NotificationCompat.Builder builder;
-
-    @Override
-    protected void onHandleIntent(Intent intent) {
-        // BEGIN_INCLUDE(service_onhandle)
-        // The URL from which to fetch content.
-        String urlString = URL;
-
-        String result ="";
-
-        // Try to connect to the Google homepage and download content.
-        try {
-            result = loadFromNetwork(urlString);
-        } catch (IOException e) {
-            Log.i(TAG, getString(R.string.connection_error));
-        }
-
-        // If the app finds the string "doodle" in the Google home page content, it
-        // indicates the presence of a doodle. Post a "Doodle Alert" notification.
-        if (result.indexOf(SEARCH_STRING) != -1) {
-            sendNotification(getString(R.string.doodle_found));
-            Log.i(TAG, "Found doodle!!");
-        } else {
-            sendNotification(getString(R.string.no_doodle));
-            Log.i(TAG, "No doodle found. :-(");
-        }
-        // Release the wake lock provided by the BroadcastReceiver.
-        SampleAlarmReceiver.completeWakefulIntent(intent);
-        // END_INCLUDE(service_onhandle)
-    }
-
-    // Post a notification indicating whether a doodle was found.
-    private void sendNotification(String msg) {
-        mNotificationManager = (NotificationManager)
-               this.getSystemService(Context.NOTIFICATION_SERVICE);
-
-        PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
-            new Intent(this, MainActivity.class), 0);
-
-        NotificationCompat.Builder mBuilder =
-                new NotificationCompat.Builder(this)
-        .setSmallIcon(R.drawable.ic_launcher)
-        .setContentTitle(getString(R.string.doodle_alert))
-        .setStyle(new NotificationCompat.BigTextStyle()
-        .bigText(msg))
-        .setContentText(msg);
-
-        mBuilder.setContentIntent(contentIntent);
-        mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
-    }
-
-//
-// The methods below this line fetch content from the specified URL and return the
-// content as a string.
-//
-    /** Given a URL string, initiate a fetch operation. */
-    private String loadFromNetwork(String urlString) throws IOException {
-        InputStream stream = null;
-        String str ="";
-
-        try {
-            stream = downloadUrl(urlString);
-            str = readIt(stream);
-        } finally {
-            if (stream != null) {
-                stream.close();
-            }
-        }
-        return str;
-    }
-
-    /**
-     * Given a string representation of a URL, sets up a connection and gets
-     * an input stream.
-     * @param urlString A string representation of a URL.
-     * @return An InputStream retrieved from a successful HttpURLConnection.
-     * @throws IOException
-     */
-    private InputStream downloadUrl(String urlString) throws IOException {
-
-        URL url = new URL(urlString);
-        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-        conn.setReadTimeout(10000 /* milliseconds */);
-        conn.setConnectTimeout(15000 /* milliseconds */);
-        conn.setRequestMethod("GET");
-        conn.setDoInput(true);
-        // Start the query
-        conn.connect();
-        InputStream stream = conn.getInputStream();
-        return stream;
-    }
-
-    /**
-     * Reads an InputStream and converts it to a String.
-     * @param stream InputStream containing HTML from www.google.com.
-     * @return String version of InputStream.
-     * @throws IOException
-     */
-    private String readIt(InputStream stream) throws IOException {
-
-        StringBuilder builder = new StringBuilder();
-        BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
-        for(String line = reader.readLine(); line != null; line = reader.readLine())
-            builder.append(line);
-        reader.close();
-        return builder.toString();
-    }
-}
diff --git a/background/alarms/repeatingAlarm/build.gradle b/background/alarms/repeatingAlarm/build.gradle
deleted file mode 100644
index cca9ac3..0000000
--- a/background/alarms/repeatingAlarm/build.gradle
+++ /dev/null
@@ -1,10 +0,0 @@
-// BEGIN_EXCLUDE
-import com.example.android.samples.build.SampleGenPlugin
-apply plugin: SampleGenPlugin
-
-samplegen {
-  pathToBuild "../../../../../build"
-  pathToSamplesCommon "../../../common"
-}
-apply from: "../../../../../build/build.gradle"
-// END_EXCLUDE
diff --git a/background/alarms/repeatingAlarm/buildSrc/build.gradle b/background/alarms/repeatingAlarm/buildSrc/build.gradle
deleted file mode 100644
index 7cebf71..0000000
--- a/background/alarms/repeatingAlarm/buildSrc/build.gradle
+++ /dev/null
@@ -1,15 +0,0 @@
-repositories {
-    mavenCentral()
-}
-dependencies {
-    compile 'org.freemarker:freemarker:2.3.20'
-}
-
-sourceSets {
-    main {
-        groovy {
-            srcDir new File(rootDir, "../../../../../../build/buildSrc/src/main/groovy")
-        }
-    }
-}
-
diff --git a/background/alarms/repeatingAlarm/gradle/wrapper/gradle-wrapper.jar b/background/alarms/repeatingAlarm/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 8c0fb64..0000000
--- a/background/alarms/repeatingAlarm/gradle/wrapper/gradle-wrapper.jar
+++ /dev/null
Binary files differ
diff --git a/background/alarms/repeatingAlarm/gradle/wrapper/gradle-wrapper.properties b/background/alarms/repeatingAlarm/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 5c22dec..0000000
--- a/background/alarms/repeatingAlarm/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
diff --git a/background/alarms/repeatingAlarm/gradlew b/background/alarms/repeatingAlarm/gradlew
deleted file mode 100755
index 91a7e26..0000000
--- a/background/alarms/repeatingAlarm/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-##  Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
-    echo "$*"
-}
-
-die ( ) {
-    echo
-    echo "$*"
-    echo
-    exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
-  CYGWIN* )
-    cygwin=true
-    ;;
-  Darwin* )
-    darwin=true
-    ;;
-  MINGW* )
-    msys=true
-    ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
-    [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
-    ls=`ls -ld "$PRG"`
-    link=`expr "$ls" : '.*-> \(.*\)$'`
-    if expr "$link" : '/.*' > /dev/null; then
-        PRG="$link"
-    else
-        PRG=`dirname "$PRG"`"/$link"
-    fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
-    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
-        # IBM's JDK on AIX uses strange locations for the executables
-        JAVACMD="$JAVA_HOME/jre/sh/java"
-    else
-        JAVACMD="$JAVA_HOME/bin/java"
-    fi
-    if [ ! -x "$JAVACMD" ] ; then
-        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-    fi
-else
-    JAVACMD="java"
-    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
-    MAX_FD_LIMIT=`ulimit -H -n`
-    if [ $? -eq 0 ] ; then
-        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
-            MAX_FD="$MAX_FD_LIMIT"
-        fi
-        ulimit -n $MAX_FD
-        if [ $? -ne 0 ] ; then
-            warn "Could not set maximum file descriptor limit: $MAX_FD"
-        fi
-    else
-        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
-    fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
-    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
-    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
-    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
-    # We build the pattern for arguments to be converted via cygpath
-    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
-    SEP=""
-    for dir in $ROOTDIRSRAW ; do
-        ROOTDIRS="$ROOTDIRS$SEP$dir"
-        SEP="|"
-    done
-    OURCYGPATTERN="(^($ROOTDIRS))"
-    # Add a user-defined pattern to the cygpath arguments
-    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
-        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
-    fi
-    # Now convert the arguments - kludge to limit ourselves to /bin/sh
-    i=0
-    for arg in "$@" ; do
-        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
-        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
-
-        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
-            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
-        else
-            eval `echo args$i`="\"$arg\""
-        fi
-        i=$((i+1))
-    done
-    case $i in
-        (0) set -- ;;
-        (1) set -- "$args0" ;;
-        (2) set -- "$args0" "$args1" ;;
-        (3) set -- "$args0" "$args1" "$args2" ;;
-        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
-        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
-        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
-        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
-        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
-        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
-    esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
-    JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/background/alarms/repeatingAlarm/gradlew.bat b/background/alarms/repeatingAlarm/gradlew.bat
deleted file mode 100644
index aec9973..0000000
--- a/background/alarms/repeatingAlarm/gradlew.bat
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off

-@rem ##########################################################################

-@rem

-@rem  Gradle startup script for Windows

-@rem

-@rem ##########################################################################

-

-@rem Set local scope for the variables with windows NT shell

-if "%OS%"=="Windows_NT" setlocal

-

-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.

-set DEFAULT_JVM_OPTS=

-

-set DIRNAME=%~dp0

-if "%DIRNAME%" == "" set DIRNAME=.

-set APP_BASE_NAME=%~n0

-set APP_HOME=%DIRNAME%

-

-@rem Find java.exe

-if defined JAVA_HOME goto findJavaFromJavaHome

-

-set JAVA_EXE=java.exe

-%JAVA_EXE% -version >NUL 2>&1

-if "%ERRORLEVEL%" == "0" goto init

-

-echo.

-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

-echo.

-echo Please set the JAVA_HOME variable in your environment to match the

-echo location of your Java installation.

-

-goto fail

-

-:findJavaFromJavaHome

-set JAVA_HOME=%JAVA_HOME:"=%

-set JAVA_EXE=%JAVA_HOME%/bin/java.exe

-

-if exist "%JAVA_EXE%" goto init

-

-echo.

-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%

-echo.

-echo Please set the JAVA_HOME variable in your environment to match the

-echo location of your Java installation.

-

-goto fail

-

-:init

-@rem Get command-line arguments, handling Windowz variants

-

-if not "%OS%" == "Windows_NT" goto win9xME_args

-if "%@eval[2+2]" == "4" goto 4NT_args

-

-:win9xME_args

-@rem Slurp the command line arguments.

-set CMD_LINE_ARGS=

-set _SKIP=2

-

-:win9xME_args_slurp

-if "x%~1" == "x" goto execute

-

-set CMD_LINE_ARGS=%*

-goto execute

-

-:4NT_args

-@rem Get arguments from the 4NT Shell from JP Software

-set CMD_LINE_ARGS=%$

-

-:execute

-@rem Setup the command line

-

-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

-

-@rem Execute Gradle

-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

-

-:end

-@rem End local scope for the variables with windows NT shell

-if "%ERRORLEVEL%"=="0" goto mainEnd

-

-:fail

-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of

-rem the _cmd.exe /c_ return code!

-if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1

-exit /b 1

-

-:mainEnd

-if "%OS%"=="Windows_NT" endlocal

-

-:omega

diff --git a/background/alarms/repeatingAlarm/repeatingAlarmSample/.gitignore b/background/alarms/repeatingAlarm/repeatingAlarmSample/.gitignore
deleted file mode 100644
index f1e8ad1..0000000
--- a/background/alarms/repeatingAlarm/repeatingAlarmSample/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-src/template/
-src/common/
\ No newline at end of file
diff --git a/background/alarms/repeatingAlarm/repeatingAlarmSample/build.gradle b/background/alarms/repeatingAlarm/repeatingAlarmSample/build.gradle
deleted file mode 100644
index 069b740..0000000
--- a/background/alarms/repeatingAlarm/repeatingAlarmSample/build.gradle
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-buildscript {
-    repositories {
-        mavenCentral()
-    }
-
-    dependencies {
-        classpath 'com.android.tools.build:gradle:0.6.+'
-    }
-}
-
-apply plugin: 'android'
-
-dependencies {
-    // Add the support lib that is appropriate for SDK 4
-    compile "com.android.support:support-v4:18.0.+"
-}
-
-// The sample build uses multiple directories to
-// keep boilerplate and common code separate from
-// the main sample code.
-List<String> dirs = [
-    'main',     // main sample code; look here for the interesting stuff.
-    'common',   // components that are reused by multiple samples
-    'template'] // boilerplate code that is generated by the sample template process
-
-android {
-    compileSdkVersion 18
-    buildToolsVersion "18.0.1"
-
-    sourceSets {
-        main {
-            dirs.each { dir ->
-                java.srcDirs "src/${dir}/java"
-                res.srcDirs "src/${dir}/res"
-            }
-        }
-        instrumentTest.setRoot('tests')
-        instrumentTest.java.srcDirs = ['tests/src']
-    }
-}
-
-task preflight (dependsOn: parent.preflight) {
-    project.afterEvaluate {
-        // Inject a preflight task into each variant so we have a place to hook tasks
-        // that need to run before any of the android build tasks.
-        //
-        android.applicationVariants.each { variant ->
-            tasks.getByPath("prepare${variant.name.capitalize()}Dependencies").dependsOn preflight
-        }
-    }
-}
-
-
-
diff --git a/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/AndroidManifest.xml b/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/AndroidManifest.xml
deleted file mode 100644
index b7d02e5..0000000
--- a/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2013 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.repeatingalarm"
-    android:versionCode="1"
-    android:versionName="1.0">
-
-    <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="17" />
-
-    <application android:allowBackup="true"
-        android:label="@string/app_name"
-        android:icon="@drawable/ic_launcher"
-        android:theme="@style/AppTheme">
-
-        <activity android:name=".MainActivity"
-                  android:label="@string/app_name"
-                  android:uiOptions="splitActionBarWhenNarrow">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-
-
-</manifest>
diff --git a/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/java/com/example/android/repeatingalarm/RepeatingAlarmFragment.java b/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/java/com/example/android/repeatingalarm/RepeatingAlarmFragment.java
deleted file mode 100644
index 81b1e44..0000000
--- a/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/java/com/example/android/repeatingalarm/RepeatingAlarmFragment.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-* Copyright 2013 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.repeatingalarm;
-
-import android.app.AlarmManager;
-import android.app.PendingIntent;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.SystemClock;
-import android.support.v4.app.Fragment;
-import android.view.MenuItem;
-import com.example.android.common.logger.*;
-
-
-public class RepeatingAlarmFragment extends Fragment {
-
-    // This value is defined and consumed by app code, so any value will work.
-    // There's no significance to this sample using 0.
-    public static final int REQUEST_CODE = 0;
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setHasOptionsMenu(true);
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        if(item.getItemId() == R.id.sample_action) {
-
-            // BEGIN_INCLUDE (intent_fired_by_alarm)
-            // First create an intent for the alarm to activate.
-            // This code simply starts an Activity, or brings it to the front if it has already
-            // been created.
-            Intent intent = new Intent(getActivity(), MainActivity.class);
-            intent.setAction(Intent.ACTION_MAIN);
-            intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
-            // END_INCLUDE (intent_fired_by_alarm)
-
-            // BEGIN_INCLUDE (pending_intent_for_alarm)
-            // Because the intent must be fired by a system service from outside the application,
-            // it's necessary to wrap it in a PendingIntent.  Providing a different process with
-            // a PendingIntent gives that other process permission to fire the intent that this
-            // application has created.
-            // Also, this code creates a PendingIntent to start an Activity.  To create a
-            // BroadcastIntent instead, simply call getBroadcast instead of getIntent.
-            PendingIntent pendingIntent = PendingIntent.getActivity(getActivity(), REQUEST_CODE,
-                    intent, 0);
-
-            // END_INCLUDE (pending_intent_for_alarm)
-
-            // BEGIN_INCLUDE (configure_alarm_manager)
-            // There are two clock types for alarms, ELAPSED_REALTIME and RTC.
-            // ELAPSED_REALTIME uses time since system boot as a reference, and RTC uses UTC (wall
-            // clock) time.  This means ELAPSED_REALTIME is suited to setting an alarm according to
-            // passage of time (every 15 seconds, 15 minutes, etc), since it isn't affected by
-            // timezone/locale.  RTC is better suited for alarms that should be dependant on current
-            // locale.
-
-            // Both types have a WAKEUP version, which says to wake up the device if the screen is
-            // off.  This is useful for situations such as alarm clocks.  Abuse of this flag is an
-            // efficient way to skyrocket the uninstall rate of an application, so use with care.
-            // For most situations, ELAPSED_REALTIME will suffice.
-            int alarmType = AlarmManager.ELAPSED_REALTIME;
-            final int FIFTEEN_SEC_MILLIS = 15000;
-
-            // The AlarmManager, like most system services, isn't created by application code, but
-            // requested from the system.
-            AlarmManager alarmManager = (AlarmManager)
-                    getActivity().getSystemService(getActivity().ALARM_SERVICE);
-
-            // setRepeating takes a start delay and period between alarms as arguments.
-            // The below code fires after 15 seconds, and repeats every 15 seconds.  This is very
-            // useful for demonstration purposes, but horrendous for production.  Don't be that dev.
-            alarmManager.setRepeating(alarmType, SystemClock.elapsedRealtime() + FIFTEEN_SEC_MILLIS,
-                    FIFTEEN_SEC_MILLIS, pendingIntent);
-            // END_INCLUDE (configure_alarm_manager);
-            Log.i("RepeatingAlarmFragment", "Alarm set.");
-        }
-        return true;
-    }
-}
diff --git a/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/res/drawable-hdpi/ic_launcher.png b/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index b1efaf4..0000000
--- a/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/res/drawable-hdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/res/drawable-mdpi/ic_launcher.png b/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index f5f9244..0000000
--- a/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/res/drawable-mdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/res/drawable-xhdpi/ic_launcher.png b/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index 5d07b3f..0000000
--- a/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/res/drawable-xhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/res/drawable-xxhdpi/ic_launcher.png b/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644
index 6ef21e1..0000000
--- a/background/alarms/repeatingAlarm/repeatingAlarmSample/src/main/res/drawable-xxhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/background/alarms/repeatingAlarm/settings.gradle b/background/alarms/repeatingAlarm/settings.gradle
deleted file mode 100644
index 73a49e8..0000000
--- a/background/alarms/repeatingAlarm/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include 'repeatingAlarmSample'
diff --git a/background/alarms/repeatingAlarm/template-params.xml b/background/alarms/repeatingAlarm/template-params.xml
deleted file mode 100644
index b5a52bb..0000000
--- a/background/alarms/repeatingAlarm/template-params.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2013 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>
-    <name>repeatingAlarm</name>
-    <group>Background</group>
-    <package>com.example.android.repeatingalarm</package>
-
-
-    <!--TODO: change minSdk if needed-->
-    <minSdk>4</minSdk>
-
-    <strings>
-        <intro>
-            <![CDATA[
-                Introductory text that explains what the sample is intended to demonstrate. Edit
-                in template-params.xml.
-            ]]>
-        </intro>
-
-        <sample_action>Set Alarm</sample_action>
-    </strings>
-
-
-    <meatFragment>AlarmFragment</meatFragment>
-    <template src="base"/>
-    <template src="SingleView"/>
-    <common src="logger"/>
-    <common src="activities"/>
-
-</sample>
diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index b895091..0000000
--- a/build.gradle
+++ /dev/null
@@ -1,55 +0,0 @@
-List<String> samples = [
-"security/keystore/BasicAndroidKeyStore",
-"connectivity/sync/BasicSyncAdapter",
-"connectivity/network/NetworkConnect",
-"connectivity/network/BasicNetworking",
-"connectivity/bluetooth/BluetoothLeGatt",
-"content/multiuser/AppRestrictions",
-"content/contacts/BasicContactables",
-"content/documentsUi/StorageClient",
-"views/TextLinkify",
-"input/gestures/BasicGestureDetect",
-"input/multitouch/BasicMultitouch",
-"testing/ActivityInstrumentation",
-"media/BasicMediaRouter",
-"media/BasicMediaDecoder",
-"ui/holo/BorderlessButtons",
-"ui/accessibility/BasicAccessibility",
-"ui/lists/CustomChoiceList",
-"ui/views/TextSwitcher",
-"ui/views/HorizontalPaging",
-"ui/actionbarcompat/Styled",
-"ui/actionbarcompat/ListPopupMenu",
-"ui/actionbarcompat/ShareActionProvider",
-"ui/actionbarcompat/Basic",
-"ui/notifications/BasicNotifications",
-"ui/notifications/CustomNotifications",
-"ui/actionbar/DoneBar",
-"ui/window/BasicImmersiveMode",
-"ui/window/AdvancedImmersiveMode",
-"ui/window/ImmersiveMode",
-"background/alarms/repeatingAlarm"
-]
-
-List<String> taskNames = [
-    "clean",
-    "refresh",
-    "build",
-    "emitAnt",
-    "emitGradle",
-    "emitBrowseable",
-]
-
-taskNames.each { taskName ->
-    def task = project.hasProperty(taskName) ? project.tasks[taskName] : project.task(taskName)
-    println task
-    samples.each { sample ->
-        File sampleDir = new File(sample)
-        task.dependsOn project.task([type: GradleBuild], "${sample}_${taskName}", {
-            buildFile = "${sample}/build.gradle"
-            dir = sample
-            tasks = [taskName]
-        })
-    }
-}
-
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
deleted file mode 100644
index b42a6ef..0000000
--- a/buildSrc/build.gradle
+++ /dev/null
@@ -1,15 +0,0 @@
-repositories {
-    mavenCentral()
-}
-dependencies {
-    compile 'org.freemarker:freemarker:2.3.20'
-}
-
-sourceSets {
-    main {
-        groovy {
-            srcDir new File(rootDir, "../../build/buildSrc/src/main/groovy")
-        }
-    }
-}
-
diff --git a/common/src/com/example/android/common/Pools.java b/common/src/com/example/android/common/Pools.java
new file mode 100644
index 0000000..b31749a
--- /dev/null
+++ b/common/src/com/example/android/common/Pools.java
@@ -0,0 +1,237 @@
+/*
+ * 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.common;
+
+/**
+ * Helper class for creating pools of objects. Creating new objects is an
+ * expensive operation, which can lead to significant performance overhead if
+ * new objects of the same type are allocated and destroyed during run time.
+ * These performance issues can be mitigated by reusing unused objects and
+ * reinitializing them, rather than destroying and removing them from memory.
+ * <p>
+ * The object pool pattern provided by the {@link Pool} interface facilitates
+ * the reuse of objects by keeping unused ('released') objects in memory and
+ * making them available for use. This can provide a significant performance
+ * improvement, as objects are only created once and returned to the Pool when
+ * no longer required, rather than destroyed and reallocated. Object
+ * {@link Pools} keep track of these unused objects. An object pool provides two
+ * basic methods for access:
+ * <ul>
+ * <li><b>{@link Pool#acquire()}:</b> Returns an used object if one is
+ * available.</li>
+ * <li><b> {@link Pool#release(Object)}:</b> Adds the given object to the pool,
+ * ready to be reallocated in acquire().</li>
+ * </ul>
+ * <p>
+ * This class contains the interface defining a {@link Pool}, an implementation
+ * based on a fixed length array ({@link SimplePool}) and a synchronized pool
+ * for use with concurrency ({@link SynchronizedPool}).
+ * <p>
+ * A {@link SimplePool} can be used like this:
+ *
+ * <pre>
+ * public class MyPooledClass {
+ *
+ *     private static final SynchronizedPool<MyPooledClass> sPool =
+ *             new SynchronizedPool<MyPooledClass>(10);
+ *
+ *     public static MyPooledClass obtain() {
+ *         MyPooledClass instance = sPool.acquire();
+ *         return (instance != null) ? instance : new MyPooledClass();
+ *     }
+ *
+ *     public void recycle() {
+ *          // Clear state if needed.
+ *          sPool.release(this);
+ *     }
+ *
+ *     . . .
+ * }
+ * </pre>
+ */
+public final class Pools {
+
+    /**
+     * Interface for managing a pool of objects.
+     *
+     * @param T The pooled type.
+     */
+    public static interface Pool<T> {
+
+        /**
+         * Retrieves an object from the pool. Returns null if the pool is empty
+         * and no object is available.
+         *
+         * @return An instance from the pool if available, null otherwise.
+         */
+        public T acquire();
+
+        /**
+         * Releases an instance to the pool. This marks the object as reusable
+         * and makes it available through a call to {@link #acquire()}. An
+         * object should not be modified or accessed once it has been released.
+         *
+         * @param instance The instance to release.
+         * @return True if the instance was put in the pool.
+         * @throws IllegalStateException If the instance is already in the pool.
+         */
+        public boolean release(T instance);
+    }
+
+    private Pools() {
+        /* do nothing - hiding constructor */
+    }
+
+    /**
+     * Simple (non-synchronized) pool of objects. This class provides a simple,
+     * fixed sized pool of objects.
+     *
+     * @param T The pooled type.
+     */
+    public static class SimplePool<T> implements Pool<T> {
+        private final Object[] mPool;
+
+        private int mPoolSize;
+
+        /**
+         * Creates a new instance. The parameter defines the maximum number of
+         * objects that can be held in this pool.
+         *
+         * @param maxPoolSize The max pool size.
+         * @throws IllegalArgumentException If the max pool size is less than
+         *             zero.
+         */
+        public SimplePool(int maxPoolSize) {
+            if (maxPoolSize <= 0) {
+                throw new IllegalArgumentException("The max pool size must be > 0");
+            }
+            mPool = new Object[maxPoolSize];
+        }
+
+        /**
+         * Returns an object from the pool or null if the pool is empty.
+         *
+         * @return An object from the pool or null if no object is available.
+         */
+        @Override
+        @SuppressWarnings("unchecked")
+        public T acquire() {
+            if (mPoolSize > 0) {
+                final int lastPooledIndex = mPoolSize - 1;
+                T instance = (T) mPool[lastPooledIndex];
+                mPool[lastPooledIndex] = null;
+                mPoolSize--;
+                return instance;
+            }
+            return null;
+        }
+
+        /**
+         * Adds an object to the pool. If the pool is already full (its
+         * allocated size has been exceeded), the object is not added and false
+         * is returned. A linear check is performed to ensure that the object is
+         * not already held in the pool.
+         *
+         * @param instance The element to release.
+         * @return True if the object was added to the pool.
+         * @throws IllegalStateException If the object already exists in the
+         *             pool.
+         */
+        @Override
+        public boolean release(T instance) {
+            if (isInPool(instance)) {
+                throw new IllegalStateException("Already in the pool!");
+            }
+            if (mPoolSize < mPool.length) {
+                mPool[mPoolSize] = instance;
+                mPoolSize++;
+                return true;
+            }
+            return false;
+        }
+
+        /**
+         * Checks if the object already exists in the pool.
+         * @param instance The element to look for.
+         * @return True if the object exists in the pool.
+         */
+        private boolean isInPool(T instance) {
+            for (int i = 0; i < mPoolSize; i++) {
+                if (mPool[i] == instance) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Synchronized pool of objects. Based on the implementation of a fixed size
+     * pool in {@link SimplePool}, this class provides synchronized concurrent
+     * access to the pool.
+     *
+     * @param T The pooled type.
+     */
+    public static class SynchronizedPool<T> extends SimplePool<T> {
+        private final Object mLock = new Object();
+
+        /**
+         * Creates a new instance.
+         *
+         * @param maxPoolSize The max pool size.
+         * @throws IllegalArgumentException If the max pool size is less than
+         *             zero.
+         */
+        public SynchronizedPool(int maxPoolSize) {
+            super(maxPoolSize);
+        }
+
+        /**
+         * Returns an object from the pool or null if the pool is empty.
+         * <p>
+         * Access to the pool is synchronized.
+         *
+         * @return An object from the pool or null if no object is available.
+         */
+        @Override
+        public T acquire() {
+            synchronized (mLock) {
+                return super.acquire();
+            }
+        }
+
+        /**
+         * Adds an object to the pool. If the pool is already full (its
+         * allocated size has been exceeded), the object is not added and false
+         * is returned. A linear check is performed to ensure that the object is
+         * not already held in the pool.
+         * <p>
+         * Access to the pool is synchronized.
+         *
+         * @param element The element to be released
+         * @return True if the object was added to the pool.
+         * @throws IllegalStateException If the object already exists in the
+         *             pool.
+         */
+        @Override
+        public boolean release(T element) {
+            synchronized (mLock) {
+                return super.release(element);
+            }
+        }
+    }
+}
diff --git a/common/src/com/example/android/common/accounts/GenericAccountService.java b/common/src/com/example/android/common/accounts/GenericAccountService.java
new file mode 100644
index 0000000..9480023
--- /dev/null
+++ b/common/src/com/example/android/common/accounts/GenericAccountService.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2013 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.common.accounts;
+
+import android.accounts.AbstractAccountAuthenticator;
+import android.accounts.Account;
+import android.accounts.AccountAuthenticatorResponse;
+import android.accounts.NetworkErrorException;
+import android.app.Service;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.util.Log;
+
+public class GenericAccountService extends Service {
+    private static final String TAG = "GenericAccountService";
+    private static final String ACCOUNT_TYPE = "com.example.android.network.sync.basicsyncadapter";
+    public static final String ACCOUNT_NAME = "sync";
+    private Authenticator mAuthenticator;
+
+    /**
+     * Obtain a handle to the {@link android.accounts.Account} used for sync in this application.
+     *
+     * @return Handle to application's account (not guaranteed to resolve unless CreateSyncAccount()
+     *         has been called)
+     */
+    public static Account GetAccount() {
+        // Note: Normally the account name is set to the user's identity (username or email
+        // address). However, since we aren't actually using any user accounts, it makes more sense
+        // to use a generic string in this case.
+        //
+        // This string should *not* be localized. If the user switches locale, we would not be
+        // able to locate the old account, and may erroneously register multiple accounts.
+        final String accountName = ACCOUNT_NAME;
+        return new Account(accountName, ACCOUNT_TYPE);
+    }
+
+    @Override
+    public void onCreate() {
+        Log.i(TAG, "Service created");
+        mAuthenticator = new Authenticator(this);
+    }
+
+    @Override
+    public void onDestroy() {
+        Log.i(TAG, "Service destroyed");
+    }
+
+    @Override
+    public IBinder onBind(Intent intent) {
+        return mAuthenticator.getIBinder();
+    }
+
+    public class Authenticator extends AbstractAccountAuthenticator {
+        public Authenticator(Context context) {
+            super(context);
+        }
+
+        @Override
+        public Bundle editProperties(AccountAuthenticatorResponse accountAuthenticatorResponse,
+                                     String s) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Bundle addAccount(AccountAuthenticatorResponse accountAuthenticatorResponse,
+                                 String s, String s2, String[] strings, Bundle bundle)
+                throws NetworkErrorException {
+            return null;
+        }
+
+        @Override
+        public Bundle confirmCredentials(AccountAuthenticatorResponse accountAuthenticatorResponse,
+                                         Account account, Bundle bundle)
+                throws NetworkErrorException {
+            return null;
+        }
+
+        @Override
+        public Bundle getAuthToken(AccountAuthenticatorResponse accountAuthenticatorResponse,
+                                   Account account, String s, Bundle bundle)
+                throws NetworkErrorException {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public String getAuthTokenLabel(String s) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Bundle updateCredentials(AccountAuthenticatorResponse accountAuthenticatorResponse,
+                                        Account account, String s, Bundle bundle)
+                throws NetworkErrorException {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Bundle hasFeatures(AccountAuthenticatorResponse accountAuthenticatorResponse,
+                                  Account account, String[] strings)
+                throws NetworkErrorException {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+}
+
diff --git a/common/src/com/example/android/common/actionbarcompat/MultiSelectionUtil.java b/common/src/com/example/android/common/actionbarcompat/MultiSelectionUtil.java
deleted file mode 100644
index 482f6ed..0000000
--- a/common/src/com/example/android/common/actionbarcompat/MultiSelectionUtil.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright (C) 2013 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.common.actionbarcompat;
-
-import android.os.Bundle;
-import android.support.v7.app.ActionBarActivity;
-import android.support.v7.view.ActionMode;
-import android.util.Pair;
-import android.util.SparseBooleanArray;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.AbsListView;
-import android.widget.Adapter;
-import android.widget.AdapterView;
-import android.widget.ListView;
-
-import java.util.HashSet;
-
-/**
- * Utilities for handling multiple selection in list views. Contains functionality similar to {@link
- * AbsListView#CHOICE_MODE_MULTIPLE_MODAL} which works with {@link ActionBarActivity} and
- * backward-compatible action bars.
- */
-public class MultiSelectionUtil {
-
-    /**
-     * Attach a Controller to the given <code>listView</code>, <code>activity</code>
-     * and <code>listener</code>.
-     *
-     * @param listView ListView which displays {@link android.widget.Checkable} items.
-     * @param activity Activity which contains the ListView.
-     * @param listener Listener that will manage the selection mode.
-     * @return the attached Controller instance.
-     */
-    public static Controller attachMultiSelectionController(final ListView listView,
-            final ActionBarActivity activity, final MultiChoiceModeListener listener) {
-        return new Controller(listView, activity, listener);
-    }
-
-    /**
-     * Class which provides functionality similar to {@link AbsListView#CHOICE_MODE_MULTIPLE_MODAL}
-     * for the {@link ListView} provided to it. A
-     * {@link android.widget.AdapterView.OnItemLongClickListener} is set on the ListView so that
-     * when an item is long-clicked an ActionBarCompat Action Mode is started. Once started, a
-     * {@link android.widget.AdapterView.OnItemClickListener} is set so that an item click toggles
-     * that item's checked state.
-     */
-    public static class Controller {
-
-        private final ListView mListView;
-        private final ActionBarActivity mActivity;
-        private final MultiChoiceModeListener mListener;
-        private final Callbacks mCallbacks;
-
-        // Current Action Mode (if there is one)
-        private ActionMode mActionMode;
-
-        // Keeps record of any items that should be checked on the next action mode creation
-        private HashSet<Pair<Integer, Long>> mItemsToCheck;
-
-        // Reference to the replace OnItemClickListener (so it can be restored later)
-        private AdapterView.OnItemClickListener mOldItemClickListener;
-
-        private final Runnable mSetChoiceModeNoneRunnable = new Runnable() {
-            @Override
-            public void run() {
-                mListView.setChoiceMode(AbsListView.CHOICE_MODE_NONE);
-            }
-        };
-
-        private Controller(ListView listView, ActionBarActivity activity,
-                MultiChoiceModeListener listener) {
-            mListView = listView;
-            mActivity = activity;
-            mListener = listener;
-            mCallbacks = new Callbacks();
-
-            // We set ourselves as the OnItemLongClickListener so we know when to start
-            // an Action Mode
-            listView.setOnItemLongClickListener(mCallbacks);
-        }
-
-        /**
-         * Finish the current Action Mode (if there is one).
-         */
-        public void finish() {
-            if (mActionMode != null) {
-                mActionMode.finish();
-            }
-        }
-
-        /**
-         * This method should be called from your {@link ActionBarActivity} or
-         * {@link android.support.v4.app.Fragment Fragment} to allow the controller to restore any
-         * instance state.
-         *
-         * @param savedInstanceState - The state passed to your Activity or Fragment.
-         */
-        public void restoreInstanceState(Bundle savedInstanceState) {
-            if (savedInstanceState != null) {
-                long[] checkedIds = savedInstanceState.getLongArray(getStateKey());
-                if (checkedIds != null && checkedIds.length > 0) {
-                    HashSet<Long> idsToCheckOnRestore = new HashSet<Long>();
-                    for (long id : checkedIds) {
-                        idsToCheckOnRestore.add(id);
-                    }
-                    tryRestoreInstanceState(idsToCheckOnRestore);
-                }
-            }
-        }
-
-        /**
-         * This method should be called from
-         * {@link ActionBarActivity#onSaveInstanceState(android.os.Bundle)} or
-         * {@link android.support.v4.app.Fragment#onSaveInstanceState(android.os.Bundle)
-         * Fragment.onSaveInstanceState(Bundle)} to allow the controller to save its instance
-         * state.
-         *
-         * @param outState - The state passed to your Activity or Fragment.
-         */
-        public void saveInstanceState(Bundle outState) {
-            if (mActionMode != null && mListView.getAdapter().hasStableIds()) {
-                outState.putLongArray(getStateKey(), mListView.getCheckedItemIds());
-            }
-        }
-
-        // Internal utility methods
-
-        private String getStateKey() {
-            return MultiSelectionUtil.class.getSimpleName() + "_" + mListView.getId();
-        }
-
-        private void tryRestoreInstanceState(HashSet<Long> idsToCheckOnRestore) {
-            if (idsToCheckOnRestore == null || mListView.getAdapter() == null) {
-                return;
-            }
-
-            boolean idsFound = false;
-            Adapter adapter = mListView.getAdapter();
-            for (int pos = adapter.getCount() - 1; pos >= 0; pos--) {
-                if (idsToCheckOnRestore.contains(adapter.getItemId(pos))) {
-                    idsFound = true;
-                    if (mItemsToCheck == null) {
-                        mItemsToCheck = new HashSet<Pair<Integer, Long>>();
-                    }
-                    mItemsToCheck.add(new Pair<Integer, Long>(pos, adapter.getItemId(pos)));
-                }
-            }
-
-            if (idsFound) {
-                // We found some IDs that were checked. Let's now restore the multi-selection
-                // state.
-                mActionMode = mActivity.startSupportActionMode(mCallbacks);
-            }
-        }
-
-        /**
-         * This class encapsulates all of the callbacks necessary for the controller class.
-         */
-        final class Callbacks implements ActionMode.Callback, AdapterView.OnItemClickListener,
-                AdapterView.OnItemLongClickListener {
-
-            @Override
-            public final boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
-                if (mListener.onCreateActionMode(actionMode, menu)) {
-                    mActionMode = actionMode;
-                    // Keep a reference to the existing OnItemClickListener so we can restore it
-                    mOldItemClickListener = mListView.getOnItemClickListener();
-
-                    // Set-up the ListView to emulate CHOICE_MODE_MULTIPLE_MODAL
-                    mListView.setOnItemClickListener(this);
-                    mListView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
-                    mListView.removeCallbacks(mSetChoiceModeNoneRunnable);
-
-                    // If there are some items to check, do it now
-                    if (mItemsToCheck != null) {
-                        for (Pair<Integer, Long> posAndId : mItemsToCheck) {
-                            mListView.setItemChecked(posAndId.first, true);
-                            // Notify the listener that the item has been checked
-                            mListener.onItemCheckedStateChanged(mActionMode, posAndId.first,
-                                    posAndId.second, true);
-                        }
-                    }
-                    return true;
-                }
-                return false;
-            }
-
-            @Override
-            public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
-                // Proxy listener
-                return mListener.onPrepareActionMode(actionMode, menu);
-            }
-
-            @Override
-            public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
-                // Proxy listener
-                return mListener.onActionItemClicked(actionMode, menuItem);
-            }
-
-            @Override
-            public void onDestroyActionMode(ActionMode actionMode) {
-                mListener.onDestroyActionMode(actionMode);
-
-                // Clear all the checked items
-                SparseBooleanArray checkedPositions = mListView.getCheckedItemPositions();
-                if (checkedPositions != null) {
-                    for (int i = 0; i < checkedPositions.size(); i++) {
-                        mListView.setItemChecked(checkedPositions.keyAt(i), false);
-                    }
-                }
-
-                // Restore the original onItemClickListener
-                mListView.setOnItemClickListener(mOldItemClickListener);
-
-                // Clear the Action Mode
-                mActionMode = null;
-
-                // Reset the ListView's Choice Mode
-                mListView.post(mSetChoiceModeNoneRunnable);
-            }
-
-            @Override
-            public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
-                // Check to see what the new checked state is, and then notify the listener
-                final boolean checked = mListView.isItemChecked(position);
-                mListener.onItemCheckedStateChanged(mActionMode, position, id, checked);
-
-                boolean hasCheckedItem = checked;
-
-                // Check to see if we have any checked items
-                if (!hasCheckedItem) {
-                    SparseBooleanArray checkedItemPositions = mListView.getCheckedItemPositions();
-                    if (checkedItemPositions != null) {
-                        // Iterate through the SparseBooleanArray to see if there is a checked item
-                        int i = 0;
-                        while (!hasCheckedItem && i < checkedItemPositions.size()) {
-                            hasCheckedItem = checkedItemPositions.valueAt(i++);
-                        }
-                    }
-                }
-
-                // If we don't have any checked items, finish the action mode
-                if (!hasCheckedItem) {
-                    mActionMode.finish();
-                }
-            }
-
-            @Override
-            public boolean onItemLongClick(AdapterView<?> adapterView, View view, int position,
-                    long id) {
-                // If we already have an action mode started return false
-                // (onItemClick will be called anyway)
-                if (mActionMode != null) {
-                    return false;
-                }
-
-                mItemsToCheck = new HashSet<Pair<Integer, Long>>();
-                mItemsToCheck.add(new Pair<Integer, Long>(position, id));
-                mActionMode = mActivity.startSupportActionMode(this);
-                return true;
-            }
-        }
-    }
-
-    /**
-     * @see android.widget.AbsListView.MultiChoiceModeListener
-     */
-    public static interface MultiChoiceModeListener extends ActionMode.Callback {
-
-        /**
-         * @see android.widget.AbsListView.MultiChoiceModeListener#onItemCheckedStateChanged(
-         *android.view.ActionMode, int, long, boolean)
-         */
-        public void onItemCheckedStateChanged(ActionMode mode, int position, long id,
-                boolean checked);
-    }
-}
diff --git a/common/src/com/example/android/common/db/SelectionBuilder.java b/common/src/com/example/android/common/db/SelectionBuilder.java
new file mode 100644
index 0000000..51d8cc3
--- /dev/null
+++ b/common/src/com/example/android/common/db/SelectionBuilder.java
@@ -0,0 +1,358 @@
+/*
+ * Copyright 2013 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.
+ */
+
+/*
+ * Modifications:
+ * -Imported from AOSP frameworks/base/core/java/com/android/internal/content
+ * -Changed package name
+ */
+
+package com.example.android.common.db;
+
+import android.content.ContentValues;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.text.TextUtils;
+import android.util.Log;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * Helper for building selection clauses for {@link SQLiteDatabase}.
+ *
+ * <p>This class provides a convenient frontend for working with SQL. Instead of composing statements
+ * manually using string concatenation, method calls are used to construct the statement one
+ * clause at a time. These methods can be chained together.
+ *
+ * <p>If multiple where() statements are provided, they're combined using {@code AND}.
+ *
+ * <p>Example:
+ *
+ * <pre>
+ *     SelectionBuilder builder = new SelectionBuilder();
+ *     Cursor c = builder.table(FeedContract.Entry.TABLE_NAME)       // String TABLE_NAME = "entry"
+ *                       .where(FeedContract.Entry._ID + "=?", id);  // String _ID = "_ID"
+ *                       .query(db, projection, sortOrder)
+ *
+ * </pre>
+ *
+ * <p>In this example, the table name and filters ({@code WHERE} clauses) are both explicitly
+ * specified via method call. SelectionBuilder takes care of issuing a "query" command to the
+ * database, and returns the resulting {@link Cursor} object.
+ *
+ * <p>Inner {@code JOIN}s can be accomplished using the mapToTable() function. The map() function
+ * can be used to create new columns based on arbitrary (SQL-based) criteria. In advanced usage,
+ * entire subqueries can be passed into the map() function.
+ *
+ * <p>Advanced example:
+ *
+ * <pre>
+ *     // String SESSIONS_JOIN_BLOCKS_ROOMS = "sessions "
+ *     //        + "LEFT OUTER JOIN blocks ON sessions.block_id=blocks.block_id "
+ *     //        + "LEFT OUTER JOIN rooms ON sessions.room_id=rooms.room_id";
+ *
+ *     // String Subquery.BLOCK_NUM_STARRED_SESSIONS =
+ *     //       "(SELECT COUNT(1) FROM "
+ *     //        + Tables.SESSIONS + " WHERE " + Qualified.SESSIONS_BLOCK_ID + "="
+ *     //        + Qualified.BLOCKS_BLOCK_ID + " AND " + Qualified.SESSIONS_STARRED + "=1)";
+ *
+ *     String Subqery.BLOCK_SESSIONS_COUNT =
+ *     Cursor c = builder.table(Tables.SESSIONS_JOIN_BLOCKS_ROOMS)
+ *               .map(Blocks.NUM_STARRED_SESSIONS, Subquery.BLOCK_NUM_STARRED_SESSIONS)
+ *               .mapToTable(Sessions._ID, Tables.SESSIONS)
+ *               .mapToTable(Sessions.SESSION_ID, Tables.SESSIONS)
+ *               .mapToTable(Sessions.BLOCK_ID, Tables.SESSIONS)
+ *               .mapToTable(Sessions.ROOM_ID, Tables.SESSIONS)
+ *               .where(Qualified.SESSIONS_BLOCK_ID + "=?", blockId);
+ * </pre>
+ *
+ * <p>In this example, we have two different types of {@code JOIN}s: a left outer join using a
+ * modified table name (since this class doesn't directly support these), and an inner join using
+ * the mapToTable() function. The map() function is used to insert a count based on specific
+ * criteria, executed as a sub-query.
+ *
+ * This class is <em>not</em> thread safe.
+ */
+public class SelectionBuilder {
+    private static final String TAG = "basicsyncadapter";
+
+    private String mTable = null;
+    private Map<String, String> mProjectionMap = Maps.newHashMap();
+    private StringBuilder mSelection = new StringBuilder();
+    private ArrayList<String> mSelectionArgs = Lists.newArrayList();
+
+    /**
+     * Reset any internal state, allowing this builder to be recycled.
+     *
+     * <p>Calling this method is more efficient than creating a new SelectionBuilder object.
+     *
+     * @return Fluent interface
+     */
+    public SelectionBuilder reset() {
+        mTable = null;
+        mSelection.setLength(0);
+        mSelectionArgs.clear();
+        return this;
+    }
+
+    /**
+     * Append the given selection clause to the internal state. Each clause is
+     * surrounded with parenthesis and combined using {@code AND}.
+     *
+     * <p>In the most basic usage, simply provide a selection in SQL {@code WHERE} statement format.
+     *
+     * <p>Example:
+     *
+     * <pre>
+     *     .where("blog_posts.category = 'PROGRAMMING');
+     * </pre>
+     *
+     * <p>User input should never be directly supplied as as part of the selection statement.
+     * Instead, use positional parameters in your selection statement, then pass the user input
+     * in via the selectionArgs parameter. This prevents SQL escape characters in user input from
+     * causing unwanted side effects. (Failure to follow this convention may have security
+     * implications.)
+     *
+     * <p>Positional parameters are specified using the '?' character.
+     *
+     * <p>Example:
+     * <pre>
+     *     .where("blog_posts.title contains ?, userSearchString);
+     * </pre>
+     *
+     * @param selection SQL where statement
+     * @param selectionArgs Values to substitute for positional parameters ('?' characters in
+     *                      {@code selection} statement. Will be automatically escaped.
+     * @return Fluent interface
+     */
+    public SelectionBuilder where(String selection, String... selectionArgs) {
+        if (TextUtils.isEmpty(selection)) {
+            if (selectionArgs != null && selectionArgs.length > 0) {
+                throw new IllegalArgumentException(
+                        "Valid selection required when including arguments=");
+            }
+
+            // Shortcut when clause is empty
+            return this;
+        }
+
+        if (mSelection.length() > 0) {
+            mSelection.append(" AND ");
+        }
+
+        mSelection.append("(").append(selection).append(")");
+        if (selectionArgs != null) {
+            Collections.addAll(mSelectionArgs, selectionArgs);
+        }
+
+        return this;
+    }
+
+    /**
+     * Table name to use for SQL {@code FROM} statement.
+     *
+     * <p>This method may only be called once. If multiple tables are required, concatenate them
+     * in SQL-format (typically comma-separated).
+     *
+     * <p>If you need to do advanced {@code JOIN}s, they can also be specified here.
+     *
+     * See also: mapToTable()
+     *
+     * @param table Table name
+     * @return Fluent interface
+     */
+    public SelectionBuilder table(String table) {
+        mTable = table;
+        return this;
+    }
+
+    /**
+     * Verify that a table name has been supplied using table().
+     *
+     * @throws IllegalStateException if table not set
+     */
+    private void assertTable() {
+        if (mTable == null) {
+            throw new IllegalStateException("Table not specified");
+        }
+    }
+
+    /**
+     * Perform an inner join.
+     *
+     * <p>Map columns from a secondary table onto the current result set. References to the column
+     * specified in {@code column} will be replaced with {@code table.column} in the SQL {@code
+     * SELECT} clause.
+     *
+     * @param column Column name to join on. Must be the same in both tables.
+     * @param table Secondary table to join.
+     * @return Fluent interface
+     */
+    public SelectionBuilder mapToTable(String column, String table) {
+        mProjectionMap.put(column, table + "." + column);
+        return this;
+    }
+
+    /**
+     * Create a new column based on custom criteria (such as aggregate functions).
+     *
+     * <p>This adds a new column to the result set, based upon custom criteria in SQL format. This
+     * is equivalent to the SQL statement: {@code SELECT toClause AS fromColumn}
+     *
+     * <p>This method is useful for executing SQL sub-queries.
+     *
+     * @param fromColumn Name of column for mapping
+     * @param toClause SQL string representing data to be mapped
+     * @return Fluent interface
+     */
+    public SelectionBuilder map(String fromColumn, String toClause) {
+        mProjectionMap.put(fromColumn, toClause + " AS " + fromColumn);
+        return this;
+    }
+
+    /**
+     * Return selection string based on current internal state.
+     *
+     * @return Current selection as a SQL statement
+     * @see #getSelectionArgs()
+     */
+    public String getSelection() {
+        return mSelection.toString();
+
+    }
+
+    /**
+     * Return selection arguments based on current internal state.
+     *
+     * @see #getSelection()
+     */
+    public String[] getSelectionArgs() {
+        return mSelectionArgs.toArray(new String[mSelectionArgs.size()]);
+    }
+
+    /**
+     * Process user-supplied projection (column list).
+     *
+     * <p>In cases where a column is mapped to another data source (either another table, or an
+     * SQL sub-query), the column name will be replaced with a more specific, SQL-compatible
+     * representation.
+     *
+     * Assumes that incoming columns are non-null.
+     *
+     * <p>See also: map(), mapToTable()
+     *
+     * @param columns User supplied projection (column list).
+     */
+    private void mapColumns(String[] columns) {
+        for (int i = 0; i < columns.length; i++) {
+            final String target = mProjectionMap.get(columns[i]);
+            if (target != null) {
+                columns[i] = target;
+            }
+        }
+    }
+
+    /**
+     * Return a description of this builder's state. Does NOT output SQL.
+     *
+     * @return Human-readable internal state
+     */
+    @Override
+    public String toString() {
+        return "SelectionBuilder[table=" + mTable + ", selection=" + getSelection()
+                + ", selectionArgs=" + Arrays.toString(getSelectionArgs()) + "]";
+    }
+
+    /**
+     * Execute query (SQL {@code SELECT}) against specified database.
+     *
+     * <p>Using a null projection (column list) is not supported.
+     *
+     * @param db Database to query.
+     * @param columns Database projection (column list) to return, must be non-NULL.
+     * @param orderBy How to order the rows, formatted as an SQL ORDER BY clause (excluding the
+     *                ORDER BY itself). Passing null will use the default sort order, which may be
+     *                unordered.
+     * @return A {@link Cursor} object, which is positioned before the first entry. Note that
+     *         {@link Cursor}s are not synchronized, see the documentation for more details.
+     */
+    public Cursor query(SQLiteDatabase db, String[] columns, String orderBy) {
+        return query(db, columns, null, null, orderBy, null);
+    }
+
+    /**
+     * Execute query ({@code SELECT}) against database.
+     *
+     * <p>Using a null projection (column list) is not supported.
+     *
+     * @param db Database to query.
+     * @param columns Database projection (column list) to return, must be non-null.
+     * @param groupBy A filter declaring how to group rows, formatted as an SQL GROUP BY clause
+     *                (excluding the GROUP BY itself). Passing null will cause the rows to not be
+     *                grouped.
+     * @param having A filter declare which row groups to include in the cursor, if row grouping is
+     *               being used, formatted as an SQL HAVING clause (excluding the HAVING itself).
+     *               Passing null will cause all row groups to be included, and is required when
+     *               row grouping is not being used.
+     * @param orderBy How to order the rows, formatted as an SQL ORDER BY clause (excluding the
+     *                ORDER BY itself). Passing null will use the default sort order, which may be
+     *                unordered.
+     * @param limit Limits the number of rows returned by the query, formatted as LIMIT clause.
+     *              Passing null denotes no LIMIT clause.
+     * @return A {@link Cursor} object, which is positioned before the first entry. Note that
+     *         {@link Cursor}s are not synchronized, see the documentation for more details.
+     */
+    public Cursor query(SQLiteDatabase db, String[] columns, String groupBy,
+                        String having, String orderBy, String limit) {
+        assertTable();
+        if (columns != null) mapColumns(columns);
+        Log.v(TAG, "query(columns=" + Arrays.toString(columns) + ") " + this);
+        return db.query(mTable, columns, getSelection(), getSelectionArgs(), groupBy, having,
+                orderBy, limit);
+    }
+
+    /**
+     * Execute an {@code UPDATE} against database.
+     *
+     * @param db Database to query.
+     * @param values A map from column names to new column values. null is a valid value that will
+     *               be translated to NULL
+     * @return The number of rows affected.
+     */
+    public int update(SQLiteDatabase db, ContentValues values) {
+        assertTable();
+        Log.v(TAG, "update() " + this);
+        return db.update(mTable, values, getSelection(), getSelectionArgs());
+    }
+
+    /**
+     * Execute {@code DELETE} against database.
+     *
+     * @param db Database to query.
+     * @return The number of rows affected.
+     */
+    public int delete(SQLiteDatabase db) {
+        assertTable();
+        Log.v(TAG, "delete() " + this);
+        return db.delete(mTable, getSelection(), getSelectionArgs());
+    }
+}
diff --git a/common/src/com/example/android/common/dummydata/Cheeses.java b/common/src/com/example/android/common/dummydata/Cheeses.java
deleted file mode 100644
index a386e68..0000000
--- a/common/src/com/example/android/common/dummydata/Cheeses.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright 2013 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.common.dummydata;
-
-import java.util.ArrayList;
-
-/**
- * Dummy data.
- */
-public class Cheeses {
-    static final String[] CHEESES = {
-            "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi",
-            "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale",
-            "Aisy Cendre", "Allgauer Emmentaler", "Alverca", "Ambert", "American Cheese",
-            "Ami du Chambertin", "Anejo Enchilado", "Anneau du Vic-Bilh", "Anthoriro", "Appenzell",
-            "Aragon", "Ardi Gasna", "Ardrahan", "Armenian String", "Aromes au Gene de Marc",
-            "Asadero", "Asiago", "Aubisque Pyrenees", "Autun", "Avaxtskyr", "Baby Swiss",
-            "Babybel", "Baguette Laonnaise", "Bakers", "Baladi", "Balaton", "Bandal", "Banon",
-            "Barry's Bay Cheddar", "Basing", "Basket Cheese", "Bath Cheese", "Bavarian Bergkase",
-            "Baylough", "Beaufort", "Beauvoorde", "Beenleigh Blue", "Beer Cheese", "Bel Paese",
-            "Bergader", "Bergere Bleue", "Berkswell", "Beyaz Peynir", "Bierkase", "Bishop Kennedy",
-            "Blarney", "Bleu d'Auvergne", "Bleu de Gex", "Bleu de Laqueuille",
-            "Bleu de Septmoncel", "Bleu Des Causses", "Blue", "Blue Castello", "Blue Rathgore",
-            "Blue Vein (Australian)", "Blue Vein Cheeses", "Bocconcini", "Bocconcini (Australian)",
-            "Boeren Leidenkaas", "Bonchester", "Bosworth", "Bougon", "Boule Du Roves",
-            "Boulette d'Avesnes", "Boursault", "Boursin", "Bouyssou", "Bra", "Braudostur",
-            "Breakfast Cheese", "Brebis du Lavort", "Brebis du Lochois", "Brebis du Puyfaucon",
-            "Bresse Bleu", "Brick", "Brie", "Brie de Meaux", "Brie de Melun", "Brillat-Savarin",
-            "Brin", "Brin d' Amour", "Brin d'Amour", "Brinza (Burduf Brinza)",
-            "Briquette de Brebis", "Briquette du Forez", "Broccio", "Broccio Demi-Affine",
-            "Brousse du Rove", "Bruder Basil", "Brusselae Kaas (Fromage de Bruxelles)", "Bryndza",
-            "Buchette d'Anjou", "Buffalo", "Burgos", "Butte", "Butterkase", "Button (Innes)",
-            "Buxton Blue", "Cabecou", "Caboc", "Cabrales", "Cachaille", "Caciocavallo", "Caciotta",
-            "Caerphilly", "Cairnsmore", "Calenzana", "Cambazola", "Camembert de Normandie",
-            "Canadian Cheddar", "Canestrato", "Cantal", "Caprice des Dieux", "Capricorn Goat",
-            "Capriole Banon", "Carre de l'Est", "Casciotta di Urbino", "Cashel Blue", "Castellano",
-            "Castelleno", "Castelmagno", "Castelo Branco", "Castigliano", "Cathelain",
-            "Celtic Promise", "Cendre d'Olivet", "Cerney", "Chabichou", "Chabichou du Poitou",
-            "Chabis de Gatine", "Chaource", "Charolais", "Chaumes", "Cheddar",
-            "Cheddar Clothbound", "Cheshire", "Chevres", "Chevrotin des Aravis", "Chontaleno",
-            "Civray", "Coeur de Camembert au Calvados", "Coeur de Chevre", "Colby", "Cold Pack",
-            "Comte", "Coolea", "Cooleney", "Coquetdale", "Corleggy", "Cornish Pepper",
-            "Cotherstone", "Cotija", "Cottage Cheese", "Cottage Cheese (Australian)",
-            "Cougar Gold", "Coulommiers", "Coverdale", "Crayeux de Roncq", "Cream Cheese",
-            "Cream Havarti", "Crema Agria", "Crema Mexicana", "Creme Fraiche", "Crescenza",
-            "Croghan", "Crottin de Chavignol", "Crottin du Chavignol", "Crowdie", "Crowley",
-            "Cuajada", "Curd", "Cure Nantais", "Curworthy", "Cwmtawe Pecorino",
-            "Cypress Grove Chevre", "Danablu (Danish Blue)", "Danbo", "Danish Fontina",
-            "Daralagjazsky", "Dauphin", "Delice des Fiouves", "Denhany Dorset Drum", "Derby",
-            "Dessertnyj Belyj", "Devon Blue", "Devon Garland", "Dolcelatte", "Doolin",
-            "Doppelrhamstufel", "Dorset Blue Vinney", "Double Gloucester", "Double Worcester",
-            "Dreux a la Feuille", "Dry Jack", "Duddleswell", "Dunbarra", "Dunlop", "Dunsyre Blue",
-            "Duroblando", "Durrus", "Dutch Mimolette (Commissiekaas)", "Edam", "Edelpilz",
-            "Emental Grand Cru", "Emlett", "Emmental", "Epoisses de Bourgogne", "Esbareich",
-            "Esrom", "Etorki", "Evansdale Farmhouse Brie", "Evora De L'Alentejo", "Exmoor Blue",
-            "Explorateur", "Feta", "Feta (Australian)", "Figue", "Filetta", "Fin-de-Siecle",
-            "Finlandia Swiss", "Finn", "Fiore Sardo", "Fleur du Maquis", "Flor de Guia",
-            "Flower Marie", "Folded", "Folded cheese with mint", "Fondant de Brebis",
-            "Fontainebleau", "Fontal", "Fontina Val d'Aosta", "Formaggio di capra", "Fougerus",
-            "Four Herb Gouda", "Fourme d' Ambert", "Fourme de Haute Loire", "Fourme de Montbrison",
-            "Fresh Jack", "Fresh Mozzarella", "Fresh Ricotta", "Fresh Truffles", "Fribourgeois",
-            "Friesekaas", "Friesian", "Friesla", "Frinault", "Fromage a Raclette", "Fromage Corse",
-            "Fromage de Montagne de Savoie", "Fromage Frais", "Fruit Cream Cheese",
-            "Frying Cheese", "Fynbo", "Gabriel", "Galette du Paludier", "Galette Lyonnaise",
-            "Galloway Goat's Milk Gems", "Gammelost", "Gaperon a l'Ail", "Garrotxa", "Gastanberra",
-            "Geitost", "Gippsland Blue", "Gjetost", "Gloucester", "Golden Cross", "Gorgonzola",
-            "Gornyaltajski", "Gospel Green", "Gouda", "Goutu", "Gowrie", "Grabetto", "Graddost",
-            "Grafton Village Cheddar", "Grana", "Grana Padano", "Grand Vatel",
-            "Grataron d' Areches", "Gratte-Paille", "Graviera", "Greuilh", "Greve",
-            "Gris de Lille", "Gruyere", "Gubbeen", "Guerbigny", "Halloumi",
-            "Halloumy (Australian)", "Haloumi-Style Cheese", "Harbourne Blue", "Havarti",
-            "Heidi Gruyere", "Hereford Hop", "Herrgardsost", "Herriot Farmhouse", "Herve",
-            "Hipi Iti", "Hubbardston Blue Cow", "Hushallsost", "Iberico", "Idaho Goatster",
-            "Idiazabal", "Il Boschetto al Tartufo", "Ile d'Yeu", "Isle of Mull", "Jarlsberg",
-            "Jermi Tortes", "Jibneh Arabieh", "Jindi Brie", "Jubilee Blue", "Juustoleipa",
-            "Kadchgall", "Kaseri", "Kashta", "Kefalotyri", "Kenafa", "Kernhem", "Kervella Affine",
-            "Kikorangi", "King Island Cape Wickham Brie", "King River Gold", "Klosterkaese",
-            "Knockalara", "Kugelkase", "L'Aveyronnais", "L'Ecir de l'Aubrac", "La Taupiniere",
-            "La Vache Qui Rit", "Laguiole", "Lairobell", "Lajta", "Lanark Blue", "Lancashire",
-            "Langres", "Lappi", "Laruns", "Lavistown", "Le Brin", "Le Fium Orbo", "Le Lacandou",
-            "Le Roule", "Leafield", "Lebbene", "Leerdammer", "Leicester", "Leyden", "Limburger",
-            "Lincolnshire Poacher", "Lingot Saint Bousquet d'Orb", "Liptauer", "Little Rydings",
-            "Livarot", "Llanboidy", "Llanglofan Farmhouse", "Loch Arthur Farmhouse",
-            "Loddiswell Avondale", "Longhorn", "Lou Palou", "Lou Pevre", "Lyonnais", "Maasdam",
-            "Macconais", "Mahoe Aged Gouda", "Mahon", "Malvern", "Mamirolle", "Manchego",
-            "Manouri", "Manur", "Marble Cheddar", "Marbled Cheeses", "Maredsous", "Margotin",
-            "Maribo", "Maroilles", "Mascares", "Mascarpone", "Mascarpone (Australian)",
-            "Mascarpone Torta", "Matocq", "Maytag Blue", "Meira", "Menallack Farmhouse",
-            "Menonita", "Meredith Blue", "Mesost", "Metton (Cancoillotte)", "Meyer Vintage Gouda",
-            "Mihalic Peynir", "Milleens", "Mimolette", "Mine-Gabhar", "Mini Baby Bells", "Mixte",
-            "Molbo", "Monastery Cheeses", "Mondseer", "Mont D'or Lyonnais", "Montasio",
-            "Monterey Jack", "Monterey Jack Dry", "Morbier", "Morbier Cru de Montagne",
-            "Mothais a la Feuille", "Mozzarella", "Mozzarella (Australian)",
-            "Mozzarella di Bufala", "Mozzarella Fresh, in water", "Mozzarella Rolls", "Munster",
-            "Murol", "Mycella", "Myzithra", "Naboulsi", "Nantais", "Neufchatel",
-            "Neufchatel (Australian)", "Niolo", "Nokkelost", "Northumberland", "Oaxaca",
-            "Olde York", "Olivet au Foin", "Olivet Bleu", "Olivet Cendre",
-            "Orkney Extra Mature Cheddar", "Orla", "Oschtjepka", "Ossau Fermier", "Ossau-Iraty",
-            "Oszczypek", "Oxford Blue", "P'tit Berrichon", "Palet de Babligny", "Paneer", "Panela",
-            "Pannerone", "Pant ys Gawn", "Parmesan (Parmigiano)", "Parmigiano Reggiano",
-            "Pas de l'Escalette", "Passendale", "Pasteurized Processed", "Pate de Fromage",
-            "Patefine Fort", "Pave d'Affinois", "Pave d'Auge", "Pave de Chirac", "Pave du Berry",
-            "Pecorino", "Pecorino in Walnut Leaves", "Pecorino Romano", "Peekskill Pyramid",
-            "Pelardon des Cevennes", "Pelardon des Corbieres", "Penamellera", "Penbryn",
-            "Pencarreg", "Perail de Brebis", "Petit Morin", "Petit Pardou", "Petit-Suisse",
-            "Picodon de Chevre", "Picos de Europa", "Piora", "Pithtviers au Foin",
-            "Plateau de Herve", "Plymouth Cheese", "Podhalanski", "Poivre d'Ane", "Polkolbin",
-            "Pont l'Eveque", "Port Nicholson", "Port-Salut", "Postel", "Pouligny-Saint-Pierre",
-            "Pourly", "Prastost", "Pressato", "Prince-Jean", "Processed Cheddar", "Provolone",
-            "Provolone (Australian)", "Pyengana Cheddar", "Pyramide", "Quark",
-            "Quark (Australian)", "Quartirolo Lombardo", "Quatre-Vents", "Quercy Petit",
-            "Queso Blanco", "Queso Blanco con Frutas --Pina y Mango", "Queso de Murcia",
-            "Queso del Montsec", "Queso del Tietar", "Queso Fresco", "Queso Fresco (Adobera)",
-            "Queso Iberico", "Queso Jalapeno", "Queso Majorero", "Queso Media Luna",
-            "Queso Para Frier", "Queso Quesadilla", "Rabacal", "Raclette", "Ragusano", "Raschera",
-            "Reblochon", "Red Leicester", "Regal de la Dombes", "Reggianito", "Remedou",
-            "Requeson", "Richelieu", "Ricotta", "Ricotta (Australian)", "Ricotta Salata", "Ridder",
-            "Rigotte", "Rocamadour", "Rollot", "Romano", "Romans Part Dieu", "Roncal", "Roquefort",
-            "Roule", "Rouleau De Beaulieu", "Royalp Tilsit", "Rubens", "Rustinu", "Saaland Pfarr",
-            "Saanenkaese", "Saga", "Sage Derby", "Sainte Maure", "Saint-Marcellin",
-            "Saint-Nectaire", "Saint-Paulin", "Salers", "Samso", "San Simon", "Sancerre",
-            "Sap Sago", "Sardo", "Sardo Egyptian", "Sbrinz", "Scamorza", "Schabzieger", "Schloss",
-            "Selles sur Cher", "Selva", "Serat", "Seriously Strong Cheddar", "Serra da Estrela",
-            "Sharpam", "Shelburne Cheddar", "Shropshire Blue", "Siraz", "Sirene", "Smoked Gouda",
-            "Somerset Brie", "Sonoma Jack", "Sottocenare al Tartufo", "Soumaintrain",
-            "Sourire Lozerien", "Spenwood", "Sraffordshire Organic", "St. Agur Blue Cheese",
-            "Stilton", "Stinking Bishop", "String", "Sussex Slipcote", "Sveciaost", "Swaledale",
-            "Sweet Style Swiss", "Swiss", "Syrian (Armenian String)", "Tala", "Taleggio", "Tamie",
-            "Tasmania Highland Chevre Log", "Taupiniere", "Teifi", "Telemea", "Testouri",
-            "Tete de Moine", "Tetilla", "Texas Goat Cheese", "Tibet", "Tillamook Cheddar",
-            "Tilsit", "Timboon Brie", "Toma", "Tomme Brulee", "Tomme d'Abondance",
-            "Tomme de Chevre", "Tomme de Romans", "Tomme de Savoie", "Tomme des Chouans", "Tommes",
-            "Torta del Casar", "Toscanello", "Touree de L'Aubier", "Tourmalet",
-            "Trappe (Veritable)", "Trois Cornes De Vendee", "Tronchon", "Trou du Cru", "Truffe",
-            "Tupi", "Turunmaa", "Tymsboro", "Tyn Grug", "Tyning", "Ubriaco", "Ulloa",
-            "Vacherin-Fribourgeois", "Valencay", "Vasterbottenost", "Venaco", "Vendomois",
-            "Vieux Corse", "Vignotte", "Vulscombe", "Waimata Farmhouse Blue",
-            "Washed Rind Cheese (Australian)", "Waterloo", "Weichkaese", "Wellington",
-            "Wensleydale", "White Stilton", "Whitestone Farmhouse", "Wigmore", "Woodside Cabecou",
-            "Xanadu", "Xynotyro", "Yarg Cornish", "Yarra Valley Pyramid", "Yorkshire Blue",
-            "Zamorano", "Zanetti Grana Padano", "Zanetti Parmigiano Reggiano"
-    };
-
-    public static ArrayList<String> asList() {
-        ArrayList<String> items = new ArrayList<String>();
-        for (int i = 0, z = CHEESES.length ; i < z ; i++) {
-            items.add(CHEESES[i]);
-        }
-        return items;
-    }
-}
\ No newline at end of file
diff --git a/common/src/java/com/example/android/common/media/CameraHelper.java b/common/src/com/example/android/common/media/CameraHelper.java
similarity index 100%
rename from common/src/java/com/example/android/common/media/CameraHelper.java
rename to common/src/com/example/android/common/media/CameraHelper.java
diff --git a/common/src/com/example/android/common/play/PlayHelper.java b/common/src/com/example/android/common/play/PlayHelper.java
new file mode 100644
index 0000000..c38c2bb
--- /dev/null
+++ b/common/src/com/example/android/common/play/PlayHelper.java
@@ -0,0 +1,102 @@
+package com.example.android.common.play;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.os.Bundle;
+import android.support.v4.app.DialogFragment;
+import android.support.v4.app.FragmentActivity;
+
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.GooglePlayServicesUtil;
+
+/**
+ * Helper class for Google Play Services functions.
+ * <ul>
+ *     <li>
+ *         Checks availability
+ *     </li>
+ *     <li>
+ *         Validates version for version bound features
+ *     </li>
+ * </ul>
+ */
+public class PlayHelper {
+
+    /**
+     * Checks for Google Play Services installation on the device. If found, validates the
+     * installed version against the requested version. If the service is installed but
+     * can't be used, the utility initiates a recovery with user intervention.
+     *
+     * @param context The context to be associated with the request. For compatibility with 1.6+,
+     *                subclass {@link FragmentActivity}.
+     * @param requestCode If we need to download Google Play Services, the download activity will be
+     *                    started using {@link Activity#startActivityForResult(Intent, int)}
+     * @param versionCode The minimum required version of the library.
+     * @return True, if successful.
+     */
+    public static boolean checkGooglePlayServiceAvailability(
+            FragmentActivity context, int requestCode, int versionCode) {
+
+        // Query for the status of Google Play services on the device
+        int statusCode = GooglePlayServicesUtil
+                .isGooglePlayServicesAvailable(context);
+
+        if ((statusCode == ConnectionResult.SUCCESS )
+                &&  (GooglePlayServicesUtil.GOOGLE_PLAY_SERVICES_VERSION_CODE >=  versionCode)) {
+            return true;
+        } else {
+            if (GooglePlayServicesUtil.isUserRecoverableError(statusCode)) {
+                Dialog eDialog = GooglePlayServicesUtil.getErrorDialog(statusCode,
+                        context, requestCode);
+                // If Google Play services can provide an error dialog
+                if (eDialog != null) {
+                    // Create a new DialogFragment for the error dialog
+                    ErrorDialogFragment errorFragment =
+                            new ErrorDialogFragment();
+                    // Set the dialog in the DialogFragment
+                    errorFragment.setDialog(eDialog);
+                    // Show the error dialog in the DialogFragment
+                    errorFragment.show(
+                            context.getSupportFragmentManager(),
+                            "Activity Recognition");
+                }
+            } else {
+                return false;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Checks for Google Play Services installation on the device. If the service is installed but
+     * can't be used, the utility initiates a recovery with user intervention.
+     *
+     * @param context The context to be associated with the request. For compatibility with 1.6+,
+     *                subclass {@link FragmentActivity}.
+     * @return True, if successful.
+     */
+    public static boolean checkGooglePlayServiceAvailability(FragmentActivity context,
+            int requestCode) {
+        return checkGooglePlayServiceAvailability(context, requestCode, -1);
+    }
+
+    // Define a DialogFragment that displays the error dialog
+    public static class ErrorDialogFragment extends DialogFragment {
+        // Global field to contain the error dialog
+        private Dialog mDialog;
+        // Default constructor. Sets the dialog field to null
+        public ErrorDialogFragment() {
+            super();
+            mDialog = null;
+        }
+        // Set the dialog to display
+        public void setDialog(Dialog dialog) {
+            mDialog = dialog;
+        }
+        // Return a Dialog to the DialogFragment.
+        @Override
+        public Dialog onCreateDialog(Bundle savedInstanceState) {
+            return mDialog;
+        }
+    }
+}
diff --git a/common/src/java/com/example/android/common/accounts/GenericAccountService.java b/common/src/java/com/example/android/common/accounts/GenericAccountService.java
deleted file mode 100644
index 0cd499a..0000000
--- a/common/src/java/com/example/android/common/accounts/GenericAccountService.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright 2013 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.common.accounts;
-
-import android.accounts.AbstractAccountAuthenticator;
-import android.accounts.Account;
-import android.accounts.AccountAuthenticatorResponse;
-import android.accounts.NetworkErrorException;
-import android.app.Service;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.util.Log;
-
-public class GenericAccountService extends Service {
-    private static final String TAG = "GenericAccountService";
-    public static final String ACCOUNT_NAME = "Account";
-    private Authenticator mAuthenticator;
-
-    /**
-     * Obtain a handle to the {@link android.accounts.Account} used for sync in this application.
-     *
-     * <p>It is important that the accountType specified here matches the value in your sync adapter
-     * configuration XML file for android.accounts.AccountAuthenticator (often saved in
-     * res/xml/syncadapter.xml). If this is not set correctly, you'll receive an error indicating
-     * that "caller uid XXXXX is different than the authenticator's uid".
-     *
-     * @param accountType AccountType defined in the configuration XML file for
-     *                    android.accounts.AccountAuthenticator (e.g. res/xml/syncadapter.xml).
-     * @return Handle to application's account (not guaranteed to resolve unless CreateSyncAccount()
-     *         has been called)
-     */
-    public static Account GetAccount(String accountType) {
-        // Note: Normally the account name is set to the user's identity (username or email
-        // address). However, since we aren't actually using any user accounts, it makes more sense
-        // to use a generic string in this case.
-        //
-        // This string should *not* be localized. If the user switches locale, we would not be
-        // able to locate the old account, and may erroneously register multiple accounts.
-        final String accountName = ACCOUNT_NAME;
-        return new Account(accountName, accountType);
-    }
-
-    @Override
-    public void onCreate() {
-        Log.i(TAG, "Service created");
-        mAuthenticator = new Authenticator(this);
-    }
-
-    @Override
-    public void onDestroy() {
-        Log.i(TAG, "Service destroyed");
-    }
-
-    @Override
-    public IBinder onBind(Intent intent) {
-        return mAuthenticator.getIBinder();
-    }
-
-    public class Authenticator extends AbstractAccountAuthenticator {
-        public Authenticator(Context context) {
-            super(context);
-        }
-
-        @Override
-        public Bundle editProperties(AccountAuthenticatorResponse accountAuthenticatorResponse,
-                                     String s) {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Bundle addAccount(AccountAuthenticatorResponse accountAuthenticatorResponse,
-                                 String s, String s2, String[] strings, Bundle bundle)
-                throws NetworkErrorException {
-            return null;
-        }
-
-        @Override
-        public Bundle confirmCredentials(AccountAuthenticatorResponse accountAuthenticatorResponse,
-                                         Account account, Bundle bundle)
-                throws NetworkErrorException {
-            return null;
-        }
-
-        @Override
-        public Bundle getAuthToken(AccountAuthenticatorResponse accountAuthenticatorResponse,
-                                   Account account, String s, Bundle bundle)
-                throws NetworkErrorException {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public String getAuthTokenLabel(String s) {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Bundle updateCredentials(AccountAuthenticatorResponse accountAuthenticatorResponse,
-                                        Account account, String s, Bundle bundle)
-                throws NetworkErrorException {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Bundle hasFeatures(AccountAuthenticatorResponse accountAuthenticatorResponse,
-                                  Account account, String[] strings)
-                throws NetworkErrorException {
-            throw new UnsupportedOperationException();
-        }
-    }
-
-}
-
diff --git a/common/src/java/com/example/android/common/activities/SampleActivityBase.java b/common/src/java/com/example/android/common/activities/SampleActivityBase.java
deleted file mode 100644
index 3228927..0000000
--- a/common/src/java/com/example/android/common/activities/SampleActivityBase.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-* Copyright 2013 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.common.activities;
-
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-
-import com.example.android.common.logger.Log;
-import com.example.android.common.logger.LogWrapper;
-
-/**
- * Base launcher activity, to handle most of the common plumbing for samples.
- */
-public class SampleActivityBase extends FragmentActivity {
-
-    public static final String TAG = "SampleActivityBase";
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-    }
-
-    @Override
-    protected  void onStart() {
-        super.onStart();
-        initializeLogging();
-    }
-
-    /** Set up targets to receive log data */
-    public void initializeLogging() {
-        // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
-        // Wraps Android's native log framework
-        LogWrapper logWrapper = new LogWrapper();
-        Log.setLogNode(logWrapper);
-
-        Log.i(TAG, "Ready");
-    }
-}
diff --git a/common/src/java/com/example/android/common/db/SelectionBuilder.java b/common/src/java/com/example/android/common/db/SelectionBuilder.java
deleted file mode 100644
index a1964c5..0000000
--- a/common/src/java/com/example/android/common/db/SelectionBuilder.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * Copyright 2013 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.
- */
-
-/*
- * Modifications:
- * -Imported from AOSP frameworks/base/core/java/com/android/internal/content
- * -Changed package name
- */
-
-package com.example.android.common.db;
-
-import android.content.ContentValues;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.text.TextUtils;
-import android.util.Log;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Helper for building selection clauses for {@link SQLiteDatabase}.
- *
- * <p>This class provides a convenient frontend for working with SQL. Instead of composing statements
- * manually using string concatenation, method calls are used to construct the statement one
- * clause at a time. These methods can be chained together.
- *
- * <p>If multiple where() statements are provided, they're combined using {@code AND}.
- *
- * <p>Example:
- *
- * <pre>
- *     SelectionBuilder builder = new SelectionBuilder();
- *     Cursor c = builder.table(FeedContract.Entry.TABLE_NAME)       // String TABLE_NAME = "entry"
- *                       .where(FeedContract.Entry._ID + "=?", id);  // String _ID = "_ID"
- *                       .query(db, projection, sortOrder)
- *
- * </pre>
- *
- * <p>In this example, the table name and filters ({@code WHERE} clauses) are both explicitly
- * specified via method call. SelectionBuilder takes care of issuing a "query" command to the
- * database, and returns the resulting {@link Cursor} object.
- *
- * <p>Inner {@code JOIN}s can be accomplished using the mapToTable() function. The map() function
- * can be used to create new columns based on arbitrary (SQL-based) criteria. In advanced usage,
- * entire subqueries can be passed into the map() function.
- *
- * <p>Advanced example:
- *
- * <pre>
- *     // String SESSIONS_JOIN_BLOCKS_ROOMS = "sessions "
- *     //        + "LEFT OUTER JOIN blocks ON sessions.block_id=blocks.block_id "
- *     //        + "LEFT OUTER JOIN rooms ON sessions.room_id=rooms.room_id";
- *
- *     // String Subquery.BLOCK_NUM_STARRED_SESSIONS =
- *     //       "(SELECT COUNT(1) FROM "
- *     //        + Tables.SESSIONS + " WHERE " + Qualified.SESSIONS_BLOCK_ID + "="
- *     //        + Qualified.BLOCKS_BLOCK_ID + " AND " + Qualified.SESSIONS_STARRED + "=1)";
- *
- *     String Subqery.BLOCK_SESSIONS_COUNT =
- *     Cursor c = builder.table(Tables.SESSIONS_JOIN_BLOCKS_ROOMS)
- *               .map(Blocks.NUM_STARRED_SESSIONS, Subquery.BLOCK_NUM_STARRED_SESSIONS)
- *               .mapToTable(Sessions._ID, Tables.SESSIONS)
- *               .mapToTable(Sessions.SESSION_ID, Tables.SESSIONS)
- *               .mapToTable(Sessions.BLOCK_ID, Tables.SESSIONS)
- *               .mapToTable(Sessions.ROOM_ID, Tables.SESSIONS)
- *               .where(Qualified.SESSIONS_BLOCK_ID + "=?", blockId);
- * </pre>
- *
- * <p>In this example, we have two different types of {@code JOIN}s: a left outer join using a
- * modified table name (since this class doesn't directly support these), and an inner join using
- * the mapToTable() function. The map() function is used to insert a count based on specific
- * criteria, executed as a sub-query.
- *
- * This class is <em>not</em> thread safe.
- */
-public class SelectionBuilder {
-    private static final String TAG = "basicsyncadapter";
-
-    private String mTable = null;
-    private Map<String, String> mProjectionMap = new HashMap<String, String>();
-    private StringBuilder mSelection = new StringBuilder();
-    private ArrayList<String> mSelectionArgs = new ArrayList<String>();
-
-    /**
-     * Reset any internal state, allowing this builder to be recycled.
-     *
-     * <p>Calling this method is more efficient than creating a new SelectionBuilder object.
-     *
-     * @return Fluent interface
-     */
-    public SelectionBuilder reset() {
-        mTable = null;
-        mSelection.setLength(0);
-        mSelectionArgs.clear();
-        return this;
-    }
-
-    /**
-     * Append the given selection clause to the internal state. Each clause is
-     * surrounded with parenthesis and combined using {@code AND}.
-     *
-     * <p>In the most basic usage, simply provide a selection in SQL {@code WHERE} statement format.
-     *
-     * <p>Example:
-     *
-     * <pre>
-     *     .where("blog_posts.category = 'PROGRAMMING');
-     * </pre>
-     *
-     * <p>User input should never be directly supplied as as part of the selection statement.
-     * Instead, use positional parameters in your selection statement, then pass the user input
-     * in via the selectionArgs parameter. This prevents SQL escape characters in user input from
-     * causing unwanted side effects. (Failure to follow this convention may have security
-     * implications.)
-     *
-     * <p>Positional parameters are specified using the '?' character.
-     *
-     * <p>Example:
-     * <pre>
-     *     .where("blog_posts.title contains ?, userSearchString);
-     * </pre>
-     *
-     * @param selection SQL where statement
-     * @param selectionArgs Values to substitute for positional parameters ('?' characters in
-     *                      {@code selection} statement. Will be automatically escaped.
-     * @return Fluent interface
-     */
-    public SelectionBuilder where(String selection, String... selectionArgs) {
-        if (TextUtils.isEmpty(selection)) {
-            if (selectionArgs != null && selectionArgs.length > 0) {
-                throw new IllegalArgumentException(
-                        "Valid selection required when including arguments=");
-            }
-
-            // Shortcut when clause is empty
-            return this;
-        }
-
-        if (mSelection.length() > 0) {
-            mSelection.append(" AND ");
-        }
-
-        mSelection.append("(").append(selection).append(")");
-        if (selectionArgs != null) {
-            Collections.addAll(mSelectionArgs, selectionArgs);
-        }
-
-        return this;
-    }
-
-    /**
-     * Table name to use for SQL {@code FROM} statement.
-     *
-     * <p>This method may only be called once. If multiple tables are required, concatenate them
-     * in SQL-format (typically comma-separated).
-     *
-     * <p>If you need to do advanced {@code JOIN}s, they can also be specified here.
-     *
-     * See also: mapToTable()
-     *
-     * @param table Table name
-     * @return Fluent interface
-     */
-    public SelectionBuilder table(String table) {
-        mTable = table;
-        return this;
-    }
-
-    /**
-     * Verify that a table name has been supplied using table().
-     *
-     * @throws IllegalStateException if table not set
-     */
-    private void assertTable() {
-        if (mTable == null) {
-            throw new IllegalStateException("Table not specified");
-        }
-    }
-
-    /**
-     * Perform an inner join.
-     *
-     * <p>Map columns from a secondary table onto the current result set. References to the column
-     * specified in {@code column} will be replaced with {@code table.column} in the SQL {@code
-     * SELECT} clause.
-     *
-     * @param column Column name to join on. Must be the same in both tables.
-     * @param table Secondary table to join.
-     * @return Fluent interface
-     */
-    public SelectionBuilder mapToTable(String column, String table) {
-        mProjectionMap.put(column, table + "." + column);
-        return this;
-    }
-
-    /**
-     * Create a new column based on custom criteria (such as aggregate functions).
-     *
-     * <p>This adds a new column to the result set, based upon custom criteria in SQL format. This
-     * is equivalent to the SQL statement: {@code SELECT toClause AS fromColumn}
-     *
-     * <p>This method is useful for executing SQL sub-queries.
-     *
-     * @param fromColumn Name of column for mapping
-     * @param toClause SQL string representing data to be mapped
-     * @return Fluent interface
-     */
-    public SelectionBuilder map(String fromColumn, String toClause) {
-        mProjectionMap.put(fromColumn, toClause + " AS " + fromColumn);
-        return this;
-    }
-
-    /**
-     * Return selection string based on current internal state.
-     *
-     * @return Current selection as a SQL statement
-     * @see #getSelectionArgs()
-     */
-    public String getSelection() {
-        return mSelection.toString();
-
-    }
-
-    /**
-     * Return selection arguments based on current internal state.
-     *
-     * @see #getSelection()
-     */
-    public String[] getSelectionArgs() {
-        return mSelectionArgs.toArray(new String[mSelectionArgs.size()]);
-    }
-
-    /**
-     * Process user-supplied projection (column list).
-     *
-     * <p>In cases where a column is mapped to another data source (either another table, or an
-     * SQL sub-query), the column name will be replaced with a more specific, SQL-compatible
-     * representation.
-     *
-     * Assumes that incoming columns are non-null.
-     *
-     * <p>See also: map(), mapToTable()
-     *
-     * @param columns User supplied projection (column list).
-     */
-    private void mapColumns(String[] columns) {
-        for (int i = 0; i < columns.length; i++) {
-            final String target = mProjectionMap.get(columns[i]);
-            if (target != null) {
-                columns[i] = target;
-            }
-        }
-    }
-
-    /**
-     * Return a description of this builder's state. Does NOT output SQL.
-     *
-     * @return Human-readable internal state
-     */
-    @Override
-    public String toString() {
-        return "SelectionBuilder[table=" + mTable + ", selection=" + getSelection()
-                + ", selectionArgs=" + Arrays.toString(getSelectionArgs()) + "]";
-    }
-
-    /**
-     * Execute query (SQL {@code SELECT}) against specified database.
-     *
-     * <p>Using a null projection (column list) is not supported.
-     *
-     * @param db Database to query.
-     * @param columns Database projection (column list) to return, must be non-NULL.
-     * @param orderBy How to order the rows, formatted as an SQL ORDER BY clause (excluding the
-     *                ORDER BY itself). Passing null will use the default sort order, which may be
-     *                unordered.
-     * @return A {@link Cursor} object, which is positioned before the first entry. Note that
-     *         {@link Cursor}s are not synchronized, see the documentation for more details.
-     */
-    public Cursor query(SQLiteDatabase db, String[] columns, String orderBy) {
-        return query(db, columns, null, null, orderBy, null);
-    }
-
-    /**
-     * Execute query ({@code SELECT}) against database.
-     *
-     * <p>Using a null projection (column list) is not supported.
-     *
-     * @param db Database to query.
-     * @param columns Database projection (column list) to return, must be non-null.
-     * @param groupBy A filter declaring how to group rows, formatted as an SQL GROUP BY clause
-     *                (excluding the GROUP BY itself). Passing null will cause the rows to not be
-     *                grouped.
-     * @param having A filter declare which row groups to include in the cursor, if row grouping is
-     *               being used, formatted as an SQL HAVING clause (excluding the HAVING itself).
-     *               Passing null will cause all row groups to be included, and is required when
-     *               row grouping is not being used.
-     * @param orderBy How to order the rows, formatted as an SQL ORDER BY clause (excluding the
-     *                ORDER BY itself). Passing null will use the default sort order, which may be
-     *                unordered.
-     * @param limit Limits the number of rows returned by the query, formatted as LIMIT clause.
-     *              Passing null denotes no LIMIT clause.
-     * @return A {@link Cursor} object, which is positioned before the first entry. Note that
-     *         {@link Cursor}s are not synchronized, see the documentation for more details.
-     */
-    public Cursor query(SQLiteDatabase db, String[] columns, String groupBy,
-                        String having, String orderBy, String limit) {
-        assertTable();
-        if (columns != null) mapColumns(columns);
-        Log.v(TAG, "query(columns=" + Arrays.toString(columns) + ") " + this);
-        return db.query(mTable, columns, getSelection(), getSelectionArgs(), groupBy, having,
-                orderBy, limit);
-    }
-
-    /**
-     * Execute an {@code UPDATE} against database.
-     *
-     * @param db Database to query.
-     * @param values A map from column names to new column values. null is a valid value that will
-     *               be translated to NULL
-     * @return The number of rows affected.
-     */
-    public int update(SQLiteDatabase db, ContentValues values) {
-        assertTable();
-        Log.v(TAG, "update() " + this);
-        return db.update(mTable, values, getSelection(), getSelectionArgs());
-    }
-
-    /**
-     * Execute {@code DELETE} against database.
-     *
-     * @param db Database to query.
-     * @return The number of rows affected.
-     */
-    public int delete(SQLiteDatabase db) {
-        assertTable();
-        Log.v(TAG, "delete() " + this);
-        return db.delete(mTable, getSelection(), getSelectionArgs());
-    }
-}
diff --git a/common/src/java/com/example/android/common/logger/LogFragment.java b/common/src/java/com/example/android/common/logger/LogFragment.java
deleted file mode 100644
index b302acd..0000000
--- a/common/src/java/com/example/android/common/logger/LogFragment.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
-* Copyright 2013 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 2013 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.common.logger;
-
-import android.graphics.Typeface;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.text.Editable;
-import android.text.TextWatcher;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ScrollView;
-
-/**
- * Simple fraggment which contains a LogView and uses is to output log data it receives
- * through the LogNode interface.
- */
-public class LogFragment extends Fragment {
-
-    private LogView mLogView;
-    private ScrollView mScrollView;
-
-    public LogFragment() {}
-
-    public View inflateViews() {
-        mScrollView = new ScrollView(getActivity());
-        ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(
-                ViewGroup.LayoutParams.MATCH_PARENT,
-                ViewGroup.LayoutParams.MATCH_PARENT);
-        mScrollView.setLayoutParams(scrollParams);
-
-        mLogView = new LogView(getActivity());
-        ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
-        logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
-        mLogView.setLayoutParams(logParams);
-        mLogView.setClickable(true);
-        mLogView.setFocusable(true);
-        mLogView.setTypeface(Typeface.MONOSPACE);
-
-        // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
-        int paddingDips = 16;
-        double scale = getResources().getDisplayMetrics().density;
-        int paddingPixels = (int) ((paddingDips * (scale)) + .5);
-        mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
-        mLogView.setCompoundDrawablePadding(paddingPixels);
-
-        mLogView.setGravity(Gravity.BOTTOM);
-        mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);
-
-        mScrollView.addView(mLogView);
-        return mScrollView;
-    }
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-                             Bundle savedInstanceState) {
-
-        View result = inflateViews();
-
-        mLogView.addTextChangedListener(new TextWatcher() {
-            @Override
-            public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
-
-            @Override
-            public void onTextChanged(CharSequence s, int start, int before, int count) {}
-
-            @Override
-            public void afterTextChanged(Editable s) {
-                mScrollView.fullScroll(ScrollView.FOCUS_DOWN);
-            }
-        });
-        return result;
-    }
-
-    public LogView getLogView() {
-        return mLogView;
-    }
-}
\ No newline at end of file
diff --git a/common/src/java/com/example/android/common/logger/LogView.java b/common/src/java/com/example/android/common/logger/LogView.java
deleted file mode 100644
index c01542b..0000000
--- a/common/src/java/com/example/android/common/logger/LogView.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2013 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.common.logger;
-
-import android.app.Activity;
-import android.content.Context;
-import android.util.*;
-import android.widget.TextView;
-
-/** Simple TextView which is used to output log data received through the LogNode interface.
-*/
-public class LogView extends TextView implements LogNode {
-
-    public LogView(Context context) {
-        super(context);
-    }
-
-    public LogView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public LogView(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-    }
-
-    /**
-     * Formats the log data and prints it out to the LogView.
-     * @param priority Log level of the data being logged.  Verbose, Error, etc.
-     * @param tag Tag for for the log data.  Can be used to organize log statements.
-     * @param msg The actual message to be logged. The actual message to be logged.
-     * @param tr If an exception was thrown, this can be sent along for the logging facilities
-     *           to extract and print useful information.
-     */
-    @Override
-    public void println(int priority, String tag, String msg, Throwable tr) {
-
-        
-        String priorityStr = null;
-
-        // For the purposes of this View, we want to print the priority as readable text.
-        switch(priority) {
-            case android.util.Log.VERBOSE:
-                priorityStr = "VERBOSE";
-                break;
-            case android.util.Log.DEBUG:
-                priorityStr = "DEBUG";
-                break;
-            case android.util.Log.INFO:
-                priorityStr = "INFO";
-                break;
-            case android.util.Log.WARN:
-                priorityStr = "WARN";
-                break;
-            case android.util.Log.ERROR:
-                priorityStr = "ERROR";
-                break;
-            case android.util.Log.ASSERT:
-                priorityStr = "ASSERT";
-                break;
-            default:
-                break;
-        }
-
-        // Handily, the Log class has a facility for converting a stack trace into a usable string.
-        String exceptionStr = null;
-        if (tr != null) {
-            exceptionStr = android.util.Log.getStackTraceString(tr);
-        }
-
-        // Take the priority, tag, message, and exception, and concatenate as necessary
-        // into one usable line of text.
-        final StringBuilder outputBuilder = new StringBuilder();
-
-        String delimiter = "\t";
-        appendIfNotNull(outputBuilder, priorityStr, delimiter);
-        appendIfNotNull(outputBuilder, tag, delimiter);
-        appendIfNotNull(outputBuilder, msg, delimiter);
-        appendIfNotNull(outputBuilder, exceptionStr, delimiter);
-
-        // In case this was originally called from an AsyncTask or some other off-UI thread,
-        // make sure the update occurs within the UI thread.
-        ((Activity) getContext()).runOnUiThread( (new Thread(new Runnable() {
-            @Override
-            public void run() {
-                // Display the text we just generated within the LogView.
-                appendToLog(outputBuilder.toString());
-            }
-        })));
-
-        if (mNext != null) {
-            mNext.println(priority, tag, msg, tr);
-        }
-    }
-
-    public LogNode getNext() {
-        return mNext;
-    }
-
-    public void setNext(LogNode node) {
-        mNext = node;
-    }
-
-    /** Takes a string and adds to it, with a separator, if the bit to be added isn't null. Since
-     * the logger takes so many arguments that might be null, this method helps cut out some of the
-     * agonizing tedium of writing the same 3 lines over and over.
-     * @param source StringBuilder containing the text to append to.
-     * @param addStr The String to append
-     * @param delimiter The String to separate the source and appended strings. A tab or comma,
-     *                  for instance.
-     * @return The fully concatenated String as a StringBuilder
-     */
-    private StringBuilder appendIfNotNull(StringBuilder source, String addStr, String delimiter) {
-        if (addStr != null) {
-            if (addStr.length() == 0) {
-                delimiter = "";
-            }
-
-            return source.append(addStr).append(delimiter);
-        }
-        return source;
-    }
-
-    // The next LogNode in the chain.
-    LogNode mNext;
-
-    /** Outputs the string as a new line of log data in the LogView. */
-    public void appendToLog(String s) {
-        append("\n" + s);
-    }
-
-
-}
diff --git a/common/src/java/com/example/android/common/media/MediaCodecWrapper.java b/common/src/java/com/example/android/common/media/MediaCodecWrapper.java
deleted file mode 100644
index a511221..0000000
--- a/common/src/java/com/example/android/common/media/MediaCodecWrapper.java
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * Copyright (C) 2013 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.common.media;
-
-import android.media.*;
-import android.os.Handler;
-import android.os.Looper;
-import android.view.Surface;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayDeque;
-import java.util.Queue;
-
-/**
- * Simplifies the MediaCodec interface by wrapping around the buffer processing operations.
- */
-public class MediaCodecWrapper {
-
-    // Handler to use for {@code OutputSampleListener} and {code OutputFormatChangedListener}
-    // callbacks
-    private Handler mHandler;
-
-
-    // Callback when media output format changes.
-    public interface OutputFormatChangedListener {
-        void outputFormatChanged(MediaCodecWrapper sender, MediaFormat newFormat);
-    }
-
-    private OutputFormatChangedListener mOutputFormatChangedListener = null;
-
-    /**
-     * Callback for decodes frames. Observers can register a listener for optional stream
-     * of decoded data
-     */
-    public interface OutputSampleListener {
-        void outputSample(MediaCodecWrapper sender, MediaCodec.BufferInfo info, ByteBuffer buffer);
-    }
-
-    /**
-     * The {@link MediaCodec} that is managed by this class.
-     */
-    private MediaCodec mDecoder;
-
-    // References to the internal buffers managed by the codec. The codec
-    // refers to these buffers by index, never by reference so it's up to us
-    // to keep track of which buffer is which.
-    private ByteBuffer[] mInputBuffers;
-    private ByteBuffer[] mOutputBuffers;
-
-    // Indices of the input buffers that are currently available for writing. We'll
-    // consume these in the order they were dequeued from the codec.
-    private Queue<Integer> mAvailableInputBuffers;
-
-    // Indices of the output buffers that currently hold valid data, in the order
-    // they were produced by the codec.
-    private Queue<Integer> mAvailableOutputBuffers;
-
-    // Information about each output buffer, by index. Each entry in this array
-    // is valid if and only if its index is currently contained in mAvailableOutputBuffers.
-    private MediaCodec.BufferInfo[] mOutputBufferInfo;
-
-    // An (optional) stream that will receive decoded data.
-    private OutputSampleListener mOutputSampleListener;
-
-    private MediaCodecWrapper(MediaCodec codec) {
-        mDecoder = codec;
-        codec.start();
-        mInputBuffers = codec.getInputBuffers();
-        mOutputBuffers = codec.getOutputBuffers();
-        mOutputBufferInfo = new MediaCodec.BufferInfo[mOutputBuffers.length];
-        mAvailableInputBuffers = new ArrayDeque<Integer>(mOutputBuffers.length);
-        mAvailableOutputBuffers = new ArrayDeque<Integer>(mInputBuffers.length);
-    }
-
-    /**
-     * Releases resources and ends the encoding/decoding session.
-     */
-    public void stopAndRelease() {
-        mDecoder.stop();
-        mDecoder.release();
-        mDecoder = null;
-        mHandler = null;
-    }
-
-    /**
-     * Getter for the registered {@link OutputFormatChangedListener}
-     */
-    public OutputFormatChangedListener getOutputFormatChangedListener() {
-        return mOutputFormatChangedListener;
-    }
-
-    /**
-     *
-     * @param outputFormatChangedListener the listener for callback.
-     * @param handler message handler for posting the callback.
-     */
-    public void setOutputFormatChangedListener(final OutputFormatChangedListener
-            outputFormatChangedListener, Handler handler) {
-        mOutputFormatChangedListener = outputFormatChangedListener;
-
-        // Making sure we don't block ourselves due to a bad implementation of the callback by
-        // using a handler provided by client.
-        Looper looper;
-        mHandler = handler;
-        if (outputFormatChangedListener != null && mHandler == null) {
-            if ((looper = Looper.myLooper()) != null) {
-                mHandler = new Handler();
-            } else {
-                throw new IllegalArgumentException(
-                        "Looper doesn't exist in the calling thread");
-            }
-        }
-    }
-
-    /**
-     * Constructs the {@link MediaCodecWrapper} wrapper object around the video codec.
-     * The codec is created using the encapsulated information in the
-     * {@link MediaFormat} object.
-     *
-     * @param trackFormat The format of the media object to be decoded.
-     * @param surface Surface to render the decoded frames.
-     * @return
-     */
-    public static MediaCodecWrapper fromVideoFormat(final MediaFormat trackFormat,
-            Surface surface) {
-        MediaCodecWrapper result = null;
-        MediaCodec videoCodec = null;
-
-        // BEGIN_INCLUDE(create_codec)
-        final String mimeType = trackFormat.getString(MediaFormat.KEY_MIME);
-
-        // Check to see if this is actually a video mime type. If it is, then create
-        // a codec that can decode this mime type.
-        if (mimeType.contains("video/")) {
-            videoCodec = MediaCodec.createDecoderByType(mimeType);
-            videoCodec.configure(trackFormat, surface, null,  0);
-
-        }
-
-        // If codec creation was successful, then create a wrapper object around the
-        // newly created codec.
-        if (videoCodec != null) {
-            result = new MediaCodecWrapper(videoCodec);
-        }
-        // END_INCLUDE(create_codec)
-
-        return result;
-    }
-
-
-    /**
-     * Write a media sample to the decoder.
-     *
-     * A "sample" here refers to a single atomic access unit in the media stream. The definition
-     * of "access unit" is dependent on the type of encoding used, but it typically refers to
-     * a single frame of video or a few seconds of audio. {@link android.media.MediaExtractor}
-     * extracts data from a stream one sample at a time.
-     *
-     * @param input A ByteBuffer containing the input data for one sample. The buffer must be set
-     * up for reading, with its position set to the beginning of the sample data and its limit
-     * set to the end of the sample data.
-     *
-     * @param presentationTimeUs  The time, relative to the beginning of the media stream,
-     * at which this buffer should be rendered.
-     *
-     * @param flags Flags to pass to the decoder. See {@link MediaCodec#queueInputBuffer(int,
-     * int, int, long, int)}
-     *
-     * @throws MediaCodec.CryptoException
-     */
-    public boolean writeSample(final ByteBuffer input,
-            final MediaCodec.CryptoInfo crypto,
-            final long presentationTimeUs,
-            final int flags) throws MediaCodec.CryptoException, WriteException {
-        boolean result = false;
-        int size = input.remaining();
-
-        // check if we have dequed input buffers available from the codec
-        if (size > 0 &&  !mAvailableInputBuffers.isEmpty()) {
-            int index = mAvailableInputBuffers.remove();
-            ByteBuffer buffer = mInputBuffers[index];
-
-            // we can't write our sample to a lesser capacity input buffer.
-            if (size > buffer.capacity()) {
-                throw new MediaCodecWrapper.WriteException(String.format(
-                        "Insufficient capacity in MediaCodec buffer: "
-                            + "tried to write %d, buffer capacity is %d.",
-                        input.remaining(),
-                        buffer.capacity()));
-            }
-
-            buffer.clear();
-            buffer.put(input);
-
-            // Submit the buffer to the codec for decoding. The presentationTimeUs
-            // indicates the position (play time) for the current sample.
-            if (crypto == null) {
-                mDecoder.queueInputBuffer(index, 0, size, presentationTimeUs, flags);
-            } else {
-                mDecoder.queueSecureInputBuffer(index, 0, crypto, presentationTimeUs, flags);
-            }
-            result = true;
-        }
-        return result;
-    }
-
-    static MediaCodec.CryptoInfo cryptoInfo= new MediaCodec.CryptoInfo();
-
-    /**
-     * Write a media sample to the decoder.
-     *
-     * A "sample" here refers to a single atomic access unit in the media stream. The definition
-     * of "access unit" is dependent on the type of encoding used, but it typically refers to
-     * a single frame of video or a few seconds of audio. {@link android.media.MediaExtractor}
-     * extracts data from a stream one sample at a time.
-     *
-     * @param extractor  Instance of {@link android.media.MediaExtractor} wrapping the media.
-     *
-     * @param presentationTimeUs The time, relative to the beginning of the media stream,
-     * at which this buffer should be rendered.
-     *
-     * @param flags  Flags to pass to the decoder. See {@link MediaCodec#queueInputBuffer(int,
-     * int, int, long, int)}
-     *
-     * @throws MediaCodec.CryptoException
-     */
-    public boolean writeSample(final MediaExtractor extractor,
-            final boolean isSecure,
-            final long presentationTimeUs,
-            int flags) {
-        boolean result = false;
-        boolean isEos = false;
-
-        if (!mAvailableInputBuffers.isEmpty()) {
-            int index = mAvailableInputBuffers.remove();
-            ByteBuffer buffer = mInputBuffers[index];
-
-            // reads the sample from the file using extractor into the buffer
-            int size = extractor.readSampleData(buffer, 0);
-            if (size <= 0) {
-                flags |= MediaCodec.BUFFER_FLAG_END_OF_STREAM;
-            }
-
-            // Submit the buffer to the codec for decoding. The presentationTimeUs
-            // indicates the position (play time) for the current sample.
-            if (!isSecure) {
-                mDecoder.queueInputBuffer(index, 0, size, presentationTimeUs, flags);
-            } else {
-                extractor.getSampleCryptoInfo(cryptoInfo);
-                mDecoder.queueSecureInputBuffer(index, 0, cryptoInfo, presentationTimeUs, flags);
-            }
-
-            result = true;
-        }
-        return result;
-    }
-
-    /**
-     * Performs a peek() operation in the queue to extract media info for the buffer ready to be
-     * released i.e. the head element of the queue.
-     *
-     * @param out_bufferInfo An output var to hold the buffer info.
-     *
-     * @return True, if the peek was successful.
-     */
-    public boolean peekSample(MediaCodec.BufferInfo out_bufferInfo) {
-        // dequeue available buffers and synchronize our data structures with the codec.
-        update();
-        boolean result = false;
-        if (!mAvailableOutputBuffers.isEmpty()) {
-            int index = mAvailableOutputBuffers.peek();
-            MediaCodec.BufferInfo info = mOutputBufferInfo[index];
-            // metadata of the sample
-            out_bufferInfo.set(
-                    info.offset,
-                    info.size,
-                    info.presentationTimeUs,
-                    info.flags);
-            result = true;
-        }
-        return result;
-    }
-
-    /**
-     * Processes, releases and optionally renders the output buffer available at the head of the
-     * queue. All observers are notified with a callback. See {@link
-     * OutputSampleListener#outputSample(MediaCodecWrapper, android.media.MediaCodec.BufferInfo,
-     * java.nio.ByteBuffer)}
-     *
-     * @param render True, if the buffer is to be rendered on the {@link Surface} configured
-     *
-     */
-    public void popSample(boolean render) {
-        // dequeue available buffers and synchronize our data structures with the codec.
-        update();
-        if (!mAvailableOutputBuffers.isEmpty()) {
-            int index = mAvailableOutputBuffers.remove();
-
-            if (render && mOutputSampleListener != null) {
-                ByteBuffer buffer = mOutputBuffers[index];
-                MediaCodec.BufferInfo info = mOutputBufferInfo[index];
-                mOutputSampleListener.outputSample(this, info, buffer);
-            }
-
-            // releases the buffer back to the codec
-            mDecoder.releaseOutputBuffer(index, render);
-        }
-    }
-
-    /**
-     * Synchronize this object's state with the internal state of the wrapped
-     * MediaCodec.
-     */
-    private void update() {
-        // BEGIN_INCLUDE(update_codec_state)
-        int index;
-
-        // Get valid input buffers from the codec to fill later in the same order they were
-        // made available by the codec.
-        while ((index = mDecoder.dequeueInputBuffer(0)) != MediaCodec.INFO_TRY_AGAIN_LATER) {
-            mAvailableInputBuffers.add(index);
-        }
-
-
-        // Likewise with output buffers. If the output buffers have changed, start using the
-        // new set of output buffers. If the output format has changed, notify listeners.
-        MediaCodec.BufferInfo info = new MediaCodec.BufferInfo();
-        while ((index = mDecoder.dequeueOutputBuffer(info, 0)) !=  MediaCodec.INFO_TRY_AGAIN_LATER) {
-            switch (index) {
-                case MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED:
-                    mOutputBuffers = mDecoder.getOutputBuffers();
-                    mOutputBufferInfo = new MediaCodec.BufferInfo[mOutputBuffers.length];
-                    mAvailableOutputBuffers.clear();
-                    break;
-                case MediaCodec.INFO_OUTPUT_FORMAT_CHANGED:
-                    if (mOutputFormatChangedListener != null) {
-                        mHandler.post(new Runnable() {
-                            @Override
-                            public void run() {
-                                mOutputFormatChangedListener
-                                        .outputFormatChanged(MediaCodecWrapper.this,
-                                                mDecoder.getOutputFormat());
-
-                            }
-                        });
-                    }
-                    break;
-                default:
-                    // Making sure the index is valid before adding to output buffers. We've already
-                    // handled INFO_TRY_AGAIN_LATER, INFO_OUTPUT_FORMAT_CHANGED &
-                    // INFO_OUTPUT_BUFFERS_CHANGED i.e all the other possible return codes but
-                    // asserting index value anyways for future-proofing the code.
-                    if(index >= 0) {
-                        mOutputBufferInfo[index] = info;
-                        mAvailableOutputBuffers.add(index);
-                    } else {
-                        throw new IllegalStateException("Unknown status from dequeueOutputBuffer");
-                    }
-                    break;
-            }
-
-        }
-        // END_INCLUDE(update_codec_state)
-
-    }
-
-    private class WriteException extends Throwable {
-        private WriteException(final String detailMessage) {
-            super(detailMessage);
-        }
-    }
-}
diff --git a/common/src/java/com/example/android/common/play/GoogleServicesConnectionFailedHelper.java b/common/src/java/com/example/android/common/play/GoogleServicesConnectionFailedHelper.java
deleted file mode 100644
index 0a80d88..0000000
--- a/common/src/java/com/example/android/common/play/GoogleServicesConnectionFailedHelper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Copyright 2013 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.common.play;
-
-import android.app.Dialog;
-import android.content.IntentSender;
-import android.support.v4.app.FragmentActivity;
-
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GooglePlayServicesClient;
-
-/**
- * Helper to handle errors from Google Play Services connections.
- *
- */
-public class GoogleServicesConnectionFailedHelper implements
-        GooglePlayServicesClient.OnConnectionFailedListener {
-
-    FragmentActivity mActivity;
-    int mRequestCode = -1;
-
-    public GoogleServicesConnectionFailedHelper(FragmentActivity mActivity, int requestCode) {
-        this.mActivity = mActivity;
-        mRequestCode = requestCode;
-    }
-
-    @Override
-    public void onConnectionFailed(ConnectionResult connectionResult) {
-
-        /*
-         * Google Play services can resolve some errors it detects.
-         * If the error has a resolution, try sending an Intent to
-         * start a Google Play services activity that can resolve
-         * error.
-         */
-        if (connectionResult.hasResolution()) {
-            try {
-                // Start an Activity that tries to resolve the error
-                connectionResult.startResolutionForResult(mActivity, mRequestCode);
-                /*
-                 * Thrown if Google Play services canceled the original
-                 * PendingIntent
-                 */
-            } catch (IntentSender.SendIntentException e) {
-                // Log the error
-                e.printStackTrace();
-            }
-        } else {
-            /*
-             * If no resolution is available, display a dialog to the
-             * user with the error.
-             */
-            PlayHelper.ErrorDialogFragment fragment = new PlayHelper.ErrorDialogFragment();
-            fragment.setDialog(new Dialog(mActivity));
-            fragment.show(mActivity.getSupportFragmentManager(), null);
-
-        }
-    }
-}
-
diff --git a/common/src/java/com/example/android/common/play/PlayHelper.java b/common/src/java/com/example/android/common/play/PlayHelper.java
deleted file mode 100644
index 95b8554..0000000
--- a/common/src/java/com/example/android/common/play/PlayHelper.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright 2013 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.common.play;
-
-import android.app.Activity;
-import android.app.Dialog;
-import android.os.Bundle;
-import android.support.v4.app.DialogFragment;
-import android.support.v4.app.FragmentActivity;
-
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GooglePlayServicesUtil;
-
-/**
- * Helper class for Google Play Services functions.
- * <ul>
- *     <li>
- *         Checks availability
- *     </li>
- *     <li>
- *         Validates version for version bound features
- *     </li>
- * </ul>
- */
-public class PlayHelper {
-
-    /**
-     * Checks for Google Play Services installation on the device. If found, validates the
-     * installed version against the requested version. If the service is installed but
-     * can't be used, the utility initiates a recovery with user intervention.
-     *
-     * @param context The context to be associated with the request. For compatibility with 1.6+,
-     *                subclass {@link FragmentActivity}.
-     * @param requestCode If we need to download Google Play Services, the download activity will be
-     *                    started using {@link Activity#startActivityForResult(Intent, int)}
-     * @param versionCode The minimum required version of the library.
-     * @return True, if successful.
-     */
-    public static boolean checkGooglePlayServiceAvailability(
-            FragmentActivity context, int requestCode, int versionCode) {
-
-        // Query for the status of Google Play services on the device
-        int statusCode = GooglePlayServicesUtil
-                .isGooglePlayServicesAvailable(context);
-
-        if ((statusCode == ConnectionResult.SUCCESS )
-                &&  (GooglePlayServicesUtil.GOOGLE_PLAY_SERVICES_VERSION_CODE >=  versionCode)) {
-            return true;
-        } else {
-            if (GooglePlayServicesUtil.isUserRecoverableError(statusCode)) {
-                Dialog eDialog = GooglePlayServicesUtil.getErrorDialog(statusCode,
-                        context, requestCode);
-                // If Google Play services can provide an error dialog
-                if (eDialog != null) {
-                    // Create a new DialogFragment for the error dialog
-                    ErrorDialogFragment errorFragment =
-                            new ErrorDialogFragment();
-                    // Set the dialog in the DialogFragment
-                    errorFragment.setDialog(eDialog);
-                    // Show the error dialog in the DialogFragment
-                    errorFragment.show(
-                            context.getSupportFragmentManager(),
-                            "Activity Recognition");
-                }
-            } else {
-                return false;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Checks for Google Play Services installation on the device. If the service is installed but
-     * can't be used, the utility initiates a recovery with user intervention.
-     *
-     * @param context The context to be associated with the request. For compatibility with 1.6+,
-     *                subclass {@link FragmentActivity}.
-     * @return True, if successful.
-     */
-    public static boolean checkGooglePlayServiceAvailability(FragmentActivity context,
-            int requestCode) {
-        return checkGooglePlayServiceAvailability(context, requestCode, -1);
-    }
-
-    // Define a DialogFragment that displays the error dialog
-    public static class ErrorDialogFragment extends DialogFragment {
-        // Global field to contain the error dialog
-        private Dialog mDialog;
-        // Default constructor. Sets the dialog field to null
-        public ErrorDialogFragment() {
-            super();
-            mDialog = null;
-        }
-        // Set the dialog to display
-        public void setDialog(Dialog dialog) {
-            mDialog = dialog;
-        }
-        // Return a Dialog to the DialogFragment.
-        @Override
-        public Dialog onCreateDialog(Bundle savedInstanceState) {
-            return mDialog;
-        }
-    }
-
-}
diff --git a/common/src/java/com/example/android/common/util/Pools.java b/common/src/java/com/example/android/common/util/Pools.java
deleted file mode 100644
index 1b7edb0..0000000
--- a/common/src/java/com/example/android/common/util/Pools.java
+++ /dev/null
@@ -1,237 +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.example.android.common.util;
-
-/**
- * Helper class for creating pools of objects. Creating new objects is an
- * expensive operation, which can lead to significant performance overhead if
- * new objects of the same type are allocated and destroyed during run time.
- * These performance issues can be mitigated by reusing unused objects and
- * reinitializing them, rather than destroying and removing them from memory.
- * <p>
- * The object pool pattern provided by the {@link Pool} interface facilitates
- * the reuse of objects by keeping unused ('released') objects in memory and
- * making them available for use. This can provide a significant performance
- * improvement, as objects are only created once and returned to the Pool when
- * no longer required, rather than destroyed and reallocated. Object
- * {@link Pools} keep track of these unused objects. An object pool provides two
- * basic methods for access:
- * <ul>
- * <li><b>{@link Pool#acquire()}:</b> Returns an used object if one is
- * available.</li>
- * <li><b> {@link Pool#release(Object)}:</b> Adds the given object to the pool,
- * ready to be reallocated in acquire().</li>
- * </ul>
- * <p>
- * This class contains the interface defining a {@link Pool}, an implementation
- * based on a fixed length array ({@link SimplePool}) and a synchronized pool
- * for use with concurrency ({@link SynchronizedPool}).
- * <p>
- * A {@link SimplePool} can be used like this:
- *
- * <pre>
- * public class MyPooledClass {
- *
- *     private static final SynchronizedPool<MyPooledClass> sPool =
- *             new SynchronizedPool<MyPooledClass>(10);
- *
- *     public static MyPooledClass obtain() {
- *         MyPooledClass instance = sPool.acquire();
- *         return (instance != null) ? instance : new MyPooledClass();
- *     }
- *
- *     public void recycle() {
- *          // Clear state if needed.
- *          sPool.release(this);
- *     }
- *
- *     . . .
- * }
- * </pre>
- */
-public final class Pools {
-
-    /**
-     * Interface for managing a pool of objects.
-     *
-     * @param T The pooled type.
-     */
-    public static interface Pool<T> {
-
-        /**
-         * Retrieves an object from the pool. Returns null if the pool is empty
-         * and no object is available.
-         *
-         * @return An instance from the pool if available, null otherwise.
-         */
-        public T acquire();
-
-        /**
-         * Releases an instance to the pool. This marks the object as reusable
-         * and makes it available through a call to {@link #acquire()}. An
-         * object should not be modified or accessed once it has been released.
-         *
-         * @param instance The instance to release.
-         * @return True if the instance was put in the pool.
-         * @throws IllegalStateException If the instance is already in the pool.
-         */
-        public boolean release(T instance);
-    }
-
-    private Pools() {
-        /* do nothing - hiding constructor */
-    }
-
-    /**
-     * Simple (non-synchronized) pool of objects. This class provides a simple,
-     * fixed sized pool of objects.
-     *
-     * @param T The pooled type.
-     */
-    public static class SimplePool<T> implements Pool<T> {
-        private final Object[] mPool;
-
-        private int mPoolSize;
-
-        /**
-         * Creates a new instance. The parameter defines the maximum number of
-         * objects that can be held in this pool.
-         *
-         * @param maxPoolSize The max pool size.
-         * @throws IllegalArgumentException If the max pool size is less than
-         *             zero.
-         */
-        public SimplePool(int maxPoolSize) {
-            if (maxPoolSize <= 0) {
-                throw new IllegalArgumentException("The max pool size must be > 0");
-            }
-            mPool = new Object[maxPoolSize];
-        }
-
-        /**
-         * Returns an object from the pool or null if the pool is empty.
-         *
-         * @return An object from the pool or null if no object is available.
-         */
-        @Override
-        @SuppressWarnings("unchecked")
-        public T acquire() {
-            if (mPoolSize > 0) {
-                final int lastPooledIndex = mPoolSize - 1;
-                T instance = (T) mPool[lastPooledIndex];
-                mPool[lastPooledIndex] = null;
-                mPoolSize--;
-                return instance;
-            }
-            return null;
-        }
-
-        /**
-         * Adds an object to the pool. If the pool is already full (its
-         * allocated size has been exceeded), the object is not added and false
-         * is returned. A linear check is performed to ensure that the object is
-         * not already held in the pool.
-         *
-         * @param instance The element to release.
-         * @return True if the object was added to the pool.
-         * @throws IllegalStateException If the object already exists in the
-         *             pool.
-         */
-        @Override
-        public boolean release(T instance) {
-            if (isInPool(instance)) {
-                throw new IllegalStateException("Already in the pool!");
-            }
-            if (mPoolSize < mPool.length) {
-                mPool[mPoolSize] = instance;
-                mPoolSize++;
-                return true;
-            }
-            return false;
-        }
-
-        /**
-         * Checks if the object already exists in the pool.
-         * @param instance The element to look for.
-         * @return True if the object exists in the pool.
-         */
-        private boolean isInPool(T instance) {
-            for (int i = 0; i < mPoolSize; i++) {
-                if (mPool[i] == instance) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
-    /**
-     * Synchronized pool of objects. Based on the implementation of a fixed size
-     * pool in {@link SimplePool}, this class provides synchronized concurrent
-     * access to the pool.
-     *
-     * @param T The pooled type.
-     */
-    public static class SynchronizedPool<T> extends SimplePool<T> {
-        private final Object mLock = new Object();
-
-        /**
-         * Creates a new instance.
-         *
-         * @param maxPoolSize The max pool size.
-         * @throws IllegalArgumentException If the max pool size is less than
-         *             zero.
-         */
-        public SynchronizedPool(int maxPoolSize) {
-            super(maxPoolSize);
-        }
-
-        /**
-         * Returns an object from the pool or null if the pool is empty.
-         * <p>
-         * Access to the pool is synchronized.
-         *
-         * @return An object from the pool or null if no object is available.
-         */
-        @Override
-        public T acquire() {
-            synchronized (mLock) {
-                return super.acquire();
-            }
-        }
-
-        /**
-         * Adds an object to the pool. If the pool is already full (its
-         * allocated size has been exceeded), the object is not added and false
-         * is returned. A linear check is performed to ensure that the object is
-         * not already held in the pool.
-         * <p>
-         * Access to the pool is synchronized.
-         *
-         * @param element The element to be released
-         * @return True if the object was added to the pool.
-         * @throws IllegalStateException If the object already exists in the
-         *             pool.
-         */
-        @Override
-        public boolean release(T element) {
-            synchronized (mLock) {
-                return super.release(element);
-            }
-        }
-    }
-}
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/build.gradle b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/build.gradle
new file mode 100644
index 0000000..945e1f5
--- /dev/null
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/build.gradle
@@ -0,0 +1,6 @@
+apply plugin: 'android'
+
+android {
+    compileSdkVersion 18
+    buildToolsVersion "18.0.0"
+}
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/AndroidManifest.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..019d258
--- /dev/null
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/AndroidManifest.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2013 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.bluetooth.le"
+          android:versionCode="1"
+          android:versionName="1.0">
+    <uses-sdk android:minSdkVersion="18"
+              android:targetSdkVersion="18"/>
+    <!-- Declare this required feature if you want to make the app available to BLE-capable
+    devices only.  If you want to make your app available to devices that don't support BLE,
+    you should omit this in the manifest.  Instead, determine BLE capability by using
+    PackageManager.hasSystemFeature(FEATURE_BLUETOOTH_LE) -->
+    <uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
+
+    <uses-permission android:name="android.permission.BLUETOOTH"/>
+    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
+
+    <application android:label="@string/app_name"
+                 android:icon="@drawable/ic_launcher"
+                 android:theme="@android:style/Theme.Holo.Light">
+        <activity android:name=".DeviceScanActivity"
+                  android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+        </activity>
+        <activity android:name=".DeviceControlActivity"/>
+        <service android:name=".BluetoothLeService" android:enabled="true"/>
+    </application>
+</manifest>
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/BluetoothLeService.java b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/BluetoothLeService.java
new file mode 100644
index 0000000..9e7aabd
--- /dev/null
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/BluetoothLeService.java
@@ -0,0 +1,319 @@
+/*
+ * Copyright (C) 2013 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.bluetooth.le;
+
+import android.app.Service;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothGatt;
+import android.bluetooth.BluetoothGattCallback;
+import android.bluetooth.BluetoothGattCharacteristic;
+import android.bluetooth.BluetoothGattDescriptor;
+import android.bluetooth.BluetoothGattService;
+import android.bluetooth.BluetoothManager;
+import android.bluetooth.BluetoothProfile;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Binder;
+import android.os.IBinder;
+import android.util.Log;
+
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * Service for managing connection and data communication with a GATT server hosted on a
+ * given Bluetooth LE device.
+ */
+public class BluetoothLeService extends Service {
+    private final static String TAG = BluetoothLeService.class.getSimpleName();
+
+    private BluetoothManager mBluetoothManager;
+    private BluetoothAdapter mBluetoothAdapter;
+    private String mBluetoothDeviceAddress;
+    private BluetoothGatt mBluetoothGatt;
+    private int mConnectionState = STATE_DISCONNECTED;
+
+    private static final int STATE_DISCONNECTED = 0;
+    private static final int STATE_CONNECTING = 1;
+    private static final int STATE_CONNECTED = 2;
+
+    public final static String ACTION_GATT_CONNECTED =
+            "com.example.bluetooth.le.ACTION_GATT_CONNECTED";
+    public final static String ACTION_GATT_DISCONNECTED =
+            "com.example.bluetooth.le.ACTION_GATT_DISCONNECTED";
+    public final static String ACTION_GATT_SERVICES_DISCOVERED =
+            "com.example.bluetooth.le.ACTION_GATT_SERVICES_DISCOVERED";
+    public final static String ACTION_DATA_AVAILABLE =
+            "com.example.bluetooth.le.ACTION_DATA_AVAILABLE";
+    public final static String EXTRA_DATA =
+            "com.example.bluetooth.le.EXTRA_DATA";
+
+    public final static UUID UUID_HEART_RATE_MEASUREMENT =
+            UUID.fromString(SampleGattAttributes.HEART_RATE_MEASUREMENT);
+
+    // Implements callback methods for GATT events that the app cares about.  For example,
+    // connection change and services discovered.
+    private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
+        @Override
+        public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
+            String intentAction;
+            if (newState == BluetoothProfile.STATE_CONNECTED) {
+                intentAction = ACTION_GATT_CONNECTED;
+                mConnectionState = STATE_CONNECTED;
+                broadcastUpdate(intentAction);
+                Log.i(TAG, "Connected to GATT server.");
+                // Attempts to discover services after successful connection.
+                Log.i(TAG, "Attempting to start service discovery:" +
+                        mBluetoothGatt.discoverServices());
+
+            } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
+                intentAction = ACTION_GATT_DISCONNECTED;
+                mConnectionState = STATE_DISCONNECTED;
+                Log.i(TAG, "Disconnected from GATT server.");
+                broadcastUpdate(intentAction);
+            }
+        }
+
+        @Override
+        public void onServicesDiscovered(BluetoothGatt gatt, int status) {
+            if (status == BluetoothGatt.GATT_SUCCESS) {
+                broadcastUpdate(ACTION_GATT_SERVICES_DISCOVERED);
+            } else {
+                Log.w(TAG, "onServicesDiscovered received: " + status);
+            }
+        }
+
+        @Override
+        public void onCharacteristicRead(BluetoothGatt gatt,
+                                         BluetoothGattCharacteristic characteristic,
+                                         int status) {
+            if (status == BluetoothGatt.GATT_SUCCESS) {
+                broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);
+            }
+        }
+
+        @Override
+        public void onCharacteristicChanged(BluetoothGatt gatt,
+                                            BluetoothGattCharacteristic characteristic) {
+            broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);
+        }
+    };
+
+    private void broadcastUpdate(final String action) {
+        final Intent intent = new Intent(action);
+        sendBroadcast(intent);
+    }
+
+    private void broadcastUpdate(final String action,
+                                 final BluetoothGattCharacteristic characteristic) {
+        final Intent intent = new Intent(action);
+
+        // This is special handling for the Heart Rate Measurement profile.  Data parsing is
+        // carried out as per profile specifications:
+        // http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml
+        if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) {
+            int flag = characteristic.getProperties();
+            int format = -1;
+            if ((flag & 0x01) != 0) {
+                format = BluetoothGattCharacteristic.FORMAT_UINT16;
+                Log.d(TAG, "Heart rate format UINT16.");
+            } else {
+                format = BluetoothGattCharacteristic.FORMAT_UINT8;
+                Log.d(TAG, "Heart rate format UINT8.");
+            }
+            final int heartRate = characteristic.getIntValue(format, 1);
+            Log.d(TAG, String.format("Received heart rate: %d", heartRate));
+            intent.putExtra(EXTRA_DATA, String.valueOf(heartRate));
+        } else {
+            // For all other profiles, writes the data formatted in HEX.
+            final byte[] data = characteristic.getValue();
+            if (data != null && data.length > 0) {
+                final StringBuilder stringBuilder = new StringBuilder(data.length);
+                for(byte byteChar : data)
+                    stringBuilder.append(String.format("%02X ", byteChar));
+                intent.putExtra(EXTRA_DATA, new String(data) + "\n" + stringBuilder.toString());
+            }
+        }
+        sendBroadcast(intent);
+    }
+
+    public class LocalBinder extends Binder {
+        BluetoothLeService getService() {
+            return BluetoothLeService.this;
+        }
+    }
+
+    @Override
+    public IBinder onBind(Intent intent) {
+        return mBinder;
+    }
+
+    @Override
+    public boolean onUnbind(Intent intent) {
+        // After using a given device, you should make sure that BluetoothGatt.close() is called
+        // such that resources are cleaned up properly.  In this particular example, close() is
+        // invoked when the UI is disconnected from the Service.
+        close();
+        return super.onUnbind(intent);
+    }
+
+    private final IBinder mBinder = new LocalBinder();
+
+    /**
+     * Initializes a reference to the local Bluetooth adapter.
+     *
+     * @return Return true if the initialization is successful.
+     */
+    public boolean initialize() {
+        // For API level 18 and above, get a reference to BluetoothAdapter through
+        // BluetoothManager.
+        if (mBluetoothManager == null) {
+            mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
+            if (mBluetoothManager == null) {
+                Log.e(TAG, "Unable to initialize BluetoothManager.");
+                return false;
+            }
+        }
+
+        mBluetoothAdapter = mBluetoothManager.getAdapter();
+        if (mBluetoothAdapter == null) {
+            Log.e(TAG, "Unable to obtain a BluetoothAdapter.");
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Connects to the GATT server hosted on the Bluetooth LE device.
+     *
+     * @param address The device address of the destination device.
+     *
+     * @return Return true if the connection is initiated successfully. The connection result
+     *         is reported asynchronously through the
+     *         {@code BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)}
+     *         callback.
+     */
+    public boolean connect(final String address) {
+        if (mBluetoothAdapter == null || address == null) {
+            Log.w(TAG, "BluetoothAdapter not initialized or unspecified address.");
+            return false;
+        }
+
+        // Previously connected device.  Try to reconnect.
+        if (mBluetoothDeviceAddress != null && address.equals(mBluetoothDeviceAddress)
+                && mBluetoothGatt != null) {
+            Log.d(TAG, "Trying to use an existing mBluetoothGatt for connection.");
+            if (mBluetoothGatt.connect()) {
+                mConnectionState = STATE_CONNECTING;
+                return true;
+            } else {
+                return false;
+            }
+        }
+
+        final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address);
+        if (device == null) {
+            Log.w(TAG, "Device not found.  Unable to connect.");
+            return false;
+        }
+        // We want to directly connect to the device, so we are setting the autoConnect
+        // parameter to false.
+        mBluetoothGatt = device.connectGatt(this, false, mGattCallback);
+        Log.d(TAG, "Trying to create a new connection.");
+        mBluetoothDeviceAddress = address;
+        mConnectionState = STATE_CONNECTING;
+        return true;
+    }
+
+    /**
+     * Disconnects an existing connection or cancel a pending connection. The disconnection result
+     * is reported asynchronously through the
+     * {@code BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)}
+     * callback.
+     */
+    public void disconnect() {
+        if (mBluetoothAdapter == null || mBluetoothGatt == null) {
+            Log.w(TAG, "BluetoothAdapter not initialized");
+            return;
+        }
+        mBluetoothGatt.disconnect();
+    }
+
+    /**
+     * After using a given BLE device, the app must call this method to ensure resources are
+     * released properly.
+     */
+    public void close() {
+        if (mBluetoothGatt == null) {
+            return;
+        }
+        mBluetoothGatt.close();
+        mBluetoothGatt = null;
+    }
+
+    /**
+     * Request a read on a given {@code BluetoothGattCharacteristic}. The read result is reported
+     * asynchronously through the {@code BluetoothGattCallback#onCharacteristicRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int)}
+     * callback.
+     *
+     * @param characteristic The characteristic to read from.
+     */
+    public void readCharacteristic(BluetoothGattCharacteristic characteristic) {
+        if (mBluetoothAdapter == null || mBluetoothGatt == null) {
+            Log.w(TAG, "BluetoothAdapter not initialized");
+            return;
+        }
+        mBluetoothGatt.readCharacteristic(characteristic);
+    }
+
+    /**
+     * Enables or disables notification on a give characteristic.
+     *
+     * @param characteristic Characteristic to act on.
+     * @param enabled If true, enable notification.  False otherwise.
+     */
+    public void setCharacteristicNotification(BluetoothGattCharacteristic characteristic,
+                                              boolean enabled) {
+        if (mBluetoothAdapter == null || mBluetoothGatt == null) {
+            Log.w(TAG, "BluetoothAdapter not initialized");
+            return;
+        }
+        mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);
+
+        // This is specific to Heart Rate Measurement.
+        if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) {
+            BluetoothGattDescriptor descriptor = characteristic.getDescriptor(
+                    UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
+            descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
+            mBluetoothGatt.writeDescriptor(descriptor);
+        }
+    }
+
+    /**
+     * Retrieves a list of supported GATT services on the connected device. This should be
+     * invoked only after {@code BluetoothGatt#discoverServices()} completes successfully.
+     *
+     * @return A {@code List} of supported services.
+     */
+    public List<BluetoothGattService> getSupportedGattServices() {
+        if (mBluetoothGatt == null) return null;
+
+        return mBluetoothGatt.getServices();
+    }
+}
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/DeviceControlActivity.java b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/DeviceControlActivity.java
new file mode 100644
index 0000000..06b3bb4
--- /dev/null
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/DeviceControlActivity.java
@@ -0,0 +1,309 @@
+/*
+ * Copyright (C) 2013 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.bluetooth.le;
+
+import android.app.Activity;
+import android.bluetooth.BluetoothGattCharacteristic;
+import android.bluetooth.BluetoothGattService;
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ExpandableListView;
+import android.widget.SimpleExpandableListAdapter;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * For a given BLE device, this Activity provides the user interface to connect, display data,
+ * and display GATT services and characteristics supported by the device.  The Activity
+ * communicates with {@code BluetoothLeService}, which in turn interacts with the
+ * Bluetooth LE API.
+ */
+public class DeviceControlActivity extends Activity {
+    private final static String TAG = DeviceControlActivity.class.getSimpleName();
+
+    public static final String EXTRAS_DEVICE_NAME = "DEVICE_NAME";
+    public static final String EXTRAS_DEVICE_ADDRESS = "DEVICE_ADDRESS";
+
+    private TextView mConnectionState;
+    private TextView mDataField;
+    private String mDeviceName;
+    private String mDeviceAddress;
+    private ExpandableListView mGattServicesList;
+    private BluetoothLeService mBluetoothLeService;
+    private ArrayList<ArrayList<BluetoothGattCharacteristic>> mGattCharacteristics =
+            new ArrayList<ArrayList<BluetoothGattCharacteristic>>();
+    private boolean mConnected = false;
+    private BluetoothGattCharacteristic mNotifyCharacteristic;
+
+    private final String LIST_NAME = "NAME";
+    private final String LIST_UUID = "UUID";
+
+    // Code to manage Service lifecycle.
+    private final ServiceConnection mServiceConnection = new ServiceConnection() {
+
+        @Override
+        public void onServiceConnected(ComponentName componentName, IBinder service) {
+            mBluetoothLeService = ((BluetoothLeService.LocalBinder) service).getService();
+            if (!mBluetoothLeService.initialize()) {
+                Log.e(TAG, "Unable to initialize Bluetooth");
+                finish();
+            }
+            // Automatically connects to the device upon successful start-up initialization.
+            mBluetoothLeService.connect(mDeviceAddress);
+        }
+
+        @Override
+        public void onServiceDisconnected(ComponentName componentName) {
+            mBluetoothLeService = null;
+        }
+    };
+
+    // Handles various events fired by the Service.
+    // ACTION_GATT_CONNECTED: connected to a GATT server.
+    // ACTION_GATT_DISCONNECTED: disconnected from a GATT server.
+    // ACTION_GATT_SERVICES_DISCOVERED: discovered GATT services.
+    // ACTION_DATA_AVAILABLE: received data from the device.  This can be a result of read
+    //                        or notification operations.
+    private final BroadcastReceiver mGattUpdateReceiver = new BroadcastReceiver() {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            final String action = intent.getAction();
+            if (BluetoothLeService.ACTION_GATT_CONNECTED.equals(action)) {
+                mConnected = true;
+                updateConnectionState(R.string.connected);
+                invalidateOptionsMenu();
+            } else if (BluetoothLeService.ACTION_GATT_DISCONNECTED.equals(action)) {
+                mConnected = false;
+                updateConnectionState(R.string.disconnected);
+                invalidateOptionsMenu();
+                clearUI();
+            } else if (BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED.equals(action)) {
+                // Show all the supported services and characteristics on the user interface.
+                displayGattServices(mBluetoothLeService.getSupportedGattServices());
+            } else if (BluetoothLeService.ACTION_DATA_AVAILABLE.equals(action)) {
+                displayData(intent.getStringExtra(BluetoothLeService.EXTRA_DATA));
+            }
+        }
+    };
+
+    // If a given GATT characteristic is selected, check for supported features.  This sample
+    // demonstrates 'Read' and 'Notify' features.  See
+    // http://d.android.com/reference/android/bluetooth/BluetoothGatt.html for the complete
+    // list of supported characteristic features.
+    private final ExpandableListView.OnChildClickListener servicesListClickListner =
+            new ExpandableListView.OnChildClickListener() {
+                @Override
+                public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
+                                            int childPosition, long id) {
+                    if (mGattCharacteristics != null) {
+                        final BluetoothGattCharacteristic characteristic =
+                                mGattCharacteristics.get(groupPosition).get(childPosition);
+                        final int charaProp = characteristic.getProperties();
+                        if ((charaProp | BluetoothGattCharacteristic.PROPERTY_READ) > 0) {
+                            // If there is an active notification on a characteristic, clear
+                            // it first so it doesn't update the data field on the user interface.
+                            if (mNotifyCharacteristic != null) {
+                                mBluetoothLeService.setCharacteristicNotification(
+                                        mNotifyCharacteristic, false);
+                                mNotifyCharacteristic = null;
+                            }
+                            mBluetoothLeService.readCharacteristic(characteristic);
+                        }
+                        if ((charaProp | BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) {
+                            mNotifyCharacteristic = characteristic;
+                            mBluetoothLeService.setCharacteristicNotification(
+                                    characteristic, true);
+                        }
+                        return true;
+                    }
+                    return false;
+                }
+    };
+
+    private void clearUI() {
+        mGattServicesList.setAdapter((SimpleExpandableListAdapter) null);
+        mDataField.setText(R.string.no_data);
+    }
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.gatt_services_characteristics);
+
+        final Intent intent = getIntent();
+        mDeviceName = intent.getStringExtra(EXTRAS_DEVICE_NAME);
+        mDeviceAddress = intent.getStringExtra(EXTRAS_DEVICE_ADDRESS);
+
+        // Sets up UI references.
+        ((TextView) findViewById(R.id.device_address)).setText(mDeviceAddress);
+        mGattServicesList = (ExpandableListView) findViewById(R.id.gatt_services_list);
+        mGattServicesList.setOnChildClickListener(servicesListClickListner);
+        mConnectionState = (TextView) findViewById(R.id.connection_state);
+        mDataField = (TextView) findViewById(R.id.data_value);
+
+        getActionBar().setTitle(mDeviceName);
+        getActionBar().setDisplayHomeAsUpEnabled(true);
+        Intent gattServiceIntent = new Intent(this, BluetoothLeService.class);
+        bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        registerReceiver(mGattUpdateReceiver, makeGattUpdateIntentFilter());
+        if (mBluetoothLeService != null) {
+            final boolean result = mBluetoothLeService.connect(mDeviceAddress);
+            Log.d(TAG, "Connect request result=" + result);
+        }
+    }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+        unregisterReceiver(mGattUpdateReceiver);
+    }
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        unbindService(mServiceConnection);
+        mBluetoothLeService = null;
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        getMenuInflater().inflate(R.menu.gatt_services, menu);
+        if (mConnected) {
+            menu.findItem(R.id.menu_connect).setVisible(false);
+            menu.findItem(R.id.menu_disconnect).setVisible(true);
+        } else {
+            menu.findItem(R.id.menu_connect).setVisible(true);
+            menu.findItem(R.id.menu_disconnect).setVisible(false);
+        }
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch(item.getItemId()) {
+            case R.id.menu_connect:
+                mBluetoothLeService.connect(mDeviceAddress);
+                return true;
+            case R.id.menu_disconnect:
+                mBluetoothLeService.disconnect();
+                return true;
+            case android.R.id.home:
+                onBackPressed();
+                return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    private void updateConnectionState(final int resourceId) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mConnectionState.setText(resourceId);
+            }
+        });
+    }
+
+    private void displayData(String data) {
+        if (data != null) {
+            mDataField.setText(data);
+        }
+    }
+
+    // Demonstrates how to iterate through the supported GATT Services/Characteristics.
+    // In this sample, we populate the data structure that is bound to the ExpandableListView
+    // on the UI.
+    private void displayGattServices(List<BluetoothGattService> gattServices) {
+        if (gattServices == null) return;
+        String uuid = null;
+        String unknownServiceString = getResources().getString(R.string.unknown_service);
+        String unknownCharaString = getResources().getString(R.string.unknown_characteristic);
+        ArrayList<HashMap<String, String>> gattServiceData = new ArrayList<HashMap<String, String>>();
+        ArrayList<ArrayList<HashMap<String, String>>> gattCharacteristicData
+                = new ArrayList<ArrayList<HashMap<String, String>>>();
+        mGattCharacteristics = new ArrayList<ArrayList<BluetoothGattCharacteristic>>();
+
+        // Loops through available GATT Services.
+        for (BluetoothGattService gattService : gattServices) {
+            HashMap<String, String> currentServiceData = new HashMap<String, String>();
+            uuid = gattService.getUuid().toString();
+            currentServiceData.put(
+                    LIST_NAME, SampleGattAttributes.lookup(uuid, unknownServiceString));
+            currentServiceData.put(LIST_UUID, uuid);
+            gattServiceData.add(currentServiceData);
+
+            ArrayList<HashMap<String, String>> gattCharacteristicGroupData =
+                    new ArrayList<HashMap<String, String>>();
+            List<BluetoothGattCharacteristic> gattCharacteristics =
+                    gattService.getCharacteristics();
+            ArrayList<BluetoothGattCharacteristic> charas =
+                    new ArrayList<BluetoothGattCharacteristic>();
+
+            // Loops through available Characteristics.
+            for (BluetoothGattCharacteristic gattCharacteristic : gattCharacteristics) {
+                charas.add(gattCharacteristic);
+                HashMap<String, String> currentCharaData = new HashMap<String, String>();
+                uuid = gattCharacteristic.getUuid().toString();
+                currentCharaData.put(
+                        LIST_NAME, SampleGattAttributes.lookup(uuid, unknownCharaString));
+                currentCharaData.put(LIST_UUID, uuid);
+                gattCharacteristicGroupData.add(currentCharaData);
+            }
+            mGattCharacteristics.add(charas);
+            gattCharacteristicData.add(gattCharacteristicGroupData);
+        }
+
+        SimpleExpandableListAdapter gattServiceAdapter = new SimpleExpandableListAdapter(
+                this,
+                gattServiceData,
+                android.R.layout.simple_expandable_list_item_2,
+                new String[] {LIST_NAME, LIST_UUID},
+                new int[] { android.R.id.text1, android.R.id.text2 },
+                gattCharacteristicData,
+                android.R.layout.simple_expandable_list_item_2,
+                new String[] {LIST_NAME, LIST_UUID},
+                new int[] { android.R.id.text1, android.R.id.text2 }
+        );
+        mGattServicesList.setAdapter(gattServiceAdapter);
+    }
+
+    private static IntentFilter makeGattUpdateIntentFilter() {
+        final IntentFilter intentFilter = new IntentFilter();
+        intentFilter.addAction(BluetoothLeService.ACTION_GATT_CONNECTED);
+        intentFilter.addAction(BluetoothLeService.ACTION_GATT_DISCONNECTED);
+        intentFilter.addAction(BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED);
+        intentFilter.addAction(BluetoothLeService.ACTION_DATA_AVAILABLE);
+        return intentFilter;
+    }
+}
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/DeviceScanActivity.java b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/DeviceScanActivity.java
new file mode 100644
index 0000000..1cc954d
--- /dev/null
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/DeviceScanActivity.java
@@ -0,0 +1,269 @@
+/*
+ * Copyright (C) 2013 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.bluetooth.le;
+
+import android.app.Activity;
+import android.app.ListActivity;
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothManager;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.os.Handler;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import java.util.ArrayList;
+import java.util.UUID;
+
+/**
+ * Activity for scanning and displaying available Bluetooth LE devices.
+ */
+public class DeviceScanActivity extends ListActivity {
+    private LeDeviceListAdapter mLeDeviceListAdapter;
+    private BluetoothAdapter mBluetoothAdapter;
+    private boolean mScanning;
+    private Handler mHandler;
+
+    private static final int REQUEST_ENABLE_BT = 1;
+    // Stops scanning after 10 seconds.
+    private static final long SCAN_PERIOD = 10000;
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        getActionBar().setTitle(R.string.title_devices);
+        mHandler = new Handler();
+
+        // Use this check to determine whether BLE is supported on the device.  Then you can
+        // selectively disable BLE-related features.
+        if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
+            Toast.makeText(this, R.string.ble_not_supported, Toast.LENGTH_SHORT).show();
+            finish();
+        }
+
+        // Initializes a Bluetooth adapter.  For API level 18 and above, get a reference to
+        // BluetoothAdapter through BluetoothManager.
+        final BluetoothManager bluetoothManager =
+                (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
+        mBluetoothAdapter = bluetoothManager.getAdapter();
+
+        // Checks if Bluetooth is supported on the device.
+        if (mBluetoothAdapter == null) {
+            Toast.makeText(this, R.string.error_bluetooth_not_supported, Toast.LENGTH_SHORT).show();
+            finish();
+            return;
+        }
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        getMenuInflater().inflate(R.menu.main, menu);
+        if (!mScanning) {
+            menu.findItem(R.id.menu_stop).setVisible(false);
+            menu.findItem(R.id.menu_scan).setVisible(true);
+            menu.findItem(R.id.menu_refresh).setActionView(null);
+        } else {
+            menu.findItem(R.id.menu_stop).setVisible(true);
+            menu.findItem(R.id.menu_scan).setVisible(false);
+            menu.findItem(R.id.menu_refresh).setActionView(
+                    R.layout.actionbar_indeterminate_progress);
+        }
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case R.id.menu_scan:
+                mLeDeviceListAdapter.clear();
+                scanLeDevice(true);
+                break;
+            case R.id.menu_stop:
+                scanLeDevice(false);
+                break;
+        }
+        return true;
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+
+        // Ensures Bluetooth is enabled on the device.  If Bluetooth is not currently enabled,
+        // fire an intent to display a dialog asking the user to grant permission to enable it.
+        if (!mBluetoothAdapter.isEnabled()) {
+            if (!mBluetoothAdapter.isEnabled()) {
+                Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
+                startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
+            }
+        }
+
+        // Initializes list view adapter.
+        mLeDeviceListAdapter = new LeDeviceListAdapter();
+        setListAdapter(mLeDeviceListAdapter);
+        scanLeDevice(true);
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        // User chose not to enable Bluetooth.
+        if (requestCode == REQUEST_ENABLE_BT && resultCode == Activity.RESULT_CANCELED) {
+            finish();
+            return;
+        }
+        super.onActivityResult(requestCode, resultCode, data);
+    }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+        scanLeDevice(false);
+        mLeDeviceListAdapter.clear();
+    }
+
+    @Override
+    protected void onListItemClick(ListView l, View v, int position, long id) {
+        final BluetoothDevice device = mLeDeviceListAdapter.getDevice(position);
+        if (device == null) return;
+        final Intent intent = new Intent(this, DeviceControlActivity.class);
+        intent.putExtra(DeviceControlActivity.EXTRAS_DEVICE_NAME, device.getName());
+        intent.putExtra(DeviceControlActivity.EXTRAS_DEVICE_ADDRESS, device.getAddress());
+        if (mScanning) {
+            mBluetoothAdapter.stopLeScan(mLeScanCallback);
+            mScanning = false;
+        }
+        startActivity(intent);
+    }
+
+    private void scanLeDevice(final boolean enable) {
+        if (enable) {
+            // Stops scanning after a pre-defined scan period.
+            mHandler.postDelayed(new Runnable() {
+                @Override
+                public void run() {
+                    mScanning = false;
+                    mBluetoothAdapter.stopLeScan(mLeScanCallback);
+                    invalidateOptionsMenu();
+                }
+            }, SCAN_PERIOD);
+
+            mScanning = true;
+            mBluetoothAdapter.startLeScan(mLeScanCallback);
+        } else {
+            mScanning = false;
+            mBluetoothAdapter.stopLeScan(mLeScanCallback);
+        }
+        invalidateOptionsMenu();
+    }
+
+    // Adapter for holding devices found through scanning.
+    private class LeDeviceListAdapter extends BaseAdapter {
+        private ArrayList<BluetoothDevice> mLeDevices;
+        private LayoutInflater mInflator;
+
+        public LeDeviceListAdapter() {
+            super();
+            mLeDevices = new ArrayList<BluetoothDevice>();
+            mInflator = DeviceScanActivity.this.getLayoutInflater();
+        }
+
+        public void addDevice(BluetoothDevice device) {
+            if(!mLeDevices.contains(device)) {
+                mLeDevices.add(device);
+            }
+        }
+
+        public BluetoothDevice getDevice(int position) {
+            return mLeDevices.get(position);
+        }
+
+        public void clear() {
+            mLeDevices.clear();
+        }
+
+        @Override
+        public int getCount() {
+            return mLeDevices.size();
+        }
+
+        @Override
+        public Object getItem(int i) {
+            return mLeDevices.get(i);
+        }
+
+        @Override
+        public long getItemId(int i) {
+            return i;
+        }
+
+        @Override
+        public View getView(int i, View view, ViewGroup viewGroup) {
+            ViewHolder viewHolder;
+            // General ListView optimization code.
+            if (view == null) {
+                view = mInflator.inflate(R.layout.listitem_device, null);
+                viewHolder = new ViewHolder();
+                viewHolder.deviceAddress = (TextView) view.findViewById(R.id.device_address);
+                viewHolder.deviceName = (TextView) view.findViewById(R.id.device_name);
+                view.setTag(viewHolder);
+            } else {
+                viewHolder = (ViewHolder) view.getTag();
+            }
+
+            BluetoothDevice device = mLeDevices.get(i);
+            final String deviceName = device.getName();
+            if (deviceName != null && deviceName.length() > 0)
+                viewHolder.deviceName.setText(deviceName);
+            else
+                viewHolder.deviceName.setText(R.string.unknown_device);
+            viewHolder.deviceAddress.setText(device.getAddress());
+
+            return view;
+        }
+    }
+
+    // Device scan callback.
+    private BluetoothAdapter.LeScanCallback mLeScanCallback =
+            new BluetoothAdapter.LeScanCallback() {
+
+        @Override
+        public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
+            runOnUiThread(new Runnable() {
+                @Override
+                public void run() {
+                    mLeDeviceListAdapter.addDevice(device);
+                    mLeDeviceListAdapter.notifyDataSetChanged();
+                }
+            });
+        }
+    };
+
+    static class ViewHolder {
+        TextView deviceName;
+        TextView deviceAddress;
+    }
+}
\ No newline at end of file
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/SampleGattAttributes.java b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/SampleGattAttributes.java
new file mode 100644
index 0000000..255653e
--- /dev/null
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/java/com/example/bluetooth/le/SampleGattAttributes.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2013 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.bluetooth.le;
+
+import java.util.HashMap;
+
+/**
+ * This class includes a small subset of standard GATT attributes for demonstration purposes.
+ */
+public class SampleGattAttributes {
+    private static HashMap<String, String> attributes = new HashMap();
+    public static String HEART_RATE_MEASUREMENT = "00002a37-0000-1000-8000-00805f9b34fb";
+    public static String CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb";
+
+    static {
+        // Sample Services.
+        attributes.put("0000180d-0000-1000-8000-00805f9b34fb", "Heart Rate Service");
+        attributes.put("0000180a-0000-1000-8000-00805f9b34fb", "Device Information Service");
+        // Sample Characteristics.
+        attributes.put(HEART_RATE_MEASUREMENT, "Heart Rate Measurement");
+        attributes.put("00002a29-0000-1000-8000-00805f9b34fb", "Manufacturer Name String");
+    }
+
+    public static String lookup(String uuid, String defaultName) {
+        String name = attributes.get(uuid);
+        return name == null ? defaultName : name;
+    }
+}
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-hdpi/ic_launcher.png b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-hdpi/ic_launcher.png
similarity index 100%
rename from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-hdpi/ic_launcher.png
rename to connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-mdpi/ic_launcher.png b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-mdpi/ic_launcher.png
similarity index 100%
rename from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-mdpi/ic_launcher.png
rename to connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-xhdpi/ic_launcher.png b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-xhdpi/ic_launcher.png
similarity index 100%
rename from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-xhdpi/ic_launcher.png
rename to connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-xxhdpi/ic_launcher.png b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-xxhdpi/ic_launcher.png
similarity index 100%
rename from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/drawable-xxhdpi/ic_launcher.png
rename to connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/layout/actionbar_indeterminate_progress.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/layout/actionbar_indeterminate_progress.xml
similarity index 100%
rename from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/layout/actionbar_indeterminate_progress.xml
rename to connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/layout/actionbar_indeterminate_progress.xml
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/layout/gatt_services_characteristics.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/layout/gatt_services_characteristics.xml
similarity index 100%
rename from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/layout/gatt_services_characteristics.xml
rename to connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/layout/gatt_services_characteristics.xml
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/layout/listitem_device.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/layout/listitem_device.xml
similarity index 100%
rename from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/layout/listitem_device.xml
rename to connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/layout/listitem_device.xml
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/menu/gatt_services.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/menu/gatt_services.xml
similarity index 100%
rename from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/menu/gatt_services.xml
rename to connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/menu/gatt_services.xml
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/menu/main.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/menu/main.xml
similarity index 100%
rename from connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/menu/main.xml
rename to connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/menu/main.xml
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/values/strings.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/values/strings.xml
new file mode 100644
index 0000000..d828aa0
--- /dev/null
+++ b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGatt/src/main/res/values/strings.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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="app_name">BLE Sample</string>
+    <string name="ble_not_supported">BLE is not supported</string>
+    <string name="label_data">Data:</string>
+    <string name="label_device_address">Device address:</string>
+    <string name="label_state">State:</string>
+    <string name="no_data">No data</string>
+    <string name="connected">Connected</string>
+    <string name="disconnected">Disconnected</string>
+    <string name="title_devices">BLE Device Scan</string>
+    <string name="error_bluetooth_not_supported">Bluetooth not supported.</string>
+
+    <string name="unknown_device">Unknown device</string>
+    <string name="unknown_characteristic">Unknown characteristic</string>
+    <string name="unknown_service">Unknown service</string>
+
+    <!-- Menu items -->
+    <string name="menu_connect">Connect</string>
+    <string name="menu_disconnect">Disconnect</string>
+    <string name="menu_scan">Scan</string>
+    <string name="menu_stop">Stop</string>
+</resources>
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/.gitignore b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/.gitignore
deleted file mode 100644
index 6eb878d..0000000
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/.gitignore
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2013 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.
-src/template/
-src/common/
-build.gradle
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/proguard-project.txt b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/proguard-project.txt
deleted file mode 100644
index 0d8f171..0000000
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/proguard-project.txt
+++ /dev/null
@@ -1,20 +0,0 @@
- To enable ProGuard in your project, edit project.properties
-# to define the proguard.config property as described in that file.
-#
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in ${sdk.dir}/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the ProGuard
-# include property in project.properties.
-#
-# For more details, see
-#   http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-#   public *;
-#}
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/AndroidManifest.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/AndroidManifest.xml
deleted file mode 100644
index babd6df..0000000
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2013 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.bluetoothlegatt"
-    android:versionCode="1"
-    android:versionName="1.0">
-
-    <uses-sdk android:minSdkVersion="18"
-        android:targetSdkVersion="18"/>
-    <!-- Declare this required feature if you want to make the app available to BLE-capable
-    devices only.  If you want to make your app available to devices that don't support BLE,
-    you should omit this in the manifest.  Instead, determine BLE capability by using
-    PackageManager.hasSystemFeature(FEATURE_BLUETOOTH_LE) -->
-    <uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
-
-    <uses-permission android:name="android.permission.BLUETOOTH"/>
-    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
-
-    <application android:label="@string/app_name"
-        android:icon="@drawable/ic_launcher"
-        android:theme="@android:style/Theme.Holo.Light">
-        <activity android:name=".DeviceScanActivity"
-            android:label="@string/app_name">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN"/>
-                <category android:name="android.intent.category.LAUNCHER"/>
-            </intent-filter>
-        </activity>
-        <activity android:name=".DeviceControlActivity"/>
-        <service android:name=".BluetoothLeService" android:enabled="true"/>
-    </application>
-
-</manifest>
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/BluetoothLeService.java b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/BluetoothLeService.java
deleted file mode 100644
index 694faaf..0000000
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/BluetoothLeService.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Copyright (C) 2013 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.bluetoothlegatt;
-
-import android.app.Service;
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothGatt;
-import android.bluetooth.BluetoothGattCallback;
-import android.bluetooth.BluetoothGattCharacteristic;
-import android.bluetooth.BluetoothGattDescriptor;
-import android.bluetooth.BluetoothGattService;
-import android.bluetooth.BluetoothManager;
-import android.bluetooth.BluetoothProfile;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Binder;
-import android.os.IBinder;
-import android.util.Log;
-
-import java.util.List;
-import java.util.UUID;
-
-/**
- * Service for managing connection and data communication with a GATT server hosted on a
- * given Bluetooth LE device.
- */
-public class BluetoothLeService extends Service {
-    private final static String TAG = BluetoothLeService.class.getSimpleName();
-
-    private BluetoothManager mBluetoothManager;
-    private BluetoothAdapter mBluetoothAdapter;
-    private String mBluetoothDeviceAddress;
-    private BluetoothGatt mBluetoothGatt;
-    private int mConnectionState = STATE_DISCONNECTED;
-
-    private static final int STATE_DISCONNECTED = 0;
-    private static final int STATE_CONNECTING = 1;
-    private static final int STATE_CONNECTED = 2;
-
-    public final static String ACTION_GATT_CONNECTED =
-            "com.example.bluetooth.le.ACTION_GATT_CONNECTED";
-    public final static String ACTION_GATT_DISCONNECTED =
-            "com.example.bluetooth.le.ACTION_GATT_DISCONNECTED";
-    public final static String ACTION_GATT_SERVICES_DISCOVERED =
-            "com.example.bluetooth.le.ACTION_GATT_SERVICES_DISCOVERED";
-    public final static String ACTION_DATA_AVAILABLE =
-            "com.example.bluetooth.le.ACTION_DATA_AVAILABLE";
-    public final static String EXTRA_DATA =
-            "com.example.bluetooth.le.EXTRA_DATA";
-
-    public final static UUID UUID_HEART_RATE_MEASUREMENT =
-            UUID.fromString(SampleGattAttributes.HEART_RATE_MEASUREMENT);
-
-    // Implements callback methods for GATT events that the app cares about.  For example,
-    // connection change and services discovered.
-    private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
-        @Override
-        public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
-            String intentAction;
-            if (newState == BluetoothProfile.STATE_CONNECTED) {
-                intentAction = ACTION_GATT_CONNECTED;
-                mConnectionState = STATE_CONNECTED;
-                broadcastUpdate(intentAction);
-                Log.i(TAG, "Connected to GATT server.");
-                // Attempts to discover services after successful connection.
-                Log.i(TAG, "Attempting to start service discovery:" +
-                        mBluetoothGatt.discoverServices());
-
-            } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
-                intentAction = ACTION_GATT_DISCONNECTED;
-                mConnectionState = STATE_DISCONNECTED;
-                Log.i(TAG, "Disconnected from GATT server.");
-                broadcastUpdate(intentAction);
-            }
-        }
-
-        @Override
-        public void onServicesDiscovered(BluetoothGatt gatt, int status) {
-            if (status == BluetoothGatt.GATT_SUCCESS) {
-                broadcastUpdate(ACTION_GATT_SERVICES_DISCOVERED);
-            } else {
-                Log.w(TAG, "onServicesDiscovered received: " + status);
-            }
-        }
-
-        @Override
-        public void onCharacteristicRead(BluetoothGatt gatt,
-                                         BluetoothGattCharacteristic characteristic,
-                                         int status) {
-            if (status == BluetoothGatt.GATT_SUCCESS) {
-                broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);
-            }
-        }
-
-        @Override
-        public void onCharacteristicChanged(BluetoothGatt gatt,
-                                            BluetoothGattCharacteristic characteristic) {
-            broadcastUpdate(ACTION_DATA_AVAILABLE, characteristic);
-        }
-    };
-
-    private void broadcastUpdate(final String action) {
-        final Intent intent = new Intent(action);
-        sendBroadcast(intent);
-    }
-
-    private void broadcastUpdate(final String action,
-                                 final BluetoothGattCharacteristic characteristic) {
-        final Intent intent = new Intent(action);
-
-        // This is special handling for the Heart Rate Measurement profile.  Data parsing is
-        // carried out as per profile specifications:
-        // http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml
-        if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) {
-            int flag = characteristic.getProperties();
-            int format = -1;
-            if ((flag & 0x01) != 0) {
-                format = BluetoothGattCharacteristic.FORMAT_UINT16;
-                Log.d(TAG, "Heart rate format UINT16.");
-            } else {
-                format = BluetoothGattCharacteristic.FORMAT_UINT8;
-                Log.d(TAG, "Heart rate format UINT8.");
-            }
-            final int heartRate = characteristic.getIntValue(format, 1);
-            Log.d(TAG, String.format("Received heart rate: %d", heartRate));
-            intent.putExtra(EXTRA_DATA, String.valueOf(heartRate));
-        } else {
-            // For all other profiles, writes the data formatted in HEX.
-            final byte[] data = characteristic.getValue();
-            if (data != null && data.length > 0) {
-                final StringBuilder stringBuilder = new StringBuilder(data.length);
-                for(byte byteChar : data)
-                    stringBuilder.append(String.format("%02X ", byteChar));
-                intent.putExtra(EXTRA_DATA, new String(data) + "\n" + stringBuilder.toString());
-            }
-        }
-        sendBroadcast(intent);
-    }
-
-    public class LocalBinder extends Binder {
-        BluetoothLeService getService() {
-            return BluetoothLeService.this;
-        }
-    }
-
-    @Override
-    public IBinder onBind(Intent intent) {
-        return mBinder;
-    }
-
-    @Override
-    public boolean onUnbind(Intent intent) {
-        // After using a given device, you should make sure that BluetoothGatt.close() is called
-        // such that resources are cleaned up properly.  In this particular example, close() is
-        // invoked when the UI is disconnected from the Service.
-        close();
-        return super.onUnbind(intent);
-    }
-
-    private final IBinder mBinder = new LocalBinder();
-
-    /**
-     * Initializes a reference to the local Bluetooth adapter.
-     *
-     * @return Return true if the initialization is successful.
-     */
-    public boolean initialize() {
-        // For API level 18 and above, get a reference to BluetoothAdapter through
-        // BluetoothManager.
-        if (mBluetoothManager == null) {
-            mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
-            if (mBluetoothManager == null) {
-                Log.e(TAG, "Unable to initialize BluetoothManager.");
-                return false;
-            }
-        }
-
-        mBluetoothAdapter = mBluetoothManager.getAdapter();
-        if (mBluetoothAdapter == null) {
-            Log.e(TAG, "Unable to obtain a BluetoothAdapter.");
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Connects to the GATT server hosted on the Bluetooth LE device.
-     *
-     * @param address The device address of the destination device.
-     *
-     * @return Return true if the connection is initiated successfully. The connection result
-     *         is reported asynchronously through the
-     *         {@code BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)}
-     *         callback.
-     */
-    public boolean connect(final String address) {
-        if (mBluetoothAdapter == null || address == null) {
-            Log.w(TAG, "BluetoothAdapter not initialized or unspecified address.");
-            return false;
-        }
-
-        // Previously connected device.  Try to reconnect.
-        if (mBluetoothDeviceAddress != null && address.equals(mBluetoothDeviceAddress)
-                && mBluetoothGatt != null) {
-            Log.d(TAG, "Trying to use an existing mBluetoothGatt for connection.");
-            if (mBluetoothGatt.connect()) {
-                mConnectionState = STATE_CONNECTING;
-                return true;
-            } else {
-                return false;
-            }
-        }
-
-        final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address);
-        if (device == null) {
-            Log.w(TAG, "Device not found.  Unable to connect.");
-            return false;
-        }
-        // We want to directly connect to the device, so we are setting the autoConnect
-        // parameter to false.
-        mBluetoothGatt = device.connectGatt(this, false, mGattCallback);
-        Log.d(TAG, "Trying to create a new connection.");
-        mBluetoothDeviceAddress = address;
-        mConnectionState = STATE_CONNECTING;
-        return true;
-    }
-
-    /**
-     * Disconnects an existing connection or cancel a pending connection. The disconnection result
-     * is reported asynchronously through the
-     * {@code BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)}
-     * callback.
-     */
-    public void disconnect() {
-        if (mBluetoothAdapter == null || mBluetoothGatt == null) {
-            Log.w(TAG, "BluetoothAdapter not initialized");
-            return;
-        }
-        mBluetoothGatt.disconnect();
-    }
-
-    /**
-     * After using a given BLE device, the app must call this method to ensure resources are
-     * released properly.
-     */
-    public void close() {
-        if (mBluetoothGatt == null) {
-            return;
-        }
-        mBluetoothGatt.close();
-        mBluetoothGatt = null;
-    }
-
-    /**
-     * Request a read on a given {@code BluetoothGattCharacteristic}. The read result is reported
-     * asynchronously through the {@code BluetoothGattCallback#onCharacteristicRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int)}
-     * callback.
-     *
-     * @param characteristic The characteristic to read from.
-     */
-    public void readCharacteristic(BluetoothGattCharacteristic characteristic) {
-        if (mBluetoothAdapter == null || mBluetoothGatt == null) {
-            Log.w(TAG, "BluetoothAdapter not initialized");
-            return;
-        }
-        mBluetoothGatt.readCharacteristic(characteristic);
-    }
-
-    /**
-     * Enables or disables notification on a give characteristic.
-     *
-     * @param characteristic Characteristic to act on.
-     * @param enabled If true, enable notification.  False otherwise.
-     */
-    public void setCharacteristicNotification(BluetoothGattCharacteristic characteristic,
-                                              boolean enabled) {
-        if (mBluetoothAdapter == null || mBluetoothGatt == null) {
-            Log.w(TAG, "BluetoothAdapter not initialized");
-            return;
-        }
-        mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);
-
-        // This is specific to Heart Rate Measurement.
-        if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) {
-            BluetoothGattDescriptor descriptor = characteristic.getDescriptor(
-                    UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
-            descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
-            mBluetoothGatt.writeDescriptor(descriptor);
-        }
-    }
-
-    /**
-     * Retrieves a list of supported GATT services on the connected device. This should be
-     * invoked only after {@code BluetoothGatt#discoverServices()} completes successfully.
-     *
-     * @return A {@code List} of supported services.
-     */
-    public List<BluetoothGattService> getSupportedGattServices() {
-        if (mBluetoothGatt == null) return null;
-
-        return mBluetoothGatt.getServices();
-    }
-}
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/DeviceControlActivity.java b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/DeviceControlActivity.java
deleted file mode 100644
index dc2f90b..0000000
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/DeviceControlActivity.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Copyright (C) 2013 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.bluetoothlegatt;
-
-import android.app.Activity;
-import android.bluetooth.BluetoothGattCharacteristic;
-import android.bluetooth.BluetoothGattService;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.ExpandableListView;
-import android.widget.SimpleExpandableListAdapter;
-import android.widget.TextView;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * For a given BLE device, this Activity provides the user interface to connect, display data,
- * and display GATT services and characteristics supported by the device.  The Activity
- * communicates with {@code BluetoothLeService}, which in turn interacts with the
- * Bluetooth LE API.
- */
-public class DeviceControlActivity extends Activity {
-    private final static String TAG = DeviceControlActivity.class.getSimpleName();
-
-    public static final String EXTRAS_DEVICE_NAME = "DEVICE_NAME";
-    public static final String EXTRAS_DEVICE_ADDRESS = "DEVICE_ADDRESS";
-
-    private TextView mConnectionState;
-    private TextView mDataField;
-    private String mDeviceName;
-    private String mDeviceAddress;
-    private ExpandableListView mGattServicesList;
-    private BluetoothLeService mBluetoothLeService;
-    private ArrayList<ArrayList<BluetoothGattCharacteristic>> mGattCharacteristics =
-            new ArrayList<ArrayList<BluetoothGattCharacteristic>>();
-    private boolean mConnected = false;
-    private BluetoothGattCharacteristic mNotifyCharacteristic;
-
-    private final String LIST_NAME = "NAME";
-    private final String LIST_UUID = "UUID";
-
-    // Code to manage Service lifecycle.
-    private final ServiceConnection mServiceConnection = new ServiceConnection() {
-
-        @Override
-        public void onServiceConnected(ComponentName componentName, IBinder service) {
-            mBluetoothLeService = ((BluetoothLeService.LocalBinder) service).getService();
-            if (!mBluetoothLeService.initialize()) {
-                Log.e(TAG, "Unable to initialize Bluetooth");
-                finish();
-            }
-            // Automatically connects to the device upon successful start-up initialization.
-            mBluetoothLeService.connect(mDeviceAddress);
-        }
-
-        @Override
-        public void onServiceDisconnected(ComponentName componentName) {
-            mBluetoothLeService = null;
-        }
-    };
-
-    // Handles various events fired by the Service.
-    // ACTION_GATT_CONNECTED: connected to a GATT server.
-    // ACTION_GATT_DISCONNECTED: disconnected from a GATT server.
-    // ACTION_GATT_SERVICES_DISCOVERED: discovered GATT services.
-    // ACTION_DATA_AVAILABLE: received data from the device.  This can be a result of read
-    //                        or notification operations.
-    private final BroadcastReceiver mGattUpdateReceiver = new BroadcastReceiver() {
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            final String action = intent.getAction();
-            if (BluetoothLeService.ACTION_GATT_CONNECTED.equals(action)) {
-                mConnected = true;
-                updateConnectionState(R.string.connected);
-                invalidateOptionsMenu();
-            } else if (BluetoothLeService.ACTION_GATT_DISCONNECTED.equals(action)) {
-                mConnected = false;
-                updateConnectionState(R.string.disconnected);
-                invalidateOptionsMenu();
-                clearUI();
-            } else if (BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED.equals(action)) {
-                // Show all the supported services and characteristics on the user interface.
-                displayGattServices(mBluetoothLeService.getSupportedGattServices());
-            } else if (BluetoothLeService.ACTION_DATA_AVAILABLE.equals(action)) {
-                displayData(intent.getStringExtra(BluetoothLeService.EXTRA_DATA));
-            }
-        }
-    };
-
-    // If a given GATT characteristic is selected, check for supported features.  This sample
-    // demonstrates 'Read' and 'Notify' features.  See
-    // http://d.android.com/reference/android/bluetooth/BluetoothGatt.html for the complete
-    // list of supported characteristic features.
-    private final ExpandableListView.OnChildClickListener servicesListClickListner =
-            new ExpandableListView.OnChildClickListener() {
-                @Override
-                public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
-                                            int childPosition, long id) {
-                    if (mGattCharacteristics != null) {
-                        final BluetoothGattCharacteristic characteristic =
-                                mGattCharacteristics.get(groupPosition).get(childPosition);
-                        final int charaProp = characteristic.getProperties();
-                        if ((charaProp | BluetoothGattCharacteristic.PROPERTY_READ) > 0) {
-                            // If there is an active notification on a characteristic, clear
-                            // it first so it doesn't update the data field on the user interface.
-                            if (mNotifyCharacteristic != null) {
-                                mBluetoothLeService.setCharacteristicNotification(
-                                        mNotifyCharacteristic, false);
-                                mNotifyCharacteristic = null;
-                            }
-                            mBluetoothLeService.readCharacteristic(characteristic);
-                        }
-                        if ((charaProp | BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) {
-                            mNotifyCharacteristic = characteristic;
-                            mBluetoothLeService.setCharacteristicNotification(
-                                    characteristic, true);
-                        }
-                        return true;
-                    }
-                    return false;
-                }
-    };
-
-    private void clearUI() {
-        mGattServicesList.setAdapter((SimpleExpandableListAdapter) null);
-        mDataField.setText(R.string.no_data);
-    }
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.gatt_services_characteristics);
-
-        final Intent intent = getIntent();
-        mDeviceName = intent.getStringExtra(EXTRAS_DEVICE_NAME);
-        mDeviceAddress = intent.getStringExtra(EXTRAS_DEVICE_ADDRESS);
-
-        // Sets up UI references.
-        ((TextView) findViewById(R.id.device_address)).setText(mDeviceAddress);
-        mGattServicesList = (ExpandableListView) findViewById(R.id.gatt_services_list);
-        mGattServicesList.setOnChildClickListener(servicesListClickListner);
-        mConnectionState = (TextView) findViewById(R.id.connection_state);
-        mDataField = (TextView) findViewById(R.id.data_value);
-
-        getActionBar().setTitle(mDeviceName);
-        getActionBar().setDisplayHomeAsUpEnabled(true);
-        Intent gattServiceIntent = new Intent(this, BluetoothLeService.class);
-        bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);
-    }
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-        registerReceiver(mGattUpdateReceiver, makeGattUpdateIntentFilter());
-        if (mBluetoothLeService != null) {
-            final boolean result = mBluetoothLeService.connect(mDeviceAddress);
-            Log.d(TAG, "Connect request result=" + result);
-        }
-    }
-
-    @Override
-    protected void onPause() {
-        super.onPause();
-        unregisterReceiver(mGattUpdateReceiver);
-    }
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-        unbindService(mServiceConnection);
-        mBluetoothLeService = null;
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        getMenuInflater().inflate(R.menu.gatt_services, menu);
-        if (mConnected) {
-            menu.findItem(R.id.menu_connect).setVisible(false);
-            menu.findItem(R.id.menu_disconnect).setVisible(true);
-        } else {
-            menu.findItem(R.id.menu_connect).setVisible(true);
-            menu.findItem(R.id.menu_disconnect).setVisible(false);
-        }
-        return true;
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch(item.getItemId()) {
-            case R.id.menu_connect:
-                mBluetoothLeService.connect(mDeviceAddress);
-                return true;
-            case R.id.menu_disconnect:
-                mBluetoothLeService.disconnect();
-                return true;
-            case android.R.id.home:
-                onBackPressed();
-                return true;
-        }
-        return super.onOptionsItemSelected(item);
-    }
-
-    private void updateConnectionState(final int resourceId) {
-        runOnUiThread(new Runnable() {
-            @Override
-            public void run() {
-                mConnectionState.setText(resourceId);
-            }
-        });
-    }
-
-    private void displayData(String data) {
-        if (data != null) {
-            mDataField.setText(data);
-        }
-    }
-
-    // Demonstrates how to iterate through the supported GATT Services/Characteristics.
-    // In this sample, we populate the data structure that is bound to the ExpandableListView
-    // on the UI.
-    private void displayGattServices(List<BluetoothGattService> gattServices) {
-        if (gattServices == null) return;
-        String uuid = null;
-        String unknownServiceString = getResources().getString(R.string.unknown_service);
-        String unknownCharaString = getResources().getString(R.string.unknown_characteristic);
-        ArrayList<HashMap<String, String>> gattServiceData = new ArrayList<HashMap<String, String>>();
-        ArrayList<ArrayList<HashMap<String, String>>> gattCharacteristicData
-                = new ArrayList<ArrayList<HashMap<String, String>>>();
-        mGattCharacteristics = new ArrayList<ArrayList<BluetoothGattCharacteristic>>();
-
-        // Loops through available GATT Services.
-        for (BluetoothGattService gattService : gattServices) {
-            HashMap<String, String> currentServiceData = new HashMap<String, String>();
-            uuid = gattService.getUuid().toString();
-            currentServiceData.put(
-                    LIST_NAME, SampleGattAttributes.lookup(uuid, unknownServiceString));
-            currentServiceData.put(LIST_UUID, uuid);
-            gattServiceData.add(currentServiceData);
-
-            ArrayList<HashMap<String, String>> gattCharacteristicGroupData =
-                    new ArrayList<HashMap<String, String>>();
-            List<BluetoothGattCharacteristic> gattCharacteristics =
-                    gattService.getCharacteristics();
-            ArrayList<BluetoothGattCharacteristic> charas =
-                    new ArrayList<BluetoothGattCharacteristic>();
-
-            // Loops through available Characteristics.
-            for (BluetoothGattCharacteristic gattCharacteristic : gattCharacteristics) {
-                charas.add(gattCharacteristic);
-                HashMap<String, String> currentCharaData = new HashMap<String, String>();
-                uuid = gattCharacteristic.getUuid().toString();
-                currentCharaData.put(
-                        LIST_NAME, SampleGattAttributes.lookup(uuid, unknownCharaString));
-                currentCharaData.put(LIST_UUID, uuid);
-                gattCharacteristicGroupData.add(currentCharaData);
-            }
-            mGattCharacteristics.add(charas);
-            gattCharacteristicData.add(gattCharacteristicGroupData);
-        }
-
-        SimpleExpandableListAdapter gattServiceAdapter = new SimpleExpandableListAdapter(
-                this,
-                gattServiceData,
-                android.R.layout.simple_expandable_list_item_2,
-                new String[] {LIST_NAME, LIST_UUID},
-                new int[] { android.R.id.text1, android.R.id.text2 },
-                gattCharacteristicData,
-                android.R.layout.simple_expandable_list_item_2,
-                new String[] {LIST_NAME, LIST_UUID},
-                new int[] { android.R.id.text1, android.R.id.text2 }
-        );
-        mGattServicesList.setAdapter(gattServiceAdapter);
-    }
-
-    private static IntentFilter makeGattUpdateIntentFilter() {
-        final IntentFilter intentFilter = new IntentFilter();
-        intentFilter.addAction(BluetoothLeService.ACTION_GATT_CONNECTED);
-        intentFilter.addAction(BluetoothLeService.ACTION_GATT_DISCONNECTED);
-        intentFilter.addAction(BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED);
-        intentFilter.addAction(BluetoothLeService.ACTION_DATA_AVAILABLE);
-        return intentFilter;
-    }
-}
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/DeviceScanActivity.java b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/DeviceScanActivity.java
deleted file mode 100644
index 9b86f7a..0000000
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/DeviceScanActivity.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright (C) 2013 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.bluetoothlegatt;
-
-import android.app.Activity;
-import android.app.ListActivity;
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothManager;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import java.util.ArrayList;
-
-/**
- * Activity for scanning and displaying available Bluetooth LE devices.
- */
-public class DeviceScanActivity extends ListActivity {
-    private LeDeviceListAdapter mLeDeviceListAdapter;
-    private BluetoothAdapter mBluetoothAdapter;
-    private boolean mScanning;
-    private Handler mHandler;
-
-    private static final int REQUEST_ENABLE_BT = 1;
-    // Stops scanning after 10 seconds.
-    private static final long SCAN_PERIOD = 10000;
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        getActionBar().setTitle(R.string.title_devices);
-        mHandler = new Handler();
-
-        // Use this check to determine whether BLE is supported on the device.  Then you can
-        // selectively disable BLE-related features.
-        if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
-            Toast.makeText(this, R.string.ble_not_supported, Toast.LENGTH_SHORT).show();
-            finish();
-        }
-
-        // Initializes a Bluetooth adapter.  For API level 18 and above, get a reference to
-        // BluetoothAdapter through BluetoothManager.
-        final BluetoothManager bluetoothManager =
-                (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
-        mBluetoothAdapter = bluetoothManager.getAdapter();
-
-        // Checks if Bluetooth is supported on the device.
-        if (mBluetoothAdapter == null) {
-            Toast.makeText(this, R.string.error_bluetooth_not_supported, Toast.LENGTH_SHORT).show();
-            finish();
-            return;
-        }
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        getMenuInflater().inflate(R.menu.main, menu);
-        if (!mScanning) {
-            menu.findItem(R.id.menu_stop).setVisible(false);
-            menu.findItem(R.id.menu_scan).setVisible(true);
-            menu.findItem(R.id.menu_refresh).setActionView(null);
-        } else {
-            menu.findItem(R.id.menu_stop).setVisible(true);
-            menu.findItem(R.id.menu_scan).setVisible(false);
-            menu.findItem(R.id.menu_refresh).setActionView(
-                    R.layout.actionbar_indeterminate_progress);
-        }
-        return true;
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            case R.id.menu_scan:
-                mLeDeviceListAdapter.clear();
-                scanLeDevice(true);
-                break;
-            case R.id.menu_stop:
-                scanLeDevice(false);
-                break;
-        }
-        return true;
-    }
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-
-        // Ensures Bluetooth is enabled on the device.  If Bluetooth is not currently enabled,
-        // fire an intent to display a dialog asking the user to grant permission to enable it.
-        if (!mBluetoothAdapter.isEnabled()) {
-            if (!mBluetoothAdapter.isEnabled()) {
-                Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
-                startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
-            }
-        }
-
-        // Initializes list view adapter.
-        mLeDeviceListAdapter = new LeDeviceListAdapter();
-        setListAdapter(mLeDeviceListAdapter);
-        scanLeDevice(true);
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        // User chose not to enable Bluetooth.
-        if (requestCode == REQUEST_ENABLE_BT && resultCode == Activity.RESULT_CANCELED) {
-            finish();
-            return;
-        }
-        super.onActivityResult(requestCode, resultCode, data);
-    }
-
-    @Override
-    protected void onPause() {
-        super.onPause();
-        scanLeDevice(false);
-        mLeDeviceListAdapter.clear();
-    }
-
-    @Override
-    protected void onListItemClick(ListView l, View v, int position, long id) {
-        final BluetoothDevice device = mLeDeviceListAdapter.getDevice(position);
-        if (device == null) return;
-        final Intent intent = new Intent(this, DeviceControlActivity.class);
-        intent.putExtra(DeviceControlActivity.EXTRAS_DEVICE_NAME, device.getName());
-        intent.putExtra(DeviceControlActivity.EXTRAS_DEVICE_ADDRESS, device.getAddress());
-        if (mScanning) {
-            mBluetoothAdapter.stopLeScan(mLeScanCallback);
-            mScanning = false;
-        }
-        startActivity(intent);
-    }
-
-    private void scanLeDevice(final boolean enable) {
-        if (enable) {
-            // Stops scanning after a pre-defined scan period.
-            mHandler.postDelayed(new Runnable() {
-                @Override
-                public void run() {
-                    mScanning = false;
-                    mBluetoothAdapter.stopLeScan(mLeScanCallback);
-                    invalidateOptionsMenu();
-                }
-            }, SCAN_PERIOD);
-
-            mScanning = true;
-            mBluetoothAdapter.startLeScan(mLeScanCallback);
-        } else {
-            mScanning = false;
-            mBluetoothAdapter.stopLeScan(mLeScanCallback);
-        }
-        invalidateOptionsMenu();
-    }
-
-    // Adapter for holding devices found through scanning.
-    private class LeDeviceListAdapter extends BaseAdapter {
-        private ArrayList<BluetoothDevice> mLeDevices;
-        private LayoutInflater mInflator;
-
-        public LeDeviceListAdapter() {
-            super();
-            mLeDevices = new ArrayList<BluetoothDevice>();
-            mInflator = DeviceScanActivity.this.getLayoutInflater();
-        }
-
-        public void addDevice(BluetoothDevice device) {
-            if(!mLeDevices.contains(device)) {
-                mLeDevices.add(device);
-            }
-        }
-
-        public BluetoothDevice getDevice(int position) {
-            return mLeDevices.get(position);
-        }
-
-        public void clear() {
-            mLeDevices.clear();
-        }
-
-        @Override
-        public int getCount() {
-            return mLeDevices.size();
-        }
-
-        @Override
-        public Object getItem(int i) {
-            return mLeDevices.get(i);
-        }
-
-        @Override
-        public long getItemId(int i) {
-            return i;
-        }
-
-        @Override
-        public View getView(int i, View view, ViewGroup viewGroup) {
-            ViewHolder viewHolder;
-            // General ListView optimization code.
-            if (view == null) {
-                view = mInflator.inflate(R.layout.listitem_device, null);
-                viewHolder = new ViewHolder();
-                viewHolder.deviceAddress = (TextView) view.findViewById(R.id.device_address);
-                viewHolder.deviceName = (TextView) view.findViewById(R.id.device_name);
-                view.setTag(viewHolder);
-            } else {
-                viewHolder = (ViewHolder) view.getTag();
-            }
-
-            BluetoothDevice device = mLeDevices.get(i);
-            final String deviceName = device.getName();
-            if (deviceName != null && deviceName.length() > 0)
-                viewHolder.deviceName.setText(deviceName);
-            else
-                viewHolder.deviceName.setText(R.string.unknown_device);
-            viewHolder.deviceAddress.setText(device.getAddress());
-
-            return view;
-        }
-    }
-
-    // Device scan callback.
-    private BluetoothAdapter.LeScanCallback mLeScanCallback =
-            new BluetoothAdapter.LeScanCallback() {
-
-        @Override
-        public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
-            runOnUiThread(new Runnable() {
-                @Override
-                public void run() {
-                    mLeDeviceListAdapter.addDevice(device);
-                    mLeDeviceListAdapter.notifyDataSetChanged();
-                }
-            });
-        }
-    };
-
-    static class ViewHolder {
-        TextView deviceName;
-        TextView deviceAddress;
-    }
-}
\ No newline at end of file
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/SampleGattAttributes.java b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/SampleGattAttributes.java
deleted file mode 100644
index e8db74c..0000000
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/java/com/example/android/bluetoothlegatt/SampleGattAttributes.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2013 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.bluetoothlegatt;
-
-import java.util.HashMap;
-
-/**
- * This class includes a small subset of standard GATT attributes for demonstration purposes.
- */
-public class SampleGattAttributes {
-    private static HashMap<String, String> attributes = new HashMap();
-    public static String HEART_RATE_MEASUREMENT = "00002a37-0000-1000-8000-00805f9b34fb";
-    public static String CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb";
-
-    static {
-        // Sample Services.
-        attributes.put("0000180d-0000-1000-8000-00805f9b34fb", "Heart Rate Service");
-        attributes.put("0000180a-0000-1000-8000-00805f9b34fb", "Device Information Service");
-        // Sample Characteristics.
-        attributes.put(HEART_RATE_MEASUREMENT, "Heart Rate Measurement");
-        attributes.put("00002a29-0000-1000-8000-00805f9b34fb", "Manufacturer Name String");
-    }
-
-    public static String lookup(String uuid, String defaultName) {
-        String name = attributes.get(uuid);
-        return name == null ? defaultName : name;
-    }
-}
diff --git a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/values/strings.xml b/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/values/strings.xml
deleted file mode 100644
index 19f3dce..0000000
--- a/connectivity/bluetooth/BluetoothLeGatt/BluetoothLeGattSample/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 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="ble_not_supported">BLE is not supported</string>
-    <string name="label_data">Data:</string>
-    <string name="label_device_address">Device address:</string>
-    <string name="label_state">State:</string>
-    <string name="no_data">No data</string>
-    <string name="connected">Connected</string>
-    <string name="disconnected">Disconnected</string>
-    <string name="title_devices">BLE Device Scan</string>
-    <string name="error_bluetooth_not_supported">Bluetooth not supported.</string>
-
-    <string name="unknown_device">Unknown device</string>
-    <string name="unknown_characteristic">Unknown characteristic</string>
-    <string name="unknown_service">Unknown service</string>
-
-    <!-- Menu items -->
-    <string name="menu_connect">Connect</string>
-    <string name="menu_disconnect">Disconnect</string>
-    <string name="menu_scan">Scan</string>
-    <string name="menu_stop">Stop</string>
-</resources>
diff --git a/connectivity/bluetooth/BluetoothLeGatt/build.gradle b/connectivity/bluetooth/BluetoothLeGatt/build.gradle
index cca9ac3..036abc8 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/build.gradle
+++ b/connectivity/bluetooth/BluetoothLeGatt/build.gradle
@@ -1,10 +1,8 @@
-// BEGIN_EXCLUDE
-import com.example.android.samples.build.SampleGenPlugin
-apply plugin: SampleGenPlugin
-
-samplegen {
-  pathToBuild "../../../../../build"
-  pathToSamplesCommon "../../../common"
+buildscript {
+    repositories {
+        mavenCentral()
+    }
+    dependencies {
+        classpath 'com.android.tools.build:gradle:0.5.+'
+    }
 }
-apply from: "../../../../../build/build.gradle"
-// END_EXCLUDE
diff --git a/connectivity/bluetooth/BluetoothLeGatt/buildSrc/build.gradle b/connectivity/bluetooth/BluetoothLeGatt/buildSrc/build.gradle
deleted file mode 100644
index e344a8c..0000000
--- a/connectivity/bluetooth/BluetoothLeGatt/buildSrc/build.gradle
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-repositories {
-    mavenCentral()
-}
-dependencies {
-    compile 'org.freemarker:freemarker:2.3.20'
-}
-
-sourceSets {
-    main {
-        groovy {
-            srcDir new File(rootDir, "../../../../../../build/buildSrc/src/main/groovy")
-        }
-    }
-}
-
diff --git a/connectivity/bluetooth/BluetoothLeGatt/gradle/wrapper/gradle-wrapper.properties b/connectivity/bluetooth/BluetoothLeGatt/gradle/wrapper/gradle-wrapper.properties
index 861eddc..5c22dec 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/gradle/wrapper/gradle-wrapper.properties
+++ b/connectivity/bluetooth/BluetoothLeGatt/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
diff --git a/connectivity/bluetooth/BluetoothLeGatt/settings.gradle b/connectivity/bluetooth/BluetoothLeGatt/settings.gradle
index 05cae43..639c5c8 100644
--- a/connectivity/bluetooth/BluetoothLeGatt/settings.gradle
+++ b/connectivity/bluetooth/BluetoothLeGatt/settings.gradle
@@ -1,4 +1 @@
-
-
-
-include 'BluetoothLeGattSample'
+include ':BluetoothLeGatt'
diff --git a/connectivity/bluetooth/BluetoothLeGatt/template-params.xml b/connectivity/bluetooth/BluetoothLeGatt/template-params.xml
deleted file mode 100644
index 323e1d7..0000000
--- a/connectivity/bluetooth/BluetoothLeGatt/template-params.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2013 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>
-    <name>BluetoothLeGatt</name>
-    <group>Connectivity</group>
-    <package>com.example.android.bluetoothlegatt</package>
-
-    <!-- change minSdk if needed-->
-    <minSdk>18</minSdk>
-
-    <strings>
-        <intro>
-            <![CDATA[
-            This sample demonstrates how to use the Bluetooth LE Generic Attribute Profile (GATT)
-            to transmit arbitrary data between devices.
-            ]]>
-        </intro>
-    </strings>
-
-    <template src="base"/>
-
-</sample>
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/build.gradle b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/build.gradle
new file mode 100644
index 0000000..0baece9
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/build.gradle
@@ -0,0 +1,10 @@
+apply plugin: 'android'
+
+dependencies {
+    compile "com.android.support:support-v4:18.0.+"
+}
+
+android {
+    compileSdkVersion 18
+    buildToolsVersion "18.0.0"
+}
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/AndroidManifest.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/AndroidManifest.xml
new file mode 100755
index 0000000..c0d3e64
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/AndroidManifest.xml
@@ -0,0 +1,44 @@
+<!--
+  Copyright 2013 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.networkbasic"
+    android:versionCode="1"
+    android:versionName="1.0">
+
+    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+
+    <application
+        android:label="@string/app_name"
+        android:icon="@drawable/ic_launcher"
+        android:theme="@style/Theme.Sample"
+        android:allowBackup="true">
+
+        <activity
+            android:name="com.example.android.networkbasic.MainActivity"
+            android:label="@string/app_name"
+            android:uiOptions="splitActionBarWhenNarrow">
+
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest>
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/SimpleTextFragment.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/SimpleTextFragment.java
new file mode 100644
index 0000000..a2be93f
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/SimpleTextFragment.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2013 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.common;
+
+import android.os.Bundle;
+
+import android.support.v4.app.Fragment;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+/**
+ * Simple fragment containing only a TextView. Used by TextPagerAdapter to create
+ * tutorial-style pages for apps.
+ */
+public class SimpleTextFragment extends Fragment {
+
+    // Contains the text that will be displayed by this Fragment
+    String mText;
+
+    // Contains a resource ID for the text that will be displayed by this fragment.
+    int mTextId = -1;
+
+    // Keys which will be used to store/retrieve text passed in via setArguments.
+    public static final String TEXT_KEY = "text";
+    public static final String TEXT_ID_KEY = "text_id";
+
+    // For situations where the app wants to modify text at Runtime, exposing the TextView.
+    private TextView mTextView;
+
+    public SimpleTextFragment() {
+    }
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        // Before initializing the textView, check if any arguments were provided via setArguments.
+        processArguments();
+
+        // Create a new TextView and set its text to whatever was provided.
+        mTextView = new TextView(getActivity());
+        mTextView.setGravity(Gravity.CENTER);
+
+        if (mText != null) {
+            mTextView.setText(mText);
+            Log.i("SimpleTextFragment", mText);
+        }
+        return mTextView;
+    }
+
+    public TextView getTextView() {
+        return mTextView;
+    }
+
+    /**
+     * Changes the text for this TextView, according to the resource ID provided.
+     * @param stringId A resource ID representing the text content for this Fragment's TextView.
+     */
+    public void setText(int stringId) {
+        getTextView().setText(getActivity().getString(stringId));
+    }
+
+    /**
+     * Processes the arguments passed into this Fragment via setArguments method.
+     * Currently the method only looks for text or a textID, nothing else.
+     */
+    public void processArguments() {
+        // For most objects we'd handle the multiple possibilities for initialization variables
+        // as multiple constructors.  For Fragments, however, it's customary to use
+        // setArguments / getArguments.
+        if (getArguments() != null) {
+            Bundle args = getArguments();
+            if (args.containsKey(TEXT_KEY)) {
+                mText = args.getString(TEXT_KEY);
+                Log.d("Constructor", "Added Text.");
+            } else if (args.containsKey(TEXT_ID_KEY)) {
+                mTextId = args.getInt(TEXT_ID_KEY);
+                mText = getString(mTextId);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/Log.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/Log.java
new file mode 100644
index 0000000..cf4abb7
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/Log.java
@@ -0,0 +1,236 @@
+/*
+ * Copyright (C) 2013 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.common.logger;
+
+/**
+ * Helper class for a list (or tree) of LoggerNodes.
+ *
+ * <p>When this is set as the head of the list,
+ * an instance of it can function as a drop-in replacement for {@link android.util.Log}.
+ * Most of the methods in this class server only to map a method call in Log to its equivalent
+ * in LogNode.</p>
+ */
+public class Log {
+    // Grabbing the native values from Android's native logging facilities,
+    // to make for easy migration and interop.
+    public static final int NONE = -1;
+    public static final int VERBOSE = android.util.Log.VERBOSE;
+    public static final int DEBUG = android.util.Log.DEBUG;
+    public static final int INFO = android.util.Log.INFO;
+    public static final int WARN = android.util.Log.WARN;
+    public static final int ERROR = android.util.Log.ERROR;
+    public static final int ASSERT = android.util.Log.ASSERT;
+
+    // Stores the beginning of the LogNode topology.
+    private static LogNode mLogNode;
+
+    /**
+     * Returns the next LogNode in the linked list.
+     */
+    public static LogNode getLogNode() {
+        return mLogNode;
+    }
+
+    /**
+     * Sets the LogNode data will be sent to.
+     */
+    public static void setLogNode(LogNode node) {
+        mLogNode = node;
+    }
+
+    /**
+     * Instructs the LogNode to print the log data provided. Other LogNodes can
+     * be chained to the end of the LogNode as desired.
+     *
+     * @param priority Log level of the data being logged. Verbose, Error, etc.
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void println(int priority, String tag, String msg, Throwable tr) {
+        if (mLogNode != null) {
+            mLogNode.println(priority, tag, msg, tr);
+        }
+    }
+
+    /**
+     * Instructs the LogNode to print the log data provided. Other LogNodes can
+     * be chained to the end of the LogNode as desired.
+     *
+     * @param priority Log level of the data being logged. Verbose, Error, etc.
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged. The actual message to be logged.
+     */
+    public static void println(int priority, String tag, String msg) {
+        println(priority, tag, msg, null);
+    }
+
+   /**
+     * Prints a message at VERBOSE priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void v(String tag, String msg, Throwable tr) {
+        println(VERBOSE, tag, msg, tr);
+    }
+
+    /**
+     * Prints a message at VERBOSE priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     */
+    public static void v(String tag, String msg) {
+        v(tag, msg, null);
+    }
+
+
+    /**
+     * Prints a message at DEBUG priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void d(String tag, String msg, Throwable tr) {
+        println(DEBUG, tag, msg, tr);
+    }
+
+    /**
+     * Prints a message at DEBUG priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     */
+    public static void d(String tag, String msg) {
+        d(tag, msg, null);
+    }
+
+    /**
+     * Prints a message at INFO priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void i(String tag, String msg, Throwable tr) {
+        println(INFO, tag, msg, tr);
+    }
+
+    /**
+     * Prints a message at INFO priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     */
+    public static void i(String tag, String msg) {
+        i(tag, msg, null);
+    }
+
+    /**
+     * Prints a message at WARN priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void w(String tag, String msg, Throwable tr) {
+        println(WARN, tag, msg, tr);
+    }
+
+    /**
+     * Prints a message at WARN priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     */
+    public static void w(String tag, String msg) {
+        w(tag, msg, null);
+    }
+
+    /**
+     * Prints a message at WARN priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void w(String tag, Throwable tr) {
+        w(tag, null, tr);
+    }
+
+    /**
+     * Prints a message at ERROR priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void e(String tag, String msg, Throwable tr) {
+        println(ERROR, tag, msg, tr);
+    }
+
+    /**
+     * Prints a message at ERROR priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     */
+    public static void e(String tag, String msg) {
+        e(tag, msg, null);
+    }
+
+    /**
+     * Prints a message at ASSERT priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void wtf(String tag, String msg, Throwable tr) {
+        println(ASSERT, tag, msg, tr);
+    }
+
+    /**
+     * Prints a message at ASSERT priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     */
+    public static void wtf(String tag, String msg) {
+        wtf(tag, msg, null);
+    }
+
+    /**
+     * Prints a message at ASSERT priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void wtf(String tag, Throwable tr) {
+        wtf(tag, null, tr);
+    }
+}
\ No newline at end of file
diff --git a/common/src/java/com/example/android/common/logger/LogNode.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogNode.java
similarity index 100%
copy from common/src/java/com/example/android/common/logger/LogNode.java
copy to connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogNode.java
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogView.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogView.java
new file mode 100644
index 0000000..953b8b1
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogView.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2013 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.common.logger;
+
+import android.content.Context;
+import android.util.*;
+import android.widget.TextView;
+
+/** Simple TextView which is used to output log data received through the LogNode interface.
+*/
+public class LogView extends TextView implements LogNode {
+
+    public LogView(Context context) {
+        super(context);
+    }
+
+    public LogView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public LogView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    /**
+     * Formats the log data and prints it out to the LogView.
+     * @param priority Log level of the data being logged.  Verbose, Error, etc.
+     * @param tag Tag for for the log data.  Can be used to organize log statements.
+     * @param msg The actual message to be logged. The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    @Override
+    public void println(int priority, String tag, String msg, Throwable tr) {
+        String priorityStr = null;
+
+        // For the purposes of this View, we want to print the priority as readable text.
+        switch(priority) {
+            case android.util.Log.VERBOSE:
+                priorityStr = "VERBOSE";
+                break;
+            case android.util.Log.DEBUG:
+                priorityStr = "DEBUG";
+                break;
+            case android.util.Log.INFO:
+                priorityStr = "INFO";
+                break;
+            case android.util.Log.WARN:
+                priorityStr = "WARN";
+                break;
+            case android.util.Log.ERROR:
+                priorityStr = "ERROR";
+                break;
+            case android.util.Log.ASSERT:
+                priorityStr = "ASSERT";
+                break;
+            default:
+                break;
+        }
+
+        // Handily, the Log class has a facility for converting a stack trace into a usable string.
+        String exceptionStr = null;
+        if (tr != null) {
+            exceptionStr = android.util.Log.getStackTraceString(tr);
+        }
+
+        // Take the priority, tag, message, and exception, and concatenate as necessary
+        // into one usable line of text.
+        StringBuilder outputBuilder = new StringBuilder();
+
+        String delimiter = "\t";
+        appendIfNotNull(outputBuilder, priorityStr, delimiter);
+        appendIfNotNull(outputBuilder, tag, delimiter);
+        appendIfNotNull(outputBuilder, msg, delimiter);
+        appendIfNotNull(outputBuilder, exceptionStr, delimiter);
+
+        // Actually display the text we just generated within the LogView.
+        appendToLog(outputBuilder.toString());
+
+        if (mNext != null) {
+            mNext.println(priority, tag, msg, tr);
+        }
+    }
+
+    public LogNode getNext() {
+        return mNext;
+    }
+
+    public void setNext(LogNode node) {
+        mNext = node;
+    }
+
+    /** Takes a string and adds to it, with a separator, if the bit to be added isn't null. Since
+     * the logger takes so many arguments that might be null, this method helps cut out some of the
+     * agonizing tedium of writing the same 3 lines over and over.
+     * @param source StringBuilder containing the text to append to.
+     * @param addStr The String to append
+     * @param delimiter The String to separate the source and appended strings. A tab or comma,
+     *                  for instance.
+     * @return The fully concatenated String as a StringBuilder
+     */
+    private StringBuilder appendIfNotNull(StringBuilder source, String addStr, String delimiter) {
+        if (addStr != null) {
+            if (addStr.length() == 0) {
+                delimiter = "";
+            }
+
+            return source.append(addStr).append(delimiter);
+        }
+        return source;
+    }
+
+    // The next LogNode in the chain.
+    LogNode mNext;
+
+    /** Outputs the string as a new line of log data in the LogView. */
+    public void appendToLog(String s) {
+        append("\n" + s);
+    }
+}
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogWrapper.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogWrapper.java
new file mode 100644
index 0000000..ea8e20e
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/LogWrapper.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2012 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.common.logger;
+
+import android.util.Log;
+
+/**
+ * Helper class which wraps Android's native Log utility in the Logger interface.  This way
+ * normal DDMS output can be one of the many targets receiving and outputting logs simultaneously.
+ */
+public class LogWrapper implements LogNode {
+
+    // For piping:  The next node to receive Log data after this one has done its work.
+    private LogNode mNext;
+
+    /**
+     * Returns the next LogNode in the linked list.
+     */
+    public LogNode getNext() {
+        return mNext;
+    }
+
+    /**
+     * Sets the LogNode data will be sent to..
+     */
+    public void setNext(LogNode node) {
+        mNext = node;
+    }
+
+    /**
+     * Prints data out to the console using Android's native log mechanism.
+     * @param priority Log level of the data being logged.  Verbose, Error, etc.
+     * @param tag Tag for for the log data.  Can be used to organize log statements.
+     * @param msg The actual message to be logged. The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    @Override
+    public void println(int priority, String tag, String msg, Throwable tr) {
+        // There actually are log methods that don't take a msg parameter.  For now,
+        // if that's the case, just convert null to the empty string and move on.
+        String useMsg = msg;
+        if (useMsg == null) {
+            useMsg = "";
+        }
+
+        // If an exeption was provided, convert that exception to a usable string and attach
+        // it to the end of the msg method.
+        if (tr != null) {
+            msg += "\n" + Log.getStackTraceString(tr);
+        }
+
+        // This is functionally identical to Log.x(tag, useMsg);
+        // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg)
+        Log.println(priority, tag, useMsg);
+
+        // If this isn't the last node in the chain, move things along.
+        if (mNext != null) {
+            mNext.println(priority, tag, msg, tr);
+        }
+    }
+}
\ No newline at end of file
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java
new file mode 100644
index 0000000..c57a111
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2013 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.common.logger;
+
+/**
+ * Simple {@link LogNode} filter, removes everything except the message.
+ * Useful for situations like on-screen log output where you don't want a lot of metadata displayed,
+ * just easy-to-read message updates as they're happening.
+ */
+public class MessageOnlyLogFilter implements LogNode {
+
+    LogNode mNext;
+
+    /**
+     * Takes the "next" LogNode as a parameter, to simplify chaining.
+     *
+     * @param next The next LogNode in the pipeline.
+     */
+    public MessageOnlyLogFilter(LogNode next) {
+        mNext = next;
+    }
+
+    public MessageOnlyLogFilter() {
+    }
+
+    @Override
+    public void println(int priority, String tag, String msg, Throwable tr) {
+        if (mNext != null) {
+            getNext().println(Log.NONE, null, msg, null);
+        }
+    }
+
+    /**
+     * Returns the next LogNode in the linked list.
+     */
+    public LogNode getNext() {
+        return mNext;
+    }
+
+    /**
+     * Sets the LogNode data will be sent to..
+     */
+    public void setNext(LogNode node) {
+        mNext = node;
+    }
+
+}
\ No newline at end of file
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/networkbasic/LogFragment.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/networkbasic/LogFragment.java
new file mode 100644
index 0000000..ecbe2eb
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/networkbasic/LogFragment.java
@@ -0,0 +1,60 @@
+package com.example.android.networkbasic;
+
+import android.support.v4.app.Fragment;
+
+import com.example.android.networkbasic.R;
+import com.example.android.common.logger.LogView;
+
+import android.os.Bundle;
+
+import android.text.Editable;
+import android.text.TextWatcher;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ScrollView;
+
+/**
+ * Simple fragment that contains a LogView and uses it to output log data it receives
+ * through the LogNode interface.
+ */
+public class LogFragment extends Fragment {
+
+  private LogView mLogView;
+
+  public LogFragment() {}
+
+  @Override
+  public View onCreateView(LayoutInflater inflater, ViewGroup container,
+          Bundle savedInstanceState) {
+
+      View result = inflater.inflate(R.layout.log_fragment, container, false);
+
+      mLogView = (LogView) result.findViewById(R.id.sample_output);
+
+      // Wire up so when the text changes, the view scrolls down.
+      final ScrollView scrollView =
+              ((ScrollView) result.findViewById(R.id.log_scroll));
+
+      mLogView.addTextChangedListener(new TextWatcher() {
+          @Override
+          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
+
+          @Override
+          public void onTextChanged(CharSequence s, int start, int before, int count) {}
+
+          @Override
+          public void afterTextChanged(Editable s) {
+              scrollView.fullScroll(ScrollView.FOCUS_DOWN);
+          }
+      });
+
+      return result;
+  }
+
+  public LogView getLogView() {
+      return mLogView;
+  }
+
+}
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/networkbasic/MainActivity.java b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/networkbasic/MainActivity.java
new file mode 100755
index 0000000..c2a4305
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/java/com/example/android/networkbasic/MainActivity.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2013 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.networkbasic;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+import android.util.TypedValue;
+import android.view.Menu;
+import android.view.MenuItem;
+
+import com.example.android.common.SimpleTextFragment;
+import com.example.android.common.logger.Log;
+import com.example.android.common.logger.LogWrapper;
+import com.example.android.common.logger.MessageOnlyLogFilter;
+
+/**
+ * Sample application demonstrating how to test whether a device is connected,
+ * and if so, whether the connection happens to be wifi or mobile (it could be
+ * something else).
+ *
+ * This sample uses the logging framework to display log output in the log
+ * fragment (LogFragment).
+ */
+public class MainActivity extends FragmentActivity {
+
+    public static final String TAG = "Basic Network Demo";
+    // Whether there is a Wi-Fi connection.
+    private static boolean wifiConnected = false;
+    // Whether there is a mobile connection.
+    private static boolean mobileConnected = false;
+
+    // Reference to the fragment showing events, so we can clear it with a button
+    // as necessary.
+    private LogFragment mLogFragment;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_main);
+
+        // Initialize text fragment that displays intro text.
+        SimpleTextFragment introFragment = (SimpleTextFragment)
+                    getSupportFragmentManager().findFragmentById(R.id.intro_fragment);
+        introFragment.setText(R.string.intro_message);
+        introFragment.getTextView().setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16.0f);
+
+        // Initialize the logging framework.
+        initializeLogging();
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        getMenuInflater().inflate(R.menu.main, menu);
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            // When the user clicks TEST, display the connection status.
+            case R.id.test_action:
+                checkNetworkConnection();
+                return true;
+            // Clear the log view fragment.
+            case R.id.clear_action:
+                mLogFragment.getLogView().setText("");
+                return true;
+        }
+        return false;
+    }
+
+    /**
+     * Check whether the device is connected, and if so, whether the connection
+     * is wifi or mobile (it could be something else).
+     */
+    private void checkNetworkConnection() {
+      // BEGIN_INCLUDE(connect)
+      ConnectivityManager connMgr =
+          (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
+      NetworkInfo activeInfo = connMgr.getActiveNetworkInfo();
+      if (activeInfo != null && activeInfo.isConnected()) {
+          wifiConnected = activeInfo.getType() == ConnectivityManager.TYPE_WIFI;
+          mobileConnected = activeInfo.getType() == ConnectivityManager.TYPE_MOBILE;
+          if(wifiConnected) {
+              Log.i(TAG, getString(R.string.wifi_connection));
+          } else if (mobileConnected){
+              Log.i(TAG, getString(R.string.mobile_connection));
+          }
+      } else {
+          Log.i(TAG, getString(R.string.no_wifi_or_mobile));
+      }
+      // END_INCLUDE(connect)
+    }
+
+    /** Create a chain of targets that will receive log data */
+    public void initializeLogging() {
+
+        // Using Log, front-end to the logging chain, emulates
+        // android.util.log method signatures.
+
+        // Wraps Android's native log framework
+        LogWrapper logWrapper = new LogWrapper();
+        Log.setLogNode(logWrapper);
+
+        // A filter that strips out everything except the message text.
+        MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();
+        logWrapper.setNext(msgFilter);
+
+        // On screen logging via a fragment with a TextView.
+        mLogFragment =
+                (LogFragment) getSupportFragmentManager().findFragmentById(R.id.log_fragment);
+        msgFilter.setNext(mLogFragment.getLogView());
+    }
+}
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-hdpi/ic_launcher.png b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-hdpi/ic_launcher.png
similarity index 100%
rename from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-hdpi/ic_launcher.png
rename to connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-mdpi/ic_launcher.png b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-mdpi/ic_launcher.png
similarity index 100%
rename from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-mdpi/ic_launcher.png
rename to connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-xhdpi/ic_launcher.png b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-xhdpi/ic_launcher.png
similarity index 100%
rename from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-xhdpi/ic_launcher.png
rename to connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-xxhdpi/ic_launcher.png b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-xxhdpi/ic_launcher.png
similarity index 100%
rename from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/drawable-xxhdpi/ic_launcher.png
rename to connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/layout/activity_main.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/layout/activity_main.xml
new file mode 100755
index 0000000..d9be686
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/layout/activity_main.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Copyright 2013 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">
+    <fragment
+        android:name="com.example.android.common.SimpleTextFragment"
+        android:id="@+id/intro_fragment"
+        android:layout_weight="1"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
+    <View
+        android:layout_width="fill_parent"
+        android:layout_height="1dp"
+        android:background="@android:color/darker_gray"/>
+    <fragment
+        android:name="com.example.android.networkbasic.LogFragment"
+        android:id="@+id/log_fragment"
+        android:layout_weight="1"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
+</LinearLayout>
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/layout/log_fragment.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/layout/log_fragment.xml
new file mode 100644
index 0000000..6d79548
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/layout/log_fragment.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Copyright 2013 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.
+  -->
+
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/log_scroll"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <com.example.android.common.logger.LogView
+        android:id="@+id/sample_output"
+        style="@style/Log"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:clickable="true"
+        android:focusable="true"
+        android:text=""
+        android:gravity="bottom" />
+</ScrollView>
\ No newline at end of file
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/menu/main.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/menu/main.xml
similarity index 100%
rename from connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/menu/main.xml
rename to connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/menu/main.xml
diff --git a/background/alarms/repeatingAlarm/Scheduler/res/values-sw600dp/styles.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values-sw600dp/styles.xml
similarity index 100%
rename from background/alarms/repeatingAlarm/Scheduler/res/values-sw600dp/styles.xml
rename to connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values-sw600dp/styles.xml
diff --git a/background/alarms/repeatingAlarm/Scheduler/res/values-v11/styles.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values-v11/styles.xml
similarity index 100%
rename from background/alarms/repeatingAlarm/Scheduler/res/values-v11/styles.xml
rename to connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values-v11/styles.xml
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/dimens.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..4f69897
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/dimens.xml
@@ -0,0 +1,24 @@
+<!--
+  Copyright 2013 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>
+
+    <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+    <dimen name="margin_medium">16dp</dimen>
+    <dimen name="margin_huge">64dp</dimen>
+
+</resources>
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/strings.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/strings.xml
new file mode 100755
index 0000000..d8116aa
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/strings.xml
@@ -0,0 +1,29 @@
+<!--
+  Copyright 2013 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="app_name">Basic Network Demo</string>
+
+    <string name="intro_message">Welcome to Basic Network Demo!
+        Click TEST to find out whether your device has a network connection, and if so, what type it is.
+    </string>
+
+    <string name="test_text">Test</string>
+    <string name="clear_text">Clear</string>
+    <string name="wifi_connection">The active connection is wifi.</string>
+    <string name="mobile_connection">The active connection is mobile.</string>
+    <string name="no_wifi_or_mobile">No wireless or mobile connection.</string>
+</resources>
diff --git a/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/styles.xml b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/styles.xml
new file mode 100644
index 0000000..4d9bb98
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/BasicNetworkDemo/src/main/res/values/styles.xml
@@ -0,0 +1,40 @@
+<!--
+  Copyright 2013 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 thegi 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>
+
+    <!-- Activity themes -->
+
+    <style name="Theme.Base" parent="android:Theme.Light" />
+
+    <style name="Theme.Sample" parent="Theme.Base" />
+
+    <!-- Widget styling -->
+
+    <style name="Widget" />
+
+    <style name="Widget.SampleOutput">
+        <item name="android:padding">@dimen/margin_medium</item>
+        <item name="android:textAppearance">?android:textAppearanceMedium</item>
+        <item name="android:lineSpacingMultiplier">1.1</item>
+    </style>
+
+    <style name="Log" parent="Widget.SampleOutput">
+        <item name="android:typeface">monospace</item>
+    </style>
+
+
+</resources>
diff --git a/connectivity/network/BasicNetworkDemo/README.txt b/connectivity/network/BasicNetworkDemo/README.txt
new file mode 100644
index 0000000..38608df
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/README.txt
@@ -0,0 +1,6 @@
+Build Instructions
+-------------------
+This sample uses the Gradle build system. To build this project, use the
+"gradlew build" command.
+
+To see a list of all available commands, run "gradlew tasks".
\ No newline at end of file
diff --git a/connectivity/network/BasicNetworkDemo/build.gradle b/connectivity/network/BasicNetworkDemo/build.gradle
new file mode 100644
index 0000000..036abc8
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/build.gradle
@@ -0,0 +1,8 @@
+buildscript {
+    repositories {
+        mavenCentral()
+    }
+    dependencies {
+        classpath 'com.android.tools.build:gradle:0.5.+'
+    }
+}
diff --git a/connectivity/network/BasicNetworking/gradle/wrapper/gradle-wrapper.jar b/connectivity/network/BasicNetworkDemo/gradle/wrapper/gradle-wrapper.jar
similarity index 100%
rename from connectivity/network/BasicNetworking/gradle/wrapper/gradle-wrapper.jar
rename to connectivity/network/BasicNetworkDemo/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/connectivity/network/BasicNetworkDemo/gradle/wrapper/gradle-wrapper.properties b/connectivity/network/BasicNetworkDemo/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..055ba6f
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+#
+#Mon Jul 22 11:40:20 PDT 2013
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
diff --git a/connectivity/network/BasicNetworking/gradlew b/connectivity/network/BasicNetworkDemo/gradlew
similarity index 100%
rename from connectivity/network/BasicNetworking/gradlew
rename to connectivity/network/BasicNetworkDemo/gradlew
diff --git a/connectivity/network/BasicNetworking/gradlew.bat b/connectivity/network/BasicNetworkDemo/gradlew.bat
similarity index 100%
rename from connectivity/network/BasicNetworking/gradlew.bat
rename to connectivity/network/BasicNetworkDemo/gradlew.bat
diff --git a/connectivity/network/BasicNetworkDemo/settings.gradle b/connectivity/network/BasicNetworkDemo/settings.gradle
new file mode 100644
index 0000000..4981654
--- /dev/null
+++ b/connectivity/network/BasicNetworkDemo/settings.gradle
@@ -0,0 +1 @@
+include ':BasicNetworkDemo'
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/.gitignore b/connectivity/network/BasicNetworking/BasicNetworkingSample/.gitignore
deleted file mode 100644
index 6eb878d..0000000
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/.gitignore
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2013 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.
-src/template/
-src/common/
-build.gradle
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/proguard-project.txt b/connectivity/network/BasicNetworking/BasicNetworkingSample/proguard-project.txt
deleted file mode 100644
index 0d8f171..0000000
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/proguard-project.txt
+++ /dev/null
@@ -1,20 +0,0 @@
- To enable ProGuard in your project, edit project.properties
-# to define the proguard.config property as described in that file.
-#
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in ${sdk.dir}/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the ProGuard
-# include property in project.properties.
-#
-# For more details, see
-#   http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-#   public *;
-#}
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/AndroidManifest.xml b/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/AndroidManifest.xml
deleted file mode 100644
index 48bfeac..0000000
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<!--
-  Copyright 2013 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.basicnetworking"
-    android:versionCode="1"
-    android:versionName="1.0">
-
-    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
-    <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-
-    <application
-        android:label="@string/app_name"
-        android:icon="@drawable/ic_launcher"
-        android:theme="@style/Theme.Sample"
-        android:allowBackup="true">
-
-        <activity
-            android:name="com.example.android.basicnetworking.MainActivity"
-            android:label="@string/app_name"
-            android:uiOptions="splitActionBarWhenNarrow">
-
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-</manifest>
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/java/com/example/android/basicnetworking/MainActivity.java b/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/java/com/example/android/basicnetworking/MainActivity.java
deleted file mode 100755
index 39ed4b1..0000000
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/java/com/example/android/basicnetworking/MainActivity.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright 2013 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.basicnetworking;
-
-import android.content.Context;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-import android.util.TypedValue;
-import android.view.Menu;
-import android.view.MenuItem;
-
-import com.example.android.common.logger.Log;
-import com.example.android.common.logger.LogFragment;
-import com.example.android.common.logger.LogWrapper;
-import com.example.android.common.logger.MessageOnlyLogFilter;
-
-/**
- * Sample application demonstrating how to test whether a device is connected,
- * and if so, whether the connection happens to be wifi or mobile (it could be
- * something else).
- *
- * This sample uses the logging framework to display log output in the log
- * fragment (LogFragment).
- */
-public class MainActivity extends FragmentActivity {
-
-    public static final String TAG = "Basic Network Demo";
-    // Whether there is a Wi-Fi connection.
-    private static boolean wifiConnected = false;
-    // Whether there is a mobile connection.
-    private static boolean mobileConnected = false;
-
-    // Reference to the fragment showing events, so we can clear it with a button
-    // as necessary.
-    private LogFragment mLogFragment;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.sample_main);
-
-        // Initialize text fragment that displays intro text.
-        SimpleTextFragment introFragment = (SimpleTextFragment)
-                    getSupportFragmentManager().findFragmentById(R.id.intro_fragment);
-        introFragment.setText(R.string.intro_message);
-        introFragment.getTextView().setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16.0f);
-
-        // Initialize the logging framework.
-        initializeLogging();
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        getMenuInflater().inflate(R.menu.main, menu);
-        return true;
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            // When the user clicks TEST, display the connection status.
-            case R.id.test_action:
-                checkNetworkConnection();
-                return true;
-            // Clear the log view fragment.
-            case R.id.clear_action:
-                mLogFragment.getLogView().setText("");
-                return true;
-        }
-        return false;
-    }
-
-    /**
-     * Check whether the device is connected, and if so, whether the connection
-     * is wifi or mobile (it could be something else).
-     */
-    private void checkNetworkConnection() {
-      // BEGIN_INCLUDE(connect)
-      ConnectivityManager connMgr =
-          (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
-      NetworkInfo activeInfo = connMgr.getActiveNetworkInfo();
-      if (activeInfo != null && activeInfo.isConnected()) {
-          wifiConnected = activeInfo.getType() == ConnectivityManager.TYPE_WIFI;
-          mobileConnected = activeInfo.getType() == ConnectivityManager.TYPE_MOBILE;
-          if(wifiConnected) {
-              Log.i(TAG, getString(R.string.wifi_connection));
-          } else if (mobileConnected){
-              Log.i(TAG, getString(R.string.mobile_connection));
-          }
-      } else {
-          Log.i(TAG, getString(R.string.no_wifi_or_mobile));
-      }
-      // END_INCLUDE(connect)
-    }
-
-    /** Create a chain of targets that will receive log data */
-    public void initializeLogging() {
-
-        // Using Log, front-end to the logging chain, emulates
-        // android.util.log method signatures.
-
-        // Wraps Android's native log framework
-        LogWrapper logWrapper = new LogWrapper();
-        Log.setLogNode(logWrapper);
-
-        // A filter that strips out everything except the message text.
-        MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();
-        logWrapper.setNext(msgFilter);
-
-        // On screen logging via a fragment with a TextView.
-        mLogFragment =
-                (LogFragment) getSupportFragmentManager().findFragmentById(R.id.log_fragment);
-        msgFilter.setNext(mLogFragment.getLogView());
-    }
-}
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/java/com/example/android/basicnetworking/SimpleTextFragment.java b/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/java/com/example/android/basicnetworking/SimpleTextFragment.java
deleted file mode 100644
index c6d409c..0000000
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/java/com/example/android/basicnetworking/SimpleTextFragment.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2013 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.basicnetworking;
-
-import android.os.Bundle;
-
-import android.support.v4.app.Fragment;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-/**
- * Simple fragment containing only a TextView. Used by TextPagerAdapter to create
- * tutorial-style pages for apps.
- */
-public class SimpleTextFragment extends Fragment {
-
-    // Contains the text that will be displayed by this Fragment
-    String mText;
-
-    // Contains a resource ID for the text that will be displayed by this fragment.
-    int mTextId = -1;
-
-    // Keys which will be used to store/retrieve text passed in via setArguments.
-    public static final String TEXT_KEY = "text";
-    public static final String TEXT_ID_KEY = "text_id";
-
-    // For situations where the app wants to modify text at Runtime, exposing the TextView.
-    private TextView mTextView;
-
-    public SimpleTextFragment() {
-    }
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
-        // Before initializing the textView, check if any arguments were provided via setArguments.
-        processArguments();
-
-        // Create a new TextView and set its text to whatever was provided.
-        mTextView = new TextView(getActivity());
-        mTextView.setGravity(Gravity.CENTER);
-
-        if (mText != null) {
-            mTextView.setText(mText);
-            Log.i("SimpleTextFragment", mText);
-        }
-        return mTextView;
-    }
-
-    public TextView getTextView() {
-        return mTextView;
-    }
-
-    /**
-     * Changes the text for this TextView, according to the resource ID provided.
-     * @param stringId A resource ID representing the text content for this Fragment's TextView.
-     */
-    public void setText(int stringId) {
-        getTextView().setText(getActivity().getString(stringId));
-    }
-
-    /**
-     * Processes the arguments passed into this Fragment via setArguments method.
-     * Currently the method only looks for text or a textID, nothing else.
-     */
-    public void processArguments() {
-        // For most objects we'd handle the multiple possibilities for initialization variables
-        // as multiple constructors.  For Fragments, however, it's customary to use
-        // setArguments / getArguments.
-        if (getArguments() != null) {
-            Bundle args = getArguments();
-            if (args.containsKey(TEXT_KEY)) {
-                mText = args.getString(TEXT_KEY);
-                Log.d("Constructor", "Added Text.");
-            } else if (args.containsKey(TEXT_ID_KEY)) {
-                mTextId = args.getInt(TEXT_ID_KEY);
-                mText = getString(mTextId);
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/layout/sample_main.xml b/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/layout/sample_main.xml
deleted file mode 100755
index ccbe6ae..0000000
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/layout/sample_main.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-  Copyright 2013 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">
-    <fragment
-        android:name="com.example.android.basicnetworking.SimpleTextFragment"
-        android:id="@+id/intro_fragment"
-        android:layout_weight="1"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent" />
-    <View
-        android:layout_width="fill_parent"
-        android:layout_height="1dp"
-        android:background="@android:color/darker_gray"/>
-    <fragment
-        android:name="com.example.android.common.logger.LogFragment"
-        android:id="@+id/log_fragment"
-        android:layout_weight="1"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent" />
-</LinearLayout>
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/values/strings.xml b/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/values/strings.xml
deleted file mode 100755
index d39460a..0000000
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<!--
-  Copyright 2013 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="test_text">Test</string>
-    <string name="clear_text">Clear</string>
-    <string name="wifi_connection">The active connection is wifi.</string>
-    <string name="mobile_connection">The active connection is mobile.</string>
-    <string name="no_wifi_or_mobile">No wireless or mobile connection.</string>
-</resources>
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/values/styles.xml b/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/values/styles.xml
deleted file mode 100644
index 3450a54..0000000
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<!--
-  Copyright 2013 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 thegi 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>
-
-    <!-- Widget styling -->
-
-    <style name="Widget.SampleOutput">
-        <item name="android:padding">@dimen/margin_medium</item>
-        <item name="android:textAppearance">?android:textAppearanceMedium</item>
-        <item name="android:lineSpacingMultiplier">1.1</item>
-    </style>
-
-    <style name="Log" parent="Widget.SampleOutput">
-        <item name="android:typeface">monospace</item>
-    </style>
-
-
-</resources>
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/tests/AndroidManifest.xml b/connectivity/network/BasicNetworking/BasicNetworkingSample/tests/AndroidManifest.xml
deleted file mode 100644
index 293c16b..0000000
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/tests/AndroidManifest.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  Copyright (C) 2013 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 name must be unique so suffix with "tests" so package loader doesn't ignore us -->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.example.android.basicnetworking.tests"
-          android:versionCode="1"
-          android:versionName="1.0">
-
-    <uses-sdk
-            android:minSdkVersion="18"
-            android:targetSdkVersion="19" />
-
-    <!-- We add an application tag here just so that we can indicate that
-         this package needs to link against the android.test library,
-         which is needed when building test cases. -->
-    <application>
-        <uses-library android:name="android.test.runner" />
-    </application>
-
-    <!--
-    Specifies the instrumentation test runner used to run the tests.
-    -->
-    <instrumentation
-            android:name="android.test.InstrumentationTestRunner"
-            android:targetPackage="com.example.android.basicnetworking"
-            android:label="Tests for com.example.android.basicnetworking" />
-
-</manifest>
\ No newline at end of file
diff --git a/connectivity/network/BasicNetworking/BasicNetworkingSample/tests/src/com/example/android/basicnetworking/tests/SampleTests.java b/connectivity/network/BasicNetworking/BasicNetworkingSample/tests/src/com/example/android/basicnetworking/tests/SampleTests.java
deleted file mode 100644
index 0cf077e..0000000
--- a/connectivity/network/BasicNetworking/BasicNetworkingSample/tests/src/com/example/android/basicnetworking/tests/SampleTests.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-* Copyright 2013 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) 2013 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.basicnetworking.tests;
-
-import com.example.android.basicnetworking.*;
-
-import android.test.ActivityInstrumentationTestCase2;
-
-/**
-* Tests for BasicNetworking sample.
-*/
-public class SampleTests extends ActivityInstrumentationTestCase2<MainActivity> {
-
-    private MainActivity mTestActivity;
-    private BasicNetworkingFragment mTestFragment;
-
-    public SampleTests() {
-        super(MainActivity.class);
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        // Starts the activity under test using the default Intent with:
-        // action = {@link Intent#ACTION_MAIN}
-        // flags = {@link Intent#FLAG_ACTIVITY_NEW_TASK}
-        // All other fields are null or empty.
-        mTestActivity = getActivity();
-        mTestFragment = (BasicNetworkingFragment)
-            mTestActivity.getSupportFragmentManager().getFragments().get(1);
-    }
-
-    /**
-    * Test if the test fixture has been set up correctly.
-    */
-    public void testPreconditions() {
-        //Try to add a message to add context to your assertions. These messages will be shown if
-        //a tests fails and make it easy to understand why a test failed
-        assertNotNull("mTestActivity is null", mTestActivity);
-        assertNotNull("mTestFragment is null", mTestFragment);
-    }
-
-    /**
-    * Add more tests below.
-    */
-
-}
\ No newline at end of file
diff --git a/connectivity/network/BasicNetworking/build.gradle b/connectivity/network/BasicNetworking/build.gradle
deleted file mode 100644
index cca9ac3..0000000
--- a/connectivity/network/BasicNetworking/build.gradle
+++ /dev/null
@@ -1,10 +0,0 @@
-// BEGIN_EXCLUDE
-import com.example.android.samples.build.SampleGenPlugin
-apply plugin: SampleGenPlugin
-
-samplegen {
-  pathToBuild "../../../../../build"
-  pathToSamplesCommon "../../../common"
-}
-apply from: "../../../../../build/build.gradle"
-// END_EXCLUDE
diff --git a/connectivity/network/BasicNetworking/buildSrc/build.gradle b/connectivity/network/BasicNetworking/buildSrc/build.gradle
deleted file mode 100644
index e344a8c..0000000
--- a/connectivity/network/BasicNetworking/buildSrc/build.gradle
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-repositories {
-    mavenCentral()
-}
-dependencies {
-    compile 'org.freemarker:freemarker:2.3.20'
-}
-
-sourceSets {
-    main {
-        groovy {
-            srcDir new File(rootDir, "../../../../../../build/buildSrc/src/main/groovy")
-        }
-    }
-}
-
diff --git a/connectivity/network/BasicNetworking/gradle/wrapper/gradle-wrapper.properties b/connectivity/network/BasicNetworking/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 861eddc..0000000
--- a/connectivity/network/BasicNetworking/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
diff --git a/connectivity/network/BasicNetworking/settings.gradle b/connectivity/network/BasicNetworking/settings.gradle
deleted file mode 100644
index 453e7cd..0000000
--- a/connectivity/network/BasicNetworking/settings.gradle
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-include 'BasicNetworkingSample'
diff --git a/connectivity/network/BasicNetworking/template-params.xml b/connectivity/network/BasicNetworking/template-params.xml
deleted file mode 100644
index 3413740..0000000
--- a/connectivity/network/BasicNetworking/template-params.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2013 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>
-    <name>BasicNetworking</name>
-    <group>Connectivity</group>
-    <package>com.example.android.basicnetworking</package>
-
-    <!-- change minSdk if needed-->
-    <minSdk>4</minSdk>
-
-    <strings>
-        <intro>
-            <![CDATA[
-                This sample demonstrates how to use the ConnectivityManager to determine if you have
-                a network connection, and if so, what type of connection it is.
-                \n\nA "NetworkInfo" object is retrieved from the ConnectivityManager, which contains information
-                on the active connection, and then the connection type is printed to an on-screen console.
-            ]]>
-        </intro>
-    </strings>
-
-    <template src="base"/>
-    <common src="logger"/>
-
-</sample>
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/build.gradle b/connectivity/network/NetworkConnect/NetworkConnect/build.gradle
new file mode 100644
index 0000000..0baece9
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/build.gradle
@@ -0,0 +1,10 @@
+apply plugin: 'android'
+
+dependencies {
+    compile "com.android.support:support-v4:18.0.+"
+}
+
+android {
+    compileSdkVersion 18
+    buildToolsVersion "18.0.0"
+}
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/AndroidManifest.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/AndroidManifest.xml
new file mode 100755
index 0000000..09fd2ee
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/AndroidManifest.xml
@@ -0,0 +1,44 @@
+<!--
+  Copyright 2013 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.networkconnect"
+    android:versionCode="1"
+    android:versionName="1.0">
+
+    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+
+    <application
+        android:label="@string/app_name"
+        android:icon="@drawable/ic_launcher"
+        android:theme="@style/Theme.Sample"
+        android:allowBackup="true">
+
+        <activity
+            android:name="com.example.android.networkconnect.MainActivity"
+            android:label="@string/app_name"
+            android:uiOptions="splitActionBarWhenNarrow">
+
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest>
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/SimpleTextFragment.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/SimpleTextFragment.java
new file mode 100644
index 0000000..a2be93f
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/SimpleTextFragment.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2013 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.common;
+
+import android.os.Bundle;
+
+import android.support.v4.app.Fragment;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+/**
+ * Simple fragment containing only a TextView. Used by TextPagerAdapter to create
+ * tutorial-style pages for apps.
+ */
+public class SimpleTextFragment extends Fragment {
+
+    // Contains the text that will be displayed by this Fragment
+    String mText;
+
+    // Contains a resource ID for the text that will be displayed by this fragment.
+    int mTextId = -1;
+
+    // Keys which will be used to store/retrieve text passed in via setArguments.
+    public static final String TEXT_KEY = "text";
+    public static final String TEXT_ID_KEY = "text_id";
+
+    // For situations where the app wants to modify text at Runtime, exposing the TextView.
+    private TextView mTextView;
+
+    public SimpleTextFragment() {
+    }
+
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        // Before initializing the textView, check if any arguments were provided via setArguments.
+        processArguments();
+
+        // Create a new TextView and set its text to whatever was provided.
+        mTextView = new TextView(getActivity());
+        mTextView.setGravity(Gravity.CENTER);
+
+        if (mText != null) {
+            mTextView.setText(mText);
+            Log.i("SimpleTextFragment", mText);
+        }
+        return mTextView;
+    }
+
+    public TextView getTextView() {
+        return mTextView;
+    }
+
+    /**
+     * Changes the text for this TextView, according to the resource ID provided.
+     * @param stringId A resource ID representing the text content for this Fragment's TextView.
+     */
+    public void setText(int stringId) {
+        getTextView().setText(getActivity().getString(stringId));
+    }
+
+    /**
+     * Processes the arguments passed into this Fragment via setArguments method.
+     * Currently the method only looks for text or a textID, nothing else.
+     */
+    public void processArguments() {
+        // For most objects we'd handle the multiple possibilities for initialization variables
+        // as multiple constructors.  For Fragments, however, it's customary to use
+        // setArguments / getArguments.
+        if (getArguments() != null) {
+            Bundle args = getArguments();
+            if (args.containsKey(TEXT_KEY)) {
+                mText = args.getString(TEXT_KEY);
+                Log.d("Constructor", "Added Text.");
+            } else if (args.containsKey(TEXT_ID_KEY)) {
+                mTextId = args.getInt(TEXT_ID_KEY);
+                mText = getString(mTextId);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/Log.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/Log.java
new file mode 100644
index 0000000..cf4abb7
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/Log.java
@@ -0,0 +1,236 @@
+/*
+ * Copyright (C) 2013 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.common.logger;
+
+/**
+ * Helper class for a list (or tree) of LoggerNodes.
+ *
+ * <p>When this is set as the head of the list,
+ * an instance of it can function as a drop-in replacement for {@link android.util.Log}.
+ * Most of the methods in this class server only to map a method call in Log to its equivalent
+ * in LogNode.</p>
+ */
+public class Log {
+    // Grabbing the native values from Android's native logging facilities,
+    // to make for easy migration and interop.
+    public static final int NONE = -1;
+    public static final int VERBOSE = android.util.Log.VERBOSE;
+    public static final int DEBUG = android.util.Log.DEBUG;
+    public static final int INFO = android.util.Log.INFO;
+    public static final int WARN = android.util.Log.WARN;
+    public static final int ERROR = android.util.Log.ERROR;
+    public static final int ASSERT = android.util.Log.ASSERT;
+
+    // Stores the beginning of the LogNode topology.
+    private static LogNode mLogNode;
+
+    /**
+     * Returns the next LogNode in the linked list.
+     */
+    public static LogNode getLogNode() {
+        return mLogNode;
+    }
+
+    /**
+     * Sets the LogNode data will be sent to.
+     */
+    public static void setLogNode(LogNode node) {
+        mLogNode = node;
+    }
+
+    /**
+     * Instructs the LogNode to print the log data provided. Other LogNodes can
+     * be chained to the end of the LogNode as desired.
+     *
+     * @param priority Log level of the data being logged. Verbose, Error, etc.
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void println(int priority, String tag, String msg, Throwable tr) {
+        if (mLogNode != null) {
+            mLogNode.println(priority, tag, msg, tr);
+        }
+    }
+
+    /**
+     * Instructs the LogNode to print the log data provided. Other LogNodes can
+     * be chained to the end of the LogNode as desired.
+     *
+     * @param priority Log level of the data being logged. Verbose, Error, etc.
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged. The actual message to be logged.
+     */
+    public static void println(int priority, String tag, String msg) {
+        println(priority, tag, msg, null);
+    }
+
+   /**
+     * Prints a message at VERBOSE priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void v(String tag, String msg, Throwable tr) {
+        println(VERBOSE, tag, msg, tr);
+    }
+
+    /**
+     * Prints a message at VERBOSE priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     */
+    public static void v(String tag, String msg) {
+        v(tag, msg, null);
+    }
+
+
+    /**
+     * Prints a message at DEBUG priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void d(String tag, String msg, Throwable tr) {
+        println(DEBUG, tag, msg, tr);
+    }
+
+    /**
+     * Prints a message at DEBUG priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     */
+    public static void d(String tag, String msg) {
+        d(tag, msg, null);
+    }
+
+    /**
+     * Prints a message at INFO priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void i(String tag, String msg, Throwable tr) {
+        println(INFO, tag, msg, tr);
+    }
+
+    /**
+     * Prints a message at INFO priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     */
+    public static void i(String tag, String msg) {
+        i(tag, msg, null);
+    }
+
+    /**
+     * Prints a message at WARN priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void w(String tag, String msg, Throwable tr) {
+        println(WARN, tag, msg, tr);
+    }
+
+    /**
+     * Prints a message at WARN priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     */
+    public static void w(String tag, String msg) {
+        w(tag, msg, null);
+    }
+
+    /**
+     * Prints a message at WARN priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void w(String tag, Throwable tr) {
+        w(tag, null, tr);
+    }
+
+    /**
+     * Prints a message at ERROR priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void e(String tag, String msg, Throwable tr) {
+        println(ERROR, tag, msg, tr);
+    }
+
+    /**
+     * Prints a message at ERROR priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     */
+    public static void e(String tag, String msg) {
+        e(tag, msg, null);
+    }
+
+    /**
+     * Prints a message at ASSERT priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void wtf(String tag, String msg, Throwable tr) {
+        println(ASSERT, tag, msg, tr);
+    }
+
+    /**
+     * Prints a message at ASSERT priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param msg The actual message to be logged.
+     */
+    public static void wtf(String tag, String msg) {
+        wtf(tag, msg, null);
+    }
+
+    /**
+     * Prints a message at ASSERT priority.
+     *
+     * @param tag Tag for for the log data. Can be used to organize log statements.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    public static void wtf(String tag, Throwable tr) {
+        wtf(tag, null, tr);
+    }
+}
\ No newline at end of file
diff --git a/common/src/java/com/example/android/common/logger/LogNode.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogNode.java
similarity index 100%
rename from common/src/java/com/example/android/common/logger/LogNode.java
rename to connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogNode.java
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogView.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogView.java
new file mode 100644
index 0000000..953b8b1
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogView.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2013 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.common.logger;
+
+import android.content.Context;
+import android.util.*;
+import android.widget.TextView;
+
+/** Simple TextView which is used to output log data received through the LogNode interface.
+*/
+public class LogView extends TextView implements LogNode {
+
+    public LogView(Context context) {
+        super(context);
+    }
+
+    public LogView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public LogView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    /**
+     * Formats the log data and prints it out to the LogView.
+     * @param priority Log level of the data being logged.  Verbose, Error, etc.
+     * @param tag Tag for for the log data.  Can be used to organize log statements.
+     * @param msg The actual message to be logged. The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    @Override
+    public void println(int priority, String tag, String msg, Throwable tr) {
+        String priorityStr = null;
+
+        // For the purposes of this View, we want to print the priority as readable text.
+        switch(priority) {
+            case android.util.Log.VERBOSE:
+                priorityStr = "VERBOSE";
+                break;
+            case android.util.Log.DEBUG:
+                priorityStr = "DEBUG";
+                break;
+            case android.util.Log.INFO:
+                priorityStr = "INFO";
+                break;
+            case android.util.Log.WARN:
+                priorityStr = "WARN";
+                break;
+            case android.util.Log.ERROR:
+                priorityStr = "ERROR";
+                break;
+            case android.util.Log.ASSERT:
+                priorityStr = "ASSERT";
+                break;
+            default:
+                break;
+        }
+
+        // Handily, the Log class has a facility for converting a stack trace into a usable string.
+        String exceptionStr = null;
+        if (tr != null) {
+            exceptionStr = android.util.Log.getStackTraceString(tr);
+        }
+
+        // Take the priority, tag, message, and exception, and concatenate as necessary
+        // into one usable line of text.
+        StringBuilder outputBuilder = new StringBuilder();
+
+        String delimiter = "\t";
+        appendIfNotNull(outputBuilder, priorityStr, delimiter);
+        appendIfNotNull(outputBuilder, tag, delimiter);
+        appendIfNotNull(outputBuilder, msg, delimiter);
+        appendIfNotNull(outputBuilder, exceptionStr, delimiter);
+
+        // Actually display the text we just generated within the LogView.
+        appendToLog(outputBuilder.toString());
+
+        if (mNext != null) {
+            mNext.println(priority, tag, msg, tr);
+        }
+    }
+
+    public LogNode getNext() {
+        return mNext;
+    }
+
+    public void setNext(LogNode node) {
+        mNext = node;
+    }
+
+    /** Takes a string and adds to it, with a separator, if the bit to be added isn't null. Since
+     * the logger takes so many arguments that might be null, this method helps cut out some of the
+     * agonizing tedium of writing the same 3 lines over and over.
+     * @param source StringBuilder containing the text to append to.
+     * @param addStr The String to append
+     * @param delimiter The String to separate the source and appended strings. A tab or comma,
+     *                  for instance.
+     * @return The fully concatenated String as a StringBuilder
+     */
+    private StringBuilder appendIfNotNull(StringBuilder source, String addStr, String delimiter) {
+        if (addStr != null) {
+            if (addStr.length() == 0) {
+                delimiter = "";
+            }
+
+            return source.append(addStr).append(delimiter);
+        }
+        return source;
+    }
+
+    // The next LogNode in the chain.
+    LogNode mNext;
+
+    /** Outputs the string as a new line of log data in the LogView. */
+    public void appendToLog(String s) {
+        append("\n" + s);
+    }
+}
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogWrapper.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogWrapper.java
new file mode 100644
index 0000000..ea8e20e
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/LogWrapper.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2012 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.common.logger;
+
+import android.util.Log;
+
+/**
+ * Helper class which wraps Android's native Log utility in the Logger interface.  This way
+ * normal DDMS output can be one of the many targets receiving and outputting logs simultaneously.
+ */
+public class LogWrapper implements LogNode {
+
+    // For piping:  The next node to receive Log data after this one has done its work.
+    private LogNode mNext;
+
+    /**
+     * Returns the next LogNode in the linked list.
+     */
+    public LogNode getNext() {
+        return mNext;
+    }
+
+    /**
+     * Sets the LogNode data will be sent to..
+     */
+    public void setNext(LogNode node) {
+        mNext = node;
+    }
+
+    /**
+     * Prints data out to the console using Android's native log mechanism.
+     * @param priority Log level of the data being logged.  Verbose, Error, etc.
+     * @param tag Tag for for the log data.  Can be used to organize log statements.
+     * @param msg The actual message to be logged. The actual message to be logged.
+     * @param tr If an exception was thrown, this can be sent along for the logging facilities
+     *           to extract and print useful information.
+     */
+    @Override
+    public void println(int priority, String tag, String msg, Throwable tr) {
+        // There actually are log methods that don't take a msg parameter.  For now,
+        // if that's the case, just convert null to the empty string and move on.
+        String useMsg = msg;
+        if (useMsg == null) {
+            useMsg = "";
+        }
+
+        // If an exeption was provided, convert that exception to a usable string and attach
+        // it to the end of the msg method.
+        if (tr != null) {
+            msg += "\n" + Log.getStackTraceString(tr);
+        }
+
+        // This is functionally identical to Log.x(tag, useMsg);
+        // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg)
+        Log.println(priority, tag, useMsg);
+
+        // If this isn't the last node in the chain, move things along.
+        if (mNext != null) {
+            mNext.println(priority, tag, msg, tr);
+        }
+    }
+}
\ No newline at end of file
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java
new file mode 100644
index 0000000..c57a111
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/common/logger/MessageOnlyLogFilter.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2013 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.common.logger;
+
+/**
+ * Simple {@link LogNode} filter, removes everything except the message.
+ * Useful for situations like on-screen log output where you don't want a lot of metadata displayed,
+ * just easy-to-read message updates as they're happening.
+ */
+public class MessageOnlyLogFilter implements LogNode {
+
+    LogNode mNext;
+
+    /**
+     * Takes the "next" LogNode as a parameter, to simplify chaining.
+     *
+     * @param next The next LogNode in the pipeline.
+     */
+    public MessageOnlyLogFilter(LogNode next) {
+        mNext = next;
+    }
+
+    public MessageOnlyLogFilter() {
+    }
+
+    @Override
+    public void println(int priority, String tag, String msg, Throwable tr) {
+        if (mNext != null) {
+            getNext().println(Log.NONE, null, msg, null);
+        }
+    }
+
+    /**
+     * Returns the next LogNode in the linked list.
+     */
+    public LogNode getNext() {
+        return mNext;
+    }
+
+    /**
+     * Sets the LogNode data will be sent to..
+     */
+    public void setNext(LogNode node) {
+        mNext = node;
+    }
+
+}
\ No newline at end of file
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/networkconnect/LogFragment.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/networkconnect/LogFragment.java
new file mode 100644
index 0000000..655d428
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/networkconnect/LogFragment.java
@@ -0,0 +1,60 @@
+package com.example.android.networkconnect;
+
+import android.support.v4.app.Fragment;
+
+import com.example.android.networkconnect.R;
+import com.example.android.common.logger.LogView;
+
+import android.os.Bundle;
+
+import android.text.Editable;
+import android.text.TextWatcher;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ScrollView;
+
+/**
+ * Simple fragment that contains a LogView and uses it to output log data it receives
+ * through the LogNode interface.
+ */
+public class LogFragment extends Fragment {
+
+  private LogView mLogView;
+
+  public LogFragment() {}
+
+  @Override
+  public View onCreateView(LayoutInflater inflater, ViewGroup container,
+          Bundle savedInstanceState) {
+
+      View result = inflater.inflate(R.layout.log_fragment, container, false);
+
+      mLogView = (LogView) result.findViewById(R.id.sample_output);
+
+      // Wire up so when the text changes, the view scrolls down.
+      final ScrollView scrollView =
+              ((ScrollView) result.findViewById(R.id.log_scroll));
+
+      mLogView.addTextChangedListener(new TextWatcher() {
+          @Override
+          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
+
+          @Override
+          public void onTextChanged(CharSequence s, int start, int before, int count) {}
+
+          @Override
+          public void afterTextChanged(Editable s) {
+              scrollView.fullScroll(ScrollView.FOCUS_DOWN);
+          }
+      });
+
+      return result;
+  }
+
+  public LogView getLogView() {
+      return mLogView;
+  }
+
+}
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/networkconnect/MainActivity.java b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/networkconnect/MainActivity.java
new file mode 100755
index 0000000..ae1591d
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/java/com/example/android/networkconnect/MainActivity.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2013 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.networkconnect;
+
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+import android.util.TypedValue;
+import android.view.Menu;
+import android.view.MenuItem;
+
+import com.example.android.common.SimpleTextFragment;
+import com.example.android.common.logger.Log;
+import com.example.android.common.logger.LogWrapper;
+import com.example.android.common.logger.MessageOnlyLogFilter;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+/**
+ * Sample application demonstrating how to connect to the network and fetch raw
+ * HTML. It uses AsyncTask to do the fetch on a background thread. To establish
+ * the network connection, it uses HttpURLConnection.
+ *
+ * This sample uses the logging framework to display log output in the log
+ * fragment (LogFragment).
+ */
+public class MainActivity extends FragmentActivity {
+
+    public static final String TAG = "Network Connect";
+
+    // Reference to the fragment showing events, so we can clear it with a button
+    // as necessary.
+    private LogFragment mLogFragment;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_main);
+
+        // Initialize text fragment that displays intro text.
+        SimpleTextFragment introFragment = (SimpleTextFragment)
+                    getSupportFragmentManager().findFragmentById(R.id.intro_fragment);
+        introFragment.setText(R.string.intro_message);
+        introFragment.getTextView().setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16.0f);
+
+        // Initialize the logging framework.
+        initializeLogging();
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        getMenuInflater().inflate(R.menu.main, menu);
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            // When the user clicks FETCH, fetch the first 500 characters of
+            // raw HTML from www.google.com.
+            case R.id.fetch_action:
+                new DownloadTask().execute("http://www.google.com");
+                return true;
+            // Clear the log view fragment.
+            case R.id.clear_action:
+              mLogFragment.getLogView().setText("");
+              return true;
+        }
+        return false;
+    }
+
+    /**
+     * Implementation of AsyncTask, to fetch the data in the background away from
+     * the UI thread.
+     */
+    private class DownloadTask extends AsyncTask<String, Void, String> {
+
+        @Override
+        protected String doInBackground(String... urls) {
+            try {
+                return loadFromNetwork(urls[0]);
+            } catch (IOException e) {
+              return getString(R.string.connection_error);
+            }
+        }
+
+        /**
+         * Uses the logging framework to display the output of the fetch
+         * operation in the log fragment.
+         */
+        @Override
+        protected void onPostExecute(String result) {
+          Log.i(TAG, result);
+        }
+    }
+
+    /** Initiates the fetch operation. */
+    private String loadFromNetwork(String urlString) throws IOException {
+        InputStream stream = null;
+        String str ="";
+
+        try {
+            stream = downloadUrl(urlString);
+            str = readIt(stream, 500);
+       } finally {
+           if (stream != null) {
+               stream.close();
+            }
+        }
+        return str;
+    }
+
+    /**
+     * Given a string representation of a URL, sets up a connection and gets
+     * an input stream.
+     * @param urlString A string representation of a URL.
+     * @return An InputStream retrieved from a successful HttpURLConnection.
+     * @throws IOException
+     */
+    private InputStream downloadUrl(String urlString) throws IOException {
+        // BEGIN_INCLUDE(get_inputstream)
+        URL url = new URL(urlString);
+        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+        conn.setReadTimeout(10000 /* milliseconds */);
+        conn.setConnectTimeout(15000 /* milliseconds */);
+        conn.setRequestMethod("GET");
+        conn.setDoInput(true);
+        // Start the query
+        conn.connect();
+        InputStream stream = conn.getInputStream();
+        return stream;
+        // END_INCLUDE(get_inputstream)
+    }
+
+    /** Reads an InputStream and converts it to a String.
+     * @param stream InputStream containing HTML from targeted site.
+     * @param len Length of string that this method returns.
+     * @return String concatenated according to len parameter.
+     * @throws IOException
+     * @throws UnsupportedEncodingException
+     */
+    private String readIt(InputStream stream, int len) throws IOException, UnsupportedEncodingException {
+        Reader reader = null;
+        reader = new InputStreamReader(stream, "UTF-8");
+        char[] buffer = new char[len];
+        reader.read(buffer);
+        return new String(buffer);
+    }
+
+    /** Create a chain of targets that will receive log data */
+    public void initializeLogging() {
+
+        // Using Log, front-end to the logging chain, emulates
+        // android.util.log method signatures.
+
+        // Wraps Android's native log framework
+        LogWrapper logWrapper = new LogWrapper();
+        Log.setLogNode(logWrapper);
+
+        // A filter that strips out everything except the message text.
+        MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();
+        logWrapper.setNext(msgFilter);
+
+        // On screen logging via a fragment with a TextView.
+        mLogFragment =
+                (LogFragment) getSupportFragmentManager().findFragmentById(R.id.log_fragment);
+        msgFilter.setNext(mLogFragment.getLogView());
+    }
+}
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-hdpi/ic_launcher.png b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-hdpi/ic_launcher.png
similarity index 100%
rename from connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-hdpi/ic_launcher.png
rename to connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-mdpi/ic_launcher.png b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-mdpi/ic_launcher.png
similarity index 100%
rename from connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-mdpi/ic_launcher.png
rename to connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-xhdpi/ic_launcher.png b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-xhdpi/ic_launcher.png
similarity index 100%
rename from connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-xhdpi/ic_launcher.png
rename to connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-xxhdpi/ic_launcher.png b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-xxhdpi/ic_launcher.png
similarity index 100%
rename from connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/drawable-xxhdpi/ic_launcher.png
rename to connectivity/network/NetworkConnect/NetworkConnect/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/layout/activity_main.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/layout/activity_main.xml
new file mode 100755
index 0000000..f21b1ac
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/layout/activity_main.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Copyright 2013 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">
+    <fragment
+        android:name="com.example.android.common.SimpleTextFragment"
+        android:id="@+id/intro_fragment"
+        android:layout_weight="1"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
+    <View
+        android:layout_width="fill_parent"
+        android:layout_height="1dp"
+        android:background="@android:color/darker_gray"/>
+    <fragment
+        android:name="com.example.android.networkconnect.LogFragment"
+        android:id="@+id/log_fragment"
+        android:layout_weight="1"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
+</LinearLayout>
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/layout/log_fragment.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/layout/log_fragment.xml
new file mode 100644
index 0000000..6d79548
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/layout/log_fragment.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Copyright 2013 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.
+  -->
+
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/log_scroll"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <com.example.android.common.logger.LogView
+        android:id="@+id/sample_output"
+        style="@style/Log"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:clickable="true"
+        android:focusable="true"
+        android:text=""
+        android:gravity="bottom" />
+</ScrollView>
\ No newline at end of file
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/menu/main.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/menu/main.xml
similarity index 100%
rename from connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/menu/main.xml
rename to connectivity/network/NetworkConnect/NetworkConnect/src/main/res/menu/main.xml
diff --git a/background/alarms/repeatingAlarm/Scheduler/res/values-sw600dp/styles.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values-sw600dp/styles.xml
similarity index 100%
copy from background/alarms/repeatingAlarm/Scheduler/res/values-sw600dp/styles.xml
copy to connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values-sw600dp/styles.xml
diff --git a/background/alarms/repeatingAlarm/Scheduler/res/values-v11/styles.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values-v11/styles.xml
similarity index 100%
copy from background/alarms/repeatingAlarm/Scheduler/res/values-v11/styles.xml
copy to connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values-v11/styles.xml
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/dimens.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..4f69897
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/dimens.xml
@@ -0,0 +1,24 @@
+<!--
+  Copyright 2013 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>
+
+    <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+    <dimen name="margin_medium">16dp</dimen>
+    <dimen name="margin_huge">64dp</dimen>
+
+</resources>
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/strings.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/strings.xml
new file mode 100755
index 0000000..756f4a7
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/strings.xml
@@ -0,0 +1,27 @@
+<!--
+  Copyright 2013 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="app_name">Network Connect</string>
+
+    <string name="intro_message">Welcome to Network Connect!
+        Click FETCH to fetch the first 500 characters of raw HTML from www.google.com.
+    </string>
+
+    <string name="fetch_text">Fetch</string>
+    <string name="clear_text">Clear</string>
+    <string name="connection_error">Connection error.</string>
+</resources>
diff --git a/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/styles.xml b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/styles.xml
new file mode 100644
index 0000000..4d9bb98
--- /dev/null
+++ b/connectivity/network/NetworkConnect/NetworkConnect/src/main/res/values/styles.xml
@@ -0,0 +1,40 @@
+<!--
+  Copyright 2013 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 thegi 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>
+
+    <!-- Activity themes -->
+
+    <style name="Theme.Base" parent="android:Theme.Light" />
+
+    <style name="Theme.Sample" parent="Theme.Base" />
+
+    <!-- Widget styling -->
+
+    <style name="Widget" />
+
+    <style name="Widget.SampleOutput">
+        <item name="android:padding">@dimen/margin_medium</item>
+        <item name="android:textAppearance">?android:textAppearanceMedium</item>
+        <item name="android:lineSpacingMultiplier">1.1</item>
+    </style>
+
+    <style name="Log" parent="Widget.SampleOutput">
+        <item name="android:typeface">monospace</item>
+    </style>
+
+
+</resources>
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/.gitignore b/connectivity/network/NetworkConnect/NetworkConnectSample/.gitignore
deleted file mode 100644
index 6eb878d..0000000
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/.gitignore
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2013 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.
-src/template/
-src/common/
-build.gradle
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/proguard-project.txt b/connectivity/network/NetworkConnect/NetworkConnectSample/proguard-project.txt
deleted file mode 100644
index 0d8f171..0000000
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/proguard-project.txt
+++ /dev/null
@@ -1,20 +0,0 @@
- To enable ProGuard in your project, edit project.properties
-# to define the proguard.config property as described in that file.
-#
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in ${sdk.dir}/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the ProGuard
-# include property in project.properties.
-#
-# For more details, see
-#   http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-#   public *;
-#}
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/AndroidManifest.xml b/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/AndroidManifest.xml
deleted file mode 100644
index 1ae29df..0000000
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2013 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.networkconnect"
-    android:versionCode="1"
-    android:versionName="1.0">
-
-    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
-    <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-
-    <application
-        android:label="@string/app_name"
-        android:icon="@drawable/ic_launcher"
-        android:theme="@style/Theme.Sample"
-        android:allowBackup="true">
-
-        <activity
-            android:name="com.example.android.networkconnect.MainActivity"
-            android:label="@string/app_name"
-            android:uiOptions="splitActionBarWhenNarrow">
-
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-</manifest>
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/java/com/example/android/networkconnect/MainActivity.java b/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/java/com/example/android/networkconnect/MainActivity.java
deleted file mode 100755
index 3ad4646..0000000
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/java/com/example/android/networkconnect/MainActivity.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright 2013 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.networkconnect;
-
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-import android.util.TypedValue;
-import android.view.Menu;
-import android.view.MenuItem;
-
-import com.example.android.common.logger.Log;
-import com.example.android.common.logger.LogFragment;
-import com.example.android.common.logger.LogWrapper;
-import com.example.android.common.logger.MessageOnlyLogFilter;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-/**
- * Sample application demonstrating how to connect to the network and fetch raw
- * HTML. It uses AsyncTask to do the fetch on a background thread. To establish
- * the network connection, it uses HttpURLConnection.
- *
- * This sample uses the logging framework to display log output in the log
- * fragment (LogFragment).
- */
-public class MainActivity extends FragmentActivity {
-
-    public static final String TAG = "Network Connect";
-
-    // Reference to the fragment showing events, so we can clear it with a button
-    // as necessary.
-    private LogFragment mLogFragment;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.sample_main);
-
-        // Initialize text fragment that displays intro text.
-        SimpleTextFragment introFragment = (SimpleTextFragment)
-                    getSupportFragmentManager().findFragmentById(R.id.intro_fragment);
-        introFragment.setText(R.string.welcome_message);
-        introFragment.getTextView().setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16.0f);
-
-        // Initialize the logging framework.
-        initializeLogging();
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        getMenuInflater().inflate(R.menu.main, menu);
-        return true;
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            // When the user clicks FETCH, fetch the first 500 characters of
-            // raw HTML from www.google.com.
-            case R.id.fetch_action:
-                new DownloadTask().execute("http://www.google.com");
-                return true;
-            // Clear the log view fragment.
-            case R.id.clear_action:
-              mLogFragment.getLogView().setText("");
-              return true;
-        }
-        return false;
-    }
-
-    /**
-     * Implementation of AsyncTask, to fetch the data in the background away from
-     * the UI thread.
-     */
-    private class DownloadTask extends AsyncTask<String, Void, String> {
-
-        @Override
-        protected String doInBackground(String... urls) {
-            try {
-                return loadFromNetwork(urls[0]);
-            } catch (IOException e) {
-              return getString(R.string.connection_error);
-            }
-        }
-
-        /**
-         * Uses the logging framework to display the output of the fetch
-         * operation in the log fragment.
-         */
-        @Override
-        protected void onPostExecute(String result) {
-          Log.i(TAG, result);
-        }
-    }
-
-    /** Initiates the fetch operation. */
-    private String loadFromNetwork(String urlString) throws IOException {
-        InputStream stream = null;
-        String str ="";
-
-        try {
-            stream = downloadUrl(urlString);
-            str = readIt(stream, 500);
-       } finally {
-           if (stream != null) {
-               stream.close();
-            }
-        }
-        return str;
-    }
-
-    /**
-     * Given a string representation of a URL, sets up a connection and gets
-     * an input stream.
-     * @param urlString A string representation of a URL.
-     * @return An InputStream retrieved from a successful HttpURLConnection.
-     * @throws java.io.IOException
-     */
-    private InputStream downloadUrl(String urlString) throws IOException {
-        // BEGIN_INCLUDE(get_inputstream)
-        URL url = new URL(urlString);
-        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-        conn.setReadTimeout(10000 /* milliseconds */);
-        conn.setConnectTimeout(15000 /* milliseconds */);
-        conn.setRequestMethod("GET");
-        conn.setDoInput(true);
-        // Start the query
-        conn.connect();
-        InputStream stream = conn.getInputStream();
-        return stream;
-        // END_INCLUDE(get_inputstream)
-    }
-
-    /** Reads an InputStream and converts it to a String.
-     * @param stream InputStream containing HTML from targeted site.
-     * @param len Length of string that this method returns.
-     * @return String concatenated according to len parameter.
-     * @throws java.io.IOException
-     * @throws java.io.UnsupportedEncodingException
-     */
-    private String readIt(InputStream stream, int len) throws IOException, UnsupportedEncodingException {
-        Reader reader = null;
-        reader = new InputStreamReader(stream, "UTF-8");
-        char[] buffer = new char[len];
-        reader.read(buffer);
-        return new String(buffer);
-    }
-
-    /** Create a chain of targets that will receive log data */
-    public void initializeLogging() {
-
-        // Using Log, front-end to the logging chain, emulates
-        // android.util.log method signatures.
-
-        // Wraps Android's native log framework
-        LogWrapper logWrapper = new LogWrapper();
-        Log.setLogNode(logWrapper);
-
-        // A filter that strips out everything except the message text.
-        MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();
-        logWrapper.setNext(msgFilter);
-
-        // On screen logging via a fragment with a TextView.
-        mLogFragment =
-                (LogFragment) getSupportFragmentManager().findFragmentById(R.id.log_fragment);
-        msgFilter.setNext(mLogFragment.getLogView());
-    }
-}
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/java/com/example/android/networkconnect/SimpleTextFragment.java b/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/java/com/example/android/networkconnect/SimpleTextFragment.java
deleted file mode 100644
index 3202937..0000000
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/java/com/example/android/networkconnect/SimpleTextFragment.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2013 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.networkconnect;
-
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-/**
- * Simple fragment containing only a TextView. Used by TextPagerAdapter to create
- * tutorial-style pages for apps.
- */
-public class SimpleTextFragment extends Fragment {
-
-    // Contains the text that will be displayed by this Fragment
-    String mText;
-
-    // Contains a resource ID for the text that will be displayed by this fragment.
-    int mTextId = -1;
-
-    // Keys which will be used to store/retrieve text passed in via setArguments.
-    public static final String TEXT_KEY = "text";
-    public static final String TEXT_ID_KEY = "text_id";
-
-    // For situations where the app wants to modify text at Runtime, exposing the TextView.
-    private TextView mTextView;
-
-    public SimpleTextFragment() {
-    }
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
-        // Before initializing the textView, check if any arguments were provided via setArguments.
-        processArguments();
-
-        // Create a new TextView and set its text to whatever was provided.
-        mTextView = new TextView(getActivity());
-        mTextView.setGravity(Gravity.CENTER);
-
-        if (mText != null) {
-            mTextView.setText(mText);
-            Log.i("SimpleTextFragment", mText);
-        }
-        return mTextView;
-    }
-
-    public TextView getTextView() {
-        return mTextView;
-    }
-
-    /**
-     * Changes the text for this TextView, according to the resource ID provided.
-     * @param stringId A resource ID representing the text content for this Fragment's TextView.
-     */
-    public void setText(int stringId) {
-        getTextView().setText(getActivity().getString(stringId));
-    }
-
-    /**
-     * Processes the arguments passed into this Fragment via setArguments method.
-     * Currently the method only looks for text or a textID, nothing else.
-     */
-    public void processArguments() {
-        // For most objects we'd handle the multiple possibilities for initialization variables
-        // as multiple constructors.  For Fragments, however, it's customary to use
-        // setArguments / getArguments.
-        if (getArguments() != null) {
-            Bundle args = getArguments();
-            if (args.containsKey(TEXT_KEY)) {
-                mText = args.getString(TEXT_KEY);
-                Log.d("Constructor", "Added Text.");
-            } else if (args.containsKey(TEXT_ID_KEY)) {
-                mTextId = args.getInt(TEXT_ID_KEY);
-                mText = getString(mTextId);
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/layout/sample_main.xml b/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/layout/sample_main.xml
deleted file mode 100755
index 76fa7d7..0000000
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/layout/sample_main.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-  Copyright 2013 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">
-    <fragment
-        android:name="com.example.android.networkconnect.SimpleTextFragment"
-        android:id="@+id/intro_fragment"
-        android:layout_weight="1"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent" />
-    <View
-        android:layout_width="fill_parent"
-        android:layout_height="1dp"
-        android:background="@android:color/darker_gray"/>
-    <fragment
-        android:name="com.example.android.common.logger.LogFragment"
-        android:id="@+id/log_fragment"
-        android:layout_weight="1"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent" />
-</LinearLayout>
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/values/strings.xml b/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/values/strings.xml
deleted file mode 100755
index 1e7915a..0000000
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  Copyright 2013 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="welcome_message">Welcome to Network Connect!
-        Click FETCH to fetch the first 500 characters of raw HTML from www.google.com.
-    </string>
-
-    <string name="fetch_text">Fetch</string>
-    <string name="clear_text">Clear</string>
-    <string name="connection_error">Connection error.</string>
-</resources>
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/tests/AndroidManifest.xml b/connectivity/network/NetworkConnect/NetworkConnectSample/tests/AndroidManifest.xml
deleted file mode 100644
index 80fec80..0000000
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/tests/AndroidManifest.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  Copyright (C) 2013 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 name must be unique so suffix with "tests" so package loader doesn't ignore us -->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.example.android.networkconnect.tests"
-          android:versionCode="1"
-          android:versionName="1.0">
-
-    <uses-sdk
-            android:minSdkVersion="18"
-            android:targetSdkVersion="19" />
-
-    <!-- We add an application tag here just so that we can indicate that
-         this package needs to link against the android.test library,
-         which is needed when building test cases. -->
-    <application>
-        <uses-library android:name="android.test.runner" />
-    </application>
-
-    <!--
-    Specifies the instrumentation test runner used to run the tests.
-    -->
-    <instrumentation
-            android:name="android.test.InstrumentationTestRunner"
-            android:targetPackage="com.example.android.networkconnect"
-            android:label="Tests for com.example.android.networkconnect" />
-
-</manifest>
\ No newline at end of file
diff --git a/connectivity/network/NetworkConnect/NetworkConnectSample/tests/src/com/example/android/networkconnect/tests/SampleTests.java b/connectivity/network/NetworkConnect/NetworkConnectSample/tests/src/com/example/android/networkconnect/tests/SampleTests.java
deleted file mode 100644
index a554964..0000000
--- a/connectivity/network/NetworkConnect/NetworkConnectSample/tests/src/com/example/android/networkconnect/tests/SampleTests.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-* Copyright 2013 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) 2013 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.networkconnect.tests;
-
-import com.example.android.networkconnect.*;
-
-import android.test.ActivityInstrumentationTestCase2;
-
-/**
-* Tests for NetworkConnect sample.
-*/
-public class SampleTests extends ActivityInstrumentationTestCase2<MainActivity> {
-
-    private MainActivity mTestActivity;
-    private NetworkConnectFragment mTestFragment;
-
-    public SampleTests() {
-        super(MainActivity.class);
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        // Starts the activity under test using the default Intent with:
-        // action = {@link Intent#ACTION_MAIN}
-        // flags = {@link Intent#FLAG_ACTIVITY_NEW_TASK}
-        // All other fields are null or empty.
-        mTestActivity = getActivity();
-        mTestFragment = (NetworkConnectFragment)
-            mTestActivity.getSupportFragmentManager().getFragments().get(1);
-    }
-
-    /**
-    * Test if the test fixture has been set up correctly.
-    */
-    public void testPreconditions() {
-        //Try to add a message to add context to your assertions. These messages will be shown if
-        //a tests fails and make it easy to understand why a test failed
-        assertNotNull("mTestActivity is null", mTestActivity);
-        assertNotNull("mTestFragment is null", mTestFragment);
-    }
-
-    /**
-    * Add more tests below.
-    */
-
-}
\ No newline at end of file
diff --git a/connectivity/network/NetworkConnect/README.txt b/connectivity/network/NetworkConnect/README.txt
new file mode 100644
index 0000000..38608df
--- /dev/null
+++ b/connectivity/network/NetworkConnect/README.txt
@@ -0,0 +1,6 @@
+Build Instructions
+-------------------
+This sample uses the Gradle build system. To build this project, use the
+"gradlew build" command.
+
+To see a list of all available commands, run "gradlew tasks".
\ No newline at end of file
diff --git a/connectivity/network/NetworkConnect/build.gradle b/connectivity/network/NetworkConnect/build.gradle
index cca9ac3..036abc8 100644
--- a/connectivity/network/NetworkConnect/build.gradle
+++ b/connectivity/network/NetworkConnect/build.gradle
@@ -1,10 +1,8 @@
-// BEGIN_EXCLUDE
-import com.example.android.samples.build.SampleGenPlugin
-apply plugin: SampleGenPlugin
-
-samplegen {
-  pathToBuild "../../../../../build"
-  pathToSamplesCommon "../../../common"
+buildscript {
+    repositories {
+        mavenCentral()
+    }
+    dependencies {
+        classpath 'com.android.tools.build:gradle:0.5.+'
+    }
 }
-apply from: "../../../../../build/build.gradle"
-// END_EXCLUDE
diff --git a/connectivity/network/NetworkConnect/buildSrc/build.gradle b/connectivity/network/NetworkConnect/buildSrc/build.gradle
deleted file mode 100644
index e344a8c..0000000
--- a/connectivity/network/NetworkConnect/buildSrc/build.gradle
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-repositories {
-    mavenCentral()
-}
-dependencies {
-    compile 'org.freemarker:freemarker:2.3.20'
-}
-
-sourceSets {
-    main {
-        groovy {
-            srcDir new File(rootDir, "../../../../../../build/buildSrc/src/main/groovy")
-        }
-    }
-}
-
diff --git a/connectivity/network/NetworkConnect/gradle/wrapper/gradle-wrapper.properties b/connectivity/network/NetworkConnect/gradle/wrapper/gradle-wrapper.properties
index 861eddc..055ba6f 100644
--- a/connectivity/network/NetworkConnect/gradle/wrapper/gradle-wrapper.properties
+++ b/connectivity/network/NetworkConnect/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#
+#Mon Jul 22 11:40:20 PDT 2013
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
diff --git a/connectivity/network/NetworkConnect/settings.gradle b/connectivity/network/NetworkConnect/settings.gradle
index ebae091..771d665 100644
--- a/connectivity/network/NetworkConnect/settings.gradle
+++ b/connectivity/network/NetworkConnect/settings.gradle
@@ -1,4 +1 @@
-
-
-
-include 'NetworkConnectSample'
+include ':NetworkConnect'
diff --git a/connectivity/network/NetworkConnect/template-params.xml b/connectivity/network/NetworkConnect/template-params.xml
deleted file mode 100644
index a1d5991..0000000
--- a/connectivity/network/NetworkConnect/template-params.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2013 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>
-    <name>NetworkConnect</name>
-    <group>Connectivity</group>
-    <package>com.example.android.networkconnect</package>
-
-
-
-    <!-- change minSdk if needed-->
-    <minSdk>8</minSdk>
-
-
-    <strings>
-        <intro>
-            <![CDATA[
-            This sample demonstrates how to connect to the network and fetch raw HTML using
-            HttpURLConnection. AsyncTask is used to perform the fetch on a background thread.
-            ]]>
-        </intro>
-    </strings>
-
-    <template src="base"/>
-    <common src="logger"/>
-
-</sample>
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/build.gradle b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/build.gradle
new file mode 100644
index 0000000..e802f1b
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/build.gradle
@@ -0,0 +1,15 @@
+apply plugin: 'android'
+
+repositories {
+    mavenCentral()
+}
+
+dependencies {
+    compile 'com.google.guava:guava:14.0.+'
+    compile "com.android.support:support-v4:18.0.+"
+}
+
+android {
+    compileSdkVersion 18
+    buildToolsVersion "18.0.0"
+}
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/AndroidManifest.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..385b293
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/AndroidManifest.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.example.android.network.sync.basicsyncadapter"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <!-- SyncAdapters are available in API 5 and above. We use API 7 as a baseline for samples. -->
+    <uses-sdk
+        android:minSdkVersion="7"
+        android:targetSdkVersion="17" />
+
+    <!-- Required for fetching feed data. -->
+    <uses-permission android:name="android.permission.INTERNET"/>
+    <!-- Required to register a SyncStatusObserver to display a "syncing..." progress indicator. -->
+    <uses-permission android:name="android.permission.READ_SYNC_STATS"/>
+    <!-- Required to enable our SyncAdapter after it's created. -->
+    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/>
+    <!-- Required because we're manually creating a new account. -->
+    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
+
+
+    <application
+        android:allowBackup="true"
+        android:icon="@drawable/ic_launcher"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+
+        <!-- Main activity, responsible for showing a list of feed entries. -->
+        <activity
+            android:name="com.example.android.network.sync.basicsyncadapter.EntryListActivity"
+            android:label="@string/app_name" >
+            <!-- This intent filter places this activity in the system's app launcher. -->
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+
+        <!-- ContentProvider to store feed data.
+
+        The "authorities" here are defined as part of a ContentProvider interface. It's used here
+        as an attachment point for the SyncAdapter. See res/xml/syncadapter.xml and
+        SyncService.java.
+
+        Since this ContentProvider is not exported, it will not be accessible outside of this app's
+        package. -->
+        <provider
+                android:name=".provider.FeedProvider"
+                android:authorities="com.example.android.network.sync.basicsyncadapter"
+                android:exported="false" />
+
+        <!-- This service implements our SyncAdapter. It needs to be exported, so that the system
+        sync framework can access it. -->
+        <service android:name=".SyncService"
+                 android:exported="true">
+            <!-- This intent filter is required. It allows the system to launch our sync service
+            as needed. -->
+            <intent-filter>
+                <action android:name="android.content.SyncAdapter" />
+            </intent-filter>
+            <!-- This points to a required XML file which describes our SyncAdapter. -->
+            <meta-data android:name="android.content.SyncAdapter"
+                       android:resource="@xml/syncadapter" />
+        </service>
+
+        <!-- This implements the account we'll use as an attachment point for our SyncAdapter. Since
+        our SyncAdapter doesn't need to authenticate the current user (it just fetches a public RSS
+        feed), this account's implementation is largely empty.
+
+        It's also possible to attach a SyncAdapter to an existing account provided by another
+        package. In that case, this element could be omitted here. -->
+        <service android:name="com.example.android.common.accounts.GenericAccountService">
+            <!-- Required filter used by the system to launch our account service. -->
+            <intent-filter>
+                <action android:name="android.accounts.AccountAuthenticator" />
+            </intent-filter>
+            <!-- This points to an XMLf ile which describes our account service. -->
+            <meta-data android:name="android.accounts.AccountAuthenticator"
+                       android:resource="@xml/authenticator" />
+        </service>
+
+</application>
+
+</manifest>
\ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListActivity.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListActivity.java
new file mode 100644
index 0000000..cff0702
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListActivity.java
@@ -0,0 +1,16 @@
+package com.example.android.network.sync.basicsyncadapter;
+
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+
+/**
+ * Activity for holding EntryListFragment.
+ */
+public class EntryListActivity extends FragmentActivity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_entry_list);
+    }
+}
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListFragment.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListFragment.java
new file mode 100644
index 0000000..0efeb40
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/EntryListFragment.java
@@ -0,0 +1,356 @@
+/*
+ * Copyright 2013 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.network.sync.basicsyncadapter;
+
+import android.accounts.Account;
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.content.ContentResolver;
+import android.content.Intent;
+import android.content.SyncStatusObserver;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.support.v4.app.ListFragment;
+import android.support.v4.app.LoaderManager;
+import android.support.v4.content.CursorLoader;
+import android.support.v4.content.Loader;
+import android.support.v4.widget.SimpleCursorAdapter;
+import android.text.format.Time;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import com.example.android.common.accounts.GenericAccountService;
+import com.example.android.network.sync.basicsyncadapter.provider.FeedContract;
+
+/**
+ * List fragment containing a list of Atom entry objects (articles) stored in the local database.
+ *
+ * <p>Database access is mediated by a content provider, specified in
+ * {@link com.example.android.network.sync.basicsyncadapter.provider.FeedProvider}. This content
+ * provider is
+ * automatically populated by  {@link SyncService}.
+ *
+ * <p>Selecting an item from the displayed list displays the article in the default browser.
+ *
+ * <p>If the content provider doesn't return any data, then the first sync hasn't run yet. This sync
+ * adapter assumes data exists in the provider once a sync has run. If your app doesn't work like
+ * this, you should add a flag that notes if a sync has run, so you can differentiate between "no
+ * available data" and "no initial sync", and display this in the UI.
+ *
+ * <p>The ActionBar displays a "Refresh" button. When the user clicks "Refresh", the sync adapter
+ * runs immediately. An indeterminate ProgressBar element is displayed, showing that the sync is
+ * occurring.
+ */
+public class EntryListFragment extends ListFragment
+        implements LoaderManager.LoaderCallbacks<Cursor> {
+
+    private static final String TAG = "EntryListFragment";
+
+    /**
+     * Cursor adapter for controlling ListView results.
+     */
+    private SimpleCursorAdapter mAdapter;
+
+    /**
+     * Handle to a SyncObserver. The ProgressBar element is visible until the SyncObserver reports
+     * that the sync is complete.
+     *
+     * <p>This allows us to delete our SyncObserver once the application is no longer in the
+     * foreground.
+     */
+    private Object mSyncObserverHandle;
+
+    /**
+     * Options menu used to populate ActionBar.
+     */
+    private Menu mOptionsMenu;
+
+    /**
+     * Projection for querying the content provider.
+     */
+    private static final String[] PROJECTION = new String[]{
+            FeedContract.Entry._ID,
+            FeedContract.Entry.COLUMN_NAME_TITLE,
+            FeedContract.Entry.COLUMN_NAME_LINK,
+            FeedContract.Entry.COLUMN_NAME_PUBLISHED
+    };
+
+    // Column indexes. The index of a column in the Cursor is the same as its relative position in
+    // the projection.
+    /** Column index for _ID */
+    private static final int COLUMN_ID = 0;
+    /** Column index for title */
+    private static final int COLUMN_TITLE = 1;
+    /** Column index for link */
+    private static final int COLUMN_URL_STRING = 2;
+    /** Column index for published */
+    private static final int COLUMN_PUBLISHED = 3;
+
+    /**
+     * List of Cursor columns to read from when preparing an adapter to populate the ListView.
+     */
+    private static final String[] FROM_COLUMNS = new String[]{
+            FeedContract.Entry.COLUMN_NAME_TITLE,
+            FeedContract.Entry.COLUMN_NAME_PUBLISHED
+    };
+
+    /**
+     * List of Views which will be populated by Cursor data.
+     */
+    private static final int[] TO_FIELDS = new int[]{
+            android.R.id.text1,
+            android.R.id.text2};
+
+    /**
+     * Mandatory empty constructor for the fragment manager to instantiate the
+     * fragment (e.g. upon screen orientation changes).
+     */
+    public EntryListFragment() {}
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setHasOptionsMenu(true);
+    }
+
+    /**
+     * Create SyncAccount at launch, if needed.
+     *
+     * <p>This will create a new account with the system for our application, register our
+     * {@link SyncService} with it, and establish a sync schedule.
+     */
+    @Override
+    public void onAttach(Activity activity) {
+        super.onAttach(activity);
+
+        // Create account, if needed
+        SyncUtils.CreateSyncAccount(activity);
+    }
+
+    @Override
+    public void onViewCreated(View view, Bundle savedInstanceState) {
+        super.onViewCreated(view, savedInstanceState);
+
+        mAdapter = new SimpleCursorAdapter(
+                getActivity(),       // Current context
+                android.R.layout.simple_list_item_activated_2,  // Layout for individual rows
+                null,                // Cursor
+                FROM_COLUMNS,        // Cursor columns to use
+                TO_FIELDS,           // Layout fields to use
+                0                    // No flags
+        );
+        mAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
+            @Override
+            public boolean setViewValue(View view, Cursor cursor, int i) {
+                if (i == COLUMN_PUBLISHED) {
+                    // Convert timestamp to human-readable date
+                    Time t = new Time();
+                    t.set(cursor.getLong(i));
+                    ((TextView) view).setText(t.format("%Y-%m-%d %H:%M"));
+                    return true;
+                } else {
+                    // Let SimpleCursorAdapter handle other fields automatically
+                    return false;
+                }
+            }
+        });
+        setListAdapter(mAdapter);
+        setEmptyText(getText(R.string.loading));
+        getLoaderManager().initLoader(0, null, this);
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        mSyncStatusObserver.onStatusChanged(0);
+
+        // Watch for sync state changes
+        final int mask = ContentResolver.SYNC_OBSERVER_TYPE_PENDING |
+                ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE;
+        mSyncObserverHandle = ContentResolver.addStatusChangeListener(mask, mSyncStatusObserver);
+    }
+
+    @Override
+    public void onPause() {
+        super.onPause();
+        if (mSyncObserverHandle != null) {
+            ContentResolver.removeStatusChangeListener(mSyncObserverHandle);
+            mSyncObserverHandle = null;
+        }
+    }
+
+    /**
+     * Query the content provider for data.
+     *
+     * <p>Loaders do queries in a background thread. They also provide a ContentObserver that is
+     * triggered when data in the content provider changes. When the sync adapter updates the
+     * content provider, the ContentObserver responds by resetting the loader and then reloading
+     * it.
+     */
+    @Override
+    public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
+        // We only have one loader, so we can ignore the value of i.
+        // (It'll be '0', as set in onCreate().)
+        return new CursorLoader(getActivity(),  // Context
+                FeedContract.Entry.CONTENT_URI, // URI
+                PROJECTION,                // Projection
+                null,                           // Selection
+                null,                           // Selection args
+                FeedContract.Entry.COLUMN_NAME_PUBLISHED + " desc"); // Sort
+    }
+
+    /**
+     * Move the Cursor returned by the query into the ListView adapter. This refreshes the existing
+     * UI with the data in the Cursor.
+     */
+    @Override
+    public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
+        mAdapter.changeCursor(cursor);
+    }
+
+    /**
+     * Called when the ContentObserver defined for the content provider detects that data has
+     * changed. The ContentObserver resets the loader, and then re-runs the loader. In the adapter,
+     * set the Cursor value to null. This removes the reference to the Cursor, allowing it to be
+     * garbage-collected.
+     */
+    @Override
+    public void onLoaderReset(Loader<Cursor> cursorLoader) {
+        mAdapter.changeCursor(null);
+    }
+
+    /**
+     * Create the ActionBar.
+     */
+    @Override
+    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+        super.onCreateOptionsMenu(menu, inflater);
+        mOptionsMenu = menu;
+        inflater.inflate(R.menu.main, menu);
+    }
+
+    /**
+     * Respond to user gestures on the ActionBar.
+     */
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            // If the user clicks the "Refresh" button.
+            case R.id.menu_refresh:
+                SyncUtils.TriggerRefresh();
+                return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    /**
+     * Load an article in the default browser when selected by the user.
+     */
+    @Override
+    public void onListItemClick(ListView listView, View view, int position, long id) {
+        super.onListItemClick(listView, view, position, id);
+
+        // Get a URI for the selected item, then start an Activity that displays the URI. Any
+        // Activity that filters for ACTION_VIEW and a URI can accept this. In most cases, this will
+        // be a browser.
+
+        // Get the item at the selected position, in the form of a Cursor.
+        Cursor c = (Cursor) mAdapter.getItem(position);
+        // Get the link to the article represented by the item.
+        String articleUrlString = c.getString(COLUMN_URL_STRING);
+        if (articleUrlString == null) {
+            Log.e(TAG, "Attempt to launch entry with null link");
+            return;
+        }
+
+        Log.i(TAG, "Opening URL: " + articleUrlString);
+        // Get a Uri object for the URL string
+        Uri articleURL = Uri.parse(articleUrlString);
+        Intent i = new Intent(Intent.ACTION_VIEW, articleURL);
+        startActivity(i);
+    }
+
+    /**
+     * Set the state of the Refresh button. If a sync is active, turn on the ProgressBar widget.
+     * Otherwise, turn it off.
+     *
+     * @param refreshing True if an active sync is occuring, false otherwise
+     */
+    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+    public void setRefreshActionButtonState(boolean refreshing) {
+        if (mOptionsMenu == null || Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
+            return;
+        }
+
+        final MenuItem refreshItem = mOptionsMenu.findItem(R.id.menu_refresh);
+        if (refreshItem != null) {
+            if (refreshing) {
+                refreshItem.setActionView(R.layout.actionbar_indeterminate_progress);
+            } else {
+                refreshItem.setActionView(null);
+            }
+        }
+    }
+
+    /**
+     * Crfate a new anonymous SyncStatusObserver. It's attached to the app's ContentResolver in
+     * onResume(), and removed in onPause(). If status changes, it sets the state of the Refresh
+     * button. If a sync is active or pending, the Refresh button is replaced by an indeterminate
+     * ProgressBar; otherwise, the button itself is displayed.
+     */
+    private SyncStatusObserver mSyncStatusObserver = new SyncStatusObserver() {
+        /** Callback invoked with the sync adapter status changes. */
+        @Override
+        public void onStatusChanged(int which) {
+            getActivity().runOnUiThread(new Runnable() {
+                /**
+                 * The SyncAdapter runs on a background thread. To update the UI, onStatusChanged()
+                 * runs on the UI thread.
+                 */
+                @Override
+                public void run() {
+                    // Create a handle to the account that was created by
+                    // SyncService.CreateSyncAccount(). This will be used to query the system to
+                    // see how the sync status has changed.
+                    Account account = GenericAccountService.GetAccount();
+                    if (account == null) {
+                        // GetAccount() returned an invalid value. This shouldn't happen, but
+                        // we'll set the status to "not refreshing".
+                        setRefreshActionButtonState(false);
+                        return;
+                    }
+
+                    // Test the ContentResolver to see if the sync adapter is active or pending.
+                    // Set the state of the refresh button accordingly.
+                    boolean syncActive = ContentResolver.isSyncActive(
+                            account, FeedContract.CONTENT_AUTHORITY);
+                    boolean syncPending = ContentResolver.isSyncPending(
+                            account, FeedContract.CONTENT_AUTHORITY);
+                    setRefreshActionButtonState(syncActive || syncPending);
+                }
+            });
+        }
+    };
+
+}
\ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncAdapter.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncAdapter.java
new file mode 100644
index 0000000..a759adb
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncAdapter.java
@@ -0,0 +1,303 @@
+/*
+ * Copyright 2013 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.network.sync.basicsyncadapter;
+
+import android.accounts.Account;
+import android.content.AbstractThreadedSyncAdapter;
+import android.content.ContentProviderClient;
+import android.content.ContentProviderOperation;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.OperationApplicationException;
+import android.content.SyncResult;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.util.Log;
+
+import com.example.android.network.sync.basicsyncadapter.net.FeedParser;
+import com.example.android.network.sync.basicsyncadapter.provider.FeedContract;
+
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * Define a sync adapter for the app.
+ *
+ * <p>This class is instantiated in {@link SyncService}, which also binds SyncAdapter to the system.
+ * SyncAdapter should only be initialized in SyncService, never anywhere else.
+ *
+ * <p>The system calls onPerformSync() via an RPC call through the IBinder object supplied by
+ * SyncService.
+ */
+class SyncAdapter extends AbstractThreadedSyncAdapter {
+    public static final String TAG = "SyncAdapter";
+
+    /**
+     * URL to fetch content from during a sync.
+     *
+     * <p>This points to the Android Developers Blog. (Side note: We highly recommend reading the
+     * Android Developer Blog to stay up to date on the latest Android platform developments!)
+     */
+    private static final String FEED_URL = "http://android-developers.blogspot.com/atom.xml";
+
+    /**
+     * Network connection timeout, in milliseconds.
+     */
+    private static final int NET_CONNECT_TIMEOUT_MILLIS = 15000;  // 15 seconds
+
+    /**
+     * Network read timeout, in milliseconds.
+     */
+    private static final int NET_READ_TIMEOUT_MILLIS = 10000;  // 10 seconds
+
+    /**
+     * Content resolver, for performing database operations.
+     */
+    private final ContentResolver mContentResolver;
+
+    /**
+     * Project used when querying content provider. Returns all known fields.
+     */
+    private static final String[] PROJECTION = new String[] {
+            FeedContract.Entry._ID,
+            FeedContract.Entry.COLUMN_NAME_ENTRY_ID,
+            FeedContract.Entry.COLUMN_NAME_TITLE,
+            FeedContract.Entry.COLUMN_NAME_LINK,
+            FeedContract.Entry.COLUMN_NAME_PUBLISHED};
+
+    // Constants representing column positions from PROJECTION.
+    public static final int COLUMN_ID = 0;
+    public static final int COLUMN_ENTRY_ID = 1;
+    public static final int COLUMN_TITLE = 2;
+    public static final int COLUMN_LINK = 3;
+    public static final int COLUMN_PUBLISHED = 4;
+
+    /**
+     * Constructor. Obtains handle to content resolver for later use.
+     */
+    public SyncAdapter(Context context, boolean autoInitialize) {
+        super(context, autoInitialize);
+        mContentResolver = context.getContentResolver();
+    }
+
+    /**
+     * Constructor. Obtains handle to content resolver for later use.
+     */
+    public SyncAdapter(Context context, boolean autoInitialize, boolean allowParallelSyncs) {
+        super(context, autoInitialize, allowParallelSyncs);
+        mContentResolver = context.getContentResolver();
+    }
+
+    /**
+     * Called by the Android system in response to a request to run the sync adapter. The work
+     * required to read data from the network, parse it, and store it in the content provider is
+     * done here. Extending AbstractThreadedSyncAdapter ensures that all methods within SyncAdapter
+     * run on a background thread. For this reason, blocking I/O and other long-running tasks can be
+     * run <em>in situ</em>, and you don't have to set up a separate thread for them.
+     .
+     *
+     * <p>This is where we actually perform any work required to perform a sync.
+     * {@link AbstractThreadedSyncAdapter} guarantees that this will be called on a non-UI thread,
+     * so it is safe to peform blocking I/O here.
+     *
+     * <p>The syncResult argument allows you to pass information back to the method that triggered
+     * the sync.
+     */
+    @Override
+    public void onPerformSync(Account account, Bundle extras, String authority,
+                              ContentProviderClient provider, SyncResult syncResult) {
+        Log.i(TAG, "Beginning network synchronization");
+        try {
+            final URL location = new URL(FEED_URL);
+            InputStream stream = null;
+
+            try {
+                Log.i(TAG, "Streaming data from network: " + location);
+                stream = downloadUrl(location);
+                updateLocalFeedData(stream, syncResult);
+                // Makes sure that the InputStream is closed after the app is
+                // finished using it.
+            } finally {
+                if (stream != null) {
+                    stream.close();
+                }
+            }
+        } catch (MalformedURLException e) {
+            Log.wtf(TAG, "Feed URL is malformed", e);
+            syncResult.stats.numParseExceptions++;
+            return;
+        } catch (IOException e) {
+            Log.e(TAG, "Error reading from network: " + e.toString());
+            syncResult.stats.numIoExceptions++;
+            return;
+        } catch (XmlPullParserException e) {
+            Log.e(TAG, "Error parsing feed: " + e.toString());
+            syncResult.stats.numParseExceptions++;
+            return;
+        } catch (ParseException e) {
+            Log.e(TAG, "Error parsing feed: " + e.toString());
+            syncResult.stats.numParseExceptions++;
+            return;
+        } catch (RemoteException e) {
+            Log.e(TAG, "Error updating database: " + e.toString());
+            syncResult.databaseError = true;
+            return;
+        } catch (OperationApplicationException e) {
+            Log.e(TAG, "Error updating database: " + e.toString());
+            syncResult.databaseError = true;
+            return;
+        }
+        Log.i(TAG, "Network synchronization complete");
+    }
+
+    /**
+     * Read XML from an input stream, storing it into the content provider.
+     *
+     * <p>This is where incoming data is persisted, committing the results of a sync. In order to
+     * minimize (expensive) disk operations, we compare incoming data with what's already in our
+     * database, and compute a merge. Only changes (insert/update/delete) will result in a database
+     * write.
+     *
+     * <p>As an additional optimization, we use a batch operation to perform all database writes at
+     * once.
+     *
+     * <p>Merge strategy:
+     * 1. Get cursor to all items in feed<br/>
+     * 2. For each item, check if it's in the incoming data.<br/>
+     *    a. YES: Remove from "incoming" list. Check if data has mutated, if so, perform
+     *            database UPDATE.<br/>
+     *    b. NO: Schedule DELETE from database.<br/>
+     * (At this point, incoming database only contains missing items.)<br/>
+     * 3. For any items remaining in incoming list, ADD to database.
+     */
+    public void updateLocalFeedData(final InputStream stream, final SyncResult syncResult)
+            throws IOException, XmlPullParserException, RemoteException,
+            OperationApplicationException, ParseException {
+        final FeedParser feedParser = new FeedParser();
+        final ContentResolver contentResolver = getContext().getContentResolver();
+
+        Log.i(TAG, "Parsing stream as Atom feed");
+        final List<FeedParser.Entry> entries = feedParser.parse(stream);
+        Log.i(TAG, "Parsing complete. Found " + entries.size() + " entries");
+
+
+        ArrayList<ContentProviderOperation> batch = new ArrayList<ContentProviderOperation>();
+
+        // Build hash table of incoming entries
+        HashMap<String, FeedParser.Entry> entryMap = new HashMap<String, FeedParser.Entry>();
+        for (FeedParser.Entry e : entries) {
+            entryMap.put(e.id, e);
+        }
+
+        // Get list of all items
+        Log.i(TAG, "Fetching local entries for merge");
+        Uri uri = FeedContract.Entry.CONTENT_URI; // Get all entries
+        Cursor c = contentResolver.query(uri, PROJECTION, null, null, null);
+        assert c != null;
+        Log.i(TAG, "Found " + c.getCount() + " local entries. Computing merge solution...");
+
+        // Find stale data
+        int id;
+        String entryId;
+        String title;
+        String link;
+        long published;
+        while (c.moveToNext()) {
+            syncResult.stats.numEntries++;
+            id = c.getInt(COLUMN_ID);
+            entryId = c.getString(COLUMN_ENTRY_ID);
+            title = c.getString(COLUMN_TITLE);
+            link = c.getString(COLUMN_LINK);
+            published = c.getLong(COLUMN_PUBLISHED);
+            FeedParser.Entry match = entryMap.get(entryId);
+            if (match != null) {
+                // Entry exists. Remove from entry map to prevent insert later.
+                entryMap.remove(entryId);
+                // Check to see if the entry needs to be updated
+                Uri existingUri = FeedContract.Entry.CONTENT_URI.buildUpon()
+                        .appendPath(Integer.toString(id)).build();
+                if ((match.title != null && !match.title.equals(title)) ||
+                        (match.link != null && !match.link.equals(link)) ||
+                        (match.published != published)) {
+                    // Update existing record
+                    Log.i(TAG, "Scheduling update: " + existingUri);
+                    batch.add(ContentProviderOperation.newUpdate(existingUri)
+                            .withValue(FeedContract.Entry.COLUMN_NAME_TITLE, title)
+                            .withValue(FeedContract.Entry.COLUMN_NAME_LINK, link)
+                            .withValue(FeedContract.Entry.COLUMN_NAME_PUBLISHED, published)
+                            .build());
+                    syncResult.stats.numUpdates++;
+                } else {
+                    Log.i(TAG, "No action: " + existingUri);
+                }
+            } else {
+                // Entry doesn't exist. Remove it from the database.
+                Uri deleteUri = FeedContract.Entry.CONTENT_URI.buildUpon()
+                        .appendPath(Integer.toString(id)).build();
+                Log.i(TAG, "Scheduling delete: " + deleteUri);
+                batch.add(ContentProviderOperation.newDelete(deleteUri).build());
+                syncResult.stats.numDeletes++;
+            }
+        }
+        c.close();
+
+        // Add new items
+        for (FeedParser.Entry e : entryMap.values()) {
+            Log.i(TAG, "Scheduling insert: entry_id=" + e.id);
+            batch.add(ContentProviderOperation.newInsert(FeedContract.Entry.CONTENT_URI)
+                    .withValue(FeedContract.Entry.COLUMN_NAME_ENTRY_ID, e.id)
+                    .withValue(FeedContract.Entry.COLUMN_NAME_TITLE, e.title)
+                    .withValue(FeedContract.Entry.COLUMN_NAME_LINK, e.link)
+                    .withValue(FeedContract.Entry.COLUMN_NAME_PUBLISHED, e.published)
+                    .build());
+            syncResult.stats.numInserts++;
+        }
+        Log.i(TAG, "Merge solution ready. Applying batch update");
+        mContentResolver.applyBatch(FeedContract.CONTENT_AUTHORITY, batch);
+        mContentResolver.notifyChange(
+                FeedContract.Entry.CONTENT_URI, // URI where data was modified
+                null,                           // No local observer
+                false);                         // IMPORTANT: Do not sync to network
+        // This sample doesn't support uploads, but if *your* code does, make sure you set
+        // syncToNetwork=false in the line above to prevent duplicate syncs.
+    }
+
+    /**
+     * Given a string representation of a URL, sets up a connection and gets an input stream.
+     */
+    private InputStream downloadUrl(final URL url) throws IOException {
+        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+        conn.setReadTimeout(NET_READ_TIMEOUT_MILLIS /* milliseconds */);
+        conn.setConnectTimeout(NET_CONNECT_TIMEOUT_MILLIS /* milliseconds */);
+        conn.setRequestMethod("GET");
+        conn.setDoInput(true);
+        // Starts the query
+        conn.connect();
+        return conn.getInputStream();
+    }
+}
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncService.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncService.java
new file mode 100644
index 0000000..bd92f37
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncService.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2013 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.example.android.network.sync.basicsyncadapter;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+import android.util.Log;
+
+/** Service to handle sync requests.
+ *
+ * <p>This service is invoked in response to Intents with action android.content.SyncAdapter, and
+ * returns a Binder connection to SyncAdapter.
+ *
+ * <p>For performance, only one sync adapter will be initialized within this application's context.
+ *
+ * <p>Note: The SyncService itself is not notified when a new sync occurs. It's role is to
+ * manage the lifecycle of our {@link SyncAdapter} and provide a handle to said SyncAdapter to the
+ * OS on request.
+ */
+public class SyncService extends Service {
+    private static final String TAG = "SyncService";
+
+    private static final Object sSyncAdapterLock = new Object();
+    private static SyncAdapter sSyncAdapter = null;
+
+    /**
+     * Thread-safe constructor, creates static {@link SyncAdapter} instance.
+     */
+    @Override
+    public void onCreate() {
+        super.onCreate();
+        Log.i(TAG, "Service created");
+        synchronized (sSyncAdapterLock) {
+            if (sSyncAdapter == null) {
+                sSyncAdapter = new SyncAdapter(getApplicationContext(), true);
+            }
+        }
+    }
+
+    @Override
+    /**
+     * Logging-only destructor.
+     */
+    public void onDestroy() {
+        super.onDestroy();
+        Log.i(TAG, "Service destroyed");
+    }
+
+    /**
+     * Return Binder handle for IPC communication with {@link SyncAdapter}.
+     *
+     * <p>New sync requests will be sent directly to the SyncAdapter using this channel.
+     *
+     * @param intent Calling intent
+     * @return Binder handle for {@link SyncAdapter}
+     */
+    @Override
+    public IBinder onBind(Intent intent) {
+        return sSyncAdapter.getSyncAdapterBinder();
+    }
+}
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncUtils.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncUtils.java
new file mode 100644
index 0000000..c6552da
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/SyncUtils.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2013 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.example.android.network.sync.basicsyncadapter;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+
+import com.example.android.common.accounts.GenericAccountService;
+import com.example.android.network.sync.basicsyncadapter.provider.FeedContract;
+
+/**
+ * Static helper methods for working with the sync framework.
+ */
+public class SyncUtils {
+    private static final long SYNC_FREQUENCY = 60 * 60;  // 1 hour (in seconds)
+    private static final String CONTENT_AUTHORITY = FeedContract.CONTENT_AUTHORITY;
+    private static final String PREF_SETUP_COMPLETE = "setup_complete";
+
+    /**
+     * Create an entry for this application in the system account list, if it isn't already there.
+     *
+     * @param context Context
+     */
+    public static void CreateSyncAccount(Context context) {
+        boolean newAccount = false;
+        boolean setupComplete = PreferenceManager
+                .getDefaultSharedPreferences(context).getBoolean(PREF_SETUP_COMPLETE, false);
+
+        // Create account, if it's missing. (Either first run, or user has deleted account.)
+        Account account = GenericAccountService.GetAccount();
+        AccountManager accountManager = (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
+        if (accountManager.addAccountExplicitly(account, null, null)) {
+            // Inform the system that this account supports sync
+            ContentResolver.setIsSyncable(account, CONTENT_AUTHORITY, 1);
+            // Inform the system that this account is eligible for auto sync when the network is up
+            ContentResolver.setSyncAutomatically(account, CONTENT_AUTHORITY, true);
+            // Recommend a schedule for automatic synchronization. The system may modify this based
+            // on other scheduled syncs and network utilization.
+            ContentResolver.addPeriodicSync(
+                    account, CONTENT_AUTHORITY, new Bundle(),SYNC_FREQUENCY);
+            newAccount = true;
+        }
+
+        // Schedule an initial sync if we detect problems with either our account or our local
+        // data has been deleted. (Note that it's possible to clear app data WITHOUT affecting
+        // the account list, so wee need to check both.)
+        if (newAccount || !setupComplete) {
+            TriggerRefresh();
+            PreferenceManager.getDefaultSharedPreferences(context).edit()
+                    .putBoolean(PREF_SETUP_COMPLETE, true).commit();
+        }
+    }
+
+    /**
+     * Helper method to trigger an immediate sync ("refresh").
+     *
+     * <p>This should only be used when we need to preempt the normal sync schedule. Typically, this
+     * means the user has pressed the "refresh" button.
+     *
+     * Note that SYNC_EXTRAS_MANUAL will cause an immediate sync, without any optimization to
+     * preserve battery life. If you know new data is available (perhaps via a GCM notification),
+     * but the user is not actively waiting for that data, you should omit this flag; this will give
+     * the OS additional freedom in scheduling your sync request.
+     */
+    public static void TriggerRefresh() {
+        Bundle b = new Bundle();
+        // Disable sync backoff and ignore sync preferences. In other words...perform sync NOW!
+        b.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
+        b.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
+        ContentResolver.requestSync(
+                GenericAccountService.GetAccount(),      // Sync account
+                FeedContract.CONTENT_AUTHORITY, // Content authority
+                b);                                      // Extras
+    }
+}
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/net/FeedParser.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/net/FeedParser.java
new file mode 100644
index 0000000..2bcbc0f
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/net/FeedParser.java
@@ -0,0 +1,278 @@
+/*
+ * Copyright 2013 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.network.sync.basicsyncadapter.net;
+
+import android.text.format.Time;
+import android.util.Xml;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This class parses generic Atom feeds.
+ *
+ * <p>Given an InputStream representation of a feed, it returns a List of entries,
+ * where each list element represents a single entry (post) in the XML feed.
+ *
+ * <p>An example of an Atom feed can be found at:
+ * http://en.wikipedia.org/w/index.php?title=Atom_(standard)&oldid=560239173#Example_of_an_Atom_1.0_feed
+ */
+public class FeedParser {
+
+    // Constants indicting XML element names that we're interested in
+    private static final int TAG_ID = 1;
+    private static final int TAG_TITLE = 2;
+    private static final int TAG_PUBLISHED = 3;
+    private static final int TAG_LINK = 4;
+
+    // We don't use XML namespaces
+    private static final String ns = null;
+
+    /** Parse an Atom feed, returning a collection of Entry objects.
+     *
+     * @param in Atom feed, as a stream.
+     * @return List of {@link Entry} objects.
+     * @throws XmlPullParserException on error parsing feed.
+     * @throws IOException on I/O error.
+     */
+    public List<Entry> parse(InputStream in)
+            throws XmlPullParserException, IOException, ParseException {
+        try {
+            XmlPullParser parser = Xml.newPullParser();
+            parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
+            parser.setInput(in, null);
+            parser.nextTag();
+            return readFeed(parser);
+        } finally {
+            in.close();
+        }
+    }
+
+    /**
+     * Decode a feed attached to an XmlPullParser.
+     *
+     * @param parser Incoming XMl
+     * @return List of {@link Entry} objects.
+     * @throws XmlPullParserException on error parsing feed.
+     * @throws IOException on I/O error.
+     */
+    private List<Entry> readFeed(XmlPullParser parser)
+            throws XmlPullParserException, IOException, ParseException {
+        List<Entry> entries = new ArrayList<Entry>();
+
+        // Search for <feed> tags. These wrap the beginning/end of an Atom document.
+        //
+        // Example:
+        // <?xml version="1.0" encoding="utf-8"?>
+        // <feed xmlns="http://www.w3.org/2005/Atom">
+        // ...
+        // </feed>
+        parser.require(XmlPullParser.START_TAG, ns, "feed");
+        while (parser.next() != XmlPullParser.END_TAG) {
+            if (parser.getEventType() != XmlPullParser.START_TAG) {
+                continue;
+            }
+            String name = parser.getName();
+            // Starts by looking for the <entry> tag. This tag repeates inside of <feed> for each
+            // article in the feed.
+            //
+            // Example:
+            // <entry>
+            //   <title>Article title</title>
+            //   <link rel="alternate" type="text/html" href="http://example.com/article/1234"/>
+            //   <link rel="edit" href="http://example.com/admin/article/1234"/>
+            //   <id>urn:uuid:218AC159-7F68-4CC6-873F-22AE6017390D</id>
+            //   <published>2003-06-27T12:00:00Z</published>
+            //   <updated>2003-06-28T12:00:00Z</updated>
+            //   <summary>Article summary goes here.</summary>
+            //   <author>
+            //     <name>Rick Deckard</name>
+            //     <email>deckard@example.com</email>
+            //   </author>
+            // </entry>
+            if (name.equals("entry")) {
+                entries.add(readEntry(parser));
+            } else {
+                skip(parser);
+            }
+        }
+        return entries;
+    }
+
+    /**
+     * Parses the contents of an entry. If it encounters a title, summary, or link tag, hands them
+     * off to their respective "read" methods for processing. Otherwise, skips the tag.
+     */
+    private Entry readEntry(XmlPullParser parser)
+            throws XmlPullParserException, IOException, ParseException {
+        parser.require(XmlPullParser.START_TAG, ns, "entry");
+        String id = null;
+        String title = null;
+        String link = null;
+        long publishedOn = 0;
+
+        while (parser.next() != XmlPullParser.END_TAG) {
+            if (parser.getEventType() != XmlPullParser.START_TAG) {
+                continue;
+            }
+            String name = parser.getName();
+            if (name.equals("id")){
+                // Example: <id>urn:uuid:218AC159-7F68-4CC6-873F-22AE6017390D</id>
+                id = readTag(parser, TAG_ID);
+            } else if (name.equals("title")) {
+                // Example: <title>Article title</title>
+                title = readTag(parser, TAG_TITLE);
+            } else if (name.equals("link")) {
+                // Example: <link rel="alternate" type="text/html" href="http://example.com/article/1234"/>
+                //
+                // Multiple link types can be included. readAlternateLink() will only return
+                // non-null when reading an "alternate"-type link. Ignore other responses.
+                String tempLink = readTag(parser, TAG_LINK);
+                if (tempLink != null) {
+                    link = tempLink;
+                }
+            } else if (name.equals("published")) {
+                // Example: <published>2003-06-27T12:00:00Z</published>
+                Time t = new Time();
+                t.parse3339(readTag(parser, TAG_PUBLISHED));
+                publishedOn = t.toMillis(false);
+            } else {
+                skip(parser);
+            }
+        }
+        return new Entry(id, title, link, publishedOn);
+    }
+
+    /**
+     * Process an incoming tag and read the selected value from it.
+     */
+    private String readTag(XmlPullParser parser, int tagType)
+            throws IOException, XmlPullParserException {
+        String tag = null;
+        String endTag = null;
+
+        switch (tagType) {
+            case TAG_ID:
+                return readBasicTag(parser, "id");
+            case TAG_TITLE:
+                return readBasicTag(parser, "title");
+            case TAG_PUBLISHED:
+                return readBasicTag(parser, "published");
+            case TAG_LINK:
+                return readAlternateLink(parser);
+            default:
+                throw new IllegalArgumentException("Unknown tag type: " + tagType);
+        }
+    }
+
+    /**
+     * Reads the body of a basic XML tag, which is guaranteed not to contain any nested elements.
+     *
+     * <p>You probably want to call readTag().
+     *
+     * @param parser Current parser object
+     * @param tag XML element tag name to parse
+     * @return Body of the specified tag
+     * @throws IOException
+     * @throws XmlPullParserException
+     */
+    private String readBasicTag(XmlPullParser parser, String tag)
+            throws IOException, XmlPullParserException {
+        parser.require(XmlPullParser.START_TAG, ns, tag);
+        String result = readText(parser);
+        parser.require(XmlPullParser.END_TAG, ns, tag);
+        return result;
+    }
+
+    /**
+     * Processes link tags in the feed.
+     */
+    private String readAlternateLink(XmlPullParser parser)
+            throws IOException, XmlPullParserException {
+        String link = null;
+        parser.require(XmlPullParser.START_TAG, ns, "link");
+        String tag = parser.getName();
+        String relType = parser.getAttributeValue(null, "rel");
+        if (relType.equals("alternate")) {
+            link = parser.getAttributeValue(null, "href");
+        }
+        while (true) {
+            if (parser.nextTag() == XmlPullParser.END_TAG) break;
+            // Intentionally break; consumes any remaining sub-tags.
+        }
+        return link;
+    }
+
+    /**
+     * For the tags title and summary, extracts their text values.
+     */
+    private String readText(XmlPullParser parser) throws IOException, XmlPullParserException {
+        String result = null;
+        if (parser.next() == XmlPullParser.TEXT) {
+            result = parser.getText();
+            parser.nextTag();
+        }
+        return result;
+    }
+
+    /**
+     * Skips tags the parser isn't interested in. Uses depth to handle nested tags. i.e.,
+     * if the next tag after a START_TAG isn't a matching END_TAG, it keeps going until it
+     * finds the matching END_TAG (as indicated by the value of "depth" being 0).
+     */
+    private void skip(XmlPullParser parser) throws XmlPullParserException, IOException {
+        if (parser.getEventType() != XmlPullParser.START_TAG) {
+            throw new IllegalStateException();
+        }
+        int depth = 1;
+        while (depth != 0) {
+            switch (parser.next()) {
+                case XmlPullParser.END_TAG:
+                    depth--;
+                    break;
+                case XmlPullParser.START_TAG:
+                    depth++;
+                    break;
+            }
+        }
+    }
+
+    /**
+     * This class represents a single entry (post) in the XML feed.
+     *
+     * <p>It includes the data members "title," "link," and "summary."
+     */
+    public static class Entry {
+        public final String id;
+        public final String title;
+        public final String link;
+        public final long published;
+
+        Entry(String id, String title, String link, long published) {
+            this.id = id;
+            this.title = title;
+            this.link = link;
+            this.published = published;
+        }
+    }
+}
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedContract.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedContract.java
new file mode 100644
index 0000000..7bfcf7f
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedContract.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2013 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.network.sync.basicsyncadapter.provider;
+
+import android.content.ContentResolver;
+import android.net.Uri;
+import android.provider.BaseColumns;
+
+/**
+ * Field and table name constants for
+ * {@link com.example.android.network.sync.basicsyncadapter.provider.FeedProvider}.
+ */
+public class FeedContract {
+    private FeedContract() {
+    }
+
+    /**
+     * Content provider authority.
+     */
+    public static final String CONTENT_AUTHORITY = "com.example.android.network.sync.basicsyncadapter";
+
+    /**
+     * Base URI. (content://com.example.android.network.sync.basicsyncadapter)
+     */
+    public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);
+
+    /**
+     * Path component for "entry"-type resources..
+     */
+    private static final String PATH_ENTRIES = "entries";
+
+    /**
+     * Columns supported by "entries" records.
+     */
+    public static class Entry implements BaseColumns {
+        /**
+         * MIME type for lists of entries.
+         */
+        public static final String CONTENT_TYPE =
+                ContentResolver.CURSOR_DIR_BASE_TYPE + "/vnd.basicsyncadapter.entries";
+        /**
+         * MIME type for individual entries.
+         */
+        public static final String CONTENT_ITEM_TYPE =
+                ContentResolver.CURSOR_ITEM_BASE_TYPE + "/vnd.basicsyncadapter.entry";
+
+        /**
+         * Fully qualified URI for "entry" resources.
+         */
+        public static final Uri CONTENT_URI =
+                BASE_CONTENT_URI.buildUpon().appendPath(PATH_ENTRIES).build();
+
+        /**
+         * Table name where records are stored for "entry" resources.
+         */
+        public static final String TABLE_NAME = "entry";
+        /**
+         * Atom ID. (Note: Not to be confused with the database primary key, which is _ID.
+         */
+        public static final String COLUMN_NAME_ENTRY_ID = "entry_id";
+        /**
+         * Article title
+         */
+        public static final String COLUMN_NAME_TITLE = "title";
+        /**
+         * Article hyperlink. Corresponds to the rel="alternate" link in the
+         * Atom spec.
+         */
+        public static final String COLUMN_NAME_LINK = "link";
+        /**
+         * Date article was published.
+         */
+        public static final String COLUMN_NAME_PUBLISHED = "published";
+    }
+}
\ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedProvider.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedProvider.java
new file mode 100644
index 0000000..358e324
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/java/com/example/android/network/sync/basicsyncadapter/provider/FeedProvider.java
@@ -0,0 +1,252 @@
+/*
+ * Copyright 2013 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.network.sync.basicsyncadapter.provider;
+
+import android.content.ContentProvider;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.UriMatcher;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+import android.net.Uri;
+
+import com.example.android.common.db.SelectionBuilder;
+
+public class FeedProvider extends ContentProvider {
+    FeedDatabase mDatabaseHelper;
+
+    /**
+     * Content authority for this provider.
+     */
+    private static final String AUTHORITY = FeedContract.CONTENT_AUTHORITY;
+
+    // The constants below represent individual URI routes, as IDs. Every URI pattern recognized by
+    // this ContentProvider is defined using sUriMatcher.addURI(), and associated with one of these
+    // IDs.
+    //
+    // When a incoming URI is run through sUriMatcher, it will be tested against the defined
+    // URI patterns, and the corresponding route ID will be returned.
+    /**
+     * URI ID for route: /entries
+     */
+    public static final int ROUTE_ENTRIES = 1;
+
+    /**
+     * URI ID for route: /entries/{ID}
+     */
+    public static final int ROUTE_ENTRIES_ID = 2;
+
+    /**
+     * UriMatcher, used to decode incoming URIs.
+     */
+    private static final UriMatcher sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
+    static {
+        sUriMatcher.addURI(AUTHORITY, "entries", ROUTE_ENTRIES);
+        sUriMatcher.addURI(AUTHORITY, "entries/*", ROUTE_ENTRIES_ID);
+    }
+
+    @Override
+    public boolean onCreate() {
+        mDatabaseHelper = new FeedDatabase(getContext());
+        return true;
+    }
+
+    /**
+     * Determine the mime type for entries returned by a given URI.
+     */
+    @Override
+    public String getType(Uri uri) {
+        final int match = sUriMatcher.match(uri);
+        switch (match) {
+            case ROUTE_ENTRIES:
+                return FeedContract.Entry.CONTENT_TYPE;
+            case ROUTE_ENTRIES_ID:
+                return FeedContract.Entry.CONTENT_ITEM_TYPE;
+            default:
+                throw new UnsupportedOperationException("Unknown uri: " + uri);
+        }
+    }
+
+    /**
+     * Perform a database query by URI.
+     *
+     * <p>Currently supports returning all entries (/entries) and individual entries by ID
+     * (/entries/{ID}).
+     */
+    @Override
+    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
+                        String sortOrder) {
+        SQLiteDatabase db = mDatabaseHelper.getReadableDatabase();
+        SelectionBuilder builder = new SelectionBuilder();
+        int uriMatch = sUriMatcher.match(uri);
+        switch (uriMatch) {
+            case ROUTE_ENTRIES_ID:
+                // Return a single entry, by ID.
+                String id = uri.getLastPathSegment();
+                builder.where(FeedContract.Entry._ID + "=?", id);
+            case ROUTE_ENTRIES:
+                // Return all known entries.
+                builder.table(FeedContract.Entry.TABLE_NAME)
+                       .where(selection, selectionArgs);
+                Cursor c = builder.query(db, projection, sortOrder);
+                // Note: Notification URI must be manually set here for loaders to correctly
+                // register ContentObservers.
+                Context ctx = getContext();
+                assert ctx != null;
+                c.setNotificationUri(ctx.getContentResolver(), uri);
+                return c;
+            default:
+                throw new UnsupportedOperationException("Unknown uri: " + uri);
+        }
+    }
+
+    /**
+     * Insert a new entry into the database.
+     */
+    @Override
+    public Uri insert(Uri uri, ContentValues values) {
+        final SQLiteDatabase db = mDatabaseHelper.getWritableDatabase();
+        assert db != null;
+        final int match = sUriMatcher.match(uri);
+        Uri result;
+        switch (match) {
+            case ROUTE_ENTRIES:
+                long id = db.insertOrThrow(FeedContract.Entry.TABLE_NAME, null, values);
+                result = Uri.parse(FeedContract.Entry.CONTENT_URI + "/" + id);
+                break;
+            case ROUTE_ENTRIES_ID:
+                throw new UnsupportedOperationException("Insert not supported on URI: " + uri);
+            default:
+                throw new UnsupportedOperationException("Unknown uri: " + uri);
+        }
+        // Send broadcast to registered ContentObservers, to refresh UI.
+        Context ctx = getContext();
+        assert ctx != null;
+        ctx.getContentResolver().notifyChange(uri, null, false);
+        return result;
+    }
+
+    /**
+     * Delete an entry by database by URI.
+     */
+    @Override
+    public int delete(Uri uri, String selection, String[] selectionArgs) {
+        SelectionBuilder builder = new SelectionBuilder();
+        final SQLiteDatabase db = mDatabaseHelper.getWritableDatabase();
+        final int match = sUriMatcher.match(uri);
+        int count;
+        switch (match) {
+            case ROUTE_ENTRIES:
+                count = builder.table(FeedContract.Entry.TABLE_NAME)
+                        .where(selection, selectionArgs)
+                        .delete(db);
+                break;
+            case ROUTE_ENTRIES_ID:
+                String id = uri.getLastPathSegment();
+                count = builder.table(FeedContract.Entry.TABLE_NAME)
+                       .where(FeedContract.Entry._ID + "=?", id)
+                       .where(selection, selectionArgs)
+                       .delete(db);
+                break;
+            default:
+                throw new UnsupportedOperationException("Unknown uri: " + uri);
+        }
+        // Send broadcast to registered ContentObservers, to refresh UI.
+        Context ctx = getContext();
+        assert ctx != null;
+        ctx.getContentResolver().notifyChange(uri, null, false);
+        return count;
+    }
+
+    /**
+     * Update an etry in the database by URI.
+     */
+    @Override
+    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
+        SelectionBuilder builder = new SelectionBuilder();
+        final SQLiteDatabase db = mDatabaseHelper.getWritableDatabase();
+        final int match = sUriMatcher.match(uri);
+        int count;
+        switch (match) {
+            case ROUTE_ENTRIES:
+                count = builder.table(FeedContract.Entry.TABLE_NAME)
+                        .where(selection, selectionArgs)
+                        .update(db, values);
+                break;
+            case ROUTE_ENTRIES_ID:
+                String id = uri.getLastPathSegment();
+                count = builder.table(FeedContract.Entry.TABLE_NAME)
+                        .where(FeedContract.Entry._ID + "=?", id)
+                        .where(selection, selectionArgs)
+                        .update(db, values);
+                break;
+            default:
+                throw new UnsupportedOperationException("Unknown uri: " + uri);
+        }
+        Context ctx = getContext();
+        assert ctx != null;
+        ctx.getContentResolver().notifyChange(uri, null, false);
+        return count;
+    }
+
+    /**
+     * SQLite backend for @{link FeedProvider}.
+     *
+     * Provides access to an disk-backed, SQLite datastore which is utilized by FeedProvider. This
+     * database should never be accessed by other parts of the application directly.
+     */
+    static class FeedDatabase extends SQLiteOpenHelper {
+        /** Schema version. */
+        public static final int DATABASE_VERSION = 1;
+        /** Filename for SQLite file. */
+        public static final String DATABASE_NAME = "feed.db";
+
+        private static final String TYPE_TEXT = " TEXT";
+        private static final String TYPE_INTEGER = " INTEGER";
+        private static final String COMMA_SEP = ",";
+        /** SQL statement to create "entry" table. */
+        private static final String SQL_CREATE_ENTRIES =
+                "CREATE TABLE " + FeedContract.Entry.TABLE_NAME + " (" +
+                        FeedContract.Entry._ID + " INTEGER PRIMARY KEY," +
+                        FeedContract.Entry.COLUMN_NAME_ENTRY_ID + TYPE_TEXT + COMMA_SEP +
+                        FeedContract.Entry.COLUMN_NAME_TITLE    + TYPE_TEXT + COMMA_SEP +
+                        FeedContract.Entry.COLUMN_NAME_LINK + TYPE_TEXT + COMMA_SEP +
+                        FeedContract.Entry.COLUMN_NAME_PUBLISHED + TYPE_INTEGER + ")";
+
+        /** SQL statement to drop "entry" table. */
+        private static final String SQL_DELETE_ENTRIES =
+                "DROP TABLE IF EXISTS " + FeedContract.Entry.TABLE_NAME;
+
+        public FeedDatabase(Context context) {
+            super(context, DATABASE_NAME, null, DATABASE_VERSION);
+        }
+
+        @Override
+        public void onCreate(SQLiteDatabase db) {
+            db.execSQL(SQL_CREATE_ENTRIES);
+        }
+
+        @Override
+        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+            // This database is only a cache for online data, so its upgrade policy is
+            // to simply to discard the data and start over
+            db.execSQL(SQL_DELETE_ENTRIES);
+            onCreate(db);
+        }
+    }
+}
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-hdpi/ic_launcher.png b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-hdpi/ic_launcher.png
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-hdpi/ic_launcher.png
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-mdpi/ic_launcher.png b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-mdpi/ic_launcher.png
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-mdpi/ic_launcher.png
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xhdpi/ic_action_refresh.png b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xhdpi/ic_action_refresh.png
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xhdpi/ic_action_refresh.png
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xhdpi/ic_action_refresh.png
Binary files differ
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xhdpi/ic_launcher.png b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xhdpi/ic_launcher.png
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xhdpi/ic_launcher.png
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xxhdpi/ic_launcher.png b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xxhdpi/ic_launcher.png
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/drawable-xxhdpi/ic_launcher.png
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/layout/actionbar_indeterminate_progress.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/layout/actionbar_indeterminate_progress.xml
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/layout/actionbar_indeterminate_progress.xml
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/layout/actionbar_indeterminate_progress.xml
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/layout/activity_entry_list.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/layout/activity_entry_list.xml
new file mode 100644
index 0000000..6e3e2fd
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/layout/activity_entry_list.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<fragment xmlns:android="http://schemas.android.com/apk/res/android"
+          xmlns:tools="http://schemas.android.com/tools"
+          android:id="@+id/entry_list"
+          android:name="com.example.android.network.sync.basicsyncadapter.EntryListFragment"
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:layout_marginLeft="16dp"
+          android:layout_marginRight="16dp"
+          tools:context=".EntryListActivity"
+          tools:layout="@android:layout/list_content" />
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/menu/main.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/menu/main.xml
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/menu/main.xml
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/menu/main.xml
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v11/styles.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v11/styles.xml
new file mode 100644
index 0000000..ff65301
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v11/styles.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright 2013 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>
+
+    <!--
+        Base application theme for API 11+. This theme completely replaces
+        AppBaseTheme from res/values/styles.xml on API 11+ devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
+        <!-- API 11 theme customizations can go here. -->
+    </style>
+
+</resources>
\ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v14/styles.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v14/styles.xml
new file mode 100644
index 0000000..a4a443a
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values-v14/styles.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright 2013 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>
+
+    <!--
+        Base application theme for API 14+. This theme completely replaces
+        AppBaseTheme from BOTH res/values/styles.xml and
+        res/values-v11/styles.xml on API 14+ devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+        <!-- API 14 theme customizations can go here. -->
+    </style>
+
+</resources>
\ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/attrs.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/attrs.xml
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/attrs.xml
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/attrs.xml
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/dimen.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/dimen.xml
similarity index 100%
rename from connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/res/values/dimen.xml
rename to connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/dimen.xml
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/strings.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/strings.xml
new file mode 100644
index 0000000..0271850
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/strings.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright 2013 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="app_name">FeedSync Sample</string>
+    <string name="account_name">FeedSync Service</string>
+    <string name="title_entry_detail">Entry Detail</string>
+    <string name="loading">Waiting for sync...</string>
+    <string name="description_refresh">Refresh</string>
+</resources>
\ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/styles.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/styles.xml
new file mode 100644
index 0000000..43a8f2b
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/values/styles.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright 2013 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>
+
+    <!--
+        Base application theme, dependent on API level. This theme is replaced
+        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Light">
+        <!--
+            Theme customizations available in newer API levels can go in
+            res/values-vXX/styles.xml, while customizations related to
+            backward-compatibility can go here.
+        -->
+    </style>
+
+    <!-- Application theme. -->
+    <style name="AppTheme" parent="AppBaseTheme">
+        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+    </style>
+
+</resources>
\ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/authenticator.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/authenticator.xml
new file mode 100644
index 0000000..cb69a66
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/authenticator.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright 2013 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.
+-->
+
+<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
+                       android:accountType="com.example.android.network.sync.basicsyncadapter"
+                       android:icon="@drawable/ic_launcher"
+                       android:smallIcon="@drawable/ic_launcher"
+                       android:label="@string/app_name"
+        />
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/syncadapter.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/syncadapter.xml
new file mode 100644
index 0000000..0fcd6e3
--- /dev/null
+++ b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapter/src/main/res/xml/syncadapter.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright 2013 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.
+-->
+
+<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
+              android:contentAuthority="com.example.android.network.sync.basicsyncadapter"
+              android:accountType="com.example.android.network.sync.basicsyncadapter"
+              android:userVisible="false"
+              android:supportsUploading="false"
+              android:allowParallelSyncs="false"
+              android:isAlwaysSyncable="true"
+        />
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/.gitignore b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/.gitignore
deleted file mode 100644
index 6eb878d..0000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/.gitignore
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2013 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.
-src/template/
-src/common/
-build.gradle
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/proguard-project.txt b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/proguard-project.txt
deleted file mode 100644
index 0d8f171..0000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/proguard-project.txt
+++ /dev/null
@@ -1,20 +0,0 @@
- To enable ProGuard in your project, edit project.properties
-# to define the proguard.config property as described in that file.
-#
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in ${sdk.dir}/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the ProGuard
-# include property in project.properties.
-#
-# For more details, see
-#   http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-#   public *;
-#}
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/AndroidManifest.xml b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/AndroidManifest.xml
deleted file mode 100644
index dd59b06..0000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2013 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.basicsyncadapter"
-    android:versionCode="1"
-    android:versionName="1.0">
-
-    <!-- SyncAdapters are available in API 5 and above. We use API 7 as a baseline for samples. -->
-    <uses-sdk
-        android:minSdkVersion="7"
-        android:targetSdkVersion="17" />
-
-    <!-- Required for fetching feed data. -->
-    <uses-permission android:name="android.permission.INTERNET"/>
-    <!-- Required to register a SyncStatusObserver to display a "syncing..." progress indicator. -->
-    <uses-permission android:name="android.permission.READ_SYNC_STATS"/>
-    <!-- Required to enable our SyncAdapter after it's created. -->
-    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/>
-    <!-- Required because we're manually creating a new account. -->
-    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
-
-
-    <application
-        android:allowBackup="true"
-        android:icon="@drawable/ic_launcher"
-        android:label="@string/app_name"
-        android:theme="@style/AppTheme" >
-
-        <!-- Main activity, responsible for showing a list of feed entries. -->
-        <activity
-            android:name=".EntryListActivity"
-            android:label="@string/app_name" >
-            <!-- This intent filter places this activity in the system's app launcher. -->
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-
-        <!-- ContentProvider to store feed data.
-
-        The "authorities" here are defined as part of a ContentProvider interface. It's used here
-        as an attachment point for the SyncAdapter. See res/xml/syncadapter.xml and
-        SyncService.java.
-
-        Since this ContentProvider is not exported, it will not be accessible outside of this app's
-        package. -->
-        <provider
-            android:name=".provider.FeedProvider"
-            android:authorities="com.example.android.basicsyncadapter"
-            android:exported="false" />
-
-        <!-- This service implements our SyncAdapter. It needs to be exported, so that the system
-        sync framework can access it. -->
-        <service android:name=".SyncService"
-            android:exported="true">
-            <!-- This intent filter is required. It allows the system to launch our sync service
-            as needed. -->
-            <intent-filter>
-                <action android:name="android.content.SyncAdapter" />
-            </intent-filter>
-            <!-- This points to a required XML file which describes our SyncAdapter. -->
-            <meta-data android:name="android.content.SyncAdapter"
-                android:resource="@xml/syncadapter" />
-        </service>
-
-        <!-- This implements the account we'll use as an attachment point for our SyncAdapter. Since
-        our SyncAdapter doesn't need to authenticate the current user (it just fetches a public RSS
-        feed), this account's implementation is largely empty.
-
-        It's also possible to attach a SyncAdapter to an existing account provided by another
-        package. In that case, this element could be omitted here. -->
-        <service android:name="com.example.android.common.accounts.GenericAccountService">
-            <!-- Required filter used by the system to launch our account service. -->
-            <intent-filter>
-                <action android:name="android.accounts.AccountAuthenticator" />
-            </intent-filter>
-            <!-- This points to an XMLf ile which describes our account service. -->
-            <meta-data android:name="android.accounts.AccountAuthenticator"
-                android:resource="@xml/authenticator" />
-        </service>
-
-    </application>
-
-</manifest>
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListActivity.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListActivity.java
deleted file mode 100644
index 9d8cb77..0000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListActivity.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.example.android.basicsyncadapter;
-
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-
-/**
- * Activity for holding EntryListFragment.
- */
-public class EntryListActivity extends FragmentActivity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_entry_list);
-    }
-}
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListFragment.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListFragment.java
deleted file mode 100644
index 83e240a..0000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/EntryListFragment.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * Copyright 2013 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.basicsyncadapter;
-
-import android.accounts.Account;
-import android.annotation.TargetApi;
-import android.app.Activity;
-import android.content.ContentResolver;
-import android.content.Intent;
-import android.content.SyncStatusObserver;
-import android.database.Cursor;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Bundle;
-import android.support.v4.app.ListFragment;
-import android.support.v4.app.LoaderManager;
-import android.support.v4.content.CursorLoader;
-import android.support.v4.content.Loader;
-import android.support.v4.widget.SimpleCursorAdapter;
-import android.text.format.Time;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.ListView;
-import android.widget.TextView;
-
-import com.example.android.common.accounts.GenericAccountService;
-import com.example.android.basicsyncadapter.provider.FeedContract;
-
-/**
- * List fragment containing a list of Atom entry objects (articles) stored in the local database.
- *
- * <p>Database access is mediated by a content provider, specified in
- * {@link com.example.android.basicsyncadapter.provider.FeedProvider}. This content
- * provider is
- * automatically populated by  {@link SyncService}.
- *
- * <p>Selecting an item from the displayed list displays the article in the default browser.
- *
- * <p>If the content provider doesn't return any data, then the first sync hasn't run yet. This sync
- * adapter assumes data exists in the provider once a sync has run. If your app doesn't work like
- * this, you should add a flag that notes if a sync has run, so you can differentiate between "no
- * available data" and "no initial sync", and display this in the UI.
- *
- * <p>The ActionBar displays a "Refresh" button. When the user clicks "Refresh", the sync adapter
- * runs immediately. An indeterminate ProgressBar element is displayed, showing that the sync is
- * occurring.
- */
-public class EntryListFragment extends ListFragment
-        implements LoaderManager.LoaderCallbacks<Cursor> {
-
-    private static final String TAG = "EntryListFragment";
-
-    /**
-     * Cursor adapter for controlling ListView results.
-     */
-    private SimpleCursorAdapter mAdapter;
-
-    /**
-     * Handle to a SyncObserver. The ProgressBar element is visible until the SyncObserver reports
-     * that the sync is complete.
-     *
-     * <p>This allows us to delete our SyncObserver once the application is no longer in the
-     * foreground.
-     */
-    private Object mSyncObserverHandle;
-
-    /**
-     * Options menu used to populate ActionBar.
-     */
-    private Menu mOptionsMenu;
-
-    /**
-     * Projection for querying the content provider.
-     */
-    private static final String[] PROJECTION = new String[]{
-            FeedContract.Entry._ID,
-            FeedContract.Entry.COLUMN_NAME_TITLE,
-            FeedContract.Entry.COLUMN_NAME_LINK,
-            FeedContract.Entry.COLUMN_NAME_PUBLISHED
-    };
-
-    // Column indexes. The index of a column in the Cursor is the same as its relative position in
-    // the projection.
-    /** Column index for _ID */
-    private static final int COLUMN_ID = 0;
-    /** Column index for title */
-    private static final int COLUMN_TITLE = 1;
-    /** Column index for link */
-    private static final int COLUMN_URL_STRING = 2;
-    /** Column index for published */
-    private static final int COLUMN_PUBLISHED = 3;
-
-    /**
-     * List of Cursor columns to read from when preparing an adapter to populate the ListView.
-     */
-    private static final String[] FROM_COLUMNS = new String[]{
-            FeedContract.Entry.COLUMN_NAME_TITLE,
-            FeedContract.Entry.COLUMN_NAME_PUBLISHED
-    };
-
-    /**
-     * List of Views which will be populated by Cursor data.
-     */
-    private static final int[] TO_FIELDS = new int[]{
-            android.R.id.text1,
-            android.R.id.text2};
-
-    /**
-     * Mandatory empty constructor for the fragment manager to instantiate the
-     * fragment (e.g. upon screen orientation changes).
-     */
-    public EntryListFragment() {}
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setHasOptionsMenu(true);
-    }
-
-    /**
-     * Create SyncAccount at launch, if needed.
-     *
-     * <p>This will create a new account with the system for our application, register our
-     * {@link SyncService} with it, and establish a sync schedule.
-     */
-    @Override
-    public void onAttach(Activity activity) {
-        super.onAttach(activity);
-
-        // Create account, if needed
-        SyncUtils.CreateSyncAccount(activity);
-    }
-
-    @Override
-    public void onViewCreated(View view, Bundle savedInstanceState) {
-        super.onViewCreated(view, savedInstanceState);
-
-        mAdapter = new SimpleCursorAdapter(
-                getActivity(),       // Current context
-                android.R.layout.simple_list_item_activated_2,  // Layout for individual rows
-                null,                // Cursor
-                FROM_COLUMNS,        // Cursor columns to use
-                TO_FIELDS,           // Layout fields to use
-                0                    // No flags
-        );
-        mAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
-            @Override
-            public boolean setViewValue(View view, Cursor cursor, int i) {
-                if (i == COLUMN_PUBLISHED) {
-                    // Convert timestamp to human-readable date
-                    Time t = new Time();
-                    t.set(cursor.getLong(i));
-                    ((TextView) view).setText(t.format("%Y-%m-%d %H:%M"));
-                    return true;
-                } else {
-                    // Let SimpleCursorAdapter handle other fields automatically
-                    return false;
-                }
-            }
-        });
-        setListAdapter(mAdapter);
-        setEmptyText(getText(R.string.loading));
-        getLoaderManager().initLoader(0, null, this);
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-        mSyncStatusObserver.onStatusChanged(0);
-
-        // Watch for sync state changes
-        final int mask = ContentResolver.SYNC_OBSERVER_TYPE_PENDING |
-                ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE;
-        mSyncObserverHandle = ContentResolver.addStatusChangeListener(mask, mSyncStatusObserver);
-    }
-
-    @Override
-    public void onPause() {
-        super.onPause();
-        if (mSyncObserverHandle != null) {
-            ContentResolver.removeStatusChangeListener(mSyncObserverHandle);
-            mSyncObserverHandle = null;
-        }
-    }
-
-    /**
-     * Query the content provider for data.
-     *
-     * <p>Loaders do queries in a background thread. They also provide a ContentObserver that is
-     * triggered when data in the content provider changes. When the sync adapter updates the
-     * content provider, the ContentObserver responds by resetting the loader and then reloading
-     * it.
-     */
-    @Override
-    public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
-        // We only have one loader, so we can ignore the value of i.
-        // (It'll be '0', as set in onCreate().)
-        return new CursorLoader(getActivity(),  // Context
-                FeedContract.Entry.CONTENT_URI, // URI
-                PROJECTION,                // Projection
-                null,                           // Selection
-                null,                           // Selection args
-                FeedContract.Entry.COLUMN_NAME_PUBLISHED + " desc"); // Sort
-    }
-
-    /**
-     * Move the Cursor returned by the query into the ListView adapter. This refreshes the existing
-     * UI with the data in the Cursor.
-     */
-    @Override
-    public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
-        mAdapter.changeCursor(cursor);
-    }
-
-    /**
-     * Called when the ContentObserver defined for the content provider detects that data has
-     * changed. The ContentObserver resets the loader, and then re-runs the loader. In the adapter,
-     * set the Cursor value to null. This removes the reference to the Cursor, allowing it to be
-     * garbage-collected.
-     */
-    @Override
-    public void onLoaderReset(Loader<Cursor> cursorLoader) {
-        mAdapter.changeCursor(null);
-    }
-
-    /**
-     * Create the ActionBar.
-     */
-    @Override
-    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
-        super.onCreateOptionsMenu(menu, inflater);
-        mOptionsMenu = menu;
-        inflater.inflate(R.menu.main, menu);
-    }
-
-    /**
-     * Respond to user gestures on the ActionBar.
-     */
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        switch (item.getItemId()) {
-            // If the user clicks the "Refresh" button.
-            case R.id.menu_refresh:
-                SyncUtils.TriggerRefresh();
-                return true;
-        }
-        return super.onOptionsItemSelected(item);
-    }
-
-    /**
-     * Load an article in the default browser when selected by the user.
-     */
-    @Override
-    public void onListItemClick(ListView listView, View view, int position, long id) {
-        super.onListItemClick(listView, view, position, id);
-
-        // Get a URI for the selected item, then start an Activity that displays the URI. Any
-        // Activity that filters for ACTION_VIEW and a URI can accept this. In most cases, this will
-        // be a browser.
-
-        // Get the item at the selected position, in the form of a Cursor.
-        Cursor c = (Cursor) mAdapter.getItem(position);
-        // Get the link to the article represented by the item.
-        String articleUrlString = c.getString(COLUMN_URL_STRING);
-        if (articleUrlString == null) {
-            Log.e(TAG, "Attempt to launch entry with null link");
-            return;
-        }
-
-        Log.i(TAG, "Opening URL: " + articleUrlString);
-        // Get a Uri object for the URL string
-        Uri articleURL = Uri.parse(articleUrlString);
-        Intent i = new Intent(Intent.ACTION_VIEW, articleURL);
-        startActivity(i);
-    }
-
-    /**
-     * Set the state of the Refresh button. If a sync is active, turn on the ProgressBar widget.
-     * Otherwise, turn it off.
-     *
-     * @param refreshing True if an active sync is occuring, false otherwise
-     */
-    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
-    public void setRefreshActionButtonState(boolean refreshing) {
-        if (mOptionsMenu == null || Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
-            return;
-        }
-
-        final MenuItem refreshItem = mOptionsMenu.findItem(R.id.menu_refresh);
-        if (refreshItem != null) {
-            if (refreshing) {
-                refreshItem.setActionView(R.layout.actionbar_indeterminate_progress);
-            } else {
-                refreshItem.setActionView(null);
-            }
-        }
-    }
-
-    /**
-     * Crfate a new anonymous SyncStatusObserver. It's attached to the app's ContentResolver in
-     * onResume(), and removed in onPause(). If status changes, it sets the state of the Refresh
-     * button. If a sync is active or pending, the Refresh button is replaced by an indeterminate
-     * ProgressBar; otherwise, the button itself is displayed.
-     */
-    private SyncStatusObserver mSyncStatusObserver = new SyncStatusObserver() {
-        /** Callback invoked with the sync adapter status changes. */
-        @Override
-        public void onStatusChanged(int which) {
-            getActivity().runOnUiThread(new Runnable() {
-                /**
-                 * The SyncAdapter runs on a background thread. To update the UI, onStatusChanged()
-                 * runs on the UI thread.
-                 */
-                @Override
-                public void run() {
-                    // Create a handle to the account that was created by
-                    // SyncService.CreateSyncAccount(). This will be used to query the system to
-                    // see how the sync status has changed.
-                    Account account = GenericAccountService.GetAccount(SyncUtils.ACCOUNT_TYPE);
-                    if (account == null) {
-                        // GetAccount() returned an invalid value. This shouldn't happen, but
-                        // we'll set the status to "not refreshing".
-                        setRefreshActionButtonState(false);
-                        return;
-                    }
-
-                    // Test the ContentResolver to see if the sync adapter is active or pending.
-                    // Set the state of the refresh button accordingly.
-                    boolean syncActive = ContentResolver.isSyncActive(
-                            account, FeedContract.CONTENT_AUTHORITY);
-                    boolean syncPending = ContentResolver.isSyncPending(
-                            account, FeedContract.CONTENT_AUTHORITY);
-                    setRefreshActionButtonState(syncActive || syncPending);
-                }
-            });
-        }
-    };
-
-}
\ No newline at end of file
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncAdapter.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncAdapter.java
deleted file mode 100644
index da67107..0000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncAdapter.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * Copyright 2013 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.basicsyncadapter;
-
-import android.accounts.Account;
-import android.annotation.TargetApi;
-import android.content.AbstractThreadedSyncAdapter;
-import android.content.ContentProviderClient;
-import android.content.ContentProviderOperation;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.OperationApplicationException;
-import android.content.SyncResult;
-import android.database.Cursor;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.example.android.basicsyncadapter.net.FeedParser;
-import com.example.android.basicsyncadapter.provider.FeedContract;
-
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * Define a sync adapter for the app.
- *
- * <p>This class is instantiated in {@link SyncService}, which also binds SyncAdapter to the system.
- * SyncAdapter should only be initialized in SyncService, never anywhere else.
- *
- * <p>The system calls onPerformSync() via an RPC call through the IBinder object supplied by
- * SyncService.
- */
-class SyncAdapter extends AbstractThreadedSyncAdapter {
-    public static final String TAG = "SyncAdapter";
-
-    /**
-     * URL to fetch content from during a sync.
-     *
-     * <p>This points to the Android Developers Blog. (Side note: We highly recommend reading the
-     * Android Developer Blog to stay up to date on the latest Android platform developments!)
-     */
-    private static final String FEED_URL = "http://android-developers.blogspot.com/atom.xml";
-
-    /**
-     * Network connection timeout, in milliseconds.
-     */
-    private static final int NET_CONNECT_TIMEOUT_MILLIS = 15000;  // 15 seconds
-
-    /**
-     * Network read timeout, in milliseconds.
-     */
-    private static final int NET_READ_TIMEOUT_MILLIS = 10000;  // 10 seconds
-
-    /**
-     * Content resolver, for performing database operations.
-     */
-    private final ContentResolver mContentResolver;
-
-    /**
-     * Project used when querying content provider. Returns all known fields.
-     */
-    private static final String[] PROJECTION = new String[] {
-            FeedContract.Entry._ID,
-            FeedContract.Entry.COLUMN_NAME_ENTRY_ID,
-            FeedContract.Entry.COLUMN_NAME_TITLE,
-            FeedContract.Entry.COLUMN_NAME_LINK,
-            FeedContract.Entry.COLUMN_NAME_PUBLISHED};
-
-    // Constants representing column positions from PROJECTION.
-    public static final int COLUMN_ID = 0;
-    public static final int COLUMN_ENTRY_ID = 1;
-    public static final int COLUMN_TITLE = 2;
-    public static final int COLUMN_LINK = 3;
-    public static final int COLUMN_PUBLISHED = 4;
-
-    /**
-     * Constructor. Obtains handle to content resolver for later use.
-     */
-    public SyncAdapter(Context context, boolean autoInitialize) {
-        super(context, autoInitialize);
-        mContentResolver = context.getContentResolver();
-    }
-
-    /**
-     * Constructor. Obtains handle to content resolver for later use.
-     */
-    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
-    public SyncAdapter(Context context, boolean autoInitialize, boolean allowParallelSyncs) {
-        super(context, autoInitialize, allowParallelSyncs);
-        mContentResolver = context.getContentResolver();
-    }
-
-    /**
-     * Called by the Android system in response to a request to run the sync adapter. The work
-     * required to read data from the network, parse it, and store it in the content provider is
-     * done here. Extending AbstractThreadedSyncAdapter ensures that all methods within SyncAdapter
-     * run on a background thread. For this reason, blocking I/O and other long-running tasks can be
-     * run <em>in situ</em>, and you don't have to set up a separate thread for them.
-     .
-     *
-     * <p>This is where we actually perform any work required to perform a sync.
-     * {@link android.content.AbstractThreadedSyncAdapter} guarantees that this will be called on a non-UI thread,
-     * so it is safe to peform blocking I/O here.
-     *
-     * <p>The syncResult argument allows you to pass information back to the method that triggered
-     * the sync.
-     */
-    @Override
-    public void onPerformSync(Account account, Bundle extras, String authority,
-                              ContentProviderClient provider, SyncResult syncResult) {
-        Log.i(TAG, "Beginning network synchronization");
-        try {
-            final URL location = new URL(FEED_URL);
-            InputStream stream = null;
-
-            try {
-                Log.i(TAG, "Streaming data from network: " + location);
-                stream = downloadUrl(location);
-                updateLocalFeedData(stream, syncResult);
-                // Makes sure that the InputStream is closed after the app is
-                // finished using it.
-            } finally {
-                if (stream != null) {
-                    stream.close();
-                }
-            }
-        } catch (MalformedURLException e) {
-            Log.e(TAG, "Feed URL is malformed", e);
-            syncResult.stats.numParseExceptions++;
-            return;
-        } catch (IOException e) {
-            Log.e(TAG, "Error reading from network: " + e.toString());
-            syncResult.stats.numIoExceptions++;
-            return;
-        } catch (XmlPullParserException e) {
-            Log.e(TAG, "Error parsing feed: " + e.toString());
-            syncResult.stats.numParseExceptions++;
-            return;
-        } catch (ParseException e) {
-            Log.e(TAG, "Error parsing feed: " + e.toString());
-            syncResult.stats.numParseExceptions++;
-            return;
-        } catch (RemoteException e) {
-            Log.e(TAG, "Error updating database: " + e.toString());
-            syncResult.databaseError = true;
-            return;
-        } catch (OperationApplicationException e) {
-            Log.e(TAG, "Error updating database: " + e.toString());
-            syncResult.databaseError = true;
-            return;
-        }
-        Log.i(TAG, "Network synchronization complete");
-    }
-
-    /**
-     * Read XML from an input stream, storing it into the content provider.
-     *
-     * <p>This is where incoming data is persisted, committing the results of a sync. In order to
-     * minimize (expensive) disk operations, we compare incoming data with what's already in our
-     * database, and compute a merge. Only changes (insert/update/delete) will result in a database
-     * write.
-     *
-     * <p>As an additional optimization, we use a batch operation to perform all database writes at
-     * once.
-     *
-     * <p>Merge strategy:
-     * 1. Get cursor to all items in feed<br/>
-     * 2. For each item, check if it's in the incoming data.<br/>
-     *    a. YES: Remove from "incoming" list. Check if data has mutated, if so, perform
-     *            database UPDATE.<br/>
-     *    b. NO: Schedule DELETE from database.<br/>
-     * (At this point, incoming database only contains missing items.)<br/>
-     * 3. For any items remaining in incoming list, ADD to database.
-     */
-    public void updateLocalFeedData(final InputStream stream, final SyncResult syncResult)
-            throws IOException, XmlPullParserException, RemoteException,
-            OperationApplicationException, ParseException {
-        final FeedParser feedParser = new FeedParser();
-        final ContentResolver contentResolver = getContext().getContentResolver();
-
-        Log.i(TAG, "Parsing stream as Atom feed");
-        final List<FeedParser.Entry> entries = feedParser.parse(stream);
-        Log.i(TAG, "Parsing complete. Found " + entries.size() + " entries");
-
-
-        ArrayList<ContentProviderOperation> batch = new ArrayList<ContentProviderOperation>();
-
-        // Build hash table of incoming entries
-        HashMap<String, FeedParser.Entry> entryMap = new HashMap<String, FeedParser.Entry>();
-        for (FeedParser.Entry e : entries) {
-            entryMap.put(e.id, e);
-        }
-
-        // Get list of all items
-        Log.i(TAG, "Fetching local entries for merge");
-        Uri uri = FeedContract.Entry.CONTENT_URI; // Get all entries
-        Cursor c = contentResolver.query(uri, PROJECTION, null, null, null);
-        assert c != null;
-        Log.i(TAG, "Found " + c.getCount() + " local entries. Computing merge solution...");
-
-        // Find stale data
-        int id;
-        String entryId;
-        String title;
-        String link;
-        long published;
-        while (c.moveToNext()) {
-            syncResult.stats.numEntries++;
-            id = c.getInt(COLUMN_ID);
-            entryId = c.getString(COLUMN_ENTRY_ID);
-            title = c.getString(COLUMN_TITLE);
-            link = c.getString(COLUMN_LINK);
-            published = c.getLong(COLUMN_PUBLISHED);
-            FeedParser.Entry match = entryMap.get(entryId);
-            if (match != null) {
-                // Entry exists. Remove from entry map to prevent insert later.
-                entryMap.remove(entryId);
-                // Check to see if the entry needs to be updated
-                Uri existingUri = FeedContract.Entry.CONTENT_URI.buildUpon()
-                        .appendPath(Integer.toString(id)).build();
-                if ((match.title != null && !match.title.equals(title)) ||
-                        (match.link != null && !match.link.equals(link)) ||
-                        (match.published != published)) {
-                    // Update existing record
-                    Log.i(TAG, "Scheduling update: " + existingUri);
-                    batch.add(ContentProviderOperation.newUpdate(existingUri)
-                            .withValue(FeedContract.Entry.COLUMN_NAME_TITLE, title)
-                            .withValue(FeedContract.Entry.COLUMN_NAME_LINK, link)
-                            .withValue(FeedContract.Entry.COLUMN_NAME_PUBLISHED, published)
-                            .build());
-                    syncResult.stats.numUpdates++;
-                } else {
-                    Log.i(TAG, "No action: " + existingUri);
-                }
-            } else {
-                // Entry doesn't exist. Remove it from the database.
-                Uri deleteUri = FeedContract.Entry.CONTENT_URI.buildUpon()
-                        .appendPath(Integer.toString(id)).build();
-                Log.i(TAG, "Scheduling delete: " + deleteUri);
-                batch.add(ContentProviderOperation.newDelete(deleteUri).build());
-                syncResult.stats.numDeletes++;
-            }
-        }
-        c.close();
-
-        // Add new items
-        for (FeedParser.Entry e : entryMap.values()) {
-            Log.i(TAG, "Scheduling insert: entry_id=" + e.id);
-            batch.add(ContentProviderOperation.newInsert(FeedContract.Entry.CONTENT_URI)
-                    .withValue(FeedContract.Entry.COLUMN_NAME_ENTRY_ID, e.id)
-                    .withValue(FeedContract.Entry.COLUMN_NAME_TITLE, e.title)
-                    .withValue(FeedContract.Entry.COLUMN_NAME_LINK, e.link)
-                    .withValue(FeedContract.Entry.COLUMN_NAME_PUBLISHED, e.published)
-                    .build());
-            syncResult.stats.numInserts++;
-        }
-        Log.i(TAG, "Merge solution ready. Applying batch update");
-        mContentResolver.applyBatch(FeedContract.CONTENT_AUTHORITY, batch);
-        mContentResolver.notifyChange(
-                FeedContract.Entry.CONTENT_URI, // URI where data was modified
-                null,                           // No local observer
-                false);                         // IMPORTANT: Do not sync to network
-        // This sample doesn't support uploads, but if *your* code does, make sure you set
-        // syncToNetwork=false in the line above to prevent duplicate syncs.
-    }
-
-    /**
-     * Given a string representation of a URL, sets up a connection and gets an input stream.
-     */
-    private InputStream downloadUrl(final URL url) throws IOException {
-        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-        conn.setReadTimeout(NET_READ_TIMEOUT_MILLIS /* milliseconds */);
-        conn.setConnectTimeout(NET_CONNECT_TIMEOUT_MILLIS /* milliseconds */);
-        conn.setRequestMethod("GET");
-        conn.setDoInput(true);
-        // Starts the query
-        conn.connect();
-        return conn.getInputStream();
-    }
-}
diff --git a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncService.java b/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncService.java
deleted file mode 100644
index 41e9c03..0000000
--- a/connectivity/sync/BasicSyncAdapter/BasicSyncAdapterSample/src/main/java/com/example/android/basicsyncadapter/SyncService.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2013 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.example.android.basicsyncadapter;
-
-import android.app.Service;
-import android.content.Intent;
-import android.os.IBinder;
-import android.util.Log;
-
-/** Service to handle sync requests.
- *
- * <p>This service is invoked in response to Intents with action android.content.SyncAdapter, and
- * returns a Binder connection to SyncAdapter.
- *
- * <p>For performance, only one sync adapter will be initialized within this application's context.
- *
- * <p>Note: The SyncService itself is not notified when a new sync occurs. It's role is to
- * manage the lifecycle of our {@link SyncAdapter} and provide a handle to said SyncAdapter to the
- * OS on request.
- */