├── settings.gradle ├── .dockerignore ├── .idea ├── .gitignore ├── compiler.xml ├── vcs.xml ├── misc.xml └── jarRepositories.xml ├── .yamllint ├── app ├── libs │ └── protobuf-java-3.6.0.jar ├── src │ └── main │ │ ├── ic_launcher-web.png │ │ ├── jniLibs │ │ ├── x86 │ │ │ └── libhu_jni.so │ │ └── armeabi │ │ │ └── libhu_jni.so │ │ ├── res │ │ ├── drawable │ │ │ ├── aawifi.png │ │ │ ├── hu_icon_256.png │ │ │ └── ic_launcher_background.xml │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── ic_launcher_foreground.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_round.png │ │ │ └── ic_launcher_foreground.png │ │ ├── values │ │ │ ├── white.xml │ │ │ ├── colors.xml │ │ │ ├── styles.xml │ │ │ └── strings.xml │ │ ├── xml │ │ │ └── accessory_filter.xml │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ └── layout │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── north3221 │ │ └── aagateway │ │ ├── AAlogger.java │ │ ├── MainActivity.java │ │ ├── HackerService.java │ │ └── ConnectionStateReceiver.java ├── proguard-rules.pro └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── Dockerfile ├── .gitignore ├── .github └── workflows │ └── build-apk.yml ├── gradlew.bat ├── README.md └── gradlew /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | app/build 3 | build 4 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | 4 | rules: 5 | line-length: disable 6 | truthy: disable 7 | -------------------------------------------------------------------------------- /app/libs/protobuf-java-3.6.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/libs/protobuf-java-3.6.0.jar -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/jniLibs/x86/libhu_jni.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/jniLibs/x86/libhu_jni.so -------------------------------------------------------------------------------- /app/src/main/res/drawable/aawifi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/drawable/aawifi.png -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi/libhu_jni.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/jniLibs/armeabi/libhu_jni.so -------------------------------------------------------------------------------- /app/src/main/res/drawable/hu_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/drawable/hu_icon_256.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values/white.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/north3221/AAGateWayWiFi/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/xml/accessory_filter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AAGateWay 3 | Will starts the AAWireless Hacker Service when AA USB Adapter is connected and WiFi is connected 4 | Exit 5 | Logging level: Set the logging level 6 | Control WiFi: Turn Wifi on/off with power 7 | Alternative usb toggle 8 | Request Battery 9 | Request Root 10 | Request Storage 11 | 12 | off 13 | info 14 | full 15 | full + log 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | ENV DEBIAN_FRONTEND=noninteractive 4 | 5 | # https://developer.android.com/studio/index.html#command-tools 6 | 7 | WORKDIR /opt/android 8 | 9 | RUN apt-get update \ 10 | && apt-get install -y \ 11 | curl \ 12 | unzip \ 13 | openjdk-8-jdk 14 | 15 | # jdk 8, 11, 13 ,16 16 | # && apt-get install -y android-sdk 17 | 18 | ENV ANDROID_HOME=/opt/android 19 | ENV PATH=$ANDROID_HOME/cmdline-tools/tools/bin/:$PATH 20 | ENV PATH=$ANDROID_HOME/emulator/:$PATH 21 | ENV PATH=$ANDROID_HOME/platform-tools/:$PATH 22 | 23 | RUN curl -L $(curl -sL https://developer.android.com/studio/index.html\#command-tools | grep "zip" | grep "linux" | grep "commandline" | grep "href" | cut -d'"' -f2) -O \ 24 | && unzip $(ls | grep zip) \ 25 | && rm -rf $(ls | grep zip) \ 26 | && mkdir tools \ 27 | && mv cmdline-tools/* tools \ 28 | && mv tools cmdline-tools/ \ 29 | && yes | sdkmanager --licenses 30 | 31 | # ENV GRADLE_OPTS=-Djava.io.tmpdir=/repo/ 32 | # export GRADLE_OPTS=-Djava.io.tmpdir=/repo/ 33 | 34 | # ./gradlew assemble 35 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | 4 | android { 5 | compileSdkVersion 27 6 | defaultConfig { 7 | applicationId "com.north3221.aagateway" 8 | minSdkVersion 14 9 | //noinspection ExpiredTargetSdkVersion 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0.3 Alpha" 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 14 | multiDexEnabled true 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | } 23 | 24 | dependencies { 25 | implementation fileTree(include: ['*.jar'], dir: 'libs') 26 | implementation 'com.android.support:appcompat-v7:27.1.1+' 27 | implementation 'com.android.support.constraint:constraint-layout:1.0.2' 28 | testImplementation 'junit:junit:4.12' 29 | androidTestImplementation 'com.android.support.test:runner:1.0.1' 30 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 31 | implementation files('libs/protobuf-java-3.6.0.jar') 32 | 33 | } 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IDE 2 | *.iml 3 | app/*.iml 4 | 5 | # Built application files 6 | *.apk 7 | *.ap_ 8 | 9 | # Files for the ART/Dalvik VM 10 | *.dex 11 | 12 | # Java class files 13 | *.class 14 | 15 | # Generated files 16 | bin/ 17 | gen/ 18 | out/ 19 | 20 | # Gradle files 21 | .gradle/ 22 | build/ 23 | 24 | # Local configuration file (sdk path, etc) 25 | local.properties 26 | 27 | # Proguard folder generated by Eclipse 28 | proguard/ 29 | 30 | # Log Files 31 | *.log 32 | 33 | # Android Studio Navigation editor temp files 34 | .navigation/ 35 | 36 | # Android Studio captures folder 37 | captures/ 38 | 39 | # IntelliJ 40 | *.iml 41 | .idea/workspace.xml 42 | .idea/tasks.xml 43 | .idea/gradle.xml 44 | .idea/assetWizardSettings.xml 45 | .idea/dictionaries 46 | .idea/libraries 47 | .idea/caches 48 | 49 | # Keystore files 50 | # Uncomment the following line if you do not want to check your keystore files in. 51 | #*.jks 52 | 53 | # External native build folder generated in Android Studio 2.2 and later 54 | .externalNativeBuild 55 | 56 | # Google Services (e.g. APIs or Firebase) 57 | google-services.json 58 | 59 | # Freeline 60 | freeline.py 61 | freeline/ 62 | freeline_project_description.json 63 | 64 | # fastlane 65 | fastlane/report.xml 66 | fastlane/Preview.html 67 | fastlane/screenshots 68 | fastlane/test_output 69 | fastlane/readme.md 70 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /.github/workflows/build-apk.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Build APK 3 | 4 | on: 5 | push: 6 | branches: 7 | - master 8 | tags: 9 | - v* 10 | pull_request: 11 | branches: 12 | - master 13 | 14 | jobs: 15 | tests: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: "YamlLint" 20 | run: | 21 | docker run \ 22 | --rm \ 23 | -w /repo \ 24 | -v $(pwd):/repo \ 25 | -t \ 26 | alpine:3.13 /bin/sh -c " \ 27 | apk add --no-cache py-pip python3 bash \ 28 | && pip3 install yamllint \ 29 | && yamllint -s . \ 30 | " 31 | - name: "ShellCheck" 32 | run: | 33 | docker run \ 34 | --rm \ 35 | -w /repo \ 36 | -v $(pwd):/repo \ 37 | -t \ 38 | alpine:3.13 /bin/sh -c " \ 39 | apk add --no-cache shellcheck bash \ 40 | && shellcheck $(find . -type f -name "*.sh" | tr '\n' ' ') 41 | " 42 | build: 43 | runs-on: ubuntu-latest 44 | steps: 45 | - uses: actions/checkout@v2 46 | - name: "Build APK" 47 | run: ./build_in_docker.sh 48 | - name: Release 49 | uses: softprops/action-gh-release@v1 50 | if: startsWith(github.ref, 'refs/tags/') 51 | with: 52 | tag_name: ${{ github.ref }} 53 | name: Release ${{ github.ref }} 54 | draft: true 55 | files: | 56 | ./app/build/outputs/apk/debug/* 57 | env: 58 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # You don't need to add this in secrets it's by default. 59 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS="-Xmx64m" 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AAGateWay Wireless Android Auto using Master Wifi Hotspot (Root required on slave) 2 | 3 | I have reworked the AAGateway to wait for USB adapter AND connection to WiFi. 4 | This only works running on the slave and connecting to master wifi hotspot 5 | 6 | Shout out to the (couldn't of done this without them): 7 | * The original [AAGateWay](https://github.com/borconi/AAGateWay) 8 | * Also the modified [AAGateWay](https://github.com/olivluca/AAGateWay) 9 | 10 | [XDA forum link](https://forum.xda-developers.com/t/android-4-1-proxy-gateway-for-android-auto.3813163) for discussion, requests and support 11 | 12 | You can build it or get it from the [Releases](https://github.com/north3221/AAGateWayWiFi/releases) section and you have to install it on the slave phone. 13 | 14 | ## Set up: 15 | ### MASTER (doesn't need to be rooted) 16 | * You MUST have [Android Auto Head Unit Server running](https://developer.android.com/training/cars/testing#:~:text=You%20only%20need%20to%20enable,server%20(see%20figure%201).) on your Master device (you cna just leave it running) 17 | * You also must have WifI tether on Master device, which the slave can connect to 18 | NB I use Tasker to automate both of these things i.e. turn on wifi tether when connected to car bluetooth and some screen touches for AA HUS 19 | 20 | ### SLAVE 21 | * Remove battery restrictions on AAgateway app on slave - Click the request battery button 22 | * Allow storage access - Click the request storage button This is for writing a log file to sdcard when logging set to full + log 23 | * Root is required - click request root button. This is to enable toggling USB to connect to car head unit when service ready 24 | * Ensure slave can connect to master wifi tether, i.e. save the network. But NO other wifi (you don't want it to connect to the wrong network) 25 | * Worth making sure that the screen wakes on power input, as some phones don't connect to wifi with screen off. This app does wake lock for up to 5 mins but doesnt work if screen off 26 | 27 | #### Settings 28 | * Logging Level: Prob worth changing it to full + log while setting up (shows stuff in ui and writes to sdcard/aagatewaylog.txt) 29 | Full just shows it all in ui (ui only updates when app is open), and info just shows the key elements on screen. 30 | * The setting control wifi means the app will turn on wifi when the slave is powered and turn it off after its has no power. 31 | The app only waits for wifi connection, not specifically your master, hence make sure only one wifi set up 32 | * Alternative usb toggle is if the standard one doesn't work (see later) 33 | 34 | ~~First time you try connecting you will need to allowed root access (TODO add prompt at startup)~~ done 35 | First time it will prompt do you want to use aawireless for android automotive, click 'always' 36 | 37 | Once done, plug slave into car, turn car on, enable wifi (if set wifi control to true, does it for you) 38 | Slave should show it has usb device and once connects to master wifi, then wifi will show connected, then usb will toggle and service will start 39 | 40 | AA should fire up, if not it will retry. Let it retry a few times 41 | If it doesn't work, unplug slave and restart your HUS on master (i.e. stop it and start it again). Then try again 42 | 43 | If after a few attempts of this you never get a flash of Android Auto then possibly there is issue between head unit, slave and master. 44 | I've put in an alternate usb toggle option. So change that setting to true and try it all again. 45 | If still fails after that then no idea, sorry. If you can debug it yourself great, raise a pr 46 | 47 | NB I an NOT a developer, just a hobbyist who likes to play and would like AA wireless in his car :-) 48 | I only have a couple of combinations to try and test this on. Happy to look at issues but be patient I may never get to em, my focus is it working for me, just sharing to try and help others. 49 | Please don't start complaining if its not working or I am not responsive to questions or issues 50 | 51 | 52 | #### Known issues 53 | 54 | ~~If slave stops, master doesn't seem to realise (AA still thinks its connected). This bawks the HUS. So you need to restart the HUS before next use 55 | TODO find a more graceful way of killing connection~~ DONE 56 | 57 | 58 | Many other issues... this wont be plane sailing, so dont expect it to be!! -------------------------------------------------------------------------------- /app/src/main/java/com/north3221/aagateway/AAlogger.java: -------------------------------------------------------------------------------- 1 | package com.north3221.aagateway; 2 | 3 | import static com.north3221.aagateway.MainActivity.SHARED_PREF_NAME; 4 | import static com.north3221.aagateway.MainActivity.TAG; 5 | 6 | import android.content.Context; 7 | import android.content.SharedPreferences; 8 | import android.os.Build; 9 | import android.support.annotation.RequiresApi; 10 | import android.util.Log; 11 | import java.io.BufferedWriter; 12 | import java.io.File; 13 | import java.io.FileWriter; 14 | import java.io.IOException; 15 | import java.text.SimpleDateFormat; 16 | 17 | class AAlogger { 18 | public static final String 19 | SHARED_PREF_KEY_LOG = "LOG", 20 | LOGFILE = "sdcard/aagatewaylog.txt"; 21 | private final Context loggerContext; 22 | 23 | public AAlogger(Context context){ 24 | loggerContext = context; 25 | } 26 | 27 | public void log(String message, String tvName){ 28 | switch (loggingLevel()){ 29 | case 0: 30 | break; 31 | case 3: 32 | log(message); 33 | case 2: 34 | if (!tvName.equals("log")){ 35 | updateTextView(message, "log"); 36 | } 37 | case 1: 38 | if (tvName.equals("log") && loggingLevel() == 1){ 39 | break; 40 | } 41 | updateTextView(message,tvName); 42 | break; 43 | } 44 | 45 | } 46 | 47 | public void log(String message){ 48 | if (loggingLevel() > 2 && android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) 49 | appendLog(message); 50 | } 51 | 52 | private void updateTextView(String message, String tvName){ 53 | 54 | int id = loggerContext.getResources().getIdentifier(tvName, "id", loggerContext.getPackageName()); 55 | Log.d(TAG, "Updating Shared Preferences for tvName:= " + tvName + " ID:= " + id); 56 | SharedPreferences sp = loggerContext.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE); 57 | if (tvName.equals("log")) { 58 | String timeStamp = new SimpleDateFormat("HH:mm:ss").format(new java.util.Date()); 59 | message = timeStamp + ":" + message + "\n" + sp.getString(String.valueOf(id), ""); 60 | } 61 | if (message.length() > 5120){ 62 | message = message.substring(0, 5120); 63 | } 64 | SharedPreferences.Editor spEditor = sp.edit(); 65 | spEditor.putString(String.valueOf(id), message); 66 | spEditor.apply(); 67 | } 68 | 69 | 70 | private int loggingLevel(){ 71 | SharedPreferences sharedpreferences = loggerContext.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE); 72 | return sharedpreferences.getInt(SHARED_PREF_KEY_LOG,0); 73 | 74 | } 75 | 76 | @RequiresApi(api = Build.VERSION_CODES.KITKAT) 77 | private void appendLog(String text) 78 | { 79 | File logFile = new File(LOGFILE); 80 | if (logFile.exists() && logFile.length() > 50000){ 81 | logFile.delete(); 82 | } 83 | if (!logFile.exists()) 84 | { 85 | try { 86 | logFile.createNewFile(); 87 | } 88 | catch (IOException e) { 89 | // TODO Auto-generated catch block 90 | e.printStackTrace(); 91 | } 92 | } 93 | String timeStamp = new SimpleDateFormat("yyyy.MM.dd.HH:mm:ss").format(new java.util.Date()); 94 | try (BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true))) { 95 | buf.append(timeStamp).append(": ").append(text); 96 | buf.newLine(); 97 | } catch (IOException e) { 98 | // TODO Auto-generated catch block 99 | e.printStackTrace(); 100 | } 101 | } 102 | 103 | public void loggingLevelChanged(){ 104 | switch (loggingLevel()){ 105 | case 0: 106 | removeSharedPref("usbconnection"); 107 | removeSharedPref("wificonnection"); 108 | removeSharedPref("aaservice"); 109 | case 1: 110 | removeSharedPref("log"); 111 | case 2: 112 | deleteLogfile(); 113 | } 114 | } 115 | 116 | private void deleteLogfile(){ 117 | Log.d(TAG, "Deleting Log File"); 118 | File logFile = new File(LOGFILE); 119 | logFile.delete(); 120 | 121 | } 122 | 123 | private void removeSharedPref(String name){ 124 | String id = String.valueOf(loggerContext.getResources().getIdentifier(name, "id", loggerContext.getPackageName())); 125 | Log.d(TAG, "Removing Shared Preferences for tvName:= " + name); 126 | SharedPreferences sp = loggerContext.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE); 127 | SharedPreferences.Editor spEditor = sp.edit(); 128 | spEditor.putString(id,""); 129 | spEditor.apply(); 130 | spEditor.remove(id); 131 | spEditor.apply(); 132 | 133 | } 134 | 135 | } 136 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 20 | 21 | 27 | 28 | 34 | 40 | 41 | 47 | 48 | 55 | 56 | 61 | 62 | 63 | 68 | 69 | 77 | 78 | 84 | 85 | 93 | 94 | 95 | 96 |