pipa: vendorsetup: switch to LOS hw/ximi and get Dolby separately

Signed-off-by: Abdulwahab Isam <abdoi94.iq@gmail.com>
This commit is contained in:
Abdulwahab Isam
2025-03-15 09:40:00 +03:00
parent 9a656d4a35
commit 42a4df0cb3
3 changed files with 243 additions and 150 deletions

View File

@@ -1,23 +0,0 @@
From fd9fd7200814c3527e46b02e3c3232e275285312 Mon Sep 17 00:00:00 2001
From: Abdulwahab Isam <abdoi94.iq@gmail.com>
Date: Sat, 15 Mar 2025 09:29:02 +0300
Subject: [PATCH] official_devices: switch to my repo
Signed-off-by: Abdulwahab Isam <abdoi94.iq@gmail.com>
---
app/src/main/res/values/strings.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 48b8a95..31fedea 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -31,7 +31,7 @@
{device} - Device name
{variant} - Build variant
-->
- <string name="updater_server_url" translatable="false">https://raw.githubusercontent.com/AxionAOSP/official_devices/refs/heads/main/OTA/{variant}/{device}.json</string>
+ <string name="updater_server_url" translatable="false">https://raw.githubusercontent.com/ai94iq/axion_official_devices/refs/heads/main/OTA/{variant}/{device}.json</string>
<string name="verification_failed_notification">Verification failed</string>
<string name="verifying_download_notification">Verifying update</string>

View File

@@ -1,40 +0,0 @@
From 583031a436f448e519c3a6fea79ede078242e86e Mon Sep 17 00:00:00 2001
From: Abdulwahab Isam <abdoi94.iq@gmail.com>
Date: Sat, 15 Mar 2025 09:27:30 +0300
Subject: [PATCH] Revert "overlays: Disable split shade for tablets"
This reverts commit decf8b582ae4daedd7e5b6a8f2369a3b48082065.
---
.../res/values-sw600dp-land/config.xml | 23 -------------------
1 file changed, 23 deletions(-)
delete mode 100644 overlay/common/frameworks/base/packages/SystemUI/res/values-sw600dp-land/config.xml
diff --git a/overlay/common/frameworks/base/packages/SystemUI/res/values-sw600dp-land/config.xml b/overlay/common/frameworks/base/packages/SystemUI/res/values-sw600dp-land/config.xml
deleted file mode 100644
index 33b6a31319..0000000000
--- a/overlay/common/frameworks/base/packages/SystemUI/res/values-sw600dp-land/config.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2025 The AxionAOSP Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- These resources are around just to allow their values to be customized
- for different hardware and product builds. -->
-<resources>
- <!-- Whether to use the split 2-column notification shade -->
- <bool name="config_use_split_notification_shade">false</bool>
-</resources>

View File

@@ -19,100 +19,256 @@ clone_if_missing "https://github.com/ai94iq/android_device_xiaomi_sm8250-common"
clone_if_missing "https://github.com/ai94iq/android_kernel_xiaomi_sm8250" "axksu" "kernel/xiaomi/sm8250" clone_if_missing "https://github.com/ai94iq/android_kernel_xiaomi_sm8250" "axksu" "kernel/xiaomi/sm8250"
clone_if_missing "https://github.com/ai94iq/proprietary_vendor_xiaomi_sm8250-common" "vic" "vendor/xiaomi/sm8250-common" clone_if_missing "https://github.com/ai94iq/proprietary_vendor_xiaomi_sm8250-common" "vic" "vendor/xiaomi/sm8250-common"
clone_if_missing "https://github.com/ai94iq/proprietary_vendor_xiaomi_pipa" "vic" "vendor/xiaomi/pipa" clone_if_missing "https://github.com/ai94iq/proprietary_vendor_xiaomi_pipa" "vic" "vendor/xiaomi/pipa"
clone_if_missing "https://github.com/ai94iq/cr-android_hardware_xiaomi" "15.0" "hardware/xiaomi" clone_if_missing "https://github.com/LineageOS/android_hardware_xiaomi" "lineage-22.1" "hardware/xiaomi"
clone_if_missing "https://github.com/ai94iq/android_packages_apps_XiaomiDolby" "axv" "packages/apps/XiaomiDolby"
# Function for applying patches with enhanced handling
apply_atomic_recovery_patch() {
local root_dir=$(pwd)
local target_dir="bootable/recovery"
local patch_path="${root_dir}/device/xiaomi/pipa/source-patches/atomic-recovery.diff"
echo "==== Applying atomic-recovery patch ===="
# Check if patch file exists
if [ ! -f "$patch_path" ]; then
echo "Error: atomic-recovery.diff patch file not found"
echo "Please check if the file exists at: ${patch_path}"
return 1
fi
# Create a temporary copy of the patch file with Unix line endings
local temp_patch=$(mktemp)
echo "Normalizing patch line endings..."
tr -d '\r' < "$patch_path" > "$temp_patch"
# Enter target directory
echo "Navigating to ${target_dir}..."
if ! cd "$target_dir"; then
echo "Error: Could not change to $target_dir directory"
rm "$temp_patch"
return 1
fi
echo "Applying atomic-recovery patch..."
# Save the current state
local current_state=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || git rev-parse HEAD)
# Try applying with git am first
echo "Trying git am with --3way option..."
if git am --3way "$temp_patch" 2>/dev/null; then
echo "✓ Patch applied successfully using git am"
rm "$temp_patch"
cd "$root_dir"
return 0
fi
git am --abort 2>/dev/null || true
# Try git apply
echo "Trying git apply with ignore-whitespace..."
if git apply --check --ignore-whitespace "$temp_patch" 2>/dev/null &&
git apply --ignore-whitespace "$temp_patch"; then
echo "✓ Patch applied successfully using git apply"
git add .
git commit -m "Applied atomic-recovery patch"
rm "$temp_patch"
cd "$root_dir"
return 0
fi
# Try patch command with various strip levels
echo "Trying patch utility with various strip levels..."
for level in 1 0 2 3; do
if patch -p${level} --ignore-whitespace --no-backup-if-mismatch < "$temp_patch" 2>/dev/null; then
echo "✓ Patch applied successfully using patch -p${level}"
git add .
git commit -m "Applied atomic-recovery patch"
rm "$temp_patch"
cd "$root_dir"
return 0
fi
done
# Try partial application
echo "Attempting partial patch application..."
patch -p1 --forward --verbose --ignore-whitespace --no-backup-if-mismatch < "$temp_patch" || true
# Check if any changes were made
if git diff --name-only | grep -q .; then
echo "✓ Partial application of atomic-recovery patch succeeded"
git add .
git commit -m "Applied atomic-recovery patch (partial)"
rm "$temp_patch"
cd "$root_dir"
return 0
fi
echo "✗ Failed to apply atomic-recovery patch after all attempts"
# Cleanup
git reset --hard HEAD 2>/dev/null || true
rm "$temp_patch"
cd "$root_dir"
return 1
}
# Function to apply vendor-enable-split-notifications by removing the config file
apply_split_notifications_fix() {
local root_dir=$(pwd)
local target_dir="vendor/lineage"
local config_file="overlay/common/frameworks/base/packages/SystemUI/res/values-sw600dp-land/config.xml"
echo "==== Applying split-notifications fix ===="
# Enter target directory
echo "Navigating to ${target_dir}..."
if ! cd "$target_dir"; then
echo "Error: Could not change to $target_dir directory"
cd "$root_dir"
return 1
fi
# Check if the file exists and remove it
if [ -f "$config_file" ]; then
echo "Removing ${config_file}..."
rm -f "$config_file"
# Commit the changes
git add .
git commit -m "Removed sw600dp-land config to enable split notifications for tablets"
echo "✓ Split-notifications fix applied successfully"
else
echo "Config file doesn't exist, no changes needed"
fi
# Return to root directory
cd "$root_dir"
return 0
}
# Function to update the Updater repository URL
apply_updater_repo_fix() {
local root_dir=$(pwd)
local target_dir="packages/apps/Updater"
local strings_file="app/src/main/res/values/strings.xml"
echo "==== Applying updater repository URL fix ===="
# Enter target directory
echo "Navigating to ${target_dir}..."
if ! cd "$target_dir"; then
echo "Error: Could not change to $target_dir directory"
cd "$root_dir"
return 1
fi
# Check if the file exists
if [ -f "$strings_file" ]; then
echo "Updating repository URL in ${strings_file}..."
# Replace the repository URL without creating a backup file
if grep -q "AxionAOSP/official_devices" "$strings_file"; then
echo "Changing AxionAOSP/official_devices to ai94iq/axion_official_devices"
sed -i 's#AxionAOSP/official_devices#ai94iq/axion_official_devices#g' "$strings_file"
# Commit the changes
git add .
git commit -m "Updated Updater repository URL to ai94iq/axion_official_devices"
echo "✓ Updater repository URL fix applied successfully"
else
echo "Repository URL pattern not found in $strings_file"
fi
else
echo "Strings file doesn't exist at $strings_file"
fi
# Return to root directory
cd "$root_dir"
return 0
}
# Function to update generate_json.sh to add IQ
modify_generate_json() {
local root_dir=$(pwd)
local target_dir="vendor/lineage"
local script_file="build/tools/generate_json.sh"
echo "==== Modifying generate_json.sh to add IQ tag ===="
# Enter target directory
echo "Navigating to ${target_dir}..."
if ! cd "$target_dir"; then
echo "Error: Could not change to $target_dir directory"
cd "$root_dir"
return 1
fi
# Check if the file exists
if [ -f "$script_file" ]; then
echo "Updating regex in ${script_file}..."
# Check if the file contains the pattern we want to modify
if grep -q "(COMMUNITY|OFFICIAL|UNOFFICIAL)" "$script_file"; then
echo "Adding IQ tag to the build type regex..."
sed -i 's#(COMMUNITY|OFFICIAL|UNOFFICIAL)#(COMMUNITY|IQ|OFFICIAL|UNOFFICIAL)#g' "$script_file"
# Commit the changes
git add .
git commit -m "Added IQ tag to generate_json.sh build type regex"
echo "✓ generate_json.sh modification applied successfully"
else
echo "Expected pattern not found in $script_file"
fi
else
echo "Script file doesn't exist at $script_file"
fi
# Return to root directory
cd "$root_dir"
return 0
}
# Main script execution starts here
ROOT_DIR=$(pwd)
DEVICE_PATH="${ROOT_DIR}/device/xiaomi/pipa"
# Check if the device repository exists
if [ ! -d "$DEVICE_PATH" ]; then
echo "Error: Device directory not found at ${DEVICE_PATH}"
echo "Please ensure all repositories are properly cloned"
exit 1
fi
# Create the patches directory if it doesn't exist
PATCHES_DIR="${DEVICE_PATH}/source-patches"
mkdir -p "$PATCHES_DIR"
# Apply patches one by one, ensuring we return to ROOT_DIR between each
echo "==== Starting patch application process ===="
# Apply atomic-recovery patch # Apply atomic-recovery patch
( apply_atomic_recovery_patch
# Store the root directory and device paths
ROOT_DIR="$(pwd)"
DEVICE_PATH="${ROOT_DIR}/device/xiaomi/pipa"
PATCH_PATH="${DEVICE_PATH}/source-patches/atomic-recovery.diff"
# Check if patch file exists # Make sure we're in the root directory
if [ ! -f "$PATCH_PATH" ]; then cd "$ROOT_DIR"
echo "Error: Patch file not found at ${PATCH_PATH}"
exit 1
fi
# Enter recovery directory # Apply split notifications fix (remove config file)
cd bootable/recovery || { apply_split_notifications_fix
echo "Error: Could not change to bootable/recovery directory"
exit 1
}
echo "Applying atomic-recovery patch from ${PATCH_PATH}..." # Make sure we're in the root directory
if git am "${PATCH_PATH}"; then cd "$ROOT_DIR"
echo "Patch applied successfully"
else
echo "Patch failed to apply, cleaning up..."
git am --abort
exit 1
fi
# Return to original directory # Apply updater repository URL fix
cd "${ROOT_DIR}" || echo "Warning: Failed to return to original directory" apply_updater_repo_fix
)
# Apply update-switch-server-url patch # Make sure we're in the root directory
( cd "$ROOT_DIR"
# Store the root directory and device paths
ROOT_DIR="$(pwd)"
DEVICE_PATH="${ROOT_DIR}/device/xiaomi/pipa"
PATCH_PATH="${DEVICE_PATH}/source-patches/update-switch-server-url.diff"
# Check if patch file exists # Apply generate_json.sh modification
if [ ! -f "$PATCH_PATH" ]; then modify_generate_json
echo "Error: Patch file not found at ${PATCH_PATH}"
exit 1
fi
# Enter Updater directory # Make sure we're in the root directory
cd packages/apps/Updater || { cd "$ROOT_DIR"
echo "Error: Could not change to packages/apps/Updater directory"
exit 1
}
echo "Applying update-switch-server-url patch from ${PATCH_PATH}..." echo "==== Patch application complete ===="
if git am "${PATCH_PATH}"; then
echo "Patch applied successfully"
else
echo "Patch failed to apply, cleaning up..."
git am --abort
exit 1
fi
# Return to original directory
cd "${ROOT_DIR}" || echo "Warning: Failed to return to original directory"
)
# Apply vendor-enable-split-notifications patch
(
# Store the root directory and device paths
ROOT_DIR="$(pwd)"
DEVICE_PATH="${ROOT_DIR}/device/xiaomi/pipa"
PATCH_PATH="${DEVICE_PATH}/source-patches/vendor-enable-split-notifications.diff"
# Check if patch file exists
if [ ! -f "$PATCH_PATH" ]; then
echo "Error: Patch file not found at ${PATCH_PATH}"
exit 1
fi
# Enter vendor/lineage directory
cd vendor/lineage || {
echo "Error: Could not change to vendor/lineage directory"
exit 1
}
echo "Applying vendor-enable-split-notifications patch from ${PATCH_PATH}..."
if git am "${PATCH_PATH}"; then
echo "Patch applied successfully"
else
echo "Patch failed to apply, cleaning up..."
git am --abort
exit 1
fi
# Return to original directory
cd "${ROOT_DIR}" || echo "Warning: Failed to return to original directory"
)