Merge "Fix array-related errorprone warnings"
diff --git a/Android.bp b/Android.bp
index f05e581..928386c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -72,7 +72,6 @@
":framework-keystore-sources",
":framework-identity-sources",
":framework-location-sources",
- ":framework-lowpan-sources",
":framework-mca-effect-sources",
":framework-mca-filterfw-sources",
":framework-mca-filterpacks-sources",
@@ -167,7 +166,6 @@
"identity/java",
"keystore/java",
"location/java",
- "lowpan/java",
"media/java",
"media/mca/effect/java",
"media/mca/filterfw/java",
diff --git a/apct-tests/perftests/OWNERS b/apct-tests/perftests/OWNERS
index 7e7feaf..4c57e64 100644
--- a/apct-tests/perftests/OWNERS
+++ b/apct-tests/perftests/OWNERS
@@ -4,6 +4,7 @@
dualli@google.com
edgararriaga@google.com
jpakaravoor@google.com
+jreck@google.com #{LAST_RESORT_SUGGESTION}
kevinjeon@google.com
philipcuadra@google.com
shombert@google.com
diff --git a/apct-tests/perftests/core/OWNERS b/apct-tests/perftests/core/OWNERS
index 2b3564e..8fb057d 100644
--- a/apct-tests/perftests/core/OWNERS
+++ b/apct-tests/perftests/core/OWNERS
@@ -1,3 +1,4 @@
+include /graphics/java/android/graphics/OWNERS
include /graphics/java/android/graphics/fonts/OWNERS
# Bug component: 568761
diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp
index 12083b6..28db61f 100644
--- a/cmds/app_process/app_main.cpp
+++ b/cmds/app_process/app_main.cpp
@@ -334,7 +334,7 @@
if (zygote) {
runtime.start("com.android.internal.os.ZygoteInit", args, zygote);
- } else if (className) {
+ } else if (!className.isEmpty()) {
runtime.start("com.android.internal.os.RuntimeInit", args, zygote);
} else {
fprintf(stderr, "Error: no class name or --zygote supplied.\n");
diff --git a/cmds/idmap2/include/idmap2/SysTrace.h b/cmds/idmap2/include/idmap2/SysTrace.h
index 19b4353..fcadf96 100644
--- a/cmds/idmap2/include/idmap2/SysTrace.h
+++ b/cmds/idmap2/include/idmap2/SysTrace.h
@@ -17,8 +17,6 @@
#ifndef IDMAP2_INCLUDE_IDMAP2_SYSTRACE_H_
#define IDMAP2_INCLUDE_IDMAP2_SYSTRACE_H_
-#define ATRACE_TAG ATRACE_TAG_RRO
-
#include <sstream>
#include <vector>
@@ -29,16 +27,12 @@
class ScopedTraceNoStart {
public:
- ~ScopedTraceNoStart() {
- ATRACE_END();
- }
+ ~ScopedTraceNoStart();
};
class ScopedTraceMessageHelper {
public:
- ~ScopedTraceMessageHelper() {
- ATRACE_BEGIN(buffer_.str().c_str());
- }
+ ~ScopedTraceMessageHelper();
std::ostream& stream() {
return buffer_;
@@ -48,9 +42,12 @@
std::ostringstream buffer_;
};
+bool atrace_enabled();
+
#define SYSTRACE \
android::idmap2::utils::ScopedTraceNoStart _trace##__LINE__; \
- (ATRACE_ENABLED()) && android::idmap2::utils::ScopedTraceMessageHelper().stream()
+ android::idmap2::utils::atrace_enabled() \
+ && android::idmap2::utils::ScopedTraceMessageHelper().stream()
#else
diff --git a/cmds/idmap2/libidmap2/SysTrace.cpp b/cmds/idmap2/libidmap2/SysTrace.cpp
new file mode 100644
index 0000000..55d45b7
--- /dev/null
+++ b/cmds/idmap2/libidmap2/SysTrace.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#define ATRACE_TAG ATRACE_TAG_RRO
+
+#include "idmap2/SysTrace.h"
+
+#ifdef __ANDROID__
+namespace android::idmap2::utils {
+
+ScopedTraceNoStart::~ScopedTraceNoStart() {
+ ATRACE_END();
+};
+
+ScopedTraceMessageHelper::~ScopedTraceMessageHelper() {
+ ATRACE_BEGIN(buffer_.str().c_str());
+}
+
+bool atrace_enabled() {
+ return ATRACE_ENABLED();
+}
+} // namespace android::idmap2::utils
+#endif
diff --git a/cmds/screencap/OWNERS b/cmds/screencap/OWNERS
new file mode 100644
index 0000000..89f1177
--- /dev/null
+++ b/cmds/screencap/OWNERS
@@ -0,0 +1,2 @@
+include /graphics/java/android/graphics/OWNERS
+include /services/core/java/com/android/server/wm/OWNERS
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index 4019283..bdecca3 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -147,8 +147,6 @@
import android.net.PacProxyManager;
import android.net.TetheringManager;
import android.net.VpnManager;
-import android.net.lowpan.ILowpanManager;
-import android.net.lowpan.LowpanManager;
import android.net.vcn.IVcnManagementService;
import android.net.vcn.VcnManager;
import android.net.wifi.WifiFrameworkInitializer;
@@ -768,15 +766,6 @@
ctx.mMainThread.getHandler());
}});
- registerService(Context.LOWPAN_SERVICE, LowpanManager.class,
- new CachedServiceFetcher<LowpanManager>() {
- @Override
- public LowpanManager createService(ContextImpl ctx) throws ServiceNotFoundException {
- IBinder b = ServiceManager.getServiceOrThrow(Context.LOWPAN_SERVICE);
- ILowpanManager service = ILowpanManager.Stub.asInterface(b);
- return new LowpanManager(ctx.getOuterContext(), service);
- }});
-
registerService(Context.WIFI_NL80211_SERVICE, WifiNl80211Manager.class,
new CachedServiceFetcher<WifiNl80211Manager>() {
@Override
diff --git a/core/java/android/app/TEST_MAPPING b/core/java/android/app/TEST_MAPPING
index 32207af..a2e4239 100644
--- a/core/java/android/app/TEST_MAPPING
+++ b/core/java/android/app/TEST_MAPPING
@@ -121,6 +121,9 @@
"include-annotation": "android.platform.test.annotations.Presubmit"
},
{
+ "exclude-annotation": "android.platform.test.annotations.LargeTest"
+ },
+ {
"exclude-annotation": "androidx.test.filters.FlakyTest"
},
{
diff --git a/core/java/android/content/TEST_MAPPING b/core/java/android/content/TEST_MAPPING
index 5bb845d..dac79e7 100644
--- a/core/java/android/content/TEST_MAPPING
+++ b/core/java/android/content/TEST_MAPPING
@@ -7,6 +7,9 @@
"include-annotation": "android.platform.test.annotations.Presubmit"
},
{
+ "exclude-annotation": "android.platform.test.annotations.LargeTest"
+ },
+ {
"exclude-annotation": "androidx.test.filters.FlakyTest"
},
{
diff --git a/core/java/android/credentials/OWNERS b/core/java/android/credentials/OWNERS
new file mode 100644
index 0000000..e8f393e
--- /dev/null
+++ b/core/java/android/credentials/OWNERS
@@ -0,0 +1,5 @@
+reemabajwa@google.com
+helenqin@google.com
+sgjerry@google.com
+leecam@google.com
+akaphle@google.com
diff --git a/core/java/android/service/credentials/OWNERS b/core/java/android/service/credentials/OWNERS
new file mode 100644
index 0000000..f3b43c1
--- /dev/null
+++ b/core/java/android/service/credentials/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/credentials/OWNERS
diff --git a/core/java/android/view/TEST_MAPPING b/core/java/android/view/TEST_MAPPING
index 50d69f7..ecb98f9 100644
--- a/core/java/android/view/TEST_MAPPING
+++ b/core/java/android/view/TEST_MAPPING
@@ -10,6 +10,9 @@
"include-annotation": "android.platform.test.annotations.Presubmit"
},
{
+ "exclude-annotation": "android.platform.test.annotations.LargeTest"
+ },
+ {
"exclude-annotation": "androidx.test.filters.FlakyTest"
},
{
diff --git a/core/jni/OWNERS b/core/jni/OWNERS
index 7f50204..14699e7 100644
--- a/core/jni/OWNERS
+++ b/core/jni/OWNERS
@@ -95,3 +95,7 @@
# Battery
per-file com_android_internal_os_Kernel* = file:/BATTERY_STATS_OWNERS
per-file com_android_internal_os_*MultiStateCounter* = file:/BATTERY_STATS_OWNERS
+
+# PM
+per-file com_android_internal_content_* = file:/PACKAGE_MANAGER_OWNERS
+
diff --git a/core/res/Android.bp b/core/res/Android.bp
index c42517d..93ce783 100644
--- a/core/res/Android.bp
+++ b/core/res/Android.bp
@@ -73,18 +73,18 @@
":remote-color-resources-compile-colors",
],
out: ["remote-color-resources.apk"],
- cmd: "$(location aapt2) link -o $(out) --manifest $(in)"
+ cmd: "$(location aapt2) link -o $(out) --manifest $(in)",
}
genrule {
name: "remote-color-resources-arsc",
srcs: [":remote-color-resources-apk"],
out: ["res/raw/remote_views_color_resources.arsc"],
- cmd: "mkdir -p $(genDir)/remote-color-resources-arsc && "
- + "unzip -x $(in) resources.arsc -d $(genDir)/remote-color-resources-arsc && "
- + "mkdir -p $$(dirname $(out)) && "
- + "mv $(genDir)/remote-color-resources-arsc/resources.arsc $(out) && "
- + "echo 'Created $(out)'"
+ cmd: "mkdir -p $(genDir)/remote-color-resources-arsc && " +
+ "unzip -x $(in) resources.arsc -d $(genDir)/remote-color-resources-arsc && " +
+ "mkdir -p $$(dirname $(out)) && " +
+ "mv $(genDir)/remote-color-resources-arsc/resources.arsc $(out) && " +
+ "echo 'Created $(out)'",
}
genrule {
@@ -95,11 +95,11 @@
"remote_color_resources_res/symbols.xml",
],
out: ["remote_views_color_resources.zip"],
- cmd: "INPUTS=($(in)) && "
- + "RES_DIR=$$(dirname $$(dirname $${INPUTS[0]})) && "
- + "mkdir -p $$RES_DIR/values && "
- + "cp $${INPUTS[1]} $$RES_DIR/values && "
- + "$(location soong_zip) -o $(out) -C $$RES_DIR -D $$RES_DIR"
+ cmd: "INPUTS=($(in)) && " +
+ "RES_DIR=$$(dirname $$(dirname $${INPUTS[0]})) && " +
+ "mkdir -p $$RES_DIR/values && " +
+ "cp $${INPUTS[1]} $$RES_DIR/values && " +
+ "$(location soong_zip) -o $(out) -C $$RES_DIR -D $$RES_DIR",
}
android_app {
@@ -154,31 +154,21 @@
cmd: "cp $(in) $(out)",
}
-// This logic can be removed once robolectric's transition to binary resources is complete
-filegroup {
- name: "robolectric_framework_raw_res_files",
- srcs: [
- "assets/**/*",
- "res/**/*",
- ":remote-color-resources-arsc",
- ],
-}
-
// Generate a text file containing a list of permissions that non-system apps
// are allowed to obtain.
genrule {
- name: "permission-list-normal",
- out: ["permission-list-normal.txt"],
- srcs: ["AndroidManifest.xml"],
- cmd: "cat $(in) " +
- // xmllint has trouble accessing attributes under the android namespace.
- // Strip these prefixes prior to processing with xmllint.
- " | sed -r 's/android:(name|protectionLevel)/\\1/g' " +
- " | $(location xmllint) /dev/stdin --xpath " +
- " '//permission[not(contains(@protectionLevel, \"signature\"))]/@name'" +
- // The result of xmllint is name="value" pairs. Format these to just the
- // permission name, one per-line.
- " | sed -r 's/\\s*name=\\s*//g' | tr -d '\"'" +
- " > $(out)",
- tools: ["xmllint"]
+ name: "permission-list-normal",
+ out: ["permission-list-normal.txt"],
+ srcs: ["AndroidManifest.xml"],
+ cmd: "cat $(in) " +
+ // xmllint has trouble accessing attributes under the android namespace.
+ // Strip these prefixes prior to processing with xmllint.
+ " | sed -r 's/android:(name|protectionLevel)/\\1/g' " +
+ " | $(location xmllint) /dev/stdin --xpath " +
+ " '//permission[not(contains(@protectionLevel, \"signature\"))]/@name'" +
+ // The result of xmllint is name="value" pairs. Format these to just the
+ // permission name, one per-line.
+ " | sed -r 's/\\s*name=\\s*//g' | tr -d '\"'" +
+ " > $(out)",
+ tools: ["xmllint"],
}
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 2215c26..bf155cc 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -222,9 +222,9 @@
<!-- Displayed to tell the user that they should switch their network preference. -->
<string name="NetworkPreferenceSwitchSummary">Try changing preferred network. Tap to change.</string>
<!-- Displayed to tell the user that emergency calls might not be available. -->
- <string name="EmergencyCallWarningTitle">Emergency calling unavailable</string>
+ <string name="EmergencyCallWarningTitle">Emergency calls may be unavailable</string>
<!-- Displayed to tell the user that emergency calls might not be available. -->
- <string name="EmergencyCallWarningSummary">Can\u2019t make emergency calls over Wi\u2011Fi</string>
+ <string name="EmergencyCallWarningSummary"><xliff:g id="spn" example="Operator">%s</xliff:g> doesn\'t support emergency calls over Wi-Fi. Tap for details.</string>
<!-- Telephony notification channel name for a channel containing network alert notifications. -->
<string name="notification_channel_network_alert">Alerts</string>
diff --git a/lowpan/java/Android.bp b/lowpan/java/Android.bp
deleted file mode 100644
index 58513d7..0000000
--- a/lowpan/java/Android.bp
+++ /dev/null
@@ -1,17 +0,0 @@
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "frameworks_base_license"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- default_applicable_licenses: ["frameworks_base_license"],
-}
-
-filegroup {
- name: "framework-lowpan-sources",
- srcs: [
- "**/*.java",
- "**/*.aidl",
- ],
- visibility: ["//frameworks/base"],
-}
diff --git a/lowpan/java/android/net/lowpan/ILowpanEnergyScanCallback.aidl b/lowpan/java/android/net/lowpan/ILowpanEnergyScanCallback.aidl
deleted file mode 100644
index f09dbe3..0000000
--- a/lowpan/java/android/net/lowpan/ILowpanEnergyScanCallback.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-/** {@hide} */
-interface ILowpanEnergyScanCallback {
- oneway void onEnergyScanResult(int channel, int rssi);
- oneway void onEnergyScanFinished();
-}
diff --git a/lowpan/java/android/net/lowpan/ILowpanInterface.aidl b/lowpan/java/android/net/lowpan/ILowpanInterface.aidl
deleted file mode 100644
index 603dc3c..0000000
--- a/lowpan/java/android/net/lowpan/ILowpanInterface.aidl
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import android.net.IpPrefix;
-import android.net.lowpan.ILowpanEnergyScanCallback;
-import android.net.lowpan.ILowpanInterfaceListener;
-import android.net.lowpan.ILowpanNetScanCallback;
-import android.net.lowpan.LowpanBeaconInfo;
-import android.net.lowpan.LowpanChannelInfo;
-import android.net.lowpan.LowpanCredential;
-import android.net.lowpan.LowpanIdentity;
-import android.net.lowpan.LowpanProvision;
-
-/** {@hide} */
-interface ILowpanInterface {
-
- // These are here for the sake of C++ interface implementations.
-
- const String PERM_ACCESS_LOWPAN_STATE = "android.permission.ACCESS_LOWPAN_STATE";
- const String PERM_CHANGE_LOWPAN_STATE = "android.permission.CHANGE_LOWPAN_STATE";
- const String PERM_READ_LOWPAN_CREDENTIAL = "android.permission.READ_LOWPAN_CREDENTIAL";
-
- /**
- * Channel mask key.
- * Used for setting a channel mask when starting a scan.
- * Type: int[]
- * */
- const String KEY_CHANNEL_MASK = "android.net.lowpan.property.CHANNEL_MASK";
-
- /**
- * Max Transmit Power Key.
- * Used for setting the maximum transmit power when starting a network scan.
- * Type: Integer
- * */
- const String KEY_MAX_TX_POWER = "android.net.lowpan.property.MAX_TX_POWER";
-
- // Interface States
-
- const String STATE_OFFLINE = "offline";
- const String STATE_COMMISSIONING = "commissioning";
- const String STATE_ATTACHING = "attaching";
- const String STATE_ATTACHED = "attached";
- const String STATE_FAULT = "fault";
-
- // Device Roles
-
- const String ROLE_END_DEVICE = "end-device";
- const String ROLE_ROUTER = "router";
- const String ROLE_SLEEPY_END_DEVICE = "sleepy-end-device";
- const String ROLE_SLEEPY_ROUTER = "sleepy-router";
- const String ROLE_LEADER = "leader";
- const String ROLE_COORDINATOR = "coordinator";
- const String ROLE_DETACHED = "detached";
-
- const String NETWORK_TYPE_UNKNOWN = "unknown";
-
- /**
- * Network type for Thread 1.x networks.
- *
- * @see android.net.lowpan.LowpanIdentity#getType
- * @see #getLowpanIdentity
- */
- const String NETWORK_TYPE_THREAD_V1 = "org.threadgroup.thread.v1";
-
- // Service-Specific Error Code Constants
-
- const int ERROR_UNSPECIFIED = 1;
- const int ERROR_INVALID_ARGUMENT = 2;
- const int ERROR_DISABLED = 3;
- const int ERROR_WRONG_STATE = 4;
- const int ERROR_TIMEOUT = 5;
- const int ERROR_IO_FAILURE = 6;
- const int ERROR_NCP_PROBLEM = 7;
- const int ERROR_BUSY = 8;
- const int ERROR_ALREADY = 9;
- const int ERROR_CANCELED = 10;
- const int ERROR_FEATURE_NOT_SUPPORTED = 11;
- const int ERROR_JOIN_FAILED_UNKNOWN = 12;
- const int ERROR_JOIN_FAILED_AT_SCAN = 13;
- const int ERROR_JOIN_FAILED_AT_AUTH = 14;
- const int ERROR_FORM_FAILED_AT_SCAN = 15;
-
- // Methods
-
- @utf8InCpp String getName();
-
- @utf8InCpp String getNcpVersion();
- @utf8InCpp String getDriverVersion();
- LowpanChannelInfo[] getSupportedChannels();
- @utf8InCpp String[] getSupportedNetworkTypes();
- byte[] getMacAddress();
-
- boolean isEnabled();
- void setEnabled(boolean enabled);
-
- boolean isUp();
- boolean isCommissioned();
- boolean isConnected();
- @utf8InCpp String getState();
-
- @utf8InCpp String getRole();
- @utf8InCpp String getPartitionId();
- byte[] getExtendedAddress();
-
- LowpanIdentity getLowpanIdentity();
- LowpanCredential getLowpanCredential();
-
- @utf8InCpp String[] getLinkAddresses();
- IpPrefix[] getLinkNetworks();
-
- void join(in LowpanProvision provision);
- void form(in LowpanProvision provision);
- void attach(in LowpanProvision provision);
- void leave();
- void reset();
-
- void startCommissioningSession(in LowpanBeaconInfo beaconInfo);
- void closeCommissioningSession();
- oneway void sendToCommissioner(in byte[] packet);
-
- void beginLowPower();
- oneway void pollForData();
-
- oneway void onHostWake();
-
- void addListener(ILowpanInterfaceListener listener);
- oneway void removeListener(ILowpanInterfaceListener listener);
-
- void startNetScan(in Map properties, ILowpanNetScanCallback listener);
- oneway void stopNetScan();
-
- void startEnergyScan(in Map properties, ILowpanEnergyScanCallback listener);
- oneway void stopEnergyScan();
-
- void addOnMeshPrefix(in IpPrefix prefix, int flags);
- oneway void removeOnMeshPrefix(in IpPrefix prefix);
-
- void addExternalRoute(in IpPrefix prefix, int flags);
- oneway void removeExternalRoute(in IpPrefix prefix);
-}
diff --git a/lowpan/java/android/net/lowpan/ILowpanInterfaceListener.aidl b/lowpan/java/android/net/lowpan/ILowpanInterfaceListener.aidl
deleted file mode 100644
index 5e4049a..0000000
--- a/lowpan/java/android/net/lowpan/ILowpanInterfaceListener.aidl
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import android.net.IpPrefix;
-import android.net.lowpan.LowpanIdentity;
-
-/** {@hide} */
-interface ILowpanInterfaceListener {
- oneway void onEnabledChanged(boolean value);
-
- oneway void onConnectedChanged(boolean value);
-
- oneway void onUpChanged(boolean value);
-
- oneway void onRoleChanged(@utf8InCpp String value);
-
- oneway void onStateChanged(@utf8InCpp String value);
-
- oneway void onLowpanIdentityChanged(in LowpanIdentity value);
-
- oneway void onLinkNetworkAdded(in IpPrefix value);
-
- oneway void onLinkNetworkRemoved(in IpPrefix value);
-
- oneway void onLinkAddressAdded(@utf8InCpp String value);
-
- oneway void onLinkAddressRemoved(@utf8InCpp String value);
-
- oneway void onReceiveFromCommissioner(in byte[] packet);
-}
diff --git a/lowpan/java/android/net/lowpan/ILowpanManager.aidl b/lowpan/java/android/net/lowpan/ILowpanManager.aidl
deleted file mode 100644
index 326aa65..0000000
--- a/lowpan/java/android/net/lowpan/ILowpanManager.aidl
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2016 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.lowpan;
-import android.net.lowpan.ILowpanInterface;
-import android.net.lowpan.ILowpanManagerListener;
-
-/** {@hide} */
-interface ILowpanManager {
-
- /* Keep this in sync with Context.LOWPAN_SERVICE */
- const String LOWPAN_SERVICE_NAME = "lowpan";
-
- ILowpanInterface getInterface(@utf8InCpp String name);
-
- @utf8InCpp String[] getInterfaceList();
-
- void addListener(ILowpanManagerListener listener);
- void removeListener(ILowpanManagerListener listener);
-
- void addInterface(ILowpanInterface lowpan_interface);
- void removeInterface(ILowpanInterface lowpan_interface);
-}
diff --git a/lowpan/java/android/net/lowpan/ILowpanManagerListener.aidl b/lowpan/java/android/net/lowpan/ILowpanManagerListener.aidl
deleted file mode 100644
index d4846f6..0000000
--- a/lowpan/java/android/net/lowpan/ILowpanManagerListener.aidl
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2016 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.lowpan;
-
-import android.net.lowpan.ILowpanInterface;
-
-/** {@hide} */
-interface ILowpanManagerListener {
- oneway void onInterfaceAdded(ILowpanInterface lowpanInterface);
- oneway void onInterfaceRemoved(ILowpanInterface lowpanInterface);
-}
diff --git a/lowpan/java/android/net/lowpan/ILowpanNetScanCallback.aidl b/lowpan/java/android/net/lowpan/ILowpanNetScanCallback.aidl
deleted file mode 100644
index 9743fce..0000000
--- a/lowpan/java/android/net/lowpan/ILowpanNetScanCallback.aidl
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import android.net.lowpan.LowpanBeaconInfo;
-
-/** {@hide} */
-interface ILowpanNetScanCallback {
- oneway void onNetScanBeacon(in LowpanBeaconInfo beacon);
- oneway void onNetScanFinished();
-}
diff --git a/lowpan/java/android/net/lowpan/InterfaceDisabledException.java b/lowpan/java/android/net/lowpan/InterfaceDisabledException.java
deleted file mode 100644
index e917d45..0000000
--- a/lowpan/java/android/net/lowpan/InterfaceDisabledException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-/**
- * Exception indicating this operation requires the interface to be enabled.
- *
- * @see LowpanInterface
- * @hide
- */
-// @SystemApi
-public class InterfaceDisabledException extends LowpanException {
-
- public InterfaceDisabledException() {}
-
- public InterfaceDisabledException(String message) {
- super(message);
- }
-
- public InterfaceDisabledException(String message, Throwable cause) {
- super(message, cause);
- }
-
- protected InterfaceDisabledException(Exception cause) {
- super(cause);
- }
-}
diff --git a/lowpan/java/android/net/lowpan/JoinFailedAtAuthException.java b/lowpan/java/android/net/lowpan/JoinFailedAtAuthException.java
deleted file mode 100644
index 7aceb71..0000000
--- a/lowpan/java/android/net/lowpan/JoinFailedAtAuthException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-/**
- * Exception indicating the join operation was unable to find the given network.
- *
- * @see LowpanInterface
- * @hide
- */
-// @SystemApi
-public class JoinFailedAtAuthException extends JoinFailedException {
-
- public JoinFailedAtAuthException() {}
-
- public JoinFailedAtAuthException(String message) {
- super(message);
- }
-
- public JoinFailedAtAuthException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public JoinFailedAtAuthException(Exception cause) {
- super(cause);
- }
-}
diff --git a/lowpan/java/android/net/lowpan/JoinFailedAtScanException.java b/lowpan/java/android/net/lowpan/JoinFailedAtScanException.java
deleted file mode 100644
index a4346f98..0000000
--- a/lowpan/java/android/net/lowpan/JoinFailedAtScanException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-/**
- * Exception indicating the join operation was unable to find the given network.
- *
- * @see LowpanInterface
- * @hide
- */
-// @SystemApi
-public class JoinFailedAtScanException extends JoinFailedException {
-
- public JoinFailedAtScanException() {}
-
- public JoinFailedAtScanException(String message) {
- super(message);
- }
-
- public JoinFailedAtScanException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public JoinFailedAtScanException(Exception cause) {
- super(cause);
- }
-}
diff --git a/lowpan/java/android/net/lowpan/JoinFailedException.java b/lowpan/java/android/net/lowpan/JoinFailedException.java
deleted file mode 100644
index e51d382..0000000
--- a/lowpan/java/android/net/lowpan/JoinFailedException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-/**
- * Exception indicating the join operation has failed.
- *
- * @see LowpanInterface
- * @hide
- */
-// @SystemApi
-public class JoinFailedException extends LowpanException {
-
- public JoinFailedException() {}
-
- public JoinFailedException(String message) {
- super(message);
- }
-
- public JoinFailedException(String message, Throwable cause) {
- super(message, cause);
- }
-
- protected JoinFailedException(Exception cause) {
- super(cause);
- }
-}
diff --git a/lowpan/java/android/net/lowpan/LowpanBeaconInfo.aidl b/lowpan/java/android/net/lowpan/LowpanBeaconInfo.aidl
deleted file mode 100644
index 9464fea..0000000
--- a/lowpan/java/android/net/lowpan/LowpanBeaconInfo.aidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright (C) 2017 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.lowpan;
-
-parcelable LowpanBeaconInfo cpp_header "android/net/lowpan/LowpanBeaconInfo.h";
diff --git a/lowpan/java/android/net/lowpan/LowpanBeaconInfo.java b/lowpan/java/android/net/lowpan/LowpanBeaconInfo.java
deleted file mode 100644
index 5d4a3a0..0000000
--- a/lowpan/java/android/net/lowpan/LowpanBeaconInfo.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-import com.android.internal.util.HexDump;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Objects;
-import java.util.TreeSet;
-
-/**
- * Describes a LoWPAN Beacon
- *
- * @hide
- */
-// @SystemApi
-public class LowpanBeaconInfo implements Parcelable {
- public static final int UNKNOWN_RSSI = Integer.MAX_VALUE;
- public static final int UNKNOWN_LQI = 0;
-
- private LowpanIdentity mIdentity;
- private int mRssi = UNKNOWN_RSSI;
- private int mLqi = UNKNOWN_LQI;
- private byte[] mBeaconAddress = null;
- private final TreeSet<Integer> mFlags = new TreeSet<>();
-
- public static final int FLAG_CAN_ASSIST = 1;
-
- /** @hide */
- public static class Builder {
- final LowpanIdentity.Builder mIdentityBuilder = new LowpanIdentity.Builder();
- final LowpanBeaconInfo mBeaconInfo = new LowpanBeaconInfo();
-
- public Builder setLowpanIdentity(LowpanIdentity x) {
- mIdentityBuilder.setLowpanIdentity(x);
- return this;
- }
-
- public Builder setName(String x) {
- mIdentityBuilder.setName(x);
- return this;
- }
-
- public Builder setXpanid(byte x[]) {
- mIdentityBuilder.setXpanid(x);
- return this;
- }
-
- public Builder setPanid(int x) {
- mIdentityBuilder.setPanid(x);
- return this;
- }
-
- public Builder setChannel(int x) {
- mIdentityBuilder.setChannel(x);
- return this;
- }
-
- public Builder setType(String x) {
- mIdentityBuilder.setType(x);
- return this;
- }
-
- public Builder setRssi(int x) {
- mBeaconInfo.mRssi = x;
- return this;
- }
-
- public Builder setLqi(int x) {
- mBeaconInfo.mLqi = x;
- return this;
- }
-
- public Builder setBeaconAddress(byte x[]) {
- mBeaconInfo.mBeaconAddress = (x != null ? x.clone() : null);
- return this;
- }
-
- public Builder setFlag(int x) {
- mBeaconInfo.mFlags.add(x);
- return this;
- }
-
- public Builder setFlags(Collection<Integer> x) {
- mBeaconInfo.mFlags.addAll(x);
- return this;
- }
-
- public LowpanBeaconInfo build() {
- mBeaconInfo.mIdentity = mIdentityBuilder.build();
- if (mBeaconInfo.mBeaconAddress == null) {
- mBeaconInfo.mBeaconAddress = new byte[0];
- }
- return mBeaconInfo;
- }
- }
-
- private LowpanBeaconInfo() {}
-
- public LowpanIdentity getLowpanIdentity() {
- return mIdentity;
- }
-
- public int getRssi() {
- return mRssi;
- }
-
- public int getLqi() {
- return mLqi;
- }
-
- public byte[] getBeaconAddress() {
- return mBeaconAddress.clone();
- }
-
- public Collection<Integer> getFlags() {
- return (Collection<Integer>) mFlags.clone();
- }
-
- public boolean isFlagSet(int flag) {
- return mFlags.contains(flag);
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
-
- sb.append(mIdentity.toString());
-
- if (mRssi != UNKNOWN_RSSI) {
- sb.append(", RSSI:").append(mRssi).append("dBm");
- }
-
- if (mLqi != UNKNOWN_LQI) {
- sb.append(", LQI:").append(mLqi);
- }
-
- if (mBeaconAddress.length > 0) {
- sb.append(", BeaconAddress:").append(HexDump.toHexString(mBeaconAddress));
- }
-
- for (Integer flag : mFlags) {
- switch (flag.intValue()) {
- case FLAG_CAN_ASSIST:
- sb.append(", CAN_ASSIST");
- break;
- default:
- sb.append(", FLAG_").append(Integer.toHexString(flag));
- break;
- }
- }
-
- return sb.toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(mIdentity, mRssi, mLqi, Arrays.hashCode(mBeaconAddress), mFlags);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof LowpanBeaconInfo)) {
- return false;
- }
- LowpanBeaconInfo rhs = (LowpanBeaconInfo) obj;
- return mIdentity.equals(rhs.mIdentity)
- && Arrays.equals(mBeaconAddress, rhs.mBeaconAddress)
- && mRssi == rhs.mRssi
- && mLqi == rhs.mLqi
- && mFlags.equals(rhs.mFlags);
- }
-
- /** Implement the Parcelable interface. */
- @Override
- public int describeContents() {
- return 0;
- }
-
- /** Implement the Parcelable interface. */
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- mIdentity.writeToParcel(dest, flags);
- dest.writeInt(mRssi);
- dest.writeInt(mLqi);
- dest.writeByteArray(mBeaconAddress);
-
- dest.writeInt(mFlags.size());
- for (Integer val : mFlags) {
- dest.writeInt(val);
- }
- }
-
- /** Implement the Parcelable interface. */
- public static final @android.annotation.NonNull Creator<LowpanBeaconInfo> CREATOR =
- new Creator<LowpanBeaconInfo>() {
- public LowpanBeaconInfo createFromParcel(Parcel in) {
- Builder builder = new Builder();
-
- builder.setLowpanIdentity(LowpanIdentity.CREATOR.createFromParcel(in));
-
- builder.setRssi(in.readInt());
- builder.setLqi(in.readInt());
-
- builder.setBeaconAddress(in.createByteArray());
-
- for (int i = in.readInt(); i > 0; i--) {
- builder.setFlag(in.readInt());
- }
-
- return builder.build();
- }
-
- public LowpanBeaconInfo[] newArray(int size) {
- return new LowpanBeaconInfo[size];
- }
- };
-}
diff --git a/lowpan/java/android/net/lowpan/LowpanChannelInfo.aidl b/lowpan/java/android/net/lowpan/LowpanChannelInfo.aidl
deleted file mode 100644
index 0676deb..0000000
--- a/lowpan/java/android/net/lowpan/LowpanChannelInfo.aidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright (C) 2017 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.lowpan;
-
-parcelable LowpanChannelInfo cpp_header "android/net/lowpan/LowpanChannelInfo.h";
diff --git a/lowpan/java/android/net/lowpan/LowpanChannelInfo.java b/lowpan/java/android/net/lowpan/LowpanChannelInfo.java
deleted file mode 100644
index 12c98b6..0000000
--- a/lowpan/java/android/net/lowpan/LowpanChannelInfo.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-import java.util.Objects;
-
-/**
- * Provides detailed information about a given channel.
- *
- * @hide
- */
-// @SystemApi
-public class LowpanChannelInfo implements Parcelable {
-
- public static final int UNKNOWN_POWER = Integer.MAX_VALUE;
- public static final float UNKNOWN_FREQUENCY = 0.0f;
- public static final float UNKNOWN_BANDWIDTH = 0.0f;
-
- private int mIndex = 0;
- private String mName = null;
- private float mSpectrumCenterFrequency = UNKNOWN_FREQUENCY;
- private float mSpectrumBandwidth = UNKNOWN_BANDWIDTH;
- private int mMaxTransmitPower = UNKNOWN_POWER;
- private boolean mIsMaskedByRegulatoryDomain = false;
-
- /** @hide */
- public static LowpanChannelInfo getChannelInfoForIeee802154Page0(int index) {
- LowpanChannelInfo info = new LowpanChannelInfo();
-
- if (index < 0) {
- info = null;
-
- } else if (index == 0) {
- info.mSpectrumCenterFrequency = 868300000.0f;
- info.mSpectrumBandwidth = 600000.0f;
-
- } else if (index < 11) {
- info.mSpectrumCenterFrequency = 906000000.0f - (2000000.0f * 1) + 2000000.0f * (index);
- info.mSpectrumBandwidth = 0; // Unknown
-
- } else if (index < 26) {
- info.mSpectrumCenterFrequency =
- 2405000000.0f - (5000000.0f * 11) + 5000000.0f * (index);
- info.mSpectrumBandwidth = 2000000.0f;
-
- } else {
- info = null;
- }
-
- info.mName = Integer.toString(index);
-
- return info;
- }
-
- private LowpanChannelInfo() {}
-
- private LowpanChannelInfo(int index, String name, float cf, float bw) {
- mIndex = index;
- mName = name;
- mSpectrumCenterFrequency = cf;
- mSpectrumBandwidth = bw;
- }
-
- public String getName() {
- return mName;
- }
-
- public int getIndex() {
- return mIndex;
- }
-
- public int getMaxTransmitPower() {
- return mMaxTransmitPower;
- }
-
- public boolean isMaskedByRegulatoryDomain() {
- return mIsMaskedByRegulatoryDomain;
- }
-
- public float getSpectrumCenterFrequency() {
- return mSpectrumCenterFrequency;
- }
-
- public float getSpectrumBandwidth() {
- return mSpectrumBandwidth;
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
-
- sb.append("Channel ").append(mIndex);
-
- if (mName != null && !mName.equals(Integer.toString(mIndex))) {
- sb.append(" (").append(mName).append(")");
- }
-
- if (mSpectrumCenterFrequency > 0.0f) {
- if (mSpectrumCenterFrequency > 1000000000.0f) {
- sb.append(", SpectrumCenterFrequency: ")
- .append(mSpectrumCenterFrequency / 1000000000.0f)
- .append("GHz");
- } else if (mSpectrumCenterFrequency > 1000000.0f) {
- sb.append(", SpectrumCenterFrequency: ")
- .append(mSpectrumCenterFrequency / 1000000.0f)
- .append("MHz");
- } else {
- sb.append(", SpectrumCenterFrequency: ")
- .append(mSpectrumCenterFrequency / 1000.0f)
- .append("kHz");
- }
- }
-
- if (mSpectrumBandwidth > 0.0f) {
- if (mSpectrumBandwidth > 1000000000.0f) {
- sb.append(", SpectrumBandwidth: ")
- .append(mSpectrumBandwidth / 1000000000.0f)
- .append("GHz");
- } else if (mSpectrumBandwidth > 1000000.0f) {
- sb.append(", SpectrumBandwidth: ")
- .append(mSpectrumBandwidth / 1000000.0f)
- .append("MHz");
- } else {
- sb.append(", SpectrumBandwidth: ")
- .append(mSpectrumBandwidth / 1000.0f)
- .append("kHz");
- }
- }
-
- if (mMaxTransmitPower != UNKNOWN_POWER) {
- sb.append(", MaxTransmitPower: ").append(mMaxTransmitPower).append("dBm");
- }
-
- return sb.toString();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof LowpanChannelInfo)) {
- return false;
- }
- LowpanChannelInfo rhs = (LowpanChannelInfo) obj;
- return Objects.equals(mName, rhs.mName)
- && mIndex == rhs.mIndex
- && mIsMaskedByRegulatoryDomain == rhs.mIsMaskedByRegulatoryDomain
- && mSpectrumCenterFrequency == rhs.mSpectrumCenterFrequency
- && mSpectrumBandwidth == rhs.mSpectrumBandwidth
- && mMaxTransmitPower == rhs.mMaxTransmitPower;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(
- mName,
- mIndex,
- mIsMaskedByRegulatoryDomain,
- mSpectrumCenterFrequency,
- mSpectrumBandwidth,
- mMaxTransmitPower);
- }
-
- /** Implement the Parcelable interface. */
- @Override
- public int describeContents() {
- return 0;
- }
-
- /** Implement the Parcelable interface. */
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(mIndex);
- dest.writeString(mName);
- dest.writeFloat(mSpectrumCenterFrequency);
- dest.writeFloat(mSpectrumBandwidth);
- dest.writeInt(mMaxTransmitPower);
- dest.writeBoolean(mIsMaskedByRegulatoryDomain);
- }
-
- /** Implement the Parcelable interface. */
- public static final @android.annotation.NonNull Creator<LowpanChannelInfo> CREATOR =
- new Creator<LowpanChannelInfo>() {
-
- public LowpanChannelInfo createFromParcel(Parcel in) {
- LowpanChannelInfo info = new LowpanChannelInfo();
-
- info.mIndex = in.readInt();
- info.mName = in.readString();
- info.mSpectrumCenterFrequency = in.readFloat();
- info.mSpectrumBandwidth = in.readFloat();
- info.mMaxTransmitPower = in.readInt();
- info.mIsMaskedByRegulatoryDomain = in.readBoolean();
-
- return info;
- }
-
- public LowpanChannelInfo[] newArray(int size) {
- return new LowpanChannelInfo[size];
- }
- };
-}
diff --git a/lowpan/java/android/net/lowpan/LowpanCommissioningSession.java b/lowpan/java/android/net/lowpan/LowpanCommissioningSession.java
deleted file mode 100644
index 8f75e8d..0000000
--- a/lowpan/java/android/net/lowpan/LowpanCommissioningSession.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.net.IpPrefix;
-import android.os.DeadObjectException;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.RemoteException;
-
-/**
- * Commissioning Session.
- *
- * <p>This class enables a device to learn the credential needed to join a network using a technique
- * called "in-band commissioning".
- *
- * @hide
- */
-// @SystemApi
-public class LowpanCommissioningSession {
-
- private final ILowpanInterface mBinder;
- private final LowpanBeaconInfo mBeaconInfo;
- private final ILowpanInterfaceListener mInternalCallback = new InternalCallback();
- private final Looper mLooper;
- private Handler mHandler;
- private Callback mCallback = null;
- private volatile boolean mIsClosed = false;
-
- /**
- * Callback base class for {@link LowpanCommissioningSession}
- *
- * @hide
- */
- // @SystemApi
- public abstract static class Callback {
- public void onReceiveFromCommissioner(@NonNull byte[] packet) {};
-
- public void onClosed() {};
- }
-
- private class InternalCallback extends ILowpanInterfaceListener.Stub {
- @Override
- public void onStateChanged(String value) {
- if (!mIsClosed) {
- switch (value) {
- case ILowpanInterface.STATE_OFFLINE:
- case ILowpanInterface.STATE_FAULT:
- synchronized (LowpanCommissioningSession.this) {
- lockedCleanup();
- }
- }
- }
- }
-
- @Override
- public void onReceiveFromCommissioner(byte[] packet) {
- mHandler.post(
- () -> {
- synchronized (LowpanCommissioningSession.this) {
- if (!mIsClosed && (mCallback != null)) {
- mCallback.onReceiveFromCommissioner(packet);
- }
- }
- });
- }
-
- // We ignore all other callbacks.
- @Override
- public void onEnabledChanged(boolean value) {}
-
- @Override
- public void onConnectedChanged(boolean value) {}
-
- @Override
- public void onUpChanged(boolean value) {}
-
- @Override
- public void onRoleChanged(String value) {}
-
- @Override
- public void onLowpanIdentityChanged(LowpanIdentity value) {}
-
- @Override
- public void onLinkNetworkAdded(IpPrefix value) {}
-
- @Override
- public void onLinkNetworkRemoved(IpPrefix value) {}
-
- @Override
- public void onLinkAddressAdded(String value) {}
-
- @Override
- public void onLinkAddressRemoved(String value) {}
- }
-
- LowpanCommissioningSession(
- ILowpanInterface binder, LowpanBeaconInfo beaconInfo, Looper looper) {
- mBinder = binder;
- mBeaconInfo = beaconInfo;
- mLooper = looper;
-
- if (mLooper != null) {
- mHandler = new Handler(mLooper);
- } else {
- mHandler = new Handler();
- }
-
- try {
- mBinder.addListener(mInternalCallback);
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
-
- private void lockedCleanup() {
- // Note: this method is only called from synchronized contexts.
-
- if (!mIsClosed) {
- try {
- mBinder.removeListener(mInternalCallback);
-
- } catch (DeadObjectException x) {
- /* We don't care if we receive a DOE at this point.
- * DOE is as good as success as far as we are concerned.
- */
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
-
- if (mCallback != null) {
- mHandler.post(() -> mCallback.onClosed());
- }
- }
-
- mCallback = null;
- mIsClosed = true;
- }
-
- /** TODO: doc */
- @NonNull
- public LowpanBeaconInfo getBeaconInfo() {
- return mBeaconInfo;
- }
-
- /** TODO: doc */
- public void sendToCommissioner(@NonNull byte[] packet) {
- if (!mIsClosed) {
- try {
- mBinder.sendToCommissioner(packet);
-
- } catch (DeadObjectException x) {
- /* This method is a best-effort delivery.
- * We don't care if we receive a DOE at this point.
- */
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
- }
-
- /** TODO: doc */
- public synchronized void setCallback(@Nullable Callback cb, @Nullable Handler handler) {
- if (!mIsClosed) {
- /* This class can be created with or without a default looper.
- * Also, this method can be called with or without a specific
- * handler. If a handler is specified, it is to always be used.
- * Otherwise, if there was a Looper specified when this object
- * was created, we create a new handle based on that looper.
- * Otherwise we just create a default handler object. Since we
- * don't really know how the previous handler was created, we
- * end up always replacing it here. This isn't a huge problem
- * because this method should be called infrequently.
- */
- if (handler != null) {
- mHandler = handler;
- } else if (mLooper != null) {
- mHandler = new Handler(mLooper);
- } else {
- mHandler = new Handler();
- }
- mCallback = cb;
- }
- }
-
- /** TODO: doc */
- public synchronized void close() {
- if (!mIsClosed) {
- try {
- mBinder.closeCommissioningSession();
-
- lockedCleanup();
-
- } catch (DeadObjectException x) {
- /* We don't care if we receive a DOE at this point.
- * DOE is as good as success as far as we are concerned.
- */
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
- }
-}
diff --git a/lowpan/java/android/net/lowpan/LowpanCredential.aidl b/lowpan/java/android/net/lowpan/LowpanCredential.aidl
deleted file mode 100644
index af0c2d6..0000000
--- a/lowpan/java/android/net/lowpan/LowpanCredential.aidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright (C) 2017 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.lowpan;
-
-parcelable LowpanCredential cpp_header "android/net/lowpan/LowpanCredential.h";
diff --git a/lowpan/java/android/net/lowpan/LowpanCredential.java b/lowpan/java/android/net/lowpan/LowpanCredential.java
deleted file mode 100644
index dcbb831..0000000
--- a/lowpan/java/android/net/lowpan/LowpanCredential.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-import com.android.internal.util.HexDump;
-import java.util.Arrays;
-import java.util.Objects;
-
-/**
- * Describes a credential for a LoWPAN network.
- *
- * @hide
- */
-// @SystemApi
-public class LowpanCredential implements Parcelable {
-
- public static final int UNSPECIFIED_KEY_INDEX = 0;
-
- private byte[] mMasterKey = null;
- private int mMasterKeyIndex = UNSPECIFIED_KEY_INDEX;
-
- LowpanCredential() {}
-
- private LowpanCredential(byte[] masterKey, int keyIndex) {
- setMasterKey(masterKey, keyIndex);
- }
-
- private LowpanCredential(byte[] masterKey) {
- setMasterKey(masterKey);
- }
-
- public static LowpanCredential createMasterKey(byte[] masterKey) {
- return new LowpanCredential(masterKey);
- }
-
- public static LowpanCredential createMasterKey(byte[] masterKey, int keyIndex) {
- return new LowpanCredential(masterKey, keyIndex);
- }
-
- void setMasterKey(byte[] masterKey) {
- if (masterKey != null) {
- masterKey = masterKey.clone();
- }
- mMasterKey = masterKey;
- }
-
- void setMasterKeyIndex(int keyIndex) {
- mMasterKeyIndex = keyIndex;
- }
-
- void setMasterKey(byte[] masterKey, int keyIndex) {
- setMasterKey(masterKey);
- setMasterKeyIndex(keyIndex);
- }
-
- public byte[] getMasterKey() {
- if (mMasterKey != null) {
- return mMasterKey.clone();
- }
- return null;
- }
-
- public int getMasterKeyIndex() {
- return mMasterKeyIndex;
- }
-
- public boolean isMasterKey() {
- return mMasterKey != null;
- }
-
- public String toSensitiveString() {
- StringBuffer sb = new StringBuffer();
-
- sb.append("<LowpanCredential");
-
- if (isMasterKey()) {
- sb.append(" MasterKey:").append(HexDump.toHexString(mMasterKey));
- if (mMasterKeyIndex != UNSPECIFIED_KEY_INDEX) {
- sb.append(", Index:").append(mMasterKeyIndex);
- }
- } else {
- sb.append(" empty");
- }
-
- sb.append(">");
-
- return sb.toString();
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
-
- sb.append("<LowpanCredential");
-
- if (isMasterKey()) {
- // We don't print out the contents of the key here,
- // we only do that in toSensitiveString.
- sb.append(" MasterKey");
- if (mMasterKeyIndex != UNSPECIFIED_KEY_INDEX) {
- sb.append(", Index:").append(mMasterKeyIndex);
- }
- } else {
- sb.append(" empty");
- }
-
- sb.append(">");
-
- return sb.toString();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof LowpanCredential)) {
- return false;
- }
- LowpanCredential rhs = (LowpanCredential) obj;
- return Arrays.equals(mMasterKey, rhs.mMasterKey) && mMasterKeyIndex == rhs.mMasterKeyIndex;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(Arrays.hashCode(mMasterKey), mMasterKeyIndex);
- }
-
- /** Implement the Parcelable interface. */
- @Override
- public int describeContents() {
- return 0;
- }
-
- /** Implement the Parcelable interface. */
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeByteArray(mMasterKey);
- dest.writeInt(mMasterKeyIndex);
- }
-
- /** Implement the Parcelable interface. */
- public static final @android.annotation.NonNull Creator<LowpanCredential> CREATOR =
- new Creator<LowpanCredential>() {
-
- public LowpanCredential createFromParcel(Parcel in) {
- LowpanCredential credential = new LowpanCredential();
-
- credential.mMasterKey = in.createByteArray();
- credential.mMasterKeyIndex = in.readInt();
-
- return credential;
- }
-
- public LowpanCredential[] newArray(int size) {
- return new LowpanCredential[size];
- }
- };
-}
diff --git a/lowpan/java/android/net/lowpan/LowpanEnergyScanResult.java b/lowpan/java/android/net/lowpan/LowpanEnergyScanResult.java
deleted file mode 100644
index da87752..0000000
--- a/lowpan/java/android/net/lowpan/LowpanEnergyScanResult.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-/**
- * Describes the result from one channel of an energy scan.
- *
- * @hide
- */
-// @SystemApi
-public class LowpanEnergyScanResult {
- public static final int UNKNOWN = Integer.MAX_VALUE;
-
- private int mChannel = UNKNOWN;
- private int mMaxRssi = UNKNOWN;
-
- LowpanEnergyScanResult() {}
-
- public int getChannel() {
- return mChannel;
- }
-
- public int getMaxRssi() {
- return mMaxRssi;
- }
-
- void setChannel(int x) {
- mChannel = x;
- }
-
- void setMaxRssi(int x) {
- mMaxRssi = x;
- }
-
- @Override
- public String toString() {
- return "LowpanEnergyScanResult(channel: " + mChannel + ", maxRssi:" + mMaxRssi + ")";
- }
-}
diff --git a/lowpan/java/android/net/lowpan/LowpanException.java b/lowpan/java/android/net/lowpan/LowpanException.java
deleted file mode 100644
index 5dfce48..0000000
--- a/lowpan/java/android/net/lowpan/LowpanException.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import android.os.ServiceSpecificException;
-import android.util.AndroidException;
-
-/**
- * <code>LowpanException</code> is thrown if an action to a LoWPAN interface could not be performed
- * or a LoWPAN interface property could not be fetched or changed.
- *
- * @see LowpanInterface
- * @hide
- */
-// @SystemApi
-public class LowpanException extends AndroidException {
- public LowpanException() {}
-
- public LowpanException(String message) {
- super(message);
- }
-
- public LowpanException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public LowpanException(Exception cause) {
- super(cause);
- }
-
- /* This method returns LowpanException so that the caller
- * can add "throw" before the invocation of this method.
- * This might seem superfluous, but it is actually to
- * help provide a hint to the java compiler that this
- * function will not return.
- */
- static LowpanException rethrowFromServiceSpecificException(ServiceSpecificException e)
- throws LowpanException {
- switch (e.errorCode) {
- case ILowpanInterface.ERROR_DISABLED:
- throw new InterfaceDisabledException(e);
-
- case ILowpanInterface.ERROR_WRONG_STATE:
- throw new WrongStateException(e);
-
- case ILowpanInterface.ERROR_CANCELED:
- throw new OperationCanceledException(e);
-
- case ILowpanInterface.ERROR_JOIN_FAILED_UNKNOWN:
- throw new JoinFailedException(e);
-
- case ILowpanInterface.ERROR_JOIN_FAILED_AT_SCAN:
- throw new JoinFailedAtScanException(e);
-
- case ILowpanInterface.ERROR_JOIN_FAILED_AT_AUTH:
- throw new JoinFailedAtAuthException(e);
-
- case ILowpanInterface.ERROR_FORM_FAILED_AT_SCAN:
- throw new NetworkAlreadyExistsException(e);
-
- case ILowpanInterface.ERROR_FEATURE_NOT_SUPPORTED:
- throw new LowpanException(
- e.getMessage() != null ? e.getMessage() : "Feature not supported", e);
-
- case ILowpanInterface.ERROR_NCP_PROBLEM:
- throw new LowpanRuntimeException(
- e.getMessage() != null ? e.getMessage() : "NCP problem", e);
-
- case ILowpanInterface.ERROR_INVALID_ARGUMENT:
- throw new LowpanRuntimeException(
- e.getMessage() != null ? e.getMessage() : "Invalid argument", e);
-
- case ILowpanInterface.ERROR_UNSPECIFIED:
- default:
- throw new LowpanRuntimeException(e);
- }
- }
-}
diff --git a/lowpan/java/android/net/lowpan/LowpanIdentity.aidl b/lowpan/java/android/net/lowpan/LowpanIdentity.aidl
deleted file mode 100644
index fcef98f..0000000
--- a/lowpan/java/android/net/lowpan/LowpanIdentity.aidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright (C) 2017 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.lowpan;
-
-parcelable LowpanIdentity cpp_header "android/net/lowpan/LowpanIdentity.h";
diff --git a/lowpan/java/android/net/lowpan/LowpanIdentity.java b/lowpan/java/android/net/lowpan/LowpanIdentity.java
deleted file mode 100644
index 1997bc4..0000000
--- a/lowpan/java/android/net/lowpan/LowpanIdentity.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import android.annotation.NonNull;
-import android.icu.text.StringPrep;
-import android.icu.text.StringPrepParseException;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.util.Log;
-import com.android.internal.util.HexDump;
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.Objects;
-
-/**
- * Describes an instance of a LoWPAN network.
- *
- * @hide
- */
-// @SystemApi
-public class LowpanIdentity implements Parcelable {
- private static final String TAG = LowpanIdentity.class.getSimpleName();
-
- // Constants
- public static final int UNSPECIFIED_CHANNEL = -1;
- public static final int UNSPECIFIED_PANID = 0xFFFFFFFF;
- // Builder
-
- /** @hide */
- // @SystemApi
- public static class Builder {
- private static final StringPrep stringPrep =
- StringPrep.getInstance(StringPrep.RFC3920_RESOURCEPREP);
-
- final LowpanIdentity mIdentity = new LowpanIdentity();
-
- private static String escape(@NonNull byte[] bytes) {
- StringBuffer sb = new StringBuffer();
- for (byte b : bytes) {
- if (b >= 32 && b <= 126) {
- sb.append((char) b);
- } else {
- sb.append(String.format("\\0x%02x", b & 0xFF));
- }
- }
- return sb.toString();
- }
-
- public Builder setLowpanIdentity(@NonNull LowpanIdentity x) {
- Objects.requireNonNull(x);
- setRawName(x.getRawName());
- setXpanid(x.getXpanid());
- setPanid(x.getPanid());
- setChannel(x.getChannel());
- setType(x.getType());
- return this;
- }
-
- public Builder setName(@NonNull String name) {
- Objects.requireNonNull(name);
- try {
- mIdentity.mName = stringPrep.prepare(name, StringPrep.DEFAULT);
- mIdentity.mRawName = mIdentity.mName.getBytes(StandardCharsets.UTF_8);
- mIdentity.mIsNameValid = true;
- } catch (StringPrepParseException x) {
- Log.w(TAG, x.toString());
- setRawName(name.getBytes(StandardCharsets.UTF_8));
- }
- return this;
- }
-
- public Builder setRawName(@NonNull byte[] name) {
- Objects.requireNonNull(name);
- mIdentity.mRawName = name.clone();
- mIdentity.mName = new String(name, StandardCharsets.UTF_8);
- try {
- String nameCheck = stringPrep.prepare(mIdentity.mName, StringPrep.DEFAULT);
- mIdentity.mIsNameValid =
- Arrays.equals(nameCheck.getBytes(StandardCharsets.UTF_8), name);
- } catch (StringPrepParseException x) {
- Log.w(TAG, x.toString());
- mIdentity.mIsNameValid = false;
- }
-
- // Non-normal names must be rendered differently to avoid confusion.
- if (!mIdentity.mIsNameValid) {
- mIdentity.mName = "«" + escape(name) + "»";
- }
-
- return this;
- }
-
- public Builder setXpanid(byte x[]) {
- mIdentity.mXpanid = (x != null ? x.clone() : null);
- return this;
- }
-
- public Builder setPanid(int x) {
- mIdentity.mPanid = x;
- return this;
- }
-
- public Builder setType(@NonNull String x) {
- mIdentity.mType = x;
- return this;
- }
-
- public Builder setChannel(int x) {
- mIdentity.mChannel = x;
- return this;
- }
-
- public LowpanIdentity build() {
- return mIdentity;
- }
- }
-
- LowpanIdentity() {}
-
- // Instance Variables
-
- private String mName = "";
- private boolean mIsNameValid = true;
- private byte[] mRawName = new byte[0];
- private String mType = "";
- private byte[] mXpanid = new byte[0];
- private int mPanid = UNSPECIFIED_PANID;
- private int mChannel = UNSPECIFIED_CHANNEL;
-
- // Public Getters
-
- public String getName() {
- return mName;
- }
-
- public boolean isNameValid() {
- return mIsNameValid;
- }
-
- public byte[] getRawName() {
- return mRawName.clone();
- }
-
- public byte[] getXpanid() {
- return mXpanid.clone();
- }
-
- public int getPanid() {
- return mPanid;
- }
-
- public String getType() {
- return mType;
- }
-
- public int getChannel() {
- return mChannel;
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
-
- sb.append("Name:").append(getName());
-
- if (mType.length() > 0) {
- sb.append(", Type:").append(mType);
- }
-
- if (mXpanid.length > 0) {
- sb.append(", XPANID:").append(HexDump.toHexString(mXpanid));
- }
-
- if (mPanid != UNSPECIFIED_PANID) {
- sb.append(", PANID:").append(String.format("0x%04X", mPanid));
- }
-
- if (mChannel != UNSPECIFIED_CHANNEL) {
- sb.append(", Channel:").append(mChannel);
- }
-
- return sb.toString();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof LowpanIdentity)) {
- return false;
- }
- LowpanIdentity rhs = (LowpanIdentity) obj;
- return Arrays.equals(mRawName, rhs.mRawName)
- && Arrays.equals(mXpanid, rhs.mXpanid)
- && mType.equals(rhs.mType)
- && mPanid == rhs.mPanid
- && mChannel == rhs.mChannel;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(
- Arrays.hashCode(mRawName), mType, Arrays.hashCode(mXpanid), mPanid, mChannel);
- }
-
- /** Implement the Parcelable interface. */
- @Override
- public int describeContents() {
- return 0;
- }
-
- /** Implement the Parcelable interface. */
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeByteArray(mRawName);
- dest.writeString(mType);
- dest.writeByteArray(mXpanid);
- dest.writeInt(mPanid);
- dest.writeInt(mChannel);
- }
-
- /** Implement the Parcelable interface. */
- public static final @android.annotation.NonNull Creator<LowpanIdentity> CREATOR =
- new Creator<LowpanIdentity>() {
-
- public LowpanIdentity createFromParcel(Parcel in) {
- Builder builder = new Builder();
-
- builder.setRawName(in.createByteArray());
- builder.setType(in.readString());
- builder.setXpanid(in.createByteArray());
- builder.setPanid(in.readInt());
- builder.setChannel(in.readInt());
-
- return builder.build();
- }
-
- public LowpanIdentity[] newArray(int size) {
- return new LowpanIdentity[size];
- }
- };
-}
diff --git a/lowpan/java/android/net/lowpan/LowpanInterface.java b/lowpan/java/android/net/lowpan/LowpanInterface.java
deleted file mode 100644
index 57e9135..0000000
--- a/lowpan/java/android/net/lowpan/LowpanInterface.java
+++ /dev/null
@@ -1,824 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.content.Context;
-import android.net.IpPrefix;
-import android.net.LinkAddress;
-import android.os.DeadObjectException;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.RemoteException;
-import android.os.ServiceSpecificException;
-import android.util.Log;
-import java.util.HashMap;
-
-/**
- * Class for managing a specific Low-power Wireless Personal Area Network (LoWPAN) interface.
- *
- * @hide
- */
-// @SystemApi
-public class LowpanInterface {
- private static final String TAG = LowpanInterface.class.getSimpleName();
-
- /** Detached role. The interface is not currently attached to a network. */
- public static final String ROLE_DETACHED = ILowpanInterface.ROLE_DETACHED;
-
- /** End-device role. End devices do not route traffic for other nodes. */
- public static final String ROLE_END_DEVICE = ILowpanInterface.ROLE_END_DEVICE;
-
- /** Router role. Routers help route traffic around the mesh network. */
- public static final String ROLE_ROUTER = ILowpanInterface.ROLE_ROUTER;
-
- /**
- * Sleepy End-Device role.
- *
- * <p>End devices with this role are nominally asleep, waking up periodically to check in with
- * their parent to see if there are packets destined for them. Such devices are capable of
- * extraordinarilly low power consumption, but packet latency can be on the order of dozens of
- * seconds(depending on how the node is configured).
- */
- public static final String ROLE_SLEEPY_END_DEVICE = ILowpanInterface.ROLE_SLEEPY_END_DEVICE;
-
- /**
- * Sleepy-router role.
- *
- * <p>Routers with this role are nominally asleep, waking up periodically to check in with other
- * routers and their children.
- */
- public static final String ROLE_SLEEPY_ROUTER = ILowpanInterface.ROLE_SLEEPY_ROUTER;
-
- /** TODO: doc */
- public static final String ROLE_LEADER = ILowpanInterface.ROLE_LEADER;
-
- /** TODO: doc */
- public static final String ROLE_COORDINATOR = ILowpanInterface.ROLE_COORDINATOR;
-
- /**
- * Offline state.
- *
- * <p>This is the initial state of the LoWPAN interface when the underlying driver starts. In
- * this state the NCP is idle and not connected to any network.
- *
- * <p>This state can be explicitly entered by calling {@link #reset()}, {@link #leave()}, or
- * <code>setUp(false)</code>, with the later two only working if we were not previously in the
- * {@link #STATE_FAULT} state.
- *
- * @see #getState()
- * @see #STATE_FAULT
- */
- public static final String STATE_OFFLINE = ILowpanInterface.STATE_OFFLINE;
-
- /**
- * Commissioning state.
- *
- * <p>The interface enters this state after a call to {@link #startCommissioningSession()}. This
- * state may only be entered directly from the {@link #STATE_OFFLINE} state.
- *
- * @see #startCommissioningSession()
- * @see #getState()
- * @hide
- */
- public static final String STATE_COMMISSIONING = ILowpanInterface.STATE_COMMISSIONING;
-
- /**
- * Attaching state.
- *
- * <p>The interface enters this state when it starts the process of trying to find other nodes
- * so that it can attach to any pre-existing network fragment, or when it is in the process of
- * calculating the optimal values for unspecified parameters when forming a new network.
- *
- * <p>The interface may stay in this state for a prolonged period of time (or may spontaneously
- * enter this state from {@link #STATE_ATTACHED}) if the underlying network technology is
- * heirarchical (like ZigBeeIP) or if the device role is that of an "end-device" ({@link
- * #ROLE_END_DEVICE} or {@link #ROLE_SLEEPY_END_DEVICE}). This is because such roles cannot
- * create their own network fragments.
- *
- * @see #STATE_ATTACHED
- * @see #getState()
- */
- public static final String STATE_ATTACHING = ILowpanInterface.STATE_ATTACHING;
-
- /**
- * Attached state.
- *
- * <p>The interface enters this state from {@link #STATE_ATTACHING} once it is actively
- * participating on a network fragment.
- *
- * @see #STATE_ATTACHING
- * @see #getState()
- */
- public static final String STATE_ATTACHED = ILowpanInterface.STATE_ATTACHED;
-
- /**
- * Fault state.
- *
- * <p>The interface will enter this state when the driver has detected some sort of problem from
- * which it was not immediately able to recover.
- *
- * <p>This state can be entered spontaneously from any other state. Calling {@link #reset} will
- * cause the device to return to the {@link #STATE_OFFLINE} state.
- *
- * @see #getState
- * @see #STATE_OFFLINE
- */
- public static final String STATE_FAULT = ILowpanInterface.STATE_FAULT;
-
- /**
- * Network type for Thread 1.x networks.
- *
- * @see android.net.lowpan.LowpanIdentity#getType
- * @see #getLowpanIdentity
- * @hide
- */
- public static final String NETWORK_TYPE_THREAD_V1 = ILowpanInterface.NETWORK_TYPE_THREAD_V1;
-
- public static final String EMPTY_PARTITION_ID = "";
-
- /**
- * Callback base class for LowpanInterface
- *
- * @hide
- */
- // @SystemApi
- public abstract static class Callback {
- public void onConnectedChanged(boolean value) {}
-
- public void onEnabledChanged(boolean value) {}
-
- public void onUpChanged(boolean value) {}
-
- public void onRoleChanged(@NonNull String value) {}
-
- public void onStateChanged(@NonNull String state) {}
-
- public void onLowpanIdentityChanged(@NonNull LowpanIdentity value) {}
-
- public void onLinkNetworkAdded(IpPrefix prefix) {}
-
- public void onLinkNetworkRemoved(IpPrefix prefix) {}
-
- public void onLinkAddressAdded(LinkAddress address) {}
-
- public void onLinkAddressRemoved(LinkAddress address) {}
- }
-
- private final ILowpanInterface mBinder;
- private final Looper mLooper;
- private final HashMap<Integer, ILowpanInterfaceListener> mListenerMap = new HashMap<>();
-
- /**
- * Create a new LowpanInterface instance. Applications will almost always want to use {@link
- * LowpanManager#getInterface LowpanManager.getInterface()} instead of this.
- *
- * @param context the application context
- * @param service the Binder interface
- * @param looper the Binder interface
- * @hide
- */
- public LowpanInterface(Context context, ILowpanInterface service, Looper looper) {
- /* We aren't currently using the context, but if we need
- * it later on we can easily add it to the class.
- */
-
- mBinder = service;
- mLooper = looper;
- }
-
- /**
- * Returns the ILowpanInterface object associated with this interface.
- *
- * @hide
- */
- public ILowpanInterface getService() {
- return mBinder;
- }
-
- // Public Actions
-
- /**
- * Form a new network with the given network information optional credential. Unspecified fields
- * in the network information will be filled in with reasonable values. If the network
- * credential is unspecified, one will be generated automatically.
- *
- * <p>This method will block until either the network was successfully formed or an error
- * prevents the network form being formed.
- *
- * <p>Upon success, the interface will be up and attached to the newly formed network.
- *
- * @see #join(LowpanProvision)
- */
- public void form(@NonNull LowpanProvision provision) throws LowpanException {
- try {
- mBinder.form(provision);
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- throw LowpanException.rethrowFromServiceSpecificException(x);
- }
- }
-
- /**
- * Attempts to join a new network with the given network information. This method will block
- * until either the network was successfully joined or an error prevented the network from being
- * formed. Upon success, the interface will be up and attached to the newly joined network.
- *
- * <p>Note that “joining” is distinct from “attaching”: Joining requires at least one other peer
- * device to be present in order for the operation to complete successfully.
- */
- public void join(@NonNull LowpanProvision provision) throws LowpanException {
- try {
- mBinder.join(provision);
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- throw LowpanException.rethrowFromServiceSpecificException(x);
- }
- }
-
- /**
- * Attaches to the network described by identity and credential. This is similar to {@link
- * #join}, except that (assuming the identity and credential are valid) it will always succeed
- * and provision the interface, even if there are no peers nearby.
- *
- * <p>This method will block execution until the operation has completed.
- */
- public void attach(@NonNull LowpanProvision provision) throws LowpanException {
- try {
- mBinder.attach(provision);
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- throw LowpanException.rethrowFromServiceSpecificException(x);
- }
- }
-
- /**
- * Bring down the network interface and forget all non-volatile details about the current
- * network.
- *
- * <p>This method will block execution until the operation has completed.
- */
- public void leave() throws LowpanException {
- try {
- mBinder.leave();
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- throw LowpanException.rethrowFromServiceSpecificException(x);
- }
- }
-
- /**
- * Start a new commissioning session. Will fail if the interface is attached to a network or if
- * the interface is disabled.
- */
- public @NonNull LowpanCommissioningSession startCommissioningSession(
- @NonNull LowpanBeaconInfo beaconInfo) throws LowpanException {
- try {
- mBinder.startCommissioningSession(beaconInfo);
-
- return new LowpanCommissioningSession(mBinder, beaconInfo, mLooper);
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- throw LowpanException.rethrowFromServiceSpecificException(x);
- }
- }
-
- /**
- * Reset this network interface as if it has been power cycled. Will bring the network interface
- * down if it was previously up. Will not erase any non-volatile settings.
- *
- * <p>This method will block execution until the operation has completed.
- *
- * @hide
- */
- public void reset() throws LowpanException {
- try {
- mBinder.reset();
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- throw LowpanException.rethrowFromServiceSpecificException(x);
- }
- }
-
- // Public Getters and Setters
-
- /** Returns the name of this network interface. */
- @NonNull
- public String getName() {
- try {
- return mBinder.getName();
-
- } catch (DeadObjectException x) {
- return "";
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
-
- /**
- * Indicates if the interface is enabled or disabled.
- *
- * @see #setEnabled
- * @see android.net.lowpan.LowpanException#LOWPAN_DISABLED
- */
- public boolean isEnabled() {
- try {
- return mBinder.isEnabled();
-
- } catch (DeadObjectException x) {
- return false;
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
-
- /**
- * Enables or disables the LoWPAN interface. When disabled, the interface is put into a
- * low-power state and all commands that require the NCP to be queried will fail with {@link
- * android.net.lowpan.LowpanException#LOWPAN_DISABLED}.
- *
- * @see #isEnabled
- * @see android.net.lowpan.LowpanException#LOWPAN_DISABLED
- * @hide
- */
- public void setEnabled(boolean enabled) throws LowpanException {
- try {
- mBinder.setEnabled(enabled);
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- throw LowpanException.rethrowFromServiceSpecificException(x);
- }
- }
-
- /**
- * Indicates if the network interface is up or down.
- *
- * @hide
- */
- public boolean isUp() {
- try {
- return mBinder.isUp();
-
- } catch (DeadObjectException x) {
- return false;
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
-
- /**
- * Indicates if there is at least one peer in range.
- *
- * @return <code>true</code> if we have at least one other peer in range, <code>false</code>
- * otherwise.
- */
- public boolean isConnected() {
- try {
- return mBinder.isConnected();
-
- } catch (DeadObjectException x) {
- return false;
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
-
- /**
- * Indicates if this interface is currently commissioned onto an existing network. If the
- * interface is commissioned, the interface may be brought up using setUp().
- */
- public boolean isCommissioned() {
- try {
- return mBinder.isCommissioned();
-
- } catch (DeadObjectException x) {
- return false;
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
-
- /**
- * Get interface state
- *
- * <h3>State Diagram</h3>
- *
- * <img src="LowpanInterface-1.png" />
- *
- * @return The current state of the interface.
- * @see #STATE_OFFLINE
- * @see #STATE_COMMISSIONING
- * @see #STATE_ATTACHING
- * @see #STATE_ATTACHED
- * @see #STATE_FAULT
- */
- public String getState() {
- try {
- return mBinder.getState();
-
- } catch (DeadObjectException x) {
- return STATE_FAULT;
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
-
- /** Get network partition/fragment identifier. */
- public String getPartitionId() {
- try {
- return mBinder.getPartitionId();
-
- } catch (DeadObjectException x) {
- return EMPTY_PARTITION_ID;
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
-
- /** TODO: doc */
- public LowpanIdentity getLowpanIdentity() {
- try {
- return mBinder.getLowpanIdentity();
-
- } catch (DeadObjectException x) {
- return new LowpanIdentity();
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
-
- /** TODO: doc */
- @NonNull
- public String getRole() {
- try {
- return mBinder.getRole();
-
- } catch (DeadObjectException x) {
- return ROLE_DETACHED;
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
-
- /** TODO: doc */
- @Nullable
- public LowpanCredential getLowpanCredential() {
- try {
- return mBinder.getLowpanCredential();
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
-
- public @NonNull String[] getSupportedNetworkTypes() throws LowpanException {
- try {
- return mBinder.getSupportedNetworkTypes();
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- throw LowpanException.rethrowFromServiceSpecificException(x);
- }
- }
-
- public @NonNull LowpanChannelInfo[] getSupportedChannels() throws LowpanException {
- try {
- return mBinder.getSupportedChannels();
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- throw LowpanException.rethrowFromServiceSpecificException(x);
- }
- }
-
- // Listener Support
-
- /**
- * Registers a subclass of {@link LowpanInterface.Callback} to receive events.
- *
- * @param cb Subclass of {@link LowpanInterface.Callback} which will receive events.
- * @param handler If not <code>null</code>, events will be dispatched via the given handler
- * object. If <code>null</code>, the thread upon which events will be dispatched is
- * unspecified.
- * @see #registerCallback(Callback)
- * @see #unregisterCallback(Callback)
- */
- public void registerCallback(@NonNull Callback cb, @Nullable Handler handler) {
- ILowpanInterfaceListener.Stub listenerBinder =
- new ILowpanInterfaceListener.Stub() {
- private Handler mHandler;
-
- {
- if (handler != null) {
- mHandler = handler;
- } else if (mLooper != null) {
- mHandler = new Handler(mLooper);
- } else {
- mHandler = new Handler();
- }
- }
-
- @Override
- public void onEnabledChanged(boolean value) {
- mHandler.post(() -> cb.onEnabledChanged(value));
- }
-
- @Override
- public void onConnectedChanged(boolean value) {
- mHandler.post(() -> cb.onConnectedChanged(value));
- }
-
- @Override
- public void onUpChanged(boolean value) {
- mHandler.post(() -> cb.onUpChanged(value));
- }
-
- @Override
- public void onRoleChanged(String value) {
- mHandler.post(() -> cb.onRoleChanged(value));
- }
-
- @Override
- public void onStateChanged(String value) {
- mHandler.post(() -> cb.onStateChanged(value));
- }
-
- @Override
- public void onLowpanIdentityChanged(LowpanIdentity value) {
- mHandler.post(() -> cb.onLowpanIdentityChanged(value));
- }
-
- @Override
- public void onLinkNetworkAdded(IpPrefix value) {
- mHandler.post(() -> cb.onLinkNetworkAdded(value));
- }
-
- @Override
- public void onLinkNetworkRemoved(IpPrefix value) {
- mHandler.post(() -> cb.onLinkNetworkRemoved(value));
- }
-
- @Override
- public void onLinkAddressAdded(String value) {
- LinkAddress la;
- try {
- la = new LinkAddress(value);
- } catch (IllegalArgumentException x) {
- Log.e(
- TAG,
- "onLinkAddressAdded: Bad LinkAddress \"" + value + "\", " + x);
- return;
- }
- mHandler.post(() -> cb.onLinkAddressAdded(la));
- }
-
- @Override
- public void onLinkAddressRemoved(String value) {
- LinkAddress la;
- try {
- la = new LinkAddress(value);
- } catch (IllegalArgumentException x) {
- Log.e(
- TAG,
- "onLinkAddressRemoved: Bad LinkAddress \""
- + value
- + "\", "
- + x);
- return;
- }
- mHandler.post(() -> cb.onLinkAddressRemoved(la));
- }
-
- @Override
- public void onReceiveFromCommissioner(byte[] packet) {
- // This is only used by the LowpanCommissioningSession.
- }
- };
- try {
- mBinder.addListener(listenerBinder);
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
-
- synchronized (mListenerMap) {
- mListenerMap.put(System.identityHashCode(cb), listenerBinder);
- }
- }
-
- /**
- * Registers a subclass of {@link LowpanInterface.Callback} to receive events.
- *
- * <p>The thread upon which events will be dispatched is unspecified.
- *
- * @param cb Subclass of {@link LowpanInterface.Callback} which will receive events.
- * @see #registerCallback(Callback, Handler)
- * @see #unregisterCallback(Callback)
- */
- public void registerCallback(Callback cb) {
- registerCallback(cb, null);
- }
-
- /**
- * Unregisters a previously registered callback class.
- *
- * @param cb Subclass of {@link LowpanInterface.Callback} which was previously registered to
- * receive events.
- * @see #registerCallback(Callback, Handler)
- * @see #registerCallback(Callback)
- */
- public void unregisterCallback(Callback cb) {
- int hashCode = System.identityHashCode(cb);
- synchronized (mListenerMap) {
- ILowpanInterfaceListener listenerBinder = mListenerMap.get(hashCode);
-
- if (listenerBinder != null) {
- mListenerMap.remove(hashCode);
-
- try {
- mBinder.removeListener(listenerBinder);
- } catch (DeadObjectException x) {
- // We ignore a dead object exception because that
- // pretty clearly means our callback isn't registered.
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
- }
- }
-
- // Active and Passive Scanning
-
- /**
- * Creates a new {@link android.net.lowpan.LowpanScanner} object for this interface.
- *
- * <p>This method allocates a new unique object for each call.
- *
- * @see android.net.lowpan.LowpanScanner
- */
- public @NonNull LowpanScanner createScanner() {
- return new LowpanScanner(mBinder);
- }
-
- // Route Management
-
- /**
- * Makes a copy of the internal list of LinkAddresses.
- *
- * @hide
- */
- public LinkAddress[] getLinkAddresses() throws LowpanException {
- try {
- String[] linkAddressStrings = mBinder.getLinkAddresses();
- LinkAddress[] ret = new LinkAddress[linkAddressStrings.length];
- int i = 0;
- for (String str : linkAddressStrings) {
- ret[i++] = new LinkAddress(str);
- }
- return ret;
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- throw LowpanException.rethrowFromServiceSpecificException(x);
- }
- }
-
- /**
- * Makes a copy of the internal list of networks reachable on via this link.
- *
- * @hide
- */
- public IpPrefix[] getLinkNetworks() throws LowpanException {
- try {
- return mBinder.getLinkNetworks();
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- throw LowpanException.rethrowFromServiceSpecificException(x);
- }
- }
-
- /**
- * Advertise the given IP prefix as an on-mesh prefix.
- *
- * @hide
- */
- public void addOnMeshPrefix(IpPrefix prefix, int flags) throws LowpanException {
- try {
- mBinder.addOnMeshPrefix(prefix, flags);
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- throw LowpanException.rethrowFromServiceSpecificException(x);
- }
- }
-
- /**
- * Remove an IP prefix previously advertised by this device from the list of advertised on-mesh
- * prefixes.
- *
- * @hide
- */
- public void removeOnMeshPrefix(IpPrefix prefix) {
- try {
- mBinder.removeOnMeshPrefix(prefix);
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- // Catch and ignore all service exceptions
- Log.e(TAG, x.toString());
- }
- }
-
- /**
- * Advertise this device to other devices on the mesh network as having a specific route to the
- * given network. This device will then receive forwarded traffic for that network.
- *
- * @hide
- */
- public void addExternalRoute(IpPrefix prefix, int flags) throws LowpanException {
- try {
- mBinder.addExternalRoute(prefix, flags);
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- throw LowpanException.rethrowFromServiceSpecificException(x);
- }
- }
-
- /**
- * Revoke a previously advertised specific route to the given network.
- *
- * @hide
- */
- public void removeExternalRoute(IpPrefix prefix) {
- try {
- mBinder.removeExternalRoute(prefix);
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- // Catch and ignore all service exceptions
- Log.e(TAG, x.toString());
- }
- }
-}
diff --git a/lowpan/java/android/net/lowpan/LowpanManager.java b/lowpan/java/android/net/lowpan/LowpanManager.java
deleted file mode 100644
index 33b35e6..0000000
--- a/lowpan/java/android/net/lowpan/LowpanManager.java
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.content.Context;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Looper;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-
-import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.os.BackgroundThread;
-
-import java.lang.ref.WeakReference;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-/**
- * Manager object for looking up LoWPAN interfaces.
- *
- * @hide
- */
-// @SystemApi
-public class LowpanManager {
- private static final String TAG = LowpanManager.class.getSimpleName();
-
- /** @hide */
- // @SystemApi
- public abstract static class Callback {
- public void onInterfaceAdded(LowpanInterface lowpanInterface) {}
-
- public void onInterfaceRemoved(LowpanInterface lowpanInterface) {}
- }
-
- private final Map<Integer, ILowpanManagerListener> mListenerMap = new HashMap<>();
- private final Map<String, LowpanInterface> mInterfaceCache = new HashMap<>();
-
- /* This is a WeakHashMap because we don't want to hold onto
- * a strong reference to ILowpanInterface, so that it can be
- * garbage collected if it isn't being used anymore. Since
- * the value class holds onto this specific ILowpanInterface,
- * we also need to have a weak reference to the value.
- * This design pattern allows us to skip removal of items
- * from this Map without leaking memory.
- */
- private final Map<IBinder, WeakReference<LowpanInterface>> mBinderCache =
- new WeakHashMap<>();
-
- private final ILowpanManager mService;
- private final Context mContext;
- private final Looper mLooper;
-
- // Static Methods
-
- public static LowpanManager from(Context context) {
- return (LowpanManager) context.getSystemService(Context.LOWPAN_SERVICE);
- }
-
- /** @hide */
- public static LowpanManager getManager() {
- IBinder binder = ServiceManager.getService(Context.LOWPAN_SERVICE);
-
- if (binder != null) {
- ILowpanManager service = ILowpanManager.Stub.asInterface(binder);
- return new LowpanManager(service);
- }
-
- return null;
- }
-
- // Constructors
-
- LowpanManager(ILowpanManager service) {
- mService = service;
- mContext = null;
- mLooper = null;
- }
-
- /**
- * Create a new LowpanManager instance. Applications will almost always want to use {@link
- * android.content.Context#getSystemService Context.getSystemService()} to retrieve the standard
- * {@link android.content.Context#LOWPAN_SERVICE Context.LOWPAN_SERVICE}.
- *
- * @param context the application context
- * @param service the Binder interface
- * @hide - hide this because it takes in a parameter of type ILowpanManager, which is a system
- * private class.
- */
- public LowpanManager(Context context, ILowpanManager service) {
- this(context, service, BackgroundThread.get().getLooper());
- }
-
- @VisibleForTesting
- public LowpanManager(Context context, ILowpanManager service, Looper looper) {
- mContext = context;
- mService = service;
- mLooper = looper;
- }
-
- /** @hide */
- @Nullable
- public LowpanInterface getInterfaceNoCreate(@NonNull ILowpanInterface ifaceService) {
- LowpanInterface iface = null;
-
- synchronized (mBinderCache) {
- if (mBinderCache.containsKey(ifaceService.asBinder())) {
- iface = mBinderCache.get(ifaceService.asBinder()).get();
- }
- }
-
- return iface;
- }
-
- /** @hide */
- @Nullable
- public LowpanInterface getInterface(@NonNull ILowpanInterface ifaceService) {
- LowpanInterface iface = null;
-
- try {
- synchronized (mBinderCache) {
- if (mBinderCache.containsKey(ifaceService.asBinder())) {
- iface = mBinderCache.get(ifaceService.asBinder()).get();
- }
-
- if (iface == null) {
- String ifaceName = ifaceService.getName();
-
- iface = new LowpanInterface(mContext, ifaceService, mLooper);
-
- synchronized (mInterfaceCache) {
- mInterfaceCache.put(iface.getName(), iface);
- }
-
- mBinderCache.put(ifaceService.asBinder(), new WeakReference(iface));
-
- /* Make sure we remove the object from the
- * interface cache if the associated service
- * dies.
- */
- ifaceService
- .asBinder()
- .linkToDeath(
- new IBinder.DeathRecipient() {
- @Override
- public void binderDied() {
- synchronized (mInterfaceCache) {
- LowpanInterface iface =
- mInterfaceCache.get(ifaceName);
-
- if ((iface != null)
- && (iface.getService() == ifaceService)) {
- mInterfaceCache.remove(ifaceName);
- }
- }
- }
- },
- 0);
- }
- }
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
-
- return iface;
- }
-
- /**
- * Returns a reference to the requested LowpanInterface object. If the given interface doesn't
- * exist, or it is not a LoWPAN interface, returns null.
- */
- @Nullable
- public LowpanInterface getInterface(@NonNull String name) {
- LowpanInterface iface = null;
-
- try {
- /* This synchronized block covers both branches of the enclosed
- * if() statement in order to avoid a race condition. Two threads
- * calling getInterface() with the same name would race to create
- * the associated LowpanInterface object, creating two of them.
- * Having the whole block be synchronized avoids that race.
- */
- synchronized (mInterfaceCache) {
- if (mInterfaceCache.containsKey(name)) {
- iface = mInterfaceCache.get(name);
-
- } else {
- ILowpanInterface ifaceService = mService.getInterface(name);
-
- if (ifaceService != null) {
- iface = getInterface(ifaceService);
- }
- }
- }
- } catch (RemoteException x) {
- throw x.rethrowFromSystemServer();
- }
-
- return iface;
- }
-
- /**
- * Returns a reference to the first registered LowpanInterface object. If there are no LoWPAN
- * interfaces registered, returns null.
- */
- @Nullable
- public LowpanInterface getInterface() {
- String[] ifaceList = getInterfaceList();
- if (ifaceList.length > 0) {
- return getInterface(ifaceList[0]);
- }
- return null;
- }
-
- /**
- * Returns a string array containing the names of LoWPAN interfaces. This list may contain fewer
- * interfaces if the calling process does not have permissions to see individual interfaces.
- */
- @NonNull
- public String[] getInterfaceList() {
- try {
- return mService.getInterfaceList();
- } catch (RemoteException x) {
- throw x.rethrowFromSystemServer();
- }
- }
-
- /**
- * Registers a callback object to receive notifications when LoWPAN interfaces are added or
- * removed.
- *
- * @hide
- */
- public void registerCallback(@NonNull Callback cb, @Nullable Handler handler)
- throws LowpanException {
- ILowpanManagerListener.Stub listenerBinder =
- new ILowpanManagerListener.Stub() {
- private Handler mHandler;
-
- {
- if (handler != null) {
- mHandler = handler;
- } else if (mLooper != null) {
- mHandler = new Handler(mLooper);
- } else {
- mHandler = new Handler();
- }
- }
-
- @Override
- public void onInterfaceAdded(ILowpanInterface ifaceService) {
- Runnable runnable =
- () -> {
- LowpanInterface iface = getInterface(ifaceService);
-
- if (iface != null) {
- cb.onInterfaceAdded(iface);
- }
- };
-
- mHandler.post(runnable);
- }
-
- @Override
- public void onInterfaceRemoved(ILowpanInterface ifaceService) {
- Runnable runnable =
- () -> {
- LowpanInterface iface = getInterfaceNoCreate(ifaceService);
-
- if (iface != null) {
- cb.onInterfaceRemoved(iface);
- }
- };
-
- mHandler.post(runnable);
- }
- };
- try {
- mService.addListener(listenerBinder);
- } catch (RemoteException x) {
- throw x.rethrowFromSystemServer();
- }
-
- synchronized (mListenerMap) {
- mListenerMap.put(Integer.valueOf(System.identityHashCode(cb)), listenerBinder);
- }
- }
-
- /** @hide */
- public void registerCallback(@NonNull Callback cb) throws LowpanException {
- registerCallback(cb, null);
- }
-
- /**
- * Unregisters a previously registered {@link LowpanManager.Callback} object.
- *
- * @hide
- */
- public void unregisterCallback(@NonNull Callback cb) {
- Integer hashCode = Integer.valueOf(System.identityHashCode(cb));
- ILowpanManagerListener listenerBinder = null;
-
- synchronized (mListenerMap) {
- listenerBinder = mListenerMap.get(hashCode);
- mListenerMap.remove(hashCode);
- }
-
- if (listenerBinder != null) {
- try {
- mService.removeListener(listenerBinder);
- } catch (RemoteException x) {
- throw x.rethrowFromSystemServer();
- }
- } else {
- throw new RuntimeException("Attempt to unregister an unknown callback");
- }
- }
-}
diff --git a/lowpan/java/android/net/lowpan/LowpanProperties.java b/lowpan/java/android/net/lowpan/LowpanProperties.java
deleted file mode 100644
index cc45ff85..0000000
--- a/lowpan/java/android/net/lowpan/LowpanProperties.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-/** {@hide} */
-public final class LowpanProperties {
-
- public static final LowpanProperty<int[]> KEY_CHANNEL_MASK =
- new LowpanStandardProperty("android.net.lowpan.property.CHANNEL_MASK", int[].class);
-
- public static final LowpanProperty<Integer> KEY_MAX_TX_POWER =
- new LowpanStandardProperty("android.net.lowpan.property.MAX_TX_POWER", Integer.class);
-
- /** @hide */
- private LowpanProperties() {}
-
- /** @hide */
- static final class LowpanStandardProperty<T> extends LowpanProperty<T> {
- private final String mName;
- private final Class<T> mType;
-
- LowpanStandardProperty(String name, Class<T> type) {
- mName = name;
- mType = type;
- }
-
- @Override
- public String getName() {
- return mName;
- }
-
- @Override
- public Class<T> getType() {
- return mType;
- }
-
- @Override
- public String toString() {
- return getName();
- }
- }
-}
diff --git a/lowpan/java/android/net/lowpan/LowpanProperty.java b/lowpan/java/android/net/lowpan/LowpanProperty.java
deleted file mode 100644
index 7f26986..0000000
--- a/lowpan/java/android/net/lowpan/LowpanProperty.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import java.util.Map;
-
-/** {@hide} */
-public abstract class LowpanProperty<T> {
- public abstract String getName();
-
- public abstract Class<T> getType();
-
- public void putInMap(Map map, T value) {
- map.put(getName(), value);
- }
-
- public T getFromMap(Map map) {
- return (T) map.get(getName());
- }
-}
diff --git a/lowpan/java/android/net/lowpan/LowpanProvision.aidl b/lowpan/java/android/net/lowpan/LowpanProvision.aidl
deleted file mode 100644
index 100e9dc..0000000
--- a/lowpan/java/android/net/lowpan/LowpanProvision.aidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright (C) 2017 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.lowpan;
-
-parcelable LowpanProvision cpp_header "android/net/lowpan/LowpanProvision.h";
diff --git a/lowpan/java/android/net/lowpan/LowpanProvision.java b/lowpan/java/android/net/lowpan/LowpanProvision.java
deleted file mode 100644
index 68c8709..0000000
--- a/lowpan/java/android/net/lowpan/LowpanProvision.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.os.Parcel;
-import android.os.Parcelable;
-import java.util.Objects;
-
-/**
- * Describes the information needed to describe a network
- *
- * @hide
- */
-// @SystemApi
-public class LowpanProvision implements Parcelable {
-
- // Builder
-
- /** @hide */
- // @SystemApi
- public static class Builder {
- private final LowpanProvision provision = new LowpanProvision();
-
- public Builder setLowpanIdentity(@NonNull LowpanIdentity identity) {
- provision.mIdentity = identity;
- return this;
- }
-
- public Builder setLowpanCredential(@NonNull LowpanCredential credential) {
- provision.mCredential = credential;
- return this;
- }
-
- public LowpanProvision build() {
- return provision;
- }
- }
-
- private LowpanProvision() {}
-
- // Instance Variables
-
- private LowpanIdentity mIdentity = new LowpanIdentity();
- private LowpanCredential mCredential = null;
-
- // Public Getters and Setters
-
- @NonNull
- public LowpanIdentity getLowpanIdentity() {
- return mIdentity;
- }
-
- @Nullable
- public LowpanCredential getLowpanCredential() {
- return mCredential;
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
-
- sb.append("LowpanProvision { identity => ").append(mIdentity.toString());
-
- if (mCredential != null) {
- sb.append(", credential => ").append(mCredential.toString());
- }
-
- sb.append("}");
-
- return sb.toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(mIdentity, mCredential);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof LowpanProvision)) {
- return false;
- }
- LowpanProvision rhs = (LowpanProvision) obj;
-
- if (!mIdentity.equals(rhs.mIdentity)) {
- return false;
- }
-
- if (!Objects.equals(mCredential, rhs.mCredential)) {
- return false;
- }
-
- return true;
- }
-
- /** Implement the Parcelable interface. */
- @Override
- public int describeContents() {
- return 0;
- }
-
- /** Implement the Parcelable interface. */
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- mIdentity.writeToParcel(dest, flags);
- if (mCredential == null) {
- dest.writeBoolean(false);
- } else {
- dest.writeBoolean(true);
- mCredential.writeToParcel(dest, flags);
- }
- }
-
- /** Implement the Parcelable interface. */
- public static final @android.annotation.NonNull Creator<LowpanProvision> CREATOR =
- new Creator<LowpanProvision>() {
- public LowpanProvision createFromParcel(Parcel in) {
- Builder builder = new Builder();
-
- builder.setLowpanIdentity(LowpanIdentity.CREATOR.createFromParcel(in));
-
- if (in.readBoolean()) {
- builder.setLowpanCredential(LowpanCredential.CREATOR.createFromParcel(in));
- }
-
- return builder.build();
- }
-
- public LowpanProvision[] newArray(int size) {
- return new LowpanProvision[size];
- }
- };
-};
diff --git a/lowpan/java/android/net/lowpan/LowpanRuntimeException.java b/lowpan/java/android/net/lowpan/LowpanRuntimeException.java
deleted file mode 100644
index 71a5a13..0000000
--- a/lowpan/java/android/net/lowpan/LowpanRuntimeException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import android.util.AndroidRuntimeException;
-
-/**
- * Generic runtime exception for LoWPAN operations.
- *
- * @hide
- */
-// @SystemApi
-public class LowpanRuntimeException extends AndroidRuntimeException {
-
- public LowpanRuntimeException() {}
-
- public LowpanRuntimeException(String message) {
- super(message);
- }
-
- public LowpanRuntimeException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public LowpanRuntimeException(Exception cause) {
- super(cause);
- }
-}
diff --git a/lowpan/java/android/net/lowpan/LowpanScanner.java b/lowpan/java/android/net/lowpan/LowpanScanner.java
deleted file mode 100644
index 59156c4..0000000
--- a/lowpan/java/android/net/lowpan/LowpanScanner.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.os.Handler;
-import android.os.RemoteException;
-import android.os.ServiceSpecificException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * LoWPAN Scanner
- *
- * <p>This class allows performing network (active) scans and energy (passive) scans.
- *
- * @see LowpanInterface
- * @hide
- */
-// @SystemApi
-public class LowpanScanner {
- private static final String TAG = LowpanScanner.class.getSimpleName();
-
- // Public Classes
-
- /**
- * Callback base class for LowpanScanner
- *
- * @hide
- */
- // @SystemApi
- public abstract static class Callback {
- public void onNetScanBeacon(LowpanBeaconInfo beacon) {}
-
- public void onEnergyScanResult(LowpanEnergyScanResult result) {}
-
- public void onScanFinished() {}
- }
-
- // Instance Variables
-
- private ILowpanInterface mBinder;
- private Callback mCallback = null;
- private Handler mHandler = null;
- private ArrayList<Integer> mChannelMask = null;
- private int mTxPower = Integer.MAX_VALUE;
-
- // Constructors/Accessors and Exception Glue
-
- LowpanScanner(@NonNull ILowpanInterface binder) {
- mBinder = binder;
- }
-
- /** Sets an instance of {@link LowpanScanner.Callback} to receive events. */
- public synchronized void setCallback(@Nullable Callback cb, @Nullable Handler handler) {
- mCallback = cb;
- mHandler = handler;
- }
-
- /** Sets an instance of {@link LowpanScanner.Callback} to receive events. */
- public void setCallback(@Nullable Callback cb) {
- setCallback(cb, null);
- }
-
- /**
- * Sets the channel mask to use when scanning.
- *
- * @param mask The channel mask to use when scanning. If <code>null</code>, any previously set
- * channel mask will be cleared and all channels not masked by the current regulatory zone
- * will be scanned.
- */
- public void setChannelMask(@Nullable Collection<Integer> mask) {
- if (mask == null) {
- mChannelMask = null;
- } else {
- if (mChannelMask == null) {
- mChannelMask = new ArrayList<>();
- } else {
- mChannelMask.clear();
- }
- mChannelMask.addAll(mask);
- }
- }
-
- /**
- * Gets the current channel mask.
- *
- * @return the current channel mask, or <code>null</code> if no channel mask is currently set.
- */
- public @Nullable Collection<Integer> getChannelMask() {
- return (Collection<Integer>) mChannelMask.clone();
- }
-
- /**
- * Adds a channel to the channel mask used for scanning.
- *
- * <p>If a channel mask was previously <code>null</code>, a new one is created containing only
- * this channel. May be called multiple times to add additional channels ot the channel mask.
- *
- * @see #setChannelMask
- * @see #getChannelMask
- * @see #getTxPower
- */
- public void addChannel(int channel) {
- if (mChannelMask == null) {
- mChannelMask = new ArrayList<>();
- }
- mChannelMask.add(Integer.valueOf(channel));
- }
-
- /**
- * Sets the maximum transmit power to be used for active scanning.
- *
- * <p>The actual transmit power used is the lesser of this value and the currently configured
- * maximum transmit power for the interface.
- *
- * @see #getTxPower
- */
- public void setTxPower(int txPower) {
- mTxPower = txPower;
- }
-
- /**
- * Gets the maximum transmit power used for active scanning.
- *
- * @see #setTxPower
- */
- public int getTxPower() {
- return mTxPower;
- }
-
- private Map<String, Object> createScanOptionMap() {
- Map<String, Object> map = new HashMap();
-
- if (mChannelMask != null) {
- LowpanProperties.KEY_CHANNEL_MASK.putInMap(
- map, mChannelMask.stream().mapToInt(i -> i).toArray());
- }
-
- if (mTxPower != Integer.MAX_VALUE) {
- LowpanProperties.KEY_MAX_TX_POWER.putInMap(map, Integer.valueOf(mTxPower));
- }
-
- return map;
- }
-
- /**
- * Start a network scan.
- *
- * <p>This method will return once the scan has started.
- *
- * @see #stopNetScan
- */
- public void startNetScan() throws LowpanException {
- Map<String, Object> map = createScanOptionMap();
-
- ILowpanNetScanCallback binderListener =
- new ILowpanNetScanCallback.Stub() {
- public void onNetScanBeacon(LowpanBeaconInfo beaconInfo) {
- Callback callback;
- Handler handler;
-
- synchronized (LowpanScanner.this) {
- callback = mCallback;
- handler = mHandler;
- }
-
- if (callback == null) {
- return;
- }
-
- Runnable runnable = () -> callback.onNetScanBeacon(beaconInfo);
-
- if (handler != null) {
- handler.post(runnable);
- } else {
- runnable.run();
- }
- }
-
- public void onNetScanFinished() {
- Callback callback;
- Handler handler;
-
- synchronized (LowpanScanner.this) {
- callback = mCallback;
- handler = mHandler;
- }
-
- if (callback == null) {
- return;
- }
-
- Runnable runnable = () -> callback.onScanFinished();
-
- if (handler != null) {
- handler.post(runnable);
- } else {
- runnable.run();
- }
- }
- };
-
- try {
- mBinder.startNetScan(map, binderListener);
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- throw LowpanException.rethrowFromServiceSpecificException(x);
- }
- }
-
- /**
- * Stop a network scan currently in progress.
- *
- * @see #startNetScan
- */
- public void stopNetScan() {
- try {
- mBinder.stopNetScan();
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
-
- /**
- * Start an energy scan.
- *
- * <p>This method will return once the scan has started.
- *
- * @see #stopEnergyScan
- */
- public void startEnergyScan() throws LowpanException {
- Map<String, Object> map = createScanOptionMap();
-
- ILowpanEnergyScanCallback binderListener =
- new ILowpanEnergyScanCallback.Stub() {
- public void onEnergyScanResult(int channel, int rssi) {
- Callback callback = mCallback;
- Handler handler = mHandler;
-
- if (callback == null) {
- return;
- }
-
- Runnable runnable =
- () -> {
- if (callback != null) {
- LowpanEnergyScanResult result =
- new LowpanEnergyScanResult();
- result.setChannel(channel);
- result.setMaxRssi(rssi);
- callback.onEnergyScanResult(result);
- }
- };
-
- if (handler != null) {
- handler.post(runnable);
- } else {
- runnable.run();
- }
- }
-
- public void onEnergyScanFinished() {
- Callback callback = mCallback;
- Handler handler = mHandler;
-
- if (callback == null) {
- return;
- }
-
- Runnable runnable = () -> callback.onScanFinished();
-
- if (handler != null) {
- handler.post(runnable);
- } else {
- runnable.run();
- }
- }
- };
-
- try {
- mBinder.startEnergyScan(map, binderListener);
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
-
- } catch (ServiceSpecificException x) {
- throw LowpanException.rethrowFromServiceSpecificException(x);
- }
- }
-
- /**
- * Stop an energy scan currently in progress.
- *
- * @see #startEnergyScan
- */
- public void stopEnergyScan() {
- try {
- mBinder.stopEnergyScan();
-
- } catch (RemoteException x) {
- throw x.rethrowAsRuntimeException();
- }
- }
-}
diff --git a/lowpan/java/android/net/lowpan/NetworkAlreadyExistsException.java b/lowpan/java/android/net/lowpan/NetworkAlreadyExistsException.java
deleted file mode 100644
index 90ef498..0000000
--- a/lowpan/java/android/net/lowpan/NetworkAlreadyExistsException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-/**
- * Exception indicating the form operation found a network nearby with the same identity.
- *
- * @see LowpanInterface
- * @hide
- */
-// @SystemApi
-public class NetworkAlreadyExistsException extends LowpanException {
-
- public NetworkAlreadyExistsException() {}
-
- public NetworkAlreadyExistsException(String message) {
- super(message, null);
- }
-
- public NetworkAlreadyExistsException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public NetworkAlreadyExistsException(Exception cause) {
- super(cause);
- }
-}
diff --git a/lowpan/java/android/net/lowpan/OperationCanceledException.java b/lowpan/java/android/net/lowpan/OperationCanceledException.java
deleted file mode 100644
index fcafe3a..0000000
--- a/lowpan/java/android/net/lowpan/OperationCanceledException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-/**
- * Exception indicating this operation was canceled by the driver before it could finish.
- *
- * @see LowpanInterface
- * @hide
- */
-// @SystemApi
-public class OperationCanceledException extends LowpanException {
-
- public OperationCanceledException() {}
-
- public OperationCanceledException(String message) {
- super(message);
- }
-
- public OperationCanceledException(String message, Throwable cause) {
- super(message, cause);
- }
-
- protected OperationCanceledException(Exception cause) {
- super(cause);
- }
-}
diff --git a/lowpan/java/android/net/lowpan/WrongStateException.java b/lowpan/java/android/net/lowpan/WrongStateException.java
deleted file mode 100644
index 3565419..0000000
--- a/lowpan/java/android/net/lowpan/WrongStateException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-/**
- * Exception indicating the interface is the wrong state for an operation.
- *
- * @see LowpanInterface
- * @hide
- */
-// @SystemApi
-public class WrongStateException extends LowpanException {
-
- public WrongStateException() {}
-
- public WrongStateException(String message) {
- super(message);
- }
-
- public WrongStateException(String message, Throwable cause) {
- super(message, cause);
- }
-
- protected WrongStateException(Exception cause) {
- super(cause);
- }
-}
diff --git a/lowpan/java/android/net/lowpan/package.html b/lowpan/java/android/net/lowpan/package.html
deleted file mode 100644
index 342e32e..0000000
--- a/lowpan/java/android/net/lowpan/package.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<HTML>
-<BODY>
-<p>@SystemApi</p>
-<!-- @hide -->
-<p>Provides classes to manage Low-power Wireless Personal Area Network (LoWPAN) functionality on the device.
-Examples of such network technologies include <a href="http://threadgroup.org/">Thread</a> and
-<a href="http://www.zigbee.org/zigbee-for-developers/network-specifications/zigbeeip/">ZigBee IP</a>.</p>
-<p>The LoWPAN APIs provide a means by which applications can communicate
-with the lower-level wireless stack that provides LoWPAN network access.</p>
-
-<p>Some APIs may require the following user permissions:</p>
-<ul>
- <li>{@link android.Manifest.permission#ACCESS_LOWPAN_STATE}</li>
- <li>{@link android.Manifest.permission#CHANGE_LOWPAN_STATE}</li>
- <li>TBD</li>
-</ul>
-
-<p class="note"><strong>Note:</strong> Not all Android-powered devices provide LoWPAN functionality.
-If your application uses these APIs, declare so with a <a
-href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a>
-element in the manifest file:</p>
-<pre>
-<manifest ...>
- <uses-feature android:name="android.hardware.lowpan" />
- ...
-</manifest>
-</pre>
-</BODY>
-</HTML>
diff --git a/lowpan/tests/Android.bp b/lowpan/tests/Android.bp
deleted file mode 100644
index 5908929..0000000
--- a/lowpan/tests/Android.bp
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2017 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.
-
-// Make test APK
-// ============================================================
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "frameworks_base_license"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- default_applicable_licenses: ["frameworks_base_license"],
-}
-
-android_test {
- name: "FrameworksLowpanApiTests",
- srcs: ["**/*.java"],
- // Filter all src files to just java files
- jacoco: {
- include_filter: ["android.net.lowpan.*"],
- exclude_filter: [
- "android.net.lowpan.LowpanInterfaceTest*",
- "android.net.lowpan.LowpanManagerTest*",
- ],
- },
- static_libs: [
- "androidx.test.rules",
- "guava",
- "mockito-target-minus-junit4",
- "frameworks-base-testutils",
- ],
- libs: [
- "android.test.runner",
- "android.test.base",
- ],
- platform_apis: true,
- test_suites: ["device-tests"],
- certificate: "platform",
-}
diff --git a/lowpan/tests/AndroidManifest.xml b/lowpan/tests/AndroidManifest.xml
deleted file mode 100644
index 8e68fc7..0000000
--- a/lowpan/tests/AndroidManifest.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- ~ Copyright (C) 2017 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
- -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="android.net.lowpan.test">
-
- <application>
- <uses-library android:name="android.test.runner" />
- <activity android:label="LowpanTestDummyLabel"
- android:name="LowpanTestDummyName"
- android:exported="true">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- </activity>
- </application>
-
- <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
- android:targetPackage="android.net.lowpan.test"
- android:label="Frameworks LoWPAN API Tests">
- </instrumentation>
-
-</manifest>
diff --git a/lowpan/tests/AndroidTest.xml b/lowpan/tests/AndroidTest.xml
deleted file mode 100644
index 978cc02..0000000
--- a/lowpan/tests/AndroidTest.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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.
--->
-<configuration description="Runs Frameworks LoWPAN API Tests.">
- <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
- <option name="test-file-name" value="FrameworksLowpanApiTests.apk" />
- </target_preparer>
-
- <option name="test-suite-tag" value="apct" />
- <option name="test-tag" value="FrameworksLowpanApiTests" />
- <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
- <option name="package" value="android.net.lowpan.test" />
- <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
- </test>
-</configuration>
diff --git a/lowpan/tests/README.md b/lowpan/tests/README.md
deleted file mode 100644
index cb5772e..0000000
--- a/lowpan/tests/README.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# LoWPAN Unit Tests
-This package contains unit tests for the android LoWPAN framework System APIs based on the
-[Android Testing Support Library](http://developer.android.com/tools/testing-support-library/index.html).
-The test cases are built using the [JUnit](http://junit.org/) and [Mockito](http://mockito.org/)
-libraries.
-
-## Running Tests
-The easiest way to run tests is simply run
-
-```
-frameworks/base/lowpan/tests/runtests.sh
-```
-
-`runtests.sh` will build the test project and all of its dependencies and push the APK to the
-connected device. It will then run the tests on the device.
-
-To pick up changes in framework/base, you will need to:
-1. rebuild the framework library 'make -j32'
-2. sync over the updated library to the device 'adb sync'
-3. restart framework on the device 'adb shell stop' then 'adb shell start'
-
-To enable syncing data to the device for first time after clean reflash:
-1. adb disable-verity
-2. adb reboot
-3. adb remount
-
-See below for a few example of options to limit which tests are run.
-See the
-[AndroidJUnitRunner Documentation](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html)
-for more details on the supported options.
-
-```
-runtests.sh -e package android.net.lowpan
-runtests.sh -e class android.net.lowpan.LowpanManagerTest
-```
-
-If you manually build and push the test APK to the device you can run tests using
-
-```
-adb shell am instrument -w 'android.net.wifi.test/androidx.test.runner.AndroidJUnitRunner'
-```
-
-## Adding Tests
-Tests can be added by adding classes to the src directory. JUnit4 style test cases can
-be written by simply annotating test methods with `org.junit.Test`.
-
-## Debugging Tests
-If you are trying to debug why tests are not doing what you expected, you can add android log
-statements and use logcat to view them. The beginning and end of every tests is automatically logged
-with the tag `TestRunner`.
diff --git a/lowpan/tests/runtests.sh b/lowpan/tests/runtests.sh
deleted file mode 100755
index 8267a79..0000000
--- a/lowpan/tests/runtests.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env bash
-
-if [ -z $ANDROID_BUILD_TOP ]; then
- echo "You need to source and lunch before you can use this script"
- exit 1
-fi
-
-echo "Running tests"
-
-set -e # fail early
-
-echo "+ mmma -j32 $ANDROID_BUILD_TOP/frameworks/base/lowpan/tests"
-# NOTE Don't actually run the command above since this shell doesn't inherit functions from the
-# caller.
-make -j32 -C $ANDROID_BUILD_TOP -f build/core/main.mk MODULES-IN-frameworks-base-lowpan-tests
-
-set -x # print commands
-
-adb root
-adb wait-for-device
-
-adb install -r -g "$OUT/data/app/FrameworksLowpanApiTests/FrameworksLowpanApiTests.apk"
-
-adb shell am instrument -w "$@" 'android.net.lowpan.test/androidx.test.runner.AndroidJUnitRunner'
diff --git a/lowpan/tests/src/android/net/lowpan/LowpanInterfaceTest.java b/lowpan/tests/src/android/net/lowpan/LowpanInterfaceTest.java
deleted file mode 100644
index 86f9d0e..0000000
--- a/lowpan/tests/src/android/net/lowpan/LowpanInterfaceTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import static org.mockito.Mockito.*;
-
-import android.content.Context;
-import android.content.pm.ApplicationInfo;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.test.TestLooper;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.util.Map;
-
-/** Unit tests for android.net.lowpan.LowpanInterface. */
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class LowpanInterfaceTest {
- private static final String TEST_PACKAGE_NAME = "TestPackage";
-
- @Mock Context mContext;
- @Mock ILowpanInterface mLowpanInterfaceService;
- @Mock IBinder mLowpanInterfaceBinder;
- @Mock ApplicationInfo mApplicationInfo;
- @Mock IBinder mAppBinder;
- @Mock LowpanInterface.Callback mLowpanInterfaceCallback;
-
- private Handler mHandler;
- private final TestLooper mTestLooper = new TestLooper();
- private ILowpanInterfaceListener mInterfaceListener;
- private LowpanInterface mLowpanInterface;
- private Map<String, Object> mPropertyMap;
-
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- when(mContext.getApplicationInfo()).thenReturn(mApplicationInfo);
- when(mContext.getOpPackageName()).thenReturn(TEST_PACKAGE_NAME);
- when(mLowpanInterfaceService.getName()).thenReturn("wpan0");
- when(mLowpanInterfaceService.asBinder()).thenReturn(mLowpanInterfaceBinder);
-
- mLowpanInterface =
- new LowpanInterface(mContext, mLowpanInterfaceService, mTestLooper.getLooper());
- }
-
- @Test
- public void testStateChangedCallback() throws Exception {
- // Register our callback
- mLowpanInterface.registerCallback(mLowpanInterfaceCallback);
-
- // Verify a listener was added
- verify(mLowpanInterfaceService)
- .addListener(
- argThat(
- listener -> {
- mInterfaceListener = listener;
- return listener instanceof ILowpanInterfaceListener;
- }));
-
- // Change some properties
- mInterfaceListener.onStateChanged(LowpanInterface.STATE_OFFLINE);
- mTestLooper.dispatchAll();
-
- // Verify that the property was changed
- verify(mLowpanInterfaceCallback)
- .onStateChanged(
- argThat(stateString -> stateString.equals(LowpanInterface.STATE_OFFLINE)));
- }
-}
diff --git a/lowpan/tests/src/android/net/lowpan/LowpanManagerTest.java b/lowpan/tests/src/android/net/lowpan/LowpanManagerTest.java
deleted file mode 100644
index 998e8a5..0000000
--- a/lowpan/tests/src/android/net/lowpan/LowpanManagerTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2017 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.lowpan;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.*;
-
-import android.content.Context;
-import android.content.pm.ApplicationInfo;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.test.TestLooper;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-/** Unit tests for android.net.lowpan.LowpanManager. */
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class LowpanManagerTest {
- private static final String TEST_PACKAGE_NAME = "TestPackage";
-
- @Mock Context mContext;
- @Mock ILowpanManager mLowpanService;
- @Mock ILowpanInterface mLowpanInterfaceService;
- @Mock IBinder mLowpanInterfaceBinder;
- @Mock ApplicationInfo mApplicationInfo;
- @Mock IBinder mAppBinder;
- @Mock LowpanManager.Callback mLowpanManagerCallback;
-
- private Handler mHandler;
- private final TestLooper mTestLooper = new TestLooper();
- private LowpanManager mLowpanManager;
-
- private ILowpanManagerListener mManagerListener;
- private LowpanInterface mLowpanInterface;
-
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- when(mContext.getApplicationInfo()).thenReturn(mApplicationInfo);
- when(mContext.getOpPackageName()).thenReturn(TEST_PACKAGE_NAME);
-
- mLowpanManager = new LowpanManager(mContext, mLowpanService, mTestLooper.getLooper());
- }
-
- @Test
- public void testGetEmptyInterfaceList() throws Exception {
- when(mLowpanService.getInterfaceList()).thenReturn(new String[0]);
- assertTrue(mLowpanManager.getInterfaceList().length == 0);
- assertTrue(mLowpanManager.getInterface() == null);
- }
-
- @Test
- public void testGetInterfaceList() throws Exception {
- when(mLowpanService.getInterfaceList()).thenReturn(new String[] {"wpan0"});
- when(mLowpanService.getInterface("wpan0")).thenReturn(mLowpanInterfaceService);
- when(mLowpanInterfaceService.getName()).thenReturn("wpan0");
- when(mLowpanInterfaceService.asBinder()).thenReturn(mLowpanInterfaceBinder);
- assertEquals(mLowpanManager.getInterfaceList().length, 1);
-
- LowpanInterface iface = mLowpanManager.getInterface();
- assertNotNull(iface);
- assertEquals(iface.getName(), "wpan0");
- }
-
- @Test
- public void testRegisterCallback() throws Exception {
- when(mLowpanInterfaceService.getName()).thenReturn("wpan0");
- when(mLowpanInterfaceService.asBinder()).thenReturn(mLowpanInterfaceBinder);
-
- // Register our callback
- mLowpanManager.registerCallback(mLowpanManagerCallback);
-
- // Verify a listener was added
- verify(mLowpanService)
- .addListener(
- argThat(
- listener -> {
- mManagerListener = listener;
- return listener instanceof ILowpanManagerListener;
- }));
-
- // Add an interface
- mManagerListener.onInterfaceAdded(mLowpanInterfaceService);
- mTestLooper.dispatchAll();
-
- // Verify that the interface was added
- verify(mLowpanManagerCallback)
- .onInterfaceAdded(
- argThat(
- iface -> {
- mLowpanInterface = iface;
- return iface instanceof LowpanInterface;
- }));
- verifyNoMoreInteractions(mLowpanManagerCallback);
-
- // This check causes the test to fail with a weird error, but I'm not sure why.
- assertEquals(mLowpanInterface.getService(), mLowpanInterfaceService);
-
- // Verify that calling getInterface on the LowpanManager object will yield the same
- // LowpanInterface object.
- when(mLowpanService.getInterfaceList()).thenReturn(new String[] {"wpan0"});
- when(mLowpanService.getInterface("wpan0")).thenReturn(mLowpanInterfaceService);
- assertEquals(mLowpanManager.getInterface(), mLowpanInterface);
-
- // Remove the service
- mManagerListener.onInterfaceRemoved(mLowpanInterfaceService);
- mTestLooper.dispatchAll();
-
- // Verify that the interface was removed
- verify(mLowpanManagerCallback).onInterfaceRemoved(mLowpanInterface);
- }
-
- @Test
- public void testUnregisterCallback() throws Exception {
- when(mLowpanInterfaceService.getName()).thenReturn("wpan0");
- when(mLowpanInterfaceService.asBinder()).thenReturn(mLowpanInterfaceBinder);
-
- // Register our callback
- mLowpanManager.registerCallback(mLowpanManagerCallback);
-
- // Verify a listener was added
- verify(mLowpanService)
- .addListener(
- argThat(
- listener -> {
- mManagerListener = listener;
- return listener instanceof ILowpanManagerListener;
- }));
-
- // Add an interface
- mManagerListener.onInterfaceAdded(mLowpanInterfaceService);
- mTestLooper.dispatchAll();
-
- // Verify that the interface was added
- verify(mLowpanManagerCallback)
- .onInterfaceAdded(
- argThat(
- iface -> {
- mLowpanInterface = iface;
- return iface instanceof LowpanInterface;
- }));
- verifyNoMoreInteractions(mLowpanManagerCallback);
-
- // Unregister our callback
- mLowpanManager.unregisterCallback(mLowpanManagerCallback);
-
- // Verify the listener was removed
- verify(mLowpanService).removeListener(mManagerListener);
-
- // Verify that the callback wasn't invoked.
- verifyNoMoreInteractions(mLowpanManagerCallback);
- }
-}
diff --git a/packages/SystemUI/OWNERS b/packages/SystemUI/OWNERS
index 7076ad9..9ef772e 100644
--- a/packages/SystemUI/OWNERS
+++ b/packages/SystemUI/OWNERS
@@ -13,7 +13,7 @@
brockman@google.com
brzezinski@google.com
brycelee@google.com
-ccassidy@google.com
+caitlinshk@google.com
chrisgollner@google.com
dupin@google.com
ethibodeau@google.com
diff --git a/proto/src/system_messages.proto b/proto/src/system_messages.proto
index b87773b..66ae435 100644
--- a/proto/src/system_messages.proto
+++ b/proto/src/system_messages.proto
@@ -290,6 +290,10 @@
// Package: android
NOTE_REVIEW_NOTIFICATION_PERMISSIONS = 71;
+ // Inform the user of wifi apm state changes.
+ // Package: android
+ NOTE_WIFI_APM_NOTIFICATION = 73;
+
// Inform the user of bluetooth apm state changes.
// Package: android
NOTE_BT_APM_NOTIFICATION = 74;
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 2fedc99..c5c4553 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -339,7 +339,7 @@
private int[] mDataConnectionNetworkType;
- private ArrayList<List<CellInfo>> mCellInfo = null;
+ private ArrayList<List<CellInfo>> mCellInfo;
private Map<Integer, List<EmergencyNumber>> mEmergencyNumberList;
@@ -725,7 +725,7 @@
mMessageWaiting[i] = false;
mCallForwarding[i] = false;
mCellIdentity[i] = null;
- mCellInfo.add(i, null);
+ mCellInfo.add(i, Collections.EMPTY_LIST);
mImsReasonInfo.add(i, null);
mSrvccState[i] = TelephonyManager.SRVCC_STATE_HANDOVER_NONE;
mCallDisconnectCause[i] = DisconnectCause.NOT_VALID;
@@ -802,7 +802,7 @@
mCallNetworkType = new int[numPhones];
mCallAttributes = new CallAttributes[numPhones];
mPreciseDataConnectionStates = new ArrayList<>();
- mCellInfo = new ArrayList<>();
+ mCellInfo = new ArrayList<>(numPhones);
mImsReasonInfo = new ArrayList<>();
mEmergencyNumberList = new HashMap<>();
mOutgoingCallEmergencyNumber = new EmergencyNumber[numPhones];
@@ -832,7 +832,7 @@
mMessageWaiting[i] = false;
mCallForwarding[i] = false;
mCellIdentity[i] = null;
- mCellInfo.add(i, null);
+ mCellInfo.add(i, Collections.EMPTY_LIST);
mImsReasonInfo.add(i, null);
mSrvccState[i] = TelephonyManager.SRVCC_STATE_HANDOVER_NONE;
mCallDisconnectCause[i] = DisconnectCause.NOT_VALID;
@@ -1794,10 +1794,17 @@
if (!checkNotifyPermission("notifyCellInfoForSubscriber()")) {
return;
}
+
if (VDBG) {
log("notifyCellInfoForSubscriber: subId=" + subId
+ " cellInfo=" + cellInfo);
}
+
+ if (cellInfo == null) {
+ loge("notifyCellInfoForSubscriber() received a null list");
+ cellInfo = Collections.EMPTY_LIST;
+ }
+
int phoneId = getPhoneIdFromSubId(subId);
synchronized (mRecords) {
if (validatePhoneId(phoneId)) {
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index 931c692..9cb1f1d 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -756,6 +756,8 @@
int errorCode, @NonNull final String packageName, @Nullable final String sessionKey,
@NonNull final VpnProfileState profileState, @Nullable final Network underlyingNetwork,
@Nullable final NetworkCapabilities nc, @Nullable final LinkProperties lp) {
+ // Add log for debugging flaky test. b/242833779
+ Log.d(TAG, "buildVpnManagerEventIntent: sessionKey = " + sessionKey);
final Intent intent = new Intent(VpnManager.ACTION_VPN_MANAGER_EVENT);
intent.setPackage(packageName);
intent.addCategory(category);
@@ -1110,7 +1112,7 @@
// Except for Settings and VpnDialogs, the caller should be matched one of oldPackage or
// newPackage. Otherwise, non VPN owner might get the VPN always-on status of the VPN owner.
// See b/191382886.
- if (!hasControlVpnPermission()) {
+ if (mContext.checkCallingOrSelfPermission(CONTROL_VPN) != PERMISSION_GRANTED) {
if (oldPackage != null) {
verifyCallingUidAndPackage(oldPackage);
}
@@ -1196,25 +1198,7 @@
mContext.unbindService(mConnection);
cleanupVpnStateLocked();
} else if (mVpnRunner != null) {
- // Build intent first because the sessionKey will be reset after performing
- // VpnRunner.exit(). Also, cache mOwnerUID even if ownerUID will not be changed in
- // VpnRunner.exit() to prevent design being changed in the future.
- // TODO(b/230548427): Remove SDK check once VPN related stuff are decoupled from
- // ConnectivityServiceTest.
- final int ownerUid = mOwnerUID;
- Intent intent = null;
- if (SdkLevel.isAtLeastT() && isVpnApp(mPackage)) {
- intent = buildVpnManagerEventIntent(
- VpnManager.CATEGORY_EVENT_DEACTIVATED_BY_USER,
- -1 /* errorClass */, -1 /* errorCode*/, mPackage,
- getSessionKeyLocked(), makeVpnProfileStateLocked(),
- null /* underlyingNetwork */, null /* nc */, null /* lp */);
- }
- // cleanupVpnStateLocked() is called from mVpnRunner.exit()
- mVpnRunner.exit();
- if (intent != null && isVpnApp(mPackage)) {
- notifyVpnManagerVpnStopped(mPackage, ownerUid, intent);
- }
+ stopVpnRunnerAndNotifyAppLocked(mPackage);
}
try {
@@ -2073,10 +2057,6 @@
"Unauthorized Caller");
}
- private boolean hasControlVpnPermission() {
- return mContext.checkCallingOrSelfPermission(CONTROL_VPN) == PERMISSION_GRANTED;
- }
-
private class Connection implements ServiceConnection {
private IBinder mService;
@@ -2778,6 +2758,8 @@
mIpSecManager = (IpSecManager) mContext.getSystemService(Context.IPSEC_SERVICE);
mNetworkCallback = new VpnIkev2Utils.Ikev2VpnNetworkCallback(TAG, this, mExecutor);
mSessionKey = UUID.randomUUID().toString();
+ // Add log for debugging flaky test. b/242833779
+ Log.d(TAG, "Generate session key = " + mSessionKey);
// Set the policy so that cancelled tasks will be removed from the work queue
mExecutor.setRemoveOnCancelPolicy(true);
@@ -3901,10 +3883,8 @@
Binder.restoreCallingIdentity(token);
}
- // If package has CONTROL_VPN, grant the ACTIVATE_PLATFORM_VPN appop.
- if (hasControlVpnPermission()) {
- setPackageAuthorization(packageName, VpnManager.TYPE_VPN_PLATFORM);
- }
+ // TODO: if package has CONTROL_VPN, grant the ACTIVATE_PLATFORM_VPN appop.
+ // This mirrors the prepareAndAuthorize that is used by VpnService.
// Return whether the app is already pre-consented
return isVpnProfilePreConsented(mContext, packageName);
@@ -3972,7 +3952,13 @@
@GuardedBy("this")
@Nullable
private String getSessionKeyLocked() {
- return isIkev2VpnRunner() ? ((IkeV2VpnRunner) mVpnRunner).mSessionKey : null;
+ // Add log for debugging flaky test. b/242833779
+ final boolean isIkev2VpnRunner = isIkev2VpnRunner();
+ final String sessionKey =
+ isIkev2VpnRunner ? ((IkeV2VpnRunner) mVpnRunner).mSessionKey : null;
+ Log.d(TAG, "getSessionKeyLocked: isIkev2VpnRunner = " + isIkev2VpnRunner
+ + ", sessionKey = " + sessionKey);
+ return sessionKey;
}
/**
@@ -4074,6 +4060,29 @@
}
}
+ @GuardedBy("this")
+ private void stopVpnRunnerAndNotifyAppLocked(@NonNull String packageName) {
+ // Build intent first because the sessionKey will be reset after performing
+ // VpnRunner.exit(). Also, cache mOwnerUID even if ownerUID will not be changed in
+ // VpnRunner.exit() to prevent design being changed in the future.
+ // TODO(b/230548427): Remove SDK check once VPN related stuff are decoupled from
+ // ConnectivityServiceTest.
+ final int ownerUid = mOwnerUID;
+ Intent intent = null;
+ if (SdkLevel.isAtLeastT() && isVpnApp(packageName)) {
+ intent = buildVpnManagerEventIntent(
+ VpnManager.CATEGORY_EVENT_DEACTIVATED_BY_USER,
+ -1 /* errorClass */, -1 /* errorCode*/, packageName,
+ getSessionKeyLocked(), makeVpnProfileStateLocked(),
+ null /* underlyingNetwork */, null /* nc */, null /* lp */);
+ }
+ // cleanupVpnStateLocked() is called from mVpnRunner.exit()
+ mVpnRunner.exit();
+ if (intent != null && isVpnApp(packageName)) {
+ notifyVpnManagerVpnStopped(packageName, ownerUid, intent);
+ }
+ }
+
/**
* Stops an already running VPN Profile for the given package.
*
@@ -4090,18 +4099,7 @@
// To stop the VPN profile, the caller must be the current prepared package and must be
// running an Ikev2VpnProfile.
if (isCurrentIkev2VpnLocked(packageName)) {
- // Build intent first because the sessionKey will be reset after performing
- // VpnRunner.exit(). Also, cache mOwnerUID even if ownerUID will not be changed in
- // VpnRunner.exit() to prevent design being changed in the future.
- final int ownerUid = mOwnerUID;
- final Intent intent = buildVpnManagerEventIntent(
- VpnManager.CATEGORY_EVENT_DEACTIVATED_BY_USER,
- -1 /* errorClass */, -1 /* errorCode*/, packageName,
- getSessionKeyLocked(), makeVpnProfileStateLocked(),
- null /* underlyingNetwork */, null /* nc */, null /* lp */);
-
- mVpnRunner.exit();
- notifyVpnManagerVpnStopped(packageName, ownerUid, intent);
+ stopVpnRunnerAndNotifyAppLocked(packageName);
}
}
diff --git a/services/core/java/com/android/server/logcat/OWNERS b/services/core/java/com/android/server/logcat/OWNERS
index 9588fa9..87d30f3 100644
--- a/services/core/java/com/android/server/logcat/OWNERS
+++ b/services/core/java/com/android/server/logcat/OWNERS
@@ -1,5 +1,7 @@
cbrubaker@google.com
eunjeongshin@google.com
+georgechan@google.com
jsharkey@google.com
vishwath@google.com
wenhaowang@google.com
+xiaozhenl@google.com
diff --git a/services/credentials/OWNERS b/services/credentials/OWNERS
new file mode 100644
index 0000000..f3b43c1
--- /dev/null
+++ b/services/credentials/OWNERS
@@ -0,0 +1 @@
+include /core/java/android/credentials/OWNERS
diff --git a/telephony/java/android/telephony/AccessNetworkConstants.java b/telephony/java/android/telephony/AccessNetworkConstants.java
index 4469ffc..7eec86a 100644
--- a/telephony/java/android/telephony/AccessNetworkConstants.java
+++ b/telephony/java/android/telephony/AccessNetworkConstants.java
@@ -115,15 +115,15 @@
/** @hide */
public static @RadioAccessNetworkType int fromString(@NonNull String str) {
switch (str.toUpperCase()) {
- case "GERAN" : return GERAN;
- case "UTRAN" : return UTRAN;
- case "EUTRAN" : return EUTRAN;
- case "CDMA2000" : return CDMA2000;
- case "IWLAN" : return IWLAN;
- case "NGRAN" : return NGRAN;
+ case "UNKNOWN": return UNKNOWN;
+ case "GERAN": return GERAN;
+ case "UTRAN": return UTRAN;
+ case "EUTRAN": return EUTRAN;
+ case "CDMA2000": return CDMA2000;
+ case "IWLAN": return IWLAN;
+ case "NGRAN": return NGRAN;
default:
- Rlog.e(TAG, "Invalid access network type " + str);
- return UNKNOWN;
+ throw new IllegalArgumentException("Invalid access network type " + str);
}
}
}
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 70fe6b1..e032f65 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -8550,6 +8550,13 @@
* IWLAN handover rules that determine whether handover is allowed or disallowed between
* cellular and IWLAN.
*
+ * Rule syntax: "source=[GERAN|UTRAN|EUTRAN|NGRAN|IWLAN|UNKNOWN], target=[GERAN|UTRAN|EUTRAN
+ * |NGRAN|IWLAN], type=[allowed|disallowed], roaming=[true|false], capabilities=[INTERNET|MMS
+ * |FOTA|IMS|CBS|SUPL|EIMS|XCAP|DUN]"
+ *
+ * Note that UNKNOWN can be only specified in the source access network and can be only used
+ * in the disallowed rule.
+ *
* The handover rules will be matched in the order. Here are some sample rules.
* <string-array name="iwlan_handover_rules" num="5">
* <!-- Handover from IWLAN to 2G/3G is not allowed -->
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 70f1639..5ed6cb9 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -139,24 +139,19 @@
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public static final Uri CONTENT_URI = SimInfo.CONTENT_URI;
- /** @hide */
- public static final String CACHE_KEY_DEFAULT_SUB_ID_PROPERTY =
+ private static final String CACHE_KEY_DEFAULT_SUB_ID_PROPERTY =
"cache_key.telephony.get_default_sub_id";
- /** @hide */
- public static final String CACHE_KEY_DEFAULT_DATA_SUB_ID_PROPERTY =
+ private static final String CACHE_KEY_DEFAULT_DATA_SUB_ID_PROPERTY =
"cache_key.telephony.get_default_data_sub_id";
- /** @hide */
- public static final String CACHE_KEY_DEFAULT_SMS_SUB_ID_PROPERTY =
+ private static final String CACHE_KEY_DEFAULT_SMS_SUB_ID_PROPERTY =
"cache_key.telephony.get_default_sms_sub_id";
- /** @hide */
- public static final String CACHE_KEY_ACTIVE_DATA_SUB_ID_PROPERTY =
+ private static final String CACHE_KEY_ACTIVE_DATA_SUB_ID_PROPERTY =
"cache_key.telephony.get_active_data_sub_id";
- /** @hide */
- public static final String CACHE_KEY_SLOT_INDEX_PROPERTY =
+ private static final String CACHE_KEY_SLOT_INDEX_PROPERTY =
"cache_key.telephony.get_slot_index";
/** @hide */
diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
index b905212..546d2ce 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
@@ -424,4 +424,24 @@
*/
@Deprecated
public static final String EXTRA_DEFAULT_NETWORK_AVAILABLE = "defaultNetworkAvailable";
+
+ /**
+ * <p>Broadcast sent to show Emergency notification due to Voice Over Wifi availability
+ *
+ * <p class="note">
+ * You can <em>not</em> receive this through components declared
+ * in manifests, only by explicitly registering for it with
+ * {@link android.content.Context#registerReceiver(android.content.BroadcastReceiver,
+ * android.content.IntentFilter) Context.registerReceiver()}.
+ *
+ * <p class="note">
+ * Requires no permission.
+ *
+ * <p class="note">This is a protected intent that can only be sent
+ * by the system.
+ *
+ * @hide
+ */
+ public static final String ACTION_VOWIFI_ENABLED
+ = "com.android.internal.telephony.ACTION_VOWIFI_ENABLED";
}
diff --git a/tests/RollbackTest/Android.bp b/tests/RollbackTest/Android.bp
index 9f6ce4e..b7c4c5b 100644
--- a/tests/RollbackTest/Android.bp
+++ b/tests/RollbackTest/Android.bp
@@ -61,6 +61,7 @@
static_libs: ["RollbackTestLib", "frameworks-base-hostutils"],
test_suites: ["general-tests"],
test_config: "NetworkStagedRollbackTest.xml",
+ data: [":RollbackTest"],
}
java_test_host {
diff --git a/tools/aapt2/format/Container.cpp b/tools/aapt2/format/Container.cpp
index 9cef7b3..1ff6c49 100644
--- a/tools/aapt2/format/Container.cpp
+++ b/tools/aapt2/format/Container.cpp
@@ -76,7 +76,7 @@
coded_out.WriteLittleEndian32(kResTable);
// Write the aligned size.
- const ::google::protobuf::uint64 size = table.ByteSize();
+ const size_t size = table.ByteSizeLong();
const int padding = CalculatePaddingForAlignment(size);
coded_out.WriteLittleEndian64(size);
@@ -109,7 +109,7 @@
coded_out.WriteLittleEndian32(kResFile);
// Write the aligned size.
- const ::google::protobuf::uint32 header_size = file.ByteSize();
+ const size_t header_size = file.ByteSizeLong();
const int header_padding = CalculatePaddingForAlignment(header_size);
const ::google::protobuf::uint64 data_size = in->TotalSize();
const int data_padding = CalculatePaddingForAlignment(data_size);
diff --git a/tools/aapt2/io/Util.h b/tools/aapt2/io/Util.h
index 5cb8206..1b48a28 100644
--- a/tools/aapt2/io/Util.h
+++ b/tools/aapt2/io/Util.h
@@ -131,8 +131,7 @@
template <typename T> bool ReadMessage(T *message) {
ZeroCopyInputAdaptor adapter(in_);
google::protobuf::io::CodedInputStream coded_stream(&adapter);
- coded_stream.SetTotalBytesLimit(std::numeric_limits<int32_t>::max(),
- coded_stream.BytesUntilTotalBytesLimit());
+ coded_stream.SetTotalBytesLimit(std::numeric_limits<int32_t>::max());
return message->ParseFromCodedStream(&coded_stream);
}
diff --git a/tools/lint/OWNERS b/tools/lint/OWNERS
index 7c04519..2c526a1 100644
--- a/tools/lint/OWNERS
+++ b/tools/lint/OWNERS
@@ -2,4 +2,5 @@
jsharkey@google.com
per-file *CallingSettingsNonUserGetterMethods* = file:/packages/SettingsProvider/OWNERS
+per-file *RegisterReceiverFlagDetector* = jacobhobbie@google.com