Merge pull request #1 from mck1117/no-android

no android
This commit is contained in:
Matthew Kennedy 2023-02-22 13:48:16 -08:00 committed by GitHub
commit 648955263b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 1 additions and 1681 deletions

View File

@ -1,73 +0,0 @@
name: Android
on: [push,pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout Submodules
run: |
git submodule update --init --depth=1 unit_tests/googletest
git submodule update --init --depth=1 firmware/libfirmware
git submodule update --init --depth=1 firmware/ext/lua
git submodule update --init --depth=1 firmware/controllers/lua/luaaa
git submodule update --init --depth=1 firmware/controllers/can/wideband_firmware
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'
- name: Install Tools
working-directory: ./.github/workflows/
run: |
sudo ./add-ubuntu-latest-apt-mirrors.sh
sudo apt-get install mtools
- name: Generate Configs, Enums & Live Documentation
working-directory: ./firmware/
run: ./gen_default_everything.sh
- name: Test Compiler
run: javac -version
- name: Print GCC version
working-directory: .
run: gcc -v
- name: Build Android
env:
RUSEFI_ANDROID_KEYPASS: ${{ secrets.RUSEFI_ANDROID_KEYPASS }}
working-directory: ./android
run: |
if [ "${{github.event_name}}" == "push" ]; then
bash ./gradlew build
else
bash ./gradlew bundleDebug test
fi
- name: Upload APK - release
if: ${{ github.event_name == 'push' }}
uses: actions/upload-artifact@v3
with:
name: rusEFI-release
path: ./android/app/build/outputs/apk/release/rusEFI-release.apk
- name: Upload APK - unsigned
if: ${{ github.event_name != 'push' }}
uses: actions/upload-artifact@v3
with:
name: rusEFI-release-unsigned
path: ./android/app/build/outputs/bundle/debug/rusEFI-debug.aab
- name: Install Tools
run: sudo apt-get install sshpass
- name: Upload rusEFI Android application
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
working-directory: .
run: java_console/upload_file.sh ${{ secrets.RUSEFI_SSH_USER }} ${{ secrets.RUSEFI_SSH_PASS }} ${{ secrets.RUSEFI_SSH_SERVER }} build_server android/app/build/outputs/apk/release/rusEFI-release.apk

14
android/.gitignore vendored
View File

@ -1,14 +0,0 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx

View File

@ -1,116 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="1.8" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/../java_console/core_ui" />
<option value="$PROJECT_DIR$/../java_console/inifile" />
<option value="$PROJECT_DIR$/../java_console/io" />
<option value="$PROJECT_DIR$/../java_console/logging" />
<option value="$PROJECT_DIR$/../java_console/logging-api" />
<option value="$PROJECT_DIR$/../java_console/models" />
<option value="$PROJECT_DIR$/../java_console/shared_io" />
<option value="$PROJECT_DIR$/../java_console/shared_ui" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

View File

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
</component>
</project>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@ -1,81 +0,0 @@
apply plugin: 'com.android.application'
apply from: '../../android/dependencies.gradle'
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 30
buildToolsVersion "30.0.2"
project.archivesBaseName = "rusEFI";
defaultConfig {
applicationId "com.rusefi.app"
// API level 19 = Android 4.4 () Samsung S4 is nicely rootable with KingRoot
// API level 21 = Android_5.0_Lollipop
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
storeFile file("../certs/rusEFI.jks")
storePassword System.getenv("RUSEFI_ANDROID_KEYPASS")
keyAlias "key0"
keyPassword System.getenv("RUSEFI_ANDROID_KEYPASS")
}
}
buildTypes {
debug {
minifyEnabled false
}
release {
minifyEnabled false
signingConfig signingConfigs.release
}
}
}
dependencies {
implementation project(':ecu_io')
implementation project(':logging-api')
implementation project(':models')
implementation global_libs.annotations
def acraVersion = '5.7.0'
implementation "ch.acra:acra-http:$acraVersion"
implementation "ch.acra:acra-mail:$acraVersion"
implementation "ch.acra:acra-dialog:$acraVersion"
implementation "ch.acra:acra-toast:$acraVersion"
implementation files('lib/dfu_java.jar')
// implementation 'com.github.mik3y:usb-serial-for-android:v2.2.3'
implementation 'com.github.mik3y:usb-serial-for-android:v3.1.0'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.navigation:navigation-fragment:2.1.0'
implementation 'androidx.navigation:navigation-ui:2.1.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
/*
gradle.taskGraph.afterTask { task ->
project.logger.lifecycle("Password " + System.getenv('RUSEFI_ANDROID_KEYPASS'));
}
*/

Binary file not shown.

View File

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.mik3y</groupId>
<artifactId>usb-serial-for-android</artifactId>
<version>v2.2.3</version>
<packaging>aar</packaging>
<name>mik3y/usb-serial-for-android</name>
<description>Android USB host serial driver library for CDC, FTDI, Arduino and other devices.</description>
<url>https://github.com/mik3y/usb-serial-for-android</url>
<inceptionYear>2013</inceptionYear>
<licenses>
<license>
<name>GNU Lesser General Public License v2.1</name>
<url>https://api.github.com/licenses/lgpl-2.1</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>mik3y</id>
<name>mike w</name>
<email></email>
</developer>
</developers>
<scm>
<connection>scm:git://github.com/mik3y/usb-serial-for-android.git</connection>
<developerConnection>scm:git://github.com/mik3y/usb-serial-for-android.git</developerConnection>
<url>git://github.com/mik3y/usb-serial-for-android.git</url>
</scm>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,26 +0,0 @@
package com.rusefi.app;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.rusefi.app", appContext.getPackageName());
}
}

View File

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rusefi.app">
<application android:label="@string/app_name"
android:name="com.rusefi.app.RusefiApplication"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<!--
The USB_DEVICE_ATTACHED intent is always sent to an activity.
Activity is launched singleTop to avoid creating multiple activities for each event.
-->
<activity
android:name=".rusEFI"
android:launchMode="singleTop">
<!-- Launch as default from Android Studio -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Launch when USB device attached -->
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
</activity>
<service android:name=".SerialService" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
</manifest>

View File

@ -1,92 +0,0 @@
package com.rusefi.app;
import android.content.ContextWrapper;
import android.widget.TextView;
import com.rusefi.Listener;
import com.rusefi.dfu.DfuImage;
import com.rusefi.core.net.ConnectionAndMeta;
import com.rusefi.core.FileUtil;
import java.io.File;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
public class DfuUpload {
private static final String BUNDLE_FILE = "rusefi_bundle_autoupdate.zip";
//public static final String FILE = "rusefi_bundle_mre_f4_autoupdate.zip";
//private static final String DFU_FILE_NAME = "rusefi_mre_f4.dfu";
private static final String DFU_FILE_NAME = "rusefi_.dfu";
public final String localDfuImageFileName;
public final String localFullFile;
public final File localFolder;
public DfuUpload(ContextWrapper context) {
localFolder = context.getExternalFilesDir(null);
localFullFile = localFolder + File.separator + BUNDLE_FILE;
localDfuImageFileName = localFolder + File.separator + DFU_FILE_NAME;
}
void downloadFileIfNotPresent(final TextView mResultView) {
if (new File(this.localFullFile).exists()) {
mResultView.append(BUNDLE_FILE + " found!\n");
uncompressFile(this.localFullFile, this.localFolder, this.localDfuImageFileName, mResultView);
} else {
mResultView.append(BUNDLE_FILE + " not found!\n");
new Thread(new Runnable() {
@Override
public void run() {
try {
ConnectionAndMeta c = new ConnectionAndMeta(BUNDLE_FILE).invoke(ConnectionAndMeta.BASE_URL_LATEST);
ConnectionAndMeta.downloadFile(localFullFile, c, new ConnectionAndMeta.DownloadProgressListener() {
@Override
public void onPercentage(final int currentPercentage) {
mResultView.post(() -> mResultView.append("Downloaded " + currentPercentage + "%\n"));
}
});
mResultView.post(() -> mResultView.append("Downloaded! " + "\n"));
uncompressFile(localFullFile, localFolder, localDfuImageFileName, mResultView);
} catch (IOException e) {
mResultView.post(() -> mResultView.append("Error downloading " + e + "\n"));
}
}
}).start();
}
}
public void uncompressFile(final String localFullFile, final File localFolder, final String localDfuImageFileName, final TextView mResultView) {
final Listener<Integer> onSuccess = new Listener<Integer>() {
@Override
public void onResult(final Integer size) {
mResultView.post(new Runnable() {
@Override
public void run() {
mResultView.append(localDfuImageFileName + " File size: " + size + "\n");
}
});
DfuImage dfuImage = new DfuImage();
try {
dfuImage.read(localDfuImageFileName);
} catch (Throwable e) {
mResultView.post(() -> mResultView.append("Error reading " + e));
}
}
};
new Thread(() -> {
try {
FileUtil.unzip(localFullFile, localFolder);
final int size = (int) new File(localDfuImageFileName).length();
onSuccess.onResult(size);
} catch (final IOException e) {
mResultView.post(() -> mResultView.append("Error uncompressing " + e + "\n"));
}
}).start();
}
}

View File

@ -1,6 +0,0 @@
package com.rusefi.app;
public enum PermissionGrantedAction {
DFU,
DASHBOARD,
}

View File

@ -1,34 +0,0 @@
package com.rusefi.app;
import android.app.Application;
import org.acra.ACRA;
import org.acra.config.CoreConfigurationBuilder;
import org.acra.config.MailSenderConfigurationBuilder;
import org.acra.config.ToastConfigurationBuilder;
public class RusefiApplication extends Application {
static {
/**
* We better not touch real classes in order not to trigger class loading
*
* Logging#LOG_CLASS_NAME
* @see ConsoleLogger
*/
System.setProperty("log.className", "com.devexperts.logging.ConsoleLogger");
}
@Override
public void onCreate() {
super.onCreate();
CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this);
builder.getPluginConfigurationBuilder(MailSenderConfigurationBuilder.class)
.setMailTo("rusefillc@gmail.com")
.setSubject("Android Crash")
.setEnabled(true);
builder.getPluginConfigurationBuilder(ToastConfigurationBuilder.class);
ACRA.init(this, builder);
}
}

View File

@ -1,26 +0,0 @@
package com.rusefi.app;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import androidx.annotation.Nullable;
public class SerialService extends Service {
class SerialBinder extends Binder {
/*
SerialService getService() {
return SerialService.this;
}
*/
}
private final IBinder binder = new SerialBinder();
@Nullable
@Override
public IBinder onBind(Intent intent) {
return binder;
}
}

View File

@ -1,57 +0,0 @@
package com.rusefi.app;
import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaRecorder;
import android.media.audiofx.AcousticEchoCanceler;
import android.media.audiofx.NoiseSuppressor;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
public class SoundBroadcast {
private static final int sampleRate = 16000; // 44100 for music
private static final int channelConfig = AudioFormat.CHANNEL_CONFIGURATION_MONO;
private static final int audioFormat = AudioFormat.ENCODING_PCM_16BIT;
private static final int minBufSize = AudioRecord.getMinBufferSize(sampleRate, channelConfig, audioFormat) + 2048;
private byte[] buffer = new byte[minBufSize];
static void checkOrRequestPermission(Activity context) {
if (ContextCompat.checkSelfPermission(context, Manifest.permission.RECORD_AUDIO)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(context,
new String[]{Manifest.permission.RECORD_AUDIO},
1234);
}
}
public void start() {
Thread streamThread = new Thread(new Runnable() {
@Override
public void run() {
/*
AudioRecord recorder = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate, channelConfig, audioFormat, minBufSize * 10);
if (NoiseSuppressor.isAvailable()) {
NoiseSuppressor.create(recorder.getAudioSessionId()).setEnabled(true);
}
if (AcousticEchoCanceler.isAvailable()) {
AcousticEchoCanceler.create(recorder.getAudioSessionId()).setEnabled(true);
}
recorder.startRecording();
while (true) {
int bytes = recorder.read(buffer, 0, buffer.length);
}
*/
}
});
streamThread.start();
}
}

View File

@ -1,350 +0,0 @@
/*
* Copyright 2017, The Android Open Source 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.
*/
package com.rusefi.app;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.util.Linkify;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.devexperts.logging.Logging;
import com.google.android.material.snackbar.BaseTransientBottomBar;
import com.google.android.material.snackbar.Snackbar;
import com.rusefi.Callable;
import com.rusefi.Timeouts;
import com.rusefi.app.serial.AndroidSerial;
import com.rusefi.app.util.AndroidUtil;
import com.rusefi.auth.AuthTokenUtil;
import com.rusefi.binaryprotocol.BinaryProtocol;
import com.rusefi.dfu.DfuConnection;
import com.rusefi.dfu.DfuImage;
import com.rusefi.dfu.DfuLogic;
import com.rusefi.dfu.android.AndroidDfuConnection;
import com.rusefi.dfu.android.DfuDeviceLocator;
import com.rusefi.io.ConnectionStateListener;
import com.rusefi.io.DfuHelper;
import com.rusefi.io.IoStream;
import com.rusefi.io.LinkManager;
import com.rusefi.io.commands.ErrorInfoCommand;
import com.rusefi.io.serial.StreamConnector;
import com.rusefi.io.tcp.BinaryProtocolProxy;
import com.rusefi.proxy.NetworkConnector;
import com.rusefi.proxy.NetworkConnectorContext;
import com.rusefi.ui.StatusConsumer;
import java.io.IOException;
import java.util.Date;
public class rusEFI extends Activity {
private final static Logging log = Logging.getLogging(rusEFI.class);
private static final String ACTION_USB_PERMISSION = "com.android.example.USB_PERMISSION";
// private static final byte REQUEST_TYPE_CLASS = 32;
// private static final byte RECIPIENT_INTERFACE = 0x01;
//
// protected static final int DFU_DETACH_TIMEOUT = 1000;
private static final String VERSION = "rusEFI app v0.20220524\n";
private static final int LOCAL_PORT = 29001;
/* UI elements */
private TextView mStatusView;
private TextView mResultView; // global dump of all messages
private TextView broadcastStatus;
private TextView authStatusMessage;
private TextView authStatusClickableUrl;
private UsbManager usbManager;
private DfuUpload dfuUpload;
private SoundBroadcast soundBroadcast = new SoundBroadcast();
private PermissionGrantedAction onPermissionGrantedAction;
@SuppressLint("SetTextI18n")
@Override
protected void onCreate(Bundle savedInstanceState) {
log.info("onCreate");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_usb);
/**
* We need to make sure that WiFi is available for us, this might be related to screen on?
*/
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
findViewById(R.id.buttonSound).setVisibility(View.GONE);
findViewById(R.id.buttonDfu).setVisibility(View.GONE);
Button view = findViewById(R.id.localBroadcast);
view.setText("Local broadcast on " + LOCAL_PORT);
broadcastStatus = findViewById(R.id.broadcastStatus);
broadcastStatus.setVisibility(View.GONE);
usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
// turn on screen while ADB debugging idle phone
AndroidUtil.turnScreenOn(this);
mStatusView = findViewById(R.id.text_status);
mResultView = findViewById(R.id.text_result);
authStatusMessage = findViewById(R.id.authStatus1);
authStatusClickableUrl = findViewById(R.id.authStatus2);
authStatusClickableUrl.setText(AuthTokenUtil.TOKEN_PROFILE_URL);
Linkify.addLinks(authStatusClickableUrl, Linkify.WEB_URLS);
IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION);
registerReceiver(mUsbReceiver, filter);
visibleLogAppend(VERSION);
dfuUpload = new DfuUpload(this);
//dfuUpload.downloadFileIfNotPresent(mResultView);
String authToken = "";
int visibility = AuthTokenUtil.isToken(authToken) ? View.GONE : View.VISIBLE;
authStatusMessage.setVisibility(visibility);
authStatusClickableUrl.setVisibility(visibility);
// switchOrProgramDfu();
// SoundBroadcast.checkOrRequestPermission(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(mUsbReceiver);
}
private final BroadcastReceiver mUsbReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (ACTION_USB_PERMISSION.equals(action)) {
synchronized (this) {
if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) {
if (onPermissionGrantedAction == PermissionGrantedAction.DFU) {
UsbDevice dfuDevice = DfuDeviceLocator.findDevice(usbManager);
doDfuUpdate(dfuDevice);
} else if (onPermissionGrantedAction == PermissionGrantedAction.DASHBOARD) {
connectDashboard();
}
}
}
}
}
};
private void switchOrProgramDfu() {
UsbDevice dfuDevice = DfuDeviceLocator.findDevice(usbManager);
if (dfuDevice == null) {
visibleLogAppend("No DFU device\n");
switchToDfu();
// once device is in DFU mode we expect what exactly to happen?
} else if (!usbManager.hasPermission(dfuDevice)) {
requestUsbPermission(dfuDevice, PermissionGrantedAction.DFU);
} else {
doDfuUpdate(dfuDevice);
}
}
public void visibleLogAppend(String s) {
CharSequence current = mResultView.getText();
mResultView.setText(s + "\n" + current);
}
@SuppressLint("SetTextI18n")
private void switchToDfu() {
AndroidSerial serial = AndroidSerial.getAndroidSerial(this, mStatusView, usbManager);
if (serial == null) {
// error already reported to mStatusView
return;
}
visibleLogAppend("Switching to DFU\n");
DfuHelper.sendDfuRebootCommand(serial, StatusConsumer.VOID);
}
public void requestUsbPermission(UsbDevice usbDevice, PermissionGrantedAction action) {
// why do we not have similar 'request serial USB permission'?
onPermissionGrantedAction = action;
PendingIntent mPermissionIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);
usbManager.requestPermission(usbDevice, mPermissionIntent);
}
@SuppressLint("SetTextI18n")
private void doDfuUpdate(UsbDevice dfuDevice) {
mStatusView.setText("rusEFI: DFU detected");
DfuDeviceLocator.Result dfu = new DfuDeviceLocator().openDfu(usbManager, dfuDevice);
DfuImage dfuImage = new DfuImage();
dfuImage.read(dfuUpload.localDfuImageFileName);
visibleLogAppend("Image size " + dfuImage.getImageSize() + "\n");
DfuConnection connection = new AndroidDfuConnection(dfu.getConnection(), dfu.getInterfaceIndex(), dfu.getTransferSize(), dfu.getFlashRange());
DfuLogic.Logger logger = DfuLogic.Logger.CONSOLE;
try {
// DfuCommandGetStatus.State state = DfuCommandGetStatus.read(c);
// mResultView.append("State " + state + "\n");
DfuLogic.uploadImage(logger, connection, dfuImage, dfu.getFlashRange());
} catch (IllegalStateException e) {
visibleLogAppend("Error " + e + "\n");
}
}
public void onConnectButton(View view) {
connectDashboard();
}
/**
* MRE + USB cable + Android + WiFi I get about 8Hz Runtime Data Rate :(
*/
public void onLocalBroadcast(View view) {
AndroidSerial serial = AndroidSerial.getAndroidSerial(this, mStatusView, usbManager);
if (serial == null) {
// error already reported to mStatusView
return;
}
try {
BinaryProtocolProxy.createProxy(serial, LOCAL_PORT, new BinaryProtocolProxy.ClientApplicationActivityListener() {
@Override
public void onActivity() {
}
}, StatusConsumer.ANONYMOUS);
visibleLogAppend("Running TCP/IP proxy on " + LOCAL_PORT);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Called when the user touches a button
*/
public void sendMessage(View view) {
if (view.getId() == R.id.buttonDfu) {
switchOrProgramDfu();
} else if (view.getId() == R.id.buttonSound) {
soundBroadcast.start();
} else if (view.getId() == R.id.buttonBroadcast) {
startService(new Intent(this, SerialService.class));
AndroidSerial serial = AndroidSerial.getAndroidSerial(this, mStatusView, usbManager);
if (serial == null) {
// error already reported to mStatusView
Snackbar mySnackbar = Snackbar.make(view, "No ECU detected", BaseTransientBottomBar.LENGTH_LONG);
mySnackbar.show();
return;
}
LinkManager linkManager = new LinkManager();
linkManager.setConnector(new StreamConnector(linkManager, new Callable<IoStream>() {
@Override
public IoStream call() {
return serial;
}
}));
linkManager.getConnector().connectAndReadConfiguration(new BinaryProtocol.Arguments(true),
new ConnectionStateListener() {
@Override
public void onConnectionEstablished() {
mResultView.post(() -> visibleLogAppend(new Date() + " On connection established\n"));
NetworkConnectorContext context = new NetworkConnectorContext();
NetworkConnector.ActivityListener oncePerSecondStatistics = new NetworkConnector.ActivityListener() {
long previousTime;
@Override
public void onActivity(IoStream targetEcuSocket) {
long now = System.currentTimeMillis();
if (now - previousTime < Timeouts.SECOND) {
// only update status once per second
return;
}
previousTime = now;
broadcastStatus.post(() -> broadcastStatus.setText(targetEcuSocket.getBytesIn() + "/" + targetEcuSocket.getBytesOut()));
}
};
NetworkConnector.NetworkConnectorResult result = new NetworkConnector().start(NetworkConnector.Implementation.Android,
readPersistedAuthToken(), context, new NetworkConnector.ReconnectListener() {
@Override
public void onReconnect() {
}
}, linkManager, oncePerSecondStatistics);
mResultView.post(() -> visibleLogAppend(new Date() + " Broadcast: " + result + "\n"));
}
@Override
public void onConnectionFailed(String errorMessage) {
mResultView.post(() -> visibleLogAppend("Connection failed " + errorMessage + " \n"));
}
});
Snackbar mySnackbar = Snackbar.make(view, "Broadcasting with " + readPersistedAuthToken(), BaseTransientBottomBar.LENGTH_LONG);
mySnackbar.show();
}
}
private void connectDashboard() {
AndroidSerial serial = AndroidSerial.getAndroidSerial(this, mStatusView, usbManager);
if (serial == null) {
// error already reported to mStatusView
return;
}
try {
String signature = BinaryProtocol.getSignature(serial);
visibleLogAppend("Connected to " + signature);
ErrorInfoCommand.send(serial);
String configError = ErrorInfoCommand.getResponse(serial.getDataBuffer());
if (configError != null)
visibleLogAppend("[CRITICAL] " + configError);
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
protected void onNewIntent(Intent intent) {
}
}

View File

@ -1,110 +0,0 @@
package com.rusefi.app.serial;
import android.annotation.SuppressLint;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbManager;
import android.widget.TextView;
import com.hoho.android.usbserial.driver.CdcAcmSerialDriver;
import com.hoho.android.usbserial.driver.ProbeTable;
import com.hoho.android.usbserial.driver.UsbSerialDriver;
import com.hoho.android.usbserial.driver.UsbSerialPort;
import com.hoho.android.usbserial.driver.UsbSerialProber;
import com.opensr5.io.DataListener;
import com.rusefi.app.PermissionGrantedAction;
import com.rusefi.app.rusEFI;
import com.rusefi.binaryprotocol.IncomingDataBuffer;
import com.rusefi.dfu.DfuLogic;
import com.rusefi.io.ByteReader;
import com.rusefi.io.serial.AbstractIoStream;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.Date;
import java.util.List;
public class AndroidSerial extends AbstractIoStream {
private static final int ST_CDC = 0x5740;
private final IncomingDataBuffer dataBuffer;
private UsbSerialPort usbSerialPort;
public static List<UsbSerialDriver> findUsbSerial(UsbManager usbManager) {
ProbeTable customTable = UsbSerialProber.getDefaultProbeTable();
customTable.addProduct(DfuLogic.ST_VENDOR, ST_CDC, CdcAcmSerialDriver.class);
UsbSerialProber prober = new UsbSerialProber(customTable);
return prober.findAllDrivers(usbManager);
}
public AndroidSerial(UsbSerialPort usbSerialPort) {
this.usbSerialPort = usbSerialPort;
dataBuffer = createDataBuffer("");
}
private static UsbSerialDriver getSerialDriver(rusEFI rusEFI, TextView mStatusView, UsbManager usbManager, PermissionGrantedAction action) {
List<UsbSerialDriver> availableDrivers = findUsbSerial(usbManager);
if (availableDrivers.isEmpty()) {
mStatusView.setText("Serial not found");
rusEFI.visibleLogAppend("No serial devices " + new Date() + "\n");
return null;
}
mStatusView.setText("rusEFI: " + availableDrivers.size() + " device(s)");
UsbSerialDriver driver = availableDrivers.get(0);
UsbDevice usbDevice = driver.getDevice();
if (!usbManager.hasPermission(usbDevice)) {
mStatusView.setText("Need permission");
rusEFI.requestUsbPermission(usbDevice, action);
return null;
}
return driver;
}
@SuppressLint("SetTextI18n")
@Nullable
public static AndroidSerial getAndroidSerial(rusEFI rusEFI, TextView mStatusView, UsbManager usbManager) {
// todo: should support separate actions not default to dashboard!
UsbSerialDriver driver = getSerialDriver(rusEFI, mStatusView, usbManager, PermissionGrantedAction.DASHBOARD);
if (driver == null) {
// error already reported to UI or permission request was fired
return null;
}
UsbDeviceConnection connection = usbManager.openDevice(driver.getDevice());
if (connection == null) {
// add UsbManager.requestPermission(driver.getDevice(), ..) handling here
mStatusView.setText("Unable to open serial");
return null;
}
UsbSerialPort port = driver.getPorts().get(0); // Most devices have just one port (port 0)
try {
port.open(connection);
port.setParameters(115200, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE);
} catch (IOException e) {
mStatusView.append("Error opening " + e);
return null;
}
return new AndroidSerial(port);
}
@Override
public IncomingDataBuffer getDataBuffer() {
return dataBuffer;
}
@Override
public void setInputListener(DataListener listener) {
ByteReader reader = buffer -> usbSerialPort.read(buffer, 5000);
ByteReader.runReaderLoop("", listener, reader, this);
}
@Override
public void write(byte[] bytes) throws IOException {
usbSerialPort.write(bytes, 1000);
}
}

View File

@ -1,20 +0,0 @@
package com.rusefi.app.util;
import android.app.Activity;
import android.os.Build;
import android.view.Window;
import android.view.WindowManager;
public class AndroidUtil {
private AndroidUtil() {
}
public static void turnScreenOn(Activity rusEFI) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
rusEFI.setTurnScreenOn(true);
} else {
Window window = rusEFI.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
}
}
}

View File

@ -1,100 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/myCoordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/text_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:textAppearanceMedium" />
<Button
android:id="@+id/buttonDfu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="sendMessage"
android:text="DFU" />
<EditText
android:id="@+id/authToken"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="text"
android:text="Auth Token" />
<TextView
android:id="@+id/authStatus1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Please paste your auth token" />
<TextView
android:id="@+id/authStatus2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView" />
<Button
android:id="@+id/buttonSound"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="sendMessage"
android:text="Sound" />
<Button
android:id="@+id/buttonConnect"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onConnectButton"
android:text="Connect" />
<Button
android:id="@+id/localBroadcast"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onLocalBroadcast"
android:text="local" />
<Button
android:id="@+id/buttonBroadcast"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="sendMessage"
android:text="Broadcast" />
<TextView
android:id="@+id/broadcastStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hello rusEFI" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text_result"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</ScrollView>
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View File

@ -1,8 +0,0 @@
<!--
https://stackoverflow.com/questions/47090526/caused-by-java-lang-unsupportedoperationexception-failed-to-resolve-attribute/47090603
https://stackoverflow.com/questions/27780713/do-i-need-to-use-a-theme-appcompat-theme-or-descendant-for-v21-styles-too
-->
<resources>
<style name="AppTheme" parent="AppBaseTheme">
</style>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">rusEFI</string>
</resources>

View File

@ -1,4 +0,0 @@
<resources>
<style name="AppBaseTheme" parent="Theme.AppCompat"></style>
<style name="AppTheme" parent="AppBaseTheme"></style>
</resources>

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 0x0403 FTDI -->
<usb-device vendor-id="1027" product-id="24577" /> <!-- 0x6001: FT232R -->
<usb-device vendor-id="1027" product-id="24592" /> <!-- 0x6010: FT2232H -->
<usb-device vendor-id="1027" product-id="24593" /> <!-- 0x6011: FT4232H -->
<usb-device vendor-id="1027" product-id="24596" /> <!-- 0x6014: FT232H -->
<usb-device vendor-id="1027" product-id="24597" /> <!-- 0x6015: FT231X -->
<!-- 0x10C4 / 0xEAxx: Silabs CP210x -->
<usb-device vendor-id="4292" product-id="60000" /> <!-- 0xea60: CP2102 -->
<usb-device vendor-id="4292" product-id="60016" /> <!-- 0xea70: CP2105 -->
<usb-device vendor-id="4292" product-id="60017" /> <!-- 0xea71: CP2108 -->
<usb-device vendor-id="4292" product-id="60032" /> <!-- 0xea80: CP2110 -->
<!-- 0x067B / 0x2303: Prolific PL2303 -->
<usb-device vendor-id="1659" product-id="8963" />
<!-- 0x1a86 / 0x7523: Qinheng CH340 -->
<usb-device vendor-id="6790" product-id="29987" />
<!-- 0x0483 / 0x5740: ST CDC -->
<usb-device vendor-id="1155" product-id="22336" />
</resources>

View File

@ -1,36 +0,0 @@
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
}
}
apply from: 'dependencies.gradle'
apply from: '../java_tools/dependencies.gradle'
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
plugins.withType(JavaPlugin) {
dependencies {
implementation global_libs.annotations
testImplementation global_libs.junit
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// gradlew allDeps
subprojects {
task allDeps(type: DependencyReportTask) {}
}

Binary file not shown.

View File

@ -1,4 +0,0 @@
ext {
libs = [
]
}

View File

@ -1,5 +0,0 @@
# android toolset is not ready for configuration cache :(
# org.gradle.unsafe.configuration-cache=true
android.useAndroidX=true
android.enableJetifier=true

Binary file not shown.

View File

@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

183
android/gradlew vendored
View File

@ -1,183 +0,0 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# 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
#
# https://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.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

100
android/gradlew.bat vendored
View File

@ -1,100 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -1,15 +0,0 @@
# Implementation Details
USB serial
https://github.com/mik3y/usb-serial-for-android
DFU implementation
https://github.com/rusefi/dfu_java
Error reporting uses
https://github.com/ACRA/acra
Hex reader based on
https://github.com/encedo/hex2dfu

View File

@ -1,17 +0,0 @@
include ':app'
include ':core_io'
project(':core_io').projectDir = new File('../java_console/shared_io')
include ':core_ui'
project(':core_ui').projectDir = new File('../java_console/core_ui')
include ':shared_ui'
project(':shared_ui').projectDir = new File('../java_console/shared_ui')
include ':ecu_io'
project(':ecu_io').projectDir = new File('../java_console/io')
include ':logging'
project(':logging').projectDir = new File('../java_console/logging')
include ':logging-api'
project(':logging-api').projectDir = new File('../java_console/logging-api')
include ':inifile'
project(':inifile').projectDir = new File('../java_console/inifile')
include ':models'
project(':models').projectDir = new File('../java_console/models')

View File

@ -3,7 +3,6 @@ plugins {
id 'java-test-fixtures'
}
apply from: '../../android/dependencies.gradle'
apply from: '../../java_tools/dependencies.gradle'
configurations {

View File

@ -2,8 +2,6 @@ plugins {
id 'java'
}
apply from: '../../android/dependencies.gradle'
// TODO: rename folder to core_io
// this CORE module cannot depend on model/ini!

View File

@ -4,8 +4,6 @@ plugins {
defaultTasks 'jar'
apply from: '../../android/dependencies.gradle'
jar {
destinationDirectory = file( '$rootDir/../..' )
manifest {

View File

@ -2,7 +2,7 @@ Here we have some tiny dev utilities - average rusEFI user would not need to use
```
cd android
cd java_tools
./gradlew :config_definition:shadowJar
```