gui: Handle theme versioning in the specified package
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com> Change-Id: I40d727cd42c778a2c09a72043ce75c7c8b9cfacb
This commit is contained in:
@@ -566,12 +566,6 @@ endif
|
||||
|
||||
LOCAL_REQUIRED_MODULES += $(TWRP_REQUIRED_MODULES)
|
||||
|
||||
TW_THEME_VERSION := $(shell grep TW_THEME_VERSION bootable/recovery/variables.h | cut -d ' ' -f 3)
|
||||
|
||||
LOCAL_POST_INSTALL_CMD += \
|
||||
sed -i "s/{themeversion}/$(TW_THEME_VERSION)/" $(TARGET_RECOVERY_ROOT_OUT)/twres/splash.xml; \
|
||||
sed -i "s/{themeversion}/$(TW_THEME_VERSION)/" $(TARGET_RECOVERY_ROOT_OUT)/twres/ui.xml;
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
# Symlink for file_contexts
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"android/soong/android"
|
||||
"android/soong/cc"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
@@ -64,6 +65,31 @@ func copyThemeResources(ctx android.BaseContext, dirs []string, files []string)
|
||||
fileDest := twRes + path.Base(file)
|
||||
copyFile(fileToCopy, fileDest)
|
||||
}
|
||||
data, err := ioutil.ReadFile(recoveryDir + "variables.h")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
version := "0"
|
||||
for _, line := range strings.Split(string(data), "\n") {
|
||||
if strings.Contains(line, "TW_THEME_VERSION") {
|
||||
version = strings.Split(line, " ")[2]
|
||||
}
|
||||
}
|
||||
_files := [2]string{"splash.xml", "ui.xml"}
|
||||
for _, i := range _files {
|
||||
data, err = ioutil.ReadFile(twRes + i)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
newFile := strings.Replace(string(data), "{themeversion}", version, -1)
|
||||
err = ioutil.WriteFile(twRes + i, []byte(newFile), 0)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func copyCustomTheme(ctx android.BaseContext, customTheme string) {
|
||||
|
||||
Reference in New Issue
Block a user