ipc/android: Initial port of parts to Kotlin.

This commit is contained in:
Ryan Pavlik 2020-11-13 13:20:06 -06:00 committed by Lubosz Sarnecki
parent b2f751ae99
commit fa840e1cd8
2 changed files with 15 additions and 16 deletions
src/xrt/ipc/android
build.gradle
src/main/java/org/freedesktop/monado/ipc

View file

@ -1,7 +1,10 @@
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
apply plugin: 'com.android.library'
plugins {
id 'com.android.library'
id 'kotlin-android'
}
android {
compileSdkVersion project.sharedTargetSdk
@ -41,4 +44,6 @@ android {
dependencies {
implementation project(':src:xrt:auxiliary:android')
implementation "androidx.annotation:annotation:$androidxAnnotationVersion"
implementation "androidx.core:core-ktx:$androidxCoreVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
}

View file

@ -6,27 +6,21 @@
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
* @ingroup ipc_android
*/
package org.freedesktop.monado.ipc
package org.freedesktop.monado.ipc;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import androidx.annotation.Nullable;
import android.app.Service
import android.content.Intent
import android.os.IBinder
/**
* Minimal implementation of a Service.
* <p>
*
* This is needed so that the APK can expose the binder service implemented in MonadoImpl.
*/
public class MonadoService extends Service {
class MonadoService : Service() {
val monado: MonadoImpl = MonadoImpl()
@Nullable
@Override
public IBinder onBind(Intent intent) {
return new MonadoImpl();
override fun onBind(intent: Intent): IBinder? {
return monado;
}
}