Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Use "D-Bus over TCP/IP over Ethernet over BLE" for communicating with the watch #216

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 37 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
plugins {
id("com.android.application")
kotlin("android")
}

android {
compileSdk = 33
buildToolsVersion = "30.0.3"
compileSdk = 34

defaultConfig {
applicationId = "org.asteroidos.sync"
minSdk = 24
targetSdk = 33
targetSdk = 34
versionCode = 29
versionName = "0.29"
ndk.abiFilters.clear()
ndk.abiFilters.add("arm64-v8a")
ndk.abiFilters.add("armeabi-v7a")
ndk.abiFilters.add("x86")
ndk.abiFilters.add("x86_64")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, now these are re-added and cgi is deleted. That's a lot of back and forths to review. I realize the PR is marked as draft, it would be nice to clean up this backlog. I'll stop reviewing here until then ;)

externalNativeBuild {
cmake {
cppFlags += ""
}
}
}
buildTypes {
named("release") {
Expand All @@ -31,28 +41,42 @@ android {
srcDir("src/main/lib/material-intro-screen/material-intro-screen/src/main/res/")
srcDir("src/main/lib/powerampapi/poweramp_api_lib/res/")
}
jniLibs {
srcDir("/tmp/android-root/lib")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, this is supposed to be the outcome of the bash script now. Maybe it doesn't hurt to add a comment above to describe where this is coming from

}
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}

lint {
checkReleaseBuilds = true
disable += "MissingTranslation"
}
namespace = "org.asteroidos.sync"
externalNativeBuild {
cmake {
path = file("src/main/cpp/CMakeLists.txt")
version = "3.22.1"
}
}
}

repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven("https://maven.google.com")
maven("https://jitpack.io")
}

dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
implementation(kotlin("reflect"))
testImplementation("junit:junit:4.13.2")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.legacy:legacy-support-v4:1.0.0")
Expand All @@ -63,4 +87,13 @@ dependencies {
implementation("org.osmdroid:osmdroid-android:6.1.16")
implementation("no.nordicsemi.android.support.v18:scanner:1.6.0")
implementation("no.nordicsemi.android:ble:2.7.2")
implementation("com.google.guava:guava:33.1.0-android")
implementation("androidx.media3:media3-session:1.3.1")
implementation("androidx.media3:media3-common:1.3.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1-Beta")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-guava:1.8.1-Beta")
implementation("uk.uuid.slf4j:slf4j-android:2.0.7-0")
compileOnly("org.slf4j:slf4j-api:2.0.7")

api(fileTree("libs") { include("*.jar") })
}
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
android:configChanges="uiMode"/>

<service
android:name=".services.NLService"
android:name=".dbus.DBusNotificationListenerService"
android:label="@string/app_name"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"
android:exported="true">
Expand Down
112 changes: 112 additions & 0 deletions app/src/main/assets/icons.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#
# AsteroidOSSync
# Copyright (c) 2024 AsteroidOS
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

default=ios-mail

code.name.monkey.retromusic=ios-musical-notes
com.android.chrome=logo-chrome
com.android.dialer=ios-call
com.android.mms=ios-text
com.android.vending=md-appstore
com.chrome.beta=logo-chrome
com.chrome.dev=logo-chrome
com.devhd.feedly=logo-rss
com.dropbox.android=logo-dropbox
com.facebook.groups=logo-facebook
com.facebook.katana=logo-facebook
com.facebook.Mentions=logo-facebook
com.facebook.orca=ios-text
com.facebook.work=logo-facebook
com.google.android.apps.docs.editors.docs=ios-document
com.google.android.apps.giant=md-analytics
com.google.android.apps.maps=ios-map
com.google.android.apps.messaging=ios-text
com.google.android.apps.photos=ios-images
com.google.android.apps.plus=logo-googleplus
com.google.android.calendar=ios-calendar
com.google.android.contacts=ios-contacts
com.google.android.dialer=ios-call
com.google.android.gm=ios-mail
com.google.android.googlequicksearchbox=logo-google
com.google.android.music=ios-musical-notes
com.google.android.talk=ios-quote
com.google.android.videos=ios-film
com.google.android.youtube=logo-youtube
com.instagram.android=logo-instagram
com.instagram.boomerang=logo-instagram
com.instagram.layout=logo-instagram
com.jb.gosms=ios-text
com.joelapenna.foursquared=logo-foursquare
com.keylesspalace.tusky=md-mastodon
com.keylesspalace.tusky.test=md-mastodon
com.linkedin.android.jobs.jobseeker=logo-linkedin
com.linkedin.android.learning=logo-linkedin
com.linkedin.android=logo-linkedin
com.linkedin.android.salesnavigator=logo-linkedin
com.linkedin.Coworkers=logo-linkedin
com.linkedin.leap=logo-linkedin
com.linkedin.pulse=logo-linkedin
com.linkedin.recruiter=logo-linkedin
com.mattermost.rnbeta=logo-mattermost
com.mattermost.rn=logo-mattermost
com.maxfour.music=ios-musical-notes
com.microsoft.office.lync15=logo-skype
com.microsoft.xboxone.smartglass.beta=logo-xbox
com.microsoft.xboxone.smartglass=logo-xbox
com.noinnion.android.greader.reader=logo-rss
com.pinterest=logo-pinterest
com.playstation.mobilemessenger=logo-playstation
com.playstation.remoteplay=logo-playstation
com.playstation.video=logo-playstation
com.reddit.frontpage=logo-reddit
com.runtastic.android=ios-walk
com.runtastic.android.pro2=ios-walk
com.scee.psxandroid=logo-playstation
com.sec.android.app.music=ios-musical-notes
com.skype.android.access=logo-skype
com.skype.raider=logo-skype
com.snapchat.android=logo-snapchat
com.sonyericsson.conversations=ios-text
com.spotify.music=ios-musical-notes
com.tinder=md-flame
com.tumblr=logo-tumblr
com.twitter.android=logo-twitter
com.valvesoftware.android.steam.community=logo-steam
com.vimeo.android.videoapp=logo-vimeo
com.whatsapp=logo-whatsapp
com.yahoo.mobile.client.android.atom=logo-yahoo
com.yahoo.mobile.client.android.finance=logo-yahoo
com.yahoo.mobile.client.android.im=logo-yahoo
com.yahoo.mobile.client.android.mail=logo-yahoo
com.yahoo.mobile.client.android.search=logo-yahoo
com.yahoo.mobile.client.android.sportacular=logo-yahoo
com.yahoo.mobile.client.android.weather=logo-yahoo
de.number26.android=ios-card
flipboard.app=logo-rss
im.vector.app=ios-chatbubbles-outline
net.etuldan.sparss.floss=logo-rss
net.frju.flym=logo-rss
net.slideshare.mobile=logo-linkedin
org.buffer.android=logo-buffer
org.kde.kdeconnect_tp=md-phone-portrait
org.telegram.messenger=ios-paper-plane
org.thoughtcrime.securesms=logo-signal
org.thunderdog.challegram=ios-paper-plane
org.wordpress.android=logo-wordpress
tv.twitch.android.app=logo-twitch
ws.xsoh.etar=ios-calendar
54 changes: 54 additions & 0 deletions app/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html.
# For more examples on how to use CMake, see https://github.com/android/ndk-samples.

# Sets the minimum CMake version required for this project.
cmake_minimum_required(VERSION 3.22.1)

# Declares the project name. The project name can be accessed via ${ PROJECT_NAME},
# Since this is the top level CMakeLists.txt, the project name is also accessible
# with ${CMAKE_PROJECT_NAME} (both CMake variables are in-sync within the top level
# build script scope).
project("sync")

add_subdirectory(libslirp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's ship libslirp as a git submodule so we don't have to copy paste files across repositories and we benefit from libslirp's commit log etc...


find_program(BASH bash)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also use submodules to integrate this cgi. It would make it a lot easier to spot backdoors hidden in it while adding it :p

set(ENV{ANDROID_NDK_HOME} ${CMAKE_ANDROID_NDK})
set(ENV{ABI} ${CMAKE_ANDROID_ARCH_ABI})
execute_process(COMMAND ${BASH} ${CMAKE_CURRENT_SOURCE_DIR}/build_depends.sh)

link_directories(/tmp/android-root/lib/${CMAKE_ANDROID_ARCH_ABI})
include_directories(/tmp/android-root/include)

set(ENV{PKG_CONFIG_PATH} /tmp/android-root/lib/${CMAKE_ANDROID_ARCH_ABI}/pkgconfig)

# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
#
# In this top level CMakeLists.txt, ${CMAKE_PROJECT_NAME} is used to define
# the target library name; in the sub-module's CMakeLists.txt, ${PROJECT_NAME}
# is preferred for the same purpose.
#
# In order to load a library into your app from Java/Kotlin, you must call
# System.loadLibrary() and pass the name of the library defined here;
# for GameActivity/NativeActivity derived applications, the same library name must be
# used in the AndroidManifest.xml file.
add_library(${CMAKE_PROJECT_NAME} SHARED
# List C/C++ source files with relative paths to this CMakeLists.txt.
sync.cpp)

# Specifies libraries CMake should link to your target library. You
# can link libraries from various origins, such as libraries defined in this
# build script, prebuilt third-party libraries, or Android system libraries.
target_link_libraries(${CMAKE_PROJECT_NAME}
slirp
android
log)

target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE
-fvisibility=hidden)
Loading