Changes for p

diff --git a/patches/platform_build/0001-Add-PRODUCT_SYSTEM_DEFAULT_PROPERTIES.patch b/patches/platform_build/0001-Add-PRODUCT_SYSTEM_DEFAULT_PROPERTIES.patch
deleted file mode 100644
index acf8134..0000000
--- a/patches/platform_build/0001-Add-PRODUCT_SYSTEM_DEFAULT_PROPERTIES.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From e0717a868052ab839ad0b589ca7cb869df5ad43f Mon Sep 17 00:00:00 2001
-From: Jaekyun Seok <jaekyun@google.com>
-Date: Fri, 3 Nov 2017 15:18:55 +0900
-Subject: [PATCH 1/4] Add PRODUCT_SYSTEM_DEFAULT_PROPERTIES
-
-PRODUCT_SYSTEM_DEFAULT_PROPERTIES will be used to define system default
-properties which should be installed in system partition.
-
-Bug: 64661857
-Test: confirmed that ART default properties are stored in
-/system/etc/prop.default when they were defined in
-PRODUCT_SYSTEM_DEFAULT_PROPERTIES.
-
-Change-Id: Ia08c25d0c5805381c6e3fe63dd1d171e8d195b90
----
- core/Makefile          | 3 ++-
- core/product-graph.mk  | 1 +
- core/product.mk        | 1 +
- core/product_config.mk | 7 +++++++
- 4 files changed, 11 insertions(+), 1 deletion(-)
-
-diff --git a/core/Makefile b/core/Makefile
-index 618e983..77a817c 100644
---- a/core/Makefile
-+++ b/core/Makefile
-@@ -90,7 +90,8 @@ INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
- endif
- ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
- FINAL_DEFAULT_PROPERTIES := \
--    $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES))
-+    $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) \
-+    $(call collapse-pairs, $(PRODUCT_SYSTEM_DEFAULT_PROPERTIES))
- ifndef property_overrides_split_enabled
-   FINAL_DEFAULT_PROPERTIES += \
-       $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
-diff --git a/core/product-graph.mk b/core/product-graph.mk
-index 36e9037..dc9a296 100644
---- a/core/product-graph.mk
-+++ b/core/product-graph.mk
-@@ -103,6 +103,7 @@ $(OUT_DIR)/products/$(strip $(1)).txt: $(this_makefile)
- 	$(hide) echo 'PRODUCT_MANUFACTURER=$$(PRODUCTS.$(strip $(1)).PRODUCT_MANUFACTURER)' >> $$@
- 	$(hide) echo 'PRODUCT_PROPERTY_OVERRIDES=$$(PRODUCTS.$(strip $(1)).PRODUCT_PROPERTY_OVERRIDES)' >> $$@
- 	$(hide) echo 'PRODUCT_DEFAULT_PROPERTY_OVERRIDES=$$(PRODUCTS.$(strip $(1)).PRODUCT_DEFAULT_PROPERTY_OVERRIDES)' >> $$@
-+	$(hide) echo 'PRODUCT_SYSTEM_DEFAULT_PROPERTIES=$$(PRODUCTS.$(strip $(1)).PRODUCT_SYSTEM_DEFAULT_PROPERTIES)' >> $$@
- 	$(hide) echo 'PRODUCT_CHARACTERISTICS=$$(PRODUCTS.$(strip $(1)).PRODUCT_CHARACTERISTICS)' >> $$@
- 	$(hide) echo 'PRODUCT_COPY_FILES=$$(PRODUCTS.$(strip $(1)).PRODUCT_COPY_FILES)' >> $$@
- 	$(hide) echo 'PRODUCT_OTA_PUBLIC_KEYS=$$(PRODUCTS.$(strip $(1)).PRODUCT_OTA_PUBLIC_KEYS)' >> $$@
-diff --git a/core/product.mk b/core/product.mk
-index 4682dac..ea6cd30 100644
---- a/core/product.mk
-+++ b/core/product.mk
-@@ -112,6 +112,7 @@ _product_var_list := \
-     PRODUCT_SUPPORTS_VERITY \
-     PRODUCT_SUPPORTS_VERITY_FEC \
-     PRODUCT_OEM_PROPERTIES \
-+    PRODUCT_SYSTEM_DEFAULT_PROPERTIES \
-     PRODUCT_SYSTEM_PROPERTY_BLACKLIST \
-     PRODUCT_SYSTEM_SERVER_APPS \
-     PRODUCT_SYSTEM_SERVER_JARS \
-diff --git a/core/product_config.mk b/core/product_config.mk
-index f7ae834..330497f 100644
---- a/core/product_config.mk
-+++ b/core/product_config.mk
-@@ -359,6 +359,13 @@ PRODUCT_DEFAULT_PROPERTY_OVERRIDES := \
-     $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
- .KATI_READONLY := PRODUCT_DEFAULT_PROPERTY_OVERRIDES
- 
-+# A list of property assignments, like "key = value", with zero or more
-+# whitespace characters on either side of the '='.
-+# used for adding properties to default.prop of system partition
-+PRODUCT_SYSTEM_DEFAULT_PROPERTIES := \
-+    $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_DEFAULT_PROPERTIES))
-+.KATI_READONLY := PRODUCT_SYSTEM_DEFAULT_PROPERTIES
-+
- # Should we use the default resources or add any product specific overlays
- PRODUCT_PACKAGE_OVERLAYS := \
-     $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGE_OVERLAYS))
--- 
-2.7.4
-
diff --git a/patches/platform_build/0004-Revert-Remove-root-folder-bt_firmware-in-GSI.patch b/patches/platform_build/0001-Revert-Remove-root-folder-bt_firmware-in-GSI.patch
similarity index 85%
rename from patches/platform_build/0004-Revert-Remove-root-folder-bt_firmware-in-GSI.patch
rename to patches/platform_build/0001-Revert-Remove-root-folder-bt_firmware-in-GSI.patch
index 79dd57e..73a2169 100644
--- a/patches/platform_build/0004-Revert-Remove-root-folder-bt_firmware-in-GSI.patch
+++ b/patches/platform_build/0001-Revert-Remove-root-folder-bt_firmware-in-GSI.patch
@@ -1,7 +1,7 @@
-From b1fd47b99f06d78d728ace3c57d5c9bade5e4831 Mon Sep 17 00:00:00 2001
+From 363cac7dd03a359471d7aa97d7f5d8a8bcba5e11 Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <phh@phh.me>
 Date: Tue, 27 Mar 2018 23:26:49 +0200
-Subject: [PATCH 4/4] Revert "Remove root folder bt_firmware in GSI"
+Subject: [PATCH 1/2] Revert "Remove root folder bt_firmware in GSI"
 
 This reverts commit 292b8433cb48ef4ceb2330e57e11b8f644d9d1ee.
 
@@ -13,7 +13,7 @@
  3 files changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/target/board/generic_arm64_ab/BoardConfig.mk b/target/board/generic_arm64_ab/BoardConfig.mk
-index 6744289..d7b9979 100644
+index fc6b58284b..820019676a 100644
 --- a/target/board/generic_arm64_ab/BoardConfig.mk
 +++ b/target/board/generic_arm64_ab/BoardConfig.mk
 @@ -33,7 +33,7 @@ TARGET_NO_RECOVERY := true
@@ -24,9 +24,9 @@
 +BOARD_ROOT_EXTRA_FOLDERS += bt_firmware firmware firmware/radio persist
  BOARD_ROOT_EXTRA_SYMLINKS := /vendor/lib/dsp:/dsp
  
- # TODO(b/36764215): remove this setting when the generic system image
+ # Set this to create /cache mount point for non-A/B devices that mounts /cache.
 diff --git a/target/board/generic_arm64_ab/sepolicy/file.te b/target/board/generic_arm64_ab/sepolicy/file.te
-index 7adfdfa..4645533 100644
+index 7adfdfa4e6..46455339a0 100644
 --- a/target/board/generic_arm64_ab/sepolicy/file.te
 +++ b/target/board/generic_arm64_ab/sepolicy/file.te
 @@ -1,5 +1,6 @@
@@ -37,7 +37,7 @@
  
  # Default type for anything under /firmware.
 diff --git a/target/board/generic_arm64_ab/sepolicy/file_contexts b/target/board/generic_arm64_ab/sepolicy/file_contexts
-index 0a80559..92a4ff8 100644
+index 0a80559e17..92a4ff8726 100644
 --- a/target/board/generic_arm64_ab/sepolicy/file_contexts
 +++ b/target/board/generic_arm64_ab/sepolicy/file_contexts
 @@ -2,6 +2,7 @@
@@ -49,5 +49,5 @@
  /dsp                    u:object_r:rootfs:s0
  
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_build/0002-Move-ART-default-properties-into-system-partition.patch b/patches/platform_build/0002-Move-ART-default-properties-into-system-partition.patch
deleted file mode 100644
index ec8d0da..0000000
--- a/patches/platform_build/0002-Move-ART-default-properties-into-system-partition.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From edcb0cb74c66637f34746dbcc7f35d6c268dc56e Mon Sep 17 00:00:00 2001
-From: Jaekyun Seok <jaekyun@google.com>
-Date: Fri, 3 Nov 2017 15:33:10 +0900
-Subject: [PATCH 2/4] Move ART default properties into system partition
-
-Bug: 64661857
-Bug: 68755013
-Test: confirmed that ART default properties were stored in
-/system/etc/prop.default on sailfish device
-
-Change-Id: Ie07d3049de5ac395cfb9105e208fe7825080fa15
----
- core/dex_preopt_libart.mk        | 4 +++-
- target/product/runtime_libart.mk | 8 ++++----
- 2 files changed, 7 insertions(+), 5 deletions(-)
-
-diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
-index 9616036..15cb221 100644
---- a/core/dex_preopt_libart.mk
-+++ b/core/dex_preopt_libart.mk
-@@ -30,7 +30,9 @@ DIRTY_IMAGE_OBJECTS := $(call word-colon,1,$(firstword \
-     $(filter %system/etc/dirty-image-objects,$(PRODUCT_COPY_FILES))))
- 
- define get-product-default-property
--$(strip $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))
-+$(strip \
-+  $(eval _prop := $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))\
-+  $(if $(_prop),$(_prop),$(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_SYSTEM_DEFAULT_PROPERTIES)))))
- endef
- 
- DEX2OAT_IMAGE_XMS := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xms)
-diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
-index 8aedee7..f1b8f45 100644
---- a/target/product/runtime_libart.mk
-+++ b/target/product/runtime_libart.mk
-@@ -56,7 +56,7 @@ PRODUCT_PACKAGES += art-tools
- PRODUCT_PACKAGES += \
-     cacerts \
- 
--PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
-+PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
-     dalvik.vm.image-dex2oat-Xms=64m \
-     dalvik.vm.image-dex2oat-Xmx=64m \
-     dalvik.vm.dex2oat-Xms=64m \
-@@ -70,16 +70,16 @@ PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
- # Different dexopt types for different package update/install times.
- # On eng builds, make "boot" reasons only extract for faster turnaround.
- ifeq (eng,$(TARGET_BUILD_VARIANT))
--    PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
-+    PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
-         pm.dexopt.first-boot=extract \
-         pm.dexopt.boot=extract
- else
--    PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
-+    PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
-         pm.dexopt.first-boot=quicken \
-         pm.dexopt.boot=verify
- endif
- 
--PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
-+PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
-     pm.dexopt.install=quicken \
-     pm.dexopt.bg-dexopt=speed-profile \
-     pm.dexopt.ab-ota=speed-profile \
--- 
-2.7.4
-
diff --git a/patches/platform_build/0003-Set-ro.build.fingerprint-in-system-etc-prop.default.patch b/patches/platform_build/0002-Set-ro.build.fingerprint-in-system-etc-prop.default.patch
similarity index 65%
rename from patches/platform_build/0003-Set-ro.build.fingerprint-in-system-etc-prop.default.patch
rename to patches/platform_build/0002-Set-ro.build.fingerprint-in-system-etc-prop.default.patch
index a780cf8..cc97661 100644
--- a/patches/platform_build/0003-Set-ro.build.fingerprint-in-system-etc-prop.default.patch
+++ b/patches/platform_build/0002-Set-ro.build.fingerprint-in-system-etc-prop.default.patch
@@ -1,24 +1,25 @@
-From ed63e5f22b143b683b0d96393d4758f61bfec9ef Mon Sep 17 00:00:00 2001
+From fb0a46552cb2c96658deb171bc83a8184211d864 Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <phh@phh.me>
 Date: Mon, 5 Mar 2018 22:27:50 +0100
-Subject: [PATCH 3/4] Set ro.build.fingerprint in system/etc/prop.default
+Subject: [PATCH 2/2] Set ro.build.fingerprint in system/etc/prop.default
 
+Change-Id: Idceb2a160f70b36aa6806ae60cbfb325367f3b75
 ---
  core/Makefile | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/core/Makefile b/core/Makefile
-index 77a817c..e0f0e91 100644
+index 0a2f6e39d0..059aa98c29 100644
 --- a/core/Makefile
 +++ b/core/Makefile
-@@ -116,6 +116,7 @@ $(INSTALLED_DEFAULT_PROP_TARGET): $(intermediate_system_build_prop)
+@@ -176,6 +176,7 @@ $(INSTALLED_DEFAULT_PROP_TARGET): $(intermediate_system_build_prop)
  	$(hide) echo ro.bootimage.build.date=`$(DATE_FROM_FILE)`>>$@
  	$(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
  	$(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
 +	$(hide) echo ro.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
- 	$(hide) build/tools/post_process_props.py $@
+ 	$(hide) build/make/tools/post_process_props.py $@
  ifdef property_overrides_split_enabled
  	$(hide) mkdir -p $(TARGET_ROOT_OUT)
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_external_selinux/0004-Enable-multipl_decls-by-default.-This-is-needed-beca.patch b/patches/platform_external_selinux/0001-Enable-multipl_decls-by-default.-This-is-needed-beca.patch
similarity index 78%
rename from patches/platform_external_selinux/0004-Enable-multipl_decls-by-default.-This-is-needed-beca.patch
rename to patches/platform_external_selinux/0001-Enable-multipl_decls-by-default.-This-is-needed-beca.patch
index ab6521f..81e554c 100644
--- a/patches/platform_external_selinux/0004-Enable-multipl_decls-by-default.-This-is-needed-beca.patch
+++ b/patches/platform_external_selinux/0001-Enable-multipl_decls-by-default.-This-is-needed-beca.patch
@@ -1,7 +1,7 @@
-From 6afcaac2da4ea0fad2e3aea4b579eddd02523e73 Mon Sep 17 00:00:00 2001
+From d3596d698dfe03369f8947b7da1bed260159426c Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <phh@phh.me>
 Date: Fri, 2 Mar 2018 22:49:55 +0100
-Subject: [PATCH 4/5] Enable multipl_decls by default. This is needed because
+Subject: [PATCH 1/2] Enable multipl_decls by default. This is needed because
  8.0 init doesn't add -m
 
 Change-Id: I43dc661d519f7b8576d72a828d8cbd444592bf5e
@@ -10,7 +10,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/secilc/secilc.c b/secilc/secilc.c
-index 0be6975..e30572e 100644
+index 0be6975b..e30572e5 100644
 --- a/secilc/secilc.c
 +++ b/secilc/secilc.c
 @@ -90,7 +90,7 @@ int main(int argc, char *argv[])
@@ -23,5 +23,5 @@
  	int preserve_tunables = 0;
  	int handle_unknown = -1;
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_external_selinux/0001-libsepol-cil-Add-ability-to-redeclare-types-attribut.patch b/patches/platform_external_selinux/0001-libsepol-cil-Add-ability-to-redeclare-types-attribut.patch
deleted file mode 100644
index d25a8da..0000000
--- a/patches/platform_external_selinux/0001-libsepol-cil-Add-ability-to-redeclare-types-attribut.patch
+++ /dev/null
@@ -1,208 +0,0 @@
-From be352c253dffb5c0d952fbeef905c3269853b7e0 Mon Sep 17 00:00:00 2001
-From: Dan Cashman <dcashman@android.com>
-Date: Tue, 29 Aug 2017 09:32:05 -0700
-Subject: [PATCH 1/5] libsepol: cil: Add ability to redeclare types[attributes]
-
-Modify cil_gen_node() to check to see if the cil_db supports multiple
-declarations, and if so, to check whether or not the
-repeated symbol is eligible to share the existing, already-stored datum. The
-only types considered so far are CIL_TYPE and CIL_TYPEATTRIBUTE, both of
-which intall empty datums during AST building, so they automatically return
-true.
-
-Test: Build policy with multilpe type and attribute declarations, and
-without. Policies are binary-identical.
-
-Signed-off-by: Dan Cashman <dcashman@android.com>
-Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>
----
- libsepol/cil/include/cil/cil.h   |  1 +
- libsepol/cil/src/cil.c           |  5 +++++
- libsepol/cil/src/cil_build_ast.c | 48 ++++++++++++++++++++++++++++++++++------
- libsepol/cil/src/cil_internal.h  |  1 +
- libsepol/src/libsepol.map.in     |  1 +
- secilc/secilc.c                  |  9 +++++++-
- 6 files changed, 57 insertions(+), 8 deletions(-)
-
-diff --git a/libsepol/cil/include/cil/cil.h b/libsepol/cil/include/cil/cil.h
-index 4507892..4df646a 100644
---- a/libsepol/cil/include/cil/cil.h
-+++ b/libsepol/cil/include/cil/cil.h
-@@ -46,6 +46,7 @@ extern int cil_userprefixes_to_string(cil_db_t *db, char **out, size_t *size);
- extern int cil_selinuxusers_to_string(cil_db_t *db, char **out, size_t *size);
- extern int cil_filecons_to_string(cil_db_t *db, char **out, size_t *size);
- extern void cil_set_disable_dontaudit(cil_db_t *db, int disable_dontaudit);
-+extern void cil_set_multiple_decls(cil_db_t *db, int multiple_decls);
- extern void cil_set_disable_neverallow(cil_db_t *db, int disable_neverallow);
- extern void cil_set_preserve_tunables(cil_db_t *db, int preserve_tunables);
- extern int cil_set_handle_unknown(cil_db_t *db, int handle_unknown);
-diff --git a/libsepol/cil/src/cil.c b/libsepol/cil/src/cil.c
-index 9b9ccc3..e8bbbfd 100644
---- a/libsepol/cil/src/cil.c
-+++ b/libsepol/cil/src/cil.c
-@@ -1675,6 +1675,11 @@ void cil_set_mls(struct cil_db *db, int mls)
- 	db->mls = mls;
- }
- 
-+void cil_set_multiple_decls(struct cil_db *db, int multiple_decls)
-+{
-+	db->multiple_decls = multiple_decls;
-+}
-+
- void cil_set_target_platform(struct cil_db *db, int target_platform)
- {
- 	db->target_platform = target_platform;
-diff --git a/libsepol/cil/src/cil_build_ast.c b/libsepol/cil/src/cil_build_ast.c
-index 36cc673..9a10e7a 100644
---- a/libsepol/cil/src/cil_build_ast.c
-+++ b/libsepol/cil/src/cil_build_ast.c
-@@ -82,10 +82,33 @@ exit:
- 	return rc;
- }
- 
-+/*
-+ * Determine whether or not multiple declarations of the same key can share a
-+ * datum, given the new datum and the one already present in a given symtab.
-+ */
-+int cil_is_datum_multiple_decl(__attribute__((unused)) struct cil_symtab_datum *cur,
-+                               __attribute__((unused)) struct cil_symtab_datum *old,
-+                               enum cil_flavor f)
-+{
-+	int rc = CIL_FALSE;
-+
-+	switch (f) {
-+	case CIL_TYPE:
-+	case CIL_TYPEATTRIBUTE:
-+		/* type and typeattribute statements insert empty datums, ret true */
-+		rc = CIL_TRUE;
-+		break;
-+	default:
-+		break;
-+	}
-+	return rc;
-+}
-+
- int cil_gen_node(__attribute__((unused)) struct cil_db *db, struct cil_tree_node *ast_node, struct cil_symtab_datum *datum, hashtab_key_t key, enum cil_sym_index sflavor, enum cil_flavor nflavor)
- {
- 	int rc = SEPOL_ERR;
- 	symtab_t *symtab = NULL;
-+	struct cil_symtab_datum *prev;
- 
- 	rc = __cil_verify_name((const char*)key);
- 	if (rc != SEPOL_OK) {
-@@ -103,15 +126,26 @@ int cil_gen_node(__attribute__((unused)) struct cil_db *db, struct cil_tree_node
- 	if (symtab != NULL) {
- 		rc = cil_symtab_insert(symtab, (hashtab_key_t)key, datum, ast_node);
- 		if (rc == SEPOL_EEXIST) {
--			cil_log(CIL_ERR, "Re-declaration of %s %s\n", 
--				cil_node_to_string(ast_node), key);
--			if (cil_symtab_get_datum(symtab, key, &datum) == SEPOL_OK) {
--				if (sflavor == CIL_SYM_BLOCKS) {
--					struct cil_tree_node *node = datum->nodes->head->data;
--					cil_tree_log(node, CIL_ERR, "Previous declaration");
-+			if (!db->multiple_decls ||
-+			    cil_symtab_get_datum(symtab, (hashtab_key_t)key, &prev) != SEPOL_OK ||
-+			    !cil_is_datum_multiple_decl(datum, prev, nflavor)) {
-+
-+				/* multiple_decls not ok, ret error */
-+				cil_log(CIL_ERR, "Re-declaration of %s %s\n",
-+					cil_node_to_string(ast_node), key);
-+				if (cil_symtab_get_datum(symtab, key, &datum) == SEPOL_OK) {
-+					if (sflavor == CIL_SYM_BLOCKS) {
-+						struct cil_tree_node *node = datum->nodes->head->data;
-+						cil_tree_log(node, CIL_ERR, "Previous declaration");
-+					}
- 				}
-+				goto exit;
- 			}
--			goto exit;
-+			/* multiple_decls is enabled and works for this datum type, add node */
-+			cil_list_append(prev->nodes, CIL_NODE, ast_node);
-+			ast_node->data = prev;
-+			cil_symtab_datum_destroy(datum);
-+			free(datum);
- 		}
- 	}
- 
-diff --git a/libsepol/cil/src/cil_internal.h b/libsepol/cil/src/cil_internal.h
-index aee3f00..abfacd8 100644
---- a/libsepol/cil/src/cil_internal.h
-+++ b/libsepol/cil/src/cil_internal.h
-@@ -312,6 +312,7 @@ struct cil_db {
- 	int preserve_tunables;
- 	int handle_unknown;
- 	int mls;
-+	int multiple_decls;
- 	int target_platform;
- 	int policy_version;
- };
-diff --git a/libsepol/src/libsepol.map.in b/libsepol/src/libsepol.map.in
-index 4042640..edd98d5 100644
---- a/libsepol/src/libsepol.map.in
-+++ b/libsepol/src/libsepol.map.in
-@@ -47,6 +47,7 @@ LIBSEPOL_1.1 {
- 	cil_set_mls;
- 	cil_set_attrs_expand_generated;
- 	cil_set_attrs_expand_size;
-+	cil_set_multiple_decls;
- 	cil_write_policy_conf;
- 	sepol_ppfile_to_module_package;
- 	sepol_module_package_to_cil;
-diff --git a/secilc/secilc.c b/secilc/secilc.c
-index f2232e7..0be6975 100644
---- a/secilc/secilc.c
-+++ b/secilc/secilc.c
-@@ -63,6 +63,7 @@ static __attribute__((__noreturn__)) void usage(const char *prog)
- 	printf("                                 statement if present in the policy\n");
- 	printf("  -D, --disable-dontaudit        do not add dontaudit rules to the binary policy\n");
- 	printf("  -P, --preserve-tunables        treat tunables as booleans\n");
-+	printf("  -m, --multiple-decls           allow some statements to be re-declared\n");
- 	printf("  -N, --disable-neverallow       do not check neverallow rules\n");
- 	printf("  -G, --expand-generated         Expand and remove auto-generated attributes\n");
- 	printf("  -X, --expand-size <SIZE>       Expand type attributes with fewer than <SIZE>\n");
-@@ -89,6 +90,7 @@ int main(int argc, char *argv[])
- 	int target = SEPOL_TARGET_SELINUX;
- 	int mls = -1;
- 	int disable_dontaudit = 0;
-+	int multiple_decls = 0;
- 	int disable_neverallow = 0;
- 	int preserve_tunables = 0;
- 	int handle_unknown = -1;
-@@ -108,6 +110,7 @@ int main(int argc, char *argv[])
- 		{"policyversion", required_argument, 0, 'c'},
- 		{"handle-unknown", required_argument, 0, 'U'},
- 		{"disable-dontaudit", no_argument, 0, 'D'},
-+		{"multiple-decls", no_argument, 0, 'm'},
- 		{"disable-neverallow", no_argument, 0, 'N'},
- 		{"preserve-tunables", no_argument, 0, 'P'},
- 		{"output", required_argument, 0, 'o'},
-@@ -119,7 +122,7 @@ int main(int argc, char *argv[])
- 	int i;
- 
- 	while (1) {
--		opt_char = getopt_long(argc, argv, "o:f:U:hvt:M:PDNc:GX:", long_opts, &opt_index);
-+		opt_char = getopt_long(argc, argv, "o:f:U:hvt:M:PDmNc:GX:", long_opts, &opt_index);
- 		if (opt_char == -1) {
- 			break;
- 		}
-@@ -175,6 +178,9 @@ int main(int argc, char *argv[])
- 			case 'D':
- 				disable_dontaudit = 1;
- 				break;
-+			case 'm':
-+				multiple_decls = 1;
-+				break;
- 			case 'N':
- 				disable_neverallow = 1;
- 				break;
-@@ -223,6 +229,7 @@ int main(int argc, char *argv[])
- 
- 	cil_db_init(&db);
- 	cil_set_disable_dontaudit(db, disable_dontaudit);
-+	cil_set_multiple_decls(db, multiple_decls);
- 	cil_set_disable_neverallow(db, disable_neverallow);
- 	cil_set_preserve_tunables(db, preserve_tunables);
- 	if (handle_unknown != -1) {
--- 
-2.7.4
-
diff --git a/patches/platform_external_selinux/0006-Increase-default-log_level-to-get-actual-selinux-err.patch b/patches/platform_external_selinux/0002-Increase-default-log_level-to-get-actual-selinux-err.patch
similarity index 78%
rename from patches/platform_external_selinux/0006-Increase-default-log_level-to-get-actual-selinux-err.patch
rename to patches/platform_external_selinux/0002-Increase-default-log_level-to-get-actual-selinux-err.patch
index 8431dd5..dd8304e 100644
--- a/patches/platform_external_selinux/0006-Increase-default-log_level-to-get-actual-selinux-err.patch
+++ b/patches/platform_external_selinux/0002-Increase-default-log_level-to-get-actual-selinux-err.patch
@@ -1,7 +1,7 @@
-From 4ff61714d1a790cafc868c1aba0c24d646e45cc0 Mon Sep 17 00:00:00 2001
+From eedcd37068e8d02f37a002a65fefd1207099d7de Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <phh@phh.me>
 Date: Mon, 9 Apr 2018 00:19:49 +0200
-Subject: [PATCH 6/6] Increase default log_level to get actual selinux error in
+Subject: [PATCH 2/2] Increase default log_level to get actual selinux error in
  kmsg
 
 ---
@@ -9,7 +9,7 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/secilc/secilc.c b/secilc/secilc.c
-index e30572e..4a1b09e 100644
+index e30572e5..4a1b09e1 100644
 --- a/secilc/secilc.c
 +++ b/secilc/secilc.c
 @@ -101,7 +101,7 @@ int main(int argc, char *argv[])
@@ -22,5 +22,5 @@
  		{"help", no_argument, 0, 'h'},
  		{"verbose", no_argument, 0, 'v'},
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_external_selinux/0002-libsepol-cil-Keep-type-attribute-declarations-when-a.patch b/patches/platform_external_selinux/0002-libsepol-cil-Keep-type-attribute-declarations-when-a.patch
deleted file mode 100644
index 77dc2cf..0000000
--- a/patches/platform_external_selinux/0002-libsepol-cil-Keep-type-attribute-declarations-when-a.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-From 0a0c8e77b3a55c70ef55cd78aa5c2a4bce5b0862 Mon Sep 17 00:00:00 2001
-From: Dan Cashman <dcashman@google.com>
-Date: Wed, 11 Oct 2017 12:59:43 -0700
-Subject: [PATCH 2/5] libsepol: cil: Keep type[attribute] declarations when
- attributizing.
-
-cil_android_attributize() uses a source policy to identify types and
-attributes to be versioned according to the given version number, and
-then proceeds to modify the provided target policy to provide this
-versioning.  Previously, the versioned policy relied on a base policy
-for the declarations of these type[attribute]s, but with multiple_decl
-support added, the declarations can be made in both places.  This will
-make the policy more robust and allow for greater flexibility and the
-types of base policy used.
-
-Bug: 37915794
-Test: Builds 'n' boots.  non_plat_sepolicy.cil now contains the public
-type[attribute] declarations.
-
-Change-Id: Iaa084211a9e2774a7ed391888fb21c4c0cf955db
----
- libsepol/cil/include/cil/android.h |  2 ++
- libsepol/cil/src/android.c         | 17 ++++++++---------
- 2 files changed, 10 insertions(+), 9 deletions(-)
-
-diff --git a/libsepol/cil/include/cil/android.h b/libsepol/cil/include/cil/android.h
-index 082d7fd..5aceda6 100644
---- a/libsepol/cil/include/cil/android.h
-+++ b/libsepol/cil/include/cil/android.h
-@@ -21,6 +21,8 @@ int cil_android_attrib_mapping(struct cil_db **mdb, struct cil_db *srcdb, const
- /*
-  * cil_android_attributize - extract attributizable elements of the policy in
-  * srcdb and convert all usage of those elements in tgtdb to versioned attributes.
-+ * Keep the attributes and type definitions so that tgtdb policy is more robust
-+ * against future changes to the public policy.
-  *   tgtdb - initialized and parsed cil_db reference to modify.
-  *   srcdb - initialized and parsed cil_db reference to source public policy
-  *           from which to extract attributizable elements.
-diff --git a/libsepol/cil/src/android.c b/libsepol/cil/src/android.c
-index 1d80046..53df418 100644
---- a/libsepol/cil/src/android.c
-+++ b/libsepol/cil/src/android.c
-@@ -200,23 +200,27 @@ static char *__cil_attrib_get_versname(char *old, const char *vers)
- 
- /*
-  * Change type to attribute - create new versioned name based on old, create
-- * typeattribute node and replace existing type node.
-+ * typeattribute node add to the existing type node.
-  */
- static int __cil_attrib_convert_type(struct cil_tree_node *node, struct version_args *args)
- {
- 	int rc = SEPOL_ERR;
- 	struct cil_type *type = (struct cil_type *)node->data;
- 	struct cil_typeattribute *typeattr = NULL;
-+	struct cil_tree_node *new_ast_node = NULL;
- 	char *new_key;
- 
- 	cil_typeattribute_init(&typeattr);
- 
- 	new_key = __cil_attrib_get_versname(type->datum.name, args->num);
- 
--	cil_symtab_datum_remove_node(&type->datum, node);
--	cil_destroy_type(type);
-+	/* create new tree node to contain typeattribute and add to tree */
-+	cil_tree_node_init(&new_ast_node);
-+	new_ast_node->parent = node->parent;
-+	new_ast_node->next = node->next;
-+	node->next = new_ast_node;
- 
--	rc = cil_gen_node(args->db, node, (struct cil_symtab_datum *) typeattr,
-+	rc = cil_gen_node(args->db, new_ast_node, (struct cil_symtab_datum *) typeattr,
- 			  new_key, CIL_SYM_TYPES, CIL_TYPEATTRIBUTE);
- 	if (rc != SEPOL_OK) {
- 		goto exit;
-@@ -422,11 +426,6 @@ static int cil_attrib_typeattribute(struct cil_tree_node *node, struct version_a
- 		if (rc != SEPOL_OK) {
- 			goto exit;
- 		}
--	} else if (__cil_get_plat_flavor(args->vers_map, key) == PLAT_ATTRIB) {
--		// platform attribute declaration to be provided by platform policy
--		cil_symtab_datum_remove_node(&typeattr->datum, node);
--		cil_destroy_typeattribute(typeattr);
--		node->flavor = CIL_NONE; // traversal relies on this node sticking around, empty it.
- 	}
- 
- 	return SEPOL_OK;
--- 
-2.7.4
-
diff --git a/patches/platform_external_selinux/0003-libsepol-cil-Create-new-keep-field-for-type-attribut.patch b/patches/platform_external_selinux/0003-libsepol-cil-Create-new-keep-field-for-type-attribut.patch
deleted file mode 100644
index 875fef9..0000000
--- a/patches/platform_external_selinux/0003-libsepol-cil-Create-new-keep-field-for-type-attribut.patch
+++ /dev/null
@@ -1,138 +0,0 @@
-From 92fac49b74a4d83bd07b086e35f3e7dfe84fd429 Mon Sep 17 00:00:00 2001
-From: James Carter <jwcart2@tycho.nsa.gov>
-Date: Fri, 17 Nov 2017 08:09:52 -0500
-Subject: [PATCH 3/5] libsepol/cil: Create new keep field for type attribute
- sets
-
-Daniel Cashman <dcashman@android.com> discovered the following:
-When using cil_db multiple_decls, the different cil_attribute nodes
-all point to the same underlying cil_attribute struct.  This leads
-to problems, though, when modifying the used value in the struct.
-__cil_post_db_attr() changes the value of the field to based on
-the output of cil_typeattribute_used(), for use later in
-cil_typeattribute_to_policydb and cil_typeattribute_to_bitmap, but
-due to the multiple declarations, cil_typeattribute_used() could be
-called again by a second node.  In this second call, the value used
-is the modifed value of CIL_TRUE or CIL_FALSE, not the flags actually
-needed. This could result in the field being reset again, to an
-incorrect CIL_FALSE value.
-
-Add the field "keep" to struct cil_typeattributeset, set its value
-using cil_typeattribute_used(), and use it when determining whether
-the attribute is to be kept or if it should be expanded.
-
-Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>
----
- libsepol/cil/src/cil.c           | 1 +
- libsepol/cil/src/cil_binary.c    | 8 ++++----
- libsepol/cil/src/cil_internal.h  | 1 +
- libsepol/cil/src/cil_policy.c    | 2 +-
- libsepol/cil/src/cil_post.c      | 2 +-
- libsepol/cil/src/cil_reset_ast.c | 1 +
- 6 files changed, 9 insertions(+), 6 deletions(-)
-
-diff --git a/libsepol/cil/src/cil.c b/libsepol/cil/src/cil.c
-index e8bbbfd..a5a3e26 100644
---- a/libsepol/cil/src/cil.c
-+++ b/libsepol/cil/src/cil.c
-@@ -2038,6 +2038,7 @@ void cil_typeattribute_init(struct cil_typeattribute **attr)
- 	(*attr)->expr_list = NULL;
- 	(*attr)->types = NULL;
- 	(*attr)->used = CIL_FALSE;
-+	(*attr)->keep = CIL_FALSE;
- }
- 
- void cil_typeattributeset_init(struct cil_typeattributeset **attrset)
-diff --git a/libsepol/cil/src/cil_binary.c b/libsepol/cil/src/cil_binary.c
-index e1481a4..1818ffa 100644
---- a/libsepol/cil/src/cil_binary.c
-+++ b/libsepol/cil/src/cil_binary.c
-@@ -567,7 +567,7 @@ int cil_typeattribute_to_policydb(policydb_t *pdb, struct cil_typeattribute *cil
- 	char *key = NULL;
- 	type_datum_t *sepol_attr = NULL;
- 
--	if (!cil_attr->used) {
-+	if (!cil_attr->keep) {
- 		return SEPOL_OK;		
- 	}
- 
-@@ -632,7 +632,7 @@ int cil_typeattribute_to_bitmap(policydb_t *pdb, const struct cil_db *db, struct
- 	ebitmap_node_t *tnode;
- 	unsigned int i;
- 
--	if (!cil_attr->used) {
-+	if (!cil_attr->keep) {
- 		return SEPOL_OK;
- 	}
- 
-@@ -1442,7 +1442,7 @@ static int __cil_should_expand_attribute( const struct cil_db *db, struct cil_sy
- 
- 	attr = (struct cil_typeattribute *)datum;
- 
--	return !attr->used || (ebitmap_cardinality(attr->types) < db->attrs_expand_size);
-+	return !attr->keep || (ebitmap_cardinality(attr->types) < db->attrs_expand_size);
- }
- 
- int __cil_avrule_to_avtab(policydb_t *pdb, const struct cil_db *db, struct cil_avrule *cil_avrule, cond_node_t *cond_node, enum cil_flavor cond_flavor)
-@@ -2525,7 +2525,7 @@ int __cil_constrain_expr_datum_to_sepol_expr(policydb_t *pdb, const struct cil_d
- 			if (rc != SEPOL_OK) {
- 				if (FLAVOR(item->data) == CIL_TYPEATTRIBUTE) {
- 					struct cil_typeattribute *attr = item->data;
--					if (!attr->used) {
-+					if (!attr->keep) {
- 						rc = 0;
- 					}
- 				}
-diff --git a/libsepol/cil/src/cil_internal.h b/libsepol/cil/src/cil_internal.h
-index abfacd8..942b28f 100644
---- a/libsepol/cil/src/cil_internal.h
-+++ b/libsepol/cil/src/cil_internal.h
-@@ -527,6 +527,7 @@ struct cil_typeattribute {
- 	struct cil_list *expr_list;
- 	ebitmap_t *types;
- 	int used;	// whether or not this attribute was used in a binary policy rule
-+	int keep;
- };
- 
- struct cil_typeattributeset {
-diff --git a/libsepol/cil/src/cil_policy.c b/libsepol/cil/src/cil_policy.c
-index 77179e6..3e51133 100644
---- a/libsepol/cil/src/cil_policy.c
-+++ b/libsepol/cil/src/cil_policy.c
-@@ -1085,7 +1085,7 @@ static void cil_typeattributes_to_policy(FILE *out, struct cil_list *types, stru
- 		type = i1->data;
- 		cil_list_for_each(i2, attributes) {
- 			attribute = i2->data;
--			if (!attribute->used)
-+			if (!attribute->keep)
- 				continue;
- 			if (ebitmap_get_bit(attribute->types, type->value)) {
- 				if (first) {
-diff --git a/libsepol/cil/src/cil_post.c b/libsepol/cil/src/cil_post.c
-index 1941fab..a30de0e 100644
---- a/libsepol/cil/src/cil_post.c
-+++ b/libsepol/cil/src/cil_post.c
-@@ -1250,7 +1250,7 @@ static int __cil_post_db_attr_helper(struct cil_tree_node *node, uint32_t *finis
- 			rc = __evaluate_type_expression(attr, db);
- 			if (rc != SEPOL_OK) goto exit;
- 		}
--		attr->used = cil_typeattribute_used(attr, db);
-+		attr->keep = cil_typeattribute_used(attr, db);
- 		break;
- 	}
- 	case CIL_ROLEATTRIBUTE: {
-diff --git a/libsepol/cil/src/cil_reset_ast.c b/libsepol/cil/src/cil_reset_ast.c
-index 676e156..142179e 100644
---- a/libsepol/cil/src/cil_reset_ast.c
-+++ b/libsepol/cil/src/cil_reset_ast.c
-@@ -186,6 +186,7 @@ static void cil_reset_typeattr(struct cil_typeattribute *attr)
- 		attr->expr_list = NULL;
- 	}
- 	attr->used = CIL_FALSE;
-+	attr->keep = CIL_FALSE;
- }
- 
- static void cil_reset_typeattributeset(struct cil_typeattributeset *tas)
--- 
-2.7.4
-
diff --git a/patches/platform_external_selinux/0005-libsepol-cil-Improve-processing-of-context-rules.patch b/patches/platform_external_selinux/0005-libsepol-cil-Improve-processing-of-context-rules.patch
deleted file mode 100644
index c5241e0..0000000
--- a/patches/platform_external_selinux/0005-libsepol-cil-Improve-processing-of-context-rules.patch
+++ /dev/null
@@ -1,377 +0,0 @@
-From 9b009c3354946ec04c60b87d344ed2abbe63c4ba Mon Sep 17 00:00:00 2001
-From: James Carter <jwcart2@tycho.nsa.gov>
-Date: Thu, 29 Mar 2018 16:06:49 -0400
-Subject: [PATCH 5/5] libsepol/cil: Improve processing of context rules
-
-Improve the processing of netifcon, genfscon, ibpkeycon, ibendportcon,
-portcon, nodecon, fsuse, filecon, iomemcon, ioportcon, pcidevicecon,
-and devicetreecon rules.
-
-If the multiple-decls option is not used then report errors if duplicate
-context rules are found. If it is used then remove duplicate context rules
-and report errors when two rules are identical except for the context.
-
-This also changes the ordering of portcon and filecon rules. The protocol
-of portcon rules will be compared if the port numbers are the same and the
-path strings of filecon rules will be compared if the number of meta
-characters, the stem length, string length and file types are the same.
-
-Based on an initial patch by Pierre-Hugues Husson (phh@phh.me)
-
-Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>
----
- libsepol/cil/src/cil_post.c | 303 ++++++++++++++++++++++++++++++++++++++++++--
- 1 file changed, 292 insertions(+), 11 deletions(-)
-
-diff --git a/libsepol/cil/src/cil_post.c b/libsepol/cil/src/cil_post.c
-index a30de0e..3799350 100644
---- a/libsepol/cil/src/cil_post.c
-+++ b/libsepol/cil/src/cil_post.c
-@@ -53,6 +53,83 @@
- static int __cil_expr_to_bitmap(struct cil_list *expr, ebitmap_t *out, int max, struct cil_db *db);
- static int __cil_expr_list_to_bitmap(struct cil_list *expr_list, ebitmap_t *out, int max, struct cil_db *db);
- 
-+static int cats_compare(struct cil_cats *a, struct cil_cats *b)
-+{
-+	struct cil_list_item *i, *j;
-+	int rc;
-+
-+	if (a == b) return 0;
-+	if (!a) return -1;
-+	if (!b) return 1;
-+
-+	/* Expects cat expression to have been evaluated */
-+	cil_list_for_each(i, a->datum_expr) {
-+		cil_list_for_each(j, b->datum_expr) {
-+			rc = strcmp(DATUM(i->data)->fqn, DATUM(j->data)->fqn);
-+			if (!rc) return rc;
-+		}
-+	}
-+	return 0;
-+}
-+
-+static int level_compare(struct cil_level *a, struct cil_level *b)
-+{
-+	int rc;
-+
-+	if (a == b) return 0;
-+	if (!a) return -1;
-+	if (!b) return 1;
-+
-+	if (a->sens != b->sens) {
-+		rc = strcmp(DATUM(a->sens)->fqn, DATUM(b->sens)->fqn);
-+		if (rc != 0) return rc;
-+	}
-+	if (a->cats != b->cats) {
-+		return cats_compare(a->cats, b->cats);
-+	}
-+	return 0;
-+}
-+
-+static int range_compare(struct cil_levelrange *a, struct cil_levelrange *b)
-+{
-+	int rc;
-+
-+	if (a == b) return 0;
-+	if (!a) return -1;
-+	if (!b) return 1;
-+
-+	if (a->low != b->low) {
-+		rc = level_compare(a->low, b->low);
-+		if (rc != 0) return rc;
-+	}
-+	if (a->high != b->high) {
-+		return level_compare(a->high, b->high);
-+	}
-+	return 0;
-+}
-+
-+static int context_compare(struct cil_context *a, struct cil_context *b)
-+{
-+	int rc;
-+
-+	if (a->user != b->user) {
-+		rc = strcmp(DATUM(a->user)->fqn, DATUM(b->user)->fqn);
-+		if (rc != 0) return rc;
-+	}
-+	if (a->role != b->role) {
-+		rc = strcmp(DATUM(a->role)->fqn, DATUM(b->role)->fqn);
-+		if (rc != 0) return rc;
-+	}
-+	if (a->type != b->type) {
-+		rc = strcmp(DATUM(a->type)->fqn, DATUM(b->type)->fqn);
-+		if (rc != 0) return rc;
-+	}
-+	if (a->range != b->range) {
-+		return range_compare(a->range, b->range);
-+	}
-+	return 0;
-+}
-+
- static int cil_verify_is_list(struct cil_list *list, enum cil_flavor flavor)
- {
- 	struct cil_list_item *curr;
-@@ -144,6 +221,8 @@ int cil_post_filecon_compare(const void *a, const void *b)
- 		rc = -1;
- 	} else if (b_filecon->type < a_filecon->type) {
- 		rc = 1;
-+	} else {
-+		rc = strcmp(a_filecon->path_str, b_filecon->path_str);
- 	}
- 
- 	free(a_path);
-@@ -167,6 +246,10 @@ int cil_post_portcon_compare(const void *a, const void *b)
- 			rc = -1;
- 		} else if (bportcon->port_low < aportcon->port_low) {
- 			rc = 1;
-+		} else if (aportcon->proto < bportcon->proto) {
-+			rc = -1;
-+		} else if (aportcon->proto > bportcon->proto) {
-+			rc = 1;
- 		}
- 	}
- 
-@@ -327,6 +410,88 @@ int cil_post_fsuse_compare(const void *a, const void *b)
- 	return rc;
- }
- 
-+int cil_post_filecon_context_compare(const void *a, const void *b)
-+{
-+	struct cil_filecon *a_filecon = *(struct cil_filecon**)a;
-+	struct cil_filecon *b_filecon = *(struct cil_filecon**)b;
-+	return context_compare(a_filecon->context, b_filecon->context);
-+}
-+
-+int cil_post_portcon_context_compare(const void *a, const void *b)
-+{
-+	struct cil_portcon *a_portcon = *(struct cil_portcon**)a;
-+	struct cil_portcon *b_portcon = *(struct cil_portcon**)b;
-+	return context_compare(a_portcon->context, b_portcon->context);
-+}
-+
-+int cil_post_genfscon_context_compare(const void *a, const void *b)
-+{
-+	struct cil_genfscon *a_genfscon = *(struct cil_genfscon**)a;
-+	struct cil_genfscon *b_genfscon = *(struct cil_genfscon**)b;
-+	return context_compare(a_genfscon->context, b_genfscon->context);
-+}
-+
-+int cil_post_netifcon_context_compare(const void *a, const void *b)
-+{
-+	int rc;
-+	struct cil_netifcon *a_netifcon = *(struct cil_netifcon**)a;
-+	struct cil_netifcon *b_netifcon = *(struct cil_netifcon**)b;
-+	rc = context_compare(a_netifcon->if_context, b_netifcon->if_context);
-+	if (rc != 0) {
-+		return rc;
-+	}
-+	return context_compare(a_netifcon->packet_context, b_netifcon->packet_context);
-+}
-+
-+int cil_post_nodecon_context_compare(const void *a, const void *b)
-+{
-+	struct cil_nodecon *a_nodecon = *(struct cil_nodecon **)a;
-+	struct cil_nodecon *b_nodecon = *(struct cil_nodecon **)b;
-+	return context_compare(a_nodecon->context, b_nodecon->context);
-+}
-+
-+int cil_post_pirqcon_context_compare(const void *a, const void *b)
-+{
-+	struct cil_pirqcon *a_pirqcon = *(struct cil_pirqcon**)a;
-+	struct cil_pirqcon *b_pirqcon = *(struct cil_pirqcon**)b;
-+	return context_compare(a_pirqcon->context, b_pirqcon->context);
-+}
-+
-+int cil_post_iomemcon_context_compare(const void *a, const void *b)
-+{
-+	struct cil_iomemcon *a_iomemcon = *(struct cil_iomemcon**)a;
-+	struct cil_iomemcon *b_iomemcon = *(struct cil_iomemcon**)b;
-+	return context_compare(a_iomemcon->context, b_iomemcon->context);
-+}
-+
-+int cil_post_ioportcon_context_compare(const void *a, const void *b)
-+{
-+	struct cil_ioportcon *a_ioportcon = *(struct cil_ioportcon**)a;
-+	struct cil_ioportcon *b_ioportcon = *(struct cil_ioportcon**)b;
-+	return context_compare(a_ioportcon->context, b_ioportcon->context);
-+}
-+
-+int cil_post_pcidevicecon_context_compare(const void *a, const void *b)
-+{
-+	struct cil_pcidevicecon *a_pcidevicecon = *(struct cil_pcidevicecon**)a;
-+	struct cil_pcidevicecon *b_pcidevicecon = *(struct cil_pcidevicecon**)b;
-+	return context_compare(a_pcidevicecon->context, b_pcidevicecon->context);
-+}
-+
-+int cil_post_devicetreecon_context_compare(const void *a, const void *b)
-+{
-+	struct cil_devicetreecon *a_devicetreecon = *(struct cil_devicetreecon**)a;
-+	struct cil_devicetreecon *b_devicetreecon = *(struct cil_devicetreecon**)b;
-+	return context_compare(a_devicetreecon->context, b_devicetreecon->context);
-+}
-+
-+int cil_post_fsuse_context_compare(const void *a, const void *b)
-+{
-+	struct cil_fsuse *a_fsuse = *(struct cil_fsuse**)a;
-+	struct cil_fsuse *b_fsuse = *(struct cil_fsuse**)b;
-+	return context_compare(a_fsuse->context, b_fsuse->context);
-+}
-+
- static int __cil_post_db_count_helper(struct cil_tree_node *node, uint32_t *finished, void *extra_args)
- {
- 	struct cil_db *db = extra_args;
-@@ -1929,6 +2094,74 @@ exit:
- 	return rc;
- }
- 
-+static int __cil_post_report_conflict(struct cil_tree_node *node, uint32_t *finished, void *extra_args)
-+{
-+	struct cil_list_item *li = extra_args;
-+
-+	if (node->flavor == CIL_BLOCK) {
-+		struct cil_block *blk = node->data;
-+		if (blk->is_abstract == CIL_TRUE) {
-+			*finished = CIL_TREE_SKIP_HEAD;
-+		}
-+	} else if (node->flavor == CIL_MACRO) {
-+		*finished = CIL_TREE_SKIP_HEAD;
-+	} else if (node->flavor == li->flavor) {
-+		if (node->data == li->data) {
-+			char *path = cil_tree_get_cil_path(node);
-+			cil_log(CIL_WARN, "  at %s:%d\n", path, node->line);
-+		}
-+	}
-+	return SEPOL_OK;
-+}
-+
-+static int __cil_post_process_context_rules(struct cil_sort *sort, int (*compar)(const void *, const void *), int (*concompar)(const void *, const void *), struct cil_db *db, enum cil_flavor flavor, const char *flavor_str)
-+{
-+	uint32_t count = sort->count;
-+	uint32_t i, j = 0, removed = 0;
-+	int rc = SEPOL_OK;
-+
-+	if (count < 2) {
-+		return SEPOL_OK;
-+	}
-+
-+	qsort(sort->array, sort->count, sizeof(sort->array), compar);
-+
-+	for (i=1; i<count; i++) {
-+		if (compar(&sort->array[i], &sort->array[j]) != 0) {
-+			j++;
-+		} else {
-+			removed++;
-+			if (!db->multiple_decls ||
-+			   concompar(&sort->array[i], &sort->array[j]) != 0) {
-+				struct cil_list_item li;
-+				int rc2;
-+				cil_log(CIL_WARN, "Found conflicting %s rules\n",
-+					flavor_str);
-+				rc = SEPOL_ERR;
-+				li.flavor = flavor;
-+				li.data = sort->array[i];
-+				rc2 = cil_tree_walk(db->ast->root,
-+						    __cil_post_report_conflict,
-+						    NULL, NULL, &li);
-+				if (rc2 != SEPOL_OK) goto exit;
-+				li.data = sort->array[j];
-+				rc2 = cil_tree_walk(db->ast->root,
-+						    __cil_post_report_conflict,
-+						    NULL, NULL, &li);
-+				if (rc2 != SEPOL_OK) goto exit;
-+			}
-+		}
-+		if (i != j) {
-+			sort->array[j] = sort->array[i];
-+		}
-+	}
-+
-+	sort->count = count - removed;
-+
-+exit:
-+	return rc;
-+}
-+
- static int cil_post_db(struct cil_db *db)
- {
- 	int rc = SEPOL_ERR;
-@@ -1975,17 +2208,65 @@ static int cil_post_db(struct cil_db *db)
- 		goto exit;
- 	}
- 
--	qsort(db->netifcon->array, db->netifcon->count, sizeof(db->netifcon->array), cil_post_netifcon_compare);
--	qsort(db->genfscon->array, db->genfscon->count, sizeof(db->genfscon->array), cil_post_genfscon_compare);
--	qsort(db->portcon->array, db->portcon->count, sizeof(db->portcon->array), cil_post_portcon_compare);
--	qsort(db->nodecon->array, db->nodecon->count, sizeof(db->nodecon->array), cil_post_nodecon_compare);
--	qsort(db->fsuse->array, db->fsuse->count, sizeof(db->fsuse->array), cil_post_fsuse_compare);
--	qsort(db->filecon->array, db->filecon->count, sizeof(db->filecon->array), cil_post_filecon_compare);
--	qsort(db->pirqcon->array, db->pirqcon->count, sizeof(db->pirqcon->array), cil_post_pirqcon_compare);
--	qsort(db->iomemcon->array, db->iomemcon->count, sizeof(db->iomemcon->array), cil_post_iomemcon_compare);
--	qsort(db->ioportcon->array, db->ioportcon->count, sizeof(db->ioportcon->array), cil_post_ioportcon_compare);
--	qsort(db->pcidevicecon->array, db->pcidevicecon->count, sizeof(db->pcidevicecon->array), cil_post_pcidevicecon_compare);
--	qsort(db->devicetreecon->array, db->devicetreecon->count, sizeof(db->devicetreecon->array), cil_post_devicetreecon_compare);
-+	rc = __cil_post_process_context_rules(db->netifcon, cil_post_netifcon_compare, cil_post_netifcon_context_compare, db, CIL_NETIFCON, CIL_KEY_NETIFCON);
-+	if (rc != SEPOL_OK) {
-+		cil_log(CIL_ERR, "Problems processing netifcon rules\n");
-+		goto exit;
-+	}
-+
-+	rc = __cil_post_process_context_rules(db->genfscon, cil_post_genfscon_compare, cil_post_genfscon_context_compare, db, CIL_GENFSCON, CIL_KEY_GENFSCON);
-+	if (rc != SEPOL_OK) {
-+		cil_log(CIL_ERR, "Problems processing genfscon rules\n");
-+		goto exit;
-+	}
-+
-+	rc = __cil_post_process_context_rules(db->portcon, cil_post_portcon_compare, cil_post_portcon_context_compare, db, CIL_PORTCON, CIL_KEY_PORTCON);
-+	if (rc != SEPOL_OK) {
-+		cil_log(CIL_ERR, "Problems processing portcon rules\n");
-+		goto exit;
-+	}
-+
-+	rc = __cil_post_process_context_rules(db->nodecon, cil_post_nodecon_compare, cil_post_nodecon_context_compare, db, CIL_NODECON, CIL_KEY_NODECON);
-+	if (rc != SEPOL_OK) {
-+		cil_log(CIL_ERR, "Problems processing nodecon rules\n");
-+		goto exit;
-+	}
-+
-+	rc = __cil_post_process_context_rules(db->fsuse, cil_post_fsuse_compare, cil_post_fsuse_context_compare, db, CIL_FSUSE, CIL_KEY_FSUSE);
-+	if (rc != SEPOL_OK) {
-+		cil_log(CIL_ERR, "Problems processing fsuse rules\n");
-+		goto exit;
-+	}
-+
-+	rc = __cil_post_process_context_rules(db->filecon, cil_post_filecon_compare, cil_post_filecon_context_compare, db, CIL_FILECON, CIL_KEY_FILECON);
-+	if (rc != SEPOL_OK) {
-+		cil_log(CIL_ERR, "Problems processing filecon rules\n");
-+		goto exit;
-+	}
-+
-+	rc = __cil_post_process_context_rules(db->iomemcon, cil_post_iomemcon_compare, cil_post_iomemcon_context_compare, db, CIL_IOMEMCON, CIL_KEY_IOMEMCON);
-+	if (rc != SEPOL_OK) {
-+		cil_log(CIL_ERR, "Problems processing iomemcon rules\n");
-+		goto exit;
-+	}
-+
-+	rc = __cil_post_process_context_rules(db->ioportcon, cil_post_ioportcon_compare, cil_post_ioportcon_context_compare, db, CIL_IOPORTCON, CIL_KEY_IOPORTCON);
-+	if (rc != SEPOL_OK) {
-+		cil_log(CIL_ERR, "Problems processing ioportcon rules\n");
-+		goto exit;
-+	}
-+
-+	rc = __cil_post_process_context_rules(db->pcidevicecon, cil_post_pcidevicecon_compare, cil_post_pcidevicecon_context_compare, db, CIL_PCIDEVICECON, CIL_KEY_PCIDEVICECON);
-+	if (rc != SEPOL_OK) {
-+		cil_log(CIL_ERR, "Problems processing pcidevicecon rules\n");
-+		goto exit;
-+	}
-+
-+	rc = __cil_post_process_context_rules(db->devicetreecon, cil_post_devicetreecon_compare, cil_post_devicetreecon_context_compare, db, CIL_DEVICETREECON, CIL_KEY_DEVICETREECON);
-+	if (rc != SEPOL_OK) {
-+		cil_log(CIL_ERR, "Problems processing devicetreecon rules\n");
-+		goto exit;
-+	}
- 
- exit:
- 	return rc;
--- 
-2.7.4
-
diff --git a/patches/platform_frameworks_av/0001-FIH-devices-Fix-Earpiece-audio-output.patch b/patches/platform_frameworks_av/0001-FIH-devices-Fix-Earpiece-audio-output.patch
index 1cf9498..0cf64b4 100644
--- a/patches/platform_frameworks_av/0001-FIH-devices-Fix-Earpiece-audio-output.patch
+++ b/patches/platform_frameworks_av/0001-FIH-devices-Fix-Earpiece-audio-output.patch
@@ -1,4 +1,4 @@
-From 25e8b3145db1134d114f54ab8b3f4bff9bb5a062 Mon Sep 17 00:00:00 2001
+From 71286a6af35eeebf33171848285c9e6dc0da1366 Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <phh@phh.me>
 Date: Tue, 24 Apr 2018 00:14:28 +0200
 Subject: [PATCH 1/2] FIH devices: Fix "Earpiece" audio output
@@ -12,11 +12,11 @@
 
 Change-Id: I4a88ba6d34d0fcd346eeea2ca903772f0271040a
 ---
- .../common/managerdefinitions/src/Serializer.cpp   | 25 +++++++++++++++++++---
+ .../managerdefinitions/src/Serializer.cpp     | 25 ++++++++++++++++---
  1 file changed, 22 insertions(+), 3 deletions(-)
 
 diff --git a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
-index a224004..f58d7e5 100644
+index a2531131d..380e2f82b 100644
 --- a/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
 +++ b/services/audiopolicy/common/managerdefinitions/src/Serializer.cpp
 @@ -191,16 +191,25 @@ const char AudioProfileTraits::Attributes::name[] = "name";
@@ -47,7 +47,7 @@
                            samplingRatesFromString(samplingRates, ","));
  
      profile->setDynamicFormat(profile->getFormat() == gDynamicFormat);
-@@ -316,7 +325,10 @@ status_t DevicePortTraits::deserialize(_xmlDoc *doc, const _xmlNode *root, PtrEl
+@@ -326,7 +335,10 @@ status_t DevicePortTraits::deserialize(_xmlDoc *doc, const _xmlNode *root, PtrEl
      }
  
      AudioProfileTraits::Collection profiles;
@@ -59,7 +59,7 @@
      if (profiles.isEmpty()) {
          sp <AudioProfile> dynamicProfile = new AudioProfile(gDynamicFormat,
                                                              ChannelsVector(), SampleRateVector());
-@@ -481,6 +493,13 @@ status_t ModuleTraits::deserialize(xmlDocPtr doc, const xmlNode *root, PtrElemen
+@@ -491,6 +503,13 @@ status_t ModuleTraits::deserialize(xmlDocPtr doc, const xmlNode *root, PtrElemen
          }
          children = children->next;
      }
@@ -74,5 +74,5 @@
  }
  
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_frameworks_av/0002-Fix-WiFi-Display-on-Huawei-devices-EMUI-8.0.patch b/patches/platform_frameworks_av/0002-Fix-WiFi-Display-on-Huawei-devices-EMUI-8.0.patch
index c5987fa..3b0f416 100644
--- a/patches/platform_frameworks_av/0002-Fix-WiFi-Display-on-Huawei-devices-EMUI-8.0.patch
+++ b/patches/platform_frameworks_av/0002-Fix-WiFi-Display-on-Huawei-devices-EMUI-8.0.patch
@@ -1,4 +1,4 @@
-From e31fc7df0316ea378dbb737c4699ee6441b0f068 Mon Sep 17 00:00:00 2001
+From 3e6bf2b4bd5cc97399e8bfe0dace8f4b2c6f69cc Mon Sep 17 00:00:00 2001
 From: Alexander Pohl <pohl199885@gmail.com>
 Date: Fri, 15 Jun 2018 19:58:07 +0200
 Subject: [PATCH 2/2] Fix WiFi-Display on Huawei devices (EMUI 8.0)
@@ -11,10 +11,10 @@
  1 file changed, 2 insertions(+), 3 deletions(-)
 
 diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
-index a2eb9a8..e5eefcb 100644
+index 7f39d109f..ed54fb58a 100644
 --- a/media/libstagefright/ACodec.cpp
 +++ b/media/libstagefright/ACodec.cpp
-@@ -4244,9 +4244,8 @@ status_t ACodec::setupAVCEncoderParameters(const sp<AMessage> &msg) {
+@@ -4279,9 +4279,8 @@ status_t ACodec::setupAVCEncoderParameters(const sp<AMessage> &msg) {
      if (msg->findInt32("intra-refresh-mode", &intraRefreshMode)) {
          err = setCyclicIntraMacroblockRefresh(msg, intraRefreshMode);
          if (err != OK) {
@@ -27,5 +27,5 @@
      }
  
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_frameworks_base/0002-Reintroduce-button-backlight-and-respective-inactivi.patch b/patches/platform_frameworks_base/0001-Reintroduce-button-backlight-and-respective-inactivi.patch
similarity index 77%
rename from patches/platform_frameworks_base/0002-Reintroduce-button-backlight-and-respective-inactivi.patch
rename to patches/platform_frameworks_base/0001-Reintroduce-button-backlight-and-respective-inactivi.patch
index eeb693f..ab99e6f 100644
--- a/patches/platform_frameworks_base/0002-Reintroduce-button-backlight-and-respective-inactivi.patch
+++ b/patches/platform_frameworks_base/0001-Reintroduce-button-backlight-and-respective-inactivi.patch
@@ -1,7 +1,7 @@
-From 1672d35b1d213d54adf7ef20bcc6344683e0969f Mon Sep 17 00:00:00 2001
+From 69d58167da745a41f6f6ef644cee1fc1ceb69376 Mon Sep 17 00:00:00 2001
 From: Ricardo Cerqueira <cyanogenmod@cerqueira.org>
 Date: Fri, 23 Nov 2012 14:23:16 +0000
-Subject: [PATCH 02/16] Reintroduce button-backlight (and respective inactivity
+Subject: [PATCH 01/14] Reintroduce button-backlight (and respective inactivity
  timeout)
 
 The power manager rewrite from Change I1d7a52e98f0449f76d70bf421f6a7f245957d1d7
@@ -14,12 +14,12 @@
 
 Change-Id: I6094c446e0b8c23f57d30652a3cbd35dee5e821a
 ---
- .../com/android/server/display/DisplayPowerController.java    | 11 +++++++++++
- .../java/com/android/server/power/PowerManagerService.java    | 10 ++++++++++
+ .../server/display/DisplayPowerController.java        | 11 +++++++++++
+ .../com/android/server/power/PowerManagerService.java | 10 ++++++++++
  2 files changed, 21 insertions(+)
 
 diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
-index f8e5836..80bdf1f 100644
+index 99412c56b27..0b2f487840b 100644
 --- a/services/core/java/com/android/server/display/DisplayPowerController.java
 +++ b/services/core/java/com/android/server/display/DisplayPowerController.java
 @@ -20,6 +20,7 @@ import android.app.ActivityManager;
@@ -27,10 +27,10 @@
  import com.android.server.LocalServices;
  import com.android.server.am.BatteryStatsService;
 +import com.android.server.lights.LightsManager;
+ import com.android.server.policy.WindowManagerPolicy;
  
  import android.animation.Animator;
- import android.animation.ObjectAnimator;
-@@ -129,6 +130,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
+@@ -141,6 +142,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
      // Battery stats.
      private final IBatteryStats mBatteryStats;
  
@@ -40,7 +40,7 @@
      // The sensor manager.
      private final SensorManager mSensorManager;
  
-@@ -300,6 +304,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
+@@ -374,6 +378,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
          mCallbacks = callbacks;
  
          mBatteryStats = BatteryStatsService.getService();
@@ -48,7 +48,7 @@
          mSensorManager = sensorManager;
          mWindowManagerPolicy = LocalServices.getService(WindowManagerPolicy.class);
          mBlanker = blanker;
-@@ -678,6 +683,12 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
+@@ -769,6 +774,12 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
          // Use zero brightness when screen is off.
          if (state == Display.STATE_OFF) {
              brightness = PowerManager.BRIGHTNESS_OFF;
@@ -60,21 +60,21 @@
 +            mLights.getLight(LightsManager.LIGHT_ID_BUTTONS).setBrightness(PowerManager.BRIGHTNESS_OFF);
          }
  
-         // Configure auto-brightness.
+         // Always use the VR brightness when in the VR state.
 diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
-index f84b20c..1ced53f 100644
+index 697801f7787..a9e4cda02ae 100644
 --- a/services/core/java/com/android/server/power/PowerManagerService.java
 +++ b/services/core/java/com/android/server/power/PowerManagerService.java
-@@ -220,6 +220,8 @@ public final class PowerManagerService extends SystemService
-     private static final int HALT_MODE_REBOOT = 1;
-     private static final int HALT_MODE_REBOOT_SAFE_MODE = 2;
+@@ -222,6 +222,8 @@ public final class PowerManagerService extends SystemService
+     // Persistent property for last reboot reason
+     private static final String LAST_REBOOT_PROPERTY = "persist.sys.boot.reason";
  
 +    private static final int BUTTON_ON_DURATION = 5 * 1000;
 +
-     // File location for last reboot reason
-     private static final String LAST_REBOOT_LOCATION = "/data/misc/reboot/last_reboot_reason";
- 
-@@ -240,6 +242,7 @@ public final class PowerManagerService extends SystemService
+     private final Context mContext;
+     private final ServiceThread mHandlerThread;
+     private final PowerManagerHandler mHandler;
+@@ -242,6 +244,7 @@ public final class PowerManagerService extends SystemService
      private SettingsObserver mSettingsObserver;
      private DreamManagerInternal mDreamManager;
      private Light mAttentionLight;
@@ -82,7 +82,7 @@
  
      private final Object mLock = LockGuard.installNewLock(LockGuard.INDEX_POWER);
  
-@@ -747,6 +750,7 @@ public final class PowerManagerService extends SystemService
+@@ -770,6 +773,7 @@ public final class PowerManagerService extends SystemService
  
              mLightsManager = getLocalService(LightsManager.class);
              mAttentionLight = mLightsManager.getLight(LightsManager.LIGHT_ID_ATTENTION);
@@ -90,7 +90,7 @@
  
              // Initialize display power management.
              mDisplayManagerInternal.initPowerManagement(
-@@ -1947,6 +1951,12 @@ public final class PowerManagerService extends SystemService
+@@ -1960,6 +1964,12 @@ public final class PowerManagerService extends SystemService
                      nextTimeout = mLastUserActivityTime
                              + screenOffTimeout - screenDimDuration;
                      if (now < nextTimeout) {
@@ -104,5 +104,5 @@
                      } else {
                          nextTimeout = mLastUserActivityTime + screenOffTimeout;
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_frameworks_base/0001-renderthread-relax-error-handling-for-wide-gamut-EGL.patch b/patches/platform_frameworks_base/0001-renderthread-relax-error-handling-for-wide-gamut-EGL.patch
deleted file mode 100644
index 62d7ab7..0000000
--- a/patches/platform_frameworks_base/0001-renderthread-relax-error-handling-for-wide-gamut-EGL.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From c4d6cce4e0e601677108be08a0c72ee58a9cb4b7 Mon Sep 17 00:00:00 2001
-From: Rob Herring <robh@kernel.org>
-Date: Wed, 29 Nov 2017 09:26:31 -0600
-Subject: [PATCH 01/16] renderthread: relax error handling for wide gamut EGL
- configs
-
-It is valid to advertise EGL_EXT_pixel_format_float, but not have a
-the requested EGL config. Instead of aborting, fallback to the default
-behavior.
-
-Change-Id: I6c602233b627dc2070364434fece57d3d0aab435
-Cc: Romain Guy <romainguy@google.com>
-Signed-off-by: Rob Herring <robh@kernel.org>
----
- libs/hwui/renderthread/EglManager.cpp | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp
-index 16d7736..bd4708d 100644
---- a/libs/hwui/renderthread/EglManager.cpp
-+++ b/libs/hwui/renderthread/EglManager.cpp
-@@ -223,9 +223,9 @@ void EglManager::loadConfigs() {
-         numConfigs = 1;
-         if (!eglChooseConfig(mEglDisplay, attribs16F, &mEglConfigWideGamut, numConfigs, &numConfigs)
-                 || numConfigs != 1) {
--            LOG_ALWAYS_FATAL(
--                    "Device claims wide gamut support, cannot find matching config, error = %s",
-+            ALOGE("Device claims wide gamut support, cannot find matching config, error = %s",
-                     eglErrorString());
-+            EglExtensions.pixelFormatFloat = false;
-         }
-     }
- }
--- 
-2.7.4
-
diff --git a/patches/platform_frameworks_base/0003-power-Disable-keyboard-button-lights-while-dozing-dr.patch b/patches/platform_frameworks_base/0002-power-Disable-keyboard-button-lights-while-dozing-dr.patch
similarity index 73%
rename from patches/platform_frameworks_base/0003-power-Disable-keyboard-button-lights-while-dozing-dr.patch
rename to patches/platform_frameworks_base/0002-power-Disable-keyboard-button-lights-while-dozing-dr.patch
index 70fbc6c..af53d56 100644
--- a/patches/platform_frameworks_base/0003-power-Disable-keyboard-button-lights-while-dozing-dr.patch
+++ b/patches/platform_frameworks_base/0002-power-Disable-keyboard-button-lights-while-dozing-dr.patch
@@ -1,7 +1,7 @@
-From c7329117006efae651d4adc315cb5663fb62e2e6 Mon Sep 17 00:00:00 2001
+From 3706f2a1c164e76b4c706a528bc7ac4894fd96d3 Mon Sep 17 00:00:00 2001
 From: Steve Kondik <steve@cyngn.com>
 Date: Sat, 3 Jan 2015 05:13:26 -0800
-Subject: [PATCH 03/16] power: Disable keyboard/button lights while
+Subject: [PATCH 02/14] power: Disable keyboard/button lights while
  dozing/dreaming
 
  * With hardkeys and doze mode enabled, entering suspend results in
@@ -10,15 +10,15 @@
 
 Change-Id: I7f1fc35a1573717d1ea101a07c4171d6f66d1553
 ---
- services/core/java/com/android/server/power/PowerManagerService.java | 2 +-
+ .../core/java/com/android/server/power/PowerManagerService.java | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
-index 1ced53f..9edf6fc 100644
+index a9e4cda02ae..4d7c6d24509 100644
 --- a/services/core/java/com/android/server/power/PowerManagerService.java
 +++ b/services/core/java/com/android/server/power/PowerManagerService.java
-@@ -1947,7 +1947,7 @@ public final class PowerManagerService extends SystemService
-                 final boolean userInactiveOverride = mUserInactiveOverrideFromWindowManager;
+@@ -1960,7 +1960,7 @@ public final class PowerManagerService extends SystemService
+                 final long nextProfileTimeout = getNextProfileTimeoutLocked(now);
  
                  mUserActivitySummary = 0;
 -                if (mLastUserActivityTime >= mLastWakeTime) {
@@ -27,5 +27,5 @@
                              + screenOffTimeout - screenDimDuration;
                      if (now < nextTimeout) {
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_frameworks_base/0004-Fix-backlight-control-on-Galaxy-S9.patch b/patches/platform_frameworks_base/0003-Fix-backlight-control-on-Galaxy-S9.patch
similarity index 83%
rename from patches/platform_frameworks_base/0004-Fix-backlight-control-on-Galaxy-S9.patch
rename to patches/platform_frameworks_base/0003-Fix-backlight-control-on-Galaxy-S9.patch
index 513decf..56683bc 100644
--- a/patches/platform_frameworks_base/0004-Fix-backlight-control-on-Galaxy-S9.patch
+++ b/patches/platform_frameworks_base/0003-Fix-backlight-control-on-Galaxy-S9.patch
@@ -1,14 +1,14 @@
-From a82315411eca9c1bb28216eb537f5a63b8a5fb94 Mon Sep 17 00:00:00 2001
+From 9ae6ae97637638189f9a8c632f07f0272ec22c73 Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <phh@phh.me>
 Date: Sat, 24 Mar 2018 08:01:48 +0100
-Subject: [PATCH 04/16] Fix backlight control on Galaxy S9(+)
+Subject: [PATCH 03/14] Fix backlight control on Galaxy S9(+)
 
 ---
- services/core/java/com/android/server/lights/LightsService.java | 7 +++++++
+ .../core/java/com/android/server/lights/LightsService.java | 7 +++++++
  1 file changed, 7 insertions(+)
 
 diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
-index a94ed60..762b0ae 100644
+index a94ed608b9c..762b0ae4037 100644
 --- a/services/core/java/com/android/server/lights/LightsService.java
 +++ b/services/core/java/com/android/server/lights/LightsService.java
 @@ -21,6 +21,7 @@ import android.app.ActivityManager;
@@ -33,5 +33,5 @@
                  color = 0xff000000 | (color << 16) | (color << 8) | color;
                  setLightLocked(color, LIGHT_FLASH_NONE, 0, 0, brightnessMode);
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_frameworks_base/0005-Relax-requirement-for-visible-flag-to-sdcards.patch b/patches/platform_frameworks_base/0004-Relax-requirement-for-visible-flag-to-sdcards.patch
similarity index 77%
rename from patches/platform_frameworks_base/0005-Relax-requirement-for-visible-flag-to-sdcards.patch
rename to patches/platform_frameworks_base/0004-Relax-requirement-for-visible-flag-to-sdcards.patch
index 3b124d3..eabb351 100644
--- a/patches/platform_frameworks_base/0005-Relax-requirement-for-visible-flag-to-sdcards.patch
+++ b/patches/platform_frameworks_base/0004-Relax-requirement-for-visible-flag-to-sdcards.patch
@@ -1,7 +1,7 @@
-From d807609094b6da867f2cb2672a6c36fb6bddaf05 Mon Sep 17 00:00:00 2001
+From f42553122ec0246adbe1685e3667bc53731cd9fb Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <phh@phh.me>
 Date: Tue, 28 Nov 2017 18:28:04 +0100
-Subject: [PATCH 05/16] Relax requirement for visible flag to sdcards
+Subject: [PATCH 04/14] Relax requirement for visible flag to sdcards
 
 The vast majority of sdcard readers are stable enough to be declared by
 the API. (I see no counter-example)
@@ -9,14 +9,14 @@
 
 Change-Id: Ia616671c03562d1eadaff5531a5c708a62d7ad3a
 ---
- services/core/java/com/android/server/StorageManagerService.java | 3 ++-
+ .../core/java/com/android/server/StorageManagerService.java    | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
-index 1ca0112..4014cab 100644
+index 183be9b9875..e8f2ad16a55 100644
 --- a/services/core/java/com/android/server/StorageManagerService.java
 +++ b/services/core/java/com/android/server/StorageManagerService.java
-@@ -1316,7 +1316,8 @@ class StorageManagerService extends IStorageManager.Stub
+@@ -1178,7 +1178,8 @@ class StorageManagerService extends IStorageManager.Stub
  
              // Adoptable public disks are visible to apps, since they meet
              // public API requirement of being in a stable location.
@@ -27,5 +27,5 @@
              }
  
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_frameworks_base/0008-Don-t-crash-if-there-is-IR-HAL-is-not-declared.patch b/patches/platform_frameworks_base/0005-Don-t-crash-if-there-is-IR-HAL-is-not-declared.patch
similarity index 83%
rename from patches/platform_frameworks_base/0008-Don-t-crash-if-there-is-IR-HAL-is-not-declared.patch
rename to patches/platform_frameworks_base/0005-Don-t-crash-if-there-is-IR-HAL-is-not-declared.patch
index 7e0fbe7..fb42d9e 100644
--- a/patches/platform_frameworks_base/0008-Don-t-crash-if-there-is-IR-HAL-is-not-declared.patch
+++ b/patches/platform_frameworks_base/0005-Don-t-crash-if-there-is-IR-HAL-is-not-declared.patch
@@ -1,14 +1,14 @@
-From b099c00a7e70e730a4d1c7227e911f8f09ffd5f3 Mon Sep 17 00:00:00 2001
+From e59a2330fe4055865eb28983a4d4a994a6298368 Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <phh@phh.me>
 Date: Thu, 17 May 2018 20:28:35 +0200
-Subject: [PATCH 08/16] Don't crash if there is IR HAL is not declared
+Subject: [PATCH 05/14] Don't crash if there is IR HAL is not declared
 
 ---
  services/core/java/com/android/server/ConsumerIrService.java | 2 --
  1 file changed, 2 deletions(-)
 
 diff --git a/services/core/java/com/android/server/ConsumerIrService.java b/services/core/java/com/android/server/ConsumerIrService.java
-index 2ed6c77..c574a03 100644
+index 2ed6c77baa0..c574a03c9a3 100644
 --- a/services/core/java/com/android/server/ConsumerIrService.java
 +++ b/services/core/java/com/android/server/ConsumerIrService.java
 @@ -50,8 +50,6 @@ public class ConsumerIrService extends IConsumerIrService.Stub {
@@ -21,5 +21,5 @@
      }
  
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_frameworks_base/0006-Also-scan-product-overlay-for-RRO.patch b/patches/platform_frameworks_base/0006-Also-scan-product-overlay-for-RRO.patch
deleted file mode 100644
index c2bb075..0000000
--- a/patches/platform_frameworks_base/0006-Also-scan-product-overlay-for-RRO.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 1fef41d82a1e7a2bbafebcf519a60c888ffd3c4b Mon Sep 17 00:00:00 2001
-From: Pierre-Hugues Husson <pierre-hugues.husson@softathome.com>
-Date: Tue, 24 Apr 2018 18:08:59 +0200
-Subject: [PATCH 06/16] Also scan /product/overlay for RRO
-
----
- core/jni/android_util_AssetManager.cpp | 6 +++++-
- core/jni/fd_utils.cpp                  | 3 ++-
- 2 files changed, 7 insertions(+), 2 deletions(-)
-
-diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
-index b137da3..30d8abe 100644
---- a/core/jni/android_util_AssetManager.cpp
-+++ b/core/jni/android_util_AssetManager.cpp
-@@ -164,7 +164,7 @@ static void verifySystemIdmaps()
-                 }
- 
-                 // Generic idmap parameters
--                const char* argv[8];
-+                const char* argv[9];
-                 int argc = 0;
-                 struct stat st;
- 
-@@ -189,6 +189,10 @@ static void verifySystemIdmaps()
-                     argv[argc++] = AssetManager::OVERLAY_DIR;
-                 }
- 
-+               if (stat("/product/overlay/", &st) == 0) {
-+                   argv[argc++] = "/product/overlay";
-+               }
-+
-                 // Finally, invoke idmap (if any overlay directory exists)
-                 if (argc > 5) {
-                     execv(AssetManager::IDMAP_BIN, (char* const*)argv);
-diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp
-index 956b724..496b140 100644
---- a/core/jni/fd_utils.cpp
-+++ b/core/jni/fd_utils.cpp
-@@ -89,7 +89,8 @@ bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const {
- 
-   if ((android::base::StartsWith(path, kOverlayDir)
-        || android::base::StartsWith(path, kOverlaySubdir)
--       || android::base::StartsWith(path, kVendorOverlayDir))
-+       || android::base::StartsWith(path, kVendorOverlayDir)
-+       || android::base::StartsWith(path, "/product/overlay"))
-       && android::base::EndsWith(path, kApkSuffix)
-       && path.find("/../") == std::string::npos) {
-     return true;
--- 
-2.7.4
-
diff --git a/patches/platform_frameworks_base/0010-S9-brightness-override-only-for-screen.patch b/patches/platform_frameworks_base/0006-S9-brightness-override-only-for-screen.patch
similarity index 84%
rename from patches/platform_frameworks_base/0010-S9-brightness-override-only-for-screen.patch
rename to patches/platform_frameworks_base/0006-S9-brightness-override-only-for-screen.patch
index 8cc2205..0a439f3 100644
--- a/patches/platform_frameworks_base/0010-S9-brightness-override-only-for-screen.patch
+++ b/patches/platform_frameworks_base/0006-S9-brightness-override-only-for-screen.patch
@@ -1,14 +1,14 @@
-From 6ef0f1fc726df642fef81ccd15edde6e9daaed53 Mon Sep 17 00:00:00 2001
+From fb7d17fad6ee79602330c669d7ce835561be0fb1 Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <pierre-hugues.husson@softathome.com>
 Date: Thu, 7 Jun 2018 13:36:51 +0200
-Subject: [PATCH 10/16] S9 brightness override only for screen
+Subject: [PATCH 06/14] S9 brightness override only for screen
 
 ---
- .../core/java/com/android/server/lights/LightsService.java   | 12 +++++++-----
+ .../com/android/server/lights/LightsService.java     | 12 +++++++-----
  1 file changed, 7 insertions(+), 5 deletions(-)
 
 diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
-index 762b0ae..eb25943 100644
+index 762b0ae4037..eb25943fa6b 100644
 --- a/services/core/java/com/android/server/lights/LightsService.java
 +++ b/services/core/java/com/android/server/lights/LightsService.java
 @@ -53,11 +53,13 @@ public class LightsService extends SystemService {
@@ -31,5 +31,5 @@
                  int color = brightness & 0x000000ff;
                  color = 0xff000000 | (color << 16) | (color << 8) | color;
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_frameworks_base/0007-Also-scan-system-overlay.patch b/patches/platform_frameworks_base/0007-Also-scan-system-overlay.patch
deleted file mode 100644
index ec64a33..0000000
--- a/patches/platform_frameworks_base/0007-Also-scan-system-overlay.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From e89aed22785fc3ce5aa0bd75c6410003dbc55245 Mon Sep 17 00:00:00 2001
-From: Pierre-Hugues Husson <phh@phh.me>
-Date: Tue, 1 May 2018 17:47:36 +0200
-Subject: [PATCH 07/16] Also scan /system/overlay
-
----
- core/jni/android_util_AssetManager.cpp | 6 +++++-
- core/jni/fd_utils.cpp                  | 3 ++-
- 2 files changed, 7 insertions(+), 2 deletions(-)
-
-diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
-index 30d8abe..9ec1a75 100644
---- a/core/jni/android_util_AssetManager.cpp
-+++ b/core/jni/android_util_AssetManager.cpp
-@@ -164,7 +164,7 @@ static void verifySystemIdmaps()
-                 }
- 
-                 // Generic idmap parameters
--                const char* argv[9];
-+                const char* argv[10];
-                 int argc = 0;
-                 struct stat st;
- 
-@@ -193,6 +193,10 @@ static void verifySystemIdmaps()
-                    argv[argc++] = "/product/overlay";
-                }
- 
-+               if (stat("/system/overlay/", &st) == 0) {
-+                   argv[argc++] = "/system/overlay";
-+               }
-+
-                 // Finally, invoke idmap (if any overlay directory exists)
-                 if (argc > 5) {
-                     execv(AssetManager::IDMAP_BIN, (char* const*)argv);
-diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp
-index 496b140..6ba3798 100644
---- a/core/jni/fd_utils.cpp
-+++ b/core/jni/fd_utils.cpp
-@@ -90,7 +90,8 @@ bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const {
-   if ((android::base::StartsWith(path, kOverlayDir)
-        || android::base::StartsWith(path, kOverlaySubdir)
-        || android::base::StartsWith(path, kVendorOverlayDir)
--       || android::base::StartsWith(path, "/product/overlay"))
-+       || android::base::StartsWith(path, "/product/overlay")
-+       || android::base::StartsWith(path, "/system/overlay"))
-       && android::base::EndsWith(path, kApkSuffix)
-       && path.find("/../") == std::string::npos) {
-     return true;
--- 
-2.7.4
-
diff --git a/patches/platform_frameworks_base/0011-WIP-Fix-OP6-brightness.patch b/patches/platform_frameworks_base/0007-WIP-Fix-OP6-brightness.patch
similarity index 83%
rename from patches/platform_frameworks_base/0011-WIP-Fix-OP6-brightness.patch
rename to patches/platform_frameworks_base/0007-WIP-Fix-OP6-brightness.patch
index be2c326..7fb90ae 100644
--- a/patches/platform_frameworks_base/0011-WIP-Fix-OP6-brightness.patch
+++ b/patches/platform_frameworks_base/0007-WIP-Fix-OP6-brightness.patch
@@ -1,21 +1,21 @@
-From d68bb6edb78ecc043456474e6f57725a319f0a81 Mon Sep 17 00:00:00 2001
+From 6f5006b0114bdca09e64a82d2b02729f1f34655d Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <pierre-hugues.husson@softathome.com>
 Date: Thu, 7 Jun 2018 13:42:02 +0200
-Subject: [PATCH 11/16] [WIP] Fix OP6 brightness
+Subject: [PATCH 07/14] [WIP] Fix OP6 brightness
 
 ---
- .../core/java/com/android/server/lights/LightsService.java   | 12 ++++++++++++
+ .../com/android/server/lights/LightsService.java     | 12 ++++++++++++
  1 file changed, 12 insertions(+)
 
 diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
-index eb25943..a77af44 100644
+index eb25943fa6b..a77af445ba6 100644
 --- a/services/core/java/com/android/server/lights/LightsService.java
 +++ b/services/core/java/com/android/server/lights/LightsService.java
 @@ -59,6 +59,18 @@ public class LightsService extends SystemService {
                          setLightLocked(brightness*100, LIGHT_FLASH_HARDWARE, 0, 0, brightnessMode);
                          return;
                      }
-+					/*
++
 +                    boolean qcomExtendBrightness = SystemProperties.getBoolean("persist.extend.brightness", false);
 +                    int scale = SystemProperties.getInt("persist.display.max_brightness", 1023);
 +                    if(fp.contains("OnePlus6")) {
@@ -26,10 +26,10 @@
 +                    if(qcomExtendBrightness) {
 +                        setLightLocked(brightness * scale / 255, LIGHT_FLASH_NONE, 0, 0, brightnessMode);
 +                        return;
-+                    } */
++                    }
                  }
  
                  int color = brightness & 0x000000ff;
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_frameworks_base/0012-Try-to-make-brightness-more-generic-using-property-s.patch b/patches/platform_frameworks_base/0008-Try-to-make-brightness-more-generic-using-property-s.patch
similarity index 83%
rename from patches/platform_frameworks_base/0012-Try-to-make-brightness-more-generic-using-property-s.patch
rename to patches/platform_frameworks_base/0008-Try-to-make-brightness-more-generic-using-property-s.patch
index d48a466..ab541d4 100644
--- a/patches/platform_frameworks_base/0012-Try-to-make-brightness-more-generic-using-property-s.patch
+++ b/patches/platform_frameworks_base/0008-Try-to-make-brightness-more-generic-using-property-s.patch
@@ -1,15 +1,15 @@
-From 33bc4de58fe68c44a270adbaeadd68e7756e98a6 Mon Sep 17 00:00:00 2001
+From 51ece7cfa0dbda604386ede0c5a360f06346f755 Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <phh@phh.me>
 Date: Sun, 10 Jun 2018 22:54:55 +0200
-Subject: [PATCH 12/16] Try to make brightness more generic using property set
+Subject: [PATCH 08/14] Try to make brightness more generic using property set
  by rw-system
 
 ---
- services/core/java/com/android/server/lights/LightsService.java | 6 ++++--
+ .../core/java/com/android/server/lights/LightsService.java  | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
-index a77af44..4dc44de 100644
+index a77af445ba6..4dc44de37cd 100644
 --- a/services/core/java/com/android/server/lights/LightsService.java
 +++ b/services/core/java/com/android/server/lights/LightsService.java
 @@ -62,9 +62,11 @@ public class LightsService extends SystemService {
@@ -27,5 +27,5 @@
  
                      if(qcomExtendBrightness) {
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_frameworks_base/0009-Fix-62.patch b/patches/platform_frameworks_base/0009-Fix-62.patch
deleted file mode 100644
index 2cbe176..0000000
--- a/patches/platform_frameworks_base/0009-Fix-62.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 90b1f32b2e4bbc22ee9dbbf586a804639fbe90f4 Mon Sep 17 00:00:00 2001
-From: Pierre-Hugues Husson <phh@phh.me>
-Date: Wed, 30 May 2018 14:05:30 +0200
-Subject: [PATCH 09/16] Fix(?) #62
-
----
- .../SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java     | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
-index cd23c97..7a0e1cb 100644
---- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
-+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
-@@ -837,7 +837,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
- 
-         @Override
-         public void onAuthenticationError(int errMsgId, CharSequence errString) {
--            handleFingerprintError(errMsgId, errString.toString());
-+            if(errString != null)
-+                 handleFingerprintError(errMsgId, errString.toString());
-+            else
-+                 handleFingerprintError(errMsgId, "unknown error");
-         }
- 
-         @Override
--- 
-2.7.4
-
diff --git a/patches/platform_frameworks_base/0013-property-matching-RROs-allow-to-prefix-the-value-wit.patch b/patches/platform_frameworks_base/0009-property-matching-RROs-allow-to-prefix-the-value-wit.patch
similarity index 80%
rename from patches/platform_frameworks_base/0013-property-matching-RROs-allow-to-prefix-the-value-wit.patch
rename to patches/platform_frameworks_base/0009-property-matching-RROs-allow-to-prefix-the-value-wit.patch
index 3621435..d249c7f 100644
--- a/patches/platform_frameworks_base/0013-property-matching-RROs-allow-to-prefix-the-value-wit.patch
+++ b/patches/platform_frameworks_base/0009-property-matching-RROs-allow-to-prefix-the-value-wit.patch
@@ -1,7 +1,7 @@
-From 02f3116e5a71bef5643bc9a6e6e7cdc9a0d1cf06 Mon Sep 17 00:00:00 2001
+From 35348fb993ba80c33ec9ffa2dcc1f5a4747cce87 Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <phh@phh.me>
 Date: Tue, 12 Jun 2018 22:55:32 +0200
-Subject: [PATCH 13/16] property-matching RROs: allow to prefix the value with
+Subject: [PATCH 09/14] property-matching RROs: allow to prefix the value with
  + to do glob match instead of exact match
 
 ---
@@ -9,7 +9,7 @@
  1 file changed, 5 insertions(+)
 
 diff --git a/cmds/idmap/scan.cpp b/cmds/idmap/scan.cpp
-index d69dd79..2be6d23 100644
+index d69dd79555a..2be6d23ac78 100644
 --- a/cmds/idmap/scan.cpp
 +++ b/cmds/idmap/scan.cpp
 @@ -1,5 +1,6 @@
@@ -31,5 +31,5 @@
      }
  
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_frameworks_base/0014-Fix-typo-on-fnmatch-return-value-check.patch b/patches/platform_frameworks_base/0010-Fix-typo-on-fnmatch-return-value-check.patch
similarity index 76%
rename from patches/platform_frameworks_base/0014-Fix-typo-on-fnmatch-return-value-check.patch
rename to patches/platform_frameworks_base/0010-Fix-typo-on-fnmatch-return-value-check.patch
index cdc860d..0689689 100644
--- a/patches/platform_frameworks_base/0014-Fix-typo-on-fnmatch-return-value-check.patch
+++ b/patches/platform_frameworks_base/0010-Fix-typo-on-fnmatch-return-value-check.patch
@@ -1,14 +1,14 @@
-From b8fd5db5611395bef9b7338d70d1279317849334 Mon Sep 17 00:00:00 2001
+From 471462f5c7428037f5bf0670c2d96cba15551dba Mon Sep 17 00:00:00 2001
 From: Song Fuchang <song.fc@gmail.com>
 Date: Sun, 17 Jun 2018 22:39:37 +0800
-Subject: [PATCH 14/16] Fix typo on fnmatch return value check
+Subject: [PATCH 10/14] Fix typo on fnmatch return value check
 
 ---
  cmds/idmap/scan.cpp | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/cmds/idmap/scan.cpp b/cmds/idmap/scan.cpp
-index 2be6d23..0acff23 100644
+index 2be6d23ac78..0acff23d031 100644
 --- a/cmds/idmap/scan.cpp
 +++ b/cmds/idmap/scan.cpp
 @@ -94,7 +94,7 @@ namespace {
@@ -21,5 +21,5 @@
  
          return (strcmp(propBuf, val) == 0);
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_frameworks_base/0015-Add-Qualcomm-starlte.patch b/patches/platform_frameworks_base/0011-Add-Qualcomm-starlte.patch
similarity index 82%
rename from patches/platform_frameworks_base/0015-Add-Qualcomm-starlte.patch
rename to patches/platform_frameworks_base/0011-Add-Qualcomm-starlte.patch
index 61adacd..7bd8e17 100644
--- a/patches/platform_frameworks_base/0015-Add-Qualcomm-starlte.patch
+++ b/patches/platform_frameworks_base/0011-Add-Qualcomm-starlte.patch
@@ -1,14 +1,14 @@
-From 983bd7a99b11e25b620fe37622f1f3a7f81dc7bd Mon Sep 17 00:00:00 2001
+From b3de3ae8a9b05017a0bf8329653075bf3b5960ea Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <phh@phh.me>
 Date: Mon, 25 Jun 2018 22:43:32 +0200
-Subject: [PATCH 15/16] Add Qualcomm starlte
+Subject: [PATCH 11/14] Add Qualcomm starlte
 
 ---
- services/core/java/com/android/server/lights/LightsService.java | 4 +++-
+ .../core/java/com/android/server/lights/LightsService.java    | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/services/core/java/com/android/server/lights/LightsService.java b/services/core/java/com/android/server/lights/LightsService.java
-index 4dc44de..2886f29 100644
+index 4dc44de37cd..2886f2900d9 100644
 --- a/services/core/java/com/android/server/lights/LightsService.java
 +++ b/services/core/java/com/android/server/lights/LightsService.java
 @@ -55,7 +55,9 @@ public class LightsService extends SystemService {
@@ -23,5 +23,5 @@
                          return;
                      }
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_frameworks_base/0016-Galaxy-S9-remaining-of-HAL-onEnroll-is-actually-a-pe.patch b/patches/platform_frameworks_base/0012-Galaxy-S9-remaining-of-HAL-onEnroll-is-actually-a-pe.patch
similarity index 77%
rename from patches/platform_frameworks_base/0016-Galaxy-S9-remaining-of-HAL-onEnroll-is-actually-a-pe.patch
rename to patches/platform_frameworks_base/0012-Galaxy-S9-remaining-of-HAL-onEnroll-is-actually-a-pe.patch
index 50564d2..affb9ba 100644
--- a/patches/platform_frameworks_base/0016-Galaxy-S9-remaining-of-HAL-onEnroll-is-actually-a-pe.patch
+++ b/patches/platform_frameworks_base/0012-Galaxy-S9-remaining-of-HAL-onEnroll-is-actually-a-pe.patch
@@ -1,18 +1,18 @@
-From 352a0b282645b142c4a57fd165e35b39602953b9 Mon Sep 17 00:00:00 2001
+From 4e3b41d78574dbb3398c3464e68be708cbb9f553 Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <phh@phh.me>
 Date: Mon, 2 Jul 2018 23:36:39 +0200
-Subject: [PATCH 16/16] [Galaxy S9] "remaining" of HAL onEnroll is actually a
+Subject: [PATCH 12/14] [Galaxy S9] "remaining" of HAL onEnroll is actually a
  percent of progress
 
 ---
- .../java/com/android/server/fingerprint/FingerprintService.java     | 6 +++++-
+ .../com/android/server/fingerprint/FingerprintService.java  | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
 
 diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java
-index b1c165e..3cfa367 100644
+index 06329e571b4..6f09433c002 100644
 --- a/services/core/java/com/android/server/fingerprint/FingerprintService.java
 +++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java
-@@ -955,7 +955,11 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
+@@ -1046,7 +1046,11 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
              mHandler.post(new Runnable() {
                  @Override
                  public void run() {
@@ -26,5 +26,5 @@
              });
          }
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_frameworks_base/0013-Show-APN-Settings-for-CDMA-carriers.patch b/patches/platform_frameworks_base/0013-Show-APN-Settings-for-CDMA-carriers.patch
new file mode 100644
index 0000000..1431098
--- /dev/null
+++ b/patches/platform_frameworks_base/0013-Show-APN-Settings-for-CDMA-carriers.patch
@@ -0,0 +1,25 @@
+From 053b2324df01b1acfd36216782e01f1890dfceab Mon Sep 17 00:00:00 2001
+From: Pierre-Hugues Husson <phh@phh.me>
+Date: Mon, 6 Aug 2018 12:49:00 +0200
+Subject: [PATCH 13/14] Show APN Settings for CDMA carriers
+
+---
+ telephony/java/android/telephony/CarrierConfigManager.java | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
+index f66164c302c..0cf93a18ca5 100644
+--- a/telephony/java/android/telephony/CarrierConfigManager.java
++++ b/telephony/java/android/telephony/CarrierConfigManager.java
+@@ -2019,7 +2019,7 @@ public class CarrierConfigManager {
+         sDefaults.putBoolean(KEY_MDN_IS_ADDITIONAL_VOICEMAIL_NUMBER_BOOL, false);
+         sDefaults.putBoolean(KEY_OPERATOR_SELECTION_EXPAND_BOOL, true);
+         sDefaults.putBoolean(KEY_PREFER_2G_BOOL, true);
+-        sDefaults.putBoolean(KEY_SHOW_APN_SETTING_CDMA_BOOL, false);
++        sDefaults.putBoolean(KEY_SHOW_APN_SETTING_CDMA_BOOL, true);
+         sDefaults.putBoolean(KEY_SHOW_CDMA_CHOICES_BOOL, false);
+         sDefaults.putBoolean(KEY_SMS_REQUIRES_DESTINATION_NUMBER_CONVERSION_BOOL, false);
+         sDefaults.putBoolean(KEY_SHOW_ONSCREEN_DIAL_BUTTON_BOOL, true);
+-- 
+2.17.1
+
diff --git a/patches/platform_frameworks_base/0014-Change-SignalStrentgh-to-change-behaviour-based-on-p.patch b/patches/platform_frameworks_base/0014-Change-SignalStrentgh-to-change-behaviour-based-on-p.patch
new file mode 100644
index 0000000..5d20653
--- /dev/null
+++ b/patches/platform_frameworks_base/0014-Change-SignalStrentgh-to-change-behaviour-based-on-p.patch
@@ -0,0 +1,78 @@
+From ff10685c75c5aa837ce70cb572ec5180a7f496d2 Mon Sep 17 00:00:00 2001
+From: Pierre-Hugues Husson <phh@phh.me>
+Date: Mon, 6 Aug 2018 20:01:44 +0200
+Subject: [PATCH 14/14] Change SignalStrentgh to change behaviour based on
+ property
+
+Change-Id: I9e8bec3dd41ecc983e007f6d00157170ac0a3e28
+---
+ .../android/telephony/SignalStrength.java     | 39 +++++++++++++------
+ 1 file changed, 27 insertions(+), 12 deletions(-)
+
+diff --git a/telephony/java/android/telephony/SignalStrength.java b/telephony/java/android/telephony/SignalStrength.java
+index 4e5639683a7..ff906d330d4 100644
+--- a/telephony/java/android/telephony/SignalStrength.java
++++ b/telephony/java/android/telephony/SignalStrength.java
+@@ -854,6 +854,7 @@ public class SignalStrength implements Parcelable {
+          * RSRQ = quality of signal dB = Number of Resource blocks*RSRP/RSSI
+          * SNR = gain = signal/noise ratio = -10log P1/P2 dB
+          */
++        String method = android.os.SystemProperties.get("persist.sys.signal.level", "default");
+         int rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN, rsrpIconLevel = -1, snrIconLevel = -1;
+ 
+         if (mLteRsrp > MAX_LTE_RSRP || mLteRsrp < MIN_LTE_RSRP) {
+@@ -897,6 +898,32 @@ public class SignalStrength implements Parcelable {
+                 + rsrpIconLevel + " snrIconLevel:" + snrIconLevel
+                 + " lteRsrpBoost:" + mLteRsrpBoost);
+ 
++        /* Valid values are (0-63, 99) as defined in TS 36.331 */
++        // TODO the range here is probably supposed to be (0..31, 99). It's unclear if anyone relies
++        // on the current incorrect range check, so this will be fixed in a future release with more
++        // soak time
++        if (mLteSignalStrength > 63) rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
++        else if (mLteSignalStrength >= 12) rssiIconLevel = SIGNAL_STRENGTH_GREAT;
++        else if (mLteSignalStrength >= 8) rssiIconLevel = SIGNAL_STRENGTH_GOOD;
++        else if (mLteSignalStrength >= 5) rssiIconLevel = SIGNAL_STRENGTH_MODERATE;
++        else if (mLteSignalStrength >= 0) rssiIconLevel = SIGNAL_STRENGTH_POOR;
++
++        if (DBG) log("getLTELevel - rssi:" + mLteSignalStrength + " rssiIconLevel:"
++                + rssiIconLevel);
++
++        if("rsrp".equals(method)) {
++            if(rsrpIconLevel == -1) rsrpIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
++            return rsrpIconLevel;
++        }
++        if("rssnr".equals(method)) {
++            if(snrIconLevel == -1) snrIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
++            return snrIconLevel;
++        }
++        if("rssi".equals(method)) {
++            if(rssiIconLevel == -1) rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
++            return rssiIconLevel;
++        }
++
+         /* Choose a measurement type to use for notification */
+         if (snrIconLevel != -1 && rsrpIconLevel != -1) {
+             /*
+@@ -911,18 +938,6 @@ public class SignalStrength implements Parcelable {
+ 
+         if (rsrpIconLevel != -1) return rsrpIconLevel;
+ 
+-        /* Valid values are (0-63, 99) as defined in TS 36.331 */
+-        // TODO the range here is probably supposed to be (0..31, 99). It's unclear if anyone relies
+-        // on the current incorrect range check, so this will be fixed in a future release with more
+-        // soak time
+-        if (mLteSignalStrength > 63) rssiIconLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+-        else if (mLteSignalStrength >= 12) rssiIconLevel = SIGNAL_STRENGTH_GREAT;
+-        else if (mLteSignalStrength >= 8) rssiIconLevel = SIGNAL_STRENGTH_GOOD;
+-        else if (mLteSignalStrength >= 5) rssiIconLevel = SIGNAL_STRENGTH_MODERATE;
+-        else if (mLteSignalStrength >= 0) rssiIconLevel = SIGNAL_STRENGTH_POOR;
+-
+-        if (DBG) log("getLteLevel - rssi:" + mLteSignalStrength + " rssiIconLevel:"
+-                + rssiIconLevel);
+         return rssiIconLevel;
+ 
+     }
+-- 
+2.17.1
+
diff --git a/patches/platform_frameworks_native/0001-device-Huawei-HWC-doesn-t-understand-0-0-0-0-fullscr.patch b/patches/platform_frameworks_native/0001-device-Huawei-HWC-doesn-t-understand-0-0-0-0-fullscr.patch
deleted file mode 100644
index 0c711ba..0000000
--- a/patches/platform_frameworks_native/0001-device-Huawei-HWC-doesn-t-understand-0-0-0-0-fullscr.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-From 6dcb8fda3d94def017ffce6f5540e88c29b1c3a4 Mon Sep 17 00:00:00 2001
-From: Pierre-Hugues Husson <phh@phh.me>
-Date: Fri, 5 Jan 2018 00:26:38 +0100
-Subject: [PATCH] [device] ::Huawei:: HWC doesn't understand 0,0,0,0 ==
- fullscreen damage. Set it to the whole visible surface
-
-::Huawei:: Fix damage for Huawei compositor
-
-For Huawei compositor, the damage area is a region on the screen.
-But for SurfaceFlinger, this is a region on the source surface.
-On Huawei devices, do the plane conversion.
-
-This fixes several UI glitches, most notably GBoard.
----
- services/surfaceflinger/Layer.cpp          | 35 +++++++++++++++++++++++++++++-
- services/surfaceflinger/SurfaceFlinger.cpp |  7 ++++++
- services/surfaceflinger/SurfaceFlinger.h   |  3 +++
- 3 files changed, 44 insertions(+), 1 deletion(-)
-
-diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
-index 038ece2..8099f1d 100755
---- a/services/surfaceflinger/Layer.cpp
-+++ b/services/surfaceflinger/Layer.cpp
-@@ -871,7 +871,40 @@ void Layer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) {
-         visible.dump(LOG_TAG);
-     }
- 
--    error = hwcLayer->setSurfaceDamage(surfaceDamageRegion);
-+    if(mFlinger->mDamageUsesScreenReference) {
-+	    const Rect& frame = hwcInfo.displayFrame;
-+	    int32_t left = frame.left;
-+	    int32_t top = frame.top;
-+	    int32_t right = frame.right;
-+	    int32_t bottom = frame.bottom;
-+	    if(surfaceDamageRegion.getBounds() == Rect::INVALID_RECT) {
-+		    auto fullSource = Region(Rect(left, top, right, bottom));
-+		    error = hwcLayer->setSurfaceDamage(fullSource);
-+	    } else {
-+		    //There is no easy way to scale, so just scale the bounds
-+		    const Rect& preDamageRect = surfaceDamageRegion.bounds();
-+		    const FloatRect& crop = hwcInfo.sourceCrop;
-+
-+		    float frameWidth = right - left;
-+		    float frameHeight = bottom - top;
-+
-+		    float cropWidth = crop.right - crop.left;
-+		    float cropHeight = crop.bottom - crop.top;
-+
-+		    float wFactor = frameWidth / cropWidth;
-+		    float hFactor = frameHeight / cropHeight;
-+
-+		    Rect scaledDamageRect = Rect(
-+				    (int)(preDamageRect.left * wFactor),
-+				    (int)(preDamageRect.top * hFactor),
-+				    (int)(preDamageRect.right * wFactor),
-+				    (int)(preDamageRect.bottom * hFactor));
-+		    Region realDamage = Region(scaledDamageRect).translate(frame.left, frame.top);
-+		    error = hwcLayer->setSurfaceDamage(realDamage);
-+	    }
-+    } else {
-+	    error = hwcLayer->setSurfaceDamage(surfaceDamageRegion);
-+    }
-     if (error != HWC2::Error::None) {
-         ALOGE("[%s] Failed to set surface damage: %s (%d)", mName.string(),
-                 to_string(error).c_str(), static_cast<int32_t>(error));
-diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
-index 4055693..3f806b7 100644
---- a/services/surfaceflinger/SurfaceFlinger.cpp
-+++ b/services/surfaceflinger/SurfaceFlinger.cpp
-@@ -247,6 +247,13 @@ SurfaceFlinger::SurfaceFlinger()
-     // but since /data may be encrypted, we need to wait until after vold
-     // comes online to attempt to read the property. The property is
-     // instead read after the boot animation
-+    property_get("ro.hardware", value, "");
-+    if(strstr(value, "hi3660")||
-+		    strstr(value, "hi6250") ||
-+		    strstr(value, "hi3670") ||
-+		    strstr(value, "kirin970")) {
-+	    mDamageUsesScreenReference = true;
-+    }
- }
- 
- void SurfaceFlinger::onFirstRef()
-diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
-index 99d4a1a..c888b1d 100644
---- a/services/surfaceflinger/SurfaceFlinger.h
-+++ b/services/surfaceflinger/SurfaceFlinger.h
-@@ -727,6 +727,9 @@ private:
-     // Restrict layers to use two buffers in their bufferqueues.
-     bool mLayerTripleBufferingDisabled = false;
- 
-+    bool mDamageUsesScreenReference;
-+
-+
-     // these are thread safe
-     mutable MessageQueue mEventQueue;
-     FrameTracker mAnimFrameTracker;
--- 
-2.7.4
-
diff --git a/patches/platform_frameworks_opt_telephony/0001-Make-better-signal-levels-on-Huawei-devices.patch b/patches/platform_frameworks_opt_telephony/0001-Make-better-signal-levels-on-Huawei-devices.patch
deleted file mode 100644
index 48a7819..0000000
--- a/patches/platform_frameworks_opt_telephony/0001-Make-better-signal-levels-on-Huawei-devices.patch
+++ /dev/null
@@ -1,127 +0,0 @@
-From 5585d35cee6b6776c291b9e0f40132eee8bb2db0 Mon Sep 17 00:00:00 2001
-From: Pierre-Hugues Husson <phh@phh.me>
-Date: Sat, 14 Apr 2018 15:53:15 +0200
-Subject: [PATCH] Make better signal levels on Huawei devices
-
-All credits to OpenKirin team, and meticulus
-
-Change-Id: I1b1b80996ee88b6107c0cfd754caa4a1bfbaf13f
----
- src/java/com/android/internal/telephony/RIL.java | 99 ++++++++++++++++++++++++
- 1 file changed, 99 insertions(+)
-
-diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
-index 226ee8e..5392ca2 100644
---- a/src/java/com/android/internal/telephony/RIL.java
-+++ b/src/java/com/android/internal/telephony/RIL.java
-@@ -5092,8 +5092,107 @@ public final class RIL extends BaseCommands implements CommandsInterface {
-         return response;
-     }
- 
-+    static SignalStrength convertHalSignalStrengthHuawei(
-+            android.hardware.radio.V1_0.SignalStrength signalStrength) {
-+	            int gsmSignalStrength = signalStrength.gw.signalStrength;
-+        int gsmBitErrorRate = signalStrength.gw.bitErrorRate;
-+        int mWcdmaRscp = 0;
-+        int mWcdmaEcio = 0;
-+        int cdmaDbm = signalStrength.cdma.dbm;
-+        int cdmaEcio = signalStrength.cdma.ecio;
-+        int evdoDbm = signalStrength.evdo.dbm;
-+        int evdoEcio = signalStrength.evdo.ecio;
-+        int evdoSnr = signalStrength.evdo.signalNoiseRatio;
-+        int lteSignalStrength = signalStrength.lte.signalStrength;
-+        int lteRsrp = signalStrength.lte.rsrp;
-+        int lteRsrq = signalStrength.lte.rsrq;
-+        int lteRssnr = signalStrength.lte.rssnr;
-+        int lteCqi = signalStrength.lte.cqi;
-+        int mGsm = 0;
-+        int mRat = 0;
-+
-+        if (lteRsrp != 0) { // LTE
-+            if (lteRsrp > -20) lteSignalStrength = 64; // None or Unknown
-+            else if (lteRsrp >= -97) lteSignalStrength = 63; // Great
-+            else if (lteRsrp >= -105) lteSignalStrength = 11; // Good
-+            else if (lteRsrp >= -113) lteSignalStrength = 7; // Moderate
-+            else if (lteRsrp >= -120) lteSignalStrength = 4; // Poor
-+            else if (lteRsrp >= -140) lteSignalStrength = 64; // None or Unknown
-+        } else if (gsmSignalStrength == 0 && lteRsrp == 0) { // 3G
-+            lteRsrp = (mWcdmaRscp & 0xFF) - 256;
-+            lteRsrq = (mWcdmaEcio & 0xFF) - 256;
-+            if (lteRsrp > -20) { // None or Unknown
-+                lteSignalStrength = 64;
-+                lteRssnr = -200;
-+            } else if (lteRsrp >= -85) { // Great
-+                lteSignalStrength = 63;
-+                lteRssnr = 300;
-+            } else if (lteRsrp >= -95) { // Good
-+                lteSignalStrength = 11;
-+                lteRssnr = 129;
-+            } else if (lteRsrp >= -105) { // Moderate
-+                lteSignalStrength = 7;
-+                lteRssnr = 44;
-+            } else if (lteRsrp >= -115) { // Poor
-+                lteSignalStrength = 4;
-+                lteRssnr = 9;
-+            } else if (lteRsrp >= -140) { // None or Unknown
-+                lteSignalStrength = 64;
-+                lteRssnr = -200;
-+            }
-+        } else if (mWcdmaRscp == 0 && lteRsrp == 0) { // 2G
-+            lteRsrp = (gsmSignalStrength & 0xFF) - 256;
-+            if (lteRsrp > -20) { // None or Unknown
-+                lteSignalStrength = 64;
-+                lteRsrq = -21;
-+                lteRssnr = -200;
-+            } else if (lteRsrp >= -85) { // Great
-+                lteSignalStrength = 63;
-+                lteRsrq = -3;
-+                lteRssnr = 300;
-+            } else if (lteRsrp >= -95) { // Good
-+                lteSignalStrength = 11;
-+                lteRsrq = -7;
-+                lteRssnr = 129;
-+            } else if (lteRsrp >= -105) { // Moderate
-+                lteSignalStrength = 7;
-+                lteRsrq = -12;
-+                lteRssnr = 44;
-+            } else if (lteRsrp >= -115) { // Poor
-+                lteSignalStrength = 4;
-+                lteRsrq = -17;
-+                lteRssnr = 9;
-+            } else if (lteRsrp >= -140) { // None or Unknown
-+                lteSignalStrength = 64;
-+                lteRsrq = -21;
-+                lteRssnr = -200;
-+            }
-+        }
-+
-+        return new SignalStrength(gsmSignalStrength,
-+                gsmSignalStrength,
-+                cdmaDbm,
-+                cdmaEcio,
-+                evdoDbm,
-+                evdoEcio,
-+                evdoSnr,
-+                lteSignalStrength,
-+                lteRsrp,
-+                lteRsrq,
-+                lteRssnr,
-+                lteCqi,
-+                signalStrength.tdScdma.rscp,
-+                false);
-+    }
-+
-     static SignalStrength convertHalSignalStrength(
-             android.hardware.radio.V1_0.SignalStrength signalStrength) {
-+
-+	    String hardware = android.os.SystemProperties.get("ro.hardware", "");
-+        if(hardware.contains("hi3660") || hardware.contains("hi6250") || hardware.contains("hi3670") || hardware.contains("kirin"))
-+            return convertHalSignalStrengthHuawei(signalStrength);
-+
-+
-         return new SignalStrength(signalStrength.gw.signalStrength,
-                 signalStrength.gw.bitErrorRate,
-                 signalStrength.cdma.dbm,
--- 
-2.7.4
-
diff --git a/patches/platform_packages_apps_Settings/0001-Add-Bliss-Bass-customizations.patch b/patches/platform_packages_apps_Settings/0001-Add-Bliss-Bass-customizations.patch
deleted file mode 100644
index 13dbfbc..0000000
--- a/patches/platform_packages_apps_Settings/0001-Add-Bliss-Bass-customizations.patch
+++ /dev/null
@@ -1,259 +0,0 @@
-From d780314a9cc19782dd15659d34c25aa0a6a96115 Mon Sep 17 00:00:00 2001
-From: Jon West <electrikjesus@gmail.com>
-Date: Sun, 5 Aug 2018 00:38:06 -0400
-Subject: [PATCH] Add Bliss Bass customizations
-
----
- res/drawable/bliss_about.xml | 38 +++++++++++++++++++++---------------
- res/drawable/bliss_bass.xml  | 38 +++++++++++++++++++++---------------
- 2 files changed, 44 insertions(+), 32 deletions(-)
-
-diff --git a/res/drawable/bliss_about.xml b/res/drawable/bliss_about.xml
-index d5e41912e3e..8ff131189f6 100644
---- a/res/drawable/bliss_about.xml
-+++ b/res/drawable/bliss_about.xml
-@@ -21,95 +21,101 @@
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 503.74 97.02 C 505.30 82.03 509.07 66.82 517.92 54.36 C 525.18 63.58 529.76 74.68 531.84 86.19 C 532.55 90.46 534.08 95.09 532.11 99.23 C 528.92 106.74 525.14 114.04 523.14 121.99 C 520.21 130.06 519.09 138.59 517.43 146.98 C 515.27 134.45 512.65 121.89 507.60 110.17 C 505.96 105.92 503.21 101.77 503.74 97.02 Z" />
-+        android:pathData="M 497.23 84.82 C 499.14 73.69 502.97 62.72 509.67 53.53 C 518.86 64.60 523.44 78.86 524.75 93.03 C 525.15 96.57 523.10 99.64 521.71 102.72 C 515.29 115.96 511.67 130.37 509.51 144.88 C 507.28 137.93 506.74 130.59 504.62 123.62 C 502.74 115.91 499.12 108.81 496.31 101.44 C 494.87 95.96 496.33 90.27 497.23 84.82 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 480.10 128.05 C 475.96 110.06 476.03 91.26 479.51 73.16 C 496.70 88.34 507.08 109.98 512.17 132.06 C 515.34 144.99 515.98 158.32 516.37 171.57 C 512.69 166.91 508.92 162.32 505.41 157.52 C 498.95 148.49 490.99 140.69 483.26 132.77 C 481.97 131.38 480.55 129.95 480.10 128.05 Z" />
-+        android:pathData="M 472.60 127.47 C 468.02 109.53 467.97 90.56 471.73 72.44 C 475.87 75.18 479.11 79.00 482.18 82.84 C 501.30 107.17 508.64 138.84 508.22 169.33 C 501.90 163.00 497.57 155.06 491.59 148.45 C 487.35 143.66 483.15 138.81 478.52 134.39 C 476.40 132.22 473.94 130.24 472.60 127.47 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 537.98 93.99 C 543.03 86.51 548.21 78.97 555.26 73.19 C 558.51 90.53 559.09 108.62 555.23 125.91 C 554.56 131.09 549.84 134.03 546.65 137.65 C 536.14 147.81 527.86 159.93 518.96 171.45 C 519.00 163.25 518.60 154.99 519.81 146.84 C 522.48 128.31 528.17 110.02 537.98 93.99 Z" />
-+        android:pathData="M 521.67 107.45 C 527.61 94.23 535.49 81.40 546.79 72.11 C 549.26 86.21 550.05 100.68 548.41 114.92 C 547.40 120.90 547.14 127.93 542.10 132.14 C 530.19 142.93 521.13 156.30 511.01 168.67 C 509.18 147.78 513.63 126.69 521.67 107.45 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 445.28 77.61 C 454.99 81.44 463.24 88.05 470.51 95.42 C 472.23 97.32 474.94 98.97 474.72 101.90 C 475.17 110.30 475.90 118.68 477.18 127.00 C 471.02 122.22 464.60 117.77 457.78 113.96 C 455.58 112.73 453.15 111.40 452.11 108.97 C 447.84 99.09 445.24 88.41 445.28 77.61 Z" />
-+        android:pathData="M 437.75 76.56 C 449.00 80.31 457.85 88.70 465.88 97.09 C 467.32 98.34 467.24 100.31 467.28 102.04 C 467.40 109.91 468.96 117.66 469.39 125.51 C 463.79 121.42 458.38 117.00 452.22 113.77 C 449.34 112.15 445.92 110.68 444.57 107.43 C 440.37 97.69 437.93 87.18 437.75 76.56 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 561.34 98.41 C 569.18 89.53 578.78 82.17 589.63 77.36 C 589.44 89.05 586.76 100.88 581.19 111.19 C 573.23 116.30 565.00 121.06 557.61 127.03 C 558.74 119.40 559.66 111.73 559.87 104.01 C 559.95 102.08 559.84 99.88 561.34 98.41 Z" />
-+        android:pathData="M 556.16 93.19 C 563.07 86.06 571.29 80.13 580.52 76.40 C 580.76 85.83 578.57 95.17 575.11 103.89 C 573.93 106.84 572.89 110.32 569.72 111.71 C 562.21 115.50 555.71 120.86 548.79 125.55 C 549.33 120.03 550.31 114.57 550.82 109.06 C 551.15 105.79 550.47 102.45 551.20 99.22 C 552.16 96.75 554.39 95.09 556.16 93.19 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 422.90 105.18 C 429.32 106.57 435.91 107.35 442.11 109.62 C 460.13 115.85 475.65 127.64 488.64 141.39 C 498.42 151.10 506.13 162.59 514.31 173.63 C 496.74 172.74 478.94 169.76 462.94 162.17 C 451.67 156.89 444.18 146.44 438.07 136.00 C 432.03 126.23 427.63 115.60 422.90 105.18 Z" />
-+        android:pathData="M 415.82 103.66 C 428.78 105.44 441.42 109.68 452.72 116.30 C 474.84 129.71 491.87 149.98 506.07 171.29 C 492.27 171.05 478.47 168.93 465.42 164.36 C 454.82 161.05 444.75 154.94 438.26 145.77 C 428.91 132.83 421.89 118.37 415.82 103.66 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 595.01 108.81 C 600.52 107.06 606.27 106.33 611.93 105.21 C 604.56 122.44 596.29 139.63 583.84 153.82 C 574.55 162.67 561.97 166.83 549.75 169.74 C 540.15 171.90 530.37 173.01 520.56 173.63 C 531.26 157.70 543.62 142.80 558.00 130.06 C 568.85 120.73 581.35 113.18 595.01 108.81 Z" />
-+        android:pathData="M 594.90 105.16 C 597.42 104.67 599.94 104.21 602.47 103.79 C 595.93 120.15 588.02 136.20 576.82 149.91 C 571.10 156.73 562.90 160.79 554.68 163.78 C 541.09 168.52 526.72 170.99 512.34 171.27 C 522.69 155.40 535.12 140.91 549.23 128.28 C 562.25 117.05 577.81 108.16 594.90 105.16 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 282.28 83.43 C 286.74 81.73 291.78 86.24 290.61 90.85 C 289.87 95.69 283.12 97.76 279.80 94.16 C 276.31 91.07 277.83 84.70 282.28 83.43 Z" />
-+        android:pathData="M 277.39 69.58 C 282.83 67.86 288.68 73.48 286.65 78.96 C 285.34 84.70 276.90 86.24 273.47 81.58 C 269.93 77.67 272.30 70.69 277.39 69.58 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 201.37 83.94 C 204.46 83.81 207.55 83.81 210.65 83.95 C 210.44 93.82 210.94 103.70 210.20 113.55 C 214.48 107.67 221.75 104.27 229.03 105.00 C 237.95 105.46 245.34 112.37 248.57 120.37 C 253.19 131.78 249.66 146.25 239.30 153.31 C 230.32 159.74 216.53 157.52 210.22 148.36 C 210.21 150.72 210.19 153.09 210.19 155.45 C 207.26 155.46 204.34 155.46 201.41 155.46 C 201.36 131.62 201.45 107.78 201.37 83.94 M 222.43 113.65 C 208.50 116.80 206.10 137.92 217.03 145.86 C 222.08 149.57 229.60 149.56 234.58 145.72 C 243.86 138.75 243.66 122.58 234.16 115.88 C 230.82 113.46 226.42 112.82 222.43 113.65 Z" />
-+        android:pathData="M 185.01 70.25 C 188.40 70.24 191.80 70.25 195.20 70.26 C 195.89 81.23 195.33 92.22 195.24 103.20 C 201.62 95.21 213.02 92.12 222.62 95.50 C 233.14 99.33 240.10 110.07 241.09 120.99 C 242.18 132.71 236.54 145.30 226.04 151.10 C 215.99 156.64 202.27 153.90 195.26 144.76 C 195.20 147.17 195.07 149.59 194.95 152.00 C 191.55 152.00 188.15 152.00 184.75 151.99 C 184.80 124.75 184.58 97.49 185.01 70.25 M 208.43 104.54 C 195.49 107.90 191.52 125.22 198.17 135.73 C 202.67 144.26 215.08 146.66 222.60 140.75 C 229.36 135.89 231.28 126.68 229.70 118.88 C 228.31 109.35 217.95 101.69 208.43 104.54 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 258.46 83.95 C 261.54 83.83 264.62 83.83 267.71 83.89 C 267.63 107.77 267.84 131.66 267.60 155.53 C 264.57 155.45 261.54 155.44 258.51 155.46 C 258.46 131.62 258.56 107.79 258.46 83.95 Z" />
-+        android:pathData="M 250.01 70.25 C 253.42 70.25 256.82 70.25 260.23 70.25 C 260.39 72.16 260.51 74.07 260.52 75.99 C 260.47 101.33 260.53 126.67 260.49 152.00 C 256.99 152.00 253.50 152.00 250.00 152.00 C 250.00 124.75 249.99 97.50 250.01 70.25 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 303.65 109.69 C 313.75 101.43 331.87 103.87 337.60 116.25 C 334.90 117.38 332.20 118.50 329.50 119.63 C 325.81 112.72 315.07 110.68 309.59 116.50 C 307.53 118.83 308.91 122.41 311.60 123.50 C 318.87 126.83 327.72 126.71 334.03 132.13 C 337.40 134.60 338.37 139.04 338.30 142.99 C 337.89 148.97 332.92 153.56 327.57 155.53 C 321.39 157.72 314.28 157.60 308.33 154.72 C 303.52 152.25 299.91 147.95 297.71 143.06 C 300.42 141.88 303.14 140.72 305.86 139.58 C 307.79 143.54 310.94 147.21 315.38 148.32 C 319.85 149.41 325.51 148.60 328.32 144.60 C 330.18 141.33 327.45 137.78 324.40 136.61 C 317.51 133.73 309.33 133.66 303.39 128.67 C 297.64 124.02 297.88 114.24 303.65 109.69 Z" />
-+        android:pathData="M 627.85 70.26 C 631.31 70.24 634.78 70.24 638.26 70.26 C 638.52 81.12 638.28 91.96 638.23 102.83 C 643.24 97.37 650.50 93.73 658.02 94.21 C 666.52 94.07 674.30 99.29 678.78 106.28 C 687.24 118.65 685.38 137.10 674.20 147.21 C 666.89 154.51 654.82 155.91 645.76 151.21 C 642.82 149.59 640.43 147.19 637.99 144.93 C 637.99 147.29 638.00 149.64 638.00 152.00 C 634.58 152.00 631.16 152.00 627.75 151.99 C 627.81 124.75 627.62 97.50 627.85 70.26 M 651.32 104.53 C 640.21 107.43 635.68 120.77 638.92 130.97 C 641.18 140.90 653.12 147.10 662.42 142.56 C 674.48 137.01 676.55 119.33 668.18 109.78 C 664.05 105.21 657.36 102.77 651.32 104.53 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 348.96 109.86 C 359.01 101.39 377.34 103.79 383.09 116.25 C 380.39 117.39 377.69 118.51 374.98 119.61 C 371.33 112.77 360.79 110.73 355.24 116.33 C 353.18 118.45 354.10 122.10 356.74 123.29 C 363.91 126.84 372.75 126.57 379.15 131.82 C 382.80 134.28 383.90 138.95 383.79 143.10 C 383.37 148.90 378.57 153.38 373.41 155.40 C 367.02 157.77 359.58 157.65 353.47 154.53 C 348.83 152.01 345.35 147.83 343.21 143.05 C 345.92 141.89 348.64 140.72 351.36 139.57 C 353.24 143.40 356.20 146.96 360.44 148.21 C 364.99 149.48 370.77 148.72 373.76 144.72 C 375.61 141.63 373.25 138.03 370.30 136.80 C 363.39 133.73 355.13 133.77 349.07 128.82 C 343.20 124.31 343.31 114.51 348.96 109.86 Z" />
-+        android:pathData="M 299.95 100.99 C 304.70 95.76 312.14 94.07 318.96 94.21 C 327.76 94.14 336.68 99.02 340.51 107.11 C 337.47 108.63 334.34 109.95 331.16 111.16 C 326.71 104.16 316.33 101.27 309.46 106.46 C 306.54 108.17 306.39 112.85 309.34 114.61 C 317.13 119.11 326.90 118.59 334.42 123.75 C 339.49 126.89 342.15 133.28 340.99 139.12 C 340.00 145.01 335.14 149.48 329.87 151.78 C 321.63 155.12 311.68 154.69 304.14 149.80 C 299.79 146.89 295.95 142.70 294.77 137.47 C 297.80 136.27 300.81 135.03 303.82 133.78 C 306.29 137.86 309.34 142.11 314.12 143.57 C 318.80 144.79 324.32 144.40 328.15 141.19 C 330.77 139.25 330.78 134.70 328.16 132.76 C 324.45 129.40 319.27 128.79 314.62 127.55 C 309.24 126.23 303.53 124.53 299.60 120.38 C 294.69 115.11 295.12 106.17 299.95 100.99 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 664.75 114.70 C 668.51 106.96 678.14 103.07 686.21 106.17 C 685.11 109.08 684.74 112.44 683.09 115.03 C 680.10 114.88 676.99 113.96 674.09 115.16 C 668.93 117.12 665.27 122.42 665.15 127.93 C 665.01 137.10 665.15 146.28 665.10 155.45 C 662.03 155.46 658.96 155.46 655.90 155.45 C 655.90 139.12 655.87 122.78 655.92 106.45 C 658.84 106.45 661.76 106.45 664.69 106.45 C 664.69 109.20 664.70 111.95 664.75 114.70 Z" />
-+        android:pathData="M 353.42 99.51 C 365.17 90.17 385.54 93.08 392.40 107.07 C 389.37 108.59 386.26 109.95 383.09 111.16 C 378.65 104.21 368.31 101.25 361.46 106.43 C 359.10 107.59 359.20 110.39 358.89 112.62 C 363.84 117.44 370.99 117.90 377.28 119.80 C 382.19 121.18 387.22 123.38 390.37 127.56 C 394.57 133.49 393.84 142.53 388.29 147.38 C 377.56 157.59 358.05 155.67 349.43 143.64 C 348.05 141.80 347.32 139.61 346.72 137.42 C 349.73 136.26 352.71 135.03 355.71 133.82 C 357.96 137.53 360.67 141.36 364.79 143.13 C 369.80 144.98 375.94 144.57 380.17 141.11 C 382.64 139.05 382.62 134.89 380.19 132.81 C 376.65 129.55 371.70 128.84 367.21 127.73 C 361.43 126.41 355.27 124.64 351.20 120.05 C 345.98 114.20 347.34 104.25 353.42 99.51 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 705.51 105.57 C 713.31 103.87 722.10 105.41 728.10 110.92 C 739.49 120.70 739.72 140.54 728.56 150.57 C 719.12 159.58 702.37 159.09 693.48 149.53 C 686.72 142.62 685.06 131.95 687.53 122.84 C 689.80 114.39 696.92 107.40 705.51 105.57 M 708.39 113.62 C 695.28 116.20 691.62 134.67 700.27 143.75 C 705.11 149.18 713.94 150.16 719.98 146.22 C 730.12 139.70 730.17 122.52 720.14 115.87 C 716.75 113.51 712.40 112.83 708.39 113.62 Z" />
-+        android:pathData="M 691.91 105.50 C 696.15 98.19 704.73 94.38 712.95 94.23 C 720.41 93.94 728.53 95.59 733.93 101.10 C 738.52 105.80 739.99 112.62 740.00 119.00 C 740.00 130.00 740.00 141.00 740.00 152.00 C 736.58 152.00 733.16 152.00 729.75 151.99 C 729.75 149.42 729.74 146.85 729.74 144.28 C 726.69 147.76 723.39 151.36 718.84 152.79 C 709.83 155.78 698.69 152.88 693.23 144.86 C 689.36 139.45 689.15 131.90 692.15 126.04 C 694.92 121.17 699.97 117.92 705.36 116.65 C 713.51 114.78 722.12 115.69 729.93 118.57 C 729.49 114.86 728.80 110.82 725.87 108.19 C 721.96 104.03 715.69 103.20 710.35 104.45 C 706.55 105.46 703.68 108.36 701.10 111.17 C 698.08 109.20 695.02 107.30 691.91 105.50 M 706.63 126.69 C 703.28 128.43 700.60 132.17 701.23 136.07 C 702.22 140.93 707.22 144.15 712.01 144.23 C 721.04 144.72 728.79 137.01 729.92 128.33 C 723.17 123.82 713.84 122.53 706.63 126.69 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 753.01 113.55 C 757.05 107.88 764.04 104.00 771.13 105.12 C 776.67 105.63 781.51 109.28 784.06 114.15 C 789.82 104.58 804.40 101.59 812.95 109.07 C 818.96 114.61 818.70 123.45 818.61 130.98 C 818.59 139.14 818.62 147.30 818.59 155.46 C 815.52 155.46 812.47 155.46 809.41 155.46 C 809.36 146.32 809.42 137.18 809.39 128.04 C 809.26 123.80 809.22 119.07 806.26 115.71 C 803.83 113.46 800.21 113.35 797.10 113.38 C 790.19 114.23 786.34 121.58 786.11 127.95 C 785.83 137.11 786.09 146.29 786.00 155.46 C 782.93 155.46 779.86 155.46 776.80 155.45 C 776.78 146.31 776.82 137.17 776.79 128.02 C 776.67 123.92 776.60 119.43 773.97 116.03 C 771.74 113.55 768.07 113.44 764.98 113.34 C 759.60 113.59 755.90 118.32 754.32 123.05 C 753.16 127.28 753.39 131.70 753.40 136.04 C 753.40 142.51 753.40 148.98 753.39 155.45 C 750.32 155.47 747.25 155.46 744.18 155.42 C 744.21 139.10 744.19 122.79 744.19 106.47 C 747.12 106.45 750.05 106.45 752.99 106.46 C 752.99 108.82 753.00 111.19 753.01 113.55 Z" />
-+        android:pathData="M 754.41 99.32 C 766.13 90.33 786.47 92.99 793.13 107.02 C 790.17 108.63 787.07 109.94 783.96 111.21 C 779.51 104.26 769.30 101.31 762.37 106.31 C 759.88 107.57 760.10 110.59 759.88 112.94 C 765.46 117.83 773.19 118.00 779.89 120.41 C 784.67 121.92 789.60 124.41 792.10 128.97 C 795.27 135.01 794.07 143.27 788.81 147.77 C 778.59 156.71 761.32 155.93 752.16 145.83 C 749.91 143.59 748.54 140.69 747.17 137.87 C 750.26 136.36 753.41 134.97 756.66 133.85 C 759.03 138.36 762.72 142.69 767.91 143.84 C 772.78 144.74 778.71 144.10 781.97 139.94 C 783.95 137.12 782.37 133.11 779.47 131.63 C 771.13 126.84 760.19 127.97 752.94 121.04 C 746.77 115.21 747.75 104.39 754.41 99.32 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 279.70 106.46 C 282.77 106.45 285.83 106.45 288.90 106.46 C 288.90 122.79 288.90 139.12 288.90 155.45 C 285.83 155.46 282.77 155.46 279.70 155.45 C 279.70 139.12 279.69 122.79 279.70 106.46 Z" />
-+        android:pathData="M 804.75 100.82 C 809.62 95.60 817.16 93.97 824.05 94.22 C 832.62 94.35 841.23 99.11 844.97 107.00 C 841.96 108.57 838.94 110.24 835.57 110.90 C 831.04 104.28 821.17 101.35 814.37 106.25 C 811.08 107.94 811.03 113.07 814.23 114.86 C 822.26 119.19 832.21 118.71 839.72 124.22 C 847.18 129.17 847.61 141.15 841.24 147.17 C 833.99 154.37 822.28 155.53 813.00 152.05 C 806.47 149.61 801.83 144.03 798.80 137.95 C 801.99 136.44 805.23 134.99 808.59 133.86 C 810.53 137.27 812.72 140.84 816.42 142.59 C 821.61 145.12 828.51 144.83 832.98 140.95 C 835.85 138.60 835.02 133.90 831.98 132.10 C 824.12 126.80 813.37 128.24 805.94 121.97 C 799.35 117.14 799.03 106.44 804.75 100.82 Z" />
-+    <path
-+        android:fillColor="?android:attr/colorAccent"
-+        android:fillAlpha="1.00"
-+        android:strokeAlpha="1.00"
-+        android:strokeWidth="1"
-+        android:pathData="M 274.00 96.00 C 277.58 95.99 281.17 96.00 284.75 96.01 C 284.75 114.67 284.74 133.33 284.75 151.99 C 281.17 152.00 277.59 152.01 274.00 152.00 C 274.00 133.33 274.00 114.67 274.00 96.00 Z" />
- </vector>
-\ No newline at end of file
-diff --git a/res/drawable/bliss_bass.xml b/res/drawable/bliss_bass.xml
-index 44d6c5d6870..b8ca2a67f49 100644
---- a/res/drawable/bliss_bass.xml
-+++ b/res/drawable/bliss_bass.xml
-@@ -21,95 +21,101 @@
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 106.73 75.24 C 108.55 62.42 112.56 49.56 120.42 39.12 C 130.07 50.42 135.09 65.22 136.06 79.92 C 130.01 91.26 124.97 103.27 122.33 115.90 C 121.52 120.35 120.83 124.82 119.96 129.26 C 117.90 114.53 114.10 99.98 107.21 86.73 C 105.05 83.21 106.42 79.05 106.73 75.24 Z" />
-+        android:pathData="M 120.40 39.87 C 129.93 50.98 134.79 65.51 135.94 79.95 C 133.20 86.17 129.63 92.06 127.50 98.58 C 123.46 108.37 121.69 118.84 119.96 129.22 C 118.02 116.03 115.02 102.87 109.13 90.83 C 107.99 87.97 105.79 85.25 106.16 82.02 C 107.40 67.14 111.38 52.00 120.40 39.87 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 133.55 90.59 C 139.42 77.88 147.67 66.06 158.61 57.22 C 161.75 75.12 162.77 94.03 157.24 111.56 C 152.36 117.22 146.25 121.78 141.41 127.52 C 134.15 135.20 127.89 143.73 121.16 151.85 C 120.90 130.89 124.40 109.57 133.55 90.59 Z" />
-+        android:pathData="M 81.68 57.74 C 97.13 70.62 107.44 88.83 113.15 107.95 C 117.05 122.13 119.02 136.86 118.81 151.58 C 113.86 146.03 109.79 139.77 104.79 134.26 C 98.97 127.41 92.69 120.96 86.00 114.96 C 84.56 113.52 82.75 112.16 82.35 110.05 C 77.72 93.01 78.44 74.96 81.68 57.74 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 81.30 57.19 C 97.00 70.15 107.36 88.66 113.13 107.99 C 117.03 122.25 119.02 137.05 118.78 151.84 C 114.23 146.83 110.52 141.12 106.06 136.03 C 98.94 127.21 90.48 119.60 82.52 111.60 C 77.18 93.99 77.99 75.10 81.30 57.19 Z" />
-+        android:pathData="M 140.67 77.63 C 145.56 70.25 151.30 63.35 158.25 57.80 C 160.86 72.42 161.88 87.50 159.24 102.19 C 158.10 106.35 158.33 111.50 154.50 114.34 C 141.90 125.36 131.53 138.54 121.14 151.58 C 120.68 125.78 126.59 99.47 140.67 77.63 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 46.45 61.33 C 57.39 65.51 66.66 73.07 74.92 81.21 C 77.07 82.79 76.46 85.66 76.69 87.96 C 76.69 95.13 78.13 102.16 79.15 109.22 C 73.28 104.82 67.33 100.48 60.74 97.20 C 58.57 95.83 55.70 95.18 54.16 93.03 C 49.36 83.20 46.18 72.34 46.45 61.33 Z" />
-+        android:pathData="M 47.14 61.88 C 58.02 66.05 67.25 73.57 75.45 81.68 C 77.43 83.19 76.86 85.88 77.10 88.04 C 77.08 95.21 78.49 102.26 79.54 109.32 C 73.77 105.01 67.93 100.72 61.45 97.50 C 58.88 95.89 55.23 95.15 54.12 91.98 C 49.80 82.57 46.87 72.31 47.14 61.88 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 164.50 81.62 C 172.74 73.09 182.39 65.73 193.46 61.29 C 193.49 72.65 190.27 83.93 184.97 93.90 C 176.53 98.41 168.29 103.35 160.66 109.16 C 162.08 101.86 163.25 94.46 163.25 87.00 C 163.46 85.20 162.94 82.95 164.50 81.62 Z" />
-+        android:pathData="M 163.19 83.19 C 171.26 74.00 181.43 66.50 192.78 61.84 C 192.76 70.88 190.77 79.86 187.19 88.14 C 185.96 90.77 185.40 94.26 182.34 95.41 C 174.49 99.17 167.31 104.14 160.29 109.25 C 162.20 100.68 162.71 91.91 163.19 83.19 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 23.51 87.96 C 38.10 89.62 52.28 94.48 64.82 102.12 C 85.76 115.16 102.34 133.88 116.80 153.62 C 98.30 152.22 79.32 149.91 62.50 141.56 C 52.87 136.91 45.94 128.33 40.49 119.38 C 33.77 109.51 28.77 98.64 23.51 87.96 Z" />
-+        android:pathData="M 24.43 88.26 C 39.19 89.93 53.53 94.95 66.15 102.78 C 86.51 115.69 102.69 133.99 116.83 153.30 C 98.42 151.92 79.53 149.60 62.82 141.24 C 53.25 136.54 46.43 127.95 41.01 119.02 C 34.45 109.36 29.57 98.71 24.43 88.26 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 196.91 92.09 C 203.26 89.98 209.93 89.23 216.48 87.97 C 211.05 98.83 206.00 109.94 199.16 120.01 C 194.30 126.73 189.80 134.15 182.56 138.60 C 174.90 143.44 166.22 146.56 157.42 148.64 C 146.23 151.67 134.62 152.90 123.07 153.61 C 132.82 140.37 143.29 127.52 155.74 116.71 C 167.61 105.87 181.54 97.01 196.91 92.09 Z" />
-+        android:pathData="M 195.43 92.60 C 201.95 90.35 208.83 89.56 215.57 88.27 C 210.13 99.10 205.12 110.21 198.25 120.23 C 193.55 126.75 189.18 133.89 182.21 138.26 C 174.91 142.96 166.61 146.02 158.20 148.08 C 146.75 151.25 134.88 152.59 123.04 153.28 C 132.87 139.94 143.45 126.99 156.05 116.16 C 167.45 105.84 180.78 97.44 195.43 92.60 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 67.43 164.42 C 71.48 163.18 73.06 169.99 68.87 170.66 C 64.98 171.60 63.50 165.26 67.43 164.42 Z" />
-+        android:pathData="M 49.14 164.27 C 50.65 164.27 52.15 164.27 53.66 164.27 C 53.65 175.96 53.66 187.65 53.65 199.34 C 52.15 199.33 50.64 199.33 49.14 199.33 C 49.14 187.64 49.14 175.96 49.14 164.27 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 27.23 164.73 C 28.76 164.72 30.29 164.71 31.81 164.68 C 31.76 169.53 31.97 174.40 31.59 179.26 C 34.39 175.73 39.22 174.14 43.50 175.80 C 52.34 178.94 54.16 192.13 47.08 198.01 C 42.73 202.19 35.15 201.52 31.55 196.67 C 31.57 197.53 31.61 199.24 31.63 200.09 C 30.17 200.09 28.71 200.09 27.26 200.09 C 27.24 188.30 27.29 176.52 27.23 164.73 M 37.32 179.60 C 29.49 181.70 29.90 195.34 38.11 196.53 C 43.48 197.61 47.81 191.92 46.88 186.90 C 46.77 182.23 41.98 178.10 37.32 179.60 Z" />
-+        android:pathData="M 60.26 164.29 C 62.23 163.05 65.06 164.77 64.94 167.08 C 65.04 169.36 62.26 171.03 60.30 169.86 C 58.09 168.84 58.07 165.34 60.26 164.29 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 55.54 200.14 C 55.43 188.33 55.51 176.51 55.49 164.69 C 57.00 164.70 58.52 164.70 60.03 164.70 C 60.04 176.49 60.03 188.27 60.03 200.06 C 58.53 200.10 57.03 200.12 55.54 200.14 Z" />
-+        android:pathData="M 125.24 164.27 C 126.74 164.27 128.24 164.27 129.74 164.27 C 129.72 169.06 129.89 173.85 129.52 178.63 C 132.50 175.04 137.53 173.57 141.89 175.45 C 150.32 179.08 151.74 191.96 144.55 197.53 C 140.18 201.44 133.03 200.55 129.45 195.98 C 129.49 196.82 129.55 198.49 129.59 199.33 C 128.50 199.33 126.33 199.34 125.24 199.34 C 125.23 187.65 125.24 175.96 125.24 164.27 M 133.55 179.72 C 127.40 183.24 128.61 194.80 136.05 195.81 C 141.46 196.87 145.68 191.00 144.64 186.01 C 144.44 180.76 138.20 176.76 133.55 179.72 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 77.68 177.69 C 82.70 173.35 91.52 174.60 94.71 180.61 C 93.40 181.18 92.10 181.75 90.79 182.31 C 88.33 178.84 82.51 177.98 79.99 181.84 C 80.28 182.39 80.87 183.47 81.16 184.02 C 85.52 186.10 91.61 185.84 94.29 190.47 C 96.59 195.04 92.44 199.97 87.88 200.55 C 82.57 201.89 76.98 198.94 74.78 194.01 C 76.10 193.44 77.42 192.87 78.74 192.30 C 80.54 195.91 85.13 198.23 88.83 195.87 C 90.68 195.03 90.16 192.99 89.57 191.51 C 85.83 189.63 81.38 189.47 77.90 187.04 C 74.90 184.90 74.96 180.03 77.68 177.69 Z" />
-+        android:pathData="M 21.18 164.28 C 22.68 164.27 24.18 164.27 25.69 164.27 C 25.66 169.08 25.83 173.90 25.46 178.70 C 28.19 175.41 32.68 173.64 36.84 175.15 C 45.03 177.64 47.69 189.07 42.46 195.51 C 38.59 201.20 29.57 201.51 25.39 195.98 C 25.43 196.82 25.50 198.49 25.53 199.33 C 24.08 199.33 22.63 199.33 21.18 199.33 C 21.18 187.65 21.19 175.96 21.18 164.28 M 30.23 179.33 C 23.34 182.31 24.22 194.75 31.99 195.81 C 37.37 196.86 41.60 191.07 40.60 186.09 C 40.41 181.12 34.93 177.13 30.23 179.33 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 100.45 177.43 C 105.55 173.41 114.10 174.72 117.20 180.64 C 115.91 181.19 114.62 181.73 113.33 182.28 C 110.75 178.79 104.68 177.96 102.30 182.10 C 105.39 186.73 112.30 185.02 115.86 189.11 C 118.59 192.06 117.47 197.16 114.04 199.06 C 108.35 202.82 99.92 200.36 97.27 194.01 C 98.59 193.43 99.92 192.86 101.25 192.30 C 103.26 197.02 110.23 198.61 113.21 193.95 C 110.96 188.63 103.93 190.32 100.14 186.84 C 97.22 184.52 97.62 179.66 100.45 177.43 Z" />
-+        android:pathData="M 59.53 175.34 C 61.03 175.34 62.53 175.33 64.03 175.34 C 64.03 183.33 64.03 191.33 64.03 199.33 C 62.53 199.33 61.03 199.33 59.53 199.34 C 59.53 191.34 59.53 183.34 59.53 175.34 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 136.58 179.92 C 138.71 176.13 143.14 174.34 147.31 175.69 C 146.86 177.13 146.40 178.57 145.94 180.02 C 142.19 179.19 137.91 181.08 137.14 185.09 C 136.53 190.06 137.00 195.10 136.86 200.09 C 135.34 200.09 133.82 200.09 132.31 200.09 C 132.31 192.02 132.31 183.95 132.31 175.88 C 133.76 175.87 135.22 175.87 136.68 175.87 C 136.66 177.22 136.63 178.57 136.58 179.92 Z" />
-+        android:pathData="M 71.71 176.63 C 76.87 172.97 84.94 174.35 88.04 180.06 C 86.74 180.60 85.43 181.14 84.12 181.68 C 81.52 178.16 76.21 177.76 73.20 180.99 C 75.57 186.04 82.35 184.41 86.06 187.86 C 89.33 190.48 88.63 196.00 85.16 198.12 C 79.53 202.12 70.99 199.70 68.22 193.36 C 69.52 192.77 70.83 192.19 72.14 191.62 C 73.99 195.12 78.45 197.51 82.12 195.17 C 84.07 194.40 83.92 191.73 82.30 190.74 C 78.78 188.54 74.10 188.90 70.93 186.04 C 68.07 183.59 68.77 178.71 71.71 176.63 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 156.45 175.66 C 161.25 174.42 166.99 175.84 169.86 180.12 C 173.84 186.01 172.74 195.49 166.24 199.19 C 160.81 202.04 152.77 201.05 149.61 195.32 C 145.05 188.70 148.10 177.38 156.45 175.66 M 156.30 180.21 C 149.91 183.47 150.80 194.86 158.05 196.42 C 163.61 198.03 168.58 192.29 167.61 186.95 C 167.54 181.52 161.16 177.36 156.30 180.21 Z" />
-+        android:pathData="M 93.83 176.76 C 98.97 172.92 107.17 174.31 110.33 180.05 C 109.05 180.59 107.76 181.13 106.48 181.68 C 103.77 178.19 98.54 177.77 95.44 180.97 C 97.77 186.00 104.48 184.41 108.21 187.75 C 111.67 190.38 110.93 196.17 107.25 198.25 C 101.58 202.08 93.25 199.60 90.51 193.35 C 91.80 192.77 93.09 192.20 94.39 191.63 C 95.99 193.79 97.98 196.26 100.98 196.07 C 103.33 196.29 107.19 194.35 105.38 191.58 C 102.14 188.22 96.46 189.28 93.12 185.95 C 90.42 183.52 91.04 178.85 93.83 176.76 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 180.19 179.20 C 182.51 176.84 185.53 174.62 189.06 175.18 C 191.90 175.31 194.14 177.26 195.67 179.51 C 197.89 176.64 201.40 174.51 205.15 175.24 C 209.16 175.37 212.25 178.95 212.48 182.83 C 213.05 188.56 212.60 194.34 212.74 200.09 C 211.22 200.09 209.70 200.09 208.19 200.10 C 207.92 194.09 208.81 187.95 207.60 182.03 C 205.74 177.53 198.62 179.01 197.37 183.30 C 195.88 188.72 196.91 194.47 196.65 200.03 C 195.12 200.05 193.60 200.08 192.07 200.13 C 191.85 194.22 192.59 188.23 191.61 182.39 C 190.10 177.56 182.60 178.80 181.30 183.22 C 179.72 188.65 180.82 194.46 180.53 200.05 C 179.01 200.06 177.48 200.08 175.96 200.12 C 175.96 192.04 175.96 183.95 175.96 175.87 C 177.42 175.87 178.89 175.87 180.35 175.87 C 180.31 176.71 180.23 178.37 180.19 179.20 Z" />
-+        android:pathData="M 152.77 179.20 C 157.41 172.87 169.12 172.84 172.50 180.39 C 174.08 186.57 173.02 193.03 173.32 199.33 C 171.88 199.33 170.43 199.33 168.99 199.33 C 169.01 198.49 169.04 196.79 169.05 195.95 C 165.83 200.68 158.72 201.44 154.58 197.51 C 151.28 194.56 151.38 188.71 154.97 186.03 C 159.11 182.95 164.69 183.58 169.31 185.11 C 168.76 183.11 168.35 180.74 166.33 179.68 C 163.16 177.47 159.10 179.12 156.71 181.69 C 155.40 180.86 154.08 180.02 152.77 179.20 M 157.16 190.33 C 155.55 193.42 159.05 196.53 162.07 196.02 C 165.93 195.92 168.53 192.47 169.28 188.97 C 165.49 187.22 159.81 186.24 157.16 190.33 Z" />
-     <path
-         android:fillColor="?android:attr/colorAccent"
-         android:fillAlpha="1.00"
-         android:strokeAlpha="1.00"
-         android:strokeWidth="1"
--        android:pathData="M 65.97 175.87 C 67.49 175.87 69.00 175.87 70.52 175.87 C 70.53 183.91 70.48 191.95 70.55 199.98 C 69.02 200.03 67.50 200.08 65.97 200.14 C 65.97 192.05 65.97 183.96 65.97 175.87 Z" />
-+        android:pathData="M 179.83 176.75 C 184.97 172.92 193.16 174.32 196.32 180.05 C 195.03 180.59 193.75 181.13 192.47 181.68 C 189.76 178.20 184.53 177.76 181.43 180.97 C 183.76 185.99 190.46 184.42 194.19 187.75 C 197.66 190.38 196.91 196.19 193.21 198.26 C 187.55 202.08 179.24 199.59 176.49 193.36 C 177.78 192.77 179.08 192.18 180.37 191.60 C 181.96 193.77 183.93 196.24 186.92 196.07 C 189.45 196.38 193.44 194.04 191.17 191.24 C 187.69 188.38 182.40 189.13 179.08 185.93 C 176.40 183.50 177.03 178.83 179.83 176.75 Z" />
-+    <path
-+        android:fillColor="?android:attr/colorAccent"
-+        android:fillAlpha="1.00"
-+        android:strokeAlpha="1.00"
-+        android:strokeWidth="1"
-+        android:pathData="M 202.41 176.51 C 207.60 173.00 215.48 174.43 218.60 180.04 C 217.30 180.59 216.00 181.15 214.70 181.71 C 212.06 178.16 206.80 177.78 203.68 180.96 C 206.24 186.34 213.87 184.20 217.36 188.64 C 220.13 191.84 218.41 197.09 214.71 198.73 C 209.01 201.91 201.42 199.26 198.76 193.35 C 200.05 192.77 201.35 192.19 202.66 191.62 C 204.34 194.04 206.74 196.61 210.02 196.03 C 212.34 196.07 215.53 193.69 213.48 191.32 C 210.02 188.28 204.55 189.18 201.24 185.83 C 198.59 183.23 199.44 178.50 202.41 176.51 Z" />
- </vector>
-\ No newline at end of file
--- 
-2.17.1
-
diff --git a/patches/platform_system_bt/0001-Make-BTM_BYPASS_EXTRA_ACL_SETUP-dynamic.patch b/patches/platform_system_bt/0001-Make-BTM_BYPASS_EXTRA_ACL_SETUP-dynamic.patch
index f626f9f..bff9460 100644
--- a/patches/platform_system_bt/0001-Make-BTM_BYPASS_EXTRA_ACL_SETUP-dynamic.patch
+++ b/patches/platform_system_bt/0001-Make-BTM_BYPASS_EXTRA_ACL_SETUP-dynamic.patch
@@ -1,18 +1,18 @@
-From d246922d298906f22a3dc64607b421ed7219e5c4 Mon Sep 17 00:00:00 2001
+From c55023b50ae531a72fc644aa9a752fdc1cf3a1df Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <phh@phh.me>
 Date: Tue, 20 Feb 2018 23:04:50 +0100
 Subject: [PATCH] Make BTM_BYPASS_EXTRA_ACL_SETUP dynamic
 
 Change-Id: Icb0868566b29b053ed7e83c9fd32e225af3f2e46
 ---
- hci/include/bt_hci_bdroid.h |  3 +++
- include/bt_target.h         |  3 +++
- stack/btm/btm_acl.cc        | 20 ++++++++++----------
- stack/btm/btm_sec.cc        | 18 +++++++++---------
+ hci/include/bt_hci_bdroid.h  |  3 +++
+ internal_include/bt_target.h |  3 +++
+ stack/btm/btm_acl.cc         | 20 ++++++++++----------
+ stack/btm/btm_sec.cc         | 18 +++++++++---------
  4 files changed, 25 insertions(+), 19 deletions(-)
 
 diff --git a/hci/include/bt_hci_bdroid.h b/hci/include/bt_hci_bdroid.h
-index aa193d0..6c82f19 100644
+index cf2c1136f..e2844db82 100644
 --- a/hci/include/bt_hci_bdroid.h
 +++ b/hci/include/bt_hci_bdroid.h
 @@ -32,6 +32,9 @@
@@ -25,10 +25,10 @@
  
  /******************************************************************************
   *  Constants & Macros
-diff --git a/include/bt_target.h b/include/bt_target.h
-index eadfc92..bf1f95d 100644
---- a/include/bt_target.h
-+++ b/include/bt_target.h
+diff --git a/internal_include/bt_target.h b/internal_include/bt_target.h
+index cf09b15da..396114faf 100644
+--- a/internal_include/bt_target.h
++++ b/internal_include/bt_target.h
 @@ -32,6 +32,9 @@
  #ifdef HAS_BDROID_BUILDCFG
  #include "bdroid_buildcfg.h"
@@ -40,10 +40,10 @@
  #include "bt_types.h" /* This must be defined AFTER buildcfg.h */
  
 diff --git a/stack/btm/btm_acl.cc b/stack/btm/btm_acl.cc
-index 8df6acb..7eba37d 100644
+index ee2530ac2..389a998c6 100644
 --- a/stack/btm/btm_acl.cc
 +++ b/stack/btm/btm_acl.cc
-@@ -1164,17 +1164,17 @@ void btm_read_remote_ext_features_failed(uint8_t status, uint16_t handle) {
+@@ -1184,17 +1184,17 @@ void btm_read_remote_ext_features_failed(uint8_t status, uint16_t handle) {
  void btm_establish_continue(tACL_CONN* p_acl_cb) {
    tBTM_BL_EVENT_DATA evt_data;
    BTM_TRACE_DEBUG("btm_establish_continue");
@@ -68,14 +68,14 @@
 +    }
    }
 -#endif
-   p_acl_cb->link_up_issued = true;
- 
-   /* If anyone cares, tell him database changed */
+   if (p_acl_cb->link_up_issued) {
+     BTM_TRACE_ERROR("%s: Already link is up ", __func__);
+     return;
 diff --git a/stack/btm/btm_sec.cc b/stack/btm/btm_sec.cc
-index 60a3a17..5d36ef9 100644
+index b0809010f..4cc1e39ab 100644
 --- a/stack/btm/btm_sec.cc
 +++ b/stack/btm/btm_sec.cc
-@@ -4490,15 +4490,15 @@ void btm_sec_connected(const RawAddress& bda, uint16_t handle, uint8_t status,
+@@ -4356,15 +4356,15 @@ void btm_sec_connected(const RawAddress& bda, uint16_t handle, uint8_t status,
    if (p_acl_cb) {
  /* whatever is in btm_establish_continue() without reporting the BTM_BL_CONN_EVT
   * event */
@@ -101,5 +101,5 @@
    btm_acl_created(bda, p_dev_rec->dev_class, p_dev_rec->sec_bd_name, handle,
                    HCI_ROLE_SLAVE, BT_TRANSPORT_BR_EDR);
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_system_core/0001-Revert-logd-add-passcred-for-logdw-socket.patch b/patches/platform_system_core/0001-Revert-logd-add-passcred-for-logdw-socket.patch
deleted file mode 100644
index 85ed78d..0000000
--- a/patches/platform_system_core/0001-Revert-logd-add-passcred-for-logdw-socket.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 57e6583545cdf028fde5aa189f8f29068dfd8fa8 Mon Sep 17 00:00:00 2001
-From: Pierre-Hugues Husson <phh@phh.me>
-Date: Sun, 10 Dec 2017 00:26:21 +0100
-Subject: [PATCH 1/2] Revert "logd: add "+passcred" for logdw socket"
-
-This reverts commit 54d8ff1121440d0ef4565ce0ab3751f82fdb393c.
-
-Android 8.0 init doesn't understand this new syntax
----
- logd/LogListener.cpp | 10 +++++-----
- logd/logd.rc         |  2 +-
- 2 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/logd/LogListener.cpp b/logd/LogListener.cpp
-index d2df68e..e4d2dea 100644
---- a/logd/LogListener.cpp
-+++ b/logd/LogListener.cpp
-@@ -145,14 +145,14 @@ int LogListener::getLogSocket() {
-     static const char socketName[] = "logdw";
-     int sock = android_get_control_socket(socketName);
- 
--    if (sock < 0) {  // logd started up in init.sh
-+    if (sock < 0) {
-         sock = socket_local_server(
-             socketName, ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_DGRAM);
-+    }
- 
--        int on = 1;
--        if (setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on))) {
--            return -1;
--        }
-+    int on = 1;
-+    if (setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0) {
-+        return -1;
-     }
-     return sock;
- }
-diff --git a/logd/logd.rc b/logd/logd.rc
-index 8804246..7494d8f 100644
---- a/logd/logd.rc
-+++ b/logd/logd.rc
-@@ -1,7 +1,7 @@
- service logd /system/bin/logd
-     socket logd stream 0666 logd logd
-     socket logdr seqpacket 0666 logd logd
--    socket logdw dgram+passcred 0222 logd logd
-+    socket logdw dgram 0222 logd logd
-     file /proc/kmsg r
-     file /dev/kmsg w
-     user logd
--- 
-2.7.4
-
diff --git a/patches/platform_system_core/0002-On-S9-disable-enable-TS-on-suspend-resume.patch b/patches/platform_system_core/0002-On-S9-disable-enable-TS-on-suspend-resume.patch
deleted file mode 100644
index e3d3104..0000000
--- a/patches/platform_system_core/0002-On-S9-disable-enable-TS-on-suspend-resume.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From 849b729e175fb847bf0e497e772cffeb2b4795de Mon Sep 17 00:00:00 2001
-From: Pierre-Hugues Husson <phh@phh.me>
-Date: Sat, 26 May 2018 12:15:54 +0200
-Subject: [PATCH 2/2] On S9/+, disable/enable TS on suspend/resume
-
----
- libsuspend/autosuspend_wakeup_count.c | 58 +++++++++++++++++++++++++++++++++++
- 1 file changed, 58 insertions(+)
-
-diff --git a/libsuspend/autosuspend_wakeup_count.c b/libsuspend/autosuspend_wakeup_count.c
-index 2da204a..4cdbb18 100644
---- a/libsuspend/autosuspend_wakeup_count.c
-+++ b/libsuspend/autosuspend_wakeup_count.c
-@@ -28,6 +28,8 @@
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <unistd.h>
-+#include <stdio.h>
-+#include <cutils/properties.h>
- 
- #include <log/log.h>
- 
-@@ -55,14 +57,61 @@ static void update_sleep_time(bool success) {
-     sleep_time = MIN(sleep_time * 2, 60000000);
- }
- 
-+const char* samsung_touchscreen_readname(const char* path) {
-+	char fullPath[PATH_MAX];
-+	sprintf(fullPath, "%s/name", path);
-+	int fd = open(fullPath, O_RDONLY);
-+	
-+	static char name[1024] = "unknown";
-+	int len = read(fd, name, sizeof(name));
-+	if(len == -1)
-+		strcpy(name, "unknown");
-+	else
-+		name[len] = 0;
-+	close(fd);
-+	return name;
-+}
-+
-+static int samsung_touchscreen_enabled_fd() {
-+	int fd = -1;
-+	for(int i=0; i<30; i++) {
-+		char path[1024];
-+		sprintf(path, "/sys/class/input/input%d", i);
-+		const char* name = samsung_touchscreen_readname(path);
-+		if(strcmp(name, "sec_touchscreen") == 0 ||
-+				strcmp(name, "sec_touchscreen\n") == 0) {
-+			char fullPath[PATH_MAX];
-+			sprintf(fullPath, "%s/enabled", path);
-+			fd = open(fullPath, O_RDWR);
-+			if(fd == -1)
-+				ALOGE("Got error %s", strerror(errno));
-+		}
-+	}
-+	return fd;
-+}
-+
-+static int samsung_touchscreen_set(int enable) {
-+	int fd;
-+        fd = samsung_touchscreen_enabled_fd();
-+	if(fd == -1) return 0;
-+	if(write(fd, enable ? "1" : "0", 1) == -1) return 0;
-+	close(fd);
-+	return 1;
-+}
-+
- static void *suspend_thread_func(void *arg __attribute__((unused)))
- {
-+    char prop[PROPERTY_VALUE_MAX];
-     char buf[80];
-     char wakeup_count[20];
-     int wakeup_count_len;
-     int ret;
-     bool success = true;
- 
-+    property_get("ro.hardware", prop, "toto");
-+    //bool samsungTs = strstr(prop, "samsungexynos9810") != NULL;
-+    bool samsungTs = true;
-+
-     while (1) {
-         update_sleep_time(success);
-         usleep(sleep_time);
-@@ -99,6 +148,15 @@ static void *suspend_thread_func(void *arg __attribute__((unused)))
-             ALOGV("%s: write %s to %s\n", __func__, sleep_state, SYS_POWER_STATE);
-             ret = TEMP_FAILURE_RETRY(write(state_fd, sleep_state, strlen(sleep_state)));
-             if (ret >= 0) {
-+		    if(samsungTs) {
-+			    ALOGE("Resetting Samsung TS");
-+			    samsung_touchscreen_set(0);
-+			    int ret = 0;
-+			    for(int i=0; i< 10 && !ret; i++) {
-+				    ret = samsung_touchscreen_set(1);
-+			    ALOGE("Resetting Samsung TS: try %d", i);
-+				}
-+			}
-                 success = true;
-             }
-             void (*func)(bool success) = wakeup_func;
--- 
-2.7.4
-
diff --git a/patches/platform_system_libvintf/0001-HACK-Support-sepolicy-vndk-26.patch b/patches/platform_system_libvintf/0001-HACK-Support-sepolicy-vndk-26.patch
deleted file mode 100644
index 2eb4949..0000000
--- a/patches/platform_system_libvintf/0001-HACK-Support-sepolicy-vndk-26.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From ee971dbb9ae4a9f9ad4c8c713dfe1097e91a848d Mon Sep 17 00:00:00 2001
-From: Pierre-Hugues Husson <phh@phh.me>
-Date: Tue, 1 May 2018 22:52:09 +0200
-Subject: [PATCH 1/2] HACK: Support sepolicy vndk 26
-
-Change-Id: I715a7fffb98ac0cf9d01768362bed0b95afcb687
----
- assemble_vintf.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/assemble_vintf.cpp b/assemble_vintf.cpp
-index 974c7fc..69d1d27 100644
---- a/assemble_vintf.cpp
-+++ b/assemble_vintf.cpp
-@@ -266,7 +266,7 @@ class AssembleVintf {
-             }
- 
-             matrix->framework.mSepolicy =
--                Sepolicy(kernelSepolicyVers, {{sepolicyVers.majorVer, sepolicyVers.minorVer}});
-+                Sepolicy(kernelSepolicyVers, {{sepolicyVers.majorVer, sepolicyVers.minorVer}, { 26, 0}});
- 
-             Version avbMetaVersion;
-             if (!getFlag("FRAMEWORK_VBMETA_VERSION", &avbMetaVersion)) {
--- 
-2.7.4
-
diff --git a/patches/platform_system_libvintf/0002-Say-we-support-AVB-1.0.patch b/patches/platform_system_libvintf/0002-Say-we-support-AVB-1.0.patch
deleted file mode 100644
index 8408ed1..0000000
--- a/patches/platform_system_libvintf/0002-Say-we-support-AVB-1.0.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 98c42d9a0f3bee91b8ff4715e00ab28db4cc26b3 Mon Sep 17 00:00:00 2001
-From: Pierre-Hugues Husson <phh@phh.me>
-Date: Sun, 10 Jun 2018 23:23:31 +0200
-Subject: [PATCH 2/2] Say we support AVB 1.0
-
-Change-Id: Ica39d42e7b5fc78bc476c413a97a1c488da51fa8
----
- parse_xml.cpp | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/parse_xml.cpp b/parse_xml.cpp
-index 0094f81..5a6d7fa 100644
---- a/parse_xml.cpp
-+++ b/parse_xml.cpp
-@@ -862,6 +862,7 @@ struct CompatibilityMatrixConverter : public XmlNodeConverter<CompatibilityMatri
-             appendChildren(root, matrixKernelConverter, m.framework.mKernels, d);
-             appendChild(root, sepolicyConverter(m.framework.mSepolicy, d));
-             appendChild(root, avbConverter(m.framework.mAvbMetaVersion, d));
-+            appendChild(root, avbConverter({1, 0}, d));
-         } else if (m.mType == SchemaType::DEVICE) {
-             appendChild(root, vndkConverter(m.device.mVndk, d));
-         }
--- 
-2.7.4
-
diff --git a/patches/platform_system_netd/0001-device-Huawei-Kirin-960-accept-broken-rpfilter-match.patch b/patches/platform_system_netd/0001-device-Huawei-Kirin-960-accept-broken-rpfilter-match.patch
deleted file mode 100644
index b91dd39..0000000
--- a/patches/platform_system_netd/0001-device-Huawei-Kirin-960-accept-broken-rpfilter-match.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From aef5c4c70702bfd952e037f0e8242522fa1e42b7 Mon Sep 17 00:00:00 2001
-From: Pierre-Hugues Husson <phh@phh.me>
-Date: Mon, 2 Jul 2018 22:01:43 +0200
-Subject: [PATCH] [device] ::Huawei Kirin 960:: accept broken rpfilter match
-
-How bad a security flaw is this?
-People lived with rpfilter on IPv4 for a very long time...
-
-Change-Id: I9aa63d18e54a8254133adf97bf757c03d6b66757
----
- server/NatController.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/server/NatController.cpp b/server/NatController.cpp
-index 58c732d..d270dd3 100644
---- a/server/NatController.cpp
-+++ b/server/NatController.cpp
-@@ -205,7 +205,7 @@ int NatController::setForwardRules(bool add, const char *intIface, const char *e
-         "*raw\n"
-         "%s %s -i %s -m rpfilter --invert ! -s fe80::/64 -j DROP\n"
-         "COMMIT\n", op, LOCAL_RAW_PREROUTING, intIface);
--    if (iptablesRestoreFunction(V6, rpfilterCmd) == -1 && add) {
-+    if (iptablesRestoreFunction(V6, rpfilterCmd) == -1 && add && false) {
-         return -1;
-     }
- 
--- 
-2.7.4
-
diff --git a/patches/platform_system_vold/0001-Allow-deletion-of-symlink.patch b/patches/platform_system_vold/0001-Allow-deletion-of-symlink.patch
index 9344b35..815f513 100644
--- a/patches/platform_system_vold/0001-Allow-deletion-of-symlink.patch
+++ b/patches/platform_system_vold/0001-Allow-deletion-of-symlink.patch
@@ -1,7 +1,7 @@
-From f838998f3f28d93a8085047725da96404b0ae56c Mon Sep 17 00:00:00 2001
+From 06a421423c529991ca38ba2d71b76daa9188849e Mon Sep 17 00:00:00 2001
 From: Pierre-Hugues Husson <phh@phh.me>
 Date: Sat, 17 Feb 2018 19:39:38 +0100
-Subject: [PATCH 1/2] Allow deletion of symlink
+Subject: [PATCH] Allow deletion of symlink
 
 Change-Id: I9731895f88729072297f753088583aabbe6990f4
 ---
@@ -9,10 +9,10 @@
  1 file changed, 1 insertion(+)
 
 diff --git a/Ext4Crypt.cpp b/Ext4Crypt.cpp
-index dc2e42a..6398464 100644
+index 67b7e90..99a63b4 100644
 --- a/Ext4Crypt.cpp
 +++ b/Ext4Crypt.cpp
-@@ -211,6 +211,7 @@ static bool prepare_dir(const std::string& dir, mode_t mode, uid_t uid, gid_t gi
+@@ -221,6 +221,7 @@ static bool prepare_dir(const std::string& dir, mode_t mode, uid_t uid, gid_t gi
  static bool destroy_dir(const std::string& dir) {
      LOG(DEBUG) << "Destroying: " << dir;
      if (rmdir(dir.c_str()) != 0 && errno != ENOENT) {
@@ -21,5 +21,5 @@
          return false;
      }
 -- 
-2.7.4
+2.17.1
 
diff --git a/patches/platform_system_vold/0002-Workaround-perdev_minors-path-change-in-Linux.patch b/patches/platform_system_vold/0002-Workaround-perdev_minors-path-change-in-Linux.patch
deleted file mode 100644
index 87db5f0..0000000
--- a/patches/platform_system_vold/0002-Workaround-perdev_minors-path-change-in-Linux.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 2f89ac71e213bfbd45d503ef615b778697ef8dc2 Mon Sep 17 00:00:00 2001
-From: Pierre-Hugues Husson <phh@archos.com>
-Date: Tue, 28 Nov 2017 15:42:56 +0100
-Subject: [PATCH 2/2] Workaround perdev_minors path change in Linux
-
-This upstream Linux change has been discussed at https://patchwork.kernel.org/patch/8281851/
-And included in AOSP in https://android-review.googlesource.com/c/kernel/common/+/202752
-Some devices have been released without it, so we need this change to
-have a working SDcard on those devices.
-
-Change-Id: I323d85bd8381f82b75db09493ddc22f432cec548
----
- Disk.cpp | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/Disk.cpp b/Disk.cpp
-index 9c22400..2f6ed5e 100644
---- a/Disk.cpp
-+++ b/Disk.cpp
-@@ -50,7 +50,8 @@ static const char* kSgdiskPath = "/system/bin/sgdisk";
- static const char* kSgdiskToken = " \t\n";
- 
- static const char* kSysfsLoopMaxMinors = "/sys/module/loop/parameters/max_part";
--static const char* kSysfsMmcMaxMinors = "/sys/module/mmcblk/parameters/perdev_minors";
-+static const char* kSysfsMmcMaxMinorsDeprecated = "/sys/module/mmcblk/parameters/perdev_minors";
-+static const char* kSysfsMmcMaxMinors = "/sys/module/mmc_block/parameters/perdev_minors";
- 
- static const unsigned int kMajorBlockLoop = 7;
- static const unsigned int kMajorBlockScsiA = 8;
-@@ -566,7 +567,8 @@ int Disk::getMaxMinors() {
-     case kMajorBlockMmc: {
-         // Per Documentation/devices.txt this is dynamic
-         std::string tmp;
--        if (!ReadFileToString(kSysfsMmcMaxMinors, &tmp)) {
-+        if (!ReadFileToString(kSysfsMmcMaxMinors, &tmp) &&
-+                !ReadFileToString(kSysfsMmcMaxMinorsDeprecated, &tmp)) {
-             LOG(ERROR) << "Failed to read max minors";
-             return -errno;
-         }
--- 
-2.7.4
-