Merge commit 'f71e19ee744a6bbac628a8fe85f9f3f2ccfa64ff' into HEAD

Change-Id: I83cf43dcfd3ff7ce866acf4339ecfbe957a21a3c
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 13b7e2a..cf55989 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -77,3 +77,5 @@
 $(call add-clean-step, find $(OUT_DIR)/target/product/bullhead/ -name \*build.prop* -exec rm -rf {} \;)
 $(call add-clean-step, find $(OUT_DIR)/target/product/bullhead/ -name \*build.prop* -exec rm -rf {} \;)
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/permissions/android.hardware.wifi.aware.xml)
+$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/lib/hw/android.hardware.broadcastradio@1.0-impl.so)
+$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/lib64/hw/android.hardware.broadcastradio@1.0-impl.so)
diff --git a/apns-full-conf.xml b/apns-full-conf.xml
index 1ce9b64..99a8d3d 100644
--- a/apns-full-conf.xml
+++ b/apns-full-conf.xml
@@ -1742,7 +1742,10 @@
   <apn carrier="internet simyo"
       mcc="214"
       mnc="03"
-      apn="gprs-service.com"
+      apn="orange"
+      user="orange"
+      password="telecable"
+      authtype="1"
       mvno_type="spn"
       mvno_match_data="simyo"
       type="default,supl"
@@ -1751,7 +1754,7 @@
   <apn carrier="simyo MMS"
       mcc="214"
       mnc="03"
-      apn="mms-service.com"
+      apn="orangemms"
       authtype="1"
       mmsc="http://mms.orange.es"
       mmsproxy="172.22.188.25"
@@ -2082,16 +2085,6 @@
       mvno_type="spn"
   />
 
-  <apn carrier="Conexión Compartida"
-      mcc="214"
-      mnc="07"
-      apn="movistar.es"
-      authtype="1"
-      user="MOVISTAR"
-      password="MOVISTAR"
-      type="dun"
-  />
-
   <apn carrier="T-2"
       mcc="214"
       mnc="07"
@@ -2182,7 +2175,10 @@
   <apn carrier="internet simyo"
       mcc="214"
       mnc="19"
-      apn="gprs-service.com"
+      apn="orange"
+      user="orange"
+      password="telecable"
+      authtype="1"
       mvno_type="spn"
       mvno_match_data="simyo"
       type="default,supl"
@@ -2191,7 +2187,7 @@
   <apn carrier="simyo MMS"
       mcc="214"
       mnc="19"
-      apn="mms-service.com"
+      apn="orangemms"
       authtype="1"
       mmsc="http://mms.orange.es"
       mmsproxy="172.22.188.25"
@@ -2334,6 +2330,7 @@
       mmsc="http://mms.t-mobile.hu/servlets/mms"
       mmsproxy="212.51.126.10"
       mmsport="8080"
+      protocol="IPV4V6"
       type="mms"
       authtype="1"
   />
@@ -2342,7 +2339,8 @@
       mcc="216"
       mnc="30"
       apn="internet.telekom"
-      type="default,dun,supl"
+      protocol="IPV4V6"
+      type="default,supl"
       authtype="1"
   />
 
@@ -2452,7 +2450,7 @@
   <apn carrier="mtelgprs"
       mcc="218"
       mnc="05"
-      apn="3g1"
+      apn="mtelsmart"
       type="default,supl"
   />
 
@@ -3045,14 +3043,14 @@
       type="ia"
   />
 
-  <apn carrier="Cosmote Connect Mobile"
+  <apn carrier="Connect Mobile"
       mcc="226"
       mnc="03"
       apn="broadband"
       type="default,supl"
   />
 
-  <apn carrier="Cosmote MMS"
+  <apn carrier="Telekom MMS"
       mcc="226"
       mnc="03"
       apn="mms"
@@ -3071,7 +3069,7 @@
       apn="wnw"
       user="wnw"
       password="wnw"
-      authtype="1"
+      authtype="3"
       type="default,supl"
   />
 
@@ -3100,14 +3098,14 @@
       type="ia"
   />
 
-  <apn carrier="Cosmote Connect Mobile"
+  <apn carrier="Connect Mobile"
       mcc="226"
       mnc="06"
       apn="broadband"
       type="default,supl"
   />
 
-  <apn carrier="Cosmote MMS"
+  <apn carrier="Telekom MMS"
       mcc="226"
       mnc="06"
       apn="mms"
@@ -3125,6 +3123,7 @@
       apn="wnw"
       user="wnw"
       password="wnw"
+      authtype="3"
       type="default,supl"
   />
 
@@ -4999,10 +4998,10 @@
       type="default,supl,mms"
   />
 
-  <apn carrier="NetCom"
+  <apn carrier="Telia Mobil"
       mcc="242"
       mnc="02"
-      apn="netcom"
+      apn="telia"
       mmsc="http://mm/"
       mmsproxy="212.169.66.4"
       mmsport="8080"
@@ -6142,6 +6141,8 @@
       mnc="02"
       apn="heyah.pl"
       type="default,supl"
+      mvno_match_data="23"
+      mvno_type="gid"
   />
 
   <apn carrier="heyahmms"
@@ -6152,6 +6153,8 @@
       mmsproxy="213.158.194.226"
       mmsport="8080"
       type="mms"
+      mvno_match_data="23"
+      mvno_type="gid"
   />
 
   <apn carrier="Orange Internet"
@@ -6216,9 +6219,11 @@
       user="telekom"
       password="telekom"
       mmsc="http://mms.t-mobile.de/servlets/mms"
-      mmsproxy="172.28.23.131"
+      mmsproxy="109.237.176.193"
       mmsport="8008"
       authtype="1"
+      protocol="IPV4V6"
+      roaming_protocol="IP"
       type="default,supl,mms"
   />
 
@@ -6229,12 +6234,13 @@
       user="telekom"
       password="telekom"
       authtype="1"
-      mmsproxy="172.28.23.131"
+      mmsproxy="109.237.176.193"
       mmsc="http://mms.t-mobile.de/servlets/mms"
       mmsport="8008"
       mvno_match_data="debitel"
       mvno_type="spn"
       protocol="IP"
+      type="default,supl,mms"
   />
 
   <apn carrier="Vodafone DE"
@@ -7253,6 +7259,7 @@
       apn="pda.bell.ca"
       type="default,mms,supl"
       mmsc="http://mms.bell.ca/mms/wapenc"
+      protocol="IPV4V6"
   />
 
   <apn carrier="Virgin Mobile"
@@ -7263,6 +7270,7 @@
       mmsc="http://mms.bell.ca/mms/wapenc"
       mvno_match_data="3E"
       mvno_type="gid"
+      protocol="IPV4V6"
   />
 
   <apn carrier="MTS"
@@ -24455,6 +24463,8 @@
       mcc="432"
       mnc="35"
       apn="mtnirancell"
+      protocol="IPV4V6"
+      roaming_protocol="IPV4V6"
       type="default,supl"
   />
 
@@ -24465,6 +24475,8 @@
       mmsc="http://mms:8002"
       mmsproxy="10.131.26.138"
       mmsport="8080"
+      protocol="IPV4V6"
+      roaming_protocol="IPV4V6"
       type="mms"
   />
 
diff --git a/camera/QCamera2/HAL3/QCamera3Channel.cpp b/camera/QCamera2/HAL3/QCamera3Channel.cpp
index cb31953..bfeb46a 100644
--- a/camera/QCamera2/HAL3/QCamera3Channel.cpp
+++ b/camera/QCamera2/HAL3/QCamera3Channel.cpp
@@ -1974,6 +1974,8 @@
 
         uint32_t raw16_stride = ((uint32_t)dim.width + 15U) & ~15U;
         uint16_t* raw16_buffer = (uint16_t *)frame->buffer;
+        uint8_t first_quintuple[5];
+        memcpy(first_quintuple, raw16_buffer, sizeof(first_quintuple));
 
         // Some raw processing may be needed prior to conversion.
         static bool raw_proc_lib_load_attempted = false;
@@ -2007,13 +2009,19 @@
             for (int32_t xs = dim.width - 1; xs >= 0; xs--) {
                 uint32_t x = (uint32_t)xs;
                 uint8_t upper_8bit = row_start[5*(x/4)+x%4];
-                uint8_t lower_2bit = ((row_start[5*(x/4)+4] >> (x%4)) & 0x3);
+                uint8_t lower_2bit = ((row_start[5*(x/4)+4] >> ((x%4) << 1)) & 0x3);
                 uint16_t raw16_pixel =
                         (uint16_t)(((uint16_t)upper_8bit)<<2 |
                         (uint16_t)lower_2bit);
                 raw16_buffer[y*raw16_stride+x] = raw16_pixel;
             }
         }
+
+        // Re-convert the first 2 pixels of the buffer because the loop above messes
+        // them up by reading the first quintuple while modifying it.
+        raw16_buffer[0] = ((uint16_t)first_quintuple[0]<<2) | (first_quintuple[4] & 0x3);
+        raw16_buffer[1] = ((uint16_t)first_quintuple[1]<<2) | ((first_quintuple[4] >> 2) & 0x3);
+
     } else {
         ALOGE("%s: Could not find stream", __func__);
     }
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.cpp b/camera/QCamera2/HAL3/QCamera3HWI.cpp
index 05c0c41..eecd454 100644
--- a/camera/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/camera/QCamera2/HAL3/QCamera3HWI.cpp
@@ -6791,7 +6791,12 @@
        ANDROID_STATISTICS_HISTOGRAM_MODE, ANDROID_STATISTICS_SHARPNESS_MAP_MODE,
        ANDROID_STATISTICS_LENS_SHADING_MAP_MODE, ANDROID_TONEMAP_CURVE_BLUE,
        ANDROID_TONEMAP_CURVE_GREEN, ANDROID_TONEMAP_CURVE_RED, ANDROID_TONEMAP_MODE,
-       ANDROID_BLACK_LEVEL_LOCK, NEXUS_EXPERIMENTAL_2016_HYBRID_AE_ENABLE};
+       ANDROID_BLACK_LEVEL_LOCK, NEXUS_EXPERIMENTAL_2016_HYBRID_AE_ENABLE,
+       QCAMERA3_PRIVATEDATA_REPROCESS, QCAMERA3_CDS_MODE, QCAMERA3_CDS_INFO,
+       QCAMERA3_CROP_COUNT_REPROCESS, QCAMERA3_CROP_REPROCESS,
+       QCAMERA3_CROP_ROI_MAP_REPROCESS, QCAMERA3_TEMPORAL_DENOISE_ENABLE,
+       QCAMERA3_TEMPORAL_DENOISE_PROCESS_TYPE, QCAMERA3_USE_AV_TIMER
+       };
 
     size_t request_keys_cnt =
             sizeof(request_keys_basic)/sizeof(request_keys_basic[0]);
@@ -6828,7 +6833,13 @@
        ANDROID_STATISTICS_FACE_SCORES,
        ANDROID_SENSOR_DYNAMIC_BLACK_LEVEL,
        ANDROID_SENSOR_DYNAMIC_WHITE_LEVEL, NEXUS_EXPERIMENTAL_2016_HYBRID_AE_ENABLE,
-       ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST };
+       ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST,
+       QCAMERA3_PRIVATEDATA_REPROCESS, QCAMERA3_CDS_MODE, QCAMERA3_CDS_INFO,
+       QCAMERA3_CROP_COUNT_REPROCESS, QCAMERA3_CROP_REPROCESS,
+       QCAMERA3_CROP_ROI_MAP_REPROCESS, QCAMERA3_TUNING_META_DATA_BLOB,
+       QCAMERA3_TEMPORAL_DENOISE_ENABLE, QCAMERA3_TEMPORAL_DENOISE_PROCESS_TYPE,
+       QCAMERA3_SENSOR_DYNAMIC_BLACK_LEVEL_PATTERN
+       };
     size_t result_keys_cnt =
             sizeof(result_keys_basic)/sizeof(result_keys_basic[0]);
 
@@ -6906,7 +6917,8 @@
        ANDROID_CONTROL_AWB_LOCK_AVAILABLE,
        ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES,
        ANDROID_SHADING_AVAILABLE_MODES,
-       ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL };
+       ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL, QCAMERA3_OPAQUE_RAW_FORMAT
+       };
 
     Vector<int32_t> available_characteristics_keys;
     available_characteristics_keys.appendArray(characteristics_keys_basic,
@@ -6914,9 +6926,6 @@
     if (hasBlackRegions) {
         available_characteristics_keys.add(ANDROID_SENSOR_OPTICAL_BLACK_REGIONS);
     }
-    staticInfo.update(ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS,
-                      available_characteristics_keys.array(),
-                      available_characteristics_keys.size());
 
     /*available stall durations depend on the hw + sw and will be different for different devices */
     /*have to add for raw after implementation*/
@@ -6989,8 +6998,15 @@
             &gCamCapability[cameraId]->padding_info, &buf_planes);
         strides[i*3+2] = buf_planes.plane_info.mp[0].stride;
     }
-    staticInfo.update(QCAMERA3_OPAQUE_RAW_STRIDES, strides,
-            3*raw_count);
+
+    if (raw_count > 0) {
+        staticInfo.update(QCAMERA3_OPAQUE_RAW_STRIDES, strides,
+                3*raw_count);
+        available_characteristics_keys.add(QCAMERA3_OPAQUE_RAW_STRIDES);
+    }
+    staticInfo.update(ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS,
+                      available_characteristics_keys.array(),
+                      available_characteristics_keys.size());
 
     gStaticMetadata[cameraId] = staticInfo.release();
     return rc;
diff --git a/camera/QCamera2/HAL3/QCamera3Stream.cpp b/camera/QCamera2/HAL3/QCamera3Stream.cpp
index 399e73d..e87d1ec 100644
--- a/camera/QCamera2/HAL3/QCamera3Stream.cpp
+++ b/camera/QCamera2/HAL3/QCamera3Stream.cpp
@@ -588,9 +588,9 @@
             break;
         case CAMERA_CMD_TYPE_EXIT:
             CDBG_HIGH("%s: Exit", __func__);
+            pme->flushFreeBatchBufQ();
             /* flush data buf queue */
             pme->mDataQ.flush();
-            pme->flushFreeBatchBufQ();
             running = 0;
             break;
         default:
diff --git a/camera/QCamera2/QCamera2Factory.cpp b/camera/QCamera2/QCamera2Factory.cpp
index 676dd65..6101036 100644
--- a/camera/QCamera2/QCamera2Factory.cpp
+++ b/camera/QCamera2/QCamera2Factory.cpp
@@ -58,7 +58,6 @@
  *==========================================================================*/
 QCamera2Factory::QCamera2Factory()
 {
-    camera_info info;
     mHalDescriptors = NULL;
     mCallbacks = NULL;
     mNumOfCameras = get_num_of_cameras();
@@ -78,10 +77,6 @@
                 } else {
                     mHalDescriptors[i].device_version = CAMERA_DEVICE_API_VERSION_1_0;
                 }
-                //Query camera at this point in order
-                //to avoid any delays during subsequent
-                //calls to 'getCameraInfo()'
-                getCameraInfo(i, &info);
             }
         } else {
             ALOGE("%s: Not enough resources to allocate HAL descriptor table!",
diff --git a/device.mk b/device.mk
index c42ed2b..19292da 100644
--- a/device.mk
+++ b/device.mk
@@ -238,7 +238,6 @@
 PRODUCT_PACKAGES += \
     android.hardware.audio@2.0-impl \
     android.hardware.audio.effect@2.0-impl \
-    android.hardware.broadcastradio@1.0-impl \
     android.hardware.soundtrigger@2.0-impl
 
 PRODUCT_PACKAGES += \
@@ -295,6 +294,7 @@
 TARGET_USES_NANOHUB_SENSORHAL := true
 NANOHUB_SENSORHAL_LID_STATE_ENABLED := true
 NANOHUB_SENSORHAL_SENSORLIST := $(LOCAL_PATH)/sensorhal/sensorlist.cpp
+NANOHUB_SENSORHAL_DIRECT_REPORT_ENABLED := true
 
 PRODUCT_PACKAGES += \
     sensors.bullhead \
@@ -579,17 +579,6 @@
 PRODUCT_PROPERTY_OVERRIDES += \
     ro.product.first_api_level=23
 
-# In userdebug, add minidebug info the the boot image and the system server to support
-# diagnosing native crashes.
-ifneq (,$(filter userdebug, $(TARGET_BUILD_VARIANT)))
-    # Boot image.
-    PRODUCT_DEX_PREOPT_BOOT_FLAGS += --generate-mini-debug-info
-    # System server and some of its services.
-    # Note: we cannot use PRODUCT_SYSTEM_SERVER_JARS, as it has not been expanded at this point.
-    $(call add-product-dex-preopt-module-config,services,--generate-mini-debug-info)
-    $(call add-product-dex-preopt-module-config,wifi-service,--generate-mini-debug-info)
-endif
-
 # setup dalvik vm configs.
 $(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk)
 
diff --git a/init.bullhead.usb.rc b/init.bullhead.usb.rc
index 697f1da..57e82f4 100644
--- a/init.bullhead.usb.rc
+++ b/init.bullhead.usb.rc
@@ -26,17 +26,15 @@
     chmod 664 /sys/class/dual_role_usb/otg_default/mode
 
 on post-fs
-    mkdir /dev/usb-ffs 0775 shell shell
+    mkdir /dev/usb-ffs 0770 shell shell
     mkdir /dev/usb-ffs/adb 0770 shell shell
     mount functionfs adb /dev/usb-ffs/adb noatime uid=2000,gid=2000,no_disconnect=1
-    mkdir /dev/usb-ffs/mtp 0770 mtp mtp
-    mount functionfs mtp /dev/usb-ffs/mtp noatime rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
     write /sys/module/g_android/parameters/mtp_rx_req_len 131072
     write /sys/module/g_android/parameters/mtp_tx_reqs 32
     setprop sys.usb.ffs.max_write 262144
     setprop sys.usb.ffs.max_read 262144
     setprop sys.usb.mtp.device_type 3
-    write /sys/class/android_usb/android0/f_ffs/aliases adb,mtp
+    write /sys/class/android_usb/android0/f_ffs/aliases adb
 
     setprop sys.usb.ffs.aio_compat 1
 
@@ -103,7 +101,7 @@
     write /sys/class/android_usb/android0/bDeviceClass 0
     write /sys/class/android_usb/android0/bDeviceSubClass 0
     write /sys/class/android_usb/android0/bDeviceProtocol 0
-    write /sys/class/android_usb/android0/functions mtp
+    write /sys/class/android_usb/android0/functions ptp
     write /sys/class/android_usb/android0/enable 1
     setprop sys.usb.state ${sys.usb.config}
 
@@ -114,7 +112,7 @@
     write /sys/class/android_usb/android0/bDeviceClass 0
     write /sys/class/android_usb/android0/bDeviceSubClass 0
     write /sys/class/android_usb/android0/bDeviceProtocol 0
-    write /sys/class/android_usb/android0/functions mtp,adb
+    write /sys/class/android_usb/android0/functions ptp,adb
     write /sys/class/android_usb/android0/enable 1
     start adbd
     setprop sys.usb.state ${sys.usb.config}
diff --git a/media_codecs.xml b/media_codecs.xml
index dffa605..d274e70 100644
--- a/media_codecs.xml
+++ b/media_codecs.xml
@@ -108,9 +108,10 @@
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
             <Quirk name="requires-loaded-to-idle-after-allocation" />
-            <Limit name="size" min="96x64" max="3840x2160" />
+            <Limit name="size" min="96x64" max="4096x4096" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
+            <Limit name="block-count" range="1-32768" /> <!-- max 4096x2048 -->
             <Limit name="blocks-per-second" min="1" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Limit name="concurrent-instances" max="13" />
@@ -119,9 +120,10 @@
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
             <Quirk name="requires-loaded-to-idle-after-allocation" />
-            <Limit name="size" min="96x64" max="3840x2160" />
+            <Limit name="size" min="96x64" max="3840x3840" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
+            <Limit name="block-count" range="1-32400" /> <!-- max 3840x2160 -->
             <Limit name="blocks-per-second" min="1" max="777600" />
             <Limit name="bitrate" range="1-20000000" />
             <Limit name="concurrent-instances" max="13" />
@@ -132,9 +134,10 @@
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
             <Quirk name="defers-output-buffer-allocation" />
-            <Limit name="size" min="64x64" max="3840x2160" />
+            <Limit name="size" min="64x64" max="4096x4096" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
+            <Limit name="block-count" range="1-32768" /> <!-- max 4096x2048 -->
             <Limit name="blocks-per-second" min="1" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Feature name="adaptive-playback" />
@@ -144,9 +147,10 @@
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
             <Quirk name="defers-output-buffer-allocation" />
-            <Limit name="size" min="64x64" max="1920x1088" />
+            <Limit name="size" min="64x64" max="2048x2048" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
+            <Limit name="block-count" range="1-8192" /> <!-- max 2048x1024 -->
             <Limit name="blocks-per-second" min="1" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Feature name="adaptive-playback" />
@@ -178,9 +182,10 @@
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
             <Quirk name="defers-output-buffer-allocation" />
-            <Limit name="size" min="64x64" max="3840x2160" />
+            <Limit name="size" min="96x64" max="3840x3840" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
+            <Limit name="block-count" range="1-32400" /> <!-- max 3840x2160 -->
             <Limit name="blocks-per-second" min="1" max="777600" />
             <Limit name="bitrate" range="1-20000000" />
             <Feature name="adaptive-playback" />
@@ -189,9 +194,10 @@
         <MediaCodec name="OMX.qcom.video.decoder.hevc" type="video/hevc" >
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="64x64" max="4096x2160" />
+            <Limit name="size" min="64x64" max="4096x4096" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
+            <Limit name="block-count" range="1-34560" /> <!-- max 4096x2160 -->
             <Limit name="blocks-per-second" min="1" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Feature name="adaptive-playback" />
@@ -200,9 +206,10 @@
         <MediaCodec name="OMX.qcom.video.decoder.hevc.secure" type="video/hevc" >
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="64x64" max="1920x1088" />
+            <Limit name="size" min="64x64" max="2048x2048" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
+            <Limit name="block-count" range="1-8192" /> <!-- max 2048x1024 -->
             <Limit name="blocks-per-second" min="1" max="972000" />
             <Limit name="bitrate" range="1-100000000" />
             <Feature name="adaptive-playback" />
diff --git a/media_codecs_performance.xml b/media_codecs_performance.xml
index b9d1a90..72abe44 100644
--- a/media_codecs_performance.xml
+++ b/media_codecs_performance.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<!-- Copyright 2016 The Android Open Source Project
+<!-- Copyright 2017 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.
@@ -14,115 +14,131 @@
      limitations under the License.
 -->
 
+<!-- Generated file for bullhead using measurements between OPR1.170623.011 and OPM1.170912.002 -->
 <MediaCodecs>
+    <!-- Measurements between OPR1.170623.010 and OPM1.170908.002 -->
     <Encoders>
         <MediaCodec name="OMX.qcom.video.encoder.h263" type="video/3gpp" update="true">
-            <Limit name="measured-frame-rate-176x144" range="235-418" /> <!-- TWEAKED -->
-            <Limit name="measured-frame-rate-352x288" range="231-245" /> <!-- N=40 v95%=1.2 -->
-            <!-- measured 93%:57-64 med:59 FLAKY(30 - 122 < mx=133.9) WIDEN(30 - 134) -->
-            <Limit name="measured-frame-rate-704x576" range="59-67" /> <!-- N=40 v93%=1.0 -->
+            <!-- measured 98%:101-511 med:187/183 variance:2.2 -->
+            <Limit name="measured-frame-rate-176x144" range="181-256" /> <!-- N=118 -->
+            <!-- measured 98%:165-490 med:241/235 FLAKY(118 - 490 < mx=495.3) -->
+            <Limit name="measured-frame-rate-352x288" range="235-248" /> <!-- TWEAKED N=118 v98%=1.7 -->
+            <Limit name="measured-frame-rate-704x576" range="128-128" /> <!-- N=114 v98%=1.4 -->
         </MediaCodec>
+        <!-- Measurements between OPR1.170623.011 and OPM1.170908.002 -->
         <MediaCodec name="OMX.qcom.video.encoder.avc" type="video/avc" update="true">
-            <Limit name="measured-frame-rate-320x240" range="251-251" /> <!-- N=40 v95%=1.3 -->
-            <Limit name="measured-frame-rate-720x480" range="69-86" /> <!-- TWEAKED -->
-            <!-- measured 93%:38-67 med:44 SLOW -->
-            <Limit name="measured-frame-rate-1280x720" range="43-51" /> <!-- N=40 v93%=1.3 -->
-            <Limit name="measured-frame-rate-1920x1080" range="27-27" /> <!-- N=40 v95%=1.3 -->
+            <Limit name="measured-frame-rate-320x240" range="212-255" /> <!-- N=118 v98%=1.9 (OPR1.170623.010-) -->
+            <Limit name="measured-frame-rate-720x480" range="143-143" /> <!-- N=116 v98%=1.5 -->
+            <Limit name="measured-frame-rate-1280x720" range="72-72" /> <!-- N=118 v98%=1.4 (OPR1.170623.010-) -->
+            <Limit name="measured-frame-rate-1920x1080" range="37-37" /> <!-- N=116 v98%=1.3 -->
         </MediaCodec>
+        <!-- Measurements between OPR1.170623.011 and OPM1.170908.002 -->
         <MediaCodec name="OMX.qcom.video.encoder.mpeg4" type="video/mp4v-es" update="true">
-            <Limit name="measured-frame-rate-176x144" range="260-374" /> <!-- TWEAKED -->
-            <Limit name="measured-frame-rate-352x288" range="201-201" /> <!-- N=40 v95%=1.1 -->
-            <Limit name="measured-frame-rate-640x480" range="77-77" /> <!-- N=40 v95%=1.0 -->
+            <Limit name="measured-frame-rate-176x144" range="178-198" /> <!-- N=118 v98%=1.8 (OPR1.170623.010-) -->
+            <Limit name="measured-frame-rate-352x288" range="199-199" /> <!-- N=116 v98%=1.2 -->
+            <Limit name="measured-frame-rate-640x480" range="77-77" /> <!-- N=116 v98%=1.0 -->
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.vp8" type="video/x-vnd.on2.vp8" update="true">
-            <Limit name="measured-frame-rate-320x180" range="112-113" /> <!-- N=40 v95%=1.0 -->
-            <Limit name="measured-frame-rate-640x360" range="107-107" /> <!-- N=40 v95%=1.0 -->
-            <Limit name="measured-frame-rate-1280x720" range="38-38" /> <!-- N=40 v95%=1.0 -->
-            <Limit name="measured-frame-rate-1920x1080" range="15-15" /> <!-- N=40 v95%=1.0 -->
+            <Limit name="measured-frame-rate-320x180" range="112-112" /> <!-- N=118 v98%=1.1 -->
+            <Limit name="measured-frame-rate-640x360" range="103-103" /> <!-- N=116 v98%=1.1 -->
+            <Limit name="measured-frame-rate-1280x720" range="38-38" /> <!-- N=118 v98%=1.0 -->
+            <Limit name="measured-frame-rate-1920x1080" range="15-15" /> <!-- N=112 v98%=1.1 (OPR1.170623.011-) -->
         </MediaCodec>
         <MediaCodec name="OMX.google.h263.encoder" type="video/3gpp" update="true">
-            <Limit name="measured-frame-rate-176x144" range="246-246" /> <!-- N=40 v95%=1.3 -->
+            <Limit name="measured-frame-rate-176x144" range="230-230" /> <!-- N=118 v98%=1.3 -->
         </MediaCodec>
+        <!-- Measurements between OPR1.170623.011 and OPM1.170908.002 -->
         <MediaCodec name="OMX.google.h264.encoder" type="video/avc" update="true">
-            <!-- measured 93%:141-243 med:161 SLOW -->
-            <Limit name="measured-frame-rate-320x240" range="161-185" /> <!-- N=40 v93%=1.3 -->
-            <!-- measured 95%:45-72 med:48 SLOW -->
-            <Limit name="measured-frame-rate-720x480" range="47-57" /> <!-- N=40 v95%=1.3 -->
-            <Limit name="measured-frame-rate-1280x720" range="20-31" /> <!-- TWEAKED -->
-            <Limit name="measured-frame-rate-1920x1080" range="10-13" /> <!-- TWEAKED -->
+            <Limit name="measured-frame-rate-320x240" range="234-234" /> <!-- N=116 v98%=1.4 -->
+            <Limit name="measured-frame-rate-720x480" range="99-99" /> <!-- N=116 v98%=1.3 -->
+            <Limit name="measured-frame-rate-1280x720" range="50-50" /> <!-- N=118 v98%=1.5 (OPR1.170623.010-) -->
+            <Limit name="measured-frame-rate-1920x1080" range="19-20" /> <!-- N=116 v98%=1.3 -->
         </MediaCodec>
         <MediaCodec name="OMX.google.mpeg4.encoder" type="video/mp4v-es" update="true">
-            <Limit name="measured-frame-rate-176x144" range="321-321" /> <!-- N=40 v95%=1.2 -->
+            <Limit name="measured-frame-rate-176x144" range="256-257" /> <!-- N=118 v98%=1.3 -->
         </MediaCodec>
         <MediaCodec name="OMX.google.vp8.encoder" type="video/x-vnd.on2.vp8" update="true">
-            <Limit name="measured-frame-rate-320x180" range="79-79" /> <!-- N=40 v95%=1.2 -->
-            <Limit name="measured-frame-rate-640x360" range="37-37" /> <!-- N=40 v95%=1.0 -->
-            <Limit name="measured-frame-rate-1280x720" range="16-16" /> <!-- N=40 v95%=1.2 -->
-            <Limit name="measured-frame-rate-1920x1080" range="8-8" /> <!-- N=40 v95%=1.2 -->
+            <Limit name="measured-frame-rate-320x180" range="99-99" /> <!-- N=116 v98%=1.0 (OPR1.170623.011-) -->
+            <Limit name="measured-frame-rate-640x360" range="37-37" /> <!-- N=114 v98%=1.0 (OPR1.170623.009-) -->
+            <Limit name="measured-frame-rate-1280x720" range="31-31" /> <!-- N=116 v98%=1.2 -->
+            <Limit name="measured-frame-rate-1920x1080" range="14-14" /> <!-- N=118 v98%=1.3 -->
+        </MediaCodec>
+        <!-- Measurements between OPR1.170208.003 and OPM1.170908.002 -->
+        <MediaCodec name="OMX.google.vp9.encoder" type="video/x-vnd.on2.vp9" update="true">
+            <!-- measured 98%:86-119 med:107/107 N=76 FLAKY(mn=45.9 < 54 - 214) -->
+            <Limit name="measured-frame-rate-320x180" range="107-107" /> <!-- v98%=1.2 -->
+            <!-- measured 98%:14-45 med:43/41 N=74 -->
+            <Limit name="measured-frame-rate-640x360" range="24-41" /> <!-- v98%=1.8 -->
+            <!-- measured 98%:4-12 med:10/9 N=78 -->
+            <Limit name="measured-frame-rate-1280x720" range="5-9" /> <!-- v98%=1.7 -->
         </MediaCodec>
     </Encoders>
     <Decoders>
         <MediaCodec name="OMX.qcom.video.decoder.h263" type="video/3gpp" update="true">
-            <Limit name="measured-frame-rate-176x144" range="683-683" /> <!-- N=40 v95%=1.1 -->
-            <Limit name="measured-frame-rate-352x288" range="699-699" /> <!-- N=40 v95%=1.1 -->
+            <!-- measured 98%:500-737 med:673/673 N=98 -->
+            <Limit name="measured-frame-rate-176x144" range="673-673" /> <!-- v98%=1.2 -->
+            <Limit name="measured-frame-rate-352x288" range="640-640" /> <!-- N=100 v98%=1.2 -->
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.avc" type="video/avc" update="true">
-            <Limit name="measured-frame-rate-320x240" range="399-399" /> <!-- N=40 v95%=1.1 -->
-            <Limit name="measured-frame-rate-720x480" range="217-218" /> <!-- N=40 v95%=1.0 -->
-            <Limit name="measured-frame-rate-1280x720" range="284-292" /> <!-- N=40 v95%=1.1 -->
-            <Limit name="measured-frame-rate-1920x1088" range="145-148" /> <!-- N=40 v95%=1.0 -->
+            <Limit name="measured-frame-rate-320x240" range="382-382" /> <!-- N=100 v98%=1.1 -->
+            <Limit name="measured-frame-rate-720x480" range="211-211" /> <!-- N=102 v98%=1.1 -->
+            <Limit name="measured-frame-rate-1280x720" range="284-285" /> <!-- N=100 v98%=1.1 -->
+            <Limit name="measured-frame-rate-1920x1080" range="141-141" /> <!-- N=100 v98%=1.1 -->
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.hevc" type="video/hevc" update="true">
-            <Limit name="measured-frame-rate-352x288" range="498-498" /> <!-- N=40 v95%=1.2 -->
-            <Limit name="measured-frame-rate-640x360" range="379-379" /> <!-- N=40 v95%=1.2 -->
-            <Limit name="measured-frame-rate-720x480" range="309-309" /> <!-- N=40 v95%=1.1 -->
-            <Limit name="measured-frame-rate-1280x720" range="433-433" /> <!-- N=40 v95%=1.2 -->
-            <Limit name="measured-frame-rate-1920x1080" range="242-242" /> <!-- N=40 v95%=1.1 -->
-            <Limit name="measured-frame-rate-3840x2160" range="42-43" /> <!-- N=40 v95%=1.0 -->
+            <Limit name="measured-frame-rate-352x288" range="410-411" /> <!-- N=100 v98%=1.2 -->
+            <Limit name="measured-frame-rate-640x360" range="367-368" /> <!-- N=102 v98%=1.1 -->
+            <Limit name="measured-frame-rate-720x480" range="331-331" /> <!-- N=102 v98%=1.1 -->
+            <Limit name="measured-frame-rate-1280x720" range="374-374" /> <!-- N=100 v98%=1.2 -->
+            <Limit name="measured-frame-rate-1920x1080" range="253-253" /> <!-- N=100 v98%=1.1 -->
+            <Limit name="measured-frame-rate-3840x2160" range="43-43" /> <!-- N=102 v98%=1.0 -->
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.mpeg4" type="video/mp4v-es" update="true">
-            <Limit name="measured-frame-rate-176x144" range="694-699" /> <!-- N=40 v95%=1.0 -->
-            <Limit name="measured-frame-rate-480x360" range="581-581" /> <!-- N=40 v95%=1.0 -->
+            <Limit name="measured-frame-rate-176x144" range="663-663" /> <!-- N=102 v98%=1.2 -->
+            <Limit name="measured-frame-rate-480x360" range="567-567" /> <!-- N=102 v98%=1.1 -->
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.vp8" type="video/x-vnd.on2.vp8" update="true">
-            <Limit name="measured-frame-rate-320x180" range="385-385" /> <!-- N=40 v95%=1.0 -->
-            <Limit name="measured-frame-rate-640x360" range="366-366" /> <!-- N=40 v95%=1.1 -->
-            <Limit name="measured-frame-rate-1280x720" range="400-400" /> <!-- N=40 v95%=1.2 -->
-            <Limit name="measured-frame-rate-1920x1080" range="247-249" /> <!-- N=40 v95%=1.0 -->
+            <Limit name="measured-frame-rate-320x180" range="382-382" /> <!-- N=102 v98%=1.0 -->
+            <!-- measured 98%:333-376 med:357/357 FLAKY(mn=0.5 < 179 - 714) -->
+            <Limit name="measured-frame-rate-640x360" range="357-357" /> <!-- N=102 v98%=1.1 -->
+            <Limit name="measured-frame-rate-1280x720" range="387-387" /> <!-- N=102 v98%=1.1 -->
+            <Limit name="measured-frame-rate-1920x1080" range="248-248" /> <!-- N=102 v98%=1.0 -->
         </MediaCodec>
         <MediaCodec name="OMX.google.h263.decoder" type="video/3gpp" update="true">
-            <!-- measured 95%:111-254 med:124 SLOW -->
-            <Limit name="measured-frame-rate-176x144" range="124-168" /> <!-- N=40 v95%=1.5 -->
+            <!-- measured 98%:85-244 med:101/101 FLAKY(51 - 244 < mx=247.5) -->
+            <Limit name="measured-frame-rate-176x144" range="101-124" /> <!-- TWEAKED N=100 v98%=1.7 -->
         </MediaCodec>
         <MediaCodec name="OMX.google.h264.decoder" type="video/avc" update="true">
-            <Limit name="measured-frame-rate-320x240" range="355-359" /> <!-- N=40 v95%=1.0 -->
-            <Limit name="measured-frame-rate-720x480" range="109-110" /> <!-- N=40 v95%=1.0 -->
-            <Limit name="measured-frame-rate-1280x720" range="40-43" /> <!-- N=40 v95%=1.1 -->
-            <Limit name="measured-frame-rate-1920x1080" range="15-15" /> <!-- N=40 v95%=1.2 -->
+            <Limit name="measured-frame-rate-320x240" range="327-327" /> <!-- N=100 v98%=1.1 -->
+            <Limit name="measured-frame-rate-720x480" range="106-106" /> <!-- N=100 v98%=1.1 -->
+            <Limit name="measured-frame-rate-1280x720" range="44-44" /> <!-- N=102 v98%=1.1 -->
+            <Limit name="measured-frame-rate-1920x1080" range="18-18" /> <!-- N=102 v98%=1.3 -->
         </MediaCodec>
         <MediaCodec name="OMX.google.hevc.decoder" type="video/hevc" update="true">
-            <Limit name="measured-frame-rate-352x288" range="305-306" /> <!-- N=40 v95%=1.2 -->
-            <Limit name="measured-frame-rate-640x360" range="105-105" /> <!-- N=40 v95%=1.4 -->
-            <Limit name="measured-frame-rate-720x480" range="97-97" /> <!-- N=40 v95%=1.3 -->
-            <Limit name="measured-frame-rate-1280x720" range="39-39" /> <!-- N=40 v95%=1.3 -->
-            <Limit name="measured-frame-rate-1920x1080" range="21-21" /> <!-- N=40 v95%=1.2 -->
+            <Limit name="measured-frame-rate-352x288" range="270-270" /> <!-- N=100 v98%=1.4 -->
+            <Limit name="measured-frame-rate-640x360" range="173-174" /> <!-- N=100 v98%=1.3 -->
+            <Limit name="measured-frame-rate-720x480" range="165-165" /> <!-- N=102 v98%=1.2 -->
+            <Limit name="measured-frame-rate-1280x720" range="63-63" /> <!-- N=102 v98%=1.2 -->
+            <Limit name="measured-frame-rate-1920x1080" range="36-36" /> <!-- N=100 v98%=1.2 -->
         </MediaCodec>
         <MediaCodec name="OMX.google.mpeg4.decoder" type="video/mp4v-es" update="true">
-            <!-- measured 95%:135-404 med:150 SLOW -->
-            <Limit name="measured-frame-rate-176x144" range="150-233" /> <!-- N=40 v95%=1.7 -->
+            <Limit name="measured-frame-rate-176x144" range="119-154" /> <!-- N=102 v98%=1.8 -->
         </MediaCodec>
         <MediaCodec name="OMX.google.vp8.decoder" type="video/x-vnd.on2.vp8" update="true">
-            <!-- measured 95%:383-730 med:397 SLOW -->
-            <Limit name="measured-frame-rate-320x180" range="397-529" /> <!-- N=40 v95%=1.4 -->
-            <Limit name="measured-frame-rate-640x360" range="107-150" /> <!-- TWEAKED -->
-            <Limit name="measured-frame-rate-1280x720" range="25-26" /> <!-- N=40 v95%=1.0 -->
-            <Limit name="measured-frame-rate-1920x1080" range="10-10" /> <!-- N=40 v95%=1.0 -->
+            <!-- measured 98%:305-939 med:332/333 FLAKY(166 - 940 < mx=956.9) -->
+            <Limit name="measured-frame-rate-320x180" range="332-470" /> <!-- N=102 v98%=1.8 -->
+            <!-- measured 90%:191-298 med:258/258 FLAKY(mn=105.9 < 129 - 516) -->
+            <Limit name="measured-frame-rate-640x360" range="211-258" /> <!-- TWEAKED N=102 v90%=1.2 -->
+            <!-- measured 98%:26-61 med:59/59 FLAKY(mn=25.3 < 26 - 118) -->
+            <Limit name="measured-frame-rate-1280x720" range="50-59" /> <!-- TWEAKED N=122 v98%=1.5 (OPR1.170623.005-) -->
+            <Limit name="measured-frame-rate-1920x1080" range="17-23" /> <!-- N=114 v98%=1.5 -->
         </MediaCodec>
         <MediaCodec name="OMX.google.vp9.decoder" type="video/x-vnd.on2.vp9" update="true">
-            <Limit name="measured-frame-rate-320x180" range="206-206" /> <!-- N=40 v95%=1.3 -->
-            <Limit name="measured-frame-rate-640x360" range="89-89" /> <!-- N=40 v95%=1.2 -->
-            <Limit name="measured-frame-rate-1280x720" range="35-35" /> <!-- N=40 v95%=1.2 -->
-            <Limit name="measured-frame-rate-1920x1080" range="21-21" /> <!-- N=40 v95%=1.2 -->
+            <Limit name="measured-frame-rate-320x180" range="281-322" /> <!-- N=100 v98%=1.6 -->
+            <!-- measured 98%:104-305 med:121/121 FLAKY(61 - 306 < mx=317.3) -->
+            <Limit name="measured-frame-rate-640x360" range="121-153" /> <!-- N=100 v98%=1.7 -->
+            <Limit name="measured-frame-rate-1280x720" range="53-53" /> <!-- N=100 v98%=1.1 -->
+            <Limit name="measured-frame-rate-1920x1080" range="33-33" /> <!-- N=100 v98%=1.1 -->
         </MediaCodec>
     </Decoders>
 </MediaCodecs>
diff --git a/overlay/frameworks/base/core/res/res/values-mcc310-mnc004/config.xml b/overlay/frameworks/base/core/res/res/values-mcc310-mnc004/config.xml
index 430867d..d88acd6 100644
--- a/overlay/frameworks/base/core/res/res/values-mcc310-mnc004/config.xml
+++ b/overlay/frameworks/base/core/res/res/values-mcc310-mnc004/config.xml
@@ -46,7 +46,7 @@
         <item>INTERMEDIATE_POS=0</item>
         <item>LPP_PROFILE=3</item>
         <item>GPS_LOCK=3</item>
-        <item>SUPL_MODE=0</item>
+        <item>SUPL_MODE=1</item>
         <item>SUPL_ES=1</item>
     </string-array>
 
diff --git a/overlay/frameworks/base/core/res/res/values-mcc310-mnc410/config.xml b/overlay/frameworks/base/core/res/res/values-mcc310-mnc410/config.xml
index f521c62..c889b69 100644
--- a/overlay/frameworks/base/core/res/res/values-mcc310-mnc410/config.xml
+++ b/overlay/frameworks/base/core/res/res/values-mcc310-mnc410/config.xml
@@ -48,4 +48,19 @@
     <string translatable="false" name="config_mobile_hotspot_provision_app_no_ui">com.lge.entitlement.SILENT_ENTITLEMENT_CHECK</string>
     <string translatable="false" name="config_mobile_hotspot_provision_response">com.lge.entitlement.SILENT_ENTITLEMENT_CHECK_RESULT</string>
 
+        <!-- Values for GPS configuration (AT&T) -->
+    <string-array translatable="false" name="config_gpsParameters">
+        <item>SUPL_HOST=supl.google.com</item>
+        <item>SUPL_PORT=7275</item>
+        <item>NTP_SERVER=north-america.pool.ntp.org</item>
+        <item>SUPL_MODE=3</item>
+        <item>SUPL_VER=0x20000</item>
+        <item>LPP_PROFILE=3</item>
+        <item>NMEA_PROVIDER=0</item>
+        <item>A_GLONASS_POS_PROTOCOL_SELECT=0</item>
+        <item>ERR_ESTIMATE=0</item>
+        <item>INTERMEDIATE_POS=0</item>
+        <item>SUPL_ES=0</item>
+    </string-array>
+
 </resources>
diff --git a/overlay/frameworks/base/core/res/res/values-mcc311-mnc480/config.xml b/overlay/frameworks/base/core/res/res/values-mcc311-mnc480/config.xml
index 4acfdcc..2cd087b 100644
--- a/overlay/frameworks/base/core/res/res/values-mcc311-mnc480/config.xml
+++ b/overlay/frameworks/base/core/res/res/values-mcc311-mnc480/config.xml
@@ -46,7 +46,7 @@
         <item>INTERMEDIATE_POS=0</item>
         <item>GPS_LOCK=3</item>
         <item>LPP_PROFILE=3</item>
-        <item>SUPL_MODE=0</item>
+        <item>SUPL_MODE=1</item>
         <item>SUPL_ES=1</item>
     </string-array>
 
diff --git a/overlay/frameworks/base/core/res/res/xml/power_profile.xml b/overlay/frameworks/base/core/res/res/xml/power_profile.xml
index 1c44e72..43a17c2 100644
--- a/overlay/frameworks/base/core/res/res/xml/power_profile.xml
+++ b/overlay/frameworks/base/core/res/res/xml/power_profile.xml
@@ -18,45 +18,43 @@
 -->
 <device name="Android">
     <!-- All values are in mA except as noted -->
+
+    <!-- Nothing -->
     <item name="none">0</item>
-    <item name="screen.on">159.667124493062</item>
-    <item name="screen.full">203.327990537703</item>
-    <item name="bluetooth.active">84.4</item>
-    <item name="bluetooth.on">0.43</item>
-    <item name="wifi.on">0.56</item>
-    <item name="wifi.active">172.99</item>
-    <item name="wifi.scan">25.7523644684504</item>
-    <item name="dsp.audio">100.88</item>
-    <item name="dsp.video">187.86</item>
-    <item name="gps.on">21.3112768663199</item>
-    <item name="radio.active">91.859655777944</item>
-    <!-- The current consumed by the radio when it is scanning for a signal -->
-    <item name="radio.scanning">4.56959643376497</item>
-    <!-- Current consumed by the radio at different signal strengths, when paging -->
-    <array name="radio.on"> <!-- Strength 0 to BINS-1 -->
-        <value>14.718992198734</value>
-        <value>7.11953513364874</value>
-	<value>9.67242765594385</value>
-	<value>10.9664724655329</value>
-	<value>5.9382806608961</value>
+
+    <!-- This is the battery capacity in mAh -->
+    <item name="battery.capacity">2700</item>
+
+    <!-- Number of cores each CPU cluster contains -->
+    <array name="cpu.clusters.cores">
+        <value>4</value> <!-- Cluster 0 has 4 cores (cpu0, cpu1, cpu2, cpu3) -->
+        <value>2</value> <!-- Cluster 1 has 2 cores (cpu4, cpu5) -->
     </array>
+
+    <!-- Power consumption when CPU is suspended -->
+    <item name="cpu.idle">0.075</item>
+    <!-- Additional power consumption when CPU is in a kernel idle loop -->
+    <item name="cpu.awake">4.397</item>
+
     <!-- Different CPU speeds as reported in
-         /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state -->
+         /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies -->
     <array name="cpu.speeds.cluster0">
         <value>384000</value> <!-- 384 MHz CPU speed -->
-        <value>460800</value> <!-- 460.8 MHz CPU speed -->
+        <value>460800</value> <!-- 460 MHz CPU speed -->
         <value>600000</value> <!-- 600 MHz CPU speed -->
         <value>672000</value> <!-- 672 MHz CPU speed -->
-        <value>787200</value> <!-- 787.2 MHz CPU speed -->
+        <value>787200</value> <!-- 787 MHz CPU speed -->
         <value>864000</value> <!-- 864 MHz CPU speed -->
         <value>960000</value> <!-- 960 MHz CPU speed -->
         <value>1248000</value> <!-- 1248 MHz CPU speed -->
         <value>1440000</value> <!-- 1440 MHz CPU speed -->
     </array>
+    <!-- Different CPU speeds as reported in
+         /sys/devices/system/cpu/cpu4/cpufreq/scaling_available_frequencies -->
     <array name="cpu.speeds.cluster1">
         <value>384000</value> <!-- 384 MHz CPU speed -->
         <value>480000</value> <!-- 480 MHz CPU speed -->
-        <value>633600</value> <!-- 633.6 MHz CPU speed -->
+        <value>633600</value> <!-- 633 MHz CPU speed -->
         <value>768000</value> <!-- 768 MHz CPU speed -->
         <value>864000</value> <!-- 864 MHz CPU speed -->
         <value>960000</value> <!-- 960 MHz CPU speed -->
@@ -65,53 +63,80 @@
         <value>1440000</value> <!-- 1440 MHz CPU speed -->
         <value>1536000</value> <!-- 1536 MHz CPU speed -->
         <value>1632000</value> <!-- 1632 MHz CPU speed -->
-        <value>1689600</value> <!-- 1689.6 MHz CPU speed -->
+        <value>1689600</value> <!-- 1689 MHz CPU speed -->
         <value>1824000</value> <!-- 1824 MHz CPU speed -->
     </array>
-    <!-- Power consumption when CPU is idle -->
-    <item name="cpu.idle">3.46965169575592</item>
-    <item name="cpu.awake">1.34521161231221</item>
-    <!-- Power consumption at different speeds -->
-    <array name="cpu.active.cluster0">
-        <value>102.762</value> <!-- 384 MHz CPU speed -->
-        <value>108.702</value> <!-- 460.8 MHz CPU speed -->
-        <value>117.097</value> <!-- 600 MHz CPU speed -->
-        <value>126.066</value> <!-- 672 MHz CPU speed -->
-        <value>134.956</value> <!-- 787.2 MHz CPU speed -->
-        <value>152.321</value> <!-- 864 MHz CPU speed -->
-        <value>174.992</value> <!-- 960 MHz CPU speed -->
-        <value>232.194</value> <!-- 1248 MHz CPU speed -->
-        <value>275.754</value> <!-- 1440 MHz CPU speed -->
-    </array>
-    <array name="cpu.active.cluster1">
-        <value>308.385</value> <!-- 384 MHz CPU speed -->
-        <value>309.652</value> <!-- 480 MHz CPU speed -->
-        <value>310.345</value> <!-- 633.6 MHz CPU speed -->
-        <value>366.795</value> <!-- 768 MHz CPU speed -->
-        <value>407.682</value> <!-- 864 MHz CPU speed -->
-        <value>449.222</value> <!-- 960 MHz CPU speed -->
-        <value>597.979</value> <!-- 1248 MHz CPU speed -->
-        <value>658.785</value> <!-- 1344 MHz CPU speed -->
-        <value>723.789</value> <!-- 1440 MHz CPU speed -->
-        <value>801.563</value> <!-- 1536 MHz CPU speed -->
-        <value>889.732</value> <!-- 1632 MHz CPU speed -->
-        <value>941.965</value> <!-- 1689.6 MHz CPU speed -->
-        <value>1074.40</value> <!-- 1824 MHz CPU speed -->
-    </array>
-    <array name="cpu.clusters.cores">
-        <value>4</value> <!-- Cluster 0 has 4 cores (cpu0, cpu1, cpu2, cpu3) -->
-        <value>2</value> <!-- Cluster 1 has 2 cores (cpu4, cpu5) -->
-    </array>
-    <!-- This is the battery capacity in mAh -->
-    <item name="battery.capacity">2700</item>
 
-    <array name="wifi.batchedscan"> <!-- mA.  Current figures based on .0801 s/c and 75.48mA while scanning -->
-        <value>.0076</value> <!-- 1-8/hr -->
-        <value>.0613</value>  <!-- 9-64/hr -->
-        <value>.4845</value>   <!-- 65-512/hr -->
-        <value>3.870</value>    <!-- 513-4096/hr -->
-        <value>30.96</value>   <!-- 4097-?/hr -->
+    <!-- Additional power used by a CPU from cluster 0 when running at different
+         speeds. Currently this measurement also includes cluster cost. -->
+    <array name="cpu.active.cluster0">
+        <value>77.358</value> <!-- 384 MHz CPU speed -->
+        <value>82.744</value> <!-- 460 MHz CPU speed -->
+        <value>85.913</value> <!-- 600 MHz CPU speed -->
+        <value>91.972</value> <!-- 672 MHz CPU speed -->
+        <value>97.483</value> <!-- 787 MHz CPU speed -->
+        <value>105.882</value> <!-- 864 MHz CPU speed -->
+        <value>113.951</value> <!-- 960 MHz CPU speed -->
+        <value>142.006</value> <!-- 1248 MHz CPU speed -->
+        <value>165.514</value> <!-- 1440 MHz CPU speed -->
     </array>
+    <!-- Additional power used by a CPU from cluster 1 when running at different
+         speeds. Currently this measurement also includes cluster cost. -->
+    <array name="cpu.active.cluster1">
+        <value>132.714</value> <!-- 384 MHz CPU speed -->
+        <value>146.321</value> <!-- 480 MHz CPU speed -->
+        <value>167.495</value> <!-- 633 MHz CPU speed -->
+        <value>194.391</value> <!-- 768 MHz CPU speed -->
+        <value>211.625</value> <!-- 864 MHz CPU speed -->
+        <value>231.291</value> <!-- 960 MHz CPU speed -->
+        <value>298.062</value> <!-- 1248 MHz CPU speed -->
+        <value>325.774</value> <!-- 1344 MHz CPU speed -->
+        <value>353.432</value> <!-- 1440 MHz CPU speed -->
+        <value>389.501</value> <!-- 1536 MHz CPU speed -->
+        <value>427.866</value> <!-- 1632 MHz CPU speed -->
+        <value>444.878</value> <!-- 1689 MHz CPU speed -->
+        <value>496.031</value> <!-- 1824 MHz CPU speed -->
+    </array>
+
+    <!-- Additional power used when screen is turned on at minimum brightness -->
+    <item name="screen.on">97.690</item>
+    <!-- Additional power used when screen is at maximum brightness, compared to
+         screen at minimum brightness -->
+    <item name="screen.full">171.856</item>
+
+    <!-- Average power used by the camera flash module when on -->
+    <item name="camera.flashlight">266.707</item>
+    <!-- Average power use by the camera subsystem for a typical camera
+         application. Intended as a rough estimate for an application running a
+         preview and capturing approximately 10 full-resolution pictures per
+         minute. -->
+    <item name="camera.avg">889.245</item>
+
+    <!-- Additional power used when audio decoding/encoding via DSP -->
+    <item name="dsp.audio">34.523</item>
+    <!-- Additional power used when video decoding via DSP -->
+    <item name="dsp.video">187.86</item>
+
+    <!-- Additional power used when GPS is acquiring a signal -->
+    <item name="gps.on">21.3112768663199</item>
+
+    <!-- Additional power used when Wi-Fi is turned on but not receiving,
+         transmitting, or scanning -->
+    <item name="wifi.on">0.56</item>
+    <!-- Additional power used when transmitting or receiving over Wi-Fi -->
+    <item name="wifi.active">172.99</item>
+    <!-- Additional power used when Wi-Fi is scanning for access points -->
+    <item name="wifi.scan">25.7523644684504</item>
+
+    <!-- mA.  Current figures based on .0801 s/c and 75.48mA while scanning -->
+    <array name="wifi.batchedscan">
+        <value>0.0076</value>   <!-- 1-8/hr -->
+        <value>0.0613</value>   <!-- 9-64/hr -->
+        <value>0.4845</value>   <!-- 65-512/hr -->
+        <value>3.870</value>    <!-- 513-4096/hr -->
+        <value>30.96</value>    <!-- 4097-?/hr -->
+    </array>
+
     <!-- Current at each of the wifi Tx levels in mA. The number of tx levels varies per device
         and is available only of wifi chipsets which support the tx level reporting. Use
         wifi.tx for other chipsets. none by default -->
@@ -280,4 +305,18 @@
         <value>2.324374274</value>
         <value>2.355329002</value>
     </array>
+
+    <!-- Additional power used when cellular radio is transmitting/receiving -->
+    <item name="radio.active">91.859655777944</item>
+    <!-- The current consumed by the radio when it is scanning for a signal -->
+    <item name="radio.scanning">4.56959643376497</item>
+    <!-- Current consumed by the radio at different signal strengths, when paging -->
+    <array name="radio.on"> <!-- Strength 0 to BINS-1 -->
+        <value>14.718992198734</value>
+        <value>7.11953513364874</value>
+	    <value>9.67242765594385</value>
+	    <value>10.9664724655329</value>
+	    <value>5.9382806608961</value>
+    </array>
+
 </device>
diff --git a/overlay/packages/apps/CarrierConfig/res/xml/vendor.xml b/overlay/packages/apps/CarrierConfig/res/xml/vendor.xml
index 4a58f75..1749697 100644
--- a/overlay/packages/apps/CarrierConfig/res/xml/vendor.xml
+++ b/overlay/packages/apps/CarrierConfig/res/xml/vendor.xml
@@ -89,6 +89,9 @@
     <carrier_config mcc="268" mnc="01">
         <boolean name="carrier_volte_available_bool" value="false" />
     </carrier_config>
+    <carrier_config mcc="234" mnc="10" spn="giffgaff">
+        <string name="default_vm_number_string">443</string>
+    </carrier_config>
     <carrier_config mcc="234" mnc="30">
         <boolean name="carrier_wfc_ims_available_bool" value="true" />
         <boolean name="hide_ims_apn_bool" value="true" />
diff --git a/proprietary-blobs.txt b/proprietary-blobs.txt
index e43d98a..e692958 100644
--- a/proprietary-blobs.txt
+++ b/proprietary-blobs.txt
@@ -22,7 +22,6 @@
 /system/bin/diag_klog
 /system/bin/diag_mdlog
 /system/bin/diag_qshrink4_daemon
-/system/bin/halutil
 /system/bin/imsdatadaemon
 /system/bin/imsqmidaemon
 /system/bin/ims_rtp_daemon
diff --git a/self-extractors/extract-lists.txt b/self-extractors/extract-lists.txt
index ef6e01c..d3b20d0 100644
--- a/self-extractors/extract-lists.txt
+++ b/self-extractors/extract-lists.txt
@@ -13,7 +13,6 @@
             system/bin/diag_klog \
             system/bin/diag_mdlog \
             system/bin/diag_qshrink4_daemon \
-            system/bin/halutil \
             system/bin/imsdatadaemon \
             system/bin/imsqmidaemon \
             system/bin/ims_rtp_daemon \
diff --git a/self-extractors/qcom/staging/device-partial.mk b/self-extractors/qcom/staging/device-partial.mk
index c40c585..1087c64 100644
--- a/self-extractors/qcom/staging/device-partial.mk
+++ b/self-extractors/qcom/staging/device-partial.mk
@@ -22,7 +22,6 @@
     vendor/qcom/bullhead/proprietary/diag_klog:system/bin/diag_klog:qcom \
     vendor/qcom/bullhead/proprietary/diag_mdlog:system/bin/diag_mdlog:qcom \
     vendor/qcom/bullhead/proprietary/diag_qshrink4_daemon:system/bin/diag_qshrink4_daemon:qcom \
-    vendor/qcom/bullhead/proprietary/halutil:system/bin/halutil:qcom \
     vendor/qcom/bullhead/proprietary/imsdatadaemon:system/bin/imsdatadaemon:qcom \
     vendor/qcom/bullhead/proprietary/imsqmidaemon:system/bin/imsqmidaemon:qcom \
     vendor/qcom/bullhead/proprietary/ims_rtp_daemon:system/bin/ims_rtp_daemon:qcom \
diff --git a/ueventd.bullhead.rc b/ueventd.bullhead.rc
index 31613db..3138659 100644
--- a/ueventd.bullhead.rc
+++ b/ueventd.bullhead.rc
@@ -79,5 +79,5 @@
 /dev/block/platform/soc.0/f9824900.sdhci/by-name/persistent 0600 system system
 # sensor HUB
 /dev/spich                0640   system     system
-/dev/nanohub              0640   system     system
-/dev/nanohub_comms        0640   system     system
+/dev/nanohub              0660   system     system
+/dev/nanohub_comms        0660   system     system
diff --git a/vendor_owner_info.txt b/vendor_owner_info.txt
index e0dbe38..5812b86 100644
--- a/vendor_owner_info.txt
+++ b/vendor_owner_info.txt
@@ -6,7 +6,6 @@
 system/bin/diag_klog:qcom
 system/bin/diag_mdlog:qcom
 system/bin/diag_qshrink4_daemon:qcom
-system/bin/halutil:qcom
 system/bin/imsdatadaemon:qcom
 system/bin/imsqmidaemon:qcom
 system/bin/ims_rtp_daemon:qcom