reset to 0afba91. DO NOT MERGE.
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 0c51a4b..b62a927 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -16,6 +16,7 @@
 
 TARGET_CPU_ABI := armeabi-v7a
 TARGET_CPU_ABI2 := armeabi
+TARGET_CPU_SMP := true
 TARGET_ARCH := arm
 TARGET_ARCH_VARIANT := armv7-a-neon
 TARGET_CPU_VARIANT := krait
@@ -29,7 +30,7 @@
 
 BOARD_KERNEL_CMDLINE := console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=shamu msm_rtb.filter=0x37 ehci-hcd.park=3 utags.blkdev=/dev/block/platform/msm_sdcc.1/by-name/utags utags.backup=/dev/block/platform/msm_sdcc.1/by-name/utagsBackup coherent_pool=8M
 
-BOARD_MKBOOTIMG_ARGS := --ramdisk_offset $(BOARD_RAMDISK_OFFSET) --tags_offset $(BOARD_KERNEL_TAGS_OFFSET)
+BOARD_MKBOOTIMG_ARGS := --ramdisk_offset BOARD_RAMDISK_OFFSET --tags_offset BOARD_KERNEL_TAGS_OFFSET
 
 # Shader cache config options
 # Maximum size of the  GLES Shaders that can be cached for reuse.
@@ -109,7 +110,51 @@
 # Support Native Layer RF cutback
 BOARD_USES_CUTBACK_IN_RILD := true
 
-BOARD_SEPOLICY_DIRS += device/moto/shamu/sepolicy
+BOARD_SEPOLICY_DIRS += \
+       device/moto/shamu/sepolicy
+
+BOARD_SEPOLICY_UNION += \
+        adspd.te \
+        atfwd.te \
+        bluetooth.te \
+        bluetooth_loader.te \
+        bootanim.te \
+        bridge.te \
+        camera.te \
+        device.te \
+        domain.te \
+        file.te \
+        gsiffd.te \
+        ims.te \
+        irsc_util.te \
+        mdm_helper.te \
+        mediaserver.te \
+        mpdecision.te \
+        netd.te \
+        netmgrd.te \
+        platform_app.te \
+        property.te \
+        property_contexts \
+        qmux.te \
+        radio.te \
+        rild.te \
+        sensors.te \
+        service.te \
+        ss_ramdump.te \
+        surfaceflinger.te \
+        system_app.te \
+        system_server.te \
+        tcmd.te \
+        tee.te \
+        te_macros \
+        thermald.te \
+        time.te \
+        ueventd.te \
+        untrusted_app.te \
+        zygote.te \
+        file_contexts \
+        genfs_contexts \
+        service_contexts
 
 HAVE_ADRENO_SOURCE:= false
 
diff --git a/CleanSpec.mk b/CleanSpec.mk
index ac7af60..c7ced08 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -63,5 +63,3 @@
 # Reduce IMS logging
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
-$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/build.prop)
-$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/build.prop)
diff --git a/ShamuLayout/res/values-bn-rBD/strings.xml b/ShamuLayout/res/values-bn-rBD/strings.xml
deleted file mode 100644
index 4ba9899..0000000
--- a/ShamuLayout/res/values-bn-rBD/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Nexus 6 হোম স্ক্রীন"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"তৈরি করুন"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"Play"</string>
-</resources>
diff --git a/ShamuLayout/res/values-en-rAU/strings.xml b/ShamuLayout/res/values-en-rAU/strings.xml
deleted file mode 100644
index f70e03d..0000000
--- a/ShamuLayout/res/values-en-rAU/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Nexus 6 Home Screen"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"Create"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"Play"</string>
-</resources>
diff --git a/ShamuLayout/res/values-eu-rES/strings.xml b/ShamuLayout/res/values-eu-rES/strings.xml
deleted file mode 100644
index cfafcf1..0000000
--- a/ShamuLayout/res/values-eu-rES/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Nexus 6 hasierako pantaila"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"Sortu"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"Play"</string>
-</resources>
diff --git a/ShamuLayout/res/values-gl-rES/strings.xml b/ShamuLayout/res/values-gl-rES/strings.xml
deleted file mode 100644
index 177281f..0000000
--- a/ShamuLayout/res/values-gl-rES/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Pantalla de inicio de Nexus 6"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"Crear"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"Play"</string>
-</resources>
diff --git a/ShamuLayout/res/values-is-rIS/strings.xml b/ShamuLayout/res/values-is-rIS/strings.xml
deleted file mode 100644
index 6c5e7ca..0000000
--- a/ShamuLayout/res/values-is-rIS/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Heimaskjár Nexus 6"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"Búa til"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"Play"</string>
-</resources>
diff --git a/ShamuLayout/res/values-kk-rKZ/strings.xml b/ShamuLayout/res/values-kk-rKZ/strings.xml
deleted file mode 100644
index 8512a92..0000000
--- a/ShamuLayout/res/values-kk-rKZ/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Nexus 6 негізгі экраны"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"Жасау"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"Ойнату"</string>
-</resources>
diff --git a/ShamuLayout/res/values-kn-rIN/strings.xml b/ShamuLayout/res/values-kn-rIN/strings.xml
deleted file mode 100644
index 93b03ac..0000000
--- a/ShamuLayout/res/values-kn-rIN/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Nexus 6 ಹೋಮ್‌ ಪರದೆ"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"ರಚಿಸಿ"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"ಪ್ಲೇ ಮಾಡು"</string>
-</resources>
diff --git a/ShamuLayout/res/values-ky-rKG/strings.xml b/ShamuLayout/res/values-ky-rKG/strings.xml
deleted file mode 100644
index ce04d48..0000000
--- a/ShamuLayout/res/values-ky-rKG/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Nexus 6 Башкы экраны"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"Түзүү"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"Ойнотуу"</string>
-</resources>
diff --git a/ShamuLayout/res/values-mk-rMK/strings.xml b/ShamuLayout/res/values-mk-rMK/strings.xml
deleted file mode 100644
index f0ac9d6..0000000
--- a/ShamuLayout/res/values-mk-rMK/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Почетен екран на Nexus 6"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"Создај"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"Пушти"</string>
-</resources>
diff --git a/ShamuLayout/res/values-ml-rIN/strings.xml b/ShamuLayout/res/values-ml-rIN/strings.xml
deleted file mode 100644
index 60772eb..0000000
--- a/ShamuLayout/res/values-ml-rIN/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Nexus 6 ഹോം സ്‌ക്രീൻ"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"സൃഷ്‌ടിക്കുക"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"പ്ലേ ചെയ്യുക"</string>
-</resources>
diff --git a/ShamuLayout/res/values-mr-rIN/strings.xml b/ShamuLayout/res/values-mr-rIN/strings.xml
deleted file mode 100644
index 1a866b7..0000000
--- a/ShamuLayout/res/values-mr-rIN/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Nexus 6 मुख्य स्क्रीन"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"तयार करा"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"प्ले करा"</string>
-</resources>
diff --git a/ShamuLayout/res/values-my-rMM/strings.xml b/ShamuLayout/res/values-my-rMM/strings.xml
deleted file mode 100644
index c41776c..0000000
--- a/ShamuLayout/res/values-my-rMM/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Nexus ၆ ပင်မ မျက်နှာပြင်"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"ဖန်တီးရန်"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"ဖွင့်ရန်"</string>
-</resources>
diff --git a/ShamuLayout/res/values-ne-rNP/strings.xml b/ShamuLayout/res/values-ne-rNP/strings.xml
deleted file mode 100644
index 2f8a96f..0000000
--- a/ShamuLayout/res/values-ne-rNP/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"नेक्सस ६ गृह स्क्रिन"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"सिर्जना गर्नुहोस्"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"बजाउनुहोस्"</string>
-</resources>
diff --git a/ShamuLayout/res/values-si-rLK/strings.xml b/ShamuLayout/res/values-si-rLK/strings.xml
deleted file mode 100644
index a8e1d1f..0000000
--- a/ShamuLayout/res/values-si-rLK/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Nexus 6 මුල් තිරය"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"සාදන්න"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"ධාවනය කරන්න"</string>
-</resources>
diff --git a/ShamuLayout/res/values-ta-rIN/strings.xml b/ShamuLayout/res/values-ta-rIN/strings.xml
deleted file mode 100644
index 3229346..0000000
--- a/ShamuLayout/res/values-ta-rIN/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Nexus 6 முகப்புத் திரை"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"உருவாக்கு"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"Play"</string>
-</resources>
diff --git a/ShamuLayout/res/values-te-rIN/strings.xml b/ShamuLayout/res/values-te-rIN/strings.xml
deleted file mode 100644
index fb4898c..0000000
--- a/ShamuLayout/res/values-te-rIN/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Nexus 6 హోమ్ స్క్రీన్"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"సృష్టించండి"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"Play"</string>
-</resources>
diff --git a/ShamuLayout/res/values-ur-rPK/strings.xml b/ShamuLayout/res/values-ur-rPK/strings.xml
deleted file mode 100644
index 9066e36..0000000
--- a/ShamuLayout/res/values-ur-rPK/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"‏Nexus 6 ہوم اسکرین"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"بنائیں"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"Play"</string>
-</resources>
diff --git a/ShamuLayout/res/values-uz-rUZ/strings.xml b/ShamuLayout/res/values-uz-rUZ/strings.xml
deleted file mode 100644
index 15e8556..0000000
--- a/ShamuLayout/res/values-uz-rUZ/strings.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--  Copyright (C) 2014 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
- -->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <string name="app_label" msgid="4827444239162090155">"Nexus 6 bosh ekrani"</string>
-    <string name="google_folder_title" msgid="3050712152111669078">"Google"</string>
-    <string name="create_folder_title" msgid="1626185277541881691">"Yangi yaratish"</string>
-    <string name="play_folder_title" msgid="8796147714003891112">"Play"</string>
-</resources>
diff --git a/bluetooth/BCM4356A2_001.003.015.0038.0059_ORC.hcd b/bluetooth/BCM4356A2_001.003.015.0038.0059_ORC.hcd
deleted file mode 100644
index ba670da..0000000
--- a/bluetooth/BCM4356A2_001.003.015.0038.0059_ORC.hcd
+++ /dev/null
Binary files differ
diff --git a/bluetooth/BCM4356A2_001.003.015.0054.0155_ORC.hcd b/bluetooth/BCM4356A2_001.003.015.0054.0155_ORC.hcd
deleted file mode 100644
index bf91bb0..0000000
--- a/bluetooth/BCM4356A2_001.003.015.0054.0155_ORC.hcd
+++ /dev/null
Binary files differ
diff --git a/camera/QCamera/HAL2/core/src/QCameraHWI_Metatags.cpp b/camera/QCamera/HAL2/core/src/QCameraHWI_Metatags.cpp
index 679cda4..3d09228 100644
--- a/camera/QCamera/HAL2/core/src/QCameraHWI_Metatags.cpp
+++ b/camera/QCamera/HAL2/core/src/QCameraHWI_Metatags.cpp
@@ -33,7 +33,7 @@
 
 
 const uint32_t QCAvailableFormats[4] = {
-        HAL_PIXEL_FORMAT_RAW16,
+        HAL_PIXEL_FORMAT_RAW_SENSOR,
         HAL_PIXEL_FORMAT_BLOB,
         HAL_PIXEL_FORMAT_YV12,
         HAL_PIXEL_FORMAT_YCrCb_420_SP
@@ -175,6 +175,21 @@
             ANDROID_LENS_FACING_BACK : ANDROID_LENS_FACING_FRONT;
     ADD_OR_SIZE(ANDROID_LENS_FACING, &lensFacing, 1);
 
+    float lensPosition[3];
+    if (mFacingBack) {
+        // Back-facing camera is center-top on device
+        lensPosition[0] = 0;
+        lensPosition[1] = 20;
+        lensPosition[2] = -5;
+    } else {
+        // Front-facing camera is center-right on device
+        lensPosition[0] = 20;
+        lensPosition[1] = 20;
+        lensPosition[2] = 0;
+    }
+    ADD_OR_SIZE(ANDROID_LENS_POSITION, lensPosition, sizeof(lensPosition)/
+            sizeof(float));
+
 #if 0
     // android.sensor
 
diff --git a/camera/QCamera/stack/mm-camera-interface/Android.mk b/camera/QCamera/stack/mm-camera-interface/Android.mk
index 13db124..cf76532 100644
--- a/camera/QCamera/stack/mm-camera-interface/Android.mk
+++ b/camera/QCamera/stack/mm-camera-interface/Android.mk
@@ -49,6 +49,7 @@
 LOCAL_SRC_FILES := $(MM_CAM_FILES)

 

 LOCAL_MODULE           := libmmcamera_interface

+LOCAL_PRELINK_MODULE   := false

 LOCAL_SHARED_LIBRARIES := libdl libcutils liblog

 LOCAL_MODULE_TAGS := optional

 

diff --git a/camera/QCamera/stack/mm-jpeg-interface/Android.mk b/camera/QCamera/stack/mm-jpeg-interface/Android.mk
index 508be47..c7d151c 100644
--- a/camera/QCamera/stack/mm-jpeg-interface/Android.mk
+++ b/camera/QCamera/stack/mm-jpeg-interface/Android.mk
@@ -29,6 +29,7 @@
     src/mm_jpeg_interface.c
 
 LOCAL_MODULE           := libmmjpeg_interface
+LOCAL_PRELINK_MODULE   := false
 LOCAL_SHARED_LIBRARIES := libdl libcutils liblog libmmstillomx libimage-jpeg-enc-omx-comp
 LOCAL_MODULE_TAGS := optional
 
diff --git a/camera/QCamera2/Android.mk b/camera/QCamera2/Android.mk
index 2ab12a9..9cf5509 100644
--- a/camera/QCamera2/Android.mk
+++ b/camera/QCamera2/Android.mk
@@ -4,24 +4,9 @@
 
 include $(CLEAR_VARS)
 
-# QCameraParameters.h has unused private field.
-# QCamera2Hal.cpp, QCamera3HWI.cpp, etc. use GNU old-style field designator extension.
-# QCamera3PostProc.cpp has unused label.
-# QCamera3HWI.cpp, QCamera3PostProc.cpp etc. have unused variable.
-# QCamera3Channel.cpp compares array to null pointer.
-# QCamera2Factory.cpp, QCamera3HWI.cpp, etc. have unused parameter.
-LOCAL_CLANG_CFLAGS += \
-        -Wno-error=unused-private-field \
-        -Wno-error=gnu-designator \
-        -Wno-error=unused-label \
-        -Wno-error=unused-variable \
-        -Wno-error=unused-parameter \
-        -Wno-error=tautological-pointer-compare \
-
 LOCAL_SRC_FILES := \
         util/QCameraCmdThread.cpp \
         util/QCameraQueue.cpp \
-        util/QCameraFlash.cpp \
         QCamera2Hal.cpp \
         QCamera2Factory.cpp
 
diff --git a/camera/QCamera2/HAL/QCamera2HWI.cpp b/camera/QCamera2/HAL/QCamera2HWI.cpp
index 51222ba..d8f5933 100644
--- a/camera/QCamera2/HAL/QCamera2HWI.cpp
+++ b/camera/QCamera2/HAL/QCamera2HWI.cpp
@@ -6177,6 +6177,7 @@
 {
     int running = 1;
     int ret;
+    uint8_t is_active = FALSE;
 
     QCamera2HardwareInterface *pme = (QCamera2HardwareInterface *)obj;
     QCameraCmdThread *cmdThread = &pme->mDefferedWorkThread;
@@ -6196,9 +6197,11 @@
         switch (cmd) {
         case CAMERA_CMD_TYPE_START_DATA_PROC:
             CDBG_HIGH("%s: start data proc", __func__);
+            is_active = TRUE;
             break;
         case CAMERA_CMD_TYPE_STOP_DATA_PROC:
             CDBG_HIGH("%s: stop data proc", __func__);
+            is_active = FALSE;
             // signal cmd is completed
             cam_sem_post(&cmdThread->sync_sem);
             break;
diff --git a/camera/QCamera2/HAL3/QCamera3Channel.cpp b/camera/QCamera2/HAL3/QCamera3Channel.cpp
index 6348625..63bc787 100644
--- a/camera/QCamera2/HAL3/QCamera3Channel.cpp
+++ b/camera/QCamera2/HAL3/QCamera3Channel.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundataion. All rights reserved.
+/* Copyright (c) 2012-2014, The Linux Foundataion. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
@@ -514,7 +514,45 @@
                                 paddingInfo, postprocess_mask, userData),
                         mCamera3Stream(stream),
                         mNumBufs(0),
-                        mStreamType(stream_type)
+                        mStreamType(stream_type),
+                        mWidth(stream->width),
+                        mHeight(stream->height)
+{
+}
+
+/*===========================================================================
+ * FUNCTION   : QCamera3RegularChannel
+ *
+ * DESCRIPTION: constructor of QCamera3RegularChannel
+ *
+ * PARAMETERS :
+ *   @cam_handle : camera handle
+ *   @cam_ops    : ptr to camera ops table
+ *   @cb_routine : callback routine to frame aggregator
+ *   @stream     : camera3_stream_t structure
+ *   @stream_type: Channel stream type
+ *   @postprocess_mask: bit mask for postprocessing
+ *   @width      : width overriding camera3_stream_t::width
+ *   @height     : height overriding camera3_stream_t::height
+ *
+ * RETURN     : none
+ *==========================================================================*/
+QCamera3RegularChannel::QCamera3RegularChannel(uint32_t cam_handle,
+                    mm_camera_ops_t *cam_ops,
+                    channel_cb_routine cb_routine,
+                    cam_padding_info_t *paddingInfo,
+                    void *userData,
+                    camera3_stream_t *stream,
+                    cam_stream_type_t stream_type,
+                    uint32_t postprocess_mask,
+                    uint32_t width, uint32_t height) :
+                        QCamera3Channel(cam_handle, cam_ops, cb_routine,
+                                paddingInfo, postprocess_mask, userData),
+                        mCamera3Stream(stream),
+                        mNumBufs(0),
+                        mStreamType(stream_type),
+                        mWidth(width),
+                        mHeight(height)
 {
 }
 
@@ -601,8 +639,8 @@
         return -EINVAL;
     }
 
-    streamDim.width = mCamera3Stream->width;
-    streamDim.height = mCamera3Stream->height;
+    streamDim.width = mWidth;
+    streamDim.height = mHeight;
 
     rc = QCamera3Channel::addStream(mStreamType,
             streamFormat,
@@ -723,6 +761,7 @@
     ATRACE_CALL();
     int rc = 0;
     mIsType = isType;
+    cam_stream_type_t streamType;
 
     if ((uint32_t)mMemory.getCnt() > (mNumBufs - 1)) {
         ALOGE("%s: Trying to register more buffers than initially requested",
@@ -739,6 +778,7 @@
         }
     }
 
+    streamType = mStreams[0]->getMyType();
     rc = mMemory.registerBuffer(buffer);
     if (ALREADY_EXISTS == rc) {
         return NO_ERROR;
@@ -761,11 +801,6 @@
     int32_t resultFrameNumber;
     camera3_stream_buffer_t result;
 
-    if (NULL == stream) {
-        ALOGE("%s: Invalid stream", __func__);
-        return;
-    }
-
     if(!super_frame) {
          ALOGE("%s: Invalid Super buffer",__func__);
          return;
@@ -784,7 +819,9 @@
     frameIndex = (uint8_t)super_frame->bufs[0]->buf_idx;
     if(frameIndex >= mNumBufs) {
          ALOGE("%s: Error, Invalid index for buffer",__func__);
-         stream->bufDone(frameIndex);
+         if(stream) {
+             stream->bufDone(frameIndex);
+         }
          return;
     }
 
@@ -797,17 +834,6 @@
     result.status = CAMERA3_BUFFER_STATUS_OK;
     result.acquire_fence = -1;
     result.release_fence = -1;
-    int32_t rc = stream->bufRelease(frameIndex);
-    if (NO_ERROR != rc) {
-        ALOGE("%s: Error %d releasing stream buffer %d",
-                __func__, rc, frameIndex);
-    }
-
-    rc = mMemory.unregisterBuffer(frameIndex);
-    if (NO_ERROR != rc) {
-        ALOGE("%s: Error %d unregistering stream buffer %d",
-                __func__, rc, frameIndex);
-    }
 
     mChannelCB(NULL, &result, resultFrameNumber, mUserData);
     free(super_frame);
@@ -1387,11 +1413,6 @@
         ////Use below data to issue framework callback
         resultBuffer = (buffer_handle_t *)obj->mMemory.getBufferHandle(bufIdx);
         resultFrameNumber = obj->mMemory.getFrameNumber(bufIdx);
-        int32_t rc = obj->mMemory.unregisterBuffer(bufIdx);
-        if (NO_ERROR != rc) {
-            ALOGE("%s: Error %d unregistering stream buffer %d",
-                    __func__, rc, bufIdx);
-        }
 
         result.stream = obj->mCamera3Stream;
         result.buffer = resultBuffer;
@@ -1604,14 +1625,12 @@
     } else {
        reproc_cfg.padding->height_padding = reproc_cfg.padding->width_padding;
     }
-    if (NULL != pInputBuffer) {
-        reproc_cfg.input_stream_dim.width = pInputBuffer->stream->width;
-        reproc_cfg.input_stream_dim.height = pInputBuffer->stream->height;
-    } else {
-        reproc_cfg.input_stream_dim.width = mYuvWidth;
-        reproc_cfg.input_stream_dim.height = mYuvHeight;
+
+    reproc_cfg.input_stream_dim.width = mYuvWidth;
+    reproc_cfg.input_stream_dim.height = mYuvHeight;
+    if (NULL == pInputBuffer)
         reproc_cfg.src_channel = this;
-    }
+
     reproc_cfg.output_stream_dim.width = mCamera3Stream->width;
     reproc_cfg.output_stream_dim.height = mCamera3Stream->height;
     reproc_cfg.stream_type = mStreamType;
diff --git a/camera/QCamera2/HAL3/QCamera3Channel.h b/camera/QCamera2/HAL3/QCamera3Channel.h
index f67216e..6916621 100644
--- a/camera/QCamera2/HAL3/QCamera3Channel.h
+++ b/camera/QCamera2/HAL3/QCamera3Channel.h
@@ -143,7 +143,15 @@
                     camera3_stream_t *stream,
                     cam_stream_type_t stream_type,
                     uint32_t postprocess_mask);
-
+    QCamera3RegularChannel(uint32_t cam_handle,
+                    mm_camera_ops_t *cam_ops,
+                    channel_cb_routine cb_routine,
+                    cam_padding_info_t *paddingInfo,
+                    void *userData,
+                    camera3_stream_t *stream,
+                    cam_stream_type_t stream_type,
+                    uint32_t postprocess_mask,
+                    uint32_t width, uint32_t height);
     virtual ~QCamera3RegularChannel();
 
     virtual int32_t start();
@@ -168,6 +176,7 @@
     camera3_stream_t *mCamera3Stream;
     uint32_t mNumBufs;
     cam_stream_type_t mStreamType; // Stream type
+    uint32_t mWidth, mHeight;
     uint8_t mIntent;
 };
 
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.cpp b/camera/QCamera2/HAL3/QCamera3HWI.cpp
index 8137d80..b8fb1d9 100644
--- a/camera/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/camera/QCamera2/HAL3/QCamera3HWI.cpp
@@ -44,7 +44,6 @@
 #include <utils/Trace.h>
 #include <ui/Fence.h>
 #include <gralloc_priv.h>
-#include "util/QCameraFlash.h"
 #include "QCamera3HWI.h"
 #include "QCamera3Mem.h"
 #include "QCamera3Channel.h"
@@ -55,6 +54,8 @@
 
 namespace qcamera {
 
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
 #define DATA_PTR(MEM_OBJ,INDEX) MEM_OBJ->getPtr( INDEX )
 
 #define EMPTY_PIPELINE_DELAY 2
@@ -245,6 +246,7 @@
       mCameraOpened(false),
       mCameraInitialized(false),
       mCallbackOps(NULL),
+      mInputStream(NULL),
       mMetadataChannel(NULL),
       mPictureChannel(NULL),
       mRawChannel(NULL),
@@ -268,7 +270,7 @@
 {
     getLogLevel();
     mCameraDevice.common.tag = HARDWARE_DEVICE_TAG;
-    mCameraDevice.common.version = CAMERA_DEVICE_API_VERSION_3_3;
+    mCameraDevice.common.version = CAMERA_DEVICE_API_VERSION_3_2;
     mCameraDevice.common.close = close_camera_device;
     mCameraDevice.ops = &mCameraOps;
     mCameraDevice.priv = this;
@@ -481,15 +483,6 @@
         ALOGE("Failure: Camera already opened");
         return ALREADY_EXISTS;
     }
-
-    rc = QCameraFlash::getInstance().reserveFlashForCamera(mCameraId);
-    if (rc < 0) {
-        ALOGE("%s: Failed to reserve flash for camera id: %d",
-                __func__,
-                mCameraId);
-        return UNKNOWN_ERROR;
-    }
-
     mCameraHandle = camera_open(mCameraId);
     if (!mCameraHandle) {
         ALOGE("camera_open failed.");
@@ -541,12 +534,6 @@
     }
 #endif
 
-    if (QCameraFlash::getInstance().releaseFlashFromCamera(mCameraId) != 0) {
-        CDBG("%s: Failed to release flash for camera id: %d",
-                __func__,
-                mCameraId);
-    }
-
     return rc;
 }
 
@@ -604,19 +591,6 @@
     int32_t available_jpeg_sizes[MAX_SIZES_CNT * 2];
     uint8_t jpeg_sizes_cnt = 0;
 
-    camera3_stream_t *inputStream = NULL;
-    /*
-    * Loop through all streams to find input stream if it exists*
-    */
-    for (size_t i = 0; i< streamList->num_streams; i++) {
-        if (streamList->streams[i]->stream_type == CAMERA3_STREAM_INPUT) {
-            if (inputStream != NULL) {
-                ALOGE("%s: Error, Multiple input streams requested");
-                return -EINVAL;
-            }
-            inputStream = streamList->streams[i];
-        }
-    }
     /*
     * Loop through all streams requested in configuration
     * Check if unsupported sizes have been requested on any of them
@@ -672,9 +646,7 @@
         case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
         default:
             /* ZSL stream will be full active array size validate that*/
-            if (newStream->stream_type == CAMERA3_STREAM_BIDIRECTIONAL
-                || newStream->stream_type == CAMERA3_STREAM_INPUT
-                || newStream->usage & GRALLOC_USAGE_HW_CAMERA_ZSL){
+            if (newStream->stream_type == CAMERA3_STREAM_BIDIRECTIONAL) {
                 if ((int32_t)(newStream->width) ==
                     gCamCapability[mCameraId]->active_array_size.width
                     && (int32_t)(newStream->height)  ==
@@ -708,9 +680,6 @@
             ALOGE("%s: Error: Unsupported size of  %d x %d requested for stream"
                   "type:%d", __func__, newStream->width, newStream->height,
                   newStream->format);
-            ALOGE("%s: Active array size is  %d x %d", __func__,
-                    gCamCapability[mCameraId]->active_array_size.width,
-                    gCamCapability[mCameraId]->active_array_size.height);
             rc = -EINVAL;
             break;
         }
@@ -729,23 +698,9 @@
  * RETURN     : Boolen true/false decision
  *
  *==========================================================================*/
-bool QCamera3HardwareInterface::isSupportChannelNeeded(camera3_stream_configuration_t *streamList,
-        size_t numStreamsOnEncoder, bool bUseCommonFeatureMask,uint32_t commonFeatureMask)
+bool QCamera3HardwareInterface::isSupportChannelNeeded(camera3_stream_configuration_t *streamList)
 {
     uint32_t i;
-    uint32_t numOutputStreams = 0;
-
-    /* Check for condition where PProc pipeline does not have any streams*/
-    for (i=0; i<streamList->num_streams; i++) {
-        if (streamList->streams[i]->stream_type != CAMERA3_STREAM_INPUT) {
-            numOutputStreams++;
-        }
-    }
-    if (numStreamsOnEncoder == numOutputStreams &&
-            bUseCommonFeatureMask &&
-            commonFeatureMask == CAM_QCOM_FEATURE_NONE) {
-        return true;
-    }
 
     /* Dummy stream needed if only raw or jpeg streams present */
     for (i = 0;i < streamList->num_streams;i++) {
@@ -837,22 +792,16 @@
     bool bUseCommonFeatureMask = false;
     uint32_t commonFeatureMask = 0;
     maxViewfinderSize = gCamCapability[mCameraId]->max_viewfinder_size;
-    camera3_stream_t *inputStream = NULL;
 
     for (size_t i = 0; i < streamList->num_streams; i++) {
         camera3_stream_t *newStream = streamList->streams[i];
         CDBG_HIGH("%s: stream[%d] type = %d, format = %d, width = %d, height = %d",
                 __func__, i, newStream->stream_type, newStream->format,
                 newStream->width, newStream->height);
-
-        if (newStream->stream_type == CAMERA3_STREAM_BIDIRECTIONAL ||
-                newStream->stream_type == CAMERA3_STREAM_INPUT){
+        if (newStream->stream_type == CAMERA3_STREAM_BIDIRECTIONAL &&
+                newStream->format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED){
             isZsl = true;
         }
-        if (newStream->stream_type == CAMERA3_STREAM_INPUT){
-            inputStream = newStream;
-        }
-
         if (newStream->format == HAL_PIXEL_FORMAT_BLOB) {
             if (newStream->width > VIDEO_4K_WIDTH ||
                     newStream->height > VIDEO_4K_HEIGHT)
@@ -890,8 +839,7 @@
                 processedStreamCnt++;
                 if (newStream->width > (uint32_t)maxViewfinderSize.width ||
                         newStream->height > (uint32_t)maxViewfinderSize.height) {
-                    if (newStream->stream_type == CAMERA3_STREAM_BIDIRECTIONAL ||
-                            newStream->usage & GRALLOC_USAGE_HW_CAMERA_ZSL) {
+                    if (newStream->stream_type == CAMERA3_STREAM_BIDIRECTIONAL) {
                         commonFeatureMask |= CAM_QCOM_FEATURE_NONE;
                     } else {
                         commonFeatureMask |= CAM_QCOM_FEATURE_PP_SUPERSET;
@@ -954,10 +902,9 @@
         return rc;
     }
 
-    camera3_stream_t *zslStream = NULL; //Only use this for size and not actual handle!
+    camera3_stream_t *inputStream = NULL;
     camera3_stream_t *jpegStream = NULL;
     cam_stream_size_info_t stream_config_info;
-    memset(&stream_config_info, 0, sizeof(cam_stream_size_info_t));
     for (size_t i = 0; i < streamList->num_streams; i++) {
         camera3_stream_t *newStream = streamList->streams[i];
         CDBG_HIGH("%s: newStream type = %d, stream format = %d stream size : %d x %d",
@@ -971,14 +918,13 @@
                 QCamera3Channel *channel =
                     (QCamera3Channel*)(*it)->stream->priv;
                 stream_exists = true;
-                if (channel)
-                    delete channel;
+                delete channel;
                 (*it)->status = VALID;
                 (*it)->stream->priv = NULL;
                 (*it)->channel = NULL;
             }
         }
-        if (!stream_exists && newStream->stream_type != CAMERA3_STREAM_INPUT) {
+        if (!stream_exists) {
             //new stream
             stream_info_t* stream_info;
             stream_info = (stream_info_t* )malloc(sizeof(stream_info_t));
@@ -987,40 +933,20 @@
             stream_info->channel = NULL;
             mStreamInfo.push_back(stream_info);
         }
-        /* Covers Opaque ZSL and API1 F/W ZSL */
-        if (newStream->usage & GRALLOC_USAGE_HW_CAMERA_ZSL
+        if (newStream->stream_type == CAMERA3_STREAM_INPUT
                 || newStream->stream_type == CAMERA3_STREAM_BIDIRECTIONAL ) {
-            if (zslStream != NULL) {
-                ALOGE("%s: Multiple input/reprocess streams requested!", __func__);
+            if (inputStream != NULL) {
+                ALOGE("%s: Multiple input streams requested!", __func__);
                 pthread_mutex_unlock(&mMutex);
                 return BAD_VALUE;
             }
-            zslStream = newStream;
-        }
-        /* Covers YUV reprocess */
-        if (inputStream != NULL) {
-            if (newStream->stream_type == CAMERA3_STREAM_OUTPUT
-                    && newStream->format == HAL_PIXEL_FORMAT_YCbCr_420_888
-                    && inputStream->format == HAL_PIXEL_FORMAT_YCbCr_420_888
-                    && inputStream->width == newStream->width
-                    && inputStream->height == newStream->height) {
-                if (zslStream != NULL) {
-                    /* This scenario indicates multiple YUV streams with same size
-                     * as input stream have been requested, since zsl stream handle
-                     * is solely use for the purpose of overriding the size of streams
-                     * which share h/w streams we will just make a guess here as to
-                     * which of the stream is a ZSL stream, this will be refactored
-                     * once we make generic logic for streams sharing encoder output
-                     */
-                    CDBG_HIGH("%s: Warning, Multiple ip/reprocess streams requested!", __func__);
-                }
-                zslStream = newStream;
-            }
+            inputStream = newStream;
         }
         if (newStream->format == HAL_PIXEL_FORMAT_BLOB) {
             jpegStream = newStream;
         }
     }
+    mInputStream = inputStream;
 
     cleanAndSortStreamInfo();
     if (mMetadataChannel) {
@@ -1052,8 +978,7 @@
     }
 
 
-    if (isSupportChannelNeeded(streamList, numStreamsOnEncoder, bUseCommonFeatureMask,
-            commonFeatureMask)) {
+    if (isSupportChannelNeeded(streamList)) {
         mSupportChannel = new QCamera3SupportChannel(
                 mCameraHandle->camera_handle,
                 mCameraHandle->ops,
@@ -1072,92 +997,67 @@
     for (size_t i = 0; i < streamList->num_streams; i++) {
         camera3_stream_t *newStream = streamList->streams[i];
         uint32_t stream_usage = newStream->usage;
-        stream_config_info.stream_sizes[stream_config_info.num_streams].width = newStream->width;
-        stream_config_info.stream_sizes[stream_config_info.num_streams].height = newStream->height;
-        if ((newStream->stream_type == CAMERA3_STREAM_BIDIRECTIONAL
-                || newStream->usage & GRALLOC_USAGE_HW_CAMERA_ZSL)
-                && newStream->format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED
-                && jpegStream){
-            //for zsl stream the size is active array size
-            // FIXME remove this for api zsl bidirectional is alway active array size
-            // and for hal 3.3 reprocess, we will *indirectly* control using input size.
-            // there is a grey area however when the application whimsically decides to create
-            // a standalone zsl stream whose size < jpeg blob size
-            /*
-            stream_config_info.stream_sizes[stream_config_info.num_streams].width =
-                    gCamCapability[mCameraId]->active_array_size.width;
-            stream_config_info.stream_sizes[stream_config_info.num_streams].height =
-                    gCamCapability[mCameraId]->active_array_size.height;
-            */
-            stream_config_info.type[stream_config_info.num_streams] = CAM_STREAM_TYPE_SNAPSHOT;
-            stream_config_info.postprocess_mask[stream_config_info.num_streams] = CAM_QCOM_FEATURE_NONE;
-        } else if(newStream->stream_type == CAMERA3_STREAM_INPUT) {
-                CDBG_HIGH("%s: Input stream configured, reprocess config", __func__);
+        stream_config_info.stream_sizes[i].width = newStream->width;
+        stream_config_info.stream_sizes[i].height = newStream->height;
+        if (newStream->stream_type == CAMERA3_STREAM_BIDIRECTIONAL &&
+            newStream->format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED && jpegStream){
+            //for zsl stream the size is jpeg stream size
+            stream_config_info.stream_sizes[i].width = jpegStream->width;
+            stream_config_info.stream_sizes[i].height = jpegStream->height;
+            stream_config_info.type[i] = CAM_STREAM_TYPE_SNAPSHOT;
+            stream_config_info.postprocess_mask[i] = CAM_QCOM_FEATURE_NONE;
         } else {
-            //for non zsl streams find out the format
-            switch (newStream->format) {
-            case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED :
+           //for non zsl streams find out the format
+           switch (newStream->format) {
+           case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED :
               {
                  if (stream_usage & private_handle_t::PRIV_FLAGS_VIDEO_ENCODER) {
-                    stream_config_info.type[stream_config_info.num_streams] = CAM_STREAM_TYPE_VIDEO;
+                    stream_config_info.type[i] = CAM_STREAM_TYPE_VIDEO;
                  } else {
-                    stream_config_info.type[stream_config_info.num_streams] = CAM_STREAM_TYPE_PREVIEW;
+                    stream_config_info.type[i] = CAM_STREAM_TYPE_PREVIEW;
                  }
-                 stream_config_info.postprocess_mask[stream_config_info.num_streams] = CAM_QCOM_FEATURE_PP_SUPERSET;
+                 stream_config_info.postprocess_mask[i] = CAM_QCOM_FEATURE_PP_SUPERSET;
               }
               break;
-            case HAL_PIXEL_FORMAT_YCbCr_420_888:
-              stream_config_info.type[stream_config_info.num_streams] = CAM_STREAM_TYPE_CALLBACK;
-              stream_config_info.postprocess_mask[stream_config_info.num_streams] = CAM_QCOM_FEATURE_PP_SUPERSET;
+           case HAL_PIXEL_FORMAT_YCbCr_420_888:
+              stream_config_info.type[i] = CAM_STREAM_TYPE_CALLBACK;
+              stream_config_info.postprocess_mask[i] = CAM_QCOM_FEATURE_PP_SUPERSET;
               break;
-            case HAL_PIXEL_FORMAT_BLOB:
-              stream_config_info.type[stream_config_info.num_streams] = CAM_STREAM_TYPE_SNAPSHOT;
+           case HAL_PIXEL_FORMAT_BLOB:
+              stream_config_info.type[i] = CAM_STREAM_TYPE_SNAPSHOT;
               if (m_bIs4KVideo && !isZsl) {
-                  stream_config_info.postprocess_mask[stream_config_info.num_streams] = CAM_QCOM_FEATURE_PP_SUPERSET;
+                  stream_config_info.postprocess_mask[i] = CAM_QCOM_FEATURE_PP_SUPERSET;
               } else {
                   if (bUseCommonFeatureMask &&
                           (newStream->width > (uint32_t)maxViewfinderSize.width ||
                                   newStream->height > (uint32_t)maxViewfinderSize.height)) {
-                      stream_config_info.postprocess_mask[stream_config_info.num_streams] = commonFeatureMask;
+                      stream_config_info.postprocess_mask[i] = commonFeatureMask;
                   } else {
-                      stream_config_info.postprocess_mask[stream_config_info.num_streams] = CAM_QCOM_FEATURE_NONE;
+                      stream_config_info.postprocess_mask[i] = CAM_QCOM_FEATURE_NONE;
                   }
               }
-              if (isZsl) {
-                  if (zslStream) {
-                      stream_config_info.stream_sizes[stream_config_info.num_streams].width =
-                              zslStream->width;
-                      stream_config_info.stream_sizes[stream_config_info.num_streams].height =
-                              zslStream->height;
-                  } else {
-                      ALOGE("%s: Error, No ZSL stream identified",__func__);
-                      pthread_mutex_unlock(&mMutex);
-                      return -EINVAL;
-                  }
-              } else if (m_bIs4KVideo) {
-                  stream_config_info.stream_sizes[stream_config_info.num_streams].width = videoWidth;
-                  stream_config_info.stream_sizes[stream_config_info.num_streams].height = videoHeight;
+              if (m_bIs4KVideo) {
+                  stream_config_info.stream_sizes[i].width = videoWidth;
+                  stream_config_info.stream_sizes[i].height = videoHeight;
               }
               break;
-            case HAL_PIXEL_FORMAT_RAW_OPAQUE:
-            case HAL_PIXEL_FORMAT_RAW16:
-            case HAL_PIXEL_FORMAT_RAW10:
-              stream_config_info.type[stream_config_info.num_streams] = CAM_STREAM_TYPE_RAW;
+           case HAL_PIXEL_FORMAT_RAW_OPAQUE:
+           case HAL_PIXEL_FORMAT_RAW16:
+           case HAL_PIXEL_FORMAT_RAW10:
+              stream_config_info.type[i] = CAM_STREAM_TYPE_RAW;
               isRawStreamRequested = true;
               break;
-            default:
-              stream_config_info.type[stream_config_info.num_streams] = CAM_STREAM_TYPE_DEFAULT;
-              stream_config_info.postprocess_mask[stream_config_info.num_streams] = CAM_QCOM_FEATURE_NONE;
+           default:
+              stream_config_info.type[i] = CAM_STREAM_TYPE_DEFAULT;
+              stream_config_info.postprocess_mask[i] = CAM_QCOM_FEATURE_NONE;
               break;
-            }
-
+           }
         }
         if (newStream->priv == NULL) {
             //New stream, construct channel
             switch (newStream->stream_type) {
             case CAMERA3_STREAM_INPUT:
                 newStream->usage = GRALLOC_USAGE_HW_CAMERA_READ;
-                newStream->usage |= GRALLOC_USAGE_HW_CAMERA_WRITE;//WR for inplace algo's
                 break;
             case CAMERA3_STREAM_BIDIRECTIONAL:
                 newStream->usage = GRALLOC_USAGE_HW_CAMERA_READ |
@@ -1179,8 +1079,26 @@
                 break;
             }
 
-            if (newStream->stream_type == CAMERA3_STREAM_OUTPUT ||
-                    newStream->stream_type == CAMERA3_STREAM_BIDIRECTIONAL) {
+            if (newStream->format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED &&
+                    newStream->stream_type == CAMERA3_STREAM_BIDIRECTIONAL &&
+                    jpegStream) {
+                QCamera3Channel *channel = NULL;
+                newStream->max_buffers = QCamera3RegularChannel::kMaxBuffers;
+                channel = new QCamera3RegularChannel(mCameraHandle->camera_handle,
+                        mCameraHandle->ops, captureResultCb,
+                        &gCamCapability[mCameraId]->padding_info,
+                        this,
+                        newStream,
+                        (cam_stream_type_t) stream_config_info.type[i],
+                        stream_config_info.postprocess_mask[i],
+                        jpegStream->width, jpegStream->height);
+                    if (channel == NULL) {
+                        ALOGE("%s: allocation of channel failed", __func__);
+                        pthread_mutex_unlock(&mMutex);
+                        return -ENOMEM;
+                    }
+                    newStream->priv = channel;
+            } else if (newStream->stream_type == CAMERA3_STREAM_OUTPUT) {
                 QCamera3Channel *channel = NULL;
                 switch (newStream->format) {
                 case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
@@ -1191,8 +1109,8 @@
                             &gCamCapability[mCameraId]->padding_info,
                             this,
                             newStream,
-                            (cam_stream_type_t) stream_config_info.type[stream_config_info.num_streams],
-                            stream_config_info.postprocess_mask[stream_config_info.num_streams]);
+                            (cam_stream_type_t) stream_config_info.type[i],
+                            stream_config_info.postprocess_mask[i]);
                     if (channel == NULL) {
                         ALOGE("%s: allocation of channel failed", __func__);
                         pthread_mutex_unlock(&mMutex);
@@ -1224,7 +1142,7 @@
                     mPictureChannel = new QCamera3PicChannel(mCameraHandle->camera_handle,
                             mCameraHandle->ops, captureResultCb,
                             &gCamCapability[mCameraId]->padding_info, this, newStream,
-                            stream_config_info.postprocess_mask[stream_config_info.num_streams],
+                            stream_config_info.postprocess_mask[i],
                             m_bIs4KVideo, mMetadataChannel);
                     if (mPictureChannel == NULL) {
                         ALOGE("%s: allocation of channel failed", __func__);
@@ -1238,11 +1156,6 @@
                     ALOGE("%s: not a supported format 0x%x", __func__, newStream->format);
                     break;
                 }
-            } else if (newStream->stream_type == CAMERA3_STREAM_INPUT) {
-                newStream->max_buffers = MAX_INFLIGHT_REPROCESS_REQUESTS;
-            } else {
-                ALOGE("%s: Error, Unknown stream type", __func__);
-                return -EINVAL;
             }
 
             for (List<stream_info_t*>::iterator it=mStreamInfo.begin();
@@ -1256,27 +1169,9 @@
             // Channel already exists for this stream
             // Do nothing for now
         }
-
-    /* Do not add entries for input stream in metastream info
-         * since there is no real stream associated with it
-         */
-        if (newStream->stream_type != CAMERA3_STREAM_INPUT)
-            stream_config_info.num_streams++;
     }
 
-    if (isZsl) {
-        if (zslStream == NULL) {
-            ALOGE("%s: Error Zsl stream handle missing", __func__);
-            pthread_mutex_unlock(&mMutex);
-            return -EINVAL;
-        }
-        /* This override is possible since the f/w gaurantees that the ZSL
-           stream will always be the active array size in case of Bidirectional
-           or will be limited to the max i/p stream size which we can control to
-           be equal to be the largest YUV/Opaque stream size
-           */
-        mPictureChannel->overrideYuvSize(zslStream->width, zslStream->height);
-    } else if (mPictureChannel && m_bIs4KVideo) {
+    if (mPictureChannel && m_bIs4KVideo) {
         mPictureChannel->overrideYuvSize(videoWidth, videoHeight);
     }
 
@@ -1297,13 +1192,12 @@
     }
 
 
+    stream_config_info.num_streams = streamList->num_streams;
     if (mSupportChannel) {
         stream_config_info.stream_sizes[stream_config_info.num_streams] =
                 QCamera3SupportChannel::kDim;
         stream_config_info.type[stream_config_info.num_streams] =
                 CAM_STREAM_TYPE_CALLBACK;
-        stream_config_info.postprocess_mask[stream_config_info.num_streams] =
-                CAM_QCOM_FEATURE_PP_SUPERSET;
         stream_config_info.num_streams++;
     }
 
@@ -1380,6 +1274,12 @@
     }
 
     uint32_t frameNumber = request->frame_number;
+    if (request->input_buffer != NULL &&
+            request->input_buffer->stream != mInputStream) {
+        ALOGE("%s: Request %d: Input buffer not from input stream!",
+                __FUNCTION__, frameNumber);
+        return BAD_VALUE;
+    }
     if (request->num_output_buffers < 1 || request->output_buffers == NULL) {
         ALOGE("%s: Request %d: No output buffers provided!",
                 __FUNCTION__, frameNumber);
@@ -1387,6 +1287,13 @@
     }
     if (request->input_buffer != NULL) {
         b = request->input_buffer;
+        QCamera3Channel *channel =
+            static_cast<QCamera3Channel*>(b->stream->priv);
+        if (channel == NULL) {
+            ALOGE("%s: Request %d: Buffer %ld: Unconfigured stream!",
+                    __func__, frameNumber, (long)idx);
+            return BAD_VALUE;
+        }
         if (b->status != CAMERA3_BUFFER_STATUS_OK) {
             ALOGE("%s: Request %d: Buffer %ld: Status not OK!",
                     __func__, frameNumber, (long)idx);
@@ -1535,10 +1442,15 @@
 int64_t QCamera3HardwareInterface::getMinFrameDuration(const camera3_capture_request_t *request)
 {
     bool hasJpegStream = false;
+    bool hasRawStream = false;
     for (uint32_t i = 0; i < request->num_output_buffers; i ++) {
         const camera3_stream_t *stream = request->output_buffers[i].stream;
         if (stream->format == HAL_PIXEL_FORMAT_BLOB)
             hasJpegStream = true;
+        else if (stream->format == HAL_PIXEL_FORMAT_RAW_OPAQUE ||
+                stream->format == HAL_PIXEL_FORMAT_RAW10 ||
+                stream->format == HAL_PIXEL_FORMAT_RAW16)
+            hasRawStream = true;
     }
 
     if (!hasJpegStream)
@@ -2356,18 +2268,6 @@
     // Notify metadata channel we receive a request
     mMetadataChannel->request(NULL, frameNumber);
 
-    metadata_buffer_t reproc_meta;
-    memset(&reproc_meta, 0, sizeof(metadata_buffer_t));
-
-    if(request->input_buffer != NULL){
-        rc = setReprocParameters(request, &reproc_meta, snapshotStreamId);
-        if (NO_ERROR != rc) {
-            ALOGE("%s: fail to set reproc parameters", __func__);
-            pthread_mutex_unlock(&mMutex);
-            return rc;
-        }
-    }
-
     // Call request on other streams
     for (size_t i = 0; i < request->num_output_buffers; i++) {
         const camera3_stream_buffer_t& output = request->output_buffers[i];
@@ -2379,17 +2279,39 @@
         }
 
         if (output.stream->format == HAL_PIXEL_FORMAT_BLOB) {
-            rc = channel->request(output.buffer, frameNumber,
-                    request->input_buffer, (request->input_buffer)? &reproc_meta : mParameters);
-            if (rc < 0) {
-                ALOGE("%s: Fail to request on picture channel", __func__);
-                pthread_mutex_unlock(&mMutex);
-                return rc;
-            }
+            QCamera3RegularChannel* inputChannel = NULL;
+            if(request->input_buffer != NULL){
+
+                //Try to get the internal format
+                inputChannel = (QCamera3RegularChannel*)
+                    request->input_buffer->stream->priv;
+                if(inputChannel == NULL ){
+                    ALOGE("%s: failed to get input channel handle", __func__);
+                    pthread_mutex_unlock(&mMutex);
+                    return NO_INIT;
+                }
+                metadata_buffer_t reproc_meta;
+                rc = setReprocParameters(request, &reproc_meta, snapshotStreamId);
+                if (NO_ERROR == rc) {
+                    rc = channel->request(output.buffer, frameNumber,
+                            request->input_buffer, &reproc_meta);
+                    if (rc < 0) {
+                        ALOGE("%s: Fail to request on picture channel", __func__);
+                        pthread_mutex_unlock(&mMutex);
+                        return rc;
+                    }
+                } else {
+                    ALOGE("%s: fail to set reproc parameters", __func__);
+                    pthread_mutex_unlock(&mMutex);
+                    return rc;
+                }
+            } else
+                rc = channel->request(output.buffer, frameNumber,
+                            NULL, mParameters);
         } else {
             CDBG("%s: %d, request with buffer %p, frame_number %d", __func__,
                 __LINE__, output.buffer, frameNumber);
-            rc = channel->request(output.buffer, frameNumber);
+           rc = channel->request(output.buffer, frameNumber);
         }
         if (rc < 0)
             ALOGE("%s: request failed", __func__);
@@ -2973,11 +2895,6 @@
             (uint8_t *)POINTER_OF_META(CAM_INTF_META_NOISE_REDUCTION_STRENGTH, metadata);
         camMetadata.update(ANDROID_NOISE_REDUCTION_STRENGTH, noiseRedStrength, 1);
     }
-    if (IS_META_AVAILABLE(CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR, metadata)) {
-        float  *effectiveExposureFactor =
-            (float *)POINTER_OF_META(CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR, metadata);
-        camMetadata.update(ANDROID_REPROCESS_EFFECTIVE_EXPOSURE_FACTOR, effectiveExposureFactor, 1);
-    }
     if (IS_META_AVAILABLE(CAM_INTF_META_SCALER_CROP_REGION, metadata)) {
         cam_crop_region_t  *hScalerCropRegion =(cam_crop_region_t *)
             POINTER_OF_META(CAM_INTF_META_SCALER_CROP_REGION, metadata);
@@ -3220,11 +3137,6 @@
     if (IS_META_AVAILABLE(CAM_INTF_META_JPEG_THUMB_SIZE, metadata)) {
         cam_dimension_t *thumb_size = (cam_dimension_t *)POINTER_OF_META(
                 CAM_INTF_META_JPEG_THUMB_SIZE, metadata);
-        // Note: cam_dimension_t should have the right layout, but for safety just copy it.
-        int32_t thumbnail_size[2];
-        thumbnail_size[0] = thumb_size->width;
-        thumbnail_size[1] = thumb_size->height;
-        camMetadata.update(ANDROID_JPEG_THUMBNAIL_SIZE, thumbnail_size, 2);
     }
     if (IS_META_AVAILABLE(CAM_INTF_META_PRIVATE_DATA, metadata)) {
         int32_t *privateData = (int32_t *)
@@ -3603,6 +3515,8 @@
                                                    const char *type,
                                                    uint32_t frameNumber)
 {
+    uint32_t frm_num = 0;
+
     //Some sanity checks
     if (meta.tuning_sensor_data_size > TUNING_SENSOR_DATA_MAX) {
         ALOGE("%s : Tuning sensor data size bigger than expected %d: %d",
@@ -4198,6 +4112,10 @@
                       (uint8_t*)gCamCapability[cameraId]->optical_stab_modes,
                       gCamCapability[cameraId]->optical_stab_modes_count);
 
+    staticInfo.update(ANDROID_LENS_POSITION,
+                      gCamCapability[cameraId]->lens_position,
+                      sizeof(gCamCapability[cameraId]->lens_position)/ sizeof(float));
+
     int32_t lens_shading_map_size[] = {gCamCapability[cameraId]->lens_shading_map_size.width,
                                        gCamCapability[cameraId]->lens_shading_map_size.height};
     staticInfo.update(ANDROID_LENS_INFO_SHADING_MAP_SIZE,
@@ -4365,8 +4283,6 @@
             sizeof(scalar_formats)/sizeof(int32_t) * 4;
     int32_t available_stream_configs[max_stream_configs_size];
     int idx = 0;
-
-    /* Add input/output stream configurations for each scalar formats*/
     for (int j = 0; j < scalar_formats_count; j++) {
         switch (scalar_formats[j]) {
         case ANDROID_SCALER_AVAILABLE_FORMATS_RAW16:
@@ -4393,12 +4309,7 @@
                 idx+=4;
             }
             break;
-
-        case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
-        case HAL_PIXEL_FORMAT_YCbCr_420_888:
         default:
-            cam_dimension_t largest_picture_size;
-            memset(&largest_picture_size, 0, sizeof(cam_dimension_t));
             for (int i = 0;
                 i < gCamCapability[cameraId]->picture_sizes_tbl_cnt; i++) {
                 available_stream_configs[idx] = scalar_formats[j];
@@ -4409,28 +4320,12 @@
                 available_stream_configs[idx+3] =
                     ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT;
                 idx+=4;
-
-                /* Book keep largest */
-                if (gCamCapability[cameraId]->picture_sizes_tbl[i].width
-                        >= largest_picture_size.width &&
-                        gCamCapability[cameraId]->picture_sizes_tbl[i].height
-                        >= largest_picture_size.height)
-                    largest_picture_size = gCamCapability[cameraId]->picture_sizes_tbl[i];
             }
 
-            /*For below 2 formats we also support i/p streams for reprocessing advertise those*/
-            if (scalar_formats[j] == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED ||
-                    scalar_formats[j] == HAL_PIXEL_FORMAT_YCbCr_420_888) {
-                available_stream_configs[idx] = scalar_formats[j];
-                available_stream_configs[idx+1] = largest_picture_size.width;
-                available_stream_configs[idx+2] = largest_picture_size.height;
-                available_stream_configs[idx+3] = ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT;
-                idx+=4;
-            }
+
             break;
         }
     }
-
     staticInfo.update(ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS,
                       available_stream_configs, idx);
     static const uint8_t hotpixelMode = ANDROID_HOT_PIXEL_MODE_FAST;
@@ -4710,8 +4605,6 @@
     available_capabilities[available_capabilities_count++] = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING;
     available_capabilities[available_capabilities_count++] = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS;
     available_capabilities[available_capabilities_count++] = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE;
-    available_capabilities[available_capabilities_count++] = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_OPAQUE_REPROCESSING;
-    available_capabilities[available_capabilities_count++] = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING;
     if (facingBack) {
         available_capabilities[available_capabilities_count++] = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW;
     }
@@ -4719,24 +4612,27 @@
                       available_capabilities,
                       available_capabilities_count);
 
-    int32_t max_input_streams = 1;
+    int32_t max_input_streams = 0;
     staticInfo.update(ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS,
                       &max_input_streams,
                       1);
 
-    int32_t io_format_map[] = {
-            HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, 2,
-            HAL_PIXEL_FORMAT_YCbCr_420_888, HAL_PIXEL_FORMAT_BLOB,
-            HAL_PIXEL_FORMAT_YCbCr_420_888, 2,
-            HAL_PIXEL_FORMAT_YCbCr_420_888, HAL_PIXEL_FORMAT_BLOB};
+    int32_t io_format_map[] = {};
     staticInfo.update(ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP,
-                      io_format_map, sizeof(io_format_map)/sizeof(io_format_map[0]));
+                      io_format_map, 0);
 
     int32_t max_latency = (facingBack)? ANDROID_SYNC_MAX_LATENCY_PER_FRAME_CONTROL:CAM_MAX_SYNC_LATENCY;
     staticInfo.update(ANDROID_SYNC_MAX_LATENCY,
                       &max_latency,
                       1);
 
+    float optical_axis_angle[2];
+    optical_axis_angle[0] = 0; //need to verify
+    optical_axis_angle[1] = 0; //need to verify
+    staticInfo.update(ANDROID_LENS_OPTICAL_AXIS_ANGLE,
+                      optical_axis_angle,
+                      2);
+
     uint8_t available_hot_pixel_modes[] = {ANDROID_HOT_PIXEL_MODE_FAST};
     staticInfo.update(ANDROID_HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES,
                       available_hot_pixel_modes,
@@ -4749,11 +4645,10 @@
                       2);
 
     uint8_t available_noise_red_modes[] = {ANDROID_NOISE_REDUCTION_MODE_OFF,
-                                           ANDROID_NOISE_REDUCTION_MODE_FAST,
-                                           ANDROID_NOISE_REDUCTION_MODE_MINIMAL};
+                                           ANDROID_NOISE_REDUCTION_MODE_FAST};
     staticInfo.update(ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES,
                       available_noise_red_modes,
-                      3);
+                      2);
 
     uint8_t available_tonemap_modes[] = {ANDROID_TONEMAP_MODE_CONTRAST_CURVE,
                                          ANDROID_TONEMAP_MODE_FAST};
@@ -4911,7 +4806,7 @@
        ANDROID_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION,
        ANDROID_LENS_INFO_HYPERFOCAL_DISTANCE, ANDROID_LENS_INFO_MINIMUM_FOCUS_DISTANCE,
        ANDROID_LENS_INFO_SHADING_MAP_SIZE, ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION,
-       ANDROID_LENS_FACING,
+       ANDROID_LENS_FACING, ANDROID_LENS_OPTICAL_AXIS_ANGLE,ANDROID_LENS_POSITION,
        ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS, ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS,
        ANDROID_REQUEST_PIPELINE_MAX_DEPTH, ANDROID_REQUEST_AVAILABLE_CAPABILITIES,
        ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, ANDROID_REQUEST_AVAILABLE_RESULT_KEYS,
@@ -5421,31 +5316,11 @@
         break;
     }
 
+
     info->orientation = gCamCapability[cameraId]->sensor_mount_angle;
-    info->device_version = CAMERA_DEVICE_API_VERSION_3_3;
+    info->device_version = CAMERA_DEVICE_API_VERSION_3_2;
     info->static_camera_characteristics = gStaticMetadata[cameraId];
 
-    //For now assume both cameras can operate independently.
-    info->conflicting_devices = NULL;
-    info->conflicting_devices_length = 0;
-
-    //resource cost is 100 * MIN(1.0, m/M),
-    //where m is throughput requirement with maximum stream configuration
-    //and M is CPP maximum throughput.
-    float max_fps = 0.0;
-    for (uint32_t i = 0;
-            i < gCamCapability[cameraId]->fps_ranges_tbl_cnt; i++) {
-        if (max_fps < gCamCapability[cameraId]->fps_ranges_tbl[i].max_fps)
-            max_fps = gCamCapability[cameraId]->fps_ranges_tbl[i].max_fps;
-    }
-    float ratio = 1.0 * MAX_PROCESSED_STREAMS *
-            gCamCapability[cameraId]->active_array_size.width *
-            gCamCapability[cameraId]->active_array_size.height * max_fps /
-            gCamCapability[cameraId]->max_pixel_bandwidth;
-    info->resource_cost = 100 * MIN(1.0, ratio);
-    ALOGI("%s: camera %d resource cost is %d", __func__, cameraId,
-            info->resource_cost);
-
     return rc;
 }
 
@@ -6293,14 +6168,6 @@
                 sizeof(noiseRedStrength), &noiseRedStrength);
     }
 
-    if (frame_settings.exists(ANDROID_REPROCESS_EFFECTIVE_EXPOSURE_FACTOR)) {
-        float reprocessEffectiveExposureFactor =
-            frame_settings.find(ANDROID_REPROCESS_EFFECTIVE_EXPOSURE_FACTOR).data.f[0];
-        rc = AddSetParmEntryToBatch(hal_metadata,
-                CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR,
-                sizeof(reprocessEffectiveExposureFactor), &reprocessEffectiveExposureFactor);
-    }
-
     cam_crop_region_t scalerCropRegion;
     bool scalerCropSet = false;
     if (frame_settings.exists(ANDROID_SCALER_CROP_REGION)) {
@@ -6565,6 +6432,8 @@
         char gps_methods[GPS_PROCESSING_METHOD_SIZE];
         const char *gps_methods_src = (const char *)
                 frame_settings.find(ANDROID_JPEG_GPS_PROCESSING_METHOD).data.u8;
+        uint32_t count = frame_settings.find(
+                ANDROID_JPEG_GPS_PROCESSING_METHOD).count;
         memset(gps_methods, '\0', sizeof(gps_methods));
         strncpy(gps_methods, gps_methods_src, sizeof(gps_methods)-1);
         rc = AddSetParmEntryToBatch(hal_metadata, CAM_INTF_META_JPEG_GPS_PROC_METHODS, sizeof(gps_methods), gps_methods);
@@ -7033,34 +6902,4 @@
     return;
 }
 
-
-/*===========================================================================
-* FUNCTION   : getFlashInfo
-*
-* DESCRIPTION: Retrieve information about whether the device has a flash.
-*
-* PARAMETERS :
-*   @cameraId  : Camera id to query
-*   @hasFlash  : Boolean indicating whether there is a flash device
-*                associated with given camera
-*   @flashNode : If a flash device exists, this will be its device node.
-*
-* RETURN     :
-*   None
-*==========================================================================*/
-void QCamera3HardwareInterface::getFlashInfo(const int cameraId,
-        bool& hasFlash,
-        char (&flashNode)[QCAMERA_MAX_FILEPATH_LENGTH])
-{
-    cam_capability_t* camCapability = gCamCapability[cameraId];
-    if (NULL == camCapability) {
-        hasFlash = false;
-        flashNode[0] = '\0';
-    } else {
-        hasFlash = camCapability->flash_available;
-        strlcpy(flashNode,
-                (char*)camCapability->flash_dev_name,
-                QCAMERA_MAX_FILEPATH_LENGTH);
-    }
-}
 }; //end namespace qcamera
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.h b/camera/QCamera2/HAL3/QCamera3HWI.h
index fa16ac4..ed8c558 100644
--- a/camera/QCamera2/HAL3/QCamera3HWI.h
+++ b/camera/QCamera2/HAL3/QCamera3HWI.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundataion. All rights reserved.
+/* Copyright (c) 2012-2013, The Linux Foundataion. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
@@ -66,9 +66,6 @@
 #define FALSE 0
 #endif
 
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-
 /* Time related macros */
 typedef int64_t nsecs_t;
 #define NSEC_PER_SEC 1000000000LL
@@ -226,17 +223,12 @@
     int queueReprocMetadata(metadata_buffer_t *metadata);
     void extractJpegMetadata(CameraMetadata& jpegMetadata,
             const camera3_capture_request_t *request);
-    bool isSupportChannelNeeded(camera3_stream_configuration_t *streamList,
-        size_t numStreamsOnEncoder, bool bUseCommonFeatureMask,uint32_t commonFeatureMask);
+    bool isSupportChannelNeeded(camera3_stream_configuration_t *streamList);
 public:
     cam_dimension_t calcMaxJpegDim();
     bool needOnlineRotation();
     int getJpegQuality();
     QCamera3Exif *getExifData();
-    static void getFlashInfo(const int cameraId,
-            bool& hasFlash,
-            char (&flashNode)[QCAMERA_MAX_FILEPATH_LENGTH]);
-
 private:
     camera3_device_t   mCameraDevice;
     uint8_t            mCameraId;
@@ -248,6 +240,7 @@
 
     const camera3_callback_ops_t *mCallbackOps;
 
+    camera3_stream_t *mInputStream;
     QCamera3MetadataChannel *mMetadataChannel;
     QCamera3PicChannel *mPictureChannel;
     QCamera3RawChannel *mRawChannel;
diff --git a/camera/QCamera2/HAL3/QCamera3Mem.cpp b/camera/QCamera2/HAL3/QCamera3Mem.cpp
index d4416ef..9ec6f79 100644
--- a/camera/QCamera2/HAL3/QCamera3Mem.cpp
+++ b/camera/QCamera2/HAL3/QCamera3Mem.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundataion. All rights reserved.
+/* Copyright (c) 2012-2014, The Linux Foundataion. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -97,20 +97,12 @@
  *==========================================================================*/
 int QCamera3Memory::cacheOpsInternal(int index, unsigned int cmd, void *vaddr)
 {
-    Mutex::Autolock lock(mLock);
-
     struct ion_flush_data cache_inv_data;
     struct ion_custom_data custom_data;
     int ret = OK;
 
-    if (MM_CAMERA_MAX_NUM_FRAMES <= index) {
-        ALOGE("%s: index %d out of bound [0, %d)",
-                __func__, index, MM_CAMERA_MAX_NUM_FRAMES);
-        return BAD_INDEX;
-    }
-
-    if (0 == mMemInfo[index].handle) {
-        ALOGE("%s: Buffer at %d not registered", __func__, index);
+    if (index >= mBufferCount) {
+        ALOGE("%s: index %d out of bound [0, %d)", __func__, index, mBufferCount);
         return BAD_INDEX;
     }
 
@@ -144,17 +136,10 @@
  *
  * RETURN     : file descriptor
  *==========================================================================*/
-int QCamera3Memory::getFd(int index)
+int QCamera3Memory::getFd(int index) const
 {
-    Mutex::Autolock lock(mLock);
-
-    if (MM_CAMERA_MAX_NUM_FRAMES <= index) {
+    if (index >= mBufferCount)
         return BAD_INDEX;
-    }
-
-    if (0 == mMemInfo[index].handle) {
-        return BAD_INDEX;
-    }
 
     return mMemInfo[index].fd;
 }
@@ -169,17 +154,10 @@
  *
  * RETURN     : buffer size
  *==========================================================================*/
-int QCamera3Memory::getSize(int index)
+int QCamera3Memory::getSize(int index) const
 {
-    Mutex::Autolock lock(mLock);
-
-    if (MM_CAMERA_MAX_NUM_FRAMES <= index) {
+    if (index >= mBufferCount)
         return BAD_INDEX;
-    }
-
-    if (0 == mMemInfo[index].handle) {
-        return BAD_INDEX;
-    }
 
     return (int)mMemInfo[index].size;
 }
@@ -193,10 +171,8 @@
  *
  * RETURN     : number of buffers allocated
  *==========================================================================*/
-int QCamera3Memory::getCnt()
+int QCamera3Memory::getCnt() const
 {
-    Mutex::Autolock lock(mLock);
-
     return mBufferCount;
 }
 
@@ -215,10 +191,8 @@
  *              none-zero failure code
  *==========================================================================*/
 int32_t QCamera3Memory::getBufDef(const cam_frame_len_offset_t &offset,
-        mm_camera_buf_def_t &bufDef, int index)
+        mm_camera_buf_def_t &bufDef, int index) const
 {
-    Mutex::Autolock lock(mLock);
-
     if (!mBufferCount) {
         ALOGE("Memory not allocated");
         return NO_INIT;
@@ -228,7 +202,7 @@
     bufDef.frame_len = mMemInfo[index].size;
     bufDef.mem_info = (void *)this;
     bufDef.num_planes = offset.num_planes;
-    bufDef.buffer = getPtrLocked(index);
+    bufDef.buffer = getPtr(index);
     bufDef.buf_idx = index;
 
     /* Plane 0 needs to be set separately. Set other planes in a loop */
@@ -427,16 +401,16 @@
 }
 
 /*===========================================================================
- * FUNCTION   : getPtrLocked
+ * FUNCTION   : getPtr
  *
- * DESCRIPTION: Return buffer pointer.
+ * DESCRIPTION: return buffer pointer
  *
  * PARAMETERS :
  *   @index   : index of the buffer
  *
  * RETURN     : buffer ptr
  *==========================================================================*/
-void *QCamera3HeapMemory::getPtrLocked(int index)
+void *QCamera3HeapMemory::getPtr(int index) const
 {
     if (index >= mBufferCount) {
         ALOGE("index out of bound");
@@ -446,21 +420,6 @@
 }
 
 /*===========================================================================
- * FUNCTION   : getPtr
- *
- * DESCRIPTION: Return buffer pointer
- *
- * PARAMETERS :
- *   @index   : index of the buffer
- *
- * RETURN     : buffer ptr
- *==========================================================================*/
-void *QCamera3HeapMemory::getPtr(int index)
-{
-    return getPtrLocked(index);
-}
-
-/*===========================================================================
  * FUNCTION   : allocate
  *
  * DESCRIPTION: allocate requested number of buffers of certain size
@@ -554,7 +513,7 @@
  *              NO_ERROR  -- success
  *              none-zero failure code
  *==========================================================================*/
-int QCamera3HeapMemory::getRegFlags(uint8_t * regFlags)
+int QCamera3HeapMemory::getRegFlags(uint8_t * regFlags) const
 {
     int i;
     for (i = 0; i < mBufferCount; i ++)
@@ -648,69 +607,61 @@
     status_t ret = NO_ERROR;
     struct ion_fd_data ion_info_fd;
     void *vaddr = NULL;
-
-    int32_t idx = -1;
-
     CDBG(" %s : E ", __FUNCTION__);
 
     memset(&ion_info_fd, 0, sizeof(ion_info_fd));
 
+    if (mBufferCount >= (MM_CAMERA_MAX_NUM_FRAMES - 1)) {
+        ALOGE("%s: Number of buffers %d greater than what's supported %d",
+            __func__, mBufferCount, MM_CAMERA_MAX_NUM_FRAMES);
+        return -EINVAL;
+    }
+
     if (0 <= getMatchBufIndex((void *) buffer)) {
         ALOGV("%s: Buffer already registered", __func__);
         return ALREADY_EXISTS;
     }
 
-    Mutex::Autolock lock(mLock);
-    if (mBufferCount >= (MM_CAMERA_MAX_NUM_FRAMES - 1)) {
-        ALOGE("%s: Number of buffers %d greater than what's supported %d",
-                __func__, mBufferCount, MM_CAMERA_MAX_NUM_FRAMES);
-        return BAD_INDEX;
-    }
+    mBufferHandle[mBufferCount] = buffer;
+    mPrivateHandle[mBufferCount] =
+        (struct private_handle_t *)(*mBufferHandle[mBufferCount]);
 
-    idx = getFreeIndexLocked();
-    if (0 > idx) {
-        ALOGE("%s: No available memory slots", __func__);
-        return BAD_INDEX;
-    }
+    setMetaData(mPrivateHandle[mBufferCount], UPDATE_COLOR_SPACE, &mColorSpace);
 
-    mBufferHandle[idx] = buffer;
-    mPrivateHandle[idx] = (struct private_handle_t *)(*mBufferHandle[idx]);
-
-    setMetaData(mPrivateHandle[idx], UPDATE_COLOR_SPACE, &mColorSpace);
-
-    mMemInfo[idx].main_ion_fd = open("/dev/ion", O_RDONLY);
-    if (mMemInfo[idx].main_ion_fd < 0) {
+    mMemInfo[mBufferCount].main_ion_fd = open("/dev/ion", O_RDONLY);
+    if (mMemInfo[mBufferCount].main_ion_fd < 0) {
         ALOGE("%s: failed: could not open ion device", __func__);
         ret = NO_MEMORY;
         goto end;
     } else {
-        ion_info_fd.fd = mPrivateHandle[idx]->fd;
-        if (ioctl(mMemInfo[idx].main_ion_fd,
+        ion_info_fd.fd = mPrivateHandle[mBufferCount]->fd;
+        if (ioctl(mMemInfo[mBufferCount].main_ion_fd,
                   ION_IOC_IMPORT, &ion_info_fd) < 0) {
             ALOGE("%s: ION import failed\n", __func__);
-            close(mMemInfo[idx].main_ion_fd);
+            close(mMemInfo[mBufferCount].main_ion_fd);
             ret = NO_MEMORY;
             goto end;
         }
     }
     ALOGV("%s: idx = %d, fd = %d, size = %d, offset = %d",
-            __func__, idx, mPrivateHandle[idx]->fd,
-            mPrivateHandle[idx]->size,
-            mPrivateHandle[idx]->offset);
-    mMemInfo[idx].fd = mPrivateHandle[idx]->fd;
-    mMemInfo[idx].size = mPrivateHandle[idx]->size;
-    mMemInfo[idx].handle = ion_info_fd.handle;
+            __func__, mBufferCount, mPrivateHandle[mBufferCount]->fd,
+            mPrivateHandle[mBufferCount]->size,
+            mPrivateHandle[mBufferCount]->offset);
+    mMemInfo[mBufferCount].fd =
+            mPrivateHandle[mBufferCount]->fd;
+    mMemInfo[mBufferCount].size =
+            mPrivateHandle[mBufferCount]->size;
+    mMemInfo[mBufferCount].handle = ion_info_fd.handle;
 
     vaddr = mmap(NULL,
-            mMemInfo[idx].size,
+            mMemInfo[mBufferCount].size,
             PROT_READ | PROT_WRITE,
             MAP_SHARED,
-            mMemInfo[idx].fd, 0);
+            mMemInfo[mBufferCount].fd, 0);
     if (vaddr == MAP_FAILED) {
-        mMemInfo[idx].handle = 0;
         ret = NO_MEMORY;
     } else {
-        mPtr[idx] = vaddr;
+        mPtr[mBufferCount] = vaddr;
         mBufferCount++;
     }
 
@@ -720,77 +671,6 @@
 }
 
 /*===========================================================================
- * FUNCTION   : unregisterBufferLocked
- *
- * DESCRIPTION: Unregister buffer. Please note that this method has to be
- *              called with 'mLock' acquired.
- *
- * PARAMETERS :
- *   @idx     : unregister buffer at index 'idx'
- *
- * RETURN     : int32_t type of status
- *              NO_ERROR  -- success
- *              none-zero failure code
- *==========================================================================*/
-int32_t QCamera3GrallocMemory::unregisterBufferLocked(size_t idx)
-{
-    munmap(mPtr[idx], mMemInfo[idx].size);
-    mPtr[idx] = NULL;
-
-    struct ion_handle_data ion_handle;
-    memset(&ion_handle, 0, sizeof(ion_handle));
-    ion_handle.handle = mMemInfo[idx].handle;
-    if (ioctl(mMemInfo[idx].main_ion_fd, ION_IOC_FREE, &ion_handle) < 0) {
-        ALOGE("ion free failed");
-    }
-    close(mMemInfo[idx].main_ion_fd);
-    memset(&mMemInfo[idx], 0, sizeof(struct QCamera3MemInfo));
-    mBufferHandle[idx] = NULL;
-    mPrivateHandle[idx] = NULL;
-    mBufferCount--;
-
-    return NO_ERROR;
-}
-
-/*===========================================================================
- * FUNCTION   : unregisterBuffer
- *
- * DESCRIPTION: unregister buffer
- *
- * PARAMETERS :
- *   @idx     : unregister buffer at index 'idx'
- *
- * RETURN     : int32_t type of status
- *              NO_ERROR  -- success
- *              none-zero failure code
- *==========================================================================*/
-int32_t QCamera3GrallocMemory::unregisterBuffer(size_t idx)
-{
-    int32_t rc = NO_ERROR;
-    Mutex::Autolock lock(mLock);
-
-    CDBG("%s: E ", __FUNCTION__);
-
-    if (MM_CAMERA_MAX_NUM_FRAMES <= idx) {
-        ALOGE("%s: Buffer index %d greater than what is supported %d",
-                __func__, idx, MM_CAMERA_MAX_NUM_FRAMES);
-        return BAD_VALUE;
-    }
-
-    if (0 == mMemInfo[idx].handle) {
-        ALOGE("%s: Trying to unregister buffer at %d which still not registered",
-                __func__, idx);
-        return BAD_VALUE;
-    }
-
-    rc = unregisterBufferLocked(idx);
-
-    CDBG(" %s : X ",__FUNCTION__);
-
-    return rc;
-}
-
-/*===========================================================================
  * FUNCTION   : unregisterBuffers
  *
  * DESCRIPTION: unregister buffers
@@ -801,20 +681,20 @@
  *==========================================================================*/
 void QCamera3GrallocMemory::unregisterBuffers()
 {
-    int err = NO_ERROR;
-    Mutex::Autolock lock(mLock);
-
     CDBG("%s: E ", __FUNCTION__);
 
-    for (size_t cnt = 0; cnt < MM_CAMERA_MAX_NUM_FRAMES; cnt++) {
-        if (0 == mMemInfo[cnt].handle) {
-            continue;
+    for (int cnt = 0; cnt < mBufferCount; cnt++) {
+        munmap(mPtr[cnt], mMemInfo[cnt].size);
+        mPtr[cnt] = NULL;
+
+        struct ion_handle_data ion_handle;
+        memset(&ion_handle, 0, sizeof(ion_handle));
+        ion_handle.handle = mMemInfo[cnt].handle;
+        if (ioctl(mMemInfo[cnt].main_ion_fd, ION_IOC_FREE, &ion_handle) < 0) {
+            ALOGE("ion free failed");
         }
-        err = unregisterBufferLocked(cnt);
-        if (NO_ERROR != err) {
-            ALOGE("%s: Error unregistering buffer %d error %d",
-                    __func__, cnt, err);
-        }
+        close(mMemInfo[cnt].main_ion_fd);
+        CDBG_HIGH("put buffer %d successfully", cnt);
     }
     mBufferCount = 0;
     CDBG(" %s : X ",__FUNCTION__);
@@ -838,18 +718,10 @@
  *==========================================================================*/
 int32_t QCamera3GrallocMemory::markFrameNumber(int index, uint32_t frameNumber)
 {
-    Mutex::Autolock lock(mLock);
-
-    if (index >= MM_CAMERA_MAX_NUM_FRAMES) {
+    if(index >= mBufferCount || index >= MM_CAMERA_MAX_NUM_FRAMES) {
         ALOGE("%s: Index out of bounds",__func__);
         return BAD_INDEX;
     }
-
-    if (0 == mMemInfo[index].handle) {
-        ALOGE("%s: Buffer at %d not registered",__func__, index);
-        return BAD_INDEX;
-    }
-
     mCurrentFrameNumbers[index] = frameNumber;
     return NO_ERROR;
 }
@@ -865,23 +737,16 @@
  *   @index   : index of the buffer
  *
  * RETURN     : int32_t frameNumber
- *              positive/zero  -- success
- *              negative failure
+ *              postive/zero  -- success
+ *              negetive failure
  *==========================================================================*/
 int32_t QCamera3GrallocMemory::getFrameNumber(int index)
 {
-    Mutex::Autolock lock(mLock);
-
-    if (index >= MM_CAMERA_MAX_NUM_FRAMES) {
+    if(index >= mBufferCount || index >= MM_CAMERA_MAX_NUM_FRAMES) {
         ALOGE("%s: Index out of bounds",__func__);
         return -1;
     }
 
-    if (0 == mMemInfo[index].handle) {
-        ALOGE("%s: Buffer at %d not registered",__func__, index);
-        return -1;
-    }
-
     return mCurrentFrameNumbers[index];
 }
 
@@ -900,6 +765,8 @@
  *==========================================================================*/
 int QCamera3GrallocMemory::cacheOps(int index, unsigned int cmd)
 {
+    if (index >= mBufferCount)
+        return BAD_INDEX;
     return cacheOpsInternal(index, cmd, mPtr[index]);
 }
 
@@ -915,14 +782,11 @@
  *              NO_ERROR  -- success
  *              none-zero failure code
  *==========================================================================*/
-int QCamera3GrallocMemory::getRegFlags(uint8_t *regFlags)
+int QCamera3GrallocMemory::getRegFlags(uint8_t *regFlags) const
 {
-    Mutex::Autolock lock(mLock);
-
     int i;
     for (i = 0; i < mBufferCount; i ++)
         regFlags[i] = 0;
-
     return NO_ERROR;
 }
 
@@ -939,95 +803,37 @@
  *==========================================================================*/
 int QCamera3GrallocMemory::getMatchBufIndex(void *object)
 {
-    Mutex::Autolock lock(mLock);
-
     int index = -1;
     buffer_handle_t *key = (buffer_handle_t*) object;
     if (!key) {
         return BAD_VALUE;
     }
-    for (int i = 0; i < MM_CAMERA_MAX_NUM_FRAMES; i++) {
+    for (int i = 0; i < mBufferCount; i++) {
         if (mBufferHandle[i] == key) {
             index = i;
             break;
         }
     }
-
     return index;
 }
 
 /*===========================================================================
- * FUNCTION   : getFreeIndexLocked
- *
- * DESCRIPTION: Find free index slot. Note 'mLock' needs to be acquired
- *              before calling this method.
- *
- * PARAMETERS : None
- *
- * RETURN     : free buffer index if found,
- *              -1 if failed
- *==========================================================================*/
-int QCamera3GrallocMemory::getFreeIndexLocked()
-{
-    int index = -1;
-
-    if (mBufferCount >= (MM_CAMERA_MAX_NUM_FRAMES - 1)) {
-        ALOGE("%s: Number of buffers %d greater than what's supported %d",
-            __func__, mBufferCount, MM_CAMERA_MAX_NUM_FRAMES);
-        return index;
-    }
-
-    for (size_t i = 0; i < MM_CAMERA_MAX_NUM_FRAMES; i++) {
-        if (0 == mMemInfo[i].handle) {
-            index = i;
-            break;
-        }
-    }
-
-    return index;
-}
-
-/*===========================================================================
- * FUNCTION   : getPtrLocked
- *
- * DESCRIPTION: Return buffer pointer. Please note 'mLock' must be acquired
- *              before calling this method.
- *
- * PARAMETERS :
- *   @index   : index of the buffer
- *
- * RETURN     : buffer ptr
- *==========================================================================*/
-void *QCamera3GrallocMemory::getPtrLocked(int index)
-{
-    if (MM_CAMERA_MAX_NUM_FRAMES <= index) {
-        ALOGE("%s: index %d out of bound [0, %d)",
-                __func__, index, MM_CAMERA_MAX_NUM_FRAMES);
-        return NULL;
-    }
-
-    if (0 == mMemInfo[index].handle) {
-        ALOGE("%s: Buffer at %d not registered", __func__, index);
-        return NULL;
-    }
-
-    return mPtr[index];
-}
-
-/*===========================================================================
  * FUNCTION   : getPtr
  *
- * DESCRIPTION: Return buffer pointer.
+ * DESCRIPTION: return buffer pointer
  *
  * PARAMETERS :
  *   @index   : index of the buffer
  *
  * RETURN     : buffer ptr
  *==========================================================================*/
-void *QCamera3GrallocMemory::getPtr(int index)
+void *QCamera3GrallocMemory::getPtr(int index) const
 {
-    Mutex::Autolock lock(mLock);
-    return getPtrLocked(index);
+    if (index >= mBufferCount) {
+        ALOGE("index out of bound");
+        return (void *)BAD_INDEX;
+    }
+    return mPtr[index];
 }
 
 /*===========================================================================
@@ -1043,19 +849,10 @@
  *==========================================================================*/
 void *QCamera3GrallocMemory::getBufferHandle(int index)
 {
-    Mutex::Autolock lock(mLock);
-
-    if (MM_CAMERA_MAX_NUM_FRAMES <= index) {
-        ALOGE("%s: index %d out of bound [0, %d)",
-                __func__, index, MM_CAMERA_MAX_NUM_FRAMES);
+    if (index >= mBufferCount) {
+        ALOGE("index out of bound");
         return NULL;
     }
-
-    if (0 == mMemInfo[index].handle) {
-        ALOGE("%s: Buffer at %d not registered", __func__, index);
-        return NULL;
-    }
-
     return mBufferHandle[index];
 }
 
diff --git a/camera/QCamera2/HAL3/QCamera3Mem.h b/camera/QCamera2/HAL3/QCamera3Mem.h
index 08dfcb2..a9af447 100644
--- a/camera/QCamera2/HAL3/QCamera3Mem.h
+++ b/camera/QCamera2/HAL3/QCamera3Mem.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundataion. All rights reserved.
+/* Copyright (c) 2012-2013, The Linux Foundataion. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -39,8 +39,6 @@
 #include <mm_camera_interface.h>
 }
 
-using namespace android;
-
 namespace qcamera {
 
 // Base class for all memory types. Abstract.
@@ -50,20 +48,20 @@
     int cleanCache(int index) {return cacheOps(index, ION_IOC_CLEAN_CACHES);}
     int invalidateCache(int index) {return cacheOps(index, ION_IOC_INV_CACHES);}
     int cleanInvalidateCache(int index) {return cacheOps(index, ION_IOC_CLEAN_INV_CACHES);}
-    int getFd(int index);
-    int getSize(int index);
-    int getCnt();
+    int getFd(int index) const;
+    int getSize(int index) const;
+    int getCnt() const;
 
     virtual int cacheOps(int index, unsigned int cmd) = 0;
-    virtual int getRegFlags(uint8_t *regFlags) = 0;
+    virtual int getRegFlags(uint8_t *regFlags) const = 0;
     virtual int getMatchBufIndex(void *object) = 0;
-    virtual void *getPtr(int index) = 0;
+    virtual void *getPtr(int index) const= 0;
 
     QCamera3Memory();
     virtual ~QCamera3Memory();
 
     int32_t getBufDef(const cam_frame_len_offset_t &offset,
-                mm_camera_buf_def_t &bufDef, int index);
+                mm_camera_buf_def_t &bufDef, int index) const;
 
 protected:
     struct QCamera3MemInfo {
@@ -74,12 +72,10 @@
     };
 
     int cacheOpsInternal(int index, unsigned int cmd, void *vaddr);
-    virtual void *getPtrLocked(int index) = 0;
 
     int mBufferCount;
     struct QCamera3MemInfo mMemInfo[MM_CAMERA_MAX_NUM_FRAMES];
     void *mPtr[MM_CAMERA_MAX_NUM_FRAMES];
-    Mutex mLock;
 };
 
 // Internal heap memory is used for memories used internally
@@ -94,11 +90,9 @@
     void deallocate();
 
     virtual int cacheOps(int index, unsigned int cmd);
-    virtual int getRegFlags(uint8_t *regFlags);
+    virtual int getRegFlags(uint8_t *regFlags) const;
     virtual int getMatchBufIndex(void *object);
-    virtual void *getPtr(int index);
-protected:
-    virtual void *getPtrLocked(int index);
+    virtual void *getPtr(int index) const;
 private:
     int alloc(int count, int size, int heap_id);
     void dealloc();
@@ -115,21 +109,16 @@
     virtual ~QCamera3GrallocMemory();
 
     int registerBuffer(buffer_handle_t *buffer);
-    int32_t unregisterBuffer(size_t idx);
     void unregisterBuffers();
     virtual int cacheOps(int index, unsigned int cmd);
-    virtual int getRegFlags(uint8_t *regFlags);
+    virtual int getRegFlags(uint8_t *regFlags) const;
     virtual int getMatchBufIndex(void *object);
-    virtual void *getPtr(int index);
+    virtual void *getPtr(int index) const;
     int32_t markFrameNumber(int index, uint32_t frameNumber);
     int32_t getFrameNumber(int index);
     void *getBufferHandle(int index);
     int32_t setColorSpace(uint8_t intent);
-protected:
-    virtual void *getPtrLocked(int index);
 private:
-    int32_t unregisterBufferLocked(size_t idx);
-    int32_t getFreeIndexLocked();
     buffer_handle_t *mBufferHandle[MM_CAMERA_MAX_NUM_FRAMES];
     struct private_handle_t *mPrivateHandle[MM_CAMERA_MAX_NUM_FRAMES];
     uint32_t mCurrentFrameNumbers[MM_CAMERA_MAX_NUM_FRAMES];
diff --git a/camera/QCamera2/HAL3/QCamera3PostProc.cpp b/camera/QCamera2/HAL3/QCamera3PostProc.cpp
index 0539d0f..a56375f 100644
--- a/camera/QCamera2/HAL3/QCamera3PostProc.cpp
+++ b/camera/QCamera2/HAL3/QCamera3PostProc.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundataion. All rights reserved.
+/* Copyright (c) 2012-2014, The Linux Foundataion. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
@@ -185,7 +185,7 @@
     int32_t rc = NO_ERROR;
     QCamera3HardwareInterface* hal_obj = (QCamera3HardwareInterface*)m_parent->mUserData;
 
-    if (hal_obj->needReprocess(mPostProcMask) || config.src_channel != m_parent) {
+    if (hal_obj->needReprocess(mPostProcMask)) {
         if (m_pReprocChannel != NULL) {
             m_pReprocChannel->stop();
             delete m_pReprocChannel;
@@ -260,6 +260,7 @@
         jpeg_settings_t *jpeg_settings)
 {
     CDBG("%s : E", __func__);
+    int32_t ret = NO_ERROR;
 
     if ((NULL == frame) || (NULL == jpeg_settings)) {
         return BAD_VALUE;
@@ -321,6 +322,10 @@
 
     CDBG("%s : X", __func__);
     return NO_ERROR;
+
+on_error:
+    CDBG("%s : X with error %d", __func__, ret);
+    return ret;
 }
 
 /*===========================================================================
@@ -384,7 +389,7 @@
         ret = BAD_VALUE;
         goto on_error;
     }
-    encode_parm.num_src_bufs = MIN(pStreamMem->getCnt(), MM_JPEG_MAX_BUF);
+    encode_parm.num_src_bufs = pStreamMem->getCnt();
     for (uint32_t i = 0; i < encode_parm.num_src_bufs; i++) {
         if (pStreamMem != NULL) {
             encode_parm.src_main_buf[i].index = i;
@@ -408,8 +413,8 @@
         cam_frame_len_offset_t thumb_offset;
         memset(&thumb_offset, 0, sizeof(cam_frame_len_offset_t));
         main_stream->getFrameOffset(thumb_offset);
-        encode_parm.num_tmb_bufs = MIN(pStreamMem->getCnt(), MM_JPEG_MAX_BUF);
-        for (size_t i = 0; i < encode_parm.num_tmb_bufs; i++) {
+        encode_parm.num_tmb_bufs = pStreamMem->getCnt();
+        for (int i = 0; i < pStreamMem->getCnt(); i++) {
             if (pStreamMem != NULL) {
                 encode_parm.src_thumb_buf[i].index = i;
                 encode_parm.src_thumb_buf[i].buf_size = pStreamMem->getSize(i);
@@ -459,6 +464,7 @@
  *==========================================================================*/
 int32_t QCamera3PostProcessor::processData(mm_camera_super_buf_t *frame)
 {
+    QCamera3HardwareInterface* hal_obj = (QCamera3HardwareInterface*)m_parent->mUserData;
     pthread_mutex_lock(&mReprocJobLock);
     // enqueue to post proc input queue
     m_inputPPQ.enqueue((void *)frame);
@@ -489,8 +495,7 @@
 int32_t QCamera3PostProcessor::processData(qcamera_fwk_input_pp_data_t *frame)
 {
     QCamera3HardwareInterface* hal_obj = (QCamera3HardwareInterface*)m_parent->mUserData;
-    if (hal_obj->needReprocess(mPostProcMask) ||
-            frame->reproc_config.src_channel != m_parent) {
+    if (hal_obj->needReprocess(mPostProcMask)) {
         pthread_mutex_lock(&mReprocJobLock);
         // enqueu to post proc input queue
         m_inputFWKPPQ.enqueue((void *)frame);
diff --git a/camera/QCamera2/HAL3/QCamera3Stream.cpp b/camera/QCamera2/HAL3/QCamera3Stream.cpp
index 35e24d8..638bac8 100644
--- a/camera/QCamera2/HAL3/QCamera3Stream.cpp
+++ b/camera/QCamera2/HAL3/QCamera3Stream.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundataion. All rights reserved.
+/* Copyright (c) 2012-2014, The Linux Foundataion. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
@@ -203,7 +203,7 @@
         int rc = mCamOps->unmap_stream_buf(mCamHandle,
                     mChannelHandle, mHandle, CAM_MAPPING_BUF_TYPE_STREAM_INFO, 0, -1);
         if (rc < 0) {
-            ALOGE("Failed to un-map stream info buffer");
+            ALOGE("Failed to map stream info buffer");
         }
         mStreamInfoBuf->deallocate();
         delete mStreamInfoBuf;
@@ -496,6 +496,36 @@
 }
 
 /*===========================================================================
+ * FUNCTION   : getInternalFormatBuffer
+ *
+ * DESCRIPTION: return buffer in the internal format structure
+ *
+ * PARAMETERS :
+ *   @index   : index of buffer to be returned
+ *
+ * RETURN     : int32_t type of status
+ *              NO_ERROR  -- success
+ *              none-zero failure code
+ *==========================================================================*/
+mm_camera_buf_def_t* QCamera3Stream::getInternalFormatBuffer(int index)
+{
+    mm_camera_buf_def_t *rc = NULL;
+    if ((index >= mNumBufs) || (mBufDefs == NULL) ||
+            (NULL == mBufDefs[index].mem_info)) {
+        ALOGE("%s:Index out of range/no internal buffers yet", __func__);
+        return NULL;
+    }
+
+    rc = (mm_camera_buf_def_t*)malloc(sizeof(mm_camera_buf_def_t));
+    if(rc) {
+        memcpy(rc, &mBufDefs[index], sizeof(mm_camera_buf_def_t));
+    } else {
+        ALOGE("%s: Failed to allocate memory",__func__);
+    }
+    return rc;
+}
+
+/*===========================================================================
  * FUNCTION   : bufDone
  *
  * DESCRIPTION: return stream buffer to kernel
@@ -510,11 +540,9 @@
 int32_t QCamera3Stream::bufDone(int index)
 {
     int32_t rc = NO_ERROR;
-    Mutex::Autolock lock(mLock);
 
-    if ((index >= mNumBufs) || (mBufDefs == NULL)) {
+    if (index >= mNumBufs || mBufDefs == NULL)
         return BAD_INDEX;
-    }
 
     if( NULL == mBufDefs[index].mem_info) {
         if (NULL == mMemOps) {
@@ -538,51 +566,8 @@
     }
 
     rc = mCamOps->qbuf(mCamHandle, mChannelHandle, &mBufDefs[index]);
-    if (rc < 0) {
+    if (rc < 0)
         return FAILED_TRANSACTION;
-    }
-
-    return rc;
-}
-
-/*===========================================================================
- * FUNCTION   : bufRelease
- *
- * DESCRIPTION: release all resources associated with this buffer
- *
- * PARAMETERS :
- *   @index   : index of buffer to be released
- *
- * RETURN     : int32_t type of status
- *              NO_ERROR  -- success
- *              none-zero failure code
- *==========================================================================*/
-int32_t QCamera3Stream::bufRelease(int32_t index)
-{
-    int32_t rc = NO_ERROR;
-    Mutex::Autolock lock(mLock);
-
-    if ((index >= mNumBufs) || (mBufDefs == NULL)) {
-        return BAD_INDEX;
-    }
-
-    if (NULL != mBufDefs[index].mem_info) {
-        if (NULL == mMemOps) {
-            ALOGE("%s: Camera operations not initialized", __func__);
-            return NO_INIT;
-        }
-
-        rc = mMemOps->unmap_ops(index, -1, mMemOps->userdata);
-        if (rc < 0) {
-            ALOGE("%s: Failed to un-map camera buffer %d", __func__, index);
-            return rc;
-        }
-
-        mBufDefs[index].mem_info = NULL;
-    } else {
-        ALOGE("%s: Buffer at index %d not registered", __func__, index);
-        return BAD_INDEX;
-    }
 
     return rc;
 }
@@ -612,7 +597,6 @@
 {
     int rc = NO_ERROR;
     uint8_t *regFlags;
-    Mutex::Autolock lock(mLock);
 
     if (!ops_tbl) {
         ALOGE("%s: ops_tbl is NULL", __func__);
@@ -701,13 +685,11 @@
 int32_t QCamera3Stream::putBufs(mm_camera_map_unmap_ops_tbl_t *ops_tbl)
 {
     int rc = NO_ERROR;
-    Mutex::Autolock lock(mLock);
-
     for (int i = 0; i < mNumBufs; i++) {
         if (NULL != mBufDefs[i].mem_info) {
             rc = ops_tbl->unmap_ops(i, -1, ops_tbl->userdata);
             if (rc < 0) {
-                ALOGE("%s: un-map stream buf failed: %d", __func__, rc);
+                ALOGE("%s: map_stream_buf failed: %d", __func__, rc);
             }
         }
     }
diff --git a/camera/QCamera2/HAL3/QCamera3Stream.h b/camera/QCamera2/HAL3/QCamera3Stream.h
index 0a6a917..c06cb12 100644
--- a/camera/QCamera2/HAL3/QCamera3Stream.h
+++ b/camera/QCamera2/HAL3/QCamera3Stream.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundataion. All rights reserved.
+/* Copyright (c) 2012-2014, The Linux Foundataion. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -31,7 +31,6 @@
 #define __QCAMERA3_STREAM_H__
 
 #include <hardware/camera3.h>
-#include "utils/Mutex.h"
 #include "QCameraCmdThread.h"
 #include "QCamera3Mem.h"
 
@@ -67,7 +66,6 @@
                          hal3_stream_cb_routine stream_cb,
                          void *userdata);
     virtual int32_t bufDone(int index);
-    virtual int32_t bufRelease(int32_t index);
     virtual int32_t processDataNotify(mm_camera_super_buf_t *bufs);
     virtual int32_t start();
     virtual int32_t stop();
@@ -79,6 +77,7 @@
     int32_t getFrameOffset(cam_frame_len_offset_t &offset);
     int32_t getFrameDimension(cam_dimension_t &dim);
     int32_t getFormat(cam_format_t &fmt);
+    mm_camera_buf_def_t* getInternalFormatBuffer(int index);
     QCamera3Memory *getStreamBufs() {return mStreamBufs;};
     uint32_t getMyServerID();
 
@@ -110,7 +109,6 @@
     cam_frame_len_offset_t mFrameLenOffset;
     cam_padding_info_t mPaddingInfo;
     QCamera3Channel *mChannel;
-    Mutex mLock;    //Lock controlling access to 'mBufDefs'
 
     static int32_t get_bufs(
                      cam_frame_len_offset_t *offset,
diff --git a/camera/QCamera2/QCamera2Factory.cpp b/camera/QCamera2/QCamera2Factory.cpp
index e0584b8..cc0be30 100644
--- a/camera/QCamera2/QCamera2Factory.cpp
+++ b/camera/QCamera2/QCamera2Factory.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundataion. All rights reserved.
+/* Copyright (c) 2012-2014, The Linux Foundataion. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
@@ -38,7 +38,6 @@
 
 #include "HAL/QCamera2HWI.h"
 #include "HAL3/QCamera3HWI.h"
-#include "util/QCameraFlash.h"
 #include "QCamera2Factory.h"
 
 using namespace android;
@@ -187,23 +186,6 @@
 }
 
 /*===========================================================================
- * FUNCTION   : set_torch_mode
- *
- * DESCRIPTION: Attempt to turn on or off the torch mode of the flash unit.
- *
- * PARAMETERS :
- *   @camera_id : camera ID
- *   @on        : Indicates whether to turn the flash on or off
- *
- * RETURN     : 0  -- success
- *              none-zero failure code
- *==========================================================================*/
-int QCamera2Factory::set_torch_mode(const char* camera_id, bool on)
-{
-    return gQCamera2Factory->setTorchMode(camera_id, on);
-}
-
-/*===========================================================================
  * FUNCTION   : getNumberOfCameras
  *
  * DESCRIPTION: query number of cameras detected
@@ -278,12 +260,6 @@
 {
     int rc = NO_ERROR;
     mCallbacks = callbacks;
-
-    rc = QCameraFlash::getInstance().registerCallbacks(callbacks);
-    if (rc != 0) {
-        ALOGE("%s : Failed to register callbacks with flash module!", __func__);
-    }
-
     return rc;
 }
 
@@ -377,69 +353,5 @@
     open: QCamera2Factory::camera_device_open,
 };
 
-/*===========================================================================
- * FUNCTION   : setTorchMode
- *
- * DESCRIPTION: Attempt to turn on or off the torch mode of the flash unit.
- *
- * PARAMETERS :
- *   @camera_id : camera ID
- *   @on        : Indicates whether to turn the flash on or off
- *
- * RETURN     : 0  -- success
- *              none-zero failure code
- *==========================================================================*/
-int QCamera2Factory::setTorchMode(const char* camera_id, bool on)
-{
-    int retVal(0);
-    long cameraIdLong(-1);
-    int cameraIdInt(-1);
-    char* endPointer = NULL;
-    errno = 0;
-    QCameraFlash& flash = QCameraFlash::getInstance();
-
-    cameraIdLong = strtol(camera_id, &endPointer, 10);
-
-    if ((errno == ERANGE) ||
-            (cameraIdLong < 0) ||
-            (cameraIdLong >= static_cast<long>(get_number_of_cameras())) ||
-            (endPointer == camera_id) ||
-            (*endPointer != '\0')) {
-        retVal = -EINVAL;
-    } else if (on) {
-        cameraIdInt = static_cast<int>(cameraIdLong);
-        retVal = flash.initFlash(cameraIdInt);
-
-        if (retVal == 0) {
-            retVal = flash.setFlashMode(cameraIdInt, on);
-            if ((retVal == 0) && (mCallbacks != NULL)) {
-                mCallbacks->torch_mode_status_change(mCallbacks,
-                        camera_id,
-                        TORCH_MODE_STATUS_AVAILABLE_ON);
-            } else if (retVal == -EALREADY) {
-                // Flash is already on, so treat this as a success.
-                retVal = 0;
-            }
-        }
-    } else {
-        cameraIdInt = static_cast<int>(cameraIdLong);
-        retVal = flash.setFlashMode(cameraIdInt, on);
-
-        if (retVal == 0) {
-            retVal = flash.deinitFlash(cameraIdInt);
-            if ((retVal == 0) && (mCallbacks != NULL)) {
-                mCallbacks->torch_mode_status_change(mCallbacks,
-                        camera_id,
-                        TORCH_MODE_STATUS_AVAILABLE_OFF);
-            }
-        } else if (retVal == -EALREADY) {
-            // Flash is already off, so treat this as a success.
-            retVal = 0;
-        }
-    }
-
-    return retVal;
-}
-
 }; // namespace qcamera
 
diff --git a/camera/QCamera2/QCamera2Factory.h b/camera/QCamera2/QCamera2Factory.h
index d7e3e3d..14dd4ba 100644
--- a/camera/QCamera2/QCamera2Factory.h
+++ b/camera/QCamera2/QCamera2Factory.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundataion. All rights reserved.
+/* Copyright (c) 2012-2014, The Linux Foundataion. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
@@ -52,7 +52,6 @@
     static int set_callbacks(const camera_module_callbacks_t *callbacks);
     static int open_legacy(const struct hw_module_t* module,
             const char* id, uint32_t halVersion, struct hw_device_t** device);
-    static int set_torch_mode(const char* camera_id, bool on);
 
 private:
     int getNumberOfCameras();
@@ -61,7 +60,7 @@
     int cameraDeviceOpen(int camera_id, struct hw_device_t **hw_device);
     static int camera_device_open(const struct hw_module_t *module, const char *id,
                 struct hw_device_t **hw_device);
-    int setTorchMode(const char* camera_id, bool on);
+
 public:
     static struct hw_module_methods_t mModuleMethods;
 
diff --git a/camera/QCamera2/QCamera2Hal.cpp b/camera/QCamera2/QCamera2Hal.cpp
index 115d36d..8696f5f 100644
--- a/camera/QCamera2/QCamera2Hal.cpp
+++ b/camera/QCamera2/QCamera2Hal.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundataion. All rights reserved.
+/* Copyright (c) 2012-2014, The Linux Foundataion. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
@@ -32,7 +32,7 @@
 
 static hw_module_t camera_common = {
     tag: HARDWARE_MODULE_TAG,
-    module_api_version: CAMERA_MODULE_API_VERSION_2_4,
+    module_api_version: CAMERA_MODULE_API_VERSION_2_3,
     hal_api_version: HARDWARE_HAL_API_VERSION,
     id: CAMERA_HARDWARE_MODULE_ID,
     name: "QCamera Module",
@@ -49,7 +49,5 @@
     set_callbacks: qcamera::QCamera2Factory::set_callbacks,
     get_vendor_tag_ops: qcamera::QCamera3VendorTags::get_vendor_tag_ops,
     open_legacy: qcamera::QCamera2Factory::open_legacy,
-    set_torch_mode: qcamera::QCamera2Factory::set_torch_mode,
-    init: NULL,
     reserved: {0}
 };
diff --git a/camera/QCamera2/stack/common/cam_intf.h b/camera/QCamera2/stack/common/cam_intf.h
index 15df3d7..c61d277 100644
--- a/camera/QCamera2/stack/common/cam_intf.h
+++ b/camera/QCamera2/stack/common/cam_intf.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -340,11 +340,6 @@
 
     /* Max size supported by ISP viewfinder path */
     cam_dimension_t max_viewfinder_size;
-
-    uint8_t flash_dev_name[QCAMERA_MAX_FILEPATH_LENGTH];
-
-    /* maximum pixel bandwidth shared between cameras */
-    uint64_t max_pixel_bandwidth;
 } cam_capability_t;
 
 typedef enum {
@@ -639,7 +634,6 @@
     INCLUDE(CAM_INTF_PARM_CAC,                          cam_aberration_mode_t,       1);
     INCLUDE(CAM_INTF_META_NEUTRAL_COL_POINT,            cam_neutral_col_point_t,     1);
     INCLUDE(CAM_INTF_PARM_ROTATION,                     cam_rotation_info_t,         1);
-    INCLUDE(CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR,    float,                       1);
 } parm_data_t;
 
 typedef parm_data_t metadata_data_t;
diff --git a/camera/QCamera2/stack/common/cam_queue.h b/camera/QCamera2/stack/common/cam_queue.h
index b6a3c3f..a23c622 100644
--- a/camera/QCamera2/stack/common/cam_queue.h
+++ b/camera/QCamera2/stack/common/cam_queue.h
@@ -29,8 +29,6 @@
 
 #include "cam_list.h"
 
-#include <stdlib.h>
-
 typedef struct {
     struct cam_list list;
     void *data;
diff --git a/camera/QCamera2/stack/common/cam_types.h b/camera/QCamera2/stack/common/cam_types.h
index bf4875e..617ad2c 100644
--- a/camera/QCamera2/stack/common/cam_types.h
+++ b/camera/QCamera2/stack/common/cam_types.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -31,7 +31,6 @@
 #define __QCAMERA_TYPES_H__
 
 #include <stdint.h>
-#include <string.h>
 #include <pthread.h>
 #include <inttypes.h>
 #include <media/msmb_camera.h>
@@ -57,6 +56,7 @@
  *  dump the image to the file
  **/
 #define CAM_DUMP_TO_FILE(path, name, index, extn, p_addr, len) ({ \
+  int rc = 0; \
   char filename[CAM_FN_CNT]; \
   if (index >= 0) \
     snprintf(filename, CAM_FN_CNT-1, "%s/%s%d.%s", path, name, index, extn); \
@@ -64,7 +64,7 @@
     snprintf(filename, CAM_FN_CNT-1, "%s/%s.%s", path, name, extn); \
   FILE *fp = fopen(filename, "w+"); \
   if (fp) { \
-    fwrite(p_addr, 1, len, fp); \
+    rc = fwrite(p_addr, 1, len, fp); \
     ALOGE("%s:%d] written size %d", __func__, __LINE__, len); \
     fclose(fp); \
   } else { \
@@ -111,16 +111,13 @@
 
 #define MAX_AF_BRACKETING_VALUES 5
 #define MAX_TEST_PATTERN_CNT     8
-#define MAX_AVAILABLE_CAPABILITIES 8
+#define MAX_AVAILABLE_CAPABILITIES 6
 
 #define GPS_PROCESSING_METHOD_SIZE 33
 #define GPS_PROCESSING_METHOD_SIZE_IN_WORD (33+3)/4
 
 #define MAX_INFLIGHT_REQUESTS  6
 #define MIN_INFLIGHT_REQUESTS  3
-#define MAX_INFLIGHT_REPROCESS_REQUESTS 1
-
-#define QCAMERA_MAX_FILEPATH_LENGTH 64
 
 typedef enum {
     CAM_HAL_V1 = 1,
@@ -595,8 +592,7 @@
 typedef enum {
     CAM_NOISE_REDUCTION_MODE_OFF,
     CAM_NOISE_REDUCTION_MODE_FAST,
-    CAM_NOISE_REDUCTION_MODE_HIGH_QUALITY,
-    CAM_NOISE_REDUCTION_MODE_MINIMAL
+    CAM_NOISE_REDUCTION_MODE_HIGH_QUALITY
 } cam_noise_reduction_mode_t;
 
 typedef enum {
@@ -1345,7 +1341,7 @@
 
     /* CAC */
     CAM_INTF_PARM_CAC,
-    CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR,
+
     CAM_INTF_PARM_MAX
 } cam_intf_parm_type_t;
 
diff --git a/camera/QCamera2/stack/mm-camera-interface/Android.mk b/camera/QCamera2/stack/mm-camera-interface/Android.mk
index 37f55d1..194c5bf 100644
--- a/camera/QCamera2/stack/mm-camera-interface/Android.mk
+++ b/camera/QCamera2/stack/mm-camera-interface/Android.mk
@@ -4,12 +4,6 @@
 include $(LOCAL_PATH)/../../../common.mk
 include $(CLEAR_VARS)
 
-# cam_intf.c has type conversion discarding qualifiers.
-# mm_camera_interface.c has incomplete field initializer.
-LOCAL_CLANG_CFLAGS += \
-        -Wno-error=incompatible-pointer-types-discards-qualifiers \
-        -Wno-error=missing-field-initializers \
-
 MM_CAM_FILES := \
         src/mm_camera_interface.c \
         src/mm_camera.c \
@@ -52,6 +46,7 @@
 LOCAL_SRC_FILES := $(MM_CAM_FILES)
 
 LOCAL_MODULE           := libmmcamera_interface
+LOCAL_PRELINK_MODULE   := false
 LOCAL_SHARED_LIBRARIES := libdl libcutils liblog
 LOCAL_MODULE_TAGS := optional
 
diff --git a/camera/QCamera2/stack/mm-camera-interface/src/cam_intf.c b/camera/QCamera2/stack/mm-camera-interface/src/cam_intf.c
index 11cfe4d..1d0e21b 100644
--- a/camera/QCamera2/stack/mm-camera-interface/src/cam_intf.c
+++ b/camera/QCamera2/stack/mm-camera-interface/src/cam_intf.c
@@ -131,8 +131,6 @@
             return POINTER_OF_META(CAM_INTF_META_NOISE_REDUCTION_MODE, metadata);
         case CAM_INTF_META_NOISE_REDUCTION_STRENGTH:
             return POINTER_OF_META(CAM_INTF_META_NOISE_REDUCTION_STRENGTH, metadata);
-        case CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR:
-            return POINTER_OF_META(CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR, metadata);
         case CAM_INTF_META_SCALER_CROP_REGION:
             return POINTER_OF_META(CAM_INTF_META_SCALER_CROP_REGION, metadata);
         case CAM_INTF_META_SCENE_FLICKER:
@@ -448,8 +446,6 @@
             return SIZE_OF_PARAM(CAM_INTF_META_NOISE_REDUCTION_MODE, metadata);
         case CAM_INTF_META_NOISE_REDUCTION_STRENGTH:
             return SIZE_OF_PARAM(CAM_INTF_META_NOISE_REDUCTION_STRENGTH, metadata);
-        case CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR:
-            return SIZE_OF_PARAM(CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR, metadata);
         case CAM_INTF_META_SCALER_CROP_REGION:
             return SIZE_OF_PARAM(CAM_INTF_META_SCALER_CROP_REGION, metadata);
         case CAM_INTF_META_SCENE_FLICKER:
diff --git a/camera/QCamera2/stack/mm-camera-test/Android.mk b/camera/QCamera2/stack/mm-camera-test/Android.mk
index b4c36e3..9d33c6e 100644
--- a/camera/QCamera2/stack/mm-camera-test/Android.mk
+++ b/camera/QCamera2/stack/mm-camera-test/Android.mk
@@ -17,10 +17,6 @@
 
 LOCAL_CFLAGS += -D_ANDROID_
 
-# mm_qcamera_main_menu.c has implicit conversion from enum to enum.
-LOCAL_CLANG_CFLAGS += \
-        -Wno-error=enum-conversion \
-
 LOCAL_SRC_FILES:= \
         src/mm_qcamera_main_menu.c \
         src/mm_qcamera_app.c \
@@ -129,10 +125,6 @@
 
 LOCAL_CFLAGS += -D_ANDROID_
 
-# mm_qcamera_main_menu.c has implicit conversion from enum to enum.
-LOCAL_CLANG_CFLAGS += \
-        -Wno-error=enum-conversion \
-
 LOCAL_SRC_FILES:= \
         src/mm_qcamera_main_menu.c \
         src/mm_qcamera_app.c \
diff --git a/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_main_menu.c b/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_main_menu.c
index a276698..fd68f73 100644
--- a/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_main_menu.c
+++ b/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_main_menu.c
@@ -1664,6 +1664,7 @@
     menu_id_change_t current_menu_id = MENU_ID_MAIN, next_menu_id;
     camera_action_t action_id;
     int action_param;
+    uint8_t previewing = 0;
     int isZSL = 0;
     uint8_t wnr_enabled = 0;
     mm_camera_lib_handle lib_handle;
@@ -1748,6 +1749,7 @@
                     CDBG_ERROR("%s:mm_camera_lib_start_stream() err=%d\n", __func__, rc);
                     goto ERROR;
                 }
+                previewing = 1;
                 break;
 
             case ACTION_STOP_PREVIEW:
@@ -1757,6 +1759,7 @@
                     CDBG_ERROR("%s:mm_camera_lib_stop_stream() err=%d\n", __func__, rc);
                     goto ERROR;
                 }
+                previewing = 0;
                 break;
 
             case ACTION_SET_WHITE_BALANCE:
diff --git a/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_snapshot.c b/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_snapshot.c
index fbd50fa..0f5e4dd 100644
--- a/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_snapshot.c
+++ b/camera/QCamera2/stack/mm-camera-test/src/mm_qcamera_snapshot.c
@@ -252,6 +252,7 @@
                                           void *user_data)
 {
 
+    int rc;
     int i = 0;
     mm_camera_test_obj_t *pme = (mm_camera_test_obj_t *)user_data;
     mm_camera_channel_t *channel = NULL;
@@ -269,6 +270,7 @@
     }
     if (NULL == channel) {
         CDBG_ERROR("%s: Wrong channel id (%d)", __func__, bufs->ch_id);
+        rc = -1;
         goto EXIT;
     }
 
@@ -281,6 +283,7 @@
     }
     if (NULL == m_stream) {
         CDBG_ERROR("%s: cannot find snapshot stream", __func__);
+        rc = -1;
         goto EXIT;
     }
 
@@ -293,6 +296,7 @@
     }
     if (NULL == m_frame) {
         CDBG_ERROR("%s: main frame is NULL", __func__);
+        rc = -1;
         goto EXIT;
     }
 
diff --git a/camera/QCamera2/stack/mm-jpeg-interface/Android.mk b/camera/QCamera2/stack/mm-jpeg-interface/Android.mk
index 127df87..6fc29fa 100644
--- a/camera/QCamera2/stack/mm-jpeg-interface/Android.mk
+++ b/camera/QCamera2/stack/mm-jpeg-interface/Android.mk
@@ -42,6 +42,7 @@
     src/mm_jpegdec.c
 
 LOCAL_MODULE           := libmmjpeg_interface
+LOCAL_PRELINK_MODULE   := false
 LOCAL_SHARED_LIBRARIES := libdl libcutils liblog libqomx_core
 LOCAL_MODULE_TAGS := optional
 
diff --git a/camera/QCamera2/stack/mm-jpeg-interface/inc/mm_jpeg_ionbuf.h b/camera/QCamera2/stack/mm-jpeg-interface/inc/mm_jpeg_ionbuf.h
index 167bfa6..df05cb4 100644
--- a/camera/QCamera2/stack/mm-jpeg-interface/inc/mm_jpeg_ionbuf.h
+++ b/camera/QCamera2/stack/mm-jpeg-interface/inc/mm_jpeg_ionbuf.h
@@ -32,7 +32,6 @@
 
 
 #include <stdio.h>
-#include <string.h>
 #include <linux/msm_ion.h>
 #include <sys/mman.h>
 #include <unistd.h>
diff --git a/camera/QCamera2/stack/mm-jpeg-interface/test/Android.mk b/camera/QCamera2/stack/mm-jpeg-interface/test/Android.mk
index decb74c..5e4c8e0 100644
--- a/camera/QCamera2/stack/mm-jpeg-interface/test/Android.mk
+++ b/camera/QCamera2/stack/mm-jpeg-interface/test/Android.mk
@@ -32,6 +32,7 @@
 
 LOCAL_32_BIT_ONLY := true
 LOCAL_MODULE           := mm-jpeg-interface-test
+LOCAL_PRELINK_MODULE   := false
 LOCAL_SHARED_LIBRARIES := libcutils libdl libmmjpeg_interface
 
 include $(BUILD_EXECUTABLE)
@@ -69,6 +70,7 @@
 
 LOCAL_32_BIT_ONLY := true
 LOCAL_MODULE           := mm-jpegdec-interface-test
+LOCAL_PRELINK_MODULE   := false
 LOCAL_SHARED_LIBRARIES := libcutils libdl libmmjpeg_interface
 
 include $(BUILD_EXECUTABLE)
diff --git a/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpeg_test.c b/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpeg_test.c
index 97ac22c..8533978 100644
--- a/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpeg_test.c
+++ b/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpeg_test.c
@@ -42,9 +42,10 @@
  *  dump the image to the file
  **/
 #define DUMP_TO_FILE(filename, p_addr, len) ({ \
+  int rc = 0; \
   FILE *fp = fopen(filename, "w+"); \
   if (fp) { \
-    fwrite(p_addr, 1, len, fp); \
+    rc = fwrite(p_addr, 1, len, fp); \
     fclose(fp); \
   } else { \
     CDBG_ERROR("%s:%d] cannot dump image", __func__, __LINE__); \
@@ -219,6 +220,7 @@
 
 int mm_jpeg_test_read(mm_jpeg_intf_test_t *p_obj, int idx)
 {
+  int rc = 0;
   FILE *fp = NULL;
   int file_size = 0;
   fp = fopen(p_obj->filename[idx], "rb");
diff --git a/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpegdec_test.c b/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpegdec_test.c
index 982b9cd..46ba7ec 100644
--- a/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpegdec_test.c
+++ b/camera/QCamera2/stack/mm-jpeg-interface/test/mm_jpegdec_test.c
@@ -34,7 +34,7 @@
 
 #define MIN(a,b)  (((a) < (b)) ? (a) : (b))
 #define MAX(a,b)  (((a) > (b)) ? (a) : (b))
-#define CLAMP(x, min, max) x = MIN(MAX((x), (min)), (max))
+#define CLAMP(x, min, max) MIN(MAX((x), (min)), (max))
 
 #define TIME_IN_US(r) ((uint64_t)r.tv_sec * 1000000LL + r.tv_usec)
 struct timeval dtime[2];
@@ -48,9 +48,10 @@
  *  dump the image to the file
  **/
 #define DUMP_TO_FILE(filename, p_addr, len) ({ \
+  int rc = 0; \
   FILE *fp = fopen(filename, "w+"); \
   if (fp) { \
-    fwrite(p_addr, 1, len, fp); \
+    rc = fwrite(p_addr, 1, len, fp); \
     fclose(fp); \
   } else { \
     CDBG_ERROR("%s:%d] cannot dump image", __func__, __LINE__); \
@@ -67,6 +68,11 @@
   int format;
 } jpeg_test_input_t;
 
+static jpeg_test_input_t jpeg_input[] = {
+  {"/data/test.jpg", 5248, 3936, "/data/test.yuv",
+      MM_JPEG_COLOR_FORMAT_YCBCRLP_H2V2}
+};
+
 typedef struct {
   char *filename;
   int width;
diff --git a/camera/QCamera2/util/QCameraCmdThread.cpp b/camera/QCamera2/util/QCameraCmdThread.cpp
index 4b24649..c5be4ad 100644
--- a/camera/QCamera2/util/QCameraCmdThread.cpp
+++ b/camera/QCamera2/util/QCameraCmdThread.cpp
@@ -29,7 +29,6 @@
 
 #include <utils/Errors.h>
 #include <utils/Log.h>
-#include <malloc.h>
 #include <sys/prctl.h>
 #include "QCameraCmdThread.h"
 
diff --git a/camera/QCamera2/util/QCameraFlash.cpp b/camera/QCamera2/util/QCameraFlash.cpp
deleted file mode 100644
index 7b0025c..0000000
--- a/camera/QCamera2/util/QCameraFlash.cpp
+++ /dev/null
@@ -1,380 +0,0 @@
-/* Copyright (c) 2015, The Linux Foundataion. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-*     * Redistributions of source code must retain the above copyright
-*       notice, this list of conditions and the following disclaimer.
-*     * Redistributions in binary form must reproduce the above
-*       copyright notice, this list of conditions and the following
-*       disclaimer in the documentation and/or other materials provided
-*       with the distribution.
-*     * Neither the name of The Linux Foundation nor the names of its
-*       contributors may be used to endorse or promote products derived
-*       from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <linux/media.h>
-#include <media/msmb_camera.h>
-#include <media/msm_cam_sensor.h>
-#include <utils/Log.h>
-
-#include "HAL3/QCamera3HWI.h"
-#include "QCameraFlash.h"
-
-#define STRING_LENGTH_OF_64_BIT_NUMBER 21
-
-volatile uint32_t gCamHal3LogLevel = 1;
-
-namespace qcamera {
-
-/*===========================================================================
- * FUNCTION   : getInstance
- *
- * DESCRIPTION: Get and create the QCameraFlash singleton.
- *
- * PARAMETERS : None
- *
- * RETURN     : None
- *==========================================================================*/
-QCameraFlash& QCameraFlash::getInstance()
-{
-    static QCameraFlash flashInstance;
-    return flashInstance;
-}
-
-/*===========================================================================
- * FUNCTION   : QCameraFlash
- *
- * DESCRIPTION: default constructor of QCameraFlash
- *
- * PARAMETERS : None
- *
- * RETURN     : None
- *==========================================================================*/
-QCameraFlash::QCameraFlash() : m_callbacks(NULL)
-{
-    memset(&m_flashOn, 0, sizeof(m_flashOn));
-    memset(&m_cameraOpen, 0, sizeof(m_cameraOpen));
-    for (int pos = 0; pos < MM_CAMERA_MAX_NUM_SENSORS; pos++) {
-        m_flashFds[pos] = -1;
-    }
-}
-
-/*===========================================================================
- * FUNCTION   : ~QCameraFlash
- *
- * DESCRIPTION: deconstructor of QCameraFlash
- *
- * PARAMETERS : None
- *
- * RETURN     : None
- *==========================================================================*/
-QCameraFlash::~QCameraFlash()
-{
-    for (int pos = 0; pos < MM_CAMERA_MAX_NUM_SENSORS; pos++) {
-        if (m_flashFds[pos] >= 0)
-            {
-                setFlashMode(pos, false);
-                close(m_flashFds[pos]);
-                m_flashFds[pos] = -1;
-            }
-    }
-}
-
-/*===========================================================================
- * FUNCTION   : registerCallbacks
- *
- * DESCRIPTION: provide flash module with reference to callbacks to framework
- *
- * PARAMETERS : None
- *
- * RETURN     : None
- *==========================================================================*/
-int32_t QCameraFlash::registerCallbacks(
-        const camera_module_callbacks_t* callbacks)
-{
-    int32_t retVal = 0;
-    m_callbacks = callbacks;
-    return retVal;
-}
-
-/*===========================================================================
- * FUNCTION   : initFlash
- *
- * DESCRIPTION: Reserve and initialize the flash unit associated with a
- *              given camera id. This function is blocking until the
- *              operation completes or fails. Each flash unit can be "inited"
- *              by only one process at a time.
- *
- * PARAMETERS :
- *   @camera_id : Camera id of the flash.
- *
- * RETURN     :
- *   0        : success
- *   -EBUSY   : The flash unit or the resource needed to turn on the
- *              the flash is busy, typically because the flash is
- *              already in use.
- *   -EINVAL  : No flash present at camera_id.
- *==========================================================================*/
-int32_t QCameraFlash::initFlash(const int camera_id)
-{
-    int32_t retVal = 0;
-    bool hasFlash = false;
-    char flashNode[QCAMERA_MAX_FILEPATH_LENGTH];
-    char flashPath[QCAMERA_MAX_FILEPATH_LENGTH] = "/dev/";
-
-    if (camera_id < 0 || camera_id >= MM_CAMERA_MAX_NUM_SENSORS) {
-        ALOGE("%s: Invalid camera id: %d", __func__, camera_id);
-        return -EINVAL;
-    }
-
-    QCamera3HardwareInterface::getFlashInfo(camera_id,
-            hasFlash,
-            flashNode);
-
-    strlcat(flashPath,
-            flashNode,
-            sizeof(flashPath));
-
-    if (!hasFlash) {
-        ALOGE("%s: No flash available for camera id: %d",
-                __func__,
-                camera_id);
-        retVal = -EINVAL;
-    } else if (m_cameraOpen[camera_id]) {
-        ALOGE("%s: Camera in use for camera id: %d",
-                __func__,
-                camera_id);
-        retVal = -EBUSY;
-    } else if (m_flashFds[camera_id] >= 0) {
-        CDBG("%s: Flash is already inited for camera id: %d",
-                __func__,
-                camera_id);
-    } else {
-        m_flashFds[camera_id] = open(flashPath, O_RDWR | O_NONBLOCK);
-
-        if (m_flashFds[camera_id] < 0) {
-            ALOGE("%s: Unable to open node '%s'",
-                    __func__,
-                    flashPath);
-            retVal = -EBUSY;
-        } else {
-            struct msm_camera_led_cfg_t cfg;
-            cfg.cfgtype = MSM_CAMERA_LED_INIT;
-            retVal = ioctl(m_flashFds[camera_id],
-                    VIDIOC_MSM_FLASH_LED_DATA_CFG,
-                    &cfg);
-            if (retVal < 0) {
-                ALOGE("%s: Unable to init flash for camera id: %d",
-                        __func__,
-                        camera_id);
-                close(m_flashFds[camera_id]);
-                m_flashFds[camera_id] = -1;
-            }
-        }
-    }
-
-    return retVal;
-}
-
-/*===========================================================================
- * FUNCTION   : setFlashMode
- *
- * DESCRIPTION: Turn on or off the flash associated with a given handle.
- *              This function is blocking until the operation completes or
- *              fails.
- *
- * PARAMETERS :
- *   @camera_id  : Camera id of the flash
- *   @on         : Whether to turn flash on (true) or off (false)
- *
- * RETURN     :
- *   0        : success
- *   -EINVAL  : No camera present at camera_id, or it is not inited.
- *   -EALREADY: Flash is already in requested state
- *==========================================================================*/
-int32_t QCameraFlash::setFlashMode(const int camera_id, const bool mode)
-{
-    int32_t retVal = 0;
-    struct msm_camera_led_cfg_t cfg;
-
-    if (camera_id < 0 || camera_id >= MM_CAMERA_MAX_NUM_SENSORS) {
-        ALOGE("%s: Invalid camera id: %d", __func__, camera_id);
-        retVal = -EINVAL;
-    } else if (mode == m_flashOn[camera_id]) {
-        CDBG("%s: flash %d is already in requested state: %d",
-                __func__,
-                camera_id,
-                mode);
-        retVal = -EALREADY;
-    } else if (m_flashFds[camera_id] < 0) {
-        ALOGE("%s: called for uninited flash: %d", __func__, camera_id);
-        retVal = -EINVAL;
-    }  else {
-        cfg.cfgtype = mode ? MSM_CAMERA_LED_LOW : MSM_CAMERA_LED_OFF;
-        retVal = ioctl(m_flashFds[camera_id],
-                VIDIOC_MSM_FLASH_LED_DATA_CFG,
-                &cfg);
-        if (retVal == 0) {
-            m_flashOn[camera_id] = mode;
-        }
-    }
-    return retVal;
-}
-
-/*===========================================================================
- * FUNCTION   : deinitFlash
- *
- * DESCRIPTION: Release the flash unit associated with a given camera
- *              position. This function is blocking until the operation
- *              completes or fails.
- *
- * PARAMETERS :
- *   @camera_id : Camera id of the flash.
- *
- * RETURN     :
- *   0        : success
- *   -EINVAL  : No camera present at camera_id or not inited.
- *==========================================================================*/
-int32_t QCameraFlash::deinitFlash(const int camera_id)
-{
-    int32_t retVal = 0;
-
-    if (camera_id < 0 || camera_id >= MM_CAMERA_MAX_NUM_SENSORS) {
-        ALOGE("%s: Invalid camera id: %d", __func__, camera_id);
-        retVal = -EINVAL;
-    } else if (m_flashFds[camera_id] < 0) {
-        ALOGE("%s: called deinitFlash for uninited flash", __func__);
-        retVal = -EINVAL;
-    } else {
-        setFlashMode(camera_id, false);
-
-        struct msm_camera_led_cfg_t cfg;
-        cfg.cfgtype = MSM_CAMERA_LED_RELEASE;
-        retVal = ioctl(m_flashFds[camera_id],
-                VIDIOC_MSM_FLASH_LED_DATA_CFG,
-                &cfg);
-        if (retVal < 0) {
-            ALOGE("%s: Failed to release flash for camera id: %d",
-                    __func__,
-                    camera_id);
-        }
-
-        close(m_flashFds[camera_id]);
-        m_flashFds[camera_id] = -1;
-    }
-
-    return retVal;
-}
-
-/*===========================================================================
- * FUNCTION   : reserveFlashForCamera
- *
- * DESCRIPTION: Give control of the flash to the camera, and notify
- *              framework that the flash has become unavailable.
- *
- * PARAMETERS :
- *   @camera_id : Camera id of the flash.
- *
- * RETURN     :
- *   0        : success
- *   -EINVAL  : No camera present at camera_id or not inited.
- *   -ENOSYS  : No callback available for torch_mode_status_change.
- *==========================================================================*/
-int32_t QCameraFlash::reserveFlashForCamera(const int camera_id)
-{
-    int32_t retVal = 0;
-
-    if (camera_id < 0 || camera_id >= MM_CAMERA_MAX_NUM_SENSORS) {
-        ALOGE("%s: Invalid camera id: %d", __func__, camera_id);
-        retVal = -EINVAL;
-    } else if (m_cameraOpen[camera_id]) {
-        CDBG("%s: Flash already reserved for camera id: %d",
-                __func__,
-                camera_id);
-    } else {
-        if (m_flashOn[camera_id]) {
-            setFlashMode(camera_id, false);
-            deinitFlash(camera_id);
-        }
-        m_cameraOpen[camera_id] = true;
-
-        if (m_callbacks == NULL ||
-                m_callbacks->torch_mode_status_change == NULL) {
-            ALOGE("%s: Callback is not defined!", __func__);
-            retVal = -ENOSYS;
-        } else {
-            char cameraIdStr[STRING_LENGTH_OF_64_BIT_NUMBER];
-            snprintf(cameraIdStr, STRING_LENGTH_OF_64_BIT_NUMBER,
-                    "%d", camera_id);
-            m_callbacks->torch_mode_status_change(m_callbacks,
-                    cameraIdStr,
-                    TORCH_MODE_STATUS_NOT_AVAILABLE);
-        }
-    }
-
-    return retVal;
-}
-
-/*===========================================================================
- * FUNCTION   : releaseFlashFromCamera
- *
- * DESCRIPTION: Release control of the flash from the camera, and notify
- *              framework that the flash has become available.
- *
- * PARAMETERS :
- *   @camera_id : Camera id of the flash.
- *
- * RETURN     :
- *   0        : success
- *   -EINVAL  : No camera present at camera_id or not inited.
- *   -ENOSYS  : No callback available for torch_mode_status_change.
- *==========================================================================*/
-int32_t QCameraFlash::releaseFlashFromCamera(const int camera_id)
-{
-    int32_t retVal = 0;
-
-    if (camera_id < 0 || camera_id >= MM_CAMERA_MAX_NUM_SENSORS) {
-        ALOGE("%s: Invalid camera id: %d", __func__, camera_id);
-        retVal = -EINVAL;
-    } else if (!m_cameraOpen[camera_id]) {
-        CDBG("%s: Flash not reserved for camera id: %d",
-                __func__,
-                camera_id);
-    } else {
-        m_cameraOpen[camera_id] = false;
-
-        if (m_callbacks == NULL ||
-                m_callbacks->torch_mode_status_change == NULL) {
-            ALOGE("%s: Callback is not defined!", __func__);
-            retVal = -ENOSYS;
-        } else {
-            char cameraIdStr[STRING_LENGTH_OF_64_BIT_NUMBER];
-            snprintf(cameraIdStr, STRING_LENGTH_OF_64_BIT_NUMBER,
-                    "%d", camera_id);
-            m_callbacks->torch_mode_status_change(m_callbacks,
-                    cameraIdStr,
-                    TORCH_MODE_STATUS_AVAILABLE_OFF);
-        }
-    }
-
-    return retVal;
-}
-
-}; // namespace qcamera
diff --git a/camera/QCamera2/util/QCameraFlash.h b/camera/QCamera2/util/QCameraFlash.h
deleted file mode 100644
index f86b6ee..0000000
--- a/camera/QCamera2/util/QCameraFlash.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (c) 2015, The Linux Foundataion. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- *       copyright notice, this list of conditions and the following
- *       disclaimer in the documentation and/or other materials provided
- *       with the distribution.
- *     * Neither the name of The Linux Foundation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef __QCAMERA_FLASH_H__
-#define __QCAMERA_FLASH_H__
-
-#include <hardware/camera_common.h>
-
-extern "C" {
-#include <mm_camera_interface.h>
-}
-
-namespace qcamera {
-
-class QCameraFlash {
-public:
-    static QCameraFlash& getInstance();
-
-    int32_t registerCallbacks(const camera_module_callbacks_t* callbacks);
-    int32_t initFlash(const int camera_id);
-    int32_t setFlashMode(const int camera_id, const bool on);
-    int32_t deinitFlash(const int camera_id);
-    int32_t reserveFlashForCamera(const int camera_id);
-    int32_t releaseFlashFromCamera(const int camera_id);
-
-private:
-    QCameraFlash();
-    virtual ~QCameraFlash();
-    QCameraFlash(const QCameraFlash&);
-    QCameraFlash& operator=(const QCameraFlash&);
-
-    const camera_module_callbacks_t *m_callbacks;
-    int32_t m_flashFds[MM_CAMERA_MAX_NUM_SENSORS];
-    bool m_flashOn[MM_CAMERA_MAX_NUM_SENSORS];
-    bool m_cameraOpen[MM_CAMERA_MAX_NUM_SENSORS];
-};
-
-}; // namespace qcamera
-
-#endif /* __QCAMERA_FLASH_H__ */
diff --git a/camera/QCamera2/util/QCameraQueue.cpp b/camera/QCamera2/util/QCameraQueue.cpp
index 31996fb..cd9105e 100644
--- a/camera/QCamera2/util/QCameraQueue.cpp
+++ b/camera/QCamera2/util/QCameraQueue.cpp
@@ -29,8 +29,6 @@
 
 #include <utils/Errors.h>
 #include <utils/Log.h>
-#include <malloc.h>
-#include <string.h>
 #include "QCameraQueue.h"
 
 namespace qcamera {
diff --git a/camera/mm-image-codec/qomx_core/Android.mk b/camera/mm-image-codec/qomx_core/Android.mk
index 02f3ff8..4d4e39c 100644
--- a/camera/mm-image-codec/qomx_core/Android.mk
+++ b/camera/mm-image-codec/qomx_core/Android.mk
@@ -21,6 +21,7 @@
 LOCAL_SRC_FILES := qomx_core.c
 
 LOCAL_MODULE           := libqomx_core
+LOCAL_PRELINK_MODULE   := false
 LOCAL_SHARED_LIBRARIES := libcutils libdl
 
 LOCAL_32_BIT_ONLY := true
diff --git a/camera/mm-image-codec/qomx_core/qomx_core.c b/camera/mm-image-codec/qomx_core/qomx_core.c
index 41d11e0..5336f55 100644
--- a/camera/mm-image-codec/qomx_core/qomx_core.c
+++ b/camera/mm-image-codec/qomx_core/qomx_core.c
@@ -177,6 +177,7 @@
 {
   OMX_ERRORTYPE rc = OMX_ErrorNone;
   int comp_idx = 0, inst_idx = 0;
+  char libName[BUFF_SIZE] = {0};
   void *p_obj = NULL;
   OMX_COMPONENTTYPE *p_comp = NULL;
   omx_core_component_t *p_core_comp = NULL;
diff --git a/camera/mm-image-codec/qomx_core/qomx_core.h b/camera/mm-image-codec/qomx_core/qomx_core.h
index c5e792b..f59f7cf 100644
--- a/camera/mm-image-codec/qomx_core/qomx_core.h
+++ b/camera/mm-image-codec/qomx_core/qomx_core.h
@@ -29,7 +29,6 @@
 #define QOMX_CORE_H
 
 #include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 #include <malloc.h>
 #include <pthread.h>
diff --git a/dataservices/rmnetctl/src/Android.mk b/dataservices/rmnetctl/src/Android.mk
index 2f0c973..03850a5 100644
--- a/dataservices/rmnetctl/src/Android.mk
+++ b/dataservices/rmnetctl/src/Android.mk
@@ -13,5 +13,6 @@
 
 LOCAL_MODULE := librmnetctl
 LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
 
 include $(BUILD_SHARED_LIBRARY)
diff --git a/device.mk b/device.mk
index fcb0212..0dc1d2d 100644
--- a/device.mk
+++ b/device.mk
@@ -83,8 +83,8 @@
     frameworks/native/data/etc/android.hardware.audio.low_latency.xml:system/etc/permissions/android.hardware.audio.low_latency.xml \
     frameworks/native/data/etc/android.hardware.bluetooth_le.xml:system/etc/permissions/android.hardware.bluetooth_le.xml \
     frameworks/native/data/etc/android.hardware.telephony.cdma.xml:system/etc/permissions/android.hardware.telephony.cdma.xml \
-    frameworks/native/data/etc/android.hardware.opengles.aep.xml:system/etc/permissions/android.hardware.opengles.aep.xml \
-    frameworks/native/data/etc/android.software.midi.xml:system/etc/permissions/android.software.midi.xml
+    frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml \
+    frameworks/native/data/etc/android.hardware.opengles.aep.xml:system/etc/permissions/android.hardware.opengles.aep.xml
 
 # For GPS
 PRODUCT_COPY_FILES += \
@@ -92,7 +92,7 @@
 
 # Touch firmware updater
 PRODUCT_COPY_FILES += \
-    $(LOCAL_PATH)/init.mmi.touch.sh:system/bin/init.mmi.touch.sh
+    $(LOCAL_PATH)/init.mmi.touch.sh:root/init.mmi.touch.sh
 
 # Add WiFi Firmware
 $(call inherit-product-if-exists, hardware/broadcom/wlan/bcmdhd/firmware/bcm4356/device-bcm.mk)
@@ -101,14 +101,12 @@
 PRODUCT_COPY_FILES += \
     device/moto/shamu/bcmdhd.cal:system/etc/wifi/bcmdhd.cal
 
-# BT FW
-PRODUCT_COPY_FILES += \
-    device/moto/shamu/bluetooth/BCM4356A2_001.003.015.0054.0155_ORC.hcd:$(TARGET_COPY_OUT_VENDOR)/firmware/bcm4354A2.hcd
-
 # For SPN display
 PRODUCT_COPY_FILES += \
     device/moto/shamu/spn-conf.xml:system/etc/spn-conf.xml
 
+PRODUCT_TAGS += dalvik.gc.type-precise
+
 # This device is 560dpi.  However the platform doesn't
 # currently contain all of the bitmaps at 560dpi density so
 # we do this little trick to fall back to the xxhdpi version
@@ -205,6 +203,9 @@
 PRODUCT_PACKAGES += \
     keystore.msm8084
 
+PRODUCT_PACKAGES += \
+    qrngd
+
 PRODUCT_PROPERTY_OVERRIDES += \
     ro.opengles.version=196609
 
@@ -336,10 +337,6 @@
 PRODUCT_SYSTEM_VERITY_PARTITION := /dev/block/platform/msm_sdcc.1/by-name/system
 $(call inherit-product, build/target/product/verity.mk)
 
-PRODUCT_PACKAGES += \
-    slideshow \
-    verity_warning_images
-
 # setup scheduler tunable
 PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
     ro.qualcomm.perf.cores_online=2
@@ -363,11 +360,3 @@
 # Copy the qcril.db file from qcril to system. Useful to get the radio tech family for the camped operator
 PRODUCT_COPY_FILES += \
     device/moto/shamu/qcril.db:system/etc/ril/qcril.db
-
-# Reduce client buffer size for fast audio output tracks
-PRODUCT_PROPERTY_OVERRIDES += \
-    af.fast_track_multiplier=1
-
-# Low latency audio buffer size in frames
-PRODUCT_PROPERTY_OVERRIDES += \
-    audio_hal.period_size=192
diff --git a/fstab.shamu b/fstab.shamu
index f07daf8..4a9989a 100644
--- a/fstab.shamu
+++ b/fstab.shamu
@@ -3,7 +3,7 @@
 # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
 #
 #<src>                                                <mnt_point>  <type>  <mnt_flags and options>                     <fs_mgr_flags>
-/dev/block/platform/msm_sdcc.1/by-name/system         /system      ext4    ro,barrier=1                                wait,verify=/dev/block/platform/msm_sdcc.1/by-name/metadata
+/dev/block/platform/msm_sdcc.1/by-name/system         /system      ext4    ro,barrier=1                                wait
 /dev/block/platform/msm_sdcc.1/by-name/userdata    /data        ext4    rw,nosuid,nodev,noatime,nodiratime,noauto_da_alloc,nobarrier    wait,check,formattable,forceencrypt=/dev/block/platform/msm_sdcc.1/by-name/metadata
 /dev/block/platform/msm_sdcc.1/by-name/cache       /cache       ext4    rw,noatime,nosuid,nodev,barrier=1,data=ordered   wait,check,formattable
 /dev/block/platform/msm_sdcc.1/by-name/modem       /firmware    ext4    ro,barrier=1,context=u:object_r:firmware_file:s0    wait
diff --git a/init.shamu.rc b/init.shamu.rc
index 9ce9b7b..f2a060b 100644
--- a/init.shamu.rc
+++ b/init.shamu.rc
@@ -25,20 +25,28 @@
     chown system system /sys/kernel/debug/kgsl/proc
 
 on init
-    # Load persistent dm-verity state
-    verity_load_state
+    # See storage config details at http://source.android.com/tech/storage/
+    mkdir /mnt/shell/emulated 0700 shell shell
+    mkdir /storage/emulated 0555 root root
 
     mkdir /oem 0550 root root
 
     # Set permissions for persist partition
     mkdir /persist 0771 system system
 
+    export EXTERNAL_STORAGE /storage/emulated/legacy
+    export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
+    export EMULATED_STORAGE_TARGET /storage/emulated
+
     # Support legacy paths
-    symlink /sdcard /mnt/sdcard
-    symlink /sdcard /storage/sdcard0
+    symlink /storage/emulated/legacy /sdcard
+    symlink /storage/emulated/legacy /mnt/sdcard
+    symlink /storage/emulated/legacy /storage/sdcard0
+    symlink /mnt/shell/emulated/0 /storage/emulated/legacy
 
 on fs
     mount_all fstab.shamu
+    setprop ro.crypto.fuse_sdcard true
 
     # Keeping following partitions outside fstab file. As user may not have
     # these partition flashed on the device. Failure to mount any partition in fstab file
@@ -64,13 +72,8 @@
     setprop persist.data.df.agg.dl_pkt 10
     setprop persist.data.df.agg.dl_size 4096
 
-    # Adjust parameters for dm-verity device
-    write /sys/block/dm-0/queue/read_ahead_kb 2048
-
-    # Update dm-verity state and set partition.*.verified properties
-    verity_update_state
-
 on post-fs-data
+    mkdir /data/tombstones 0771 system system
     mkdir /tombstones/modem 0771 system system
     mkdir /tombstones/lpass 0771 system system
     mkdir /tombstones/wcnss 0771 system system
@@ -251,6 +254,10 @@
 
 # msm specific files that need to be created on /data
 on post-fs-data
+    # we will remap this as /mnt/sdcard with the sdcard fuse tool
+    mkdir /data/media 0770 media_rw media_rw
+    chown media_rw media_rw /data/media
+
     mkdir /data/misc/bluetooth 0770 bluetooth bluetooth
 
     # Create the directories used by the Wireless subsystem
@@ -374,32 +381,6 @@
     class main
     group radio
 
-service imsqmidaemon /system/bin/imsqmidaemon
-    class main
-    user system
-    socket ims_qmid stream 0660 system radio
-    group radio log
-
-service imsdatadaemon /system/bin/imsdatadaemon
-    class main
-    user root
-    socket ims_datad stream 0660 system radio
-    group system wifi radio inet log
-    disabled
-
-on property:sys.ims.QMI_DAEMON_STATUS=1
-    start imsdatadaemon
-
-service ims_rtp_daemon /system/bin/ims_rtp_daemon
-    class main
-    user root
-    socket ims_rtpd stream 0660 system radio
-    group system radio inet log
-    disabled
-
-on property:sys.ims.DATA_DAEMON_STATUS=1
-   start ims_rtp_daemon
-
 service sensors /system/bin/sensors.qcom
     class core
     user root
@@ -503,7 +484,7 @@
     oneshot
 
 service adspd /system/bin/adspd /dev/ttyHS3
-   class main
+   class late_start
    socket adspdsock stream 0660 media media
    user media
    group media input
@@ -518,6 +499,10 @@
     # Adjust socket buffer to enlarge TCP receive window for high bandwidth (e.g. DO-RevB)
     write /proc/sys/net/ipv4/tcp_adv_win_scale  2
 
+# virtual sdcard daemon running as media_rw (1023)
+service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
+    class late_start
+
 on charger
     write /sys/class/leds/lcd-backlight/brightness 100
     mount ext4 /dev/block/platform/msm_sdcc.1/by-name/system /system ro barrier=1
@@ -577,9 +562,6 @@
 on property:vold.decrypt=trigger_reset_main
     stop gnss-svcd
 
-on verity-logging
-    exec u:r:slideshow:s0 -- /sbin/slideshow warning/verity_red_1 warning/verity_red_2
-
 # When QCA1530 is known not to present
 on property:persist.qca1530=no
    stop gnss-svcd
@@ -589,7 +571,7 @@
 on property:init.svc.surfaceflinger=stopped
     stop ppd
 
-service mmi-touch-sh /system/bin/init.mmi.touch.sh atmel
+service mmi-touch-sh /system/bin/sh /init.mmi.touch.sh atmel
     class main
     user root
     oneshot
@@ -623,8 +605,3 @@
     class late_start
     user system
     group system radio
-
-# STOPSHIP: Required for WiFi Calling
-#service cnd /system/bin/cnd
-#    class late_start
-#    socket cnd stream 660 root inet
diff --git a/init.shamu.usb.rc b/init.shamu.usb.rc
index dfd0ddb..7d95d73 100644
--- a/init.shamu.usb.rc
+++ b/init.shamu.usb.rc
@@ -230,26 +230,6 @@
     start adbd
     setprop sys.usb.state ${sys.usb.config}
 
-# USB midi configuration
-on property:sys.usb.config=midi
-    write /sys/class/android_usb/android0/enable 0
-    write /sys/class/android_usb/android0/idVendor 18D1
-    write /sys/class/android_usb/android0/idProduct 4EE8
-    write /sys/class/android_usb/android0/functions ${sys.usb.config}
-    write /sys/class/android_usb/android0/enable 1
-    start adbd
-    setprop sys.usb.state ${sys.usb.config}
-
-# USB midi configuration, with adb
-on property:sys.usb.config=midi,adb
-    write /sys/class/android_usb/android0/enable 0
-    write /sys/class/android_usb/android0/idVendor 18D1
-    write /sys/class/android_usb/android0/idProduct 4EE9
-    write /sys/class/android_usb/android0/functions ${sys.usb.config}
-    write /sys/class/android_usb/android0/enable 1
-    start adbd
-    setprop sys.usb.state ${sys.usb.config}
-
 # QDSS - Qualcomm Debug Subsystem
 on property:sys.usb.config=diag,qdss,adb
     write /sys/class/android_usb/android0/enable 0
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
index 22f9ad1..ab0a689 100644
--- a/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -273,10 +273,6 @@
     <!-- Flag specifying whether VoLTE is availasble on device -->
     <bool name="config_device_volte_available">true</bool>
 
-    <!-- Flag specifying whether WFC over IMS is availasble on device -->
-    <!-- STOPSHIP if disabled -->
-    <bool name="config_device_wfc_ims_available">false</bool>
-
     <!-- Configure mobile tcp buffer sizes in the form:
          rat-name:rmem_min,rmem_def,rmem_max,wmem_min,wmem_def,wmem_max
          If no value is found for the rat-name in use, the system default will be applied.
diff --git a/proprietary-blobs.txt b/proprietary-blobs.txt
index bb65ea8..4f4bbcd 100644
--- a/proprietary-blobs.txt
+++ b/proprietary-blobs.txt
@@ -55,9 +55,8 @@
 /system/bin/usbhub
 /system/bin/usbhub_init
 /system/etc/Bluetooth_cal.acdb
-/system/etc/diag/mdm/FIT_V16_2_volte_full_ip.cfg
-/system/etc/diag/mdm/FIT_V16_3_audio.cfg
-/system/etc/diag/mdm/FIT_V16_1.cfg
+/system/etc/diag/mdm/FIT_V15_audio.cfg
+/system/etc/diag/mdm/FIT_V15.cfg
 /system/etc/diag/mdm/sensors_qxdm.cfg
 /system/etc/diag/sensors_qxdm.cfg
 /system/etc/firmware/cpp_firmware_v1_1_1.fw
diff --git a/qrngd/Android.mk b/qrngd/Android.mk
new file mode 100644
index 0000000..18640be
--- /dev/null
+++ b/qrngd/Android.mk
@@ -0,0 +1,9 @@
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES:= qrngd.c
+LOCAL_SHARED_LIBRARIES := libc libcutils
+LOCAL_CFLAGS := -DANDROID_CHANGES
+LOCAL_MODULE = qrngd
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_EXECUTABLE)
diff --git a/qrngd/qrngd.c b/qrngd/qrngd.c
new file mode 100644
index 0000000..0be5bd3
--- /dev/null
+++ b/qrngd/qrngd.c
@@ -0,0 +1,462 @@
+/*
+ * Copyright (c) 2011, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ *       copyright notice, this list of conditions and the following
+ *       disclaimer in the documentation and/or other materials provided
+ *       with the distribution.
+ *     * Neither the name of The Linux Foundation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <syslog.h>
+#include <unistd.h>
+#include <linux/random.h>
+#include <linux/types.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/poll.h>
+#include <linux/capability.h>
+#include <sys/prctl.h>
+#include <private/android_filesystem_config.h>
+
+#ifdef ANDROID_CHANGES
+#include <android/log.h>
+#endif
+
+#ifndef min
+	#define min(a,b) (((a)>(b))?(b):(a))
+#endif
+
+typedef unsigned char bool;
+
+#define TRUE 1
+#define FALSE 0
+
+#define RANDOM_DEVICE       "/dev/random"
+#define RANDOM_DEVICE_HW    "/dev/hw_random"
+
+/* The device (/dev/random) internal limits 4096 bits of entropy, 512 bytes */
+#define MAX_ENT_POOL_BITS  4096
+#define MAX_ENT_POOL_BYTES (MAX_ENT_POOL_BITS / 8)
+
+#define MAX_ENT_POOL_WRITES 128  		/* write pool with smaller chunks */
+
+///* Burst-mode timeout in us (micro-seconds) */
+//#define BURST_MODE_TIMEOUT 100000		/* 100ms */
+///* Idle-mode wait in us (micro-seconds) */
+//#define IDLE_MODE_WAIT 10000			/* 10ms */
+
+/* Buffer to hold hardware entropy bytes (this must be 2KB for FIPS testing       */
+#define MAX_BUFFER 2048				/* do not change this value       */
+static unsigned char databuf[MAX_BUFFER];	/* create buffer for FIPS testing */
+static unsigned long buffsize;			/* size of data in buffer         */
+static unsigned long curridx;			/* position of current index      */
+
+/* Globals */
+//static bool read_blocked = FALSE;
+//static pid_t qrngd_pid;
+
+/* User parameters */
+struct user_options {
+	char            input_device_name[128];
+	char            output_device_name[128];
+	bool            run_as_daemon;
+};
+
+/* Version number of this source */
+#define APP_VERSION "1.01"
+#define APP_NAME    "qrngd"
+
+const char *program_version =
+APP_NAME " " APP_VERSION "\n"
+"Copyright (c) 2011, The Linux Foundation. All rights reserved.\n"
+"This is free software; see the source for copying conditions.  There is NO\n"
+"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n";
+
+const char *program_usage =
+"Usage: " APP_NAME " [OPTION...]\n"
+"  -b                 background - become a daemon (default)\n"
+"  -f                 foreground - do not fork and become a daemon\n"
+"  -r <device name>   hardware random input device (default: /dev/hw_random)\n"
+"  -o <device name>   system random output device (default: /dev/random)\n"
+"  -h                 help (this page)\n";
+
+/* Logging information */
+enum log_level {
+	DEBUG = 0,
+	INFO = 1,
+	WARNING = 2,
+	ERROR = 3,
+	FATAL = 4,
+	LOG_MAX = 4,
+};
+
+/* Logging function for outputing to stderr or log */
+void log_print(int level, char *format, ...)
+{
+	if (level >= 0 && level <= LOG_MAX) {
+#ifdef ANDROID_CHANGES
+		static int levels[5] = {
+			ANDROID_LOG_DEBUG, ANDROID_LOG_INFO, ANDROID_LOG_WARN,
+			ANDROID_LOG_ERROR, ANDROID_LOG_FATAL
+		};
+		va_list ap;
+		va_start(ap, format);
+		__android_log_vprint(levels[level], APP_NAME, format, ap);
+		va_end(ap);
+#else
+		static char *levels = "DIWEF";
+		va_list ap;
+		fprintf(stderr, "%c: ", levels[level]);
+		va_start(ap, format);
+		vfprintf(stderr, format, ap);
+		va_end(ap);
+		fputc('\n', stderr);
+#endif
+	}
+}
+
+static void title(void)
+{
+	printf("%s", program_version);
+}
+
+static void usage(void)
+{
+	printf("%s", program_usage);
+}
+
+/* Parse command line parameters */
+static int get_user_options(struct user_options *user_ops, int argc, char **argv)
+{
+	int max_params = argc;
+	int itr = 1;			/* skip program name */
+	while (itr < max_params) {
+		if (argv[itr][0] != '-')
+			return -1;
+
+		switch (argv[itr++][1]) {
+			case 'b':
+				user_ops->run_as_daemon = TRUE;
+				break;
+
+			case 'f':
+				user_ops->run_as_daemon = FALSE;
+				break;
+
+			case 'r':
+				if (itr < max_params) {
+					if (strlen(argv[itr]) < sizeof(user_ops->input_device_name))
+						strcpy(user_ops->input_device_name, argv[itr++]);
+					else
+						return -1;
+					break;
+				}
+				else
+					return -1;
+
+			case 'o':
+				if (itr < max_params) {
+					if (strlen(argv[itr]) < sizeof(user_ops->output_device_name))
+						strcpy(user_ops->output_device_name, argv[itr++]);
+					else
+						return -1;
+					break;
+				}
+				else
+					return -1;
+
+			case 'h':
+				return -1;
+
+
+			default:
+				fprintf(stderr, "ERROR: Bad option: '%s'\n", argv[itr-1]);
+				return -1;
+		}
+	}
+	return 0;
+}
+
+/* Only check FIPS 140-2 (Continuous Random Number Generator Test) */
+static int fips_test(const unsigned char *buf, size_t size)
+{
+	unsigned long *buff_ul = (unsigned long *) buf;
+	size_t size_ul = size >> 2;	/* convert byte to word size */
+	unsigned long last_value;
+	unsigned int rnd_ctr[256];
+	int i;
+
+
+	/* Continuous Random Number Generator Test */
+	last_value = *(buff_ul++);
+	size_ul--;
+
+	while (size_ul > 0) {
+		if (*buff_ul == last_value) {
+			log_print(ERROR, "ERROR: Bad word value from hardware.");
+			return -1;
+		} else
+			last_value = *buff_ul;
+		buff_ul++;
+		size_ul--;
+	}
+
+	/* count each random number */
+	for (i = 0; i < size; ++i) {
+		rnd_ctr[buf[i]]++;
+	}
+
+	/* check random numbers to make sure they are not bogus */
+	for (i = 0; i < 256; ++i) {
+		if (rnd_ctr[i] == 0) {
+			log_print(ERROR, "ERROR: Bad spectral random number sample.");
+			return -1;
+		}
+	}
+
+	return 0;
+}
+
+/* Read data from the hardware RNG source */
+static int read_src(int fd, void *buf, size_t size)
+{
+	size_t offset = 0;
+	char *chr = (char *) buf;
+	ssize_t ret;
+
+	if (!size)
+		return -1;
+	do {
+		ret = read(fd, chr + offset, size);
+		/* any read failure is bad */
+		if (ret == -1)
+			return -1;
+		size -= ret;
+		offset += ret;
+	} while (size > 0);
+
+	/* should have read in all of requested data */
+	if (size > 0)
+		return -1;
+	return 0;
+}
+
+/*Hold minimal permissions, so as to get IOCTL working*/
+static int qrng_update_cap()
+{
+	int retvalue = 0;
+	struct __user_cap_header_struct header;
+	struct __user_cap_data_struct cap;
+
+	memset(&header, 0, sizeof(header));
+	memset(&cap, 0, sizeof(cap));
+	prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);
+	if( 0 != setgid(AID_SYSTEM)){
+		fprintf(stderr, "setgid error\n");
+		return -1;
+	}
+	if( 0 != setuid(AID_SYSTEM)){
+		fprintf(stderr, "setuid error\n");
+		return -1;
+	}
+	header.version = _LINUX_CAPABILITY_VERSION;
+	header.pid = 0;
+	cap.effective = (1 << CAP_SYS_ADMIN) | (1 << CAP_NET_RAW);
+	cap.permitted = cap.effective;
+	cap.inheritable = 0;
+	retvalue = capset(&header, &cap);
+	if(retvalue != 0){
+		fprintf(stderr, "capset error\n");
+		return -1;
+	}
+	return 0;
+}
+
+/* The beginning of everything */
+int main(int argc, char **argv)
+{
+	struct user_options user_ops;		/* holds user configuration data     */
+	struct rand_pool_info *rand = NULL;	/* structure to pass entropy (IOCTL) */
+	int random_fd = 0;			/* output file descriptor            */
+	int random_hw_fd = 0;			/* input file descriptor             */
+	int ent_count;				/* current system entropy            */
+	int write_size;				/* max entropy data to pass          */
+	struct pollfd fds[1];			/* used for polling file descriptor  */
+	int ret;
+	int exitval = 0;
+
+	/* set default parameters */
+	user_ops.run_as_daemon = TRUE;
+	strcpy(user_ops.input_device_name, RANDOM_DEVICE_HW);
+	strcpy(user_ops.output_device_name, RANDOM_DEVICE);
+
+	/* display application header */
+	title();
+
+	/* get user preferences */
+	ret = get_user_options(&user_ops, argc, argv);
+	if (ret < 0) {
+		usage();
+		exitval = 1;
+		goto exit;
+	}
+
+	/* open hardware random device */
+	random_hw_fd = open(user_ops.input_device_name, O_RDONLY);
+	if (random_hw_fd < 0) {
+		fprintf(stderr, "Can't open hardware random device file %s\n", user_ops.input_device_name);
+		exitval = 1;
+		goto exit;
+	}
+
+	/*Hold minimal permissions, just enough to get IOCTL working*/
+	if(0 != qrng_update_cap()){
+		log_print(ERROR, "qrngd permission reset failed, exiting\n");
+		exitval = 1;
+		goto exit;
+	}
+
+	/* open random device */
+	random_fd = open(user_ops.output_device_name, O_RDWR);
+	if (random_fd < 0) {
+		fprintf(stderr, "Can't open random device file %s\n", user_ops.output_device_name);
+		exitval = 1;
+		goto exit;
+	}
+
+	/* allocate memory for ioctl data struct and buffer */
+	rand = malloc(sizeof(struct rand_pool_info) + MAX_ENT_POOL_WRITES);
+	if (!rand) {
+		fprintf(stderr, "Can't allocate memory\n");
+		exitval = 1;
+		goto exit;
+	}
+
+	/* setup poll() data */
+	memset(fds, 0 , sizeof(fds));
+	fds[0].fd = random_fd;
+	fds[0].events = POLLOUT;
+
+	/* run as daemon if requested to do so */
+	if (user_ops.run_as_daemon) {
+		fprintf(stderr, "Starting daemon.\n");
+		if (daemon(0, 0) < 0) {
+			fprintf(stderr, "can't daemonize: %s\n", strerror(errno));
+			exitval = 1;
+			goto exit;
+		}
+#ifndef ANDROID_CHANGES
+		openlog(APP_NAME, 0, LOG_DAEMON);
+#endif
+	}
+
+	/* log message */
+	log_print(INFO, APP_NAME " has started:\n" "Reading device:'%s' updating entropy for device:'%s'",
+		  user_ops.input_device_name,
+		  user_ops.output_device_name);
+
+	/* main loop to get data from hardware and feed RNG entropy pool */
+	while (1) {
+
+		/* Check for empty buffer and fill with hardware random generated numbers */
+		if (buffsize == 0) {
+			/* fill buffer with random data from hardware */
+			ret = read_src(random_hw_fd, databuf, MAX_BUFFER);
+			if (ret < 0) {
+				log_print(ERROR, "ERROR: Can't read from hardware source.");
+				exitval = 1;
+				goto exit;
+			}
+			/* run FIPS test on buffer, if buffer fails then ditch it and get new data */
+			ret = fips_test(databuf, MAX_BUFFER);
+			if (ret < 0) {
+				buffsize = 0;
+				log_print(INFO, "ERROR: Failed FIPS test.");
+			}
+			/* everything good, reset buffer variables to indicate full buffer */
+			else {
+				buffsize = MAX_BUFFER;
+				curridx  = 0;
+			}
+		}
+		/* We should have data here, if not then something bad happened above and we should wait and try again */
+		if (buffsize == 0) {
+			log_print(ERROR, "ERROR: Timeout getting valid random data from hardware.");
+			usleep(100000);	/* 100ms */
+			continue;
+		}
+
+		/* Get current entropy pool size in bits and convert to bytes */
+		if (ioctl(random_fd, RNDGETENTCNT, &ent_count) != 0) {
+			log_print(ERROR, "ERROR: Can't read entropy count.");
+			exitval = 1;
+			goto exit;
+		}
+		/* convert entropy bits to bytes */
+		ent_count >>= 3;
+
+		/* fill entropy pool */
+		write_size = min(buffsize, MAX_ENT_POOL_WRITES);
+
+		/* Write some data to the device */
+		rand->entropy_count = write_size * 8;
+		rand->buf_size      = write_size;
+		memcpy(rand->buf, &databuf[curridx], write_size);
+		curridx  += write_size;
+		buffsize -= write_size;
+
+		/* Issue the ioctl to increase the entropy count */
+		if (ioctl(random_fd, RNDADDENTROPY, rand) < 0) {
+			log_print(ERROR,"ERROR: RNDADDENTROPY ioctl() failed.");
+			exitval = 1;
+			goto exit;
+		}
+
+		/* Wait if entropy pool is full */
+		ret = poll(fds, 1, -1);
+		if (ret < 0) {
+			log_print(ERROR,"ERROR: poll call failed.");
+			/* wait if error */
+			usleep(100000);
+		}
+	}
+
+exit:
+	/* free other resources */
+	if (rand)
+		free(rand);
+	if (random_fd)
+		close(random_fd);
+	if (random_hw_fd)
+		close(random_hw_fd);
+	return exitval;
+}
+
diff --git a/self-extractors/extract-lists.txt b/self-extractors/extract-lists.txt
index 6080a63..0bdadec 100644
--- a/self-extractors/extract-lists.txt
+++ b/self-extractors/extract-lists.txt
@@ -11,9 +11,8 @@
             system/bin/ramdump \
             system/bin/tcmd_mini \
             system/etc/Bluetooth_cal.acdb \
-            system/etc/diag/mdm/FIT_V16_2_volte_full_ip.cfg \
-            system/etc/diag/mdm/FIT_V16_3_audio.cfg \
-            system/etc/diag/mdm/FIT_V16_1.cfg \
+            system/etc/diag/mdm/FIT_V15_audio.cfg \
+            system/etc/diag/mdm/FIT_V15.cfg \
             system/etc/diag/mdm/sensors_qxdm.cfg \
             system/etc/diag/sensors_qxdm.cfg \
             system/etc/firmware/vpu.b00 \
diff --git a/self-extractors/moto/staging/device-partial.mk b/self-extractors/moto/staging/device-partial.mk
index b4be093..88edf7e 100644
--- a/self-extractors/moto/staging/device-partial.mk
+++ b/self-extractors/moto/staging/device-partial.mk
@@ -18,9 +18,8 @@
     vendor/moto/shamu/proprietary/ramdump:system/bin/ramdump:moto \
     vendor/moto/shamu/proprietary/tcmd_mini:system/bin/tcmd_mini:moto \
     vendor/moto/shamu/proprietary/Bluetooth_cal.acdb:system/etc/Bluetooth_cal.acdb:moto \
-    vendor/moto/shamu/proprietary/FIT_V16_2_volte_full_ip.cfg:system/etc/diag/mdm/FIT_V16_2_volte_full_ip.cfg:moto \
-    vendor/moto/shamu/proprietary/FIT_V16_3_audio.cfg:system/etc/diag/mdm/FIT_V16_3_audio.cfg:moto \
-    vendor/moto/shamu/proprietary/FIT_V16_1.cfg:system/etc/diag/mdm/FIT_V16_1.cfg:moto \
+    vendor/moto/shamu/proprietary/FIT_V15_audio.cfg:system/etc/diag/mdm/FIT_V15_audio.cfg:moto \
+    vendor/moto/shamu/proprietary/FIT_V15.cfg:system/etc/diag/mdm/FIT_V15.cfg:moto \
     vendor/moto/shamu/proprietary/sensors_qxdm.cfg:system/etc/diag/mdm/sensors_qxdm.cfg:moto \
     vendor/moto/shamu/proprietary/sensors_qxdm.cfg:system/etc/diag/sensors_qxdm.cfg:moto \
     vendor/moto/shamu/proprietary/vpu.b00:system/etc/firmware/vpu.b00:moto \
diff --git a/sepolicy/adspd.te b/sepolicy/adspd.te
index 0c684dc..bc955c7 100644
--- a/sepolicy/adspd.te
+++ b/sepolicy/adspd.te
@@ -17,6 +17,3 @@
 # For now, allow writes to all of /sys.
 # TODO: scope down this access.
 allow adspd sysfs:file write;
-
-allow adspd sysfs_mmi_touch:dir search;
-allow adspd sysfs_mmi_touch:file r_file_perms;
diff --git a/sepolicy/atfwd.te b/sepolicy/atfwd.te
index 0400a1a..a713530 100644
--- a/sepolicy/atfwd.te
+++ b/sepolicy/atfwd.te
@@ -13,5 +13,3 @@
 binder_use(atfwd);
 binder_call(atfwd, system_app);
 binder_call(atfwd, servicemanager);
-
-allow atfwd atfwd_service:service_manager find;
diff --git a/sepolicy/bootanim.te b/sepolicy/bootanim.te
new file mode 100644
index 0000000..3b17145
--- /dev/null
+++ b/sepolicy/bootanim.te
@@ -0,0 +1,2 @@
+#TODO - identify cause of this
+allow bootanim shell_data_file:dir search;
diff --git a/sepolicy/camera.te b/sepolicy/camera.te
index 77cb8ef..d0fd639 100644
--- a/sepolicy/camera.te
+++ b/sepolicy/camera.te
@@ -5,7 +5,7 @@
 # Started by init
 init_daemon_domain(camera)
 
-allow camera system_file:file execmod;
+allow camera self:process execmem;
 
 # Interact with other media devices
 allow camera camera_device:dir search;
@@ -26,3 +26,6 @@
 allow camera camera_socket:sock_file { create unlink };
 allow camera system_data_file:dir w_dir_perms;
 allow camera system_data_file:sock_file unlink;
+
+# TODO b/17015082
+allow camera shell_data_file:dir search;
diff --git a/sepolicy/cnd.te b/sepolicy/cnd.te
deleted file mode 100644
index ed498f9..0000000
--- a/sepolicy/cnd.te
+++ /dev/null
@@ -1,13 +0,0 @@
-#permissive cnd;
-type cnd, domain;
-type cnd_exec, exec_type, file_type;
-
-# cnd is started by init, type transit from init domain to cnd domain
-init_daemon_domain(cnd)
-# associate netdomain as an attribute of cnd domain
-net_domain(cnd)
-
-allow cnd self:capability { net_raw setuid setgid };
-
-allow cnd netmgrd:dir search;
-allow cnd netmgrd:file r_file_perms;
diff --git a/sepolicy/device.te b/sepolicy/device.te
index 26c8c1c..b3210f9 100644
--- a/sepolicy/device.te
+++ b/sepolicy/device.te
@@ -4,12 +4,14 @@
 # eMMC rpmb - necessarily drm?
 type drm_block_device, dev_type;
 
+# STOPSHIP b/16455932
+type fingerprint_device, dev_type;
+
 type efs_block_device, dev_type;
 type mdm_helper_device, dev_type;
 type ramdump_device, dev_type;
 type modem_hob_block_device, dev_type;
 type cid_block_device, dev_type;
-type persist_block_device, dev_type;
 
 # Real Time Clock
 type rtc, dev_type;
diff --git a/sepolicy/file.te b/sepolicy/file.te
index a0c0351..197e9b5 100644
--- a/sepolicy/file.te
+++ b/sepolicy/file.te
@@ -2,8 +2,6 @@
 type firmware_file, fs_type, contextmount_type;
 type fsg_file, fs_type, contextmount_type;
 
-type cnd_socket, file_type;
-
 type adspd_socket, file_type;
 type camera_socket, file_type;
 type mpdecision_socket, file_type;
@@ -26,7 +24,6 @@
 type sysfs_smdcntl_open_timeout, fs_type, sysfs_type;
 type sysfs_xhci_msm_hsic, fs_type, sysfs_type;
 type sysfs_msm_hsic_host, fs_type, sysfs_type;
-type sysfs_mmi_touch, fs_type, sysfs_type;
 
 type persist_file, file_type;
 type persist_data_file, file_type;
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index ff385d2..97f4244 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -19,7 +19,10 @@
 /dev/ttyHS3                    u:object_r:adspd_device:s0
 
 #Serial console
-/dev/ttyHSL0                   u:object_r:console_device:s0
+/dev/ttyHSL0                   u:object_r:tty_device:s0
+
+# STOPSHIP b/16455932
+/dev/vfsspi                    u:object_r:fingerprint_device:s0
 
 # GPU device
 /dev/kgsl-3d0                  u:object_r:gpu_device:s0
@@ -32,9 +35,6 @@
 # factory reset protection partition
 /dev/block/platform/msm_sdcc\.1/by-name/frp           u:object_r:frp_block_device:s0
 
-# /persist
-/dev/block/platform/msm_sdcc\.1/by-name/persist   u:object_r:persist_block_device:s0
-
 # mdm1hob, mdm1dhob
 /dev/block/platform/msm_sdcc.1/by-name/mdm1hob   u:object_r:modem_hob_block_device:s0
 /dev/block/platform/msm_sdcc.1/by-name/mdm1dhob  u:object_r:modem_hob_block_device:s0
@@ -45,13 +45,6 @@
 /dev/block/platform/msm_sdcc.1/by-name/mdm1m9kefs3  u:object_r:efs_block_device:s0
 /dev/block/platform/msm_sdcc.1/by-name/mdm1m9kefsc  u:object_r:efs_block_device:s0
 
-/dev/block/platform/msm_sdcc\.1/by-name/system       u:object_r:system_block_device:s0
-/dev/block/platform/msm_sdcc\.1/by-name/recovery     u:object_r:recovery_block_device:s0
-/dev/block/platform/msm_sdcc\.1/by-name/boot         u:object_r:boot_block_device:s0
-/dev/block/platform/msm_sdcc\.1/by-name/userdata     u:object_r:userdata_block_device:s0
-/dev/block/platform/msm_sdcc\.1/by-name/metadata     u:object_r:metadata_block_device:s0
-/dev/block/platform/msm_sdcc\.1/by-name/cache        u:object_r:cache_block_device:s0
-
 # Customer Identifier
 /dev/block/platform/msm_sdcc.1/by-name/cid          u:object_r:cid_block_device:s0
 
@@ -87,7 +80,6 @@
 #Add context for IMS Socket node
 /dev/socket/ims_qmid            u:object_r:ims_socket:s0
 /dev/socket/ims_datad           u:object_r:ims_socket:s0
-/dev/socket/ims_rtpd            u:object_r:ims_socket:s0
 
 # Shared memory log
 /dev/smem_log                   u:object_r:shared_log_device:s0
@@ -126,7 +118,6 @@
 /system/bin/bdAddrLoader        u:object_r:bluetooth_loader_exec:s0
 /system/bin/bridgemgrd          u:object_r:bridge_exec:s0
 /system/vendor/bin/gsiff_daemon u:object_r:gsiffd_exec:s0
-/system/bin/init\.mmi\.touch\.sh u:object_r:mmi_touch_sh_exec:s0
 /system/bin/irsc_util           u:object_r:irsc_util_exec:s0
 /system/bin/ks                  u:object_r:mdm_helper_exec:s0
 /system/bin/mdm_helper          u:object_r:mdm_helper_exec:s0
@@ -153,9 +144,6 @@
 # Sysfs files used by qmuxd
 /sys/devices/virtual/smdpkt/smdcntl([0-9])+/open_timeout u:object_r:sysfs_smdcntl_open_timeout:s0
 
-# mmi_touch related /sys files
-/sys/devices/f9966000\.i2c/i2c-1/1-004a(/.*)?            u:object_r:sysfs_mmi_touch:s0
-
 # Context for mpdecision
 /sys/module/msm_thermal/core_control/cpus_offlined              u:object_r:sysfs_mpdecision:s0
 /sys/devices/system/cpu/cpu0/rq-stats(/.*)?                     u:object_r:sysfs_rqstats:s0
@@ -169,7 +157,3 @@
 
 /system/bin/imsdatadaemon                       u:object_r:ims_exec:s0
 /system/bin/imsqmidaemon                        u:object_r:ims_exec:s0
-/system/bin/ims_rtp_daemon                      u:object_r:ims_exec:s0
-
-/dev/socket/cnd  u:object_r:cnd_socket:s0
-/system/bin/cnd  u:object_r:cnd_exec:s0
diff --git a/sepolicy/fsck.te b/sepolicy/fsck.te
deleted file mode 100644
index 1500b5f..0000000
--- a/sepolicy/fsck.te
+++ /dev/null
@@ -1 +0,0 @@
-allow fsck persist_block_device:blk_file rw_file_perms;
diff --git a/sepolicy/ims.te b/sepolicy/ims.te
index cf84be2..06464ed 100644
--- a/sepolicy/ims.te
+++ b/sepolicy/ims.te
@@ -13,12 +13,6 @@
 # Allow ims to communicate with netd.
 allow ims netd_socket:sock_file write;
 
-# Allow ims to communicate with cnd.
-allow ims cnd_socket:sock_file write;
-
-# Allow ims to communicate with cnd.
-allow ims cnd:unix_stream_socket connectto;
-
 # Needed to let ims daemon drop unneeded capabilities and to allow access to
 # net_bind
 allow ims self:capability { setpcap setuid net_bind_service };
@@ -49,11 +43,3 @@
 
 # Allow ims to tell init to start the ims data service via property=sys.ims.QMI_DAEMON_STATUS
 allow ims qcom_ims_prop:property_service set;
-allow ims ims_socket:sock_file write;
-
-allow ims wpa_socket:sock_file create_file_perms;
-allow ims wpa_socket:dir rw_dir_perms;
-
-allow ims wifi_data_file:dir r_dir_perms;
-
-unix_socket_send(ims, wpa, wpa)
diff --git a/sepolicy/init.te b/sepolicy/init.te
deleted file mode 100644
index 14f1b92..0000000
--- a/sepolicy/init.te
+++ /dev/null
@@ -1 +0,0 @@
-allow init diag_device:chr_file unlink;
diff --git a/sepolicy/mediaserver.te b/sepolicy/mediaserver.te
index 2eccb3c..cd0a5e7 100644
--- a/sepolicy/mediaserver.te
+++ b/sepolicy/mediaserver.te
@@ -14,3 +14,6 @@
 unix_socket_connect(mediaserver, adspd, adspd)
 allow mediaserver audio_cutback_data_file:dir search;
 allow mediaserver audio_cutback_data_file:sock_file write;
+
+# TODO b/17015082
+allow mediaserver shell_data_file:dir search;
diff --git a/sepolicy/mmi_touch_sh.te b/sepolicy/mmi_touch_sh.te
deleted file mode 100644
index d6bd05b..0000000
--- a/sepolicy/mmi_touch_sh.te
+++ /dev/null
@@ -1,16 +0,0 @@
-type mmi_touch_sh, domain;
-type mmi_touch_sh_exec, exec_type, file_type;
-
-# Started by init
-init_daemon_domain(mmi_touch_sh)
-
-# shell scripts need to execute /system/bin/sh
-allow mmi_touch_sh shell_exec:file rx_file_perms;
-
-# Logs to /dev/kmsg
-allow mmi_touch_sh kmsg_device:chr_file w_file_perms;
-
-# Write to /sys/path/to/firmware/forcereflash
-# Read from /sys/path/to/firmware/poweron (and others)
-allow mmi_touch_sh sysfs_mmi_touch:file rw_file_perms;
-allow mmi_touch_sh sysfs_mmi_touch:dir search;
diff --git a/sepolicy/netmgrd.te b/sepolicy/netmgrd.te
index 506ada9..d7ff8d1 100644
--- a/sepolicy/netmgrd.te
+++ b/sepolicy/netmgrd.te
@@ -20,23 +20,17 @@
 allow netmgrd shared_log_device:chr_file rw_file_perms;
 
 # Access to /proc/sys/net/*
-allow netmgrd proc_net:file rw_file_perms;
-allow netmgrd proc_net:dir r_dir_perms;
+allow netmgrd proc_net:file write;
 
 # Runs /system/bin/toolbox
 allow netmgrd system_file:file rx_file_perms;
 
-#Allow operations on different types of sockets
 allow netmgrd self:netlink_socket create_socket_perms;
-allow netmgrd self:rawip_socket create_socket_perms;
 allow netmgrd self:netlink_route_socket nlmsg_write;
-allow netmgrd self:netlink_xfrm_socket { create_socket_perms nlmsg_write nlmsg_read };
+allow netmgrd self:netlink_xfrm_socket create_socket_perms;
 
 # b/17065650
-allow netmgrd self:socket create_socket_perms;
-
-#Allow communication with cnd
-unix_socket_connect(netmgrd, cnd, cnd)
+allow netmgrd self:socket {create ioctl read};
 
 # CONFIG_MODULES not set in shamu_defconfig
 dontaudit netmgrd self:capability sys_module;
@@ -45,12 +39,9 @@
 unix_socket_connect(netmgrd, property, init)
 allow netmgrd net_radio_prop:property_service set;
 
-#Set netmgrd properties
-allow netmgrd qcom_netmgrd_prop:property_service set;
-
 # Permission to run netd commands
 allow netmgrd netd_socket:sock_file write;
 
 #Allow access to files associated with netd
-allow netmgrd net_data_file:file r_file_perms;
 allow netmgrd net_data_file:dir r_dir_perms;
+
diff --git a/sepolicy/property.te b/sepolicy/property.te
index 07b30c7..201d6b7 100644
--- a/sepolicy/property.te
+++ b/sepolicy/property.te
@@ -1,2 +1 @@
  type qcom_ims_prop, property_type;
- type qcom_netmgrd_prop, property_type;
diff --git a/sepolicy/property_contexts b/sepolicy/property_contexts
index d7d0d0f..74da243 100644
--- a/sepolicy/property_contexts
+++ b/sepolicy/property_contexts
@@ -1,2 +1 @@
 sys.ims.        u:object_r:qcom_ims_prop:s0
-net.r_rmnet     u:object_r:qcom_netmgrd_prop:s0
diff --git a/sepolicy/rild.te b/sepolicy/rild.te
index 00f32f8..69069ae 100644
--- a/sepolicy/rild.te
+++ b/sepolicy/rild.te
@@ -26,5 +26,3 @@
 # Allow permissions for FSG
 allow rild fsg_file:dir search;
 allow rild fsg_file:file r_file_perms;
-
-allow rild mediaserver_service:service_manager find;
diff --git a/sepolicy/sensors.te b/sepolicy/sensors.te
index 000b31d..bac2d54 100644
--- a/sepolicy/sensors.te
+++ b/sepolicy/sensors.te
@@ -8,13 +8,6 @@
 # drop privileges
 allow sensors self:capability { dac_override sys_nice chown setuid setgid net_bind_service};
 
-# b/18417109
-# The kernel code does a permission check of both net_bind_service and
-# net_raw, and allows access if either one returns true.
-# It does the net_raw check first, triggering an SELinux denial.
-# No need to audit
-dontaudit sensors self:capability net_raw;
-
 allow sensors persist_sensors_file:dir setattr;
 
 allow sensors shared_log_device:chr_file rw_file_perms;
diff --git a/sepolicy/service.te b/sepolicy/service.te
index a454fb7..612d43d 100644
--- a/sepolicy/service.te
+++ b/sepolicy/service.te
@@ -1,2 +1 @@
 type atfwd_service,             service_manager_type;
-type cne_service,               service_manager_type;
diff --git a/sepolicy/service_contexts b/sepolicy/service_contexts
index 28b6ce1..2c7dfc7 100644
--- a/sepolicy/service_contexts
+++ b/sepolicy/service_contexts
@@ -1,3 +1,2 @@
 rcs                                       u:object_r:radio_service:s0
 AtCmdFwd                                  u:object_r:atfwd_service:s0
-cneservice                                u:object_r:cne_service:s0
diff --git a/sepolicy/surfaceflinger.te b/sepolicy/surfaceflinger.te
new file mode 100644
index 0000000..75b0677
--- /dev/null
+++ b/sepolicy/surfaceflinger.te
@@ -0,0 +1,2 @@
+# TODO - identify cause of this
+allow surfaceflinger shell_data_file:dir search;
diff --git a/sepolicy/system_app.te b/sepolicy/system_app.te
index f66aaa5..64304d0 100644
--- a/sepolicy/system_app.te
+++ b/sepolicy/system_app.te
@@ -1,7 +1,6 @@
+# TODO b/17015082
+allow system_app shell_data_file:dir search;
+
 allow system_app time:unix_stream_socket connectto;
 
 allow system_app atfwd_service:service_manager add;
-
-allow system_app cne_service:service_manager add;
-
-unix_socket_connect(system_app, cnd, cnd)
diff --git a/sepolicy/system_server.te b/sepolicy/system_server.te
index 713f3e4..a3f2cc4 100644
--- a/sepolicy/system_server.te
+++ b/sepolicy/system_server.te
@@ -2,6 +2,7 @@
 # (e.g., LocationManager)
 qmux_socket(system_server)
 
+allow system_server fingerprint_device:chr_file rw_file_perms;
 allow system_server mpdecision_socket:dir r_dir_perms;
 unix_socket_send(system_server, mpdecision, mpdecision)
 
diff --git a/sepolicy/ueventd.te b/sepolicy/ueventd.te
index f58b051..156e035 100644
--- a/sepolicy/ueventd.te
+++ b/sepolicy/ueventd.te
@@ -1,4 +1,2 @@
 allow ueventd { firmware_file }:dir r_dir_perms;
 allow ueventd { firmware_file }:file r_file_perms;
-allow ueventd sysfs_mmi_touch:file w_file_perms;
-allow ueventd sysfs_mmi_touch:dir search;
diff --git a/sepolicy/wpa.te b/sepolicy/wpa.te
deleted file mode 100644
index 8e17353..0000000
--- a/sepolicy/wpa.te
+++ /dev/null
@@ -1,2 +0,0 @@
-# permission for wpa socket which IMS use to communicate
-allow wpa ims:unix_dgram_socket sendto;
diff --git a/sepolicy/zygote.te b/sepolicy/zygote.te
new file mode 100644
index 0000000..db4a0c3
--- /dev/null
+++ b/sepolicy/zygote.te
@@ -0,0 +1,2 @@
+# TODO - identify cause of this
+allow zygote shell_data_file:dir search;
diff --git a/vendor_owner_info.txt b/vendor_owner_info.txt
index 757edec..b844c4c 100644
--- a/vendor_owner_info.txt
+++ b/vendor_owner_info.txt
@@ -39,9 +39,8 @@
 system/bin/usbhub_init:qcom
 system/bin/usbhub:qcom
 system/etc/Bluetooth_cal.acdb:moto
-system/etc/diag/mdm/FIT_V16_2_volte_full_ip.cfg:moto
-system/etc/diag/mdm/FIT_V16_3_audio.cfg:moto
-system/etc/diag/mdm/FIT_V16_1.cfg:moto
+system/etc/diag/mdm/FIT_V15_audio.cfg:moto
+system/etc/diag/mdm/FIT_V15.cfg:moto
 system/etc/diag/mdm/sensors_qxdm.cfg:moto
 system/etc/diag/sensors_qxdm.cfg:moto
 system/etc/firmware/cpp_firmware_v1_1_1.fw:qcom
diff --git a/verity/Android.mk b/verity/Android.mk
deleted file mode 100644
index 8493309..0000000
--- a/verity/Android.mk
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# Copyright 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# This contains the module build definitions for the hardware-specific
-# components for this device.
-#
-# As much as possible, those components should be built unconditionally,
-# with device-specific names to avoid collisions, to avoid device-specific
-# bitrot and build breakages. Building a component unconditionally does
-# *not* include it on all devices, so it is safe even with hardware-specific
-# components.
-
-LOCAL_PATH := $(call my-dir)
-
-define _add-warning-image
-include $$(CLEAR_VARS)
-LOCAL_MODULE := warning_$(notdir $(1))
-LOCAL_MODULE_STEM := $(notdir $(1))
-_img_modules += $$(LOCAL_MODULE)
-LOCAL_SRC_FILES := $1
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $$(TARGET_ROOT_OUT)/res/images/warning
-include $$(BUILD_PREBUILT)
-endef
-
-_img_modules :=
-_images :=
-$(foreach _img, $(call find-subdir-subdir-files, "images", "*.png"), \
-  $(eval $(call _add-warning-image,$(_img))))
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := verity_warning_images
-LOCAL_MODULE_TAGS := optional
-LOCAL_REQUIRED_MODULES := $(_img_modules)
-include $(BUILD_PHONY_PACKAGE)
-
-_add-warning-image :=
-_img_modules :=
diff --git a/verity/images/verity_red_1.png b/verity/images/verity_red_1.png
deleted file mode 100644
index 0b8c308..0000000
--- a/verity/images/verity_red_1.png
+++ /dev/null
Binary files differ
diff --git a/verity/images/verity_red_2.png b/verity/images/verity_red_2.png
deleted file mode 100644
index e7a4b37..0000000
--- a/verity/images/verity_red_2.png
+++ /dev/null
Binary files differ