am ed56df6f: am 91df3bc9: am a4bb0b7c: am d5abe7ea: am ccd11ec5: DO NOT MERGE Increase the system-image revision number after opengl bug fix

* commit 'ed56df6fb39a8861a4788d927c56ddb67dbcb60f':
  DO NOT MERGE Increase the system-image revision number after opengl bug fix
diff --git a/samples/Support4Demos/AndroidManifest.xml b/samples/Support4Demos/AndroidManifest.xml
index b747876..3a0d545 100644
--- a/samples/Support4Demos/AndroidManifest.xml
+++ b/samples/Support4Demos/AndroidManifest.xml
@@ -24,7 +24,7 @@
 
     <uses-permission android:name="android.permission.READ_CONTACTS" />
 
-    <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="13" />
+    <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="17" />
 
     <!-- The smallest screen this app works on is a phone.  The app will
          scale its UI to larger screens but doesn't make good use of them
@@ -276,8 +276,46 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".widget.DrawerLayoutActivity"
+                  android:label="@string/drawer_layout_support">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name=".widget.SlidingPaneLayoutActivity"
+                  android:label="@string/sliding_pane_layout_support">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
         <provider android:authorities="com.example.supportv4.content.sharingsupportprovider"
                   android:name=".content.SharingSupportProvider" />
 
+        <!-- FileProvider Example -->
+
+        <activity android:name=".content.FileProviderExample"
+                android:label="@string/file_provider_example">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
+<!-- BEGIN_INCLUDE(file_provider_declaration) -->
+        <provider
+            android:name="android.support.v4.content.FileProvider"
+            android:authorities="com.example.android.supportv4.my_files"
+            android:grantUriPermissions="true"
+            android:exported="false">
+            <meta-data
+                android:name="android.support.FILE_PROVIDER_PATHS"
+                android:resource="@xml/my_paths" />
+        </provider>
+<!-- END_INCLUDE(file_provider_declaration) -->
+
     </application>
 </manifest>
diff --git a/samples/Support4Demos/res/drawable-hdpi/drawer_shadow.9.png b/samples/Support4Demos/res/drawable-hdpi/drawer_shadow.9.png
new file mode 100644
index 0000000..224cc4f
--- /dev/null
+++ b/samples/Support4Demos/res/drawable-hdpi/drawer_shadow.9.png
Binary files differ
diff --git a/samples/Support4Demos/res/drawable-hdpi/ic_drawer.png b/samples/Support4Demos/res/drawable-hdpi/ic_drawer.png
new file mode 100644
index 0000000..ff7b1de
--- /dev/null
+++ b/samples/Support4Demos/res/drawable-hdpi/ic_drawer.png
Binary files differ
diff --git a/samples/Support4Demos/res/drawable-mdpi/drawer_shadow.9.png b/samples/Support4Demos/res/drawable-mdpi/drawer_shadow.9.png
new file mode 100644
index 0000000..3797f99
--- /dev/null
+++ b/samples/Support4Demos/res/drawable-mdpi/drawer_shadow.9.png
Binary files differ
diff --git a/samples/Support4Demos/res/drawable-mdpi/ic_drawer.png b/samples/Support4Demos/res/drawable-mdpi/ic_drawer.png
new file mode 100644
index 0000000..fb681ba
--- /dev/null
+++ b/samples/Support4Demos/res/drawable-mdpi/ic_drawer.png
Binary files differ
diff --git a/samples/Support4Demos/res/drawable-xhdpi/drawer_shadow.9.png b/samples/Support4Demos/res/drawable-xhdpi/drawer_shadow.9.png
new file mode 100644
index 0000000..fa3d853
--- /dev/null
+++ b/samples/Support4Demos/res/drawable-xhdpi/drawer_shadow.9.png
Binary files differ
diff --git a/samples/Support4Demos/res/drawable-xhdpi/ic_drawer.png b/samples/Support4Demos/res/drawable-xhdpi/ic_drawer.png
new file mode 100644
index 0000000..b9bc3d7
--- /dev/null
+++ b/samples/Support4Demos/res/drawable-xhdpi/ic_drawer.png
Binary files differ
diff --git a/samples/Support4Demos/res/layout/drawer_layout.xml b/samples/Support4Demos/res/layout/drawer_layout.xml
new file mode 100644
index 0000000..2ab0b1a
--- /dev/null
+++ b/samples/Support4Demos/res/layout/drawer_layout.xml
@@ -0,0 +1,51 @@
+<?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.
+-->
+
+<!--
+    A DrawerLayout is indended to be used as the top-level content view
+    using match_parent for both width and height to consume the full space available.
+-->
+<android.support.v4.widget.DrawerLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/drawer_layout"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <!-- As the main content view, the view below consumes the entire
+         space available using match_parent in both dimensions. -->
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:paddingLeft="16dp"
+        android:paddingRight="16dp"
+        android:scrollbarStyle="outsideOverlay">
+        <TextView android:id="@+id/content_text"
+                  android:layout_width="match_parent"
+                  android:layout_height="match_parent"
+                  android:text="@string/drawer_layout_summary"
+                  android:textAppearance="?android:attr/textAppearanceMedium"/>
+    </ScrollView>
+    <!-- android:layout_gravity="left" tells DrawerLayout to treat
+         this as a sliding drawer on the left side. The drawer is
+         given a fixed width in dp and extends the full height of
+         the container. A solid background is used for contrast
+         with the content view. -->
+    <ListView android:id="@+id/left_drawer"
+              android:layout_width="300dp"
+              android:layout_height="match_parent"
+              android:layout_gravity="left"
+              android:background="#ff333333"/>
+</android.support.v4.widget.DrawerLayout>
+
diff --git a/samples/Support4Demos/res/layout/file_provider_example.xml b/samples/Support4Demos/res/layout/file_provider_example.xml
new file mode 100644
index 0000000..2e53c3b
--- /dev/null
+++ b/samples/Support4Demos/res/layout/file_provider_example.xml
@@ -0,0 +1,29 @@
+<?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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:padding="16dp"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <Button
+        android:text="@string/share_file"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:onClick="onShareFileClick" />
+
+</LinearLayout>
diff --git a/samples/Support4Demos/res/layout/sliding_pane_layout.xml b/samples/Support4Demos/res/layout/sliding_pane_layout.xml
new file mode 100644
index 0000000..ea0ff96
--- /dev/null
+++ b/samples/Support4Demos/res/layout/sliding_pane_layout.xml
@@ -0,0 +1,56 @@
+<?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.
+-->
+
+<!--
+    A SlidingPaneLayout is indended to be used as the top-level content view
+    using match_parent for both width and height to consume the full space available.
+-->
+<android.support.v4.widget.SlidingPaneLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/sliding_pane_layout"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <!-- The first child view becomes the left pane. When the combined
+         desired width (expressed using android:layout_width) would
+         not fit on-screen at once, the right pane is permitted to
+         overlap the left. -->
+    <ListView android:id="@+id/left_pane"
+              android:layout_width="280dp"
+              android:layout_height="match_parent"
+              android:layout_gravity="left"/>
+    <!-- The second child becomes the right (content) pane. In this
+         example, android:layout_weight is used to express that this
+         pane should grow to consume leftover available space when the
+         window is wide enough. This allows the content pane to
+         responsively grow in width on larger screens while still
+         requiring at least the minimum width expressed by
+         android:layout_width. -->
+    <ScrollView
+        android:layout_width="300dp"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:paddingLeft="16dp"
+        android:paddingRight="16dp"
+        android:scrollbarStyle="outsideOverlay"
+        android:background="#ff333333">
+        <TextView android:id="@+id/content_text"
+                  android:layout_width="match_parent"
+                  android:layout_height="match_parent"
+                  android:text="@string/sliding_pane_layout_summary"
+                  android:textAppearance="?android:attr/textAppearanceMedium"/>
+    </ScrollView>
+</android.support.v4.widget.SlidingPaneLayout>
+
diff --git a/samples/Support4Demos/res/values/strings.xml b/samples/Support4Demos/res/values/strings.xml
index 35cbb75..3cb4c2c 100644
--- a/samples/Support4Demos/res/values/strings.xml
+++ b/samples/Support4Demos/res/values/strings.xml
@@ -134,4 +134,16 @@
     <string name="sharing_support_title">ShareCompat Demo</string>
     <string name="sharing_receiver_title">ShareCompat Receiver</string>
 
+    <string name="file_provider_example">FileProvider example</string>
+    <string name="drawer_layout_support">Widget/Drawer layout</string>
+
+    <string name="drawer_layout_summary">This activity illustrates the use of sliding drawers. The drawer may be pulled out from the left edge with an edge swipe. If this demo is running on Ice Cream Sandwich or newer you may tap the icon at the left side of the action bar to open the drawer as well.</string>
+
+    <string name="drawer_open">Open navigation drawer</string>
+    <string name="drawer_close">Close navigation drawer</string>
+
+    <string name="sliding_pane_layout_support">Widget/Sliding pane layout</string>
+
+    <string name="sliding_pane_layout_summary">This activity illustrates the use of sliding panes. The content pane may be slid to one side on narrow devices to reveal the left pane used to select content. Sliding panes can be used to fit a UI intended for wider screens in a smaller space. Tapping the Action Bar\'s Up button at the left side of the bar will navigate up in the hierarchy, represented by the left pane. If you rotate the device to landscape mode, on most devices you will see that both panes fit together side by side with no sliding necessary.</string>
+
 </resources>
diff --git a/samples/Support4Demos/res/xml/my_paths.xml b/samples/Support4Demos/res/xml/my_paths.xml
new file mode 100644
index 0000000..f7223d3
--- /dev/null
+++ b/samples/Support4Demos/res/xml/my_paths.xml
@@ -0,0 +1,14 @@
+<!-- BEGIN_INCLUDE(file_provider_paths_declaration) -->
+<paths xmlns:android="http://schemas.android.com/apk/res/android">
+    <!-- Offer access to files under Context.getFilesDir() + "thumbs/"
+         through alias "my_thumbs" -->
+    <files-path name="my_thumbs" path="thumbs/" />
+
+    <!-- Offer access to files under Environment.getExternalStorageDirectory()
+         through alias "my_external" -->
+    <external-path name="my_external" />
+
+    <!-- Offer access to files under "/proc" through alias "my_proc" -->
+    <root-path name="my_proc" path="proc/" />
+</paths>
+<!-- END_INCLUDE(file_provider_paths_declaration) -->
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/content/FileProviderExample.java b/samples/Support4Demos/src/com/example/android/supportv4/content/FileProviderExample.java
new file mode 100644
index 0000000..926c632
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/content/FileProviderExample.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2011 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.supportv4.content;
+import android.app.Activity;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.net.Uri;
+import android.os.Bundle;
+import android.support.v4.content.FileProvider;
+import android.view.View;
+
+import com.example.android.supportv4.R;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Sample that shows how private files can be easily shared.
+ */
+public class FileProviderExample extends Activity {
+    private static final String AUTHORITY = "com.example.android.supportv4.my_files";
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.file_provider_example);
+    }
+
+    public void onShareFileClick(View view) {
+        // Save a thumbnail to file
+        final File thumbsDir = new File(getFilesDir(), "thumbs");
+        thumbsDir.mkdirs();
+        final File file = new File(thumbsDir, "private.png");
+        saveThumbnail(view, file);
+
+        // Now share that private file using FileProvider
+        final Uri uri = FileProvider.getUriForFile(this, AUTHORITY, file);
+        final Intent intent = new Intent(Intent.ACTION_SEND);
+        intent.setType("image/png");
+        intent.putExtra(Intent.EXTRA_STREAM, uri);
+        startActivity(intent);
+    }
+
+    /**
+     * Save thumbnail of given {@link View} to {@link File}.
+     */
+    private void saveThumbnail(View view, File file) {
+        final Bitmap bitmap = Bitmap.createBitmap(
+                view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
+        final Canvas canvas = new Canvas(bitmap);
+        view.draw(canvas);
+
+        try {
+            final OutputStream os = new FileOutputStream(file);
+            try {
+                bitmap.compress(Bitmap.CompressFormat.PNG, 100, os);
+            } finally {
+                os.close();
+            }
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/widget/DrawerLayoutActivity.java b/samples/Support4Demos/src/com/example/android/supportv4/widget/DrawerLayoutActivity.java
new file mode 100644
index 0000000..ce311cc
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/widget/DrawerLayoutActivity.java
@@ -0,0 +1,244 @@
+/*
+ * 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.supportv4.widget;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.content.res.Configuration;
+import android.os.Build;
+import android.os.Bundle;
+import android.support.v4.app.ActionBarDrawerToggle;
+import android.support.v4.view.GravityCompat;
+import android.support.v4.widget.DrawerLayout;
+import android.view.Gravity;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import com.example.android.supportv4.R;
+import com.example.android.supportv4.Shakespeare;
+
+/**
+ * This example illustrates a common usage of the DrawerLayout widget
+ * in the Android support library.
+ *
+ * <p>A DrawerLayout should be positioned at the top of your view hierarchy, placing it
+ * below the action bar but above your content views. The primary content should match_parent
+ * in both dimensions. Each drawer should define a reasonable width and match_parent for height.
+ * Drawer views should be positioned after the content view in your layout to preserve proper
+ * ordering.</p>
+ *
+ * <p>When a navigation (left) drawer is present, the host activity should detect presses of
+ * the action bar's Up affordance as a signal to open and close the navigation drawer.
+ * Items within the drawer should fall into one of two categories.</p>
+ *
+ * <ul>
+ *     <li><strong>View switches</strong>. A view switch follows the same basic policies as
+ *     list or tab navigation in that a view switch does not create navigation history.
+ *     This pattern should only be used at the root activity of a task, leaving some form
+ *     of Up navigation active for activities further down the navigation hierarchy.</li>
+ *     <li><strong>Selective Up</strong>. The drawer allows the user to choose an alternate
+ *     parent for Up navigation. This allows a user to jump across an app's navigation
+ *     hierarchy at will. The application should treat this as it treats Up navigation from
+ *     a different task, replacing the current task stack using TaskStackBuilder or similar.
+ *     This is the only form of navigation drawer that should be used outside of the root
+ *     activity of a task.</li>
+ * </ul>
+ *
+ * <p>Right side drawers should be used for actions, not navigation. This follows the pattern
+ * established by the Action Bar that navigation should be to the left and actions to the right.
+ * An action should be an operation performed on the current contents of the window,
+ * for example enabling or disabling a data overlay on top of the current content.</p>
+ */
+public class DrawerLayoutActivity extends Activity {
+    private DrawerLayout mDrawerLayout;
+    private ListView mDrawer;
+    private TextView mContent;
+
+    private ActionBarHelper mActionBar;
+
+    private ActionBarDrawerToggle mDrawerToggle;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.drawer_layout);
+
+        mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
+        mDrawer = (ListView) findViewById(R.id.left_drawer);
+        mContent = (TextView) findViewById(R.id.content_text);
+
+        mDrawerLayout.setDrawerListener(new DemoDrawerListener());
+        mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
+
+        mDrawer.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
+                Shakespeare.TITLES));
+        mDrawer.setOnItemClickListener(new DrawerItemClickListener());
+
+        mActionBar = createActionBarHelper();
+        mActionBar.init();
+
+        // ActionBarDrawerToggle provides convenient helpers for tying together the
+        // prescribed interactions between a top-level sliding drawer and the action bar.
+        mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
+                R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close);
+    }
+
+    @Override
+    protected void onPostCreate(Bundle savedInstanceState) {
+        super.onPostCreate(savedInstanceState);
+
+        // Sync the toggle state after onRestoreInstanceState has occurred.
+        mDrawerToggle.syncState();
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        /*
+         * The action bar home/up action should open or close the drawer.
+         * mDrawerToggle will take care of this.
+         */
+        if (mDrawerToggle.onOptionsItemSelected(item)) {
+            return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    public void onConfigurationChanged(Configuration newConfig) {
+        super.onConfigurationChanged(newConfig);
+        mDrawerToggle.onConfigurationChanged(newConfig);
+    }
+
+    /**
+     * This list item click listener implements very simple view switching by changing
+     * the primary content text. The drawer is closed when a selection is made.
+     */
+    private class DrawerItemClickListener implements ListView.OnItemClickListener {
+        @Override
+        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+            mContent.setText(Shakespeare.DIALOGUE[position]);
+            mActionBar.setTitle(Shakespeare.TITLES[position]);
+            mDrawerLayout.closeDrawer(mDrawer);
+        }
+    }
+
+    /**
+     * A drawer listener can be used to respond to drawer events such as becoming
+     * fully opened or closed. You should always prefer to perform expensive operations
+     * such as drastic relayout when no animation is currently in progress, either before
+     * or after the drawer animates.
+     *
+     * When using ActionBarDrawerToggle, all DrawerLayout listener methods should be forwarded
+     * if the ActionBarDrawerToggle is not used as the DrawerLayout listener directly.
+     */
+    private class DemoDrawerListener implements DrawerLayout.DrawerListener {
+        @Override
+        public void onDrawerOpened(View drawerView) {
+            mDrawerToggle.onDrawerOpened(drawerView);
+            mActionBar.onDrawerOpened();
+        }
+
+        @Override
+        public void onDrawerClosed(View drawerView) {
+            mDrawerToggle.onDrawerClosed(drawerView);
+            mActionBar.onDrawerClosed();
+        }
+
+        @Override
+        public void onDrawerSlide(View drawerView, float slideOffset) {
+            mDrawerToggle.onDrawerSlide(drawerView, slideOffset);
+        }
+
+        @Override
+        public void onDrawerStateChanged(int newState) {
+            mDrawerToggle.onDrawerStateChanged(newState);
+        }
+    }
+
+    /**
+     * Create a compatible helper that will manipulate the action bar if available.
+     */
+    private ActionBarHelper createActionBarHelper() {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+            return new ActionBarHelperICS();
+        } else {
+            return new ActionBarHelper();
+        }
+    }
+
+    /**
+     * Stub action bar helper; this does nothing.
+     */
+    private class ActionBarHelper {
+        public void init() {}
+        public void onDrawerClosed() {}
+        public void onDrawerOpened() {}
+        public void setTitle(CharSequence title) {}
+    }
+
+    /**
+     * Action bar helper for use on ICS and newer devices.
+     */
+    private class ActionBarHelperICS extends ActionBarHelper {
+        private final ActionBar mActionBar;
+        private CharSequence mDrawerTitle;
+        private CharSequence mTitle;
+
+        ActionBarHelperICS() {
+            mActionBar = getActionBar();
+        }
+
+        @Override
+        public void init() {
+            mActionBar.setDisplayHomeAsUpEnabled(true);
+            mActionBar.setHomeButtonEnabled(true);
+            mTitle = mDrawerTitle = getTitle();
+        }
+
+        /**
+         * When the drawer is closed we restore the action bar state reflecting
+         * the specific contents in view.
+         */
+        @Override
+        public void onDrawerClosed() {
+            super.onDrawerClosed();
+            mActionBar.setTitle(mTitle);
+        }
+
+        /**
+         * When the drawer is open we set the action bar to a generic title.
+         * The action bar should only contain data relevant at the top level of
+         * the nav hierarchy represented by the drawer, as the rest of your content
+         * will be dimmed down and non-interactive.
+         */
+        @Override
+        public void onDrawerOpened() {
+            super.onDrawerOpened();
+            mActionBar.setTitle(mDrawerTitle);
+        }
+
+        @Override
+        public void setTitle(CharSequence title) {
+            mTitle = title;
+        }
+    }
+}
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/widget/SlidingPaneLayoutActivity.java b/samples/Support4Demos/src/com/example/android/supportv4/widget/SlidingPaneLayoutActivity.java
new file mode 100644
index 0000000..f26e038
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/widget/SlidingPaneLayoutActivity.java
@@ -0,0 +1,222 @@
+/*
+ * 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.supportv4.widget;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.os.Build;
+import android.os.Bundle;
+import android.support.v4.widget.SlidingPaneLayout;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewTreeObserver;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import com.example.android.supportv4.Shakespeare;
+import com.example.android.supportv4.R;
+
+/**
+ * This example illustrates a common usage of SlidingPaneLayout in the Android support library.
+ *
+ * <p>A SlidingPaneLayout should be positioned at the top of your view hierarchy, placing it
+ * below the action bar but above your content views. It is ideal as a two-pane layout
+ * for larger screens, used in place of a horizontal LinearLayout.</p>
+ *
+ * <p>What separates SlidingPaneLayout from LinearLayout in this usage is that SlidingPaneLayout
+ * allows these wide, two-pane layouts to overlap when horizontal space is at a premium. The user
+ * can then access both panes by physically sliding the content pane into view or out of the way
+ * or implicitly by moving focus between the two panes. This can greatly simplify development
+ * of Android apps that support multiple form factors and screen sizes.</p>
+ *
+ * <p>When it comes to your navigation hierarchy, the left pane of a SlidingPaneLayout is always
+ * considered to be one level up from the right content pane. As such, your Action Bar's
+ * Up navigation should be enabled if the right pane is obscuring the left pane, and invoking it
+ * should open the panes, revealing the left pane for normal interaction. From this open state
+ * where the left pane is in primary focus, the Action Bar's Up affordance should act as if
+ * both panes were fully visible in the activity window and navigate to the activity one level up
+ * in the app's logical hierarchy. If the activity is the root of the application's task, the up
+ * affordance should be disabled when the sliding pane is open and showing the left pane.
+ * This code example illustrates this root activity case.</p>
+ *
+ * <p>Note that SlidingPaneLayout differs in usage from DrawerLayout. While DrawerLayout offers
+ * sliding utility drawers for extended navigation options and actions, the panes of a
+ * SlidingPaneLayout are firmly part of the content itself. If it would not make sense for
+ * both panes to be visible all the time on a sufficiently wide screen, DrawerLayout and its
+ * associated patterns are likely to be a better choice for your usage.</p>
+ */
+public class SlidingPaneLayoutActivity extends Activity {
+    private SlidingPaneLayout mSlidingLayout;
+    private ListView mList;
+    private TextView mContent;
+
+    private ActionBarHelper mActionBar;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.sliding_pane_layout);
+
+        mSlidingLayout = (SlidingPaneLayout) findViewById(R.id.sliding_pane_layout);
+        mList = (ListView) findViewById(R.id.left_pane);
+        mContent = (TextView) findViewById(R.id.content_text);
+
+        mSlidingLayout.setPanelSlideListener(new SliderListener());
+        mSlidingLayout.openPane();
+
+        mList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
+                Shakespeare.TITLES));
+        mList.setOnItemClickListener(new ListItemClickListener());
+
+        mActionBar = createActionBarHelper();
+        mActionBar.init();
+
+        mSlidingLayout.getViewTreeObserver().addOnGlobalLayoutListener(new FirstLayoutListener());
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        /*
+         * The action bar up action should open the slider if it is currently closed,
+         * as the left pane contains content one level up in the navigation hierarchy.
+         */
+        if (item.getItemId() == android.R.id.home && !mSlidingLayout.isOpen()) {
+            mSlidingLayout.smoothSlideOpen();
+            return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    /**
+     * This list item click listener implements very simple view switching by changing
+     * the primary content text. The slider is closed when a selection is made to fully
+     * reveal the content.
+     */
+    private class ListItemClickListener implements ListView.OnItemClickListener {
+        @Override
+        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+            mContent.setText(Shakespeare.DIALOGUE[position]);
+            mActionBar.setTitle(Shakespeare.TITLES[position]);
+            mSlidingLayout.smoothSlideClosed();
+        }
+    }
+
+    /**
+     * This panel slide listener updates the action bar accordingly for each panel state.
+     */
+    private class SliderListener extends SlidingPaneLayout.SimplePanelSlideListener {
+        @Override
+        public void onPanelOpened(View panel) {
+            mActionBar.onPanelOpened();
+        }
+
+        @Override
+        public void onPanelClosed(View panel) {
+            mActionBar.onPanelClosed();
+        }
+    }
+
+    /**
+     * This global layout listener is used to fire an event after first layout occurs
+     * and then it is removed. This gives us a chance to configure parts of the UI
+     * that adapt based on available space after they have had the opportunity to measure
+     * and layout.
+     */
+    private class FirstLayoutListener implements ViewTreeObserver.OnGlobalLayoutListener {
+        @Override
+        public void onGlobalLayout() {
+            mActionBar.onFirstLayout();
+            mSlidingLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
+        }
+    }
+
+    /**
+     * Create a compatible helper that will manipulate the action bar if available.
+     */
+    private ActionBarHelper createActionBarHelper() {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+            return new ActionBarHelperICS();
+        } else {
+            return new ActionBarHelper();
+        }
+    }
+
+    /**
+     * Stub action bar helper; this does nothing.
+     */
+    private class ActionBarHelper {
+        public void init() {}
+        public void onPanelClosed() {}
+        public void onPanelOpened() {}
+        public void onFirstLayout() {}
+        public void setTitle(CharSequence title) {}
+    }
+
+    /**
+     * Action bar helper for use on ICS and newer devices.
+     */
+    private class ActionBarHelperICS extends ActionBarHelper {
+        private final ActionBar mActionBar;
+        private CharSequence mDrawerTitle;
+        private CharSequence mTitle;
+
+        ActionBarHelperICS() {
+            mActionBar = getActionBar();
+        }
+
+        @Override
+        public void init() {
+            mActionBar.setDisplayHomeAsUpEnabled(true);
+            mActionBar.setHomeButtonEnabled(true);
+            mTitle = mDrawerTitle = getTitle();
+        }
+
+        @Override
+        public void onPanelClosed() {
+            super.onPanelClosed();
+            mActionBar.setDisplayHomeAsUpEnabled(true);
+            mActionBar.setHomeButtonEnabled(true);
+            mActionBar.setTitle(mTitle);
+        }
+
+        @Override
+        public void onPanelOpened() {
+            super.onPanelOpened();
+            mActionBar.setHomeButtonEnabled(false);
+            mActionBar.setDisplayHomeAsUpEnabled(false);
+            mActionBar.setTitle(mDrawerTitle);
+        }
+
+        @Override
+        public void onFirstLayout() {
+            if (mSlidingLayout.canSlide() && !mSlidingLayout.isOpen()) {
+                onPanelClosed();
+            } else {
+                onPanelOpened();
+            }
+        }
+
+        @Override
+        public void setTitle(CharSequence title) {
+            mTitle = title;
+        }
+    }
+
+}
diff --git a/samples/training/NavigationDrawer/AndroidManifest.xml b/samples/training/NavigationDrawer/AndroidManifest.xml
new file mode 100755
index 0000000..e48ee24
--- /dev/null
+++ b/samples/training/NavigationDrawer/AndroidManifest.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 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.navigationdrawerexample"
+    android:versionCode="1"
+    android:versionName="1.0">
+
+    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
+
+    <application
+        android:label="@string/app_name"
+        android:icon="@drawable/ic_launcher"
+        android:theme="@android:style/Theme.Holo.Light.DarkActionBar">
+
+        <activity
+            android:name=".MainActivity"
+            android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+
+    </application>
+
+</manifest>
diff --git a/samples/training/NavigationDrawer/libs/android-support-v4.jar b/samples/training/NavigationDrawer/libs/android-support-v4.jar
new file mode 100644
index 0000000..ee6f13a
--- /dev/null
+++ b/samples/training/NavigationDrawer/libs/android-support-v4.jar
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-hdpi/action_search.png b/samples/training/NavigationDrawer/res/drawable-hdpi/action_search.png
new file mode 100755
index 0000000..f12e005
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-hdpi/action_search.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-hdpi/drawer_shadow.9.png b/samples/training/NavigationDrawer/res/drawable-hdpi/drawer_shadow.9.png
new file mode 100644
index 0000000..224cc4f
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-hdpi/drawer_shadow.9.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-hdpi/ic_drawer.png b/samples/training/NavigationDrawer/res/drawable-hdpi/ic_drawer.png
new file mode 100644
index 0000000..ff7b1de
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-hdpi/ic_drawer.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-hdpi/ic_launcher.png b/samples/training/NavigationDrawer/res/drawable-hdpi/ic_launcher.png
new file mode 100755
index 0000000..b460d60
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-mdpi/action_search.png b/samples/training/NavigationDrawer/res/drawable-mdpi/action_search.png
new file mode 100755
index 0000000..587d9e0
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-mdpi/action_search.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-mdpi/drawer_shadow.9.png b/samples/training/NavigationDrawer/res/drawable-mdpi/drawer_shadow.9.png
new file mode 100644
index 0000000..3797f99
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-mdpi/drawer_shadow.9.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-mdpi/ic_drawer.png b/samples/training/NavigationDrawer/res/drawable-mdpi/ic_drawer.png
new file mode 100644
index 0000000..fb681ba
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-mdpi/ic_drawer.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-mdpi/ic_launcher.png b/samples/training/NavigationDrawer/res/drawable-mdpi/ic_launcher.png
new file mode 100755
index 0000000..dee53f4
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-xhdpi/action_search.png b/samples/training/NavigationDrawer/res/drawable-xhdpi/action_search.png
new file mode 100755
index 0000000..3549f84
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-xhdpi/action_search.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-xhdpi/drawer_shadow.9.png b/samples/training/NavigationDrawer/res/drawable-xhdpi/drawer_shadow.9.png
new file mode 100644
index 0000000..fa3d853
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-xhdpi/drawer_shadow.9.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-xhdpi/ic_drawer.png b/samples/training/NavigationDrawer/res/drawable-xhdpi/ic_drawer.png
new file mode 100644
index 0000000..b9bc3d7
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-xhdpi/ic_drawer.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-xhdpi/ic_launcher.png b/samples/training/NavigationDrawer/res/drawable-xhdpi/ic_launcher.png
new file mode 100755
index 0000000..d4e1215
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable-xxhdpi/ic_launcher.png b/samples/training/NavigationDrawer/res/drawable-xxhdpi/ic_launcher.png
new file mode 100755
index 0000000..2cc3275
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/earth.jpg b/samples/training/NavigationDrawer/res/drawable/earth.jpg
new file mode 100644
index 0000000..6cabbf4
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/earth.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/jupiter.jpg b/samples/training/NavigationDrawer/res/drawable/jupiter.jpg
new file mode 100644
index 0000000..24e8eea
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/jupiter.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/mars.jpg b/samples/training/NavigationDrawer/res/drawable/mars.jpg
new file mode 100644
index 0000000..db253ef
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/mars.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/mercury.jpg b/samples/training/NavigationDrawer/res/drawable/mercury.jpg
new file mode 100644
index 0000000..531790b
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/mercury.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/neptune.jpg b/samples/training/NavigationDrawer/res/drawable/neptune.jpg
new file mode 100644
index 0000000..88467c5
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/neptune.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/saturn.jpg b/samples/training/NavigationDrawer/res/drawable/saturn.jpg
new file mode 100644
index 0000000..8219d18
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/saturn.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/uranus.jpg b/samples/training/NavigationDrawer/res/drawable/uranus.jpg
new file mode 100644
index 0000000..fa32e37
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/uranus.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/drawable/venus.jpg b/samples/training/NavigationDrawer/res/drawable/venus.jpg
new file mode 100644
index 0000000..e04f078
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/drawable/venus.jpg
Binary files differ
diff --git a/samples/training/NavigationDrawer/res/layout/activity_main.xml b/samples/training/NavigationDrawer/res/layout/activity_main.xml
new file mode 100755
index 0000000..f097cd0
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/layout/activity_main.xml
@@ -0,0 +1,47 @@
+<!--
+  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.
+  -->
+
+
+<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
+<android.support.v4.widget.DrawerLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/drawer_layout"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <!-- As the main content view, the view below consumes the entire
+         space available using match_parent in both dimensions. -->
+    <FrameLayout
+        android:id="@+id/content_frame"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
+
+    <!-- android:layout_gravity="start" tells DrawerLayout to treat
+         this as a sliding drawer on the left side for left-to-right
+         languages and on the right side for right-to-left languages.
+         The drawer is given a fixed width in dp and extends the full height of
+         the container. A solid background is used for contrast
+         with the content view. -->
+    <ListView
+        android:id="@+id/left_drawer"
+        android:layout_width="240dp"
+        android:layout_height="match_parent"
+        android:layout_gravity="start"
+        android:choiceMode="singleChoice"
+        android:divider="@android:color/transparent"
+        android:dividerHeight="0dp"
+        android:background="#111"/>
+</android.support.v4.widget.DrawerLayout>
diff --git a/samples/training/NavigationDrawer/res/layout/drawer_list_item.xml b/samples/training/NavigationDrawer/res/layout/drawer_list_item.xml
new file mode 100644
index 0000000..ab52575
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/layout/drawer_list_item.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.
+  -->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@android:id/text1"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:textAppearance="?android:attr/textAppearanceListItemSmall"
+    android:gravity="center_vertical"
+    android:paddingLeft="16dp"
+    android:paddingRight="16dp"
+    android:textColor="#fff"
+    android:background="?android:attr/activatedBackgroundIndicator"
+    android:minHeight="?android:attr/listPreferredItemHeightSmall"/>
\ No newline at end of file
diff --git a/samples/training/NavigationDrawer/res/layout/fragment_planet.xml b/samples/training/NavigationDrawer/res/layout/fragment_planet.xml
new file mode 100644
index 0000000..4fe5bbe
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/layout/fragment_planet.xml
@@ -0,0 +1,23 @@
+<!--
+  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.
+  -->
+
+<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/image"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="#000000"
+    android:gravity="center"
+    android:padding="32dp" />
diff --git a/samples/training/NavigationDrawer/res/menu/main.xml b/samples/training/NavigationDrawer/res/menu/main.xml
new file mode 100644
index 0000000..970c16a
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/menu/main.xml
@@ -0,0 +1,22 @@
+<!--
+  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/action_websearch"
+          android:icon="@drawable/action_search"
+          android:title="@string/action_websearch"
+          android:showAsAction="ifRoom|withText" />
+</menu>
\ No newline at end of file
diff --git a/samples/training/NavigationDrawer/res/values/strings.xml b/samples/training/NavigationDrawer/res/values/strings.xml
new file mode 100755
index 0000000..3112f40
--- /dev/null
+++ b/samples/training/NavigationDrawer/res/values/strings.xml
@@ -0,0 +1,33 @@
+<!--
+  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">Navigation Drawer Example</string>
+    <string-array name="planets_array">
+        <item>Mercury</item>
+        <item>Venus</item>
+        <item>Earth</item>
+        <item>Mars</item>
+        <item>Jupiter</item>
+        <item>Saturn</item>
+        <item>Uranus</item>
+        <item>Neptune</item>
+    </string-array>
+    <string name="drawer_open">Open navigation drawer</string>
+    <string name="drawer_close">Close navigation drawer</string>
+    <string name="action_websearch">Web search</string>
+    <string name="app_not_available">Sorry, there\'s no web browser available</string>
+</resources>
diff --git a/samples/training/NavigationDrawer/src/com/example/android/navigationdrawerexample/MainActivity.java b/samples/training/NavigationDrawer/src/com/example/android/navigationdrawerexample/MainActivity.java
new file mode 100755
index 0000000..70ffac3
--- /dev/null
+++ b/samples/training/NavigationDrawer/src/com/example/android/navigationdrawerexample/MainActivity.java
@@ -0,0 +1,240 @@
+/*
+ * 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.navigationdrawerexample;
+
+import java.util.Locale;
+
+import android.app.Activity;
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.app.SearchManager;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.support.v4.app.ActionBarDrawerToggle;
+import android.support.v4.view.GravityCompat;
+import android.support.v4.widget.DrawerLayout;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.Toast;
+
+/**
+ * This example illustrates a common usage of the DrawerLayout widget
+ * in the Android support library.
+ * <p/>
+ * <p>When a navigation (left) drawer is present, the host activity should detect presses of
+ * the action bar's Up affordance as a signal to open and close the navigation drawer. The
+ * ActionBarDrawerToggle facilitates this behavior.
+ * Items within the drawer should fall into one of two categories:</p>
+ * <p/>
+ * <ul>
+ * <li><strong>View switches</strong>. A view switch follows the same basic policies as
+ * list or tab navigation in that a view switch does not create navigation history.
+ * This pattern should only be used at the root activity of a task, leaving some form
+ * of Up navigation active for activities further down the navigation hierarchy.</li>
+ * <li><strong>Selective Up</strong>. The drawer allows the user to choose an alternate
+ * parent for Up navigation. This allows a user to jump across an app's navigation
+ * hierarchy at will. The application should treat this as it treats Up navigation from
+ * a different task, replacing the current task stack using TaskStackBuilder or similar.
+ * This is the only form of navigation drawer that should be used outside of the root
+ * activity of a task.</li>
+ * </ul>
+ * <p/>
+ * <p>Right side drawers should be used for actions, not navigation. This follows the pattern
+ * established by the Action Bar that navigation should be to the left and actions to the right.
+ * An action should be an operation performed on the current contents of the window,
+ * for example enabling or disabling a data overlay on top of the current content.</p>
+ */
+public class MainActivity extends Activity {
+    private DrawerLayout mDrawerLayout;
+    private ListView mDrawerList;
+    private ActionBarDrawerToggle mDrawerToggle;
+
+    private CharSequence mDrawerTitle;
+    private CharSequence mTitle;
+    private String[] mPlanetTitles;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_main);
+
+        mTitle = mDrawerTitle = getTitle();
+        mPlanetTitles = getResources().getStringArray(R.array.planets_array);
+        mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
+        mDrawerList = (ListView) findViewById(R.id.left_drawer);
+
+        // set a custom shadow that overlays the main content when the drawer opens
+        mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
+        // set up the drawer's list view with items and click listener
+        mDrawerList.setAdapter(new ArrayAdapter<String>(this,
+                R.layout.drawer_list_item, mPlanetTitles));
+        mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
+
+        // enable ActionBar app icon to behave as action to toggle nav drawer
+        getActionBar().setDisplayHomeAsUpEnabled(true);
+        getActionBar().setHomeButtonEnabled(true);
+
+        // ActionBarDrawerToggle ties together the the proper interactions
+        // between the sliding drawer and the action bar app icon
+        mDrawerToggle = new ActionBarDrawerToggle(
+                this,                  /* host Activity */
+                mDrawerLayout,         /* DrawerLayout object */
+                R.drawable.ic_drawer,  /* nav drawer image to replace 'Up' caret */
+                R.string.drawer_open,  /* "open drawer" description for accessibility */
+                R.string.drawer_close  /* "close drawer" description for accessibility */
+                ) {
+            public void onDrawerClosed(View view) {
+                getActionBar().setTitle(mTitle);
+                invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
+            }
+
+            public void onDrawerOpened(View drawerView) {
+                getActionBar().setTitle(mDrawerTitle);
+                invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
+            }
+        };
+        mDrawerLayout.setDrawerListener(mDrawerToggle);
+
+        if (savedInstanceState == null) {
+            selectItem(0);
+        }
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        MenuInflater inflater = getMenuInflater();
+        inflater.inflate(R.menu.main, menu);
+        return super.onCreateOptionsMenu(menu);
+    }
+
+    /* Called whenever we call invalidateOptionsMenu() */
+    @Override
+    public boolean onPrepareOptionsMenu(Menu menu) {
+        // If the nav drawer is open, hide action items related to the content view
+        boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
+        menu.findItem(R.id.action_websearch).setVisible(!drawerOpen);
+        return super.onPrepareOptionsMenu(menu);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+         // The action bar home/up action should open or close the drawer.
+         // ActionBarDrawerToggle will take care of this.
+        if (mDrawerToggle.onOptionsItemSelected(item)) {
+            return true;
+        }
+        // Handle action buttons
+        switch(item.getItemId()) {
+        case R.id.action_websearch:
+            // create intent to perform web search for this planet
+            Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
+            intent.putExtra(SearchManager.QUERY, getActionBar().getTitle());
+            // catch event that there's no activity to handle intent
+            if (intent.resolveActivity(getPackageManager()) != null) {
+                startActivity(intent);
+            } else {
+                Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show();
+            }
+            return true;
+        default:
+            return super.onOptionsItemSelected(item);
+        }
+    }
+
+    /* The click listner for ListView in the navigation drawer */
+    private class DrawerItemClickListener implements ListView.OnItemClickListener {
+        @Override
+        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+            selectItem(position);
+        }
+    }
+
+    private void selectItem(int position) {
+        // update the main content by replacing fragments
+        Fragment fragment = new PlanetFragment();
+        Bundle args = new Bundle();
+        args.putInt(PlanetFragment.ARG_PLANET_NUMBER, position);
+        fragment.setArguments(args);
+
+        FragmentManager fragmentManager = getFragmentManager();
+        fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
+
+        // update selected item and title, then close the drawer
+        mDrawerList.setItemChecked(position, true);
+        setTitle(mPlanetTitles[position]);
+        mDrawerLayout.closeDrawer(mDrawerList);
+    }
+
+    @Override
+    public void setTitle(CharSequence title) {
+        mTitle = title;
+        getActionBar().setTitle(mTitle);
+    }
+
+    /**
+     * When using the ActionBarDrawerToggle, you must call it during
+     * onPostCreate() and onConfigurationChanged()...
+     */
+
+    @Override
+    protected void onPostCreate(Bundle savedInstanceState) {
+        super.onPostCreate(savedInstanceState);
+        // Sync the toggle state after onRestoreInstanceState has occurred.
+        mDrawerToggle.syncState();
+    }
+
+    @Override
+    public void onConfigurationChanged(Configuration newConfig) {
+        super.onConfigurationChanged(newConfig);
+        // Pass any configuration change to the drawer toggls
+        mDrawerToggle.onConfigurationChanged(newConfig);
+    }
+
+    /**
+     * Fragment that appears in the "content_frame", shows a planet
+     */
+    public static class PlanetFragment extends Fragment {
+        public static final String ARG_PLANET_NUMBER = "planet_number";
+
+        public PlanetFragment() {
+            // Empty constructor required for fragment subclasses
+        }
+
+        @Override
+        public View onCreateView(LayoutInflater inflater, ViewGroup container,
+                Bundle savedInstanceState) {
+            View rootView = inflater.inflate(R.layout.fragment_planet, container, false);
+            int i = getArguments().getInt(ARG_PLANET_NUMBER);
+            String planet = getResources().getStringArray(R.array.planets_array)[i];
+
+            int imageId = getResources().getIdentifier(planet.toLowerCase(Locale.getDefault()),
+                            "drawable", getActivity().getPackageName());
+            ((ImageView) rootView.findViewById(R.id.image)).setImageResource(imageId);
+            getActivity().setTitle(planet);
+            return rootView;
+        }
+    }
+}
\ No newline at end of file
diff --git a/scripts/app_engine_server/memcache_zipserve.py b/scripts/app_engine_server/memcache_zipserve.py
index dfd7de9..9c6f42e 100644
--- a/scripts/app_engine_server/memcache_zipserve.py
+++ b/scripts/app_engine_server/memcache_zipserve.py
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# -*- coding: utf-8 -*-
 #
 # Copyright 2009 Google Inc.
 #
@@ -526,6 +527,10 @@
     resp_data = None
     file_itr = iter(self.zipfilenames)
 
+    # decode any escape characters in the URI
+    # Note: We are currenty just looking for '@' (%40)
+    file_path = file_path.replace('%40', '@')
+
     # check the index, if we have one, to see what archive the file is in
     archive_name = self.MapFileToArchive(file_path)
     if not archive_name:
diff --git a/scripts/app_engine_server/redirects.yaml b/scripts/app_engine_server/redirects.yaml
index 47ee9bb..7cb6379 100644
--- a/scripts/app_engine_server/redirects.yaml
+++ b/scripts/app_engine_server/redirects.yaml
@@ -110,6 +110,18 @@
   type: permanent
   comment: Redirect sdk reference to new location
 
+- src: /tools/sdk/win-usb.html
+  dst: /sdk/win-usb.html
+  type: permanent
+
+- src: /tools/sdk/index.html
+  dst: /sdk/index.html
+  type: permanent
+
+- src: /tools/sdk/installing.html
+  dst: /sdk/installing/bundle.html
+  type: permanent
+
 #new one works
 - src: /sdk/requirements.html
   dst: /sdk/index.html
@@ -237,6 +249,26 @@
   dst: /tools/adk/index.html
   type: permanent
 
+- src: /tools/workflow/publishing/versioning.html
+  dst: /tools/publishing/versioning.html
+  type: permanent
+
+- src: /tools/workflow/publishing/publishing.html
+  dst: /tools/publishing/publishing_overview.html
+  type: permanent
+
+- src: /tools/workflow/publishing_overview.html
+  dst: /tools/publishing/publishing_overview.html
+  type: permanent
+
+- src: /tools/workflow/publishing/publishing_overview.html
+  dst: /tools/publishing/publishing_overview.html
+  type: permanent
+
+- src: /tools/workflow/app-signing.html
+  dst: /tools/publishing/app-signing.html
+  type: permanent
+
 - src: /tools/adk/aoa.html
   dst: http://source.android.com/tech/accessories/aoap/aoa.html
   type: permanent
@@ -392,6 +424,23 @@
   dst: /training/articles/perf-jni.html
   type: permanent
 
+# move ui docs to design
+
+- src: /guide/practices/ui_guidelines/index.html
+  dst: /design/index.html
+  type: permanent
+
+- src: /guide/practices/ui_guidelines/icon_design.*
+  dst: /design/style/iconography.html
+  type: permanent
+
+- src: /guide/practices/ui_guidelines/activity_task_design.html
+  dst: /design/patterns/app-structure.html
+  type: permanent
+
+- src: /guide/practices/ui_guidelines/menu_design.html
+  dst: /design/patterns/actionbar.html
+  type: permanent
 
 
 # new one
@@ -621,3 +670,7 @@
 - src: /edu/?$
   dst: /distribute/googleplay/edu/index.html
   type: permanent
+
+- src: /edu/signup
+  dst: https://services.google.com/fb/forms/playedu
+  type: permanent
diff --git a/sdk/support_source.properties b/sdk/support_source.properties
index 9b4281a..433fba9 100644
--- a/sdk/support_source.properties
+++ b/sdk/support_source.properties
@@ -1,5 +1,5 @@
 Pkg.UserSrc=false
-Pkg.Revision=12
+Pkg.Revision=13
 Extra.Vendor=android
 Extra.VendorId=android
 Extra.VendorDisplay=Android
diff --git a/testrunner/test_defs.xml b/testrunner/test_defs.xml
index 8494cb0..25f23e2 100644
--- a/testrunner/test_defs.xml
+++ b/testrunner/test_defs.xml
@@ -85,6 +85,11 @@
     coverage_target="framework"
     continuous="true" />
 
+<test name="frameworks-support"
+    build_path="frameworks/support/tests"
+    package="android.support.tests"
+    continuous="true" />
+
 <test name="core"
     build_path="frameworks/base/tests/CoreTests"
     package="android.core"
diff --git a/tools/emulator/system/camera/EmulatedCameraFactory.cpp b/tools/emulator/system/camera/EmulatedCameraFactory.cpp
index 84248ca..0964335 100755
--- a/tools/emulator/system/camera/EmulatedCameraFactory.cpp
+++ b/tools/emulator/system/camera/EmulatedCameraFactory.cpp
@@ -196,7 +196,7 @@
     if (camera_id < 0 || camera_id >= getEmulatedCameraNum()) {
         ALOGE("%s: Camera id %d is out of bounds (%d)",
              __FUNCTION__, camera_id, getEmulatedCameraNum());
-        return -EINVAL;
+        return -ENODEV;
     }
 
     return mEmulatedCameras[camera_id]->connectCamera(device);
@@ -214,7 +214,7 @@
     if (camera_id < 0 || camera_id >= getEmulatedCameraNum()) {
         ALOGE("%s: Camera id %d is out of bounds (%d)",
              __FUNCTION__, camera_id, getEmulatedCameraNum());
-        return -EINVAL;
+        return -ENODEV;
     }
 
     return mEmulatedCameras[camera_id]->getCameraInfo(info);
diff --git a/tools/emulator/system/camera/EmulatedFakeCamera2.cpp b/tools/emulator/system/camera/EmulatedFakeCamera2.cpp
index 4e4ee54..2746d22 100644
--- a/tools/emulator/system/camera/EmulatedFakeCamera2.cpp
+++ b/tools/emulator/system/camera/EmulatedFakeCamera2.cpp
@@ -165,22 +165,26 @@
 }
 
 status_t EmulatedFakeCamera2::closeCamera() {
-    Mutex::Autolock l(mMutex);
+    {
+        Mutex::Autolock l(mMutex);
 
-    status_t res;
-    ALOGV("%s", __FUNCTION__);
+        status_t res;
+        ALOGV("%s", __FUNCTION__);
 
-    res = mSensor->shutDown();
-    if (res != NO_ERROR) {
-        ALOGE("%s: Unable to shut down sensor: %d", __FUNCTION__, res);
-        return res;
+        res = mSensor->shutDown();
+        if (res != NO_ERROR) {
+            ALOGE("%s: Unable to shut down sensor: %d", __FUNCTION__, res);
+            return res;
+        }
+
+        mConfigureThread->requestExit();
+        mReadoutThread->requestExit();
+        mControlThread->requestExit();
+        mJpegCompressor->cancel();
     }
 
-    mConfigureThread->requestExit();
-    mReadoutThread->requestExit();
-    mControlThread->requestExit();
-    mJpegCompressor->cancel();
-
+    // give up the lock since we will now block and the threads
+    // can call back into this object
     mConfigureThread->join();
     mReadoutThread->join();
     mControlThread->join();
@@ -1131,6 +1135,7 @@
         camera_metadata_t *request,
         Buffers *buffers) {
     Mutex::Autolock lock(mInputMutex);
+    Mutex::Autolock iLock(mInternalsMutex);
     if ( !readyForNextCapture() ) {
         ALOGE("In flight queue full, dropping captures");
         mParent->signalError();
@@ -1149,6 +1154,8 @@
 }
 
 bool EmulatedFakeCamera2::ReadoutThread::isStreamInUse(uint32_t id) {
+    // acquire in same order as threadLoop
+    Mutex::Autolock iLock(mInternalsMutex);
     Mutex::Autolock lock(mInputMutex);
 
     size_t i = mInFlightHead;
@@ -1160,7 +1167,6 @@
         i = (i + 1) % kInFlightQueueSize;
     }
 
-    Mutex::Autolock iLock(mInternalsMutex);
 
     if (mBuffers != NULL) {
         for (i = 0; i < mBuffers->size(); i++) {
@@ -1271,7 +1277,7 @@
     ALOGV("Readout: Constructing metadata and frames for request %d",
             frameNumber);
 
-    if (*entry.data.u8 == ANDROID_REQUEST_METADATA_FULL) {
+    if (*entry.data.u8 == ANDROID_REQUEST_METADATA_MODE_FULL) {
         ALOGV("Readout: Metadata requested, constructing");
 
         camera_metadata_t *frame = NULL;
@@ -1389,14 +1395,14 @@
     status_t res;
     camera_metadata_entry_t entry;
     res = find_camera_metadata_entry(frame,
-                ANDROID_STATS_FACE_DETECT_MODE,
+                ANDROID_STATISTICS_FACE_DETECT_MODE,
                 &entry);
     if (res != OK) {
         ALOGE("%s: Unable to find face detect mode!", __FUNCTION__);
         return BAD_VALUE;
     }
 
-    if (entry.data.u8[0] == ANDROID_STATS_FACE_DETECTION_OFF) return OK;
+    if (entry.data.u8[0] == ANDROID_STATISTICS_FACE_DETECT_MODE_OFF) return OK;
 
     // The coordinate system for the face regions is the raw sensor pixel
     // coordinates. Here, we map from the scene coordinates (0-19 in both axis)
@@ -1428,21 +1434,21 @@
         scores[i] += (int32_t)(((float)rand() / RAND_MAX) * 10 - 5);
     }
 
-    res = add_camera_metadata_entry(frame, ANDROID_STATS_FACE_RECTANGLES,
+    res = add_camera_metadata_entry(frame, ANDROID_STATISTICS_FACE_RECTANGLES,
             rects, numFaces * 4);
     if (res != OK) {
         ALOGE("%s: Unable to add face rectangles!", __FUNCTION__);
         return BAD_VALUE;
     }
 
-    res = add_camera_metadata_entry(frame, ANDROID_STATS_FACE_SCORES,
+    res = add_camera_metadata_entry(frame, ANDROID_STATISTICS_FACE_SCORES,
             scores, numFaces);
     if (res != OK) {
         ALOGE("%s: Unable to add face scores!", __FUNCTION__);
         return BAD_VALUE;
     }
 
-    if (entry.data.u8[0] == ANDROID_STATS_FACE_DETECTION_SIMPLE) return OK;
+    if (entry.data.u8[0] == ANDROID_STATISTICS_FACE_DETECT_MODE_SIMPLE) return OK;
 
     // Advanced face detection options - add eye/mouth coordinates.  The
     // coordinates in order are (leftEyeX, leftEyeY, rightEyeX, rightEyeY,
@@ -1473,14 +1479,14 @@
         100, 200
     };
 
-    res = add_camera_metadata_entry(frame, ANDROID_STATS_FACE_LANDMARKS,
+    res = add_camera_metadata_entry(frame, ANDROID_STATISTICS_FACE_LANDMARKS,
             features, numFaces * 6);
     if (res != OK) {
         ALOGE("%s: Unable to add face landmarks!", __FUNCTION__);
         return BAD_VALUE;
     }
 
-    res = add_camera_metadata_entry(frame, ANDROID_STATS_FACE_IDS,
+    res = add_camera_metadata_entry(frame, ANDROID_STATISTICS_FACE_IDS,
             ids, numFaces);
     if (res != OK) {
         ALOGE("%s: Unable to add face scores!", __FUNCTION__);
@@ -1508,16 +1514,16 @@
     mCancelAf = false;
     mStartPrecapture = false;
 
-    mControlMode = ANDROID_CONTROL_AUTO;
+    mControlMode = ANDROID_CONTROL_MODE_AUTO;
 
-    mEffectMode = ANDROID_CONTROL_EFFECT_OFF;
+    mEffectMode = ANDROID_CONTROL_EFFECT_MODE_OFF;
     mSceneMode = ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY;
 
-    mAfMode = ANDROID_CONTROL_AF_AUTO;
+    mAfMode = ANDROID_CONTROL_AF_MODE_AUTO;
     mAfModeChange = false;
 
-    mAeMode = ANDROID_CONTROL_AE_ON;
-    mAwbMode = ANDROID_CONTROL_AWB_AUTO;
+    mAeMode = ANDROID_CONTROL_AE_MODE_ON;
+    mAwbMode = ANDROID_CONTROL_AWB_MODE_AUTO;
 
     mAfTriggerId = 0;
     mPrecaptureTriggerId = 0;
@@ -1541,26 +1547,47 @@
     return OK;
 }
 
+// Override android.control.* fields with 3A values before sending request to sensor
 status_t EmulatedFakeCamera2::ControlThread::processRequest(camera_metadata_t *request) {
     Mutex::Autolock lock(mInputMutex);
     // TODO: Add handling for all android.control.* fields here
     camera_metadata_entry_t mode;
     status_t res;
 
+#define READ_IF_OK(res, what, def)                                             \
+    (((res) == OK) ? (what) : (uint8_t)(def))
+
     res = find_camera_metadata_entry(request,
             ANDROID_CONTROL_MODE,
             &mode);
-    mControlMode = mode.data.u8[0];
+    mControlMode = READ_IF_OK(res, mode.data.u8[0], ANDROID_CONTROL_MODE_OFF);
+
+    // disable all 3A
+    if (mControlMode == ANDROID_CONTROL_MODE_OFF) {
+        mEffectMode =   ANDROID_CONTROL_EFFECT_MODE_OFF;
+        mSceneMode =    ANDROID_CONTROL_SCENE_MODE_UNSUPPORTED;
+        mAfMode =       ANDROID_CONTROL_AF_MODE_OFF;
+        mAeLock =       ANDROID_CONTROL_AE_LOCK_ON;
+        mAeMode =       ANDROID_CONTROL_AE_MODE_OFF;
+        mAfModeChange = true;
+        mStartAf =      false;
+        mCancelAf =     true;
+        mAeState =      ANDROID_CONTROL_AE_STATE_INACTIVE;
+        mAwbMode =      ANDROID_CONTROL_AWB_MODE_OFF;
+        return res;
+    }
 
     res = find_camera_metadata_entry(request,
             ANDROID_CONTROL_EFFECT_MODE,
             &mode);
-    mEffectMode = mode.data.u8[0];
+    mEffectMode = READ_IF_OK(res, mode.data.u8[0],
+                             ANDROID_CONTROL_EFFECT_MODE_OFF);
 
     res = find_camera_metadata_entry(request,
             ANDROID_CONTROL_SCENE_MODE,
             &mode);
-    mSceneMode = mode.data.u8[0];
+    mSceneMode = READ_IF_OK(res, mode.data.u8[0],
+                             ANDROID_CONTROL_SCENE_MODE_UNSUPPORTED);
 
     res = find_camera_metadata_entry(request,
             ANDROID_CONTROL_AF_MODE,
@@ -1576,12 +1603,15 @@
     res = find_camera_metadata_entry(request,
             ANDROID_CONTROL_AE_MODE,
             &mode);
-    mAeMode = mode.data.u8[0];
+    mAeMode = READ_IF_OK(res, mode.data.u8[0],
+                             ANDROID_CONTROL_AE_MODE_OFF);
 
     res = find_camera_metadata_entry(request,
             ANDROID_CONTROL_AE_LOCK,
             &mode);
-    bool aeLock = (mode.data.u8[0] == ANDROID_CONTROL_AE_LOCK_ON);
+    uint8_t aeLockVal = READ_IF_OK(res, mode.data.u8[0],
+                                   ANDROID_CONTROL_AE_LOCK_ON);
+    bool aeLock = (aeLockVal == ANDROID_CONTROL_AE_LOCK_ON);
     if (mAeLock && !aeLock) {
         mAeState = ANDROID_CONTROL_AE_STATE_INACTIVE;
     }
@@ -1590,11 +1620,12 @@
     res = find_camera_metadata_entry(request,
             ANDROID_CONTROL_AWB_MODE,
             &mode);
-    mAwbMode = mode.data.u8[0];
+    mAwbMode = READ_IF_OK(res, mode.data.u8[0],
+                          ANDROID_CONTROL_AWB_MODE_OFF);
 
     // TODO: Override more control fields
 
-    if (mAeMode != ANDROID_CONTROL_AE_OFF) {
+    if (mAeMode != ANDROID_CONTROL_AE_MODE_OFF) {
         camera_metadata_entry_t exposureTime;
         res = find_camera_metadata_entry(request,
                 ANDROID_SENSOR_EXPOSURE_TIME,
@@ -1604,6 +1635,8 @@
         }
     }
 
+#undef READ_IF_OK
+
     return OK;
 }
 
@@ -1743,12 +1776,12 @@
 int EmulatedFakeCamera2::ControlThread::processAfTrigger(uint8_t afMode,
         uint8_t afState) {
     switch (afMode) {
-        case ANDROID_CONTROL_AF_OFF:
-        case ANDROID_CONTROL_AF_EDOF:
+        case ANDROID_CONTROL_AF_MODE_OFF:
+        case ANDROID_CONTROL_AF_MODE_EDOF:
             // Do nothing
             break;
-        case ANDROID_CONTROL_AF_MACRO:
-        case ANDROID_CONTROL_AF_AUTO:
+        case ANDROID_CONTROL_AF_MODE_MACRO:
+        case ANDROID_CONTROL_AF_MODE_AUTO:
             switch (afState) {
                 case ANDROID_CONTROL_AF_STATE_INACTIVE:
                 case ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED:
@@ -1768,7 +1801,7 @@
                           afState);
             }
             break;
-        case ANDROID_CONTROL_AF_CONTINUOUS_PICTURE:
+        case ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE:
             switch (afState) {
                 // Picture mode waits for passive scan to complete
                 case ANDROID_CONTROL_AF_STATE_PASSIVE_SCAN:
@@ -1789,7 +1822,7 @@
                           afState);
             }
             break;
-        case ANDROID_CONTROL_AF_CONTINUOUS_VIDEO:
+        case ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO:
             switch (afState) {
                 // Video mode does not wait for passive scan to complete
                 case ANDROID_CONTROL_AF_STATE_PASSIVE_SCAN:
@@ -1816,8 +1849,8 @@
 
 int EmulatedFakeCamera2::ControlThread::maybeStartAfScan(uint8_t afMode,
         uint8_t afState) {
-    if ((afMode == ANDROID_CONTROL_AF_CONTINUOUS_VIDEO ||
-            afMode == ANDROID_CONTROL_AF_CONTINUOUS_PICTURE) &&
+    if ((afMode == ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO ||
+            afMode == ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE) &&
         (afState == ANDROID_CONTROL_AF_STATE_INACTIVE ||
             afState == ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED)) {
 
@@ -1844,8 +1877,8 @@
     if (mAfScanDuration <= 0) {
         ALOGV("%s: AF scan done", __FUNCTION__);
         switch (afMode) {
-            case ANDROID_CONTROL_AF_MACRO:
-            case ANDROID_CONTROL_AF_AUTO: {
+            case ANDROID_CONTROL_AF_MODE_MACRO:
+            case ANDROID_CONTROL_AF_MODE_AUTO: {
                 bool success = ((double)rand() / RAND_MAX) < kAfSuccessRate;
                 if (success) {
                     afState = ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED;
@@ -1854,7 +1887,7 @@
                 }
                 break;
             }
-            case ANDROID_CONTROL_AF_CONTINUOUS_PICTURE:
+            case ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE:
                 if (mLockAfterPassiveScan) {
                     afState = ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED;
                     mLockAfterPassiveScan = false;
@@ -1862,7 +1895,7 @@
                     afState = ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED;
                 }
                 break;
-            case ANDROID_CONTROL_AF_CONTINUOUS_VIDEO:
+            case ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO:
                 afState = ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED;
                 break;
             default:
@@ -1891,13 +1924,13 @@
 int EmulatedFakeCamera2::ControlThread::processPrecaptureTrigger(uint8_t aeMode,
         uint8_t aeState) {
     switch (aeMode) {
-        case ANDROID_CONTROL_AE_OFF:
+        case ANDROID_CONTROL_AE_MODE_OFF:
             // Don't do anything for these
             return aeState;
-        case ANDROID_CONTROL_AE_ON:
-        case ANDROID_CONTROL_AE_ON_AUTO_FLASH:
-        case ANDROID_CONTROL_AE_ON_ALWAYS_FLASH:
-        case ANDROID_CONTROL_AE_ON_AUTO_FLASH_REDEYE:
+        case ANDROID_CONTROL_AE_MODE_ON:
+        case ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH:
+        case ANDROID_CONTROL_AE_MODE_ON_ALWAYS_FLASH:
+        case ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE:
             // Trigger a precapture cycle
             aeState = ANDROID_CONTROL_AE_STATE_PRECAPTURE;
             mAeScanDuration = ((double)rand() / RAND_MAX) *
@@ -1915,12 +1948,12 @@
         uint8_t aeState) {
     if (aeLocked) return aeState;
     switch (aeMode) {
-        case ANDROID_CONTROL_AE_OFF:
+        case ANDROID_CONTROL_AE_MODE_OFF:
             break;
-        case ANDROID_CONTROL_AE_ON:
-        case ANDROID_CONTROL_AE_ON_AUTO_FLASH:
-        case ANDROID_CONTROL_AE_ON_ALWAYS_FLASH:
-        case ANDROID_CONTROL_AE_ON_AUTO_FLASH_REDEYE: {
+        case ANDROID_CONTROL_AE_MODE_ON:
+        case ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH:
+        case ANDROID_CONTROL_AE_MODE_ON_ALWAYS_FLASH:
+        case ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE: {
             if (aeState != ANDROID_CONTROL_AE_STATE_INACTIVE &&
                     aeState != ANDROID_CONTROL_AE_STATE_CONVERGED) break;
 
@@ -2000,39 +2033,39 @@
 
     // 5 cm min focus distance for back camera, infinity (fixed focus) for front
     const float minFocusDistance = mFacingBack ? 1.0/0.05 : 0.0;
-    ADD_OR_SIZE(ANDROID_LENS_MINIMUM_FOCUS_DISTANCE,
+    ADD_OR_SIZE(ANDROID_LENS_INFO_MINIMUM_FOCUS_DISTANCE,
             &minFocusDistance, 1);
     // 5 m hyperfocal distance for back camera, infinity (fixed focus) for front
     const float hyperFocalDistance = mFacingBack ? 1.0/5.0 : 0.0;
-    ADD_OR_SIZE(ANDROID_LENS_HYPERFOCAL_DISTANCE,
+    ADD_OR_SIZE(ANDROID_LENS_INFO_HYPERFOCAL_DISTANCE,
             &minFocusDistance, 1);
 
     static const float focalLength = 3.30f; // mm
-    ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_FOCAL_LENGTHS,
+    ADD_OR_SIZE(ANDROID_LENS_INFO_AVAILABLE_FOCAL_LENGTHS,
             &focalLength, 1);
     static const float aperture = 2.8f;
-    ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_APERTURES,
+    ADD_OR_SIZE(ANDROID_LENS_INFO_AVAILABLE_APERTURES,
             &aperture, 1);
     static const float filterDensity = 0;
-    ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_FILTER_DENSITY,
+    ADD_OR_SIZE(ANDROID_LENS_INFO_AVAILABLE_FILTER_DENSITIES,
             &filterDensity, 1);
     static const uint8_t availableOpticalStabilization =
-            ANDROID_LENS_OPTICAL_STABILIZATION_OFF;
-    ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_OPTICAL_STABILIZATION,
+            ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF;
+    ADD_OR_SIZE(ANDROID_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION,
             &availableOpticalStabilization, 1);
 
     static const int32_t lensShadingMapSize[] = {1, 1};
-    ADD_OR_SIZE(ANDROID_LENS_SHADING_MAP_SIZE, lensShadingMapSize,
+    ADD_OR_SIZE(ANDROID_LENS_INFO_SHADING_MAP_SIZE, lensShadingMapSize,
             sizeof(lensShadingMapSize)/sizeof(int32_t));
 
     static const float lensShadingMap[3 * 1 * 1 ] =
             { 1.f, 1.f, 1.f };
-    ADD_OR_SIZE(ANDROID_LENS_SHADING_MAP, lensShadingMap,
+    ADD_OR_SIZE(ANDROID_LENS_INFO_SHADING_MAP, lensShadingMap,
             sizeof(lensShadingMap)/sizeof(float));
 
     // Identity transform
     static const int32_t geometricCorrectionMapSize[] = {2, 2};
-    ADD_OR_SIZE(ANDROID_LENS_GEOMETRIC_CORRECTION_MAP_SIZE,
+    ADD_OR_SIZE(ANDROID_LENS_INFO_GEOMETRIC_CORRECTION_MAP_SIZE,
             geometricCorrectionMapSize,
             sizeof(geometricCorrectionMapSize)/sizeof(int32_t));
 
@@ -2041,7 +2074,7 @@
             1.f, 0.f,  1.f, 0.f,  1.f, 0.f,
             0.f, 1.f,  0.f, 1.f,  0.f, 1.f,
             1.f, 1.f,  1.f, 1.f,  1.f, 1.f};
-    ADD_OR_SIZE(ANDROID_LENS_GEOMETRIC_CORRECTION_MAP,
+    ADD_OR_SIZE(ANDROID_LENS_INFO_GEOMETRIC_CORRECTION_MAP,
             geometricCorrectionMap,
             sizeof(geometricCorrectionMap)/sizeof(float));
 
@@ -2066,31 +2099,31 @@
 
     // android.sensor
 
-    ADD_OR_SIZE(ANDROID_SENSOR_EXPOSURE_TIME_RANGE,
+    ADD_OR_SIZE(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,
             Sensor::kExposureTimeRange, 2);
 
-    ADD_OR_SIZE(ANDROID_SENSOR_MAX_FRAME_DURATION,
+    ADD_OR_SIZE(ANDROID_SENSOR_INFO_MAX_FRAME_DURATION,
             &Sensor::kFrameDurationRange[1], 1);
 
-    ADD_OR_SIZE(ANDROID_SENSOR_AVAILABLE_SENSITIVITIES,
+    ADD_OR_SIZE(ANDROID_SENSOR_INFO_AVAILABLE_SENSITIVITIES,
             Sensor::kAvailableSensitivities,
             sizeof(Sensor::kAvailableSensitivities)
             /sizeof(uint32_t));
 
-    ADD_OR_SIZE(ANDROID_SENSOR_COLOR_FILTER_ARRANGEMENT,
+    ADD_OR_SIZE(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT,
             &Sensor::kColorFilterArrangement, 1);
 
     static const float sensorPhysicalSize[2] = {3.20f, 2.40f}; // mm
-    ADD_OR_SIZE(ANDROID_SENSOR_PHYSICAL_SIZE,
+    ADD_OR_SIZE(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,
             sensorPhysicalSize, 2);
 
-    ADD_OR_SIZE(ANDROID_SENSOR_PIXEL_ARRAY_SIZE,
+    ADD_OR_SIZE(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
             Sensor::kResolution, 2);
 
-    ADD_OR_SIZE(ANDROID_SENSOR_ACTIVE_ARRAY_SIZE,
+    ADD_OR_SIZE(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
             Sensor::kResolution, 2);
 
-    ADD_OR_SIZE(ANDROID_SENSOR_WHITE_LEVEL,
+    ADD_OR_SIZE(ANDROID_SENSOR_INFO_WHITE_LEVEL,
             &Sensor::kMaxRawValue, 1);
 
     static const int32_t blackLevelPattern[4] = {
@@ -2104,10 +2137,10 @@
 
     // android.flash
     static const uint8_t flashAvailable = 0;
-    ADD_OR_SIZE(ANDROID_FLASH_AVAILABLE, &flashAvailable, 1);
+    ADD_OR_SIZE(ANDROID_FLASH_INFO_AVAILABLE, &flashAvailable, 1);
 
     static const int64_t flashChargeDuration = 0;
-    ADD_OR_SIZE(ANDROID_FLASH_CHARGE_DURATION, &flashChargeDuration, 1);
+    ADD_OR_SIZE(ANDROID_FLASH_INFO_CHARGE_DURATION, &flashChargeDuration, 1);
 
     // android.tonemap
 
@@ -2157,7 +2190,7 @@
             sizeof(kAvailableJpegMinDurations)/sizeof(uint64_t));
 
     static const float maxZoom = 10;
-    ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_MAX_ZOOM,
+    ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM,
             &maxZoom, 1);
 
     // android.jpeg
@@ -2176,33 +2209,33 @@
     // android.stats
 
     static const uint8_t availableFaceDetectModes[] = {
-        ANDROID_STATS_FACE_DETECTION_OFF,
-        ANDROID_STATS_FACE_DETECTION_SIMPLE,
-        ANDROID_STATS_FACE_DETECTION_FULL
+        ANDROID_STATISTICS_FACE_DETECT_MODE_OFF,
+        ANDROID_STATISTICS_FACE_DETECT_MODE_SIMPLE,
+        ANDROID_STATISTICS_FACE_DETECT_MODE_FULL
     };
 
-    ADD_OR_SIZE(ANDROID_STATS_AVAILABLE_FACE_DETECT_MODES,
+    ADD_OR_SIZE(ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES,
             availableFaceDetectModes,
             sizeof(availableFaceDetectModes));
 
     static const int32_t maxFaceCount = 8;
-    ADD_OR_SIZE(ANDROID_STATS_MAX_FACE_COUNT,
+    ADD_OR_SIZE(ANDROID_STATISTICS_INFO_MAX_FACE_COUNT,
             &maxFaceCount, 1);
 
     static const int32_t histogramSize = 64;
-    ADD_OR_SIZE(ANDROID_STATS_HISTOGRAM_BUCKET_COUNT,
+    ADD_OR_SIZE(ANDROID_STATISTICS_INFO_HISTOGRAM_BUCKET_COUNT,
             &histogramSize, 1);
 
     static const int32_t maxHistogramCount = 1000;
-    ADD_OR_SIZE(ANDROID_STATS_MAX_HISTOGRAM_COUNT,
+    ADD_OR_SIZE(ANDROID_STATISTICS_INFO_MAX_HISTOGRAM_COUNT,
             &maxHistogramCount, 1);
 
     static const int32_t sharpnessMapSize[2] = {64, 64};
-    ADD_OR_SIZE(ANDROID_STATS_SHARPNESS_MAP_SIZE,
+    ADD_OR_SIZE(ANDROID_STATISTICS_INFO_SHARPNESS_MAP_SIZE,
             sharpnessMapSize, sizeof(sharpnessMapSize)/sizeof(int32_t));
 
     static const int32_t maxSharpnessMapValue = 1000;
-    ADD_OR_SIZE(ANDROID_STATS_MAX_SHARPNESS_MAP_VALUE,
+    ADD_OR_SIZE(ANDROID_STATISTICS_INFO_MAX_SHARPNESS_MAP_VALUE,
             &maxSharpnessMapValue, 1);
 
     // android.control
@@ -2214,7 +2247,7 @@
             availableSceneModes, sizeof(availableSceneModes));
 
     static const uint8_t availableEffects[] = {
-            ANDROID_CONTROL_EFFECT_OFF
+            ANDROID_CONTROL_EFFECT_MODE_OFF
     };
     ADD_OR_SIZE(ANDROID_CONTROL_AVAILABLE_EFFECTS,
             availableEffects, sizeof(availableEffects));
@@ -2224,8 +2257,8 @@
             &max3aRegions, 1);
 
     static const uint8_t availableAeModes[] = {
-            ANDROID_CONTROL_AE_OFF,
-            ANDROID_CONTROL_AE_ON
+            ANDROID_CONTROL_AE_MODE_OFF,
+            ANDROID_CONTROL_AE_MODE_ON
     };
     ADD_OR_SIZE(ANDROID_CONTROL_AE_AVAILABLE_MODES,
             availableAeModes, sizeof(availableAeModes));
@@ -2233,11 +2266,11 @@
     static const camera_metadata_rational exposureCompensationStep = {
             1, 3
     };
-    ADD_OR_SIZE(ANDROID_CONTROL_AE_EXP_COMPENSATION_STEP,
+    ADD_OR_SIZE(ANDROID_CONTROL_AE_COMPENSATION_STEP,
             &exposureCompensationStep, 1);
 
     int32_t exposureCompensationRange[] = {-9, 9};
-    ADD_OR_SIZE(ANDROID_CONTROL_AE_EXP_COMPENSATION_RANGE,
+    ADD_OR_SIZE(ANDROID_CONTROL_AE_COMPENSATION_RANGE,
             exposureCompensationRange,
             sizeof(exposureCompensationRange)/sizeof(int32_t));
 
@@ -2249,33 +2282,33 @@
             sizeof(availableTargetFpsRanges)/sizeof(int32_t));
 
     static const uint8_t availableAntibandingModes[] = {
-            ANDROID_CONTROL_AE_ANTIBANDING_OFF,
-            ANDROID_CONTROL_AE_ANTIBANDING_AUTO
+            ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF,
+            ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO
     };
     ADD_OR_SIZE(ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES,
             availableAntibandingModes, sizeof(availableAntibandingModes));
 
     static const uint8_t availableAwbModes[] = {
-            ANDROID_CONTROL_AWB_OFF,
-            ANDROID_CONTROL_AWB_AUTO,
-            ANDROID_CONTROL_AWB_INCANDESCENT,
-            ANDROID_CONTROL_AWB_FLUORESCENT,
-            ANDROID_CONTROL_AWB_DAYLIGHT,
-            ANDROID_CONTROL_AWB_SHADE
+            ANDROID_CONTROL_AWB_MODE_OFF,
+            ANDROID_CONTROL_AWB_MODE_AUTO,
+            ANDROID_CONTROL_AWB_MODE_INCANDESCENT,
+            ANDROID_CONTROL_AWB_MODE_FLUORESCENT,
+            ANDROID_CONTROL_AWB_MODE_DAYLIGHT,
+            ANDROID_CONTROL_AWB_MODE_SHADE
     };
     ADD_OR_SIZE(ANDROID_CONTROL_AWB_AVAILABLE_MODES,
             availableAwbModes, sizeof(availableAwbModes));
 
     static const uint8_t availableAfModesBack[] = {
-            ANDROID_CONTROL_AF_OFF,
-            ANDROID_CONTROL_AF_AUTO,
-            ANDROID_CONTROL_AF_MACRO,
-            ANDROID_CONTROL_AF_CONTINUOUS_VIDEO,
-            ANDROID_CONTROL_AF_CONTINUOUS_PICTURE
+            ANDROID_CONTROL_AF_MODE_OFF,
+            ANDROID_CONTROL_AF_MODE_AUTO,
+            ANDROID_CONTROL_AF_MODE_MACRO,
+            ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO,
+            ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE
     };
 
     static const uint8_t availableAfModesFront[] = {
-            ANDROID_CONTROL_AF_OFF
+            ANDROID_CONTROL_AF_MODE_OFF
     };
 
     if (mFacingBack) {
@@ -2287,7 +2320,7 @@
     }
 
     static const uint8_t availableVstabModes[] = {
-            ANDROID_CONTROL_VIDEO_STABILIZATION_OFF
+            ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF
     };
     ADD_OR_SIZE(ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES,
             availableVstabModes, sizeof(availableVstabModes));
@@ -2327,7 +2360,7 @@
     static const uint8_t requestType = ANDROID_REQUEST_TYPE_CAPTURE;
     ADD_OR_SIZE(ANDROID_REQUEST_TYPE, &requestType, 1);
 
-    static const uint8_t metadataMode = ANDROID_REQUEST_METADATA_FULL;
+    static const uint8_t metadataMode = ANDROID_REQUEST_METADATA_MODE_FULL;
     ADD_OR_SIZE(ANDROID_REQUEST_METADATA_MODE, &metadataMode, 1);
 
     static const int32_t id = 0;
@@ -2355,7 +2388,7 @@
     ADD_OR_SIZE(ANDROID_LENS_FILTER_DENSITY, &filterDensity, 1);
 
     static const uint8_t opticalStabilizationMode =
-            ANDROID_LENS_OPTICAL_STABILIZATION_OFF;
+            ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF;
     ADD_OR_SIZE(ANDROID_LENS_OPTICAL_STABILIZATION_MODE,
             &opticalStabilizationMode, 1);
 
@@ -2376,7 +2409,7 @@
 
     /** android.flash */
 
-    static const uint8_t flashMode = ANDROID_FLASH_OFF;
+    static const uint8_t flashMode = ANDROID_FLASH_MODE_OFF;
     ADD_OR_SIZE(ANDROID_FLASH_MODE, &flashMode, 1);
 
     static const uint8_t flashPower = 10;
@@ -2395,79 +2428,47 @@
     uint8_t tonemapMode = 0;
     uint8_t edgeMode = 0;
     switch (request_template) {
-      case CAMERA2_TEMPLATE_PREVIEW:
-        hotPixelMode = ANDROID_PROCESSING_FAST;
-        demosaicMode = ANDROID_PROCESSING_FAST;
-        noiseMode = ANDROID_PROCESSING_FAST;
-        shadingMode = ANDROID_PROCESSING_FAST;
-        geometricMode = ANDROID_PROCESSING_FAST;
-        colorMode = ANDROID_PROCESSING_FAST;
-        tonemapMode = ANDROID_PROCESSING_FAST;
-        edgeMode = ANDROID_PROCESSING_FAST;
-        break;
       case CAMERA2_TEMPLATE_STILL_CAPTURE:
-        hotPixelMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        demosaicMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        noiseMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        shadingMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        geometricMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        colorMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        tonemapMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        edgeMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        break;
-      case CAMERA2_TEMPLATE_VIDEO_RECORD:
-        hotPixelMode = ANDROID_PROCESSING_FAST;
-        demosaicMode = ANDROID_PROCESSING_FAST;
-        noiseMode = ANDROID_PROCESSING_FAST;
-        shadingMode = ANDROID_PROCESSING_FAST;
-        geometricMode = ANDROID_PROCESSING_FAST;
-        colorMode = ANDROID_PROCESSING_FAST;
-        tonemapMode = ANDROID_PROCESSING_FAST;
-        edgeMode = ANDROID_PROCESSING_FAST;
-        break;
+        // fall-through
       case CAMERA2_TEMPLATE_VIDEO_SNAPSHOT:
-        hotPixelMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        demosaicMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        noiseMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        shadingMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        geometricMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        colorMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        tonemapMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        edgeMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        break;
+        // fall-through
       case CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG:
-        hotPixelMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        demosaicMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        noiseMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        shadingMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        geometricMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        colorMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        tonemapMode = ANDROID_PROCESSING_HIGH_QUALITY;
-        edgeMode = ANDROID_PROCESSING_HIGH_QUALITY;
+        hotPixelMode = ANDROID_HOT_PIXEL_MODE_HIGH_QUALITY;
+        demosaicMode = ANDROID_DEMOSAIC_MODE_HIGH_QUALITY;
+        noiseMode = ANDROID_NOISE_REDUCTION_MODE_HIGH_QUALITY;
+        shadingMode = ANDROID_SHADING_MODE_HIGH_QUALITY;
+        geometricMode = ANDROID_GEOMETRIC_MODE_HIGH_QUALITY;
+        colorMode = ANDROID_COLOR_CORRECTION_MODE_HIGH_QUALITY;
+        tonemapMode = ANDROID_TONEMAP_MODE_HIGH_QUALITY;
+        edgeMode = ANDROID_EDGE_MODE_HIGH_QUALITY;
         break;
+      case CAMERA2_TEMPLATE_PREVIEW:
+        // fall-through
+      case CAMERA2_TEMPLATE_VIDEO_RECORD:
+        // fall-through
       default:
-        hotPixelMode = ANDROID_PROCESSING_FAST;
-        demosaicMode = ANDROID_PROCESSING_FAST;
-        noiseMode = ANDROID_PROCESSING_FAST;
-        shadingMode = ANDROID_PROCESSING_FAST;
-        geometricMode = ANDROID_PROCESSING_FAST;
-        colorMode = ANDROID_PROCESSING_FAST;
-        tonemapMode = ANDROID_PROCESSING_FAST;
-        edgeMode = ANDROID_PROCESSING_FAST;
+        hotPixelMode = ANDROID_HOT_PIXEL_MODE_FAST;
+        demosaicMode = ANDROID_DEMOSAIC_MODE_FAST;
+        noiseMode = ANDROID_NOISE_REDUCTION_MODE_FAST;
+        shadingMode = ANDROID_SHADING_MODE_FAST;
+        geometricMode = ANDROID_GEOMETRIC_MODE_FAST;
+        colorMode = ANDROID_COLOR_CORRECTION_MODE_FAST;
+        tonemapMode = ANDROID_TONEMAP_MODE_FAST;
+        edgeMode = ANDROID_EDGE_MODE_FAST;
         break;
     }
     ADD_OR_SIZE(ANDROID_HOT_PIXEL_MODE, &hotPixelMode, 1);
     ADD_OR_SIZE(ANDROID_DEMOSAIC_MODE, &demosaicMode, 1);
-    ADD_OR_SIZE(ANDROID_NOISE_MODE, &noiseMode, 1);
+    ADD_OR_SIZE(ANDROID_NOISE_REDUCTION_MODE, &noiseMode, 1);
     ADD_OR_SIZE(ANDROID_SHADING_MODE, &shadingMode, 1);
     ADD_OR_SIZE(ANDROID_GEOMETRIC_MODE, &geometricMode, 1);
-    ADD_OR_SIZE(ANDROID_COLOR_MODE, &colorMode, 1);
+    ADD_OR_SIZE(ANDROID_COLOR_CORRECTION_MODE, &colorMode, 1);
     ADD_OR_SIZE(ANDROID_TONEMAP_MODE, &tonemapMode, 1);
     ADD_OR_SIZE(ANDROID_EDGE_MODE, &edgeMode, 1);
 
     /** android.noise */
     static const uint8_t noiseStrength = 5;
-    ADD_OR_SIZE(ANDROID_NOISE_STRENGTH, &noiseStrength, 1);
+    ADD_OR_SIZE(ANDROID_NOISE_REDUCTION_STRENGTH, &noiseStrength, 1);
 
     /** android.color */
     static const float colorTransform[9] = {
@@ -2475,7 +2476,7 @@
         0.f, 1.f, 0.f,
         0.f, 0.f, 1.f
     };
-    ADD_OR_SIZE(ANDROID_COLOR_TRANSFORM, colorTransform, 9);
+    ADD_OR_SIZE(ANDROID_COLOR_CORRECTION_TRANSFORM, colorTransform, 9);
 
     /** android.tonemap */
     static const float tonemapCurve[4] = {
@@ -2524,14 +2525,16 @@
 
     /** android.stats */
 
-    static const uint8_t faceDetectMode = ANDROID_STATS_FACE_DETECTION_OFF;
-    ADD_OR_SIZE(ANDROID_STATS_FACE_DETECT_MODE, &faceDetectMode, 1);
+    static const uint8_t faceDetectMode =
+        ANDROID_STATISTICS_FACE_DETECT_MODE_OFF;
+    ADD_OR_SIZE(ANDROID_STATISTICS_FACE_DETECT_MODE, &faceDetectMode, 1);
 
-    static const uint8_t histogramMode = ANDROID_STATS_OFF;
-    ADD_OR_SIZE(ANDROID_STATS_HISTOGRAM_MODE, &histogramMode, 1);
+    static const uint8_t histogramMode = ANDROID_STATISTICS_HISTOGRAM_MODE_OFF;
+    ADD_OR_SIZE(ANDROID_STATISTICS_HISTOGRAM_MODE, &histogramMode, 1);
 
-    static const uint8_t sharpnessMapMode = ANDROID_STATS_OFF;
-    ADD_OR_SIZE(ANDROID_STATS_SHARPNESS_MAP_MODE, &sharpnessMapMode, 1);
+    static const uint8_t sharpnessMapMode =
+        ANDROID_STATISTICS_SHARPNESS_MAP_MODE_OFF;
+    ADD_OR_SIZE(ANDROID_STATISTICS_SHARPNESS_MAP_MODE, &sharpnessMapMode, 1);
 
     // faceRectangles, faceScores, faceLandmarks, faceIds, histogram,
     // sharpnessMap only in frames
@@ -2541,36 +2544,36 @@
     uint8_t controlIntent = 0;
     switch (request_template) {
       case CAMERA2_TEMPLATE_PREVIEW:
-        controlIntent = ANDROID_CONTROL_INTENT_PREVIEW;
+        controlIntent = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW;
         break;
       case CAMERA2_TEMPLATE_STILL_CAPTURE:
-        controlIntent = ANDROID_CONTROL_INTENT_STILL_CAPTURE;
+        controlIntent = ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE;
         break;
       case CAMERA2_TEMPLATE_VIDEO_RECORD:
-        controlIntent = ANDROID_CONTROL_INTENT_VIDEO_RECORD;
+        controlIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD;
         break;
       case CAMERA2_TEMPLATE_VIDEO_SNAPSHOT:
-        controlIntent = ANDROID_CONTROL_INTENT_VIDEO_SNAPSHOT;
+        controlIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT;
         break;
       case CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG:
-        controlIntent = ANDROID_CONTROL_INTENT_ZERO_SHUTTER_LAG;
+        controlIntent = ANDROID_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG;
         break;
       default:
-        controlIntent = ANDROID_CONTROL_INTENT_CUSTOM;
+        controlIntent = ANDROID_CONTROL_CAPTURE_INTENT_CUSTOM;
         break;
     }
     ADD_OR_SIZE(ANDROID_CONTROL_CAPTURE_INTENT, &controlIntent, 1);
 
-    static const uint8_t controlMode = ANDROID_CONTROL_AUTO;
+    static const uint8_t controlMode = ANDROID_CONTROL_MODE_AUTO;
     ADD_OR_SIZE(ANDROID_CONTROL_MODE, &controlMode, 1);
 
-    static const uint8_t effectMode = ANDROID_CONTROL_EFFECT_OFF;
+    static const uint8_t effectMode = ANDROID_CONTROL_EFFECT_MODE_OFF;
     ADD_OR_SIZE(ANDROID_CONTROL_EFFECT_MODE, &effectMode, 1);
 
     static const uint8_t sceneMode = ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY;
     ADD_OR_SIZE(ANDROID_CONTROL_SCENE_MODE, &sceneMode, 1);
 
-    static const uint8_t aeMode = ANDROID_CONTROL_AE_ON_AUTO_FLASH;
+    static const uint8_t aeMode = ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH;
     ADD_OR_SIZE(ANDROID_CONTROL_AE_MODE, &aeMode, 1);
 
     static const uint8_t aeLock = ANDROID_CONTROL_AE_LOCK_OFF;
@@ -2582,7 +2585,7 @@
     ADD_OR_SIZE(ANDROID_CONTROL_AE_REGIONS, controlRegions, 5);
 
     static const int32_t aeExpCompensation = 0;
-    ADD_OR_SIZE(ANDROID_CONTROL_AE_EXP_COMPENSATION, &aeExpCompensation, 1);
+    ADD_OR_SIZE(ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION, &aeExpCompensation, 1);
 
     static const int32_t aeTargetFpsRange[2] = {
         10, 30
@@ -2590,11 +2593,11 @@
     ADD_OR_SIZE(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, aeTargetFpsRange, 2);
 
     static const uint8_t aeAntibandingMode =
-            ANDROID_CONTROL_AE_ANTIBANDING_AUTO;
+            ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO;
     ADD_OR_SIZE(ANDROID_CONTROL_AE_ANTIBANDING_MODE, &aeAntibandingMode, 1);
 
     static const uint8_t awbMode =
-            ANDROID_CONTROL_AWB_AUTO;
+            ANDROID_CONTROL_AWB_MODE_AUTO;
     ADD_OR_SIZE(ANDROID_CONTROL_AWB_MODE, &awbMode, 1);
 
     static const uint8_t awbLock = ANDROID_CONTROL_AWB_LOCK_OFF;
@@ -2605,29 +2608,30 @@
     uint8_t afMode = 0;
     switch (request_template) {
       case CAMERA2_TEMPLATE_PREVIEW:
-        afMode = ANDROID_CONTROL_AF_AUTO;
+        afMode = ANDROID_CONTROL_AF_MODE_AUTO;
         break;
       case CAMERA2_TEMPLATE_STILL_CAPTURE:
-        afMode = ANDROID_CONTROL_AF_AUTO;
+        afMode = ANDROID_CONTROL_AF_MODE_AUTO;
         break;
       case CAMERA2_TEMPLATE_VIDEO_RECORD:
-        afMode = ANDROID_CONTROL_AF_CONTINUOUS_VIDEO;
+        afMode = ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO;
         break;
       case CAMERA2_TEMPLATE_VIDEO_SNAPSHOT:
-        afMode = ANDROID_CONTROL_AF_CONTINUOUS_VIDEO;
+        afMode = ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO;
         break;
       case CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG:
-        afMode = ANDROID_CONTROL_AF_CONTINUOUS_PICTURE;
+        afMode = ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE;
         break;
       default:
-        afMode = ANDROID_CONTROL_AF_AUTO;
+        afMode = ANDROID_CONTROL_AF_MODE_AUTO;
         break;
     }
     ADD_OR_SIZE(ANDROID_CONTROL_AF_MODE, &afMode, 1);
 
     ADD_OR_SIZE(ANDROID_CONTROL_AF_REGIONS, controlRegions, 5);
 
-    static const uint8_t vstabMode = ANDROID_CONTROL_VIDEO_STABILIZATION_OFF;
+    static const uint8_t vstabMode =
+        ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF;
     ADD_OR_SIZE(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, &vstabMode, 1);
 
     // aeState, awbState, afState only in frame
diff --git a/tools/emulator/system/camera/fake-pipeline2/Sensor.cpp b/tools/emulator/system/camera/fake-pipeline2/Sensor.cpp
index 73f1fb5..316fe02 100644
--- a/tools/emulator/system/camera/fake-pipeline2/Sensor.cpp
+++ b/tools/emulator/system/camera/fake-pipeline2/Sensor.cpp
@@ -42,7 +42,8 @@
     {33331760L, 30000000000L}; // ~1/30 s - 30 sec
 const nsecs_t Sensor::kMinVerticalBlank = 10000L;
 
-const uint8_t Sensor::kColorFilterArrangement = ANDROID_SENSOR_RGGB;
+const uint8_t Sensor::kColorFilterArrangement =
+    ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB;
 
 // Output image data characteristics
 const uint32_t Sensor::kMaxRawValue = 4000;