#!/bin/b-fash

set -e;
source "build/envsetup.sh";

### ASB
repopick -f 332119 # ASB SPL Uprev
repopick -f -t P_asb_2022-05
repopick -f -t P_asb_2022-06
repopick -f -t P_asb_2022-07
repopick -f -t P_asb_2022-08
repopick -f -t P_asb_2022-09
repopick -f -t P_asb_2022-10
repopick -f -t P_asb_2022-11
repopick -f -t P_asb_2022-12
repopick -f -t P_asb_2023-01
repopick -f -t P_asb_2023-02
repopick -f -t P_asb_2023-03
repopick -f -t P_asb_2023-04
repopick -f -t P_asb_2023-05
repopick -f -t P_asb_2023-06
repopick -f -t P_asb_2023-07
repopick -f -t P_asb_2023-08
repopick -f -t P_asb_2023-09
repopick -f -t P_asb_2023-10
repopick -P external/libvpx -f 367237 # libvpx CVE
repopick -f -t P_asb_2023-11
repopick -f -t P_asb_2023-12
repopick -f -t P_asb_2024-01
repopick -f -t P_asb_2024-02
repopick -f -t P_asb_2024-03
repopick -f -t P_asb_2024-04
repopick -f -t P_asb_2024-05
repopick -f -t P_asb_2024-06
repopick -f -t P_asb_2024-07
repopick -f -t P_asb_2024-08
repopick -f -t P_asb_2024-09
repopick -f -t P_asb_2024-10
wait

### Python3 Migration
repopick -f 325288 325892 325893 325901

### TZDB
repopick -f -t P_tzdata_2022
wait

### Platform
## bionic
changes=(
268655 # Expose arm libm intrinisics that were available on N and before
)
repopick -f -P bionic ${changes[@]}&

## frameworks/base
changes=(
354072 # Alter model name to avoid SafetyNet HW attestation enforcement
354073 # keystore: Block key attestation for SafetyNet
354074 # AttestationHooks: Set shipping level to 32 for devices >=33
354075 # Limit SafetyNet workarounds to unstable GMS process
354076 # gmscompat: Apply the SafetyNet workaround to Play store aswell
354077 # gmscompat: Use Nexus 6P fingerprint for CTS/Integrity
354078 # gmscompat: Make CTS/Play Integrity pass again
373896 # gmscompat: Use new info
)
repopick -f -P frameworks/base ${changes[@]}&

## hardware/interfaces
changes=(
265297 # composer: hwc2on1: Resolve fence leak
)
repopick -f -P hardware/interfaces ${changes[@]}&

## packages/apps/Bluetooth
changes=(
307919 # Bluetooth: don't kill stack if Telecom not found
)
repopick -f -P packages/apps/Bluetooth ${changes[@]}&

## packages/apps/Settings
changes=(
251793 # [DNM] [TESTING] Settings: Use Google variant of SettingsIntelligence
)
repopick -f -P packages/apps/Settings ${changes[@]}&

## vendor/lineage
changes=(
273619 # adb insecure by default
)
repopick -f -P vendor/lineage ${changes[@]}&

### Devices

## berkeley - VNDK28 FW ONLY
repopick -f 249828 # [DNM] kirin970: Remove kernel partition from fstab
repopick -f 241458 # Revert "kirin970-common: Abort installation on devices with too new firmware"
## Shipped
## Should fix: BKL-L04 Pie kernel source

## fugu
# device/asus/fugu
#changes=(
#260709 # [DNM] fugu: Set SELinux to Permissive
#)
#repopick -f -P device/asus/fugu ${changes[@]}&
## TODO: Test enforcing SELinux

## shieldtablet
#changes=(
#294322 # DNM SE
#)
#repopick -f -P device/nvidia/shieldtablet ${changes[@]}&
## TODO: Merge GL fencing fix

## yellowstone
repopick -f 279494 # [DNM] yellowstone: Set SE Linux to permissive status
## TODO: SELinux Enforcing, Tethering

wait
