Skip ab/6749736 in stage.

Merged-In: I6f86b9d412627a64624c55159631a46926df69a5
Change-Id: I6b25082ea23d6337c6fd58c278caeb4177d0c760
diff --git a/device-common.mk b/device-common.mk
index d0f540e..f39d550 100644
--- a/device-common.mk
+++ b/device-common.mk
@@ -138,6 +138,10 @@
 PRODUCT_COPY_FILES += \
     $(LOCAL_PATH)/seccomp_policy/mediaswcodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediaswcodec.policy
 
+# Copy hardware config file(s)
+PRODUCT_COPY_FILES +=  \
+        device/linaro/dragonboard/etc/permissions/android.software.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.xml
+
 # Memtrack
 PRODUCT_PACKAGES += \
     memtrack.default \
diff --git a/etc/permissions/android.software.xml b/etc/permissions/android.software.xml
new file mode 100644
index 0000000..742a086
--- /dev/null
+++ b/etc/permissions/android.software.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 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.
+-->
+
+<!-- These are the hardware components that all handheld devices
+     must include. Devices with optional hardware must also include extra
+     hardware files, per the comments below.
+
+     Handheld devices include phones, mobile Internet devices (MIDs),
+     Personal Media Players (PMPs), small tablets (7" or less), and similar
+     devices.
+-->
+<permissions>
+    <!-- following features are said to be "basic system services"
+         in frameworks/native/data/etc/tablet_core_hardware.xml,
+    -->
+    <feature name="android.software.activities_on_secondary_displays" />
+    <feature name="android.software.autofill" />
+    <feature name="android.software.companion_device_setup" />
+    <feature name="android.software.home_screen" />
+    <feature name="android.software.input_methods" />
+    <feature name="android.software.picture_in_picture" />
+    <feature name="android.software.print" />
+
+    <!-- need by following cts test
+        android.app.cts.ActivityManagerProcessStateTest#testCantSaveStateLaunchAndBackground
+        android.app.cts.ActivityManagerProcessStateTest#testCantSaveStateLaunchAndSwitch
+    -->
+    <feature name="android.software.cant_save_state" />
+
+</permissions>
diff --git a/gralloc/Android.mk b/gralloc/Android.mk
index 049b019..ec1c38e 100644
--- a/gralloc/Android.mk
+++ b/gralloc/Android.mk
@@ -28,7 +28,7 @@
 
 LOCAL_SHARED_LIBRARIES := \
 	libdrm \
-	libgbm \
+	libgbm_mesa \
 	liblog \
 	libcutils
 
diff --git a/gralloc/gralloc.cpp b/gralloc/gralloc.cpp
index c71e901..1cc9f55 100644
--- a/gralloc/gralloc.cpp
+++ b/gralloc/gralloc.cpp
@@ -24,7 +24,7 @@
 
 #define LOG_TAG "GRALLOC-GBM"
 
-#include <cutils/log.h>
+#include <log/log.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
diff --git a/gralloc/gralloc_gbm.cpp b/gralloc/gralloc_gbm.cpp
index bdb41b8..29d11cd 100644
--- a/gralloc/gralloc_gbm.cpp
+++ b/gralloc/gralloc_gbm.cpp
@@ -24,11 +24,12 @@
 
 #define LOG_TAG "GRALLOC-GBM"
 
-#include <cutils/log.h>
+#include <log/log.h>
 #include <cutils/atomic.h>
 #include <cutils/properties.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -382,8 +383,7 @@
 	gbm_bo_handle_map.emplace(handle, bo);
 
 	/* in pixels */
-	struct gralloc_handle_t *ghandle = gralloc_handle(handle);
-	*stride = ghandle->stride / gralloc_gbm_get_bpp(format);
+	*stride = gralloc_handle(handle)->stride / gralloc_gbm_get_bpp(format);
 
 	return handle;
 }
@@ -420,7 +420,7 @@
 		gbm_bo_set_user_data(bo, bo_data, gralloc_gbm_destroy_user_data);
 	}
 
-	ALOGI("lock bo %p, cnt=%d, usage=%x", bo, bo_data->lock_count, usage);
+	ALOGV("lock bo %p, cnt=%d, usage=%x", bo, bo_data->lock_count, usage);
 
 	/* allow multiple locks with compatible usages */
 	if (bo_data->lock_count && (bo_data->locked_for & usage) != usage)
@@ -491,10 +491,10 @@
 {
 	struct gralloc_handle_t *hnd = gralloc_handle(handle);
 	int ystride, cstride;
-	void *addr;
+	void *addr = 0;
 	int err;
 
-	ALOGD("handle %p, hnd %p, usage 0x%x", handle, hnd, usage);
+	ALOGV("handle %p, hnd %p, usage 0x%x", handle, hnd, usage);
 
 	err = gralloc_gbm_bo_lock(handle, usage, x, y, w, h, &addr);
 	if (err)
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index d16f3fc..bf856df 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -40,6 +40,6 @@
 /vendor/lib(64)?/hw/gralloc\.gbm\.so							u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libdrm\.so								u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libdrm_freedreno\.so							u:object_r:same_process_hal_file:s0
-/vendor/lib(64)?/libgbm\.so								u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libgbm_mesa\.so							u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libglapi\.so								u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libqrtr\.so								u:object_r:same_process_hal_file:s0