[Thread] add ot-daemon to com.android.tethering

ot-daemon is a dependency of the new Thread feature. This commit
add the ot-daemon binary and init rc file to the Tethering module.
Note that the ot-daemon service is default disabled and versioned
init rc file is used to ensure that this service won't be started
before Android U.

This is expected to increase the size of "com.android.tethering.capex"
by around 400 KB.

Manual verification:
1. on Android T (33) CF device, the ot-daemon service is not started
   after device boots; It reports service not found error when trying
   to start the ot-daemon service with adb shell command "start
   ot-daemon"
2. on Android U (34) CF device, the ot-daemon service is not started
   after device boots; It can be started with shell comamnd "start
   ot-daemon" but then failed because of missing sepolicy rules as
   expected

Test: see above manual verification note
Bug: 296211911
Change-Id: I222e2bbcc2ad0be2beec9f5f3406e7144d314370
This commit is contained in:
Kangping Dong
2023-08-28 21:54:35 +08:00
parent a337d95cc4
commit f2060610c0
3 changed files with 58 additions and 1 deletions

View File

@@ -96,6 +96,7 @@ apex {
},
binaries: [
"clatd",
"ot-daemon",
],
canned_fs_config: "canned_fs_config",
bpfs: [
@@ -111,7 +112,10 @@ apex {
apps: [
"ServiceConnectivityResources",
],
prebuilts: ["current_sdkinfo"],
prebuilts: [
"ot-daemon.init.34rc",
"current_sdkinfo",
],
manifest: "manifest.json",
key: "com.android.tethering.key",
// Indicates that pre-installed version of this apex can be compressed.

29
thread/apex/Android.bp Normal file
View File

@@ -0,0 +1,29 @@
//
// Copyright (C) 2023 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 {
default_applicable_licenses: ["Android-Apache-2.0"],
}
// Versioned ot-daemon init file which will be processed by the system on 34+ devices.
// See https://android.googlesource.com/platform/system/core/+/HEAD/init/README.md#versioned-rc-files-within-apexs
// for details of versioned rc files.
prebuilt_etc {
name: "ot-daemon.init.34rc",
src: "ot-daemon.34rc",
filename: "init.34rc",
installable: false,
}

View File

@@ -0,0 +1,24 @@
# Copyright (C) 2023 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.
service ot-daemon /apex/com.android.tethering/bin/ot-daemon -I thread-wpan --auto-attach=0 threadnetwork_hal://binder?none
interface aidl ot_daemon
disabled
oneshot
updatable
class main
user thread_network
group thread_network inet system
seclabel u:r:ot_daemon:s0
override