Merge "[Thread] flagging Android Thread APIs" into main

This commit is contained in:
Kangping Dong
2023-10-24 14:26:06 +00:00
committed by Gerrit Code Review
5 changed files with 46 additions and 3 deletions

View File

@@ -417,12 +417,12 @@ package android.net.nsd {
package android.net.thread {
public class ThreadNetworkController {
@FlaggedApi("com.android.net.thread.flags.thread_enabled") public class ThreadNetworkController {
method public int getThreadVersion();
field public static final int THREAD_VERSION_1_3 = 4; // 0x4
}
public class ThreadNetworkManager {
@FlaggedApi("com.android.net.thread.flags.thread_enabled") public class ThreadNetworkManager {
method @NonNull public java.util.List<android.net.thread.ThreadNetworkController> getAllThreadNetworkControllers();
}

View File

@@ -0,0 +1,8 @@
package: "com.android.net.thread.flags"
flag {
name: "thread_enabled"
namespace: "thread_network"
description: "Controls whether the Android Thread feature is enabled"
bug: "301473012"
}

View File

@@ -18,6 +18,7 @@ package android.net.thread;
import static java.util.Objects.requireNonNull;
import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.SystemApi;
@@ -30,7 +31,8 @@ import java.lang.annotation.RetentionPolicy;
* Provides the primary API for controlling all aspects of a Thread network.
*
* @hide
*/
*/
@FlaggedApi(ThreadNetworkFlags.FLAG_THREAD_ENABLED)
@SystemApi
public class ThreadNetworkController {

View File

@@ -0,0 +1,31 @@
/*
* 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 android.net.thread;
/**
* Container for flag constants defined in the "thread_network" namespace.
*
* @hide
*/
// TODO: replace this class with auto-generated "com.android.net.thread.flags.Flags" once the
// flagging infra is fully supported for mainline modules.
public final class ThreadNetworkFlags {
/** @hide */
public static final String FLAG_THREAD_ENABLED = "com.android.net.thread.flags.thread_enabled";
private ThreadNetworkFlags() {}
}

View File

@@ -18,6 +18,7 @@ package android.net.thread;
import static java.util.Objects.requireNonNull;
import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.SystemService;
@@ -34,6 +35,7 @@ import java.util.List;
*
* @hide
*/
@FlaggedApi(ThreadNetworkFlags.FLAG_THREAD_ENABLED)
@SystemApi
@SystemService(ThreadNetworkManager.SERVICE_NAME)
public class ThreadNetworkManager {