Merge changes from topic "thread-make-pretty-enhance" into main

* changes:
  [Thread] format AIDL files
  [Thread] enhance make-pretty.sh
This commit is contained in:
Treehugger Robot 2024-08-12 08:22:10 +00:00 • committed by Gerrit Code Review
commit 34b57700cd
5 changed files with 50 additions and 20 deletions

View file

@ -16,11 +16,11 @@
package android.net.thread;
/**
* Mapping from a channel to its max power.
*
* {@hide}
*/
/**
* Mapping from a channel to its max power.
*
* {@hide}
*/
parcelable ChannelMaxPower {
int channel; // The Thread radio channel.
int maxPower; // The max power in the unit of 0.01dBm. Passing INT16_MAX(32767) will

View file

@ -23,6 +23,8 @@ import android.net.thread.PendingOperationalDataset;
* @hide
*/
oneway interface IOperationalDatasetCallback {
void onActiveOperationalDatasetChanged(in @nullable ActiveOperationalDataset activeOpDataset);
void onPendingOperationalDatasetChanged(in @nullable PendingOperationalDataset pendingOpDataset);
void onActiveOperationalDatasetChanged(
in @nullable ActiveOperationalDataset activeOpDataset);
void onPendingOperationalDatasetChanged(
in @nullable PendingOperationalDataset pendingOpDataset);
}

View file

@ -28,9 +28,9 @@ import android.net.thread.PendingOperationalDataset;
import android.net.thread.ThreadConfiguration;
/**
* Interface for communicating with ThreadNetworkControllerService.
* @hide
*/
* Interface for communicating with ThreadNetworkControllerService.
* @hide
*/
interface IThreadNetworkController {
void registerStateCallback(in IStateCallback callback);
void unregisterStateCallback(in IStateCallback callback);
@ -38,10 +38,12 @@ interface IThreadNetworkController {
void unregisterOperationalDatasetCallback(in IOperationalDatasetCallback callback);
void join(in ActiveOperationalDataset activeOpDataset, in IOperationReceiver receiver);
void scheduleMigration(in PendingOperationalDataset pendingOpDataset, in IOperationReceiver receiver);
void scheduleMigration(
in PendingOperationalDataset pendingOpDataset, in IOperationReceiver receiver);
void leave(in IOperationReceiver receiver);
void setTestNetworkAsUpstream(in String testNetworkInterfaceName, in IOperationReceiver receiver);
void setTestNetworkAsUpstream(
in String testNetworkInterfaceName, in IOperationReceiver receiver);
void setChannelMaxPowers(in ChannelMaxPower[] channelMaxPowers, in IOperationReceiver receiver);
int getThreadVersion();

View file

@ -19,9 +19,9 @@ package android.net.thread;
import android.net.thread.IThreadNetworkController;
/**
* Interface for communicating with ThreadNetworkService.
* @hide
*/
* Interface for communicating with ThreadNetworkService.
* @hide
*/
interface IThreadNetworkManager {
List<IThreadNetworkController> getAllThreadNetworkControllers();
}

View file

@ -1,9 +1,35 @@
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
ANDROID_ROOT_DIR=$(
while [ ! -d ".repo" ] && [ "$PWD" != "/" ]; do cd ..; done
pwd
)
GOOGLE_JAVA_FORMAT=$SCRIPT_DIR/../../../../../prebuilts/tools/common/google-java-format/google-java-format
ANDROID_BP_FORMAT=$SCRIPT_DIR/../../../../../prebuilts/build-tools/linux-x86/bin/bpfmt
if [ ! -d "$ANDROID_ROOT_DIR/.repo" ]; then
echo "Error: The script has to run in an Android repo checkout"
exit 1
fi
$GOOGLE_JAVA_FORMAT --aosp -i $(find $SCRIPT_DIR/../ -name "*.java")
$ANDROID_BP_FORMAT -w $(find $SCRIPT_DIR/../ -name "*.bp")
GOOGLE_JAVA_FORMAT=$ANDROID_ROOT_DIR/prebuilts/tools/common/google-java-format/google-java-format
ANDROID_BP_FORMAT=$ANDROID_ROOT_DIR/prebuilts/build-tools/linux-x86/bin/bpfmt
AIDL_FORMAT=$ANDROID_ROOT_DIR/system/tools/aidl/aidl-format.sh
CONNECTIVITY_DIR=$ANDROID_ROOT_DIR/packages/modules/Connectivity
OPENTHREAD_DIR=$ANDROID_ROOT_DIR/external/openthread
OTBR_POSIX_DIR=$ANDROID_ROOT_DIR/external/ot-br-posix
ALLOWED_CODE_DIRS=($CONNECTIVITY_DIR $OPENTHREAD_DIR $OTBR_POSIX_DIR)
CODE_DIR=$(git rev-parse --show-toplevel)
if [[ ! " ${ALLOWED_CODE_DIRS[@]} " =~ " ${CODE_DIR} " ]]; then
echo "Error: The script has to run in the Git project Connectivity, openthread or ot-br-posix"
exit 1
fi
if [[ $CODE_DIR == $CONNECTIVITY_DIR ]]; then
CODE_DIR=$CODE_DIR"/thread"
fi
$GOOGLE_JAVA_FORMAT --aosp -i $(find $CODE_DIR -name "*.java")
$ANDROID_BP_FORMAT -w $(find $CODE_DIR -name "*.bp")
$AIDL_FORMAT -w $(find $CODE_DIR -name "*.aidl")