  #!/bin/sh
  
  if [ -f /EON ]; then
    export LD_LIBRARY_PATH="/system/lib64:$LD_LIBRARY_PATH"
    exec ./android/spinner/spinner "$1"
  else
    if [ -f /TICI ] && [ ! -f qt/spinner ]; then
      cp qt/spinner_aarch64 qt/spinner
    fi
  
    exec ./qt/spinner "$1"
  fi
 
</s> remove if [ -f /EON ]; then
  export LD_LIBRARY_PATH="/system/lib64:$LD_LIBRARY_PATH"
  exec ./android/text/text "$1"
else
  if [ -f /TICI ] && [ ! -f qt/text ]; then
    cp qt/text_aarch64 qt/text
  fi

  exec ./qt/text "$1"
 </s> add if [ -f /EON ] && [ ! -f qt/text ]; then
  cp qt/text_aarch64 qt/text
elif [ -f /TICI ] && [ ! -f qt/text ]; then
  cp qt/text_larch64 qt/text </s> remove if arch == 'aarch64' and "QT" not in os.environ:
  libs += ['EGL', 'GLESv3', 'gnustl_shared', 'hardware', 'OpenSLES', 'cutils', 'uuid']
  linkflags = ['-Wl,-rpath=/system/lib64,-rpath=/system/comma/usr/lib']

  src += ["android/ui.cc", "android/sl_sound.cc"]
  env.Program('_ui', src,
    LINKFLAGS=linkflags,
    LIBS=libs)
else:
  qt_base_libs = qt_env["LIBS"] + libs + ["pthread"]
  if arch == "Darwin":
    del qt_base_libs[qt_base_libs.index('OpenCL')]
    qt_env['FRAMEWORKS'] += ['OpenCL']

  widgets_src = ["qt/widgets/input.cc", "qt/widgets/drive_stats.cc",
                 "qt/widgets/ssh_keys.cc", "qt/widgets/toggle.cc", "qt/widgets/controls.cc", "qt/qt_sound.cc",
                 "qt/widgets/offroad_alerts.cc", "qt/widgets/setup.cc", "qt/widgets/keyboard.cc",
                 "#phonelibs/qrcode/QrCode.cc"]

  if arch != 'aarch64':
    widgets_src += ["qt/offroad/networking.cc", "qt/offroad/wifiManager.cc"]

  widgets = qt_env.Library("qt_widgets", widgets_src, LIBS=qt_base_libs)
  qt_libs = qt_base_libs + [widgets]

  qt_src = ["qt/ui.cc", "qt/window.cc", "qt/home.cc", "qt/api.cc", "qt/offroad/settings.cc",
            "qt/offroad/onboarding.cc"] + src
  qt_env.Program("_ui", qt_src, LIBS=qt_libs)

  # spinner and text window
  qt_env.Program("qt/text", ["qt/text.cc"], LIBS=qt_base_libs)
  qt_env.Program("qt/spinner", ["qt/spinner.cc"], LIBS=qt_base_libs)

  # build setup, factory resetter, and installer
  if "BUILD_SETUP" in os.environ:
    qt_env.Program("qt/setup/reset", ["qt/setup/reset.cc"], LIBS=qt_libs)
    qt_env.Program("qt/setup/setup", ["qt/setup/setup.cc"], LIBS=qt_libs + ['curl', 'common', 'json11'])
    qt_env.Program("qt/setup/wifi", ["qt/setup/wifi.cc"], LIBS=qt_libs + ['common', 'json11'])

    installers = [
      ("openpilot", "master"),
      #("openpilot_test", "release3-staging"),
      #("openpilot_internal", "master"),
      #("dashcam", "dashcam3-staging"),
      #("dashcam_test", "dashcam3-staging"),
    ]
    for name, branch in installers:
      d = {'BRANCH': f"'\"{branch}\"'"}
      if "internal" in name:
        d['INTERNAL'] = "1"

        import requests
        r = requests.get("https://github.com/commaci2.keys")
        r.raise_for_status()
        d['SSH_KEYS'] = f'\\"{r.text.strip()}\\"'
      qt_env.Program(f"qt/setup/installer_{name}", ["qt/setup/installer.cc"], LIBS=qt_libs, CPPDEFINES=d)
 </s> add qt_base_libs = qt_env["LIBS"] + libs + ["pthread"]
if arch == "Darwin":
  del qt_base_libs[qt_base_libs.index('OpenCL')]
  qt_env['FRAMEWORKS'] += ['OpenCL']

widgets_src = ["qt/widgets/input.cc", "qt/widgets/drive_stats.cc",
               "qt/widgets/ssh_keys.cc", "qt/widgets/toggle.cc", "qt/widgets/controls.cc", "qt/qt_sound.cc",
               "qt/widgets/offroad_alerts.cc", "qt/widgets/setup.cc", "qt/widgets/keyboard.cc",
               "#phonelibs/qrcode/QrCode.cc"]
if arch != 'aarch64':
  widgets_src += ["qt/offroad/networking.cc", "qt/offroad/wifiManager.cc"]

widgets = qt_env.Library("qt_widgets", widgets_src, LIBS=qt_base_libs)
qt_libs = qt_base_libs + [widgets]

# spinner and text window
qt_env.Program("qt/text", ["qt/text.cc"], LIBS=qt_base_libs)
qt_env.Program("qt/spinner", ["qt/spinner.cc"], LIBS=qt_base_libs)

# build main UI
qt_src = ["qt/ui.cc", "qt/window.cc", "qt/home.cc", "qt/api.cc", "qt/offroad/settings.cc",
          "qt/offroad/onboarding.cc"] + src
qt_env.Program("_ui", qt_src, LIBS=qt_libs)

# setup, factory resetter, and installer
if arch != 'aarch64' and "BUILD_SETUP" in os.environ:
  qt_env.Program("qt/setup/reset", ["qt/setup/reset.cc"], LIBS=qt_libs)
  qt_env.Program("qt/setup/setup", ["qt/setup/setup.cc"], LIBS=qt_libs + ['curl', 'common', 'json11'])
  qt_env.Program("qt/setup/wifi", ["qt/setup/wifi.cc"], LIBS=qt_libs + ['common', 'json11'])

  installers = [
    ("openpilot", "master"),
    #("openpilot_test", "release3-staging"),
    #("openpilot_internal", "master"),
    #("dashcam", "dashcam3-staging"),
    #("dashcam_test", "dashcam3-staging"),
  ]
  for name, branch in installers:
    d = {'BRANCH': f"'\"{branch}\"'"}
    if "internal" in name:
      d['INTERNAL'] = "1"

      import requests
      r = requests.get("https://github.com/commaci2.keys")
      r.raise_for_status()
      d['SSH_KEYS'] = f'\\"{r.text.strip()}\\"'
    qt_env.Program(f"qt/setup/installer_{name}", ["qt/setup/installer.cc"], LIBS=qt_libs, CPPDEFINES=d) </s> remove                       ["test spinner build", "cd selfdrive/ui/spinner && make clean && make"],
                      ["test text window build", "cd selfdrive/ui/text && make clean && make"],
 </s> add  </s> remove   if EON:
    pm_apply_packages('disable')

 </s> add  </s> remove   AudibleAlert.chimeEngage: 85,
  AudibleAlert.chimeDisengage: 85,
  AudibleAlert.chimeError: 85,
  AudibleAlert.chimePrompt: 85,
  AudibleAlert.chimeWarning1: 80,
  AudibleAlert.chimeWarning2: 107,
  AudibleAlert.chimeWarning2Repeat: 177,
  AudibleAlert.chimeWarningRepeat: 240,
 </s> add   AudibleAlert.chimeEngage: 173,
  AudibleAlert.chimeDisengage: 173,
  AudibleAlert.chimeError: 173,
  AudibleAlert.chimePrompt: 173,
  AudibleAlert.chimeWarning1: 163,
  AudibleAlert.chimeWarning2: 216,
  AudibleAlert.chimeWarning2Repeat: 346,
  AudibleAlert.chimeWarningRepeat: 468,
if [ -f /EON ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_aarch64 qt/spinner
elif [ -f /TICI ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_larch64 qt/spinner
  #!/bin/sh
  
if [ -f /EON ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_aarch64 qt/spinner
elif [ -f /TICI ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_larch64 qt/spinner
if [ -f /EON ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_aarch64 qt/spinner
elif [ -f /TICI ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_larch64 qt/spinner
if [ -f /EON ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_aarch64 qt/spinner
elif [ -f /TICI ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_larch64 qt/spinner
if [ -f /EON ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_aarch64 qt/spinner
elif [ -f /TICI ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_larch64 qt/spinner
if [ -f /EON ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_aarch64 qt/spinner
elif [ -f /TICI ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_larch64 qt/spinner
if [ -f /EON ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_aarch64 qt/spinner
elif [ -f /TICI ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_larch64 qt/spinner
if [ -f /EON ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_aarch64 qt/spinner
elif [ -f /TICI ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_larch64 qt/spinner
if [ -f /EON ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_aarch64 qt/spinner
elif [ -f /TICI ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_larch64 qt/spinner
if [ -f /EON ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_aarch64 qt/spinner
elif [ -f /TICI ] && [ ! -f qt/spinner ]; then
  cp qt/spinner_larch64 qt/spinner
  fi
keep keep replace replace replace replace replace replace replace replace replace keep
 APK purge (#20446)

* purge begins

* release files

* remove those

* no more android

* only qt

* text and spinner

* neos update script

* update sounds

* update cpu usage

* all done

Co-authored-by: Comma Device <device@comma.ai> 
selfdrive/ui/spinner