Skip to content

Commit

Permalink
Upstream latest code follow VSTool
Browse files Browse the repository at this point in the history
  • Loading branch information
buihien224 authored Jun 18, 2024
1 parent dda02b7 commit 0f619f7
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 21 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/patch.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
name: miuivs_patch_build
name: vsteam_framework_patch

on:
workflow_dispatch:
inputs:
F:
description: 'framework.jar Url'
required: true
default: ''
S:
description: 'services.jar Url'
required: true
default: ''
jobs:
build:
Expand All @@ -32,20 +30,25 @@ jobs:
- name: Download Framework and Services dir
run: |
axel -n $(nproc) ${{ github.event.inputs.F }}
axel -n $(nproc) ${{ github.event.inputs.S }}
mkdir img_temp
- name : PATCH-ING
[[ "${{ github.event.inputs.F }}" ]] && axel -n $(nproc) ${{ github.event.inputs.F }} -o img_temp/
[[ "${{ github.event.inputs.S }}" ]] && axel -n $(nproc) ${{ github.event.inputs.S }} -o img_temp/
if [[ -z "${{ github.event.inputs.F }}" && -z "${{ github.event.inputs.S }}" ]]; then
exit 1
fi
- name : Proccesing
run: |
sudo chmod 777 -R *
./bhlnk.sh
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
# Artifact name
name: android14_patched_bhlnk.zip
# A file, directory or wildcard pattern that describes what to upload
name: framework_U_patch_${{ github.actor }}.zip
path: ./module/*
# The desired behavior if no files are found using the provided path.

51 changes: 39 additions & 12 deletions bhlnk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,44 @@ repM="python3 $dir/bin/strRep.py"

get_file_dir() {
if [[ $1 ]]; then
sudo find $dir/ -name $1
test=$(sudo find "$dir/img_temp/" -type f -name "$1")
for i in $test; do
echo $i
done
else
return 0
fi

}


mvst() {
scr_folder=$(dirname $(sudo find -name $1 | sed -e 's,^\./,,' ))
if [[ $3 ]]; then
scr_folder=$(echo $scr_folder | cut -d'/' -f2-)
fi
des_folder=$(sudo find -name $2 | sed -e 's,^\./,,')
mkdir -p $des_folder/$scr_folder
mv $(sudo find -type f -name $1 | sed -e 's,^\./,,' ) $des_folder/$scr_folder

}

jar_util()
{
cd $dir

if [[ ! -d $dir/jar_temp ]]; then
mkdir $dir/jar_temp
fi

#binary
bak="java -jar $dir/bin/baksmali.jar d"
sma="java -jar $dir/bin/smali.jar a"
sma="java -jar $dir/bin/smali-2.5.2.jar a"


if [[ $1 == "d" ]]; then
echo -ne "====> Patching $2 : "

if [[ $(get_file_dir $2 ) ]]; then
sudo mv $(get_file_dir $2 ) $dir/jar_temp
sudo cp $(get_file_dir $2 ) $dir/jar_temp
sudo chown $(whoami) $dir/jar_temp/$2
unzip $dir/jar_temp/$2 -d $dir/jar_temp/$2.out >/dev/null 2>&1
if [[ -d $dir/jar_temp/"$2.out" ]]; then
Expand All @@ -51,21 +67,20 @@ jar_util()
for fld in $(sudo find -maxdepth 1 -name "*.out" ); do
if [[ $4 ]]; then
if [[ "$fld" != *"$4"* && "$fld" != *"$5"* ]]; then
echo $fld
$sma $fld -o $(echo ${fld//.out})
$sma $fld -o $(echo ${fld//.out}) --api 34
[[ -f $(echo ${fld//.out}) ]] && rm -rf $fld
fi
else
$sma $fld -o $(echo ${fld//.out})
$sma $fld -o $(echo ${fld//.out}) --api 34
[[ -f $(echo ${fld//.out}) ]] && rm -rf $fld
fi
done
7za a -tzip -mx=0 $dir/jar_temp/$2_notal $dir/jar_temp/$2.out/. >/dev/null 2>&1
#zip -r -j -0 $dir/jar_temp/$2_notal $dir/jar_temp/$2.out/.
zipalign -p -v 4 $dir/jar_temp/$2_notal $dir/jar_temp/$2 >/dev/null 2>&1
$zipalign_sa -p -v 4 $dir/jar_temp/$2_notal $dir/jar_temp/$2 >/dev/null 2>&1
if [[ -f $dir/jar_temp/$2 ]]; then
rm -rf $dir/jar_temp/$2.out $dir/jar_temp/$2_notal
#sudo cp -rf $dir/jar_temp/$2 $(get_file_dir $2)
sudo cp -rf $dir/jar_temp/$2 $(get_file_dir $2)
echo "Succes"
else
echo "Fail"
Expand All @@ -75,6 +90,7 @@ jar_util()
fi
}


repM () {
if [[ $4 == "r" ]]; then
if [[ -f $3 ]]; then
Expand All @@ -94,19 +110,30 @@ repM () {

framework() {

jar_util d 'framework.jar' fw classes4 classes5
jar_util d 'framework.jar' fw 5 5

count=$(ls -dq classes* | wc -l)
mkdir "classes$count.dex.out"

repM 'getMinimumSignatureSchemeVersionForTargetSdk' true ApkSignatureVerifier.smali

mvst 'ApkSignatureVerifier.smali' "classes$count.dex.out"

jar_util a 'framework.jar' fw classes4 classes5
jar_util a 'framework.jar' fw 5 5
}

services() {

jar_util d "services.jar" fw

count=$(ls -dq classes* | wc -l)
mkdir "classes$count.dex.out"

repM 'isPlatformSigned' true 'PackageManagerService$PackageManagerInternalImpl.smali'
repM 'isSignedWithPlatformKey' true 'PackageImpl.smali'

mvst 'PackageManagerService$PackageManagerInternalImpl.smali' "classes$count.dex.out"
mvst 'PackageImpl.smali' "classes$count.dex.out"

jar_util a "services.jar" fw
}
Expand Down
Binary file added bin/smali-2.5.2.jar
Binary file not shown.

0 comments on commit 0f619f7

Please sign in to comment.