From 93b778b9456165f2814920dc2114c6127fbe957d Mon Sep 17 00:00:00 2001 From: yunhanw Date: Tue, 18 Oct 2022 11:44:47 -0700 Subject: [PATCH] add android dummy stub for java matter controller application --- examples/build_overrides/build.gni | 1 + examples/java-matter-controller/BUILD.gn | 8 +-- .../java/src/com/matter/controller/Main.java | 7 ++ .../java-matter-controller/stub_src/BUILD.gn | 45 ++++++++++++ .../android/annotations/Nullable.java | 48 +++++++++++++ .../android/bluetooth/BluetoothGatt.java | 67 ++++++++++++++++++ .../bluetooth/BluetoothGattCallback.java | 68 +++++++++++++++++++ .../BluetoothGattCharacteristic.java | 60 ++++++++++++++++ .../bluetooth/BluetoothGattDescriptor.java | 60 ++++++++++++++++ .../bluetooth/BluetoothGattService.java | 51 ++++++++++++++ .../android/bluetooth/BluetoothProfile.java | 41 +++++++++++ .../stub_src/android/os/Build.java | 44 ++++++++++++ .../stub_src/android/os/Parcel.java | 65 ++++++++++++++++++ .../stub_src/android/os/Parcelable.java | 32 +++++++++ .../stub_src/android/util/Log.java | 48 +++++++++++++ src/controller/java/BUILD.gn | 31 ++++++--- src/platform/logging/BUILD.gn | 4 +- 17 files changed, 662 insertions(+), 18 deletions(-) create mode 100644 examples/java-matter-controller/stub_src/BUILD.gn create mode 100644 examples/java-matter-controller/stub_src/android/annotations/Nullable.java create mode 100644 examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGatt.java create mode 100644 examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattCallback.java create mode 100644 examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattCharacteristic.java create mode 100644 examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattDescriptor.java create mode 100644 examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattService.java create mode 100644 examples/java-matter-controller/stub_src/android/bluetooth/BluetoothProfile.java create mode 100644 examples/java-matter-controller/stub_src/android/os/Build.java create mode 100644 examples/java-matter-controller/stub_src/android/os/Parcel.java create mode 100644 examples/java-matter-controller/stub_src/android/os/Parcelable.java create mode 100644 examples/java-matter-controller/stub_src/android/util/Log.java diff --git a/examples/build_overrides/build.gni b/examples/build_overrides/build.gni index 323b150ed3399a..2d4c9ebbd14760 100644 --- a/examples/build_overrides/build.gni +++ b/examples/build_overrides/build.gni @@ -15,4 +15,5 @@ declare_args() { # Root directory for build files. build_root = "//third_party/connectedhomeip/build" + build_java_matter_controller = true } diff --git a/examples/java-matter-controller/BUILD.gn b/examples/java-matter-controller/BUILD.gn index a82349286cc7e4..7f3bf4abd814ce 100644 --- a/examples/java-matter-controller/BUILD.gn +++ b/examples/java-matter-controller/BUILD.gn @@ -21,12 +21,10 @@ import("${chip_root}/build/chip/tools.gni") android_binary("java-matter-controller") { output_name = "java-matter-controller" - deps = [ - ":android", + "${chip_root}/examples/java-matter-controller/stub_src", "${chip_root}/src/controller/java", "${chip_root}/src/setup_payload/java", - "${chip_root}/third_party/android_deps:annotation", ] sources = [ "java/src/com/matter/controller/Main.java" ] @@ -34,10 +32,6 @@ android_binary("java-matter-controller") { javac_flags = [ "-Xlint:deprecation" ] } -java_prebuilt("android") { - jar_path = "${android_sdk_root}/platforms/android-21/android.jar" -} - group("default") { deps = [ ":java-matter-controller" ] } diff --git a/examples/java-matter-controller/java/src/com/matter/controller/Main.java b/examples/java-matter-controller/java/src/com/matter/controller/Main.java index 6c2d18189f62d6..0f6820ef937344 100644 --- a/examples/java-matter-controller/java/src/com/matter/controller/Main.java +++ b/examples/java-matter-controller/java/src/com/matter/controller/Main.java @@ -16,9 +16,16 @@ * */ package com.matter.controller; +import chip.devicecontroller.ChipDeviceController; +import chip.devicecontroller.ControllerParams; +import chip.devicecontroller.GetConnectedDeviceCallbackJni.GetConnectedDeviceCallback; public class Main { public static void main(String[] args) { + ChipDeviceController controller = new ChipDeviceController(null); + String address = "127.0.0.1"; + controller.pairDeviceWithAddress(1, address, 5540, 3840, 20202021, null); + System.out.println("Hello Matter Controller!"); for (String s : args) { diff --git a/examples/java-matter-controller/stub_src/BUILD.gn b/examples/java-matter-controller/stub_src/BUILD.gn new file mode 100644 index 00000000000000..a45c3cfdae140a --- /dev/null +++ b/examples/java-matter-controller/stub_src/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright (c) 2020-2021 Project CHIP 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 +# +# 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. + +import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") +import("${build_root}/config/android_abi.gni") +import("${chip_root}/build/chip/java/rules.gni") + +android_library("stub_src") { + output_name = "Android.jar" + + sources = [ + "android/annotations/Nullable.java", + "android/bluetooth/BluetoothGatt.java", + "android/bluetooth/BluetoothGattCallback.java", + "android/bluetooth/BluetoothGattCharacteristic.java", + "android/bluetooth/BluetoothGattDescriptor.java", + "android/bluetooth/BluetoothGattService.java", + "android/bluetooth/BluetoothProfile.java", + "android/os/Build.java", + "android/os/Parcelable.java", + "android/os/Parcel.java", + "android/util/Log.java", + ] + deps = [ + ":json", + ] + + javac_flags = [ "-Xlint:deprecation" ] +} + +java_prebuilt("json") { + jar_path = "json-20220924.jar" +} diff --git a/examples/java-matter-controller/stub_src/android/annotations/Nullable.java b/examples/java-matter-controller/stub_src/android/annotations/Nullable.java new file mode 100644 index 00000000000000..de0801c88bd4a4 --- /dev/null +++ b/examples/java-matter-controller/stub_src/android/annotations/Nullable.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php + * + * 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. + */ + + //Modified from AOSP + +package androidx.annotation; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +/** + * Denotes that a parameter, field or method return value can be null. + * Note: this is the default assumption for most Java APIs and the + * default assumption made by most static code checking tools, so usually you + * don't need to use this annotation; its primary use is to override a default + * wider annotation like {@link NonNullByDefault}. + *

+ * When decorating a method call parameter, this denotes the parameter can + * legitimately be null and the method will gracefully deal with it. Typically + * used on optional parameters. + *

+ * When decorating a method, this denotes the method might legitimately return + * null. + *

+ * This is a marker annotation and it has no specific attributes. + */ +@Documented +@Retention(RetentionPolicy.SOURCE) +@Target({METHOD, PARAMETER, LOCAL_VARIABLE, FIELD}) +public @interface Nullable { +} diff --git a/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGatt.java b/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGatt.java new file mode 100644 index 00000000000000..9c90ced8745cc2 --- /dev/null +++ b/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGatt.java @@ -0,0 +1,67 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2015-2017 Nest Labs, Inc. + * All rights reserved. + * + * 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. + */ + +/** + * BluetoothGatt.java + * Stub file to allow compiling standalone, without Android SDK. + * + */ + +package android.bluetooth; + +import java.util.List; +import java.util.UUID; + + +// Stub class to allow standalone compilation without Android +public final class BluetoothGatt +{ + + public static final int GATT_SUCCESS = 0; + + public void close() + { + } + + public BluetoothGattService getService(UUID uuid) + { + return null; + } + + public List getServices() + { + return null; + } + + public boolean setCharacteristicNotification(BluetoothGattCharacteristic characteristic, + boolean enable) + { + return false; + } + + public boolean writeCharacteristic(BluetoothGattCharacteristic characteristic) + { + return false; + } + + public boolean writeDescriptor(BluetoothGattDescriptor descriptor) + { + return false; + } +} diff --git a/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattCallback.java b/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattCallback.java new file mode 100644 index 00000000000000..115761e8f8b8a9 --- /dev/null +++ b/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattCallback.java @@ -0,0 +1,68 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2015-2017 Nest Labs, Inc. + * All rights reserved. + * + * 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. + */ + +/** + * BluetoothGattCallback.java + * Stub file to allow compiling standalone, without Android SDK. + * + */ + +package android.bluetooth; + + +// Stub class to allow standalone compilation without Android +public abstract class BluetoothGattCallback +{ + public void onCharacteristicChanged(BluetoothGatt gatt, + BluetoothGattCharacteristic characteristic) + { + } + + public void onCharacteristicRead(BluetoothGatt gatt, + BluetoothGattCharacteristic characteristic, + int status) + { + } + + public void onCharacteristicWrite(BluetoothGatt gatt, + BluetoothGattCharacteristic characteristic, + int status) + { + } + + public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) + { + } + + public void onDescriptorRead(BluetoothGatt gatt, + BluetoothGattDescriptor descriptor, + int status) + { + } + + public void onDescriptorWrite(BluetoothGatt gatt, + BluetoothGattDescriptor descriptor, + int status) + { + } + + public void onServicesDiscovered(BluetoothGatt gatt, int status) + { + } +} diff --git a/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattCharacteristic.java b/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattCharacteristic.java new file mode 100644 index 00000000000000..bcaeec91861e08 --- /dev/null +++ b/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattCharacteristic.java @@ -0,0 +1,60 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2015-2017 Nest Labs, Inc. + * All rights reserved. + * + * 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. + */ + +/** + * BluetoothGattCharacteristic.java + * Stub file to allow compiling standalone, without Android SDK. + * + */ + +package android.bluetooth; + +import java.util.UUID; + + +// Stub class to allow standalone compilation without Android +public class BluetoothGattCharacteristic +{ + protected UUID mUuid; + + public BluetoothGattDescriptor getDescriptor(UUID uuid) + { + return null; + } + + public BluetoothGattService getService() + { + return null; + } + + public UUID getUuid() + { + return mUuid; + } + + public byte[] getValue() + { + return null; + } + + public boolean setValue(byte[] value) + { + return false; + } +} diff --git a/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattDescriptor.java b/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattDescriptor.java new file mode 100644 index 00000000000000..3a793a901dcc2b --- /dev/null +++ b/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattDescriptor.java @@ -0,0 +1,60 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2015-2017 Nest Labs, Inc. + * All rights reserved. + * + * 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. + */ + +/** + * BluetoothGattDescriptor.java + * Stub file to allow compiling standalone, without Android SDK. + * + */ + +package android.bluetooth; + +import java.util.UUID; + + +// Stub class to allow standalone compilation without Android +public class BluetoothGattDescriptor +{ + public static final byte[] ENABLE_NOTIFICATION_VALUE = {0x01, 0x00}; + + public static final byte[] ENABLE_INDICATION_VALUE = {0x02, 0x00}; + + public static final byte[] DISABLE_NOTIFICATION_VALUE = {0x00, 0x00}; + + protected UUID mUuid; + + public BluetoothGattCharacteristic getCharacteristic() { + return null; + } + + public UUID getUuid() + { + return mUuid; + } + + public byte[] getValue() + { + return null; + } + + public boolean setValue(byte[] value) + { + return true; + } +} diff --git a/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattService.java b/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattService.java new file mode 100644 index 00000000000000..1f238744354ee8 --- /dev/null +++ b/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothGattService.java @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2015-2017 Nest Labs, Inc. + * All rights reserved. + * + * 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. + */ + +/** + * BluetoothGattService.java + * Stub file to allow compiling standalone, without Android SDK. + * + */ + +package android.bluetooth; + +import java.util.UUID; +import java.util.List; + + +// Stub class to allow standalone compilation without Android +public class BluetoothGattService +{ + protected UUID mUuid; + + public BluetoothGattCharacteristic getCharacteristic(UUID uuid) + { + return null; + } + + public List getCharacteristics() + { + return null; + } + + public UUID getUuid() + { + return mUuid; + } +} diff --git a/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothProfile.java b/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothProfile.java new file mode 100644 index 00000000000000..17120988e8ca80 --- /dev/null +++ b/examples/java-matter-controller/stub_src/android/bluetooth/BluetoothProfile.java @@ -0,0 +1,41 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2015-2017 Nest Labs, Inc. + * All rights reserved. + * + * 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. + */ + +/** + * BluetoothProfile.java + * Stub file to allow compiling standalone, without Android SDK. + * + */ + +package android.bluetooth; + +// Stub class to allow standalone compilation without Android +public final class BluetoothProfile +{ + + /** The profile is in disconnected state */ + public static final int STATE_DISCONNECTED = 0; + /** The profile is in connecting state */ + public static final int STATE_CONNECTING = 1; + /** The profile is in connected state */ + public static final int STATE_CONNECTED = 2; + /** The profile is in disconnecting state */ + public static final int STATE_DISCONNECTING = 3; + +} diff --git a/examples/java-matter-controller/stub_src/android/os/Build.java b/examples/java-matter-controller/stub_src/android/os/Build.java new file mode 100644 index 00000000000000..8d0c60dfab8d09 --- /dev/null +++ b/examples/java-matter-controller/stub_src/android/os/Build.java @@ -0,0 +1,44 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2015-2017 Nest Labs, Inc. + * All rights reserved. + * + * 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. + */ + +/** + * Build.java + * Stub file to allow compiling standalone, without Android SDK. + * + */ + +package android.os; + +public final class Build +{ + public static class VERSION + { + public static final int SDK_INT = 0; + } + + public static class VERSION_CODES + { + public static final int JELLY_BEAN_MR2 = 18; + } + + public static final String MANUFACTURER = "Unknown"; + + public static final String MODEL = "Unknown"; + +} diff --git a/examples/java-matter-controller/stub_src/android/os/Parcel.java b/examples/java-matter-controller/stub_src/android/os/Parcel.java new file mode 100644 index 00000000000000..858ab0d809f956 --- /dev/null +++ b/examples/java-matter-controller/stub_src/android/os/Parcel.java @@ -0,0 +1,65 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * 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. + */ + + /** + * BluetoothGatt.java + * Stub file to allow compiling standalone, without Android SDK. + * + */ +package android.os; +import androidx.annotation.Nullable; +import android.os.Parcelable; + +public final class Parcel +{ + private static final String TAG = "Parcel"; + + @Nullable + public final T readParcelable(@Nullable ClassLoader loader) { + return null; + } + + public final void writeParcelable(@Nullable Parcelable p, int parcelableFlags) { + return; + } + + @Nullable + public final String readString() { + return null; + } + + public final void writeString(@Nullable String val) { + return; + } + + public final int readInt() { + return 0; + } + + public final void writeInt(int val) { + return; + } + + public final void readByteArray(byte[] val) { + return; + } + + public final void writeByteArray(byte[] b) { + return; + } +} diff --git a/examples/java-matter-controller/stub_src/android/os/Parcelable.java b/examples/java-matter-controller/stub_src/android/os/Parcelable.java new file mode 100644 index 00000000000000..bdaa3c4e1a974d --- /dev/null +++ b/examples/java-matter-controller/stub_src/android/os/Parcelable.java @@ -0,0 +1,32 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * 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. + */ + + /** + * BluetoothGatt.java + * Stub file to allow compiling standalone, without Android SDK. + * + */ + +package android.os; + +public interface Parcelable { + public interface Creator { + public T createFromParcel(Parcel source); + public T[] newArray(int size); + } +} diff --git a/examples/java-matter-controller/stub_src/android/util/Log.java b/examples/java-matter-controller/stub_src/android/util/Log.java new file mode 100644 index 00000000000000..29e59fb2937109 --- /dev/null +++ b/examples/java-matter-controller/stub_src/android/util/Log.java @@ -0,0 +1,48 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * Copyright (c) 2015-2017 Nest Labs, Inc. + * All rights reserved. + * + * 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. + */ + +/** + * Log.java + * Stub file to allow compiling standalone, without Android SDK. + * + */ + +package android.util; + +public final class Log +{ + public static int d(String tag, String message) + { + return 0; + } + + public static int e(String tag, String msg) + { + return 0; + } + + public static int e(String tag, String msg, Throwable tr) { + return 0; + } + + public static int w(String tag, String message) + { + return 0; + } +} diff --git a/src/controller/java/BUILD.gn b/src/controller/java/BUILD.gn index 61244807707b8b..e1313c22c9d5e2 100644 --- a/src/controller/java/BUILD.gn +++ b/src/controller/java/BUILD.gn @@ -62,19 +62,17 @@ shared_library("jni") { output_dir = "${root_out_dir}/lib/jni/${android_abi}" ldflags = [ "-Wl,--gc-sections" ] + + data_deps = [ + "${chip_root}/build/chip/java:shared_cpplib", + ] } android_library("java") { output_name = "CHIPController.jar" - deps = [ - ":android", - "${chip_root}/third_party/android_deps:annotation", - ] - data_deps = [ ":jni", - "${chip_root}/build/chip/java:shared_cpplib", ] sources = [ @@ -122,12 +120,29 @@ android_library("java") { "zap-generated/chip/devicecontroller/ClusterWriteMapping.java", ] + if (build_java_matter_controller) { + deps = [ + "${chip_root}/examples/java-matter-controller/stub_src", + ] + } + else + { + deps = [ + ":android", + "${chip_root}/third_party/android_deps:annotation", + ] + } + javac_flags = [ "-Xlint:deprecation" ] # TODO: add classpath support (we likely need to add something like # ..../platforms/android-21/android.jar to access BLE items) } -java_prebuilt("android") { - jar_path = "${android_sdk_root}/platforms/android-21/android.jar" +if (!build_java_matter_controller) +{ + java_prebuilt("android") { + jar_path = "${android_sdk_root}/platforms/android-21/android.jar" + } + } diff --git a/src/platform/logging/BUILD.gn b/src/platform/logging/BUILD.gn index 038f9421d819b2..de0b07c9623a26 100644 --- a/src/platform/logging/BUILD.gn +++ b/src/platform/logging/BUILD.gn @@ -12,7 +12,7 @@ source_set("headers") { if (current_os == "android") { static_library("android") { - sources = [ "impl/android/Logging.cpp" ] + sources = [ "impl/stdio/Logging.cpp" ] deps = [ ":headers", "${chip_root}/src/lib/core:chip_config_header", @@ -20,8 +20,6 @@ if (current_os == "android") { "${chip_root}/src/lib/support:logging_constants", "${chip_root}/src/platform:platform_buildconfig", ] - - libs = [ "log" ] } }