Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/android13.yml
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,6 @@ jobs:
FEATURES_LIST+=("- Add Gboard Support")
fi

if [ ${#FEATURES_LIST[@]} -eq 0 ]; then

if [ ${#FEATURES_LIST[@]} -eq 0 ]; then
FEATURES="- Signature Verification Bypass (default)"
else
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/android14.yml
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,6 @@ jobs:
FEATURES_LIST+=("- Add Gboard Support")
fi

if [ ${#FEATURES_LIST[@]} -eq 0 ]; then

if [ ${#FEATURES_LIST[@]} -eq 0 ]; then
FEATURES="- Signature Verification Bypass (default)"
else
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/android16.yml
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ jobs:
await github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/${{ steps.release_info.outputs.tag }}'
ref: 'tags/' + '${{ steps.release_info.outputs.tag }}'
});
} catch (e) {
console.log('Tag might not exist, continuing...');
Expand Down Expand Up @@ -402,7 +402,8 @@ jobs:
tag_name: ${{ steps.release_info.outputs.tag }}
name: ${{ steps.release_info.outputs.name }}
files: ${{ steps.find_zip.outputs.file_path }}
body: ${{ steps.generate_release_body.outputs.release_body }}
body: |
${{ steps.generate_release_body.outputs.release_body }}

- name: Upload patched jars
uses: actions/upload-artifact@v4
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/feature-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,18 @@ jobs:
if-no-files-found: warn
path: |
test-results/android${{ matrix.android_version }}/**/Framework-Patcher-android${{ matrix.android_version }}-*.zip
retention-days: 7
retention-days: 7

# Completion job to provide a static status check name for branch protection rules
check:
name: Feature Test Suite
needs: feature-tests
runs-on: ubuntu-latest
if: always()
steps:
- name: All tests passed
if: ${{ !(contains(needs.feature-tests.result, 'failure')) && !(contains(needs.feature-tests.result, 'cancelled')) }}
run: exit 0
- name: Tests failed
if: ${{ contains(needs.feature-tests.result, 'failure') || contains(needs.feature-tests.result, 'cancelled') }}
run: exit 1
Empty file modified scripts/core/apk_ops.sh
100644 → 100755
Empty file.
Empty file modified scripts/core/kaorios_patches.sh
100644 → 100755
Empty file.
Empty file modified scripts/core/logging.sh
100644 → 100755
Empty file.
Empty file modified scripts/core/module.sh
100644 → 100755
Empty file.
6 changes: 1 addition & 5 deletions scripts/core/patching.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
find_smali_method_file() {
local decompile_dir="$1"
local method="$2"
# returns first match (stdout)
find "$decompile_dir" -type f -name "*.smali" -print0 |
xargs -0 grep -s -l -- ".method" 2>/dev/null |
xargs -r -I{} sh -c "grep -s -q \"[[:space:]]*\\.method.*${method}\" \"{}\" && printf '%s\n' \"{}\"" |
head -n1
grep -r -l --include="*.smali" "[[:space:]]*\.method.*${method}" "$decompile_dir" 2>/dev/null | head -n1
}

add_static_return_patch() {
Expand Down
Empty file modified scripts/core/tools.sh
100644 → 100755
Empty file.
Empty file modified scripts/helper.sh
100644 → 100755
Empty file.
128 changes: 1 addition & 127 deletions scripts/patcher_a13.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -95,134 +95,8 @@ recompile_jar() {
echo "Created patched JAR: $patched_jar"
}

# Function to patch method with direct file path (no searching)
patch_method_in_file() {
local method="$1"
local ret_val="$2"
local file="$3"

# Check if file exists
if [ ! -f "$file" ]; then
echo "⚠ File not found: $(basename "$file")"
return
fi

local start
start=$(grep -n "^[[:space:]]*\.method.* $method" "$file" | cut -d: -f1 | head -n1)
[ -z "$start" ] && {
echo "⚠ Method $method not found in $(basename "$file")"
return
}

local total_lines end=0 i="$start"
total_lines=$(wc -l <"$file")
while [ "$i" -le "$total_lines" ]; do
line=$(sed -n "${i}p" "$file")
[[ "$line" == *".end method"* ]] && {
end="$i"
break
}
i=$((i + 1))
done

[ "$end" -eq 0 ] && {
echo "⚠ End not found for $method"
return
}

local method_head
method_head=$(sed -n "${start}p" "$file")
method_head_escaped=$(printf "%s\n" "$method_head" | sed 's/\\/\\\\/g')

sed -i "${start},${end}c\\
$method_head_escaped\\
.registers 8\\
const/4 v0, 0x$ret_val\\
return v0\\
.end method" "$file"

echo "✓ Patched $method to return $ret_val in $(basename "$file")"
}

# Function to add static return patch (legacy - searches for file)
add_static_return_patch() {
local method="$1"
local ret_val="$2"
local decompile_dir="$3"
local file

# Simple working approach from old script
file=$(find "$decompile_dir" -type f -name "*.smali" -print0 | xargs -0 grep -l ".method.* $method" 2>/dev/null | head -n 1)

[ -z "$file" ] && return

# Call the new function with found file
patch_method_in_file "$method" "$ret_val" "$file"
}
# Note: patching functions are sourced from helper.sh -> core/patching.sh

# Function to patch return-void method with direct file path
patch_return_void_in_file() {
local method="$1"
local file="$2"

# Check if file exists
if [ ! -f "$file" ]; then
echo "⚠ File not found: $(basename "$file")"
return
fi

local start
start=$(grep -n "^[[:space:]]*\.method.* $method" "$file" | cut -d: -f1 | head -n1)
[ -z "$start" ] && {
echo "⚠ Method $method not found in $(basename "$file")"
return
}

local total_lines end=0 i="$start"
total_lines=$(wc -l <"$file")
while [ "$i" -le "$total_lines" ]; do
line=$(sed -n "${i}p" "$file")
[[ "$line" == *".end method"* ]] && {
end="$i"
break
}
i=$((i + 1))
done

[ "$end" -eq 0 ] && {
echo "⚠ Method $method end not found"
return
}

local method_head
method_head=$(sed -n "${start}p" "$file")
method_head_escaped=$(printf "%s\n" "$method_head" | sed 's/\\/\\\\/g')

sed -i "${start},${end}c\\
$method_head_escaped\\
.registers 8\\
return-void\\
.end method" "$file"

echo "✓ Patched $method → return-void in $(basename "$file")"
}

# Function to patch return-void method (legacy - searches for file)
patch_return_void_method() {
local method="$1"
local decompile_dir="$2"
local file

# Simple working approach from old script
file=$(find "$decompile_dir" -type f -name "*.smali" -print0 | xargs -0 grep -l ".method.* $method" 2>/dev/null | head -n 1)
[ -z "$file" ] && {
echo "Method $method not found"
return
}

# Call the new function with found file
patch_return_void_in_file "$method" "$file"
}

# ============================================
# Feature-specific patch functions for framework.jar
Expand Down
128 changes: 1 addition & 127 deletions scripts/patcher_a14.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,134 +95,8 @@ recompile_jar() {
echo "Created patched JAR: $patched_jar"
}

# Function to patch method with direct file path (no searching)
patch_method_in_file() {
local method="$1"
local ret_val="$2"
local file="$3"

# Check if file exists
if [ ! -f "$file" ]; then
echo "⚠ File not found: $(basename "$file")"
return
fi

local start
start=$(grep -n "^[[:space:]]*\.method.* $method" "$file" | cut -d: -f1 | head -n1)
[ -z "$start" ] && {
echo "⚠ Method $method not found in $(basename "$file")"
return
}

local total_lines end=0 i="$start"
total_lines=$(wc -l <"$file")
while [ "$i" -le "$total_lines" ]; do
line=$(sed -n "${i}p" "$file")
[[ "$line" == *".end method"* ]] && {
end="$i"
break
}
i=$((i + 1))
done

[ "$end" -eq 0 ] && {
echo "⚠ End not found for $method"
return
}

local method_head
method_head=$(sed -n "${start}p" "$file")
method_head_escaped=$(printf "%s\n" "$method_head" | sed 's/\\/\\\\/g')

sed -i "${start},${end}c\\
$method_head_escaped\\
.registers 8\\
const/4 v0, 0x$ret_val\\
return v0\\
.end method" "$file"

echo "✓ Patched $method to return $ret_val in $(basename "$file")"
}

# Function to add static return patch (legacy - searches for file)
add_static_return_patch() {
local method="$1"
local ret_val="$2"
local decompile_dir="$3"
local file

# Simple working approach from old script
file=$(find "$decompile_dir" -type f -name "*.smali" -print0 | xargs -0 grep -l ".method.* $method" 2>/dev/null | head -n 1)

[ -z "$file" ] && return

# Call the new function with found file
patch_method_in_file "$method" "$ret_val" "$file"
}
# Note: patching functions are sourced from helper.sh -> core/patching.sh

# Function to patch return-void method with direct file path
patch_return_void_in_file() {
local method="$1"
local file="$2"

# Check if file exists
if [ ! -f "$file" ]; then
echo "⚠ File not found: $(basename "$file")"
return
fi

local start
start=$(grep -n "^[[:space:]]*\.method.* $method" "$file" | cut -d: -f1 | head -n1)
[ -z "$start" ] && {
echo "⚠ Method $method not found in $(basename "$file")"
return
}

local total_lines end=0 i="$start"
total_lines=$(wc -l <"$file")
while [ "$i" -le "$total_lines" ]; do
line=$(sed -n "${i}p" "$file")
[[ "$line" == *".end method"* ]] && {
end="$i"
break
}
i=$((i + 1))
done

[ "$end" -eq 0 ] && {
echo "⚠ Method $method end not found"
return
}

local method_head
method_head=$(sed -n "${start}p" "$file")
method_head_escaped=$(printf "%s\n" "$method_head" | sed 's/\\/\\\\/g')

sed -i "${start},${end}c\\
$method_head_escaped\\
.registers 8\\
return-void\\
.end method" "$file"

echo "✓ Patched $method → return-void in $(basename "$file")"
}

# Function to patch return-void method (legacy - searches for file)
patch_return_void_method() {
local method="$1"
local decompile_dir="$2"
local file

# Simple working approach from old script
file=$(find "$decompile_dir" -type f -name "*.smali" -print0 | xargs -0 grep -l ".method.* $method" 2>/dev/null | head -n 1)
[ -z "$file" ] && {
echo "Method $method not found"
return
}

# Call the new function with found file
patch_return_void_in_file "$method" "$file"
}

# ============================================
# Feature-specific patch functions for framework.jar
Expand Down
Empty file modified scripts/patcher_a16.sh
100644 → 100755
Empty file.
Loading
Loading