Skip to content
This repository has been archived by the owner on Jan 5, 2022. It is now read-only.

Commit

Permalink
auto-confirm: some devices require different sequences on backup/rest…
Browse files Browse the repository at this point in the history
…ore, eg Xiaomi Mi8
  • Loading branch information
IzzySoft committed Oct 5, 2018
1 parent 79fffd5 commit 5b15d38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions doc/config.sample
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ MK_APPRESTORE_DELAY=p
MK_AUTOCONFIRM_DELAY=3
# If the default auto-confirm sequence (22 23) doesn't work for you, specify a different one. Here's e.g. what the Xiaomi Mi8 wants:
MK_AUTOCONFIRM_SEQUENCE=(61 61 61 66)
# Optionally, if your device requires a different sequence for restore (again the Xiaomi Mi8) – leave empty/untouched otherwise:
MK_AUTOCONFIRM_SEQUENCE_2=(61 61 66)
# trigger an export from XPosed and pull it. Requires XPrivacy PRO key.
MK_XPRIVACY_EXPORT=0
# pull the XPrivacy databases when found (not contained in adb backup; root required)
Expand Down
10 changes: 6 additions & 4 deletions lib/scriptgen.lib
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,14 @@ getUserAppBackup() {
echo >> "$restorescript"

if [[ "${AUTO_CONFIRM}" -eq 1 ]]; then
[[ -n "${MK_AUTOCONFIRM_SEQUENCE_2}" || ${#MK_AUTOCONFIRM_SEQUENCE_2[@]} -eq 0 ]] && MK_AUTOCONFIRM_SEQUENCE_2=${MK_AUTOCONFIRM_SEQUENCE[@]}
echo "function autoConfirm() {" >> "$restorescript"
if [[ ! -z "${BACKUP_PASSWORD}" ]]; then
echo -e " adb ${ADBOPTS} shell input text \"${BACKUP_PASSWORD}\" \\" >> "$restorescript"
echo " && sleep 1" >> "$restorescript" # wait between sending text and keycodes
fi
if [[ ${#MK_AUTOCONFIRM_SEQUENCE[@]} -gt 0 ]]; then # run device-specific keycode sequence. Default: 22 23
for keyevent in ${MK_AUTOCONFIRM_SEQUENCE[@]}; do
if [[ ${#MK_AUTOCONFIRM_SEQUENCE_2[@]} -gt 0 ]]; then # run device-specific keycode sequence. Default: 22 23
for keyevent in ${MK_AUTOCONFIRM_SEQUENCE_2[@]}; do
echo -e " adb ${ADBOPTS} shell input keyevent ${keyevent}; sleep ${MK_AUTOCONFIRM_DELAY}" >> "$restorescript"
done
fi
Expand Down Expand Up @@ -440,13 +441,14 @@ getSystemAppBackup() {
echo >> "$restorescript"

if [[ "${AUTO_CONFIRM}" -eq 1 ]]; then
[[ -n "${MK_AUTOCONFIRM_SEQUENCE_2}" || ${#MK_AUTOCONFIRM_SEQUENCE_2[@]} -eq 0 ]] && MK_AUTOCONFIRM_SEQUENCE_2=${MK_AUTOCONFIRM_SEQUENCE[@]}
echo "function autoConfirm() {" >> "$restorescript"
if [[ ! -z "${BACKUP_PASSWORD}" ]]; then
echo -e " adb ${ADBOPTS} shell input text \"${BACKUP_PASSWORD}\" \\" >> "$restorescript"
echo " && sleep 1" >> "$restorescript" # wait between sending text and keycodes
fi
if [[ ${#MK_AUTOCONFIRM_SEQUENCE[@]} -gt 0 ]]; then # run device-specific keycode sequence. Default: 22 23
for keyevent in ${MK_AUTOCONFIRM_SEQUENCE[@]}; do
if [[ ${#MK_AUTOCONFIRM_SEQUENCE_2[@]} -gt 0 ]]; then # run device-specific keycode sequence. Default: 22 23
for keyevent in ${MK_AUTOCONFIRM_SEQUENCE_2[@]}; do
echo -e " adb ${ADBOPTS} shell input keyevent ${keyevent}; sleep ${MK_AUTOCONFIRM_DELAY}" >> "$restorescript"
done
fi
Expand Down

0 comments on commit 5b15d38

Please sign in to comment.