Merge "Remove obsolete self-extractors for hikey."
diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk
index 3ab2410..ef4544e 100644
--- a/BoardConfigCommon.mk
+++ b/BoardConfigCommon.mk
@@ -32,7 +32,6 @@
 TARGET_USE_PAN_DISPLAY := true
 
 TARGET_USES_HWC2 := true
-SF_START_GRAPHICS_ALLOCATOR_SERVICE := true
 
 TARGET_AUX_OS_VARIANT_LIST := neonkey argonkey
 
diff --git a/audio/Android.mk b/audio/Android.mk
index c1ba564..0a02789 100644
--- a/audio/Android.mk
+++ b/audio/Android.mk
@@ -22,8 +22,11 @@
 # required type is 'primary'. Other possibilites are 'a2dp', 'usb', etc.
 include $(CLEAR_VARS)
 
+LOCAL_HEADER_LIBRARIES += libhardware_headers
 LOCAL_MODULE := audio.primary.$(TARGET_BOARD_PLATFORM)
 LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_VENDOR_MODULE := true
+
 LOCAL_SRC_FILES := audio_hw.c
 LOCAL_SHARED_LIBRARIES := liblog libcutils libtinyalsa
 LOCAL_CFLAGS := -Wno-unused-parameter
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index ceeea8c..56b3e14 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -23,8 +23,9 @@
 #include <stdint.h>
 #include <sys/time.h>
 #include <stdlib.h>
+#include <unistd.h>
 
-#include <cutils/log.h>
+#include <log/log.h>
 #include <cutils/str_parms.h>
 #include <cutils/properties.h>
 
diff --git a/gralloc/Android.mk b/gralloc/Android.mk
index 7f682fc..8c41842 100644
--- a/gralloc/Android.mk
+++ b/gralloc/Android.mk
@@ -23,11 +23,8 @@
 include $(CLEAR_VARS)
 LOCAL_PRELINK_MODULE := false
 
-ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 21 && echo OK),OK)
-	LOCAL_MODULE_RELATIVE_PATH := hw
-else
-	LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-endif
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_VENDOR_MODULE := true
 
 MALI_DDK_TEST_PATH := hardware/arm/
 
diff --git a/power/Android.mk b/power/Android.mk
index 187d56e..53e464e 100644
--- a/power/Android.mk
+++ b/power/Android.mk
@@ -19,9 +19,13 @@
 # hw/<POWERS_HARDWARE_MODULE_ID>.<ro.hardware>.so
 include $(CLEAR_VARS)
 
-LOCAL_MODULE_RELATIVE_PATH := hw
 LOCAL_SHARED_LIBRARIES := liblog libcutils
 LOCAL_SRC_FILES := power_hikey.c
+
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_VENDOR_MODULE := true
+
+LOCAL_HEADER_LIBRARIES += libhardware_headers
 LOCAL_MODULE := power.$(TARGET_BOARD_PLATFORM)
 LOCAL_MODULE_TAGS := optional
 include $(BUILD_SHARED_LIBRARY)
diff --git a/power/power_hikey.c b/power/power_hikey.c
index 34264d8..f9a3ddb 100644
--- a/power/power_hikey.c
+++ b/power/power_hikey.c
@@ -31,7 +31,7 @@
 //#define LOG_NDEBUG 0
 
 #define LOG_TAG "HiKeyPowerHAL"
-#include <utils/Log.h>
+#include <log/log.h>
 
 #include <hardware/hardware.h>
 #include <hardware/power.h>
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index d9658d3..a356e0b 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -14,12 +14,16 @@
 /dev/hi_vdec	       u:object_r:video_device:s0
 /dev/hi_venc	       u:object_r:video_device:s0
 
+/dev/graphics/fb0      u:object_r:graphics_device:s0
 
 # files in /vendor
 /(vendor|system/vendor)/bin/uim  u:object_r:hci_attach_exec:s0
 /(vendor|system/vendor)/bin/hw/android\.hardware\.bluetooth@1\.0-service\.hikey      u:object_r:hal_bluetooth_hikey_exec:s0
 /(vendor|system/vendor)/bin/nanoapp_cmd  u:object_r:nanoapp_cmd_exec:s0
 
+/(vendor|system/vendor)/lib(64)?/hw/gralloc\.hikey960\.so u:object_r:same_process_hal_file:s0
+/(vendor|system/vendor)/lib(64)?/hw/gralloc\.hikey\.so u:object_r:same_process_hal_file:s0
+
 # /data
 /data/vendor/sensor(/.*)?        u:object_r:sensor_vendor_data_file:s0
 
diff --git a/sepolicy/hal_graphics_allocator_default.te b/sepolicy/hal_graphics_allocator_default.te
new file mode 100644
index 0000000..b17dc7d
--- /dev/null
+++ b/sepolicy/hal_graphics_allocator_default.te
@@ -0,0 +1,2 @@
+allow hal_graphics_allocator_default graphics_device:dir search;
+allow hal_graphics_allocator_default graphics_device:chr_file { open read write ioctl map rw_file_perms};
diff --git a/sepolicy/hal_graphics_composer_default.te b/sepolicy/hal_graphics_composer_default.te
new file mode 100644
index 0000000..d7715de
--- /dev/null
+++ b/sepolicy/hal_graphics_composer_default.te
@@ -0,0 +1,2 @@
+vndbinder_use(hal_graphics_composer_default)
+
diff --git a/sepolicy/init.te b/sepolicy/init.te
index 16d3a3e..7f18b9b 100644
--- a/sepolicy/init.te
+++ b/sepolicy/init.te
@@ -4,3 +4,6 @@
 allow init configfs:lnk_file { create unlink };
 # for symlink /sdcard /mnt/sdcard
 allow init tmpfs:lnk_file create;
+allow init configfs:lnk_file create;
+
+dontaudit init kernel:system module_request;
diff --git a/sepolicy/surfaceflinger.te b/sepolicy/surfaceflinger.te
deleted file mode 100644
index f53f2b4..0000000
--- a/sepolicy/surfaceflinger.te
+++ /dev/null
@@ -1 +0,0 @@
-hal_server_domain(surfaceflinger, hal_graphics_allocator)
diff --git a/sepolicy/system_server.te b/sepolicy/system_server.te
new file mode 100644
index 0000000..335bfe3
--- /dev/null
+++ b/sepolicy/system_server.te
@@ -0,0 +1,5 @@
+# TODO(b/73123675): BatterySaver needs access to cpufreq. Remove this access
+# once cpufreq functionality is hidden behind a HAL.
+allow system_server sysfs_devices_system_cpu:file w_file_perms;
+
+dontaudit system_server self:capability sys_module;
diff --git a/sepolicy/vendor_init.te b/sepolicy/vendor_init.te
deleted file mode 100644
index 733a112..0000000
--- a/sepolicy/vendor_init.te
+++ /dev/null
@@ -1,4 +0,0 @@
-allow vendor_init {
-  hostapd_socket
-  wifi_data_file
-}:dir { create search getattr open read setattr ioctl write add_name remove_name rmdir relabelfrom };
diff --git a/ueventd.common.rc b/ueventd.common.rc
index b76dd4c..ff82f70 100644
--- a/ueventd.common.rc
+++ b/ueventd.common.rc
@@ -11,6 +11,8 @@
 /dev/hifi_misc   0666 system audio
 /dev/hi_vdec     0660 system camera
 /dev/hi_venc     0660 system camera
+/dev/ion	 0666 system graphics
+/dev/graphics/fb0	0666 system graphics
 
 /sys/devices/platform/ddr_devfreq/devfreq/ddr_devfreq		min_freq	0644	system	system
 /sys/devices/platform/e82c0000.mali/devfreq/e82c0000.mali	min_freq	0644	system	system