Merge "Fix more kotlin 1.7.0 errors"
diff --git a/Android.bp b/Android.bp
index d884802..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",
@@ -367,6 +365,15 @@
name: "framework-minus-apex-intdefs",
defaults: ["framework-minus-apex-defaults"],
plugins: ["intdef-annotation-processor"],
+
+ // Errorprone and android lint will already run on framework-minus-apex, don't rerun them on
+ // the intdefs version in order to speed up the build.
+ errorprone: {
+ enabled: false,
+ },
+ lint: {
+ enabled: false,
+ },
}
// This "framework" module is NOT installed to the device. It's
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/blobstore/src/com/android/perftests/blob/BlobStorePerfTests.java b/apct-tests/perftests/blobstore/src/com/android/perftests/blob/BlobStorePerfTests.java
index 3781b6d..03e5468 100644
--- a/apct-tests/perftests/blobstore/src/com/android/perftests/blob/BlobStorePerfTests.java
+++ b/apct-tests/perftests/blobstore/src/com/android/perftests/blob/BlobStorePerfTests.java
@@ -257,7 +257,7 @@
runShellCommand(String.format(
"cmd blob_store delete-blob --algo %s --digest %s --label %s --expiry %d --tag %s",
blobHandle.algorithm,
- Base64.getEncoder().encode(blobHandle.digest),
+ Base64.getEncoder().encodeToString(blobHandle.digest),
blobHandle.label,
blobHandle.expiryTimeMillis,
blobHandle.tag));
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/api/OWNERS b/api/OWNERS
index 4d8ed03..bf6216c 100644
--- a/api/OWNERS
+++ b/api/OWNERS
@@ -3,7 +3,7 @@
# Modularization team
file:platform/packages/modules/common:/OWNERS
-per-file Android.bp = file:platform/build/soong:/OWNERS
+per-file Android.bp = file:platform/build/soong:/OWNERS #{LAST_RESORT_SUGGESTION}
# For metalava team to disable lint checks in platform
-per-file Android.bp = aurimas@google.com,emberrose@google.com,sjgilbert@google.com
\ No newline at end of file
+per-file Android.bp = aurimas@google.com,emberrose@google.com,sjgilbert@google.com
diff --git a/cmds/abx/Android.bp b/cmds/abx/Android.bp
index 50a0b75..a832dea 100644
--- a/cmds/abx/Android.bp
+++ b/cmds/abx/Android.bp
@@ -1,4 +1,3 @@
-
package {
default_applicable_licenses: ["frameworks_base_cmds_abx_license"],
}
@@ -18,7 +17,7 @@
java_binary {
name: "abx",
- wrapper: "abx",
+ wrapper: "abx.sh",
srcs: ["**/*.java"],
required: [
"abx2xml",
@@ -28,10 +27,10 @@
sh_binary {
name: "abx2xml",
- src: "abx2xml",
+ src: "abx2xml.sh",
}
sh_binary {
name: "xml2abx",
- src: "xml2abx",
+ src: "xml2abx.sh",
}
diff --git a/cmds/abx/abx b/cmds/abx/abx.sh
similarity index 100%
rename from cmds/abx/abx
rename to cmds/abx/abx.sh
diff --git a/cmds/abx/abx2xml b/cmds/abx/abx2xml
deleted file mode 100755
index 0a9362d..0000000
--- a/cmds/abx/abx2xml
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/system/bin/sh
-export CLASSPATH=/system/framework/abx.jar
-exec app_process /system/bin com.android.commands.abx.Abx "$0" "$@"
diff --git a/cmds/abx/abx b/cmds/abx/abx2xml.sh
similarity index 100%
copy from cmds/abx/abx
copy to cmds/abx/abx2xml.sh
diff --git a/cmds/abx/xml2abx b/cmds/abx/xml2abx
deleted file mode 100755
index 0a9362d..0000000
--- a/cmds/abx/xml2abx
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/system/bin/sh
-export CLASSPATH=/system/framework/abx.jar
-exec app_process /system/bin com.android.commands.abx.Abx "$0" "$@"
diff --git a/cmds/abx/abx b/cmds/abx/xml2abx.sh
similarity index 100%
copy from cmds/abx/abx
copy to cmds/abx/xml2abx.sh
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/bmgr/Android.bp b/cmds/bmgr/Android.bp
index 14beb55..a85669a 100644
--- a/cmds/bmgr/Android.bp
+++ b/cmds/bmgr/Android.bp
@@ -20,6 +20,6 @@
java_binary {
name: "bmgr",
- wrapper: "bmgr",
+ wrapper: "bmgr.sh",
srcs: ["**/*.java"],
}
diff --git a/cmds/bmgr/bmgr b/cmds/bmgr/bmgr.sh
similarity index 100%
rename from cmds/bmgr/bmgr
rename to cmds/bmgr/bmgr.sh
diff --git a/cmds/bu/Android.bp b/cmds/bu/Android.bp
index 5b4ec31..b61a7a6 100644
--- a/cmds/bu/Android.bp
+++ b/cmds/bu/Android.bp
@@ -20,6 +20,6 @@
java_binary {
name: "bu",
- wrapper: "bu",
+ wrapper: "bu.sh",
srcs: ["**/*.java"],
}
diff --git a/cmds/bu/bu b/cmds/bu/bu.sh
similarity index 100%
rename from cmds/bu/bu
rename to cmds/bu/bu.sh
diff --git a/cmds/content/Android.bp b/cmds/content/Android.bp
index c70d01e..0dd0f03 100644
--- a/cmds/content/Android.bp
+++ b/cmds/content/Android.bp
@@ -19,6 +19,6 @@
java_binary {
name: "content",
- wrapper: "content",
+ wrapper: "content.sh",
srcs: ["**/*.java"],
}
diff --git a/cmds/content/content b/cmds/content/content.sh
similarity index 100%
rename from cmds/content/content
rename to cmds/content/content.sh
diff --git a/cmds/device_config/Android.bp b/cmds/device_config/Android.bp
index 69572d8..83b2730 100644
--- a/cmds/device_config/Android.bp
+++ b/cmds/device_config/Android.bp
@@ -14,5 +14,5 @@
sh_binary {
name: "device_config",
- src: "device_config",
+ src: "device_config.sh",
}
diff --git a/cmds/device_config/device_config b/cmds/device_config/device_config.sh
similarity index 100%
rename from cmds/device_config/device_config
rename to cmds/device_config/device_config.sh
diff --git a/cmds/dpm/Android.bp b/cmds/dpm/Android.bp
index 6819d09..29bee49 100644
--- a/cmds/dpm/Android.bp
+++ b/cmds/dpm/Android.bp
@@ -20,5 +20,5 @@
sh_binary {
name: "dpm",
- src: "dpm",
+ src: "dpm.sh",
}
diff --git a/cmds/dpm/dpm b/cmds/dpm/dpm.sh
similarity index 100%
rename from cmds/dpm/dpm
rename to cmds/dpm/dpm.sh
diff --git a/cmds/hid/Android.bp b/cmds/hid/Android.bp
index 295c71c..a6e2769 100644
--- a/cmds/hid/Android.bp
+++ b/cmds/hid/Android.bp
@@ -20,7 +20,7 @@
java_binary {
name: "hid",
- wrapper: "hid",
+ wrapper: "hid.sh",
srcs: ["**/*.java"],
required: ["libhidcommand_jni"],
}
diff --git a/cmds/hid/hid b/cmds/hid/hid.sh
similarity index 100%
rename from cmds/hid/hid
rename to cmds/hid/hid.sh
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/CommandLineOptions.cpp b/cmds/idmap2/libidmap2/CommandLineOptions.cpp
index 5b0ae92..8129d99 100644
--- a/cmds/idmap2/libidmap2/CommandLineOptions.cpp
+++ b/cmds/idmap2/libidmap2/CommandLineOptions.cpp
@@ -17,6 +17,7 @@
#include "idmap2/CommandLineOptions.h"
#include <algorithm>
+#include <cassert>
#include <iomanip>
#include <iostream>
#include <memory>
diff --git a/cmds/idmap2/libidmap2/Idmap.cpp b/cmds/idmap2/libidmap2/Idmap.cpp
index 6515d55..06650f6 100644
--- a/cmds/idmap2/libidmap2/Idmap.cpp
+++ b/cmds/idmap2/libidmap2/Idmap.cpp
@@ -17,6 +17,7 @@
#include "idmap2/Idmap.h"
#include <algorithm>
+#include <cassert>
#include <iostream>
#include <iterator>
#include <limits>
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/ime/Android.bp b/cmds/ime/Android.bp
index 6dd3ba1..5f54ffa 100644
--- a/cmds/ime/Android.bp
+++ b/cmds/ime/Android.bp
@@ -20,5 +20,5 @@
sh_binary {
name: "ime",
- src: "ime",
+ src: "ime.sh",
}
diff --git a/cmds/ime/ime b/cmds/ime/ime.sh
similarity index 100%
rename from cmds/ime/ime
rename to cmds/ime/ime.sh
diff --git a/cmds/input/Android.bp b/cmds/input/Android.bp
index 2e30176..8f44f3e 100644
--- a/cmds/input/Android.bp
+++ b/cmds/input/Android.bp
@@ -20,5 +20,5 @@
sh_binary {
name: "input",
- src: "input",
+ src: "input.sh",
}
diff --git a/cmds/input/input b/cmds/input/input.sh
similarity index 100%
rename from cmds/input/input
rename to cmds/input/input.sh
diff --git a/cmds/locksettings/Android.bp b/cmds/locksettings/Android.bp
index 3869c8f..5ee5824 100644
--- a/cmds/locksettings/Android.bp
+++ b/cmds/locksettings/Android.bp
@@ -23,6 +23,6 @@
java_binary {
name: "locksettings",
- wrapper: "locksettings",
+ wrapper: "locksettings.sh",
srcs: ["**/*.java"],
}
diff --git a/cmds/locksettings/locksettings b/cmds/locksettings/locksettings.sh
similarity index 100%
rename from cmds/locksettings/locksettings
rename to cmds/locksettings/locksettings.sh
diff --git a/cmds/pm/Android.bp b/cmds/pm/Android.bp
index 847dbab..0e61a9e 100644
--- a/cmds/pm/Android.bp
+++ b/cmds/pm/Android.bp
@@ -20,5 +20,5 @@
sh_binary {
name: "pm",
- src: "pm",
+ src: "pm.sh",
}
diff --git a/cmds/pm/pm b/cmds/pm/pm.sh
similarity index 100%
rename from cmds/pm/pm
rename to cmds/pm/pm.sh
diff --git a/cmds/requestsync/Android.bp b/cmds/requestsync/Android.bp
index 57e8dd3..8718f79 100644
--- a/cmds/requestsync/Android.bp
+++ b/cmds/requestsync/Android.bp
@@ -20,6 +20,6 @@
java_binary {
name: "requestsync",
- wrapper: "requestsync",
+ wrapper: "requestsync.sh",
srcs: ["**/*.java"],
}
diff --git a/cmds/requestsync/requestsync b/cmds/requestsync/requestsync.sh
similarity index 100%
rename from cmds/requestsync/requestsync
rename to cmds/requestsync/requestsync.sh
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/cmds/settings/Android.bp b/cmds/settings/Android.bp
index cc73006..8180fd6 100644
--- a/cmds/settings/Android.bp
+++ b/cmds/settings/Android.bp
@@ -14,5 +14,5 @@
sh_binary {
name: "settings",
- src: "settings",
+ src: "settings.sh",
}
diff --git a/cmds/settings/settings b/cmds/settings/settings.sh
similarity index 100%
rename from cmds/settings/settings
rename to cmds/settings/settings.sh
diff --git a/cmds/sm/Android.bp b/cmds/sm/Android.bp
index ecfacae..403022a 100644
--- a/cmds/sm/Android.bp
+++ b/cmds/sm/Android.bp
@@ -20,6 +20,6 @@
java_binary {
name: "sm",
- wrapper: "sm",
+ wrapper: "sm.sh",
srcs: ["**/*.java"],
}
diff --git a/cmds/sm/sm b/cmds/sm/sm.sh
similarity index 100%
rename from cmds/sm/sm
rename to cmds/sm/sm.sh
diff --git a/cmds/svc/Android.bp b/cmds/svc/Android.bp
index 41a3ebd..a246087 100644
--- a/cmds/svc/Android.bp
+++ b/cmds/svc/Android.bp
@@ -20,6 +20,6 @@
java_binary {
name: "svc",
- wrapper: "svc",
+ wrapper: "svc.sh",
srcs: ["**/*.java"],
}
diff --git a/cmds/svc/svc b/cmds/svc/svc.sh
similarity index 100%
rename from cmds/svc/svc
rename to cmds/svc/svc.sh
diff --git a/cmds/telecom/Android.bp b/cmds/telecom/Android.bp
index 4da79c5..be02710 100644
--- a/cmds/telecom/Android.bp
+++ b/cmds/telecom/Android.bp
@@ -20,6 +20,6 @@
java_binary {
name: "telecom",
- wrapper: "telecom",
+ wrapper: "telecom.sh",
srcs: ["**/*.java"],
}
diff --git a/cmds/telecom/telecom b/cmds/telecom/telecom.sh
similarity index 100%
rename from cmds/telecom/telecom
rename to cmds/telecom/telecom.sh
diff --git a/cmds/uiautomator/cmds/uiautomator/Android.bp b/cmds/uiautomator/cmds/uiautomator/Android.bp
index 56e2e70..5132386 100644
--- a/cmds/uiautomator/cmds/uiautomator/Android.bp
+++ b/cmds/uiautomator/cmds/uiautomator/Android.bp
@@ -25,7 +25,7 @@
java_binary {
name: "uiautomator",
- wrapper: "uiautomator",
+ wrapper: "uiautomator.sh",
srcs: ["src/**/*.java"],
static_libs: ["uiautomator.core"],
}
diff --git a/cmds/uiautomator/cmds/uiautomator/uiautomator b/cmds/uiautomator/cmds/uiautomator/uiautomator.sh
similarity index 100%
rename from cmds/uiautomator/cmds/uiautomator/uiautomator
rename to cmds/uiautomator/cmds/uiautomator/uiautomator.sh
diff --git a/cmds/uinput/Android.bp b/cmds/uinput/Android.bp
index 260cfc7..4b08d96 100644
--- a/cmds/uinput/Android.bp
+++ b/cmds/uinput/Android.bp
@@ -20,9 +20,10 @@
java_binary {
name: "uinput",
- wrapper: "uinput",
- srcs: ["**/*.java",
- ":uinputcommand_aidl"
+ wrapper: "uinput.sh",
+ srcs: [
+ "**/*.java",
+ ":uinputcommand_aidl",
],
required: ["libuinputcommand_jni"],
}
diff --git a/cmds/uinput/uinput b/cmds/uinput/uinput.sh
similarity index 100%
rename from cmds/uinput/uinput
rename to cmds/uinput/uinput.sh
diff --git a/cmds/vr/Android.bp b/cmds/vr/Android.bp
index 8936491..61795b4c 100644
--- a/cmds/vr/Android.bp
+++ b/cmds/vr/Android.bp
@@ -20,6 +20,6 @@
java_binary {
name: "vr",
- wrapper: "vr",
+ wrapper: "vr.sh",
srcs: ["**/*.java"],
}
diff --git a/cmds/vr/vr b/cmds/vr/vr.sh
similarity index 100%
rename from cmds/vr/vr
rename to cmds/vr/vr.sh
diff --git a/cmds/wm/Android.bp b/cmds/wm/Android.bp
index cf6b019..4d00f17 100644
--- a/cmds/wm/Android.bp
+++ b/cmds/wm/Android.bp
@@ -20,5 +20,5 @@
sh_binary {
name: "wm",
- src: "wm",
+ src: "wm.sh",
}
diff --git a/cmds/wm/wm b/cmds/wm/wm.sh
similarity index 100%
rename from cmds/wm/wm
rename to cmds/wm/wm.sh
diff --git a/core/api/current.txt b/core/api/current.txt
index 584c67f..a85c69b 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -32083,6 +32083,7 @@
method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectCustomSlowCalls();
method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectDiskReads();
method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectDiskWrites();
+ method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectExplicitGc();
method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectNetwork();
method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectResourceMismatches();
method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectUnbufferedIo();
@@ -32097,6 +32098,7 @@
method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitCustomSlowCalls();
method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitDiskReads();
method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitDiskWrites();
+ method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitExplicitGc();
method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitNetwork();
method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitResourceMismatches();
method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitUnbufferedIo();
@@ -32650,6 +32652,9 @@
public final class DiskWriteViolation extends android.os.strictmode.Violation {
}
+ public final class ExplicitGcViolation extends android.os.strictmode.Violation {
+ }
+
public final class FileUriExposedViolation extends android.os.strictmode.Violation {
}
diff --git a/core/api/module-lib-current.txt b/core/api/module-lib-current.txt
index b952216..d3fc379 100644
--- a/core/api/module-lib-current.txt
+++ b/core/api/module-lib-current.txt
@@ -171,6 +171,7 @@
method @NonNull public static android.media.BluetoothProfileConnectionInfo createA2dpSinkInfo(int);
method @NonNull public static android.media.BluetoothProfileConnectionInfo createHearingAidInfo(boolean);
method @NonNull public static android.media.BluetoothProfileConnectionInfo createLeAudioInfo(boolean, boolean);
+ method @NonNull public static android.media.BluetoothProfileConnectionInfo createLeAudioOutputInfo(boolean, int);
method public int describeContents();
method public int getProfile();
method public int getVolume();
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 9253228..03818a5 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -1815,10 +1815,6 @@
method public static void setViolationLogger(android.os.StrictMode.ViolationLogger);
}
- public static final class StrictMode.ThreadPolicy.Builder {
- method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectExplicitGc();
- }
-
public static final class StrictMode.ViolationInfo implements android.os.Parcelable {
ctor public StrictMode.ViolationInfo(android.os.Parcel);
ctor public StrictMode.ViolationInfo(android.os.Parcel, boolean);
@@ -2055,13 +2051,6 @@
}
-package android.os.strictmode {
-
- public final class ExplicitGcViolation extends android.os.strictmode.Violation {
- }
-
-}
-
package android.os.vibrator {
public final class PrebakedSegment extends android.os.vibrator.VibrationEffectSegment {
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/app/VoiceInteractor.java b/core/java/android/app/VoiceInteractor.java
index 7014d69..a5a50d6 100644
--- a/core/java/android/app/VoiceInteractor.java
+++ b/core/java/android/app/VoiceInteractor.java
@@ -43,6 +43,7 @@
import java.io.PrintWriter;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Objects;
import java.util.concurrent.Executor;
@@ -1103,7 +1104,10 @@
}
try {
boolean[] res = mInteractor.supportsCommands(mContext.getOpPackageName(), commands);
- if (DEBUG) Log.d(TAG, "supportsCommands: cmds=" + commands + " res=" + res);
+ if (DEBUG) {
+ Log.d(TAG, "supportsCommands: cmds=" + Arrays.toString(commands) + " res="
+ + Arrays.toString(res));
+ }
return res;
} catch (RemoteException e) {
throw new RuntimeException("Voice interactor has died", e);
diff --git a/core/java/android/app/admin/PreferentialNetworkServiceConfig.java b/core/java/android/app/admin/PreferentialNetworkServiceConfig.java
index 24b4f4b..63c9839 100644
--- a/core/java/android/app/admin/PreferentialNetworkServiceConfig.java
+++ b/core/java/android/app/admin/PreferentialNetworkServiceConfig.java
@@ -203,17 +203,14 @@
return mIsEnabled == that.mIsEnabled
&& mAllowFallbackToDefaultConnection == that.mAllowFallbackToDefaultConnection
&& mNetworkId == that.mNetworkId
- && Objects.equals(mIncludedUids, that.mIncludedUids)
- && Objects.equals(mExcludedUids, that.mExcludedUids);
+ && Arrays.equals(mIncludedUids, that.mIncludedUids)
+ && Arrays.equals(mExcludedUids, that.mExcludedUids);
}
@Override
public int hashCode() {
- return ((Objects.hashCode(mIsEnabled) * 17)
- + (Objects.hashCode(mAllowFallbackToDefaultConnection) * 19)
- + (Objects.hashCode(mIncludedUids) * 23)
- + (Objects.hashCode(mExcludedUids) * 29)
- + mNetworkId * 31);
+ return Objects.hash(mIsEnabled, mAllowFallbackToDefaultConnection,
+ Arrays.hashCode(mIncludedUids), Arrays.hashCode(mExcludedUids), mNetworkId);
}
/**
diff --git a/core/java/android/companion/BluetoothLeDeviceFilter.java b/core/java/android/companion/BluetoothLeDeviceFilter.java
index e6091f0..2934cd2 100644
--- a/core/java/android/companion/BluetoothLeDeviceFilter.java
+++ b/core/java/android/companion/BluetoothLeDeviceFilter.java
@@ -204,9 +204,10 @@
@Override
public int hashCode() {
- return Objects.hash(mNamePattern, mScanFilter, mRawDataFilter, mRawDataFilterMask,
- mRenamePrefix, mRenameSuffix, mRenameBytesFrom, mRenameBytesLength,
- mRenameNameFrom, mRenameNameLength, mRenameBytesReverseOrder);
+ return Objects.hash(mNamePattern, mScanFilter, Arrays.hashCode(mRawDataFilter),
+ Arrays.hashCode(mRawDataFilterMask), mRenamePrefix, mRenameSuffix,
+ mRenameBytesFrom, mRenameBytesLength, mRenameNameFrom, mRenameNameLength,
+ mRenameBytesReverseOrder);
}
@Override
diff --git a/core/java/android/content/AttributionSource.java b/core/java/android/content/AttributionSource.java
index 3f2fa21..b0c6cbc 100644
--- a/core/java/android/content/AttributionSource.java
+++ b/core/java/android/content/AttributionSource.java
@@ -495,14 +495,9 @@
@Override
public int hashCode() {
- int _hash = 1;
- _hash = 31 * _hash + mAttributionSourceState.uid;
- _hash = 31 * _hash + Objects.hashCode(mAttributionSourceState.packageName);
- _hash = 31 * _hash + Objects.hashCode(mAttributionSourceState.attributionTag);
- _hash = 31 * _hash + Objects.hashCode(mAttributionSourceState.token);
- _hash = 31 * _hash + Objects.hashCode(mAttributionSourceState.renouncedPermissions);
- _hash = 31 * _hash + Objects.hashCode(getNext());
- return _hash;
+ return Objects.hash(mAttributionSourceState.uid, mAttributionSourceState.packageName,
+ mAttributionSourceState.attributionTag, mAttributionSourceState.token,
+ Arrays.hashCode(mAttributionSourceState.renouncedPermissions), getNext());
}
@Override
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/content/pm/LauncherApps.java b/core/java/android/content/pm/LauncherApps.java
index 301d1bbc..364aa90 100644
--- a/core/java/android/content/pm/LauncherApps.java
+++ b/core/java/android/content/pm/LauncherApps.java
@@ -1723,7 +1723,8 @@
public void onPackagesAvailable(UserHandle user, String[] packageNames, boolean replacing)
throws RemoteException {
if (DEBUG) {
- Log.d(TAG, "onPackagesAvailable " + user.getIdentifier() + "," + packageNames);
+ Log.d(TAG, "onPackagesAvailable " + user.getIdentifier() + ","
+ + Arrays.toString(packageNames));
}
synchronized (LauncherApps.this) {
for (CallbackMessageHandler callback : mCallbacks) {
@@ -1736,7 +1737,8 @@
public void onPackagesUnavailable(UserHandle user, String[] packageNames, boolean replacing)
throws RemoteException {
if (DEBUG) {
- Log.d(TAG, "onPackagesUnavailable " + user.getIdentifier() + "," + packageNames);
+ Log.d(TAG, "onPackagesUnavailable " + user.getIdentifier() + ","
+ + Arrays.toString(packageNames));
}
synchronized (LauncherApps.this) {
for (CallbackMessageHandler callback : mCallbacks) {
@@ -1750,7 +1752,8 @@
Bundle launcherExtras)
throws RemoteException {
if (DEBUG) {
- Log.d(TAG, "onPackagesSuspended " + user.getIdentifier() + "," + packageNames);
+ Log.d(TAG, "onPackagesSuspended " + user.getIdentifier() + ","
+ + Arrays.toString(packageNames));
}
synchronized (LauncherApps.this) {
for (CallbackMessageHandler callback : mCallbacks) {
@@ -1763,7 +1766,8 @@
public void onPackagesUnsuspended(UserHandle user, String[] packageNames)
throws RemoteException {
if (DEBUG) {
- Log.d(TAG, "onPackagesUnsuspended " + user.getIdentifier() + "," + packageNames);
+ Log.d(TAG, "onPackagesUnsuspended " + user.getIdentifier() + ","
+ + Arrays.toString(packageNames));
}
synchronized (LauncherApps.this) {
for (CallbackMessageHandler callback : mCallbacks) {
diff --git a/core/java/android/content/pm/ShortcutInfo.java b/core/java/android/content/pm/ShortcutInfo.java
index 52774e3..1f83d75 100644
--- a/core/java/android/content/pm/ShortcutInfo.java
+++ b/core/java/android/content/pm/ShortcutInfo.java
@@ -53,6 +53,7 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -2617,7 +2618,7 @@
addIndentOrComma(sb, indent);
sb.append("persons=");
- sb.append(mPersons);
+ sb.append(Arrays.toString(mPersons));
addIndentOrComma(sb, indent);
diff --git a/core/java/android/content/res/GradientColor.java b/core/java/android/content/res/GradientColor.java
index 35ad503..7bc551d 100644
--- a/core/java/android/content/res/GradientColor.java
+++ b/core/java/android/content/res/GradientColor.java
@@ -22,13 +22,6 @@
import android.annotation.Nullable;
import android.content.pm.ActivityInfo.Config;
import android.content.res.Resources.Theme;
-
-import com.android.internal.R;
-import com.android.internal.util.GrowingArrayUtils;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
import android.graphics.LinearGradient;
import android.graphics.RadialGradient;
import android.graphics.Shader;
@@ -38,9 +31,16 @@
import android.util.Log;
import android.util.Xml;
+import com.android.internal.R;
+import com.android.internal.util.GrowingArrayUtils;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.util.Arrays;
/**
* Lets you define a gradient color, which is used inside
@@ -466,7 +466,7 @@
}
if (tempColors.length < 2) {
Log.w(TAG, "<gradient> tag requires 2 color values specified!" + tempColors.length
- + " " + tempColors);
+ + " " + Arrays.toString(tempColors));
}
if (mGradientType == GradientDrawable.LINEAR_GRADIENT) {
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/hardware/radio/ProgramSelector.java b/core/java/android/hardware/radio/ProgramSelector.java
index d525753..2d2882d 100644
--- a/core/java/android/hardware/radio/ProgramSelector.java
+++ b/core/java/android/hardware/radio/ProgramSelector.java
@@ -490,8 +490,12 @@
public String toString() {
StringBuilder sb = new StringBuilder("ProgramSelector(type=").append(mProgramType)
.append(", primary=").append(mPrimaryId);
- if (mSecondaryIds.length > 0) sb.append(", secondary=").append(mSecondaryIds);
- if (mVendorIds.length > 0) sb.append(", vendor=").append(mVendorIds);
+ if (mSecondaryIds.length > 0) {
+ sb.append(", secondary=").append(Arrays.toString(mSecondaryIds));
+ }
+ if (mVendorIds.length > 0) {
+ sb.append(", vendor=").append(Arrays.toString(mVendorIds));
+ }
sb.append(")");
return sb.toString();
}
diff --git a/core/java/android/hardware/radio/RadioManager.java b/core/java/android/hardware/radio/RadioManager.java
index 4cc001a..83589ea 100644
--- a/core/java/android/hardware/radio/RadioManager.java
+++ b/core/java/android/hardware/radio/RadioManager.java
@@ -505,7 +505,8 @@
public int hashCode() {
return Objects.hash(mId, mServiceName, mClassId, mImplementor, mProduct, mVersion,
mSerial, mNumTuners, mNumAudioSources, mIsInitializationRequired,
- mIsCaptureSupported, mBands, mIsBgScanSupported, mDabFrequencyTable, mVendorInfo);
+ mIsCaptureSupported, Arrays.hashCode(mBands), mIsBgScanSupported,
+ mDabFrequencyTable, mVendorInfo);
}
@Override
@@ -525,7 +526,7 @@
if (mNumAudioSources != other.mNumAudioSources) return false;
if (mIsInitializationRequired != other.mIsInitializationRequired) return false;
if (mIsCaptureSupported != other.mIsCaptureSupported) return false;
- if (!Objects.equals(mBands, other.mBands)) return false;
+ if (!Arrays.equals(mBands, other.mBands)) return false;
if (mIsBgScanSupported != other.mIsBgScanSupported) return false;
if (!Objects.equals(mDabFrequencyTable, other.mDabFrequencyTable)) return false;
if (!Objects.equals(mVendorInfo, other.mVendorInfo)) return false;
diff --git a/core/java/android/metrics/LogMaker.java b/core/java/android/metrics/LogMaker.java
index a19eb56..8644d91 100644
--- a/core/java/android/metrics/LogMaker.java
+++ b/core/java/android/metrics/LogMaker.java
@@ -23,6 +23,7 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import java.util.Arrays;
/**
@@ -395,7 +396,7 @@
out[i * 2] = entries.keyAt(i);
out[i * 2 + 1] = entries.valueAt(i);
}
- int size = out.toString().getBytes().length;
+ int size = Arrays.toString(out).getBytes().length;
if (size > MAX_SERIALIZED_SIZE) {
Log.i(TAG, "Log line too long, did not emit: " + size + " bytes.");
throw new RuntimeException();
diff --git a/core/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtils.java b/core/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtils.java
index be57372..d6f191e 100644
--- a/core/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtils.java
+++ b/core/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtils.java
@@ -37,6 +37,7 @@
import android.net.ipsec.ike.IkeSessionParams.IkeConfigRequest;
import android.os.PersistableBundle;
import android.util.ArraySet;
+import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.vcn.util.PersistableBundleUtils;
@@ -58,6 +59,8 @@
*/
@VisibleForTesting(visibility = Visibility.PRIVATE)
public final class IkeSessionParamsUtils {
+ private static final String TAG = IkeSessionParamsUtils.class.getSimpleName();
+
private static final String SERVER_HOST_NAME_KEY = "SERVER_HOST_NAME_KEY";
private static final String SA_PROPOSALS_KEY = "SA_PROPOSALS_KEY";
private static final String LOCAL_ID_KEY = "LOCAL_ID_KEY";
@@ -72,6 +75,13 @@
private static final String NATT_KEEPALIVE_DELAY_SEC_KEY = "NATT_KEEPALIVE_DELAY_SEC_KEY";
private static final String IKE_OPTIONS_KEY = "IKE_OPTIONS_KEY";
+ // TODO: b/243181760 Use the IKE API when they are exposed
+ @VisibleForTesting(visibility = Visibility.PRIVATE)
+ public static final int IKE_OPTION_AUTOMATIC_ADDRESS_FAMILY_SELECTION = 6;
+
+ @VisibleForTesting(visibility = Visibility.PRIVATE)
+ public static final int IKE_OPTION_AUTOMATIC_NATT_KEEPALIVES = 7;
+
private static final Set<Integer> IKE_OPTIONS = new ArraySet<>();
static {
@@ -80,6 +90,26 @@
IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_MOBIKE);
IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_FORCE_PORT_4500);
IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_INITIAL_CONTACT);
+ IKE_OPTIONS.add(IkeSessionParams.IKE_OPTION_REKEY_MOBILITY);
+ IKE_OPTIONS.add(IKE_OPTION_AUTOMATIC_ADDRESS_FAMILY_SELECTION);
+ IKE_OPTIONS.add(IKE_OPTION_AUTOMATIC_NATT_KEEPALIVES);
+ }
+
+ /**
+ * Check if an IKE option is supported in the IPsec module installed on the device
+ *
+ * <p>This method ensures caller to safely access options that are added between dessert
+ * releases.
+ */
+ @VisibleForTesting(visibility = Visibility.PRIVATE)
+ public static boolean isIkeOptionValid(int option) {
+ try {
+ new IkeSessionParams.Builder().addIkeOption(option);
+ return true;
+ } catch (IllegalArgumentException e) {
+ Log.d(TAG, "Option not supported; discarding: " + option);
+ return false;
+ }
}
/** Serializes an IkeSessionParams to a PersistableBundle. */
@@ -130,7 +160,7 @@
// IKE_OPTION is defined in IKE module and added in the IkeSessionParams
final List<Integer> enabledIkeOptions = new ArrayList<>();
for (int option : IKE_OPTIONS) {
- if (params.hasIkeOption(option)) {
+ if (isIkeOptionValid(option) && params.hasIkeOption(option)) {
enabledIkeOptions.add(option);
}
}
@@ -205,12 +235,16 @@
// Clear IKE Options that are by default enabled
for (int option : IKE_OPTIONS) {
- builder.removeIkeOption(option);
+ if (isIkeOptionValid(option)) {
+ builder.removeIkeOption(option);
+ }
}
final int[] optionArray = in.getIntArray(IKE_OPTIONS_KEY);
for (int option : optionArray) {
- builder.addIkeOption(option);
+ if (isIkeOptionValid(option)) {
+ builder.addIkeOption(option);
+ }
}
return builder.build();
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index 412a33a..113a640 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -26,6 +26,9 @@
import android.app.ActivityManager;
import android.app.ActivityThread;
import android.app.IActivityManager;
+import android.app.compat.CompatChanges;
+import android.compat.annotation.ChangeId;
+import android.compat.annotation.EnabledSince;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -344,6 +347,13 @@
public static final int NETWORK_POLICY_LOG = 1;
/** {@hide} */
public static final int NETWORK_POLICY_REJECT = 2;
+
+ /**
+ * Detect explicit calls to {@link Runtime#gc()}.
+ */
+ @ChangeId
+ @EnabledSince(targetSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
+ static final long DETECT_EXPLICIT_GC = 3400644L;
// TODO: wrap in some ImmutableHashMap thing.
// Note: must be before static initialization of sVmPolicy.
@@ -496,6 +506,7 @@
* <p>As of the Gingerbread release this includes network and disk operations but will
* likely expand in future releases.
*/
+ @SuppressWarnings("AndroidFrameworkCompatChange")
public @NonNull Builder detectAll() {
detectDiskReads();
detectDiskWrites();
@@ -511,6 +522,9 @@
if (targetSdk >= Build.VERSION_CODES.O) {
detectUnbufferedIo();
}
+ if (CompatChanges.isChangeEnabled(DETECT_EXPLICIT_GC)) {
+ detectExplicitGc();
+ }
return this;
}
@@ -591,26 +605,16 @@
}
/**
- * Detect explicit GC requests, i.e. calls to Runtime.gc().
- *
- * @hide
+ * Detect calls to {@link Runtime#gc()}.
*/
- @TestApi
public @NonNull Builder detectExplicitGc() {
- // TODO(b/3400644): Un-hide this for next API update
- // TODO(b/3400644): Un-hide ExplicitGcViolation for next API update
- // TODO(b/3400644): Make DETECT_EXPLICIT_GC a @TestApi for next API update
- // TODO(b/3400644): Call this from detectAll in next API update
return enable(DETECT_THREAD_EXPLICIT_GC);
}
/**
- * Disable detection of explicit GC requests, i.e. calls to Runtime.gc().
- *
- * @hide
+ * Disable detection of calls to {@link Runtime#gc()}.
*/
public @NonNull Builder permitExplicitGc() {
- // TODO(b/3400644): Un-hide this for next API update
return disable(DETECT_THREAD_EXPLICIT_GC);
}
diff --git a/core/java/android/os/incremental/IncrementalStorage.java b/core/java/android/os/incremental/IncrementalStorage.java
index 13b22d3..a1ed253 100644
--- a/core/java/android/os/incremental/IncrementalStorage.java
+++ b/core/java/android/os/incremental/IncrementalStorage.java
@@ -26,6 +26,7 @@
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.util.Arrays;
import java.util.Objects;
import java.util.UUID;
@@ -515,7 +516,7 @@
throw new IOException("Unsupported log2BlockSize: " + hashingInfo.log2BlockSize);
}
if (hashingInfo.salt != null && hashingInfo.salt.length > 0) {
- throw new IOException("Unsupported salt: " + hashingInfo.salt);
+ throw new IOException("Unsupported salt: " + Arrays.toString(hashingInfo.salt));
}
if (hashingInfo.rawRootHash.length != INCFS_MAX_HASH_SIZE) {
throw new IOException("rawRootHash has to be " + INCFS_MAX_HASH_SIZE + " bytes");
diff --git a/core/java/android/os/strictmode/ExplicitGcViolation.java b/core/java/android/os/strictmode/ExplicitGcViolation.java
index 583ed1a..c4ae82d 100644
--- a/core/java/android/os/strictmode/ExplicitGcViolation.java
+++ b/core/java/android/os/strictmode/ExplicitGcViolation.java
@@ -19,10 +19,7 @@
/**
* See #{@link android.os.StrictMode.ThreadPolicy.Builder#detectExplicitGc()}.
- *
- * @hide
*/
-@TestApi
public final class ExplicitGcViolation extends Violation {
/** @hide */
public ExplicitGcViolation() {
diff --git a/core/java/android/service/autofill/OptionalValidators.java b/core/java/android/service/autofill/OptionalValidators.java
index 7189c88..2043539 100644
--- a/core/java/android/service/autofill/OptionalValidators.java
+++ b/core/java/android/service/autofill/OptionalValidators.java
@@ -25,6 +25,8 @@
import com.android.internal.util.Preconditions;
+import java.util.Arrays;
+
/**
* Compound validator that returns {@code true} on {@link #isValid(ValueFinder)} if any
* of its subvalidators returns {@code true} as well.
@@ -61,7 +63,8 @@
public String toString() {
if (!sDebug) return super.toString();
- return new StringBuilder("OptionalValidators: [validators=").append(mValidators)
+ return new StringBuilder("OptionalValidators: [validators=")
+ .append(Arrays.toString(mValidators))
.append("]")
.toString();
}
diff --git a/core/java/android/service/autofill/RequiredValidators.java b/core/java/android/service/autofill/RequiredValidators.java
index 619eba0..054582e 100644
--- a/core/java/android/service/autofill/RequiredValidators.java
+++ b/core/java/android/service/autofill/RequiredValidators.java
@@ -25,6 +25,8 @@
import com.android.internal.util.Preconditions;
+import java.util.Arrays;
+
/**
* Compound validator that only returns {@code true} on {@link #isValid(ValueFinder)} if all
* of its subvalidators return {@code true} as well.
@@ -60,7 +62,8 @@
public String toString() {
if (!sDebug) return super.toString();
- return new StringBuilder("RequiredValidators: [validators=").append(mValidators)
+ return new StringBuilder("RequiredValidators: [validators=")
+ .append(Arrays.toString(mValidators))
.append("]")
.toString();
}
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/service/voice/VoiceInteractionSession.java b/core/java/android/service/voice/VoiceInteractionSession.java
index 11b60ca..777d143 100644
--- a/core/java/android/service/voice/VoiceInteractionSession.java
+++ b/core/java/android/service/voice/VoiceInteractionSession.java
@@ -73,6 +73,7 @@
import java.io.PrintWriter;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -597,7 +598,7 @@
VoiceInteractor.PickOptionRequest.Option[] selections, Bundle result) {
try {
if (DEBUG) Log.d(TAG, "sendPickOptionResult: req=" + mInterface
- + " finished=" + finished + " selections=" + selections
+ + " finished=" + finished + " selections=" + Arrays.toString(selections)
+ " result=" + result);
if (finished) {
finishRequest();
diff --git a/core/java/android/speech/tts/FileSynthesisCallback.java b/core/java/android/speech/tts/FileSynthesisCallback.java
index 3bde32b..3177c5c 100644
--- a/core/java/android/speech/tts/FileSynthesisCallback.java
+++ b/core/java/android/speech/tts/FileSynthesisCallback.java
@@ -24,6 +24,7 @@
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.FileChannel;
+import java.util.Arrays;
/**
* Speech synthesis request that writes the audio to a WAV file.
@@ -152,8 +153,8 @@
@Override
public int audioAvailable(byte[] buffer, int offset, int length) {
if (DBG) {
- Log.d(TAG, "FileSynthesisRequest.audioAvailable(" + buffer + "," + offset
- + "," + length + ")");
+ Log.d(TAG, "FileSynthesisRequest.audioAvailable(" + Arrays.toString(buffer)
+ + "," + offset + "," + length + ")");
}
FileChannel fileChannel = null;
synchronized (mStateLock) {
diff --git a/core/java/android/util/ArrayMap.java b/core/java/android/util/ArrayMap.java
index c0bc991..155f508 100644
--- a/core/java/android/util/ArrayMap.java
+++ b/core/java/android/util/ArrayMap.java
@@ -23,6 +23,7 @@
import libcore.util.EmptyArray;
+import java.util.Arrays;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Map;
@@ -231,7 +232,7 @@
array[0] = array[1] = null;
mTwiceBaseCacheSize--;
if (DEBUG) {
- Log.d(TAG, "Retrieving 2x cache " + mHashes
+ Log.d(TAG, "Retrieving 2x cache " + Arrays.toString(mHashes)
+ " now have " + mTwiceBaseCacheSize + " entries");
}
return;
@@ -258,7 +259,7 @@
array[0] = array[1] = null;
mBaseCacheSize--;
if (DEBUG) {
- Log.d(TAG, "Retrieving 1x cache " + mHashes
+ Log.d(TAG, "Retrieving 1x cache " + Arrays.toString(mHashes)
+ " now have " + mBaseCacheSize + " entries");
}
return;
@@ -295,8 +296,10 @@
}
mTwiceBaseCache = array;
mTwiceBaseCacheSize++;
- if (DEBUG) Log.d(TAG, "Storing 2x cache " + array
- + " now have " + mTwiceBaseCacheSize + " entries");
+ if (DEBUG) {
+ Log.d(TAG, "Storing 2x cache " + Arrays.toString(array)
+ + " now have " + mTwiceBaseCacheSize + " entries");
+ }
}
}
} else if (hashes.length == BASE_SIZE) {
@@ -309,8 +312,10 @@
}
mBaseCache = array;
mBaseCacheSize++;
- if (DEBUG) Log.d(TAG, "Storing 1x cache " + array
- + " now have " + mBaseCacheSize + " entries");
+ if (DEBUG) {
+ Log.d(TAG, "Storing 1x cache " + Arrays.toString(array)
+ + " now have " + mBaseCacheSize + " entries");
+ }
}
}
}
diff --git a/core/java/android/util/ArraySet.java b/core/java/android/util/ArraySet.java
index b5c75b9..73114e2 100644
--- a/core/java/android/util/ArraySet.java
+++ b/core/java/android/util/ArraySet.java
@@ -23,6 +23,7 @@
import libcore.util.EmptyArray;
import java.lang.reflect.Array;
+import java.util.Arrays;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
@@ -194,8 +195,8 @@
array[0] = array[1] = null;
sTwiceBaseCacheSize--;
if (DEBUG) {
- Log.d(TAG, "Retrieving 2x cache " + mHashes + " now have "
- + sTwiceBaseCacheSize + " entries");
+ Log.d(TAG, "Retrieving 2x cache " + Arrays.toString(mHashes)
+ + " now have " + sTwiceBaseCacheSize + " entries");
}
return;
}
@@ -221,8 +222,8 @@
array[0] = array[1] = null;
sBaseCacheSize--;
if (DEBUG) {
- Log.d(TAG, "Retrieving 1x cache " + mHashes + " now have "
- + sBaseCacheSize + " entries");
+ Log.d(TAG, "Retrieving 1x cache " + Arrays.toString(mHashes)
+ + " now have " + sBaseCacheSize + " entries");
}
return;
}
@@ -259,8 +260,8 @@
sTwiceBaseCache = array;
sTwiceBaseCacheSize++;
if (DEBUG) {
- Log.d(TAG, "Storing 2x cache " + array + " now have " + sTwiceBaseCacheSize
- + " entries");
+ Log.d(TAG, "Storing 2x cache " + Arrays.toString(array) + " now have "
+ + sTwiceBaseCacheSize + " entries");
}
}
}
@@ -275,7 +276,7 @@
sBaseCache = array;
sBaseCacheSize++;
if (DEBUG) {
- Log.d(TAG, "Storing 1x cache " + array + " now have "
+ Log.d(TAG, "Storing 1x cache " + Arrays.toString(array) + " now have "
+ sBaseCacheSize + " entries");
}
}
diff --git a/core/java/android/util/proto/ProtoInputStream.java b/core/java/android/util/proto/ProtoInputStream.java
index 9789b10..9a15cd5 100644
--- a/core/java/android/util/proto/ProtoInputStream.java
+++ b/core/java/android/util/proto/ProtoInputStream.java
@@ -21,6 +21,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.Objects;
/**
* Class to read to a protobuf stream.
@@ -968,26 +970,17 @@
public String dumpDebugData() {
StringBuilder sb = new StringBuilder();
- sb.append("\nmFieldNumber : 0x" + Integer.toHexString(mFieldNumber));
- sb.append("\nmWireType : 0x" + Integer.toHexString(mWireType));
- sb.append("\nmState : 0x" + Integer.toHexString(mState));
- sb.append("\nmDiscardedBytes : 0x" + Integer.toHexString(mDiscardedBytes));
- sb.append("\nmOffset : 0x" + Integer.toHexString(mOffset));
- sb.append("\nmExpectedObjectTokenStack : ");
- if (mExpectedObjectTokenStack == null) {
- sb.append("null");
- } else {
- sb.append(mExpectedObjectTokenStack);
- }
- sb.append("\nmDepth : 0x" + Integer.toHexString(mDepth));
- sb.append("\nmBuffer : ");
- if (mBuffer == null) {
- sb.append("null");
- } else {
- sb.append(mBuffer);
- }
- sb.append("\nmBufferSize : 0x" + Integer.toHexString(mBufferSize));
- sb.append("\nmEnd : 0x" + Integer.toHexString(mEnd));
+ sb.append("\nmFieldNumber : 0x").append(Integer.toHexString(mFieldNumber));
+ sb.append("\nmWireType : 0x").append(Integer.toHexString(mWireType));
+ sb.append("\nmState : 0x").append(Integer.toHexString(mState));
+ sb.append("\nmDiscardedBytes : 0x").append(Integer.toHexString(mDiscardedBytes));
+ sb.append("\nmOffset : 0x").append(Integer.toHexString(mOffset));
+ sb.append("\nmExpectedObjectTokenStack : ")
+ .append(Objects.toString(mExpectedObjectTokenStack));
+ sb.append("\nmDepth : 0x").append(Integer.toHexString(mDepth));
+ sb.append("\nmBuffer : ").append(Arrays.toString(mBuffer));
+ sb.append("\nmBufferSize : 0x").append(Integer.toHexString(mBufferSize));
+ sb.append("\nmEnd : 0x").append(Integer.toHexString(mEnd));
return sb.toString();
}
diff --git a/core/java/android/util/proto/ProtoUtils.java b/core/java/android/util/proto/ProtoUtils.java
index 8464d2d..58d9913 100644
--- a/core/java/android/util/proto/ProtoUtils.java
+++ b/core/java/android/util/proto/ProtoUtils.java
@@ -20,6 +20,7 @@
import android.util.Duration;
import java.io.IOException;
+import java.util.Arrays;
/**
* This class contains a list of helper functions to write common proto in
@@ -91,27 +92,27 @@
final int wireType = proto.getWireType();
long fieldConstant;
- sb.append("Offset : 0x" + Integer.toHexString(proto.getOffset()));
- sb.append("\nField Number : 0x" + Integer.toHexString(proto.getFieldNumber()));
+ sb.append("Offset : 0x").append(Integer.toHexString(proto.getOffset()));
+ sb.append("\nField Number : 0x").append(Integer.toHexString(proto.getFieldNumber()));
sb.append("\nWire Type : ");
switch (wireType) {
case ProtoStream.WIRE_TYPE_VARINT:
- sb.append("varint");
fieldConstant = ProtoStream.makeFieldId(fieldNumber,
ProtoStream.FIELD_COUNT_SINGLE | ProtoStream.FIELD_TYPE_INT64);
- sb.append("\nField Value : 0x" + Long.toHexString(proto.readLong(fieldConstant)));
+ sb.append("varint\nField Value : 0x");
+ sb.append(Long.toHexString(proto.readLong(fieldConstant)));
break;
case ProtoStream.WIRE_TYPE_FIXED64:
- sb.append("fixed64");
fieldConstant = ProtoStream.makeFieldId(fieldNumber,
ProtoStream.FIELD_COUNT_SINGLE | ProtoStream.FIELD_TYPE_FIXED64);
- sb.append("\nField Value : 0x" + Long.toHexString(proto.readLong(fieldConstant)));
+ sb.append("fixed64\nField Value : 0x");
+ sb.append(Long.toHexString(proto.readLong(fieldConstant)));
break;
case ProtoStream.WIRE_TYPE_LENGTH_DELIMITED:
- sb.append("length delimited");
fieldConstant = ProtoStream.makeFieldId(fieldNumber,
ProtoStream.FIELD_COUNT_SINGLE | ProtoStream.FIELD_TYPE_BYTES);
- sb.append("\nField Bytes : " + proto.readBytes(fieldConstant));
+ sb.append("length delimited\nField Bytes : ");
+ sb.append(Arrays.toString(proto.readBytes(fieldConstant)));
break;
case ProtoStream.WIRE_TYPE_START_GROUP:
sb.append("start group");
@@ -120,13 +121,13 @@
sb.append("end group");
break;
case ProtoStream.WIRE_TYPE_FIXED32:
- sb.append("fixed32");
fieldConstant = ProtoStream.makeFieldId(fieldNumber,
ProtoStream.FIELD_COUNT_SINGLE | ProtoStream.FIELD_TYPE_FIXED32);
- sb.append("\nField Value : 0x" + Integer.toHexString(proto.readInt(fieldConstant)));
+ sb.append("fixed32\nField Value : 0x");
+ sb.append(Integer.toHexString(proto.readInt(fieldConstant)));
break;
default:
- sb.append("unknown(" + proto.getWireType() + ")");
+ sb.append("unknown(").append(proto.getWireType()).append(")");
}
return sb.toString();
}
diff --git a/core/java/android/view/OWNERS b/core/java/android/view/OWNERS
index 1e1c250..6d64022 100644
--- a/core/java/android/view/OWNERS
+++ b/core/java/android/view/OWNERS
@@ -81,8 +81,8 @@
per-file DisplayCutout.aidl = file:/services/core/java/com/android/server/wm/OWNERS
per-file DisplayCutout.java = file:/services/core/java/com/android/server/wm/OWNERS
per-file IDisplay*.aidl = file:/services/core/java/com/android/server/wm/OWNERS
-per-file Inset*.java = file:/services/core/java/com/android/server/wm/OWNERS
-per-file Inset*.aidl = file:/services/core/java/com/android/server/wm/OWNERS
+per-file *Inset*.java = file:/services/core/java/com/android/server/wm/OWNERS
+per-file *Inset*.aidl = file:/services/core/java/com/android/server/wm/OWNERS
per-file IPinnedStackListener.aidl = file:/services/core/java/com/android/server/wm/OWNERS
per-file IRecents*.aidl = file:/services/core/java/com/android/server/wm/OWNERS
per-file IRemote*.aidl = file:/services/core/java/com/android/server/wm/OWNERS
@@ -94,7 +94,6 @@
per-file SurfaceControl*.aidl = file:/services/core/java/com/android/server/wm/OWNERS
per-file SurfaceSession.java = file:/services/core/java/com/android/server/wm/OWNERS
per-file SyncRtSurfaceTransactionApplier.java = file:/services/core/java/com/android/server/wm/OWNERS
-per-file ViewRootInsetsControllerHost.java = file:/services/core/java/com/android/server/wm/OWNERS
per-file Window*.java = file:/services/core/java/com/android/server/wm/OWNERS
per-file Window*.aidl = file:/services/core/java/com/android/server/wm/OWNERS
per-file TransactionCommittedCallback.java = file:/services/core/java/com/android/server/wm/OWNERS
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index a1ce39e..6a23aba 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -1934,7 +1934,7 @@
@Override
public int hashCode() {
- return Objects.hash(supportedDisplayModes, activeDisplayModeId, activeDisplayModeId,
+ return Objects.hash(Arrays.hashCode(supportedDisplayModes), activeDisplayModeId,
activeColorMode, hdrCapabilities);
}
}
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/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index ac57d69..e290812 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -7928,20 +7928,31 @@
synchronized (mModemNetworkLock) {
if (displayTransport == TRANSPORT_CELLULAR) {
mModemIfaces = includeInStringArray(mModemIfaces, iface);
- if (DEBUG) Slog.d(TAG, "Note mobile iface " + iface + ": " + mModemIfaces);
+ if (DEBUG) {
+ Slog.d(TAG, "Note mobile iface " + iface + ": "
+ + Arrays.toString(mModemIfaces));
+ }
} else {
mModemIfaces = excludeFromStringArray(mModemIfaces, iface);
- if (DEBUG) Slog.d(TAG, "Note non-mobile iface " + iface + ": " + mModemIfaces);
+ if (DEBUG) {
+ Slog.d(TAG, "Note non-mobile iface " + iface + ": "
+ + Arrays.toString(mModemIfaces));
+ }
}
}
synchronized (mWifiNetworkLock) {
if (displayTransport == TRANSPORT_WIFI) {
mWifiIfaces = includeInStringArray(mWifiIfaces, iface);
- if (DEBUG) Slog.d(TAG, "Note wifi iface " + iface + ": " + mWifiIfaces);
+ if (DEBUG) {
+ Slog.d(TAG, "Note wifi iface " + iface + ": " + Arrays.toString(mWifiIfaces));
+ }
} else {
mWifiIfaces = excludeFromStringArray(mWifiIfaces, iface);
- if (DEBUG) Slog.d(TAG, "Note non-wifi iface " + iface + ": " + mWifiIfaces);
+ if (DEBUG) {
+ Slog.d(TAG, "Note non-wifi iface " + iface + ": "
+ + Arrays.toString(mWifiIfaces));
+ }
}
}
}
@@ -14409,7 +14420,7 @@
@NonNull CpuDeltaPowerAccumulator accumulator) {
if (DEBUG_ENERGY) {
Slog.d(TAG,
- "Updating cpu cluster stats: " + clusterChargeUC.toString());
+ "Updating cpu cluster stats: " + Arrays.toString(clusterChargeUC));
}
if (mGlobalMeasuredEnergyStats == null) {
return;
diff --git a/core/java/com/android/internal/widget/LockscreenCredential.java b/core/java/com/android/internal/widget/LockscreenCredential.java
index 1074004..db83c09 100644
--- a/core/java/com/android/internal/widget/LockscreenCredential.java
+++ b/core/java/com/android/internal/widget/LockscreenCredential.java
@@ -26,7 +26,6 @@
import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;
-import android.os.storage.StorageManager;
import android.text.TextUtils;
import com.android.internal.util.Preconditions;
@@ -368,7 +367,7 @@
@Override
public int hashCode() {
// Effective Java — Always override hashCode when you override equals
- return (17 + mType) * 31 + mCredential.hashCode();
+ return Objects.hash(mType, Arrays.hashCode(mCredential));
}
@Override
diff --git a/core/jni/OWNERS b/core/jni/OWNERS
index 671e634..14699e7 100644
--- a/core/jni/OWNERS
+++ b/core/jni/OWNERS
@@ -49,7 +49,7 @@
per-file *Zygote* = file:/ZYGOTE_OWNERS
per-file core_jni_helpers.* = file:/ZYGOTE_OWNERS
per-file fd_utils.* = file:/ZYGOTE_OWNERS
-per-file Android.bp = file:platform/build/soong:/OWNERS
+per-file Android.bp = file:platform/build/soong:/OWNERS #{LAST_RESORT_SUGGESTION}
per-file android_animation_* = file:/core/java/android/animation/OWNERS
per-file android_app_admin_* = file:/core/java/android/app/admin/OWNERS
per-file android_hardware_Usb* = file:/services/usb/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/locale_config.xml b/core/res/res/values/locale_config.xml
index e9b42d3..78ec145 100644
--- a/core/res/res/values/locale_config.xml
+++ b/core/res/res/values/locale_config.xml
@@ -23,7 +23,7 @@
<item>ak-GH</item> <!-- Akan (Ghana) -->
<item>am-ET</item> <!-- Amharic (Ethiopia) -->
<item>ar-AE</item> <!-- Arabic (United Arab Emirates) -->
- <item>ar-AE-u-nu-latn</item> <!-- Arabic (United Arab Emirates, Western Digits) -->
+ <item>ar-AE-u-nu-arab</item> <!-- Arabic (United Arab Emirates, Arabic Digits) -->
<item>ar-BH</item> <!-- Arabic (Bahrain) -->
<item>ar-BH-u-nu-latn</item> <!-- Arabic (Bahrain, Western Digits) -->
<item>ar-DJ</item> <!-- Arabic (Djibouti) -->
@@ -190,6 +190,7 @@
<item>en-MS</item> <!-- English (Montserrat) -->
<item>en-MT</item> <!-- English (Malta) -->
<item>en-MU</item> <!-- English (Mauritius) -->
+ <item>en-MV</item> <!-- English (Maldives) -->
<item>en-MW</item> <!-- English (Malawi) -->
<item>en-MY</item> <!-- English (Malaysia) -->
<item>en-NA</item> <!-- English (Namibia) -->
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/core/tests/coretests/src/android/hardware/input/OWNERS b/core/tests/coretests/src/android/hardware/input/OWNERS
new file mode 100644
index 0000000..3f8a602
--- /dev/null
+++ b/core/tests/coretests/src/android/hardware/input/OWNERS
@@ -0,0 +1,2 @@
+include /core/java/android/hardware/input/OWNERS
+
diff --git a/core/tests/coretests/src/android/provider/FontsContractTest.java b/core/tests/coretests/src/android/provider/FontsContractTest.java
index c5d6f7f..21a2205 100644
--- a/core/tests/coretests/src/android/provider/FontsContractTest.java
+++ b/core/tests/coretests/src/android/provider/FontsContractTest.java
@@ -42,6 +42,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
/**
@@ -282,9 +283,10 @@
setupPackageManager();
byte[] wrongCert = Base64.decode("this is a wrong cert", Base64.DEFAULT);
- List<byte[]> certList = Arrays.asList(wrongCert);
+ List<byte[]> certList = Collections.singletonList(wrongCert);
FontRequest requestWrongCerts = new FontRequest(
- TestFontsProvider.AUTHORITY, PACKAGE_NAME, "query", Arrays.asList(certList));
+ TestFontsProvider.AUTHORITY, PACKAGE_NAME, "query",
+ Collections.singletonList(certList));
assertNull(FontsContract.getProvider(mPackageManager, requestWrongCerts));
}
@@ -293,9 +295,10 @@
throws PackageManager.NameNotFoundException {
ProviderInfo info = setupPackageManager();
- List<byte[]> certList = Arrays.asList(BYTE_ARRAY);
+ List<byte[]> certList = Collections.singletonList(BYTE_ARRAY);
FontRequest requestRightCerts = new FontRequest(
- TestFontsProvider.AUTHORITY, PACKAGE_NAME, "query", Arrays.asList(certList));
+ TestFontsProvider.AUTHORITY, PACKAGE_NAME, "query",
+ Collections.singletonList(certList));
ProviderInfo result = FontsContract.getProvider(
mPackageManager, requestRightCerts);
@@ -309,7 +312,8 @@
byte[] wrongCert = Base64.decode("this is a wrong cert", Base64.DEFAULT);
List<byte[]> certList = Arrays.asList(wrongCert, BYTE_ARRAY);
FontRequest requestRightCerts = new FontRequest(
- TestFontsProvider.AUTHORITY, PACKAGE_NAME, "query", Arrays.asList(certList));
+ TestFontsProvider.AUTHORITY, PACKAGE_NAME, "query",
+ Collections.singletonList(certList));
assertNull(FontsContract.getProvider(mPackageManager, requestRightCerts));
}
@@ -332,7 +336,8 @@
// {BYTE_ARRAY_2, BYTE_ARRAY_COPY}.
List<byte[]> certList = Arrays.asList(BYTE_ARRAY_2, BYTE_ARRAY_COPY);
FontRequest requestRightCerts = new FontRequest(
- TestFontsProvider.AUTHORITY, PACKAGE_NAME, "query", Arrays.asList(certList));
+ TestFontsProvider.AUTHORITY, PACKAGE_NAME, "query",
+ Collections.singletonList(certList));
assertNull(FontsContract.getProvider(mPackageManager, requestRightCerts));
}
@@ -341,9 +346,9 @@
ProviderInfo info = setupPackageManager();
List<List<byte[]>> certList = new ArrayList<>();
- byte[] wrongCert = Base64.decode("this is a wrong cert", Base64.DEFAULT);
- certList.add(Arrays.asList(wrongCert));
- certList.add(Arrays.asList(BYTE_ARRAY));
+ certList.add(Collections.singletonList(
+ Base64.decode("this is a wrong cert", Base64.DEFAULT)));
+ certList.add(Collections.singletonList(BYTE_ARRAY));
FontRequest requestRightCerts = new FontRequest(
TestFontsProvider.AUTHORITY, PACKAGE_NAME, "query", certList);
ProviderInfo result = FontsContract.getProvider(mPackageManager, requestRightCerts);
@@ -356,7 +361,7 @@
setupPackageManager();
List<List<byte[]>> certList = new ArrayList<>();
- certList.add(Arrays.asList(BYTE_ARRAY));
+ certList.add(Collections.singletonList(BYTE_ARRAY));
FontRequest requestRightCerts = new FontRequest(
TestFontsProvider.AUTHORITY, "com.wrong.package.name", "query", certList);
try {
diff --git a/graphics/java/android/graphics/ColorSpace.java b/graphics/java/android/graphics/ColorSpace.java
index 582488f..ca3c847 100644
--- a/graphics/java/android/graphics/ColorSpace.java
+++ b/graphics/java/android/graphics/ColorSpace.java
@@ -2796,7 +2796,8 @@
if (mWhitePoint == null || mTransform == null) {
throw new IllegalStateException(
"ColorSpace (" + this + ") cannot create native object! mWhitePoint: "
- + mWhitePoint + " mTransform: " + mTransform);
+ + Arrays.toString(mWhitePoint) + " mTransform: "
+ + Arrays.toString(mTransform));
}
// This mimics the old code that was in native.
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp
index 53c6db0..f9b3a8c 100644
--- a/libs/hwui/SkiaCanvas.cpp
+++ b/libs/hwui/SkiaCanvas.cpp
@@ -51,6 +51,49 @@
using uirenderer::PaintUtils;
+class SkiaCanvas::Clip {
+public:
+ Clip(const SkRect& rect, SkClipOp op, const SkMatrix& m)
+ : mType(Type::Rect), mOp(op), mMatrix(m), mRRect(SkRRect::MakeRect(rect)) {}
+ Clip(const SkRRect& rrect, SkClipOp op, const SkMatrix& m)
+ : mType(Type::RRect), mOp(op), mMatrix(m), mRRect(rrect) {}
+ Clip(const SkPath& path, SkClipOp op, const SkMatrix& m)
+ : mType(Type::Path), mOp(op), mMatrix(m), mPath(std::in_place, path) {}
+
+ void apply(SkCanvas* canvas) const {
+ canvas->setMatrix(mMatrix);
+ switch (mType) {
+ case Type::Rect:
+ // Don't anti-alias rectangular clips
+ canvas->clipRect(mRRect.rect(), mOp, false);
+ break;
+ case Type::RRect:
+ // Ensure rounded rectangular clips are anti-aliased
+ canvas->clipRRect(mRRect, mOp, true);
+ break;
+ case Type::Path:
+ // Ensure path clips are anti-aliased
+ canvas->clipPath(mPath.value(), mOp, true);
+ break;
+ }
+ }
+
+private:
+ enum class Type {
+ Rect,
+ RRect,
+ Path,
+ };
+
+ Type mType;
+ SkClipOp mOp;
+ SkMatrix mMatrix;
+
+ // These are logically a union (tracked separately due to non-POD path).
+ std::optional<SkPath> mPath;
+ SkRRect mRRect;
+};
+
Canvas* Canvas::create_canvas(const SkBitmap& bitmap) {
return new SkiaCanvas(bitmap);
}
@@ -194,49 +237,6 @@
}
}
-class SkiaCanvas::Clip {
-public:
- Clip(const SkRect& rect, SkClipOp op, const SkMatrix& m)
- : mType(Type::Rect), mOp(op), mMatrix(m), mRRect(SkRRect::MakeRect(rect)) {}
- Clip(const SkRRect& rrect, SkClipOp op, const SkMatrix& m)
- : mType(Type::RRect), mOp(op), mMatrix(m), mRRect(rrect) {}
- Clip(const SkPath& path, SkClipOp op, const SkMatrix& m)
- : mType(Type::Path), mOp(op), mMatrix(m), mPath(std::in_place, path) {}
-
- void apply(SkCanvas* canvas) const {
- canvas->setMatrix(mMatrix);
- switch (mType) {
- case Type::Rect:
- // Don't anti-alias rectangular clips
- canvas->clipRect(mRRect.rect(), mOp, false);
- break;
- case Type::RRect:
- // Ensure rounded rectangular clips are anti-aliased
- canvas->clipRRect(mRRect, mOp, true);
- break;
- case Type::Path:
- // Ensure path clips are anti-aliased
- canvas->clipPath(mPath.value(), mOp, true);
- break;
- }
- }
-
-private:
- enum class Type {
- Rect,
- RRect,
- Path,
- };
-
- Type mType;
- SkClipOp mOp;
- SkMatrix mMatrix;
-
- // These are logically a union (tracked separately due to non-POD path).
- std::optional<SkPath> mPath;
- SkRRect mRRect;
-};
-
const SkiaCanvas::SaveRec* SkiaCanvas::currentSaveRec() const {
const SaveRec* rec = mSaveStack ? static_cast<const SaveRec*>(mSaveStack->back()) : nullptr;
int currentSaveCount = mCanvas->getSaveCount();
diff --git a/libs/hwui/thread/WorkQueue.h b/libs/hwui/thread/WorkQueue.h
index 46b8bc0..f2751d2 100644
--- a/libs/hwui/thread/WorkQueue.h
+++ b/libs/hwui/thread/WorkQueue.h
@@ -57,7 +57,7 @@
public:
WorkQueue(std::function<void()>&& wakeFunc, std::mutex& lock)
- : mWakeFunc(move(wakeFunc)), mLock(lock) {}
+ : mWakeFunc(std::move(wakeFunc)), mLock(lock) {}
void process() {
auto now = clock::now();
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/media/Android.bp b/media/Android.bp
index d28a21c..ec243bf 100644
--- a/media/Android.bp
+++ b/media/Android.bp
@@ -113,7 +113,7 @@
min_sdk_version: "29",
apex_available: [
"//apex_available:platform",
- "com.android.bluetooth",
+ "com.android.btservices",
],
},
},
diff --git a/media/aidl/android/media/audio/common/AudioPort.aidl b/media/aidl/android/media/audio/common/AudioPort.aidl
index 84675e3..d32b840 100644
--- a/media/aidl/android/media/audio/common/AudioPort.aidl
+++ b/media/aidl/android/media/audio/common/AudioPort.aidl
@@ -23,8 +23,9 @@
import android.media.audio.common.ExtraAudioDescriptor;
/**
- * Audio port structure describes the capabilities of an audio port
- * as well as its current configuration.
+ * Audio port structure describes the capabilities of an audio port.
+ * This is a "blueprint" which contains all the possible configurations
+ * that are supported by the port.
*
* {@hide}
*/
diff --git a/media/aidl/android/media/audio/common/AudioPortExt.aidl b/media/aidl/android/media/audio/common/AudioPortExt.aidl
index c4681cb..eadc0ab 100644
--- a/media/aidl/android/media/audio/common/AudioPortExt.aidl
+++ b/media/aidl/android/media/audio/common/AudioPortExt.aidl
@@ -34,6 +34,9 @@
AudioPortDeviceExt device;
/** Information specific to mix ports. */
AudioPortMixExt mix;
- /** Audio session identifier. */
+ /**
+ * NOT USED. Framework audio session identifier.
+ * Use android.media.AudioPortExtSys.session on the system side.
+ */
int session;
}
diff --git a/media/aidl/android/media/audio/common/AudioPortMixExt.aidl b/media/aidl/android/media/audio/common/AudioPortMixExt.aidl
index f3613a4..eb117ec 100644
--- a/media/aidl/android/media/audio/common/AudioPortMixExt.aidl
+++ b/media/aidl/android/media/audio/common/AudioPortMixExt.aidl
@@ -32,12 +32,12 @@
AudioPortMixExtUseCase usecase;
/**
* Maximum number of input or output streams that can be simultaneously
- * opened for this port.
+ * opened for this port. '0' means 'unlimited'.
*/
int maxOpenStreamCount;
/**
* Maximum number of input or output streams that can be simultaneously
- * active for this port.
+ * active for this port. '0' means 'all opened streams'.
*/
int maxActiveStreamCount;
/** Mute duration while changing device, when used for output. */
diff --git a/media/java/android/media/BluetoothProfileConnectionInfo.java b/media/java/android/media/BluetoothProfileConnectionInfo.java
index c148846..a316c21 100644
--- a/media/java/android/media/BluetoothProfileConnectionInfo.java
+++ b/media/java/android/media/BluetoothProfileConnectionInfo.java
@@ -126,6 +126,20 @@
}
/**
+ * Factory method for <code>BluetoothProfileConnectionInfo</code> for an LE output device
+ * @param suppressNoisyIntent if true the {@link AudioManager.ACTION_AUDIO_BECOMING_NOISY}
+ * intent will not be sent.
+ * @param volume the volume index of the device, -1 if unknown or to be ignored
+ * @return an instance of BluetoothProfileConnectionInfo for the BLE output device that reflects
+ * the given parameters
+ */
+ public static @NonNull BluetoothProfileConnectionInfo createLeAudioOutputInfo(
+ boolean suppressNoisyIntent, int volume) {
+ return new BluetoothProfileConnectionInfo(BluetoothProfile.LE_AUDIO, suppressNoisyIntent,
+ volume, /*isLeOutput*/ true);
+ }
+
+ /**
* @return The profile connection
*/
public int getProfile() {
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 1077275..737bc34 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -5089,9 +5089,12 @@
@Nullable Map<String, String> optionalParameters)
throws NoDrmSchemeException
{
- Log.v(TAG, "getKeyRequest: " +
- " keySetId: " + keySetId + " initData:" + initData + " mimeType: " + mimeType +
- " keyType: " + keyType + " optionalParameters: " + optionalParameters);
+ Log.v(TAG, "getKeyRequest: "
+ + " keySetId: " + Arrays.toString(keySetId)
+ + " initData:" + Arrays.toString(initData)
+ + " mimeType: " + mimeType
+ + " keyType: " + keyType
+ + " optionalParameters: " + optionalParameters);
synchronized (mDrmLock) {
if (!mActiveDrmScheme) {
@@ -5150,7 +5153,8 @@
public byte[] provideKeyResponse(@Nullable byte[] keySetId, @NonNull byte[] response)
throws NoDrmSchemeException, DeniedByServerException
{
- Log.v(TAG, "provideKeyResponse: keySetId: " + keySetId + " response: " + response);
+ Log.v(TAG, "provideKeyResponse: keySetId: " + Arrays.toString(keySetId)
+ + " response: " + Arrays.toString(response));
synchronized (mDrmLock) {
@@ -5166,8 +5170,9 @@
byte[] keySetResult = mDrmObj.provideKeyResponse(scope, response);
- Log.v(TAG, "provideKeyResponse: keySetId: " + keySetId + " response: " + response +
- " --> " + keySetResult);
+ Log.v(TAG, "provideKeyResponse: keySetId: " + Arrays.toString(keySetId)
+ + " response: " + Arrays.toString(response)
+ + " --> " + Arrays.toString(keySetResult));
return keySetResult;
@@ -5194,7 +5199,7 @@
public void restoreKeys(@NonNull byte[] keySetId)
throws NoDrmSchemeException
{
- Log.v(TAG, "restoreKeys: keySetId: " + keySetId);
+ Log.v(TAG, "restoreKeys: keySetId: " + Arrays.toString(keySetId));
synchronized (mDrmLock) {
@@ -5481,7 +5486,8 @@
// at prepareDrm/openSession rather than getKeyRequest/provideKeyResponse
try {
mDrmSessionId = mDrmObj.openSession();
- Log.v(TAG, "prepareDrm_openSessionStep: mDrmSessionId=" + mDrmSessionId);
+ Log.v(TAG, "prepareDrm_openSessionStep: mDrmSessionId="
+ + Arrays.toString(mDrmSessionId));
// Sending it down to native/mediaserver to create the crypto object
// This call could simply fail due to bad player state, e.g., after start().
@@ -5544,7 +5550,7 @@
response = Streams.readFully(connection.getInputStream());
Log.v(TAG, "HandleProvisioninig: Thread run: response " +
- response.length + " " + response);
+ response.length + " " + Arrays.toString(response));
} catch (Exception e) {
status = PREPARE_DRM_STATUS_PROVISIONING_NETWORK_ERROR;
Log.w(TAG, "HandleProvisioninig: Thread run: connect " + e + " url: " + url);
@@ -5628,8 +5634,9 @@
return PREPARE_DRM_STATUS_PREPARATION_ERROR;
}
- Log.v(TAG, "HandleProvisioninig provReq " +
- " data: " + provReq.getData() + " url: " + provReq.getDefaultUrl());
+ Log.v(TAG, "HandleProvisioninig provReq "
+ + " data: " + Arrays.toString(provReq.getData())
+ + " url: " + provReq.getDefaultUrl());
// networking in a background thread
mDrmProvisioningInProgress = true;
@@ -5712,7 +5719,8 @@
private void cleanDrmObj()
{
// the caller holds mDrmLock
- Log.v(TAG, "cleanDrmObj: mDrmObj=" + mDrmObj + " mDrmSessionId=" + mDrmSessionId);
+ Log.v(TAG, "cleanDrmObj: mDrmObj=" + mDrmObj
+ + " mDrmSessionId=" + Arrays.toString(mDrmSessionId));
if (mDrmSessionId != null) {
mDrmObj.closeSession(mDrmSessionId);
diff --git a/media/java/android/media/audiopolicy/AudioProductStrategy.java b/media/java/android/media/audiopolicy/AudioProductStrategy.java
index 31d5967..f957498 100644
--- a/media/java/android/media/audiopolicy/AudioProductStrategy.java
+++ b/media/java/android/media/audiopolicy/AudioProductStrategy.java
@@ -32,6 +32,7 @@
import com.android.internal.util.Preconditions;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
/**
@@ -182,7 +183,7 @@
AudioProductStrategy thatStrategy = (AudioProductStrategy) o;
return mName == thatStrategy.mName && mId == thatStrategy.mId
- && mAudioAttributesGroups.equals(thatStrategy.mAudioAttributesGroups);
+ && Arrays.equals(mAudioAttributesGroups, thatStrategy.mAudioAttributesGroups);
}
/**
@@ -415,7 +416,7 @@
return mVolumeGroupId == thatAag.mVolumeGroupId
&& mLegacyStreamType == thatAag.mLegacyStreamType
- && mAudioAttributes.equals(thatAag.mAudioAttributes);
+ && Arrays.equals(mAudioAttributes, thatAag.mAudioAttributes);
}
public int getStreamType() {
diff --git a/media/java/android/media/audiopolicy/AudioVolumeGroup.java b/media/java/android/media/audiopolicy/AudioVolumeGroup.java
index 79be922..d58111d 100644
--- a/media/java/android/media/audiopolicy/AudioVolumeGroup.java
+++ b/media/java/android/media/audiopolicy/AudioVolumeGroup.java
@@ -114,7 +114,7 @@
AudioVolumeGroup thatAvg = (AudioVolumeGroup) o;
return mName == thatAvg.mName && mId == thatAvg.mId
- && mAudioAttributes.equals(thatAvg.mAudioAttributes);
+ && Arrays.equals(mAudioAttributes, thatAvg.mAudioAttributes);
}
/**
diff --git a/media/java/android/media/metrics/PlaybackMetrics.java b/media/java/android/media/metrics/PlaybackMetrics.java
index e71ee20..51a2c9d 100644
--- a/media/java/android/media/metrics/PlaybackMetrics.java
+++ b/media/java/android/media/metrics/PlaybackMetrics.java
@@ -402,9 +402,10 @@
@Override
public int hashCode() {
return Objects.hash(mMediaDurationMillis, mStreamSource, mStreamType, mPlaybackType,
- mDrmType, mContentType, mPlayerName, mPlayerVersion, mExperimentIds,
- mVideoFramesPlayed, mVideoFramesDropped, mAudioUnderrunCount, mNetworkBytesRead,
- mLocalBytesRead, mNetworkTransferDurationMillis, mDrmSessionId);
+ mDrmType, mContentType, mPlayerName, mPlayerVersion,
+ Arrays.hashCode(mExperimentIds), mVideoFramesPlayed, mVideoFramesDropped,
+ mAudioUnderrunCount, mNetworkBytesRead, mLocalBytesRead,
+ mNetworkTransferDurationMillis, Arrays.hashCode(mDrmSessionId));
}
@Override
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/helpers/CameraErrorCollector.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/helpers/CameraErrorCollector.java
index 41914b8..ebf1a75 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/helpers/CameraErrorCollector.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/helpers/CameraErrorCollector.java
@@ -16,10 +16,6 @@
package com.android.mediaframeworktest.helpers;
-import org.hamcrest.CoreMatchers;
-import org.hamcrest.Matcher;
-import org.junit.rules.ErrorCollector;
-
import android.graphics.Rect;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CaptureRequest;
@@ -30,6 +26,10 @@
import android.util.Log;
import android.util.Size;
+import org.hamcrest.CoreMatchers;
+import org.hamcrest.Matcher;
+import org.junit.rules.ErrorCollector;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -903,7 +903,7 @@
if ((value = expectKeyValueNotNull(characteristics, key)) == null) {
return;
}
- String reason = "Key " + key.getName() + " value " + value
+ String reason = "Key " + key.getName() + " value " + Arrays.toString(value)
+ " doesn't contain the expected value " + expected;
expectContains(reason, value, expected);
}
@@ -921,7 +921,7 @@
if ((value = expectKeyValueNotNull(characteristics, key)) == null) {
return;
}
- String reason = "Key " + key.getName() + " value " + value
+ String reason = "Key " + key.getName() + " value " + Arrays.toString(value)
+ " doesn't contain the expected value " + expected;
expectContains(reason, value, expected);
}
@@ -939,7 +939,7 @@
if ((value = expectKeyValueNotNull(characteristics, key)) == null) {
return;
}
- String reason = "Key " + key.getName() + " value " + value
+ String reason = "Key " + key.getName() + " value " + Arrays.toString(value)
+ " doesn't contain the expected value " + expected;
expectContains(reason, value, expected);
}
@@ -960,7 +960,7 @@
public <T> void expectContains(T[] values, T expected) {
String reason = "Expected value " + expected
- + " is not contained in the given values " + values;
+ + " is not contained in the given values " + Arrays.toString(values);
expectContains(reason, values, expected);
}
@@ -996,7 +996,7 @@
public void expectContains(int[] values, int expected) {
String reason = "Expected value " + expected
- + " is not contained in the given values " + values;
+ + " is not contained in the given values " + Arrays.toString(values);
expectContains(reason, values, expected);
}
@@ -1040,7 +1040,7 @@
*/
public void expectContains(boolean[] values, boolean expected) {
String reason = "Expected value " + expected
- + " is not contained in the given values " + values;
+ + " is not contained in the given values " + Arrays.toString(values);
expectContains(reason, values, expected);
}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/BluetoothProfileConnectionInfoTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/BluetoothProfileConnectionInfoTest.java
new file mode 100644
index 0000000..ae162b5
--- /dev/null
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/BluetoothProfileConnectionInfoTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+package com.android.mediaframeworktest.unit;
+
+import static org.junit.Assert.assertEquals;
+
+import android.bluetooth.BluetoothProfile;
+import android.media.BluetoothProfileConnectionInfo;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class BluetoothProfileConnectionInfoTest {
+
+ @Test
+ public void testCoverageLeAudioOutputVolume() {
+ final boolean supprNoisy = false;
+ final int volume = 1;
+ final BluetoothProfileConnectionInfo info = BluetoothProfileConnectionInfo
+ .createLeAudioOutputInfo(supprNoisy, volume);
+ assertEquals(info.getProfile(), BluetoothProfile.LE_AUDIO);
+ assertEquals(info.isSuppressNoisyIntent(), supprNoisy);
+ assertEquals(info.isLeOutput(), true);
+ assertEquals(info.getVolume(), volume);
+ }
+
+}
diff --git a/opengl/java/android/opengl/GLLogWrapper.java b/opengl/java/android/opengl/GLLogWrapper.java
index bff7396..e645afa 100644
--- a/opengl/java/android/opengl/GLLogWrapper.java
+++ b/opengl/java/android/opengl/GLLogWrapper.java
@@ -2812,7 +2812,7 @@
public void glDeleteBuffers(int n, int[] buffers, int offset) {
begin("glDeleteBuffers");
arg("n", n);
- arg("buffers", buffers.toString());
+ arg("buffers", Arrays.toString(buffers));
arg("offset", offset);
end();
mgl11.glDeleteBuffers(n, buffers, offset);
@@ -2831,7 +2831,7 @@
public void glGenBuffers(int n, int[] buffers, int offset) {
begin("glGenBuffers");
arg("n", n);
- arg("buffers", buffers.toString());
+ arg("buffers", Arrays.toString(buffers));
arg("offset", offset);
end();
mgl11.glGenBuffers(n, buffers, offset);
@@ -2850,7 +2850,7 @@
public void glGetBooleanv(int pname, boolean[] params, int offset) {
begin("glGetBooleanv");
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glGetBooleanv(pname, params, offset);
@@ -2871,7 +2871,7 @@
begin("glGetBufferParameteriv");
arg("target", target);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glGetBufferParameteriv(target, pname, params, offset);
@@ -2891,7 +2891,7 @@
public void glGetClipPlanef(int pname, float[] eqn, int offset) {
begin("glGetClipPlanef");
arg("pname", pname);
- arg("eqn", eqn.toString());
+ arg("eqn", Arrays.toString(eqn));
arg("offset", offset);
end();
mgl11.glGetClipPlanef(pname, eqn, offset);
@@ -2910,7 +2910,7 @@
public void glGetClipPlanex(int pname, int[] eqn, int offset) {
begin("glGetClipPlanex");
arg("pname", pname);
- arg("eqn", eqn.toString());
+ arg("eqn", Arrays.toString(eqn));
arg("offset", offset);
end();
mgl11.glGetClipPlanex(pname, eqn, offset);
@@ -2928,7 +2928,7 @@
public void glGetFixedv(int pname, int[] params, int offset) {
begin("glGetFixedv");
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glGetFixedv(pname, params, offset);
@@ -2946,7 +2946,7 @@
public void glGetFloatv(int pname, float[] params, int offset) {
begin("glGetFloatv");
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glGetFloatv(pname, params, offset);
@@ -2965,7 +2965,7 @@
begin("glGetLightfv");
arg("light", light);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glGetLightfv(light, pname, params, offset);
@@ -2986,7 +2986,7 @@
begin("glGetLightxv");
arg("light", light);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glGetLightxv(light, pname, params, offset);
@@ -3008,7 +3008,7 @@
begin("glGetMaterialfv");
arg("face", face);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glGetMaterialfv(face, pname, params, offset);
@@ -3029,7 +3029,7 @@
begin("glGetMaterialxv");
arg("face", face);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glGetMaterialxv(face, pname, params, offset);
@@ -3050,7 +3050,7 @@
begin("glGetTexEnviv");
arg("env", env);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glGetTexEnviv(env, pname, params, offset);
@@ -3071,7 +3071,7 @@
begin("glGetTexEnviv");
arg("env", env);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glGetTexEnviv(env, pname, params, offset);
@@ -3092,7 +3092,7 @@
begin("glGetTexParameterfv");
arg("target", target);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glGetTexParameterfv(target, pname, params, offset);
@@ -3113,7 +3113,7 @@
begin("glGetTexParameteriv");
arg("target", target);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glGetTexEnviv(target, pname, params, offset);
@@ -3135,7 +3135,7 @@
begin("glGetTexParameterxv");
arg("target", target);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glGetTexParameterxv(target, pname, params, offset);
@@ -3191,7 +3191,7 @@
public void glPointParameterfv(int pname, float[] params, int offset) {
begin("glPointParameterfv");
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glPointParameterfv(pname, params, offset);
@@ -3219,7 +3219,7 @@
public void glPointParameterxv(int pname, int[] params, int offset) {
begin("glPointParameterxv");
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glPointParameterxv(pname, params, offset);
@@ -3259,7 +3259,7 @@
begin("glTexEnviv");
arg("target", target);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glTexEnviv(target, pname, params, offset);
@@ -3281,7 +3281,7 @@
begin("glTexParameterfv");
arg("target", target);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glTexParameterfv( target, pname, params, offset);
@@ -3313,7 +3313,7 @@
begin("glTexParameterxv");
arg("target", target);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11.glTexParameterxv(target, pname, params, offset);
@@ -3356,7 +3356,7 @@
public void glGetPointerv(int pname, Buffer[] params) {
begin("glGetPointerv");
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
end();
mgl11.glGetPointerv(pname, params);
checkError();
@@ -3513,7 +3513,7 @@
public void glDeleteFramebuffersOES(int n, int[] framebuffers, int offset) {
begin("glDeleteFramebuffersOES");
arg("n", n);
- arg("framebuffers", framebuffers.toString());
+ arg("framebuffers", Arrays.toString(framebuffers));
arg("offset", offset);
end();
mgl11ExtensionPack.glDeleteFramebuffersOES(n, framebuffers, offset);
@@ -3534,7 +3534,7 @@
public void glDeleteRenderbuffersOES(int n, int[] renderbuffers, int offset) {
begin("glDeleteRenderbuffersOES");
arg("n", n);
- arg("renderbuffers", renderbuffers.toString());
+ arg("renderbuffers", Arrays.toString(renderbuffers));
arg("offset", offset);
end();
mgl11ExtensionPack.glDeleteRenderbuffersOES(n, renderbuffers, offset);
@@ -3591,7 +3591,7 @@
public void glGenFramebuffersOES(int n, int[] framebuffers, int offset) {
begin("glGenFramebuffersOES");
arg("n", n);
- arg("framebuffers", framebuffers.toString());
+ arg("framebuffers", Arrays.toString(framebuffers));
arg("offset", offset);
end();
mgl11ExtensionPack.glGenFramebuffersOES(n, framebuffers, offset);
@@ -3612,7 +3612,7 @@
public void glGenRenderbuffersOES(int n, int[] renderbuffers, int offset) {
begin("glGenRenderbuffersOES");
arg("n", n);
- arg("renderbuffers", renderbuffers.toString());
+ arg("renderbuffers", Arrays.toString(renderbuffers));
arg("offset", offset);
end();
mgl11ExtensionPack.glGenRenderbuffersOES(n, renderbuffers, offset);
@@ -3636,7 +3636,7 @@
arg("target", target);
arg("attachment", attachment);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11ExtensionPack.glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params, offset);
@@ -3662,7 +3662,7 @@
begin("glGetRenderbufferParameterivOES");
arg("target", target);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11ExtensionPack.glGetRenderbufferParameterivOES(target, pname, params, offset);
@@ -3686,7 +3686,7 @@
begin("glGetTexGenfv");
arg("coord", coord);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11ExtensionPack.glGetTexGenfv(coord, pname, params, offset);
@@ -3709,7 +3709,7 @@
begin("glGetTexGeniv");
arg("coord", coord);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11ExtensionPack.glGetTexGeniv(coord, pname, params, offset);
@@ -3732,7 +3732,7 @@
begin("glGetTexGenxv");
arg("coord", coord);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11ExtensionPack.glGetTexGenxv(coord, pname, params, offset);
@@ -3799,7 +3799,7 @@
begin("glTexGenfv");
arg("coord", coord);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11ExtensionPack.glTexGenfv(coord, pname, params, offset);
@@ -3833,7 +3833,7 @@
begin("glTexGeniv");
arg("coord", coord);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11ExtensionPack.glTexGeniv(coord, pname, params, offset);
@@ -3867,7 +3867,7 @@
begin("glTexGenxv");
arg("coord", coord);
arg("pname", pname);
- arg("params", params.toString());
+ arg("params", Arrays.toString(params));
arg("offset", offset);
end();
mgl11ExtensionPack.glTexGenxv(coord, pname, params, offset);
diff --git a/packages/SettingsLib/src/com/android/settingslib/media/OWNERS b/packages/SettingsLib/src/com/android/settingslib/media/OWNERS
new file mode 100644
index 0000000..d40f322
--- /dev/null
+++ b/packages/SettingsLib/src/com/android/settingslib/media/OWNERS
@@ -0,0 +1,2 @@
+# Default reviewers for this and subdirectories.
+shaoweishen@google.com
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index f05c1e2..104998c 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -247,6 +247,9 @@
"com.android.systemui",
],
plugins: ["dagger2-compiler"],
+ lint: {
+ test: true,
+ },
}
// Opt-in config for optimizing the SystemUI target using R8.
diff --git a/packages/SystemUI/OWNERS b/packages/SystemUI/OWNERS
index 4a5828d..9ef772e 100644
--- a/packages/SystemUI/OWNERS
+++ b/packages/SystemUI/OWNERS
@@ -13,13 +13,12 @@
brockman@google.com
brzezinski@google.com
brycelee@google.com
-ccassidy@google.com
+caitlinshk@google.com
chrisgollner@google.com
-cinek@google.com
-cwren@google.com
dupin@google.com
ethibodeau@google.com
evanlaird@google.com
+florenceyang@google.com
gwasserman@google.com
hwwang@google.com
hyunyoungs@google.com
@@ -28,36 +27,36 @@
jbolinger@google.com
jdemeulenaere@google.com
jeffdq@google.com
+jernej@google.com
+jglazier@google.com
jjaggi@google.com
jonmiranda@google.com
joshtrask@google.com
juliacr@google.com
juliatuttle@google.com
justinkoh@google.com
-kchyn@google.com
kozynski@google.com
kprevas@google.com
lynhan@google.com
madym@google.com
mankoff@google.com
-mett@google.com
mkephart@google.com
mpietal@google.com
mrcasey@google.com
mrenouf@google.com
-nesciosquid@google.com
nickchameyev@google.com
nicomazz@google.com
ogunwale@google.com
peanutbutter@google.com
+peskal@google.com
pinyaoting@google.com
pixel@google.com
+pomini@google.com
rahulbanerjee@google.com
roosa@google.com
santie@google.com
shanh@google.com
snoeberger@google.com
-sreyasr@google.com
steell@google.com
sfufa@google.com
stwu@google.com
@@ -71,15 +70,10 @@
victortulias@google.com
winsonc@google.com
wleshner@google.com
-yurilin@google.com
xuqiu@google.com
+yuandizhou@google.com
+yurilin@google.com
zakcohen@google.com
-jernej@google.com
-jglazier@google.com
-peskal@google.com
-
-#Android Auto
-hseog@google.com
#Android TV
rgl@google.com
diff --git a/packages/SystemUI/src/com/android/systemui/volume/OWNERS b/packages/SystemUI/src/com/android/systemui/volume/OWNERS
new file mode 100644
index 0000000..e627d61
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/volume/OWNERS
@@ -0,0 +1,4 @@
+asc@google.com # send reviews here
+
+juliacr@google.com
+tsuji@google.com
diff --git a/proto/src/system_messages.proto b/proto/src/system_messages.proto
index dfa34bb..66ae435 100644
--- a/proto/src/system_messages.proto
+++ b/proto/src/system_messages.proto
@@ -290,6 +290,14 @@
// 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;
+
// ADD_NEW_IDS_ABOVE_THIS_LINE
// Legacy IDs with arbitrary values appear below
// Legacy IDs existed as stable non-conflicting constants prior to the O release
diff --git a/services/OWNERS b/services/OWNERS
index 67cee55..495c0737 100644
--- a/services/OWNERS
+++ b/services/OWNERS
@@ -1,4 +1,4 @@
-per-file Android.bp = file:platform/build/soong:/OWNERS
+per-file Android.bp = file:platform/build/soong:/OWNERS #{LAST_RESORT_SUGGESTION}
# art-team@ manages the system server profile
per-file art-profile* = calin@google.com, ngeoffray@google.com, vmarko@google.com
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 99c8495..9a1d295 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -685,8 +685,8 @@
if (mTraceManager.isA11yTracingEnabledForTypes(FLAGS_PACKAGE_BROADCAST_RECEIVER)) {
mTraceManager.logTrace(LOG_TAG + ".PM.onHandleForceStop",
FLAGS_PACKAGE_BROADCAST_RECEIVER,
- "intent=" + intent + ";packages=" + packages + ";uid=" + uid
- + ";doit=" + doit);
+ "intent=" + intent + ";packages=" + Arrays.toString(packages)
+ + ";uid=" + uid + ";doit=" + doit);
}
synchronized (mLock) {
final int userId = getChangingUserId();
diff --git a/services/accessibility/java/com/android/server/accessibility/gestures/MultiFingerSwipe.java b/services/accessibility/java/com/android/server/accessibility/gestures/MultiFingerSwipe.java
index f731c44..d20fa8e 100644
--- a/services/accessibility/java/com/android/server/accessibility/gestures/MultiFingerSwipe.java
+++ b/services/accessibility/java/com/android/server/accessibility/gestures/MultiFingerSwipe.java
@@ -447,7 +447,7 @@
StringBuilder builder = new StringBuilder(super.toString());
if (getState() != STATE_GESTURE_CANCELED) {
builder.append(", mBase: ")
- .append(mBase.toString())
+ .append(Arrays.toString(mBase))
.append(", mMinPixelsBetweenSamplesX:")
.append(mMinPixelsBetweenSamplesX)
.append(", mMinPixelsBetweenSamplesY:")
diff --git a/services/api/OWNERS b/services/api/OWNERS
index a609390..e10440c 100644
--- a/services/api/OWNERS
+++ b/services/api/OWNERS
@@ -1,4 +1,4 @@
-per-file Android.bp = file:platform/build/soong:/OWNERS
+per-file Android.bp = file:platform/build/soong:/OWNERS #{LAST_RESORT_SUGGESTION}
# API changes are managed via Prolog rules, not OWNERS
*
diff --git a/services/backup/java/com/android/server/backup/UserBackupManagerService.java b/services/backup/java/com/android/server/backup/UserBackupManagerService.java
index ca7fe0c..b9cbf12 100644
--- a/services/backup/java/com/android/server/backup/UserBackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/UserBackupManagerService.java
@@ -85,7 +85,6 @@
import android.os.Process;
import android.os.RemoteException;
import android.os.SELinux;
-import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.WorkSource;
@@ -2832,7 +2831,7 @@
+ " includekeyvalue="
+ doKeyValue
+ " pkgs="
- + pkgList));
+ + Arrays.toString(pkgList)));
}
Slog.i(TAG, addUserIdToLogMessage(mUserId, "Beginning adb backup..."));
diff --git a/services/backup/java/com/android/server/backup/utils/BackupEligibilityRules.java b/services/backup/java/com/android/server/backup/utils/BackupEligibilityRules.java
index bd1ac2dc..00f0867 100644
--- a/services/backup/java/com/android/server/backup/utils/BackupEligibilityRules.java
+++ b/services/backup/java/com/android/server/backup/utils/BackupEligibilityRules.java
@@ -25,9 +25,9 @@
import android.annotation.Nullable;
import android.app.backup.BackupManager.OperationType;
import android.app.backup.BackupTransport;
+import android.app.compat.CompatChanges;
import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledSince;
-import android.app.compat.CompatChanges;
import android.compat.annotation.Overridable;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
@@ -46,6 +46,7 @@
import com.google.android.collect.Sets;
+import java.util.Arrays;
import java.util.Set;
/**
@@ -359,8 +360,8 @@
}
if (DEBUG) {
- Slog.v(TAG, "signaturesMatch(): stored=" + storedSigs + " device="
- + signingInfo.getApkContentsSigners());
+ Slog.v(TAG, "signaturesMatch(): stored=" + Arrays.toString(storedSigs)
+ + " device=" + Arrays.toString(signingInfo.getApkContentsSigners()));
}
final int nStored = storedSigs.length;
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 0807fba..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)) {
@@ -2978,8 +2985,8 @@
pw.println("mBarringInfo=" + mBarringInfo.get(i));
pw.println("mCarrierNetworkChangeState=" + mCarrierNetworkChangeState[i]);
pw.println("mTelephonyDisplayInfo=" + mTelephonyDisplayInfos[i]);
- pw.println("mIsDataEnabled=" + mIsDataEnabled);
- pw.println("mDataEnabledReason=" + mDataEnabledReason);
+ pw.println("mIsDataEnabled=" + mIsDataEnabled[i]);
+ pw.println("mDataEnabledReason=" + mDataEnabledReason[i]);
pw.println("mAllowedNetworkTypeReason=" + mAllowedNetworkTypeReason[i]);
pw.println("mAllowedNetworkTypeValue=" + mAllowedNetworkTypeValue[i]);
pw.println("mPhysicalChannelConfigs=" + mPhysicalChannelConfigs.get(i));
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 8856147..bc065d1 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -17794,6 +17794,13 @@
}
/**
+ * Reset the dropbox rate limiter
+ */
+ void resetDropboxRateLimiter() {
+ mDropboxRateLimiter.reset();
+ }
+
+ /**
* Kill processes for the user with id userId and that depend on the package named packageName
*/
@Override
diff --git a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
index 570a157..82d0b67 100644
--- a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
+++ b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
@@ -350,6 +350,8 @@
return runSetBgAbusiveUids(pw);
case "list-bg-exemptions-config":
return runListBgExemptionsConfig(pw);
+ case "reset-dropbox-rate-limiter":
+ return runResetDropboxRateLimiter();
default:
return handleDefaultCommands(cmd);
}
@@ -3374,6 +3376,11 @@
return 0;
}
+ int runResetDropboxRateLimiter() throws RemoteException {
+ mInternal.resetDropboxRateLimiter();
+ return 0;
+ }
+
private Resources getResources(PrintWriter pw) throws RemoteException {
// system resources does not contain all the device configuration, construct it manually.
Configuration config = mInterface.getConfiguration();
diff --git a/services/core/java/com/android/server/am/DropboxRateLimiter.java b/services/core/java/com/android/server/am/DropboxRateLimiter.java
index baf062d..6087f76 100644
--- a/services/core/java/com/android/server/am/DropboxRateLimiter.java
+++ b/services/core/java/com/android/server/am/DropboxRateLimiter.java
@@ -19,11 +19,13 @@
import android.os.SystemClock;
import android.text.format.DateUtils;
import android.util.ArrayMap;
+import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
/** Rate limiter for adding errors into dropbox. */
public class DropboxRateLimiter {
+ private static final String TAG = "DropboxRateLimiter";
// After RATE_LIMIT_ALLOWED_ENTRIES have been collected (for a single breakdown of
// process/eventType) further entries will be rejected until RATE_LIMIT_BUFFER_DURATION has
// elapsed, after which the current count for this breakdown will be reset.
@@ -105,6 +107,15 @@
mLastMapCleanUp = now;
}
+ /** Resets the rate limiter memory. */
+ void reset() {
+ synchronized (mErrorClusterRecords) {
+ mErrorClusterRecords.clear();
+ }
+ mLastMapCleanUp = 0L;
+ Slog.i(TAG, "Rate limiter reset.");
+ }
+
String errorKey(String eventType, String processName) {
return eventType + processName;
}
diff --git a/services/core/java/com/android/server/appop/DiscreteRegistry.java b/services/core/java/com/android/server/appop/DiscreteRegistry.java
index 158092f..dd0c4b86 100644
--- a/services/core/java/com/android/server/appop/DiscreteRegistry.java
+++ b/services/core/java/com/android/server/appop/DiscreteRegistry.java
@@ -816,8 +816,7 @@
}
} catch (Throwable t) {
- Slog.e(TAG, "Error while cleaning timeline files: " + t.getMessage() + " "
- + t.getStackTrace());
+ Slog.e(TAG, "Error while cleaning timeline files: ", t);
}
}
}
diff --git a/services/core/java/com/android/server/audio/AudioDeviceInventory.java b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
index dbe4fb8..9c0d3df 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceInventory.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
@@ -375,7 +375,8 @@
makeLeAudioDeviceUnavailable(address, btInfo.mAudioSystemDevice);
} else if (switchToAvailable) {
makeLeAudioDeviceAvailable(address, BtHelper.getName(btInfo.mDevice),
- streamType, btInfo.mAudioSystemDevice, "onSetBtActiveDevice");
+ streamType, btInfo.mVolume, btInfo.mAudioSystemDevice,
+ "onSetBtActiveDevice");
}
break;
default: throw new IllegalArgumentException("Invalid profile "
@@ -1159,8 +1160,8 @@
}
@GuardedBy("mDevicesLock")
- private void makeLeAudioDeviceAvailable(String address, String name, int streamType, int device,
- String eventSource) {
+ private void makeLeAudioDeviceAvailable(String address, String name, int streamType,
+ int volumeIndex, int device, String eventSource) {
if (device != AudioSystem.DEVICE_NONE) {
/* Audio Policy sees Le Audio similar to A2DP. Let's make sure
* AUDIO_POLICY_FORCE_NO_BT_A2DP is not set
@@ -1181,7 +1182,9 @@
return;
}
- final int leAudioVolIndex = mDeviceBroker.getVssVolumeForDevice(streamType, device);
+ final int leAudioVolIndex = (volumeIndex == -1)
+ ? mDeviceBroker.getVssVolumeForDevice(streamType, device)
+ : volumeIndex;
final int maxIndex = mDeviceBroker.getMaxVssVolumeForStream(streamType);
mDeviceBroker.postSetLeAudioVolumeIndex(leAudioVolIndex, maxIndex, streamType);
mDeviceBroker.postApplyVolumeOnDevice(streamType, device, "makeLeAudioDeviceAvailable");
diff --git a/services/core/java/com/android/server/backup/BackupUtils.java b/services/core/java/com/android/server/backup/BackupUtils.java
index 96c5621..76eba16 100644
--- a/services/core/java/com/android/server/backup/BackupUtils.java
+++ b/services/core/java/com/android/server/backup/BackupUtils.java
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.stream.Collectors;
public class BackupUtils {
private static final String TAG = "BackupUtils";
@@ -64,8 +65,9 @@
}
if (DEBUG) {
- Slog.v(TAG, "signaturesMatch(): stored=" + storedSigHashes
- + " device=" + signingInfo.getApkContentsSigners());
+ Slog.v(TAG, "signaturesMatch(): stored="
+ + storedSigHashes.stream().map(Arrays::toString).collect(Collectors.toList())
+ + " device=" + Arrays.toString(signingInfo.getApkContentsSigners()));
}
final int nStored = storedSigHashes.size();
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index 16a060a..9cb1f1d 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -752,10 +752,12 @@
return true;
}
- private boolean sendEventToVpnManagerApp(@NonNull String category, int errorClass,
+ private Intent buildVpnManagerEventIntent(@NonNull String category, int errorClass,
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);
@@ -771,6 +773,20 @@
intent.putExtra(VpnManager.EXTRA_ERROR_CODE, errorCode);
}
+ return intent;
+ }
+
+ private boolean sendEventToVpnManagerApp(@NonNull String category, int errorClass,
+ 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) {
+ final Intent intent = buildVpnManagerEventIntent(category, errorClass, errorCode,
+ packageName, sessionKey, profileState, underlyingNetwork, nc, lp);
+ return sendEventToVpnManagerApp(intent, packageName);
+ }
+
+ private boolean sendEventToVpnManagerApp(@NonNull final Intent intent,
+ @NonNull final String packageName) {
// Allow VpnManager app to temporarily run background services to handle this error.
// If an app requires anything beyond this grace period, they MUST either declare
// themselves as a foreground service, or schedule a job/workitem.
@@ -1096,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);
}
@@ -1182,12 +1198,7 @@
mContext.unbindService(mConnection);
cleanupVpnStateLocked();
} else if (mVpnRunner != null) {
- if (!VpnConfig.LEGACY_VPN.equals(mPackage)) {
- notifyVpnManagerVpnStopped(mPackage, mOwnerUID);
- }
-
- // cleanupVpnStateLocked() is called from mVpnRunner.exit()
- mVpnRunner.exit();
+ stopVpnRunnerAndNotifyAppLocked(mPackage);
}
try {
@@ -2046,10 +2057,6 @@
"Unauthorized Caller");
}
- private boolean hasControlVpnPermission() {
- return mContext.checkCallingOrSelfPermission(CONTROL_VPN) == PERMISSION_GRANTED;
- }
-
private class Connection implements ServiceConnection {
private IBinder mService;
@@ -2751,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);
@@ -2886,6 +2895,9 @@
final LinkProperties lp;
synchronized (Vpn.this) {
+ // Ignore stale runner.
+ if (mVpnRunner != this) return;
+
mInterface = interfaceName;
mConfig.mtu = maxMtu;
mConfig.interfaze = mInterface;
@@ -2987,6 +2999,9 @@
try {
synchronized (Vpn.this) {
+ // Ignore stale runner.
+ if (mVpnRunner != this) return;
+
mConfig.underlyingNetworks = new Network[] {network};
mNetworkCapabilities =
new NetworkCapabilities.Builder(mNetworkCapabilities)
@@ -3076,7 +3091,12 @@
// Clear mInterface to prevent Ikev2VpnRunner being cleared when
// interfaceRemoved() is called.
- mInterface = null;
+ synchronized (Vpn.this) {
+ // Ignore stale runner.
+ if (mVpnRunner != this) return;
+
+ mInterface = null;
+ }
// Without MOBIKE, we have no way to seamlessly migrate. Close on old
// (non-default) network, and start the new one.
resetIkeState();
@@ -3261,6 +3281,9 @@
/** Marks the state as FAILED, and disconnects. */
private void markFailedAndDisconnect(Exception exception) {
synchronized (Vpn.this) {
+ // Ignore stale runner.
+ if (mVpnRunner != this) return;
+
updateState(DetailedState.FAILED, exception.getMessage());
}
@@ -3345,6 +3368,9 @@
}
synchronized (Vpn.this) {
+ // Ignore stale runner.
+ if (mVpnRunner != this) return;
+
// TODO(b/230548427): Remove SDK check once VPN related stuff are
// decoupled from ConnectivityServiceTest.
if (SdkLevel.isAtLeastT() && category != null && isVpnApp(mPackage)) {
@@ -3371,6 +3397,9 @@
Log.d(TAG, "Resetting state for token: " + mCurrentToken);
synchronized (Vpn.this) {
+ // Ignore stale runner.
+ if (mVpnRunner != this) return;
+
// Since this method handles non-fatal errors only, set mInterface to null to
// prevent the NetworkManagementEventObserver from killing this VPN based on the
// interface going down (which we expect).
@@ -3854,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);
@@ -3925,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;
}
/**
@@ -3993,6 +4026,7 @@
mConfig.proxyInfo = profile.proxy;
mConfig.requiresInternetValidation = profile.requiresInternetValidation;
mConfig.excludeLocalRoutes = profile.excludeLocalRoutes;
+ mConfig.allowBypass = profile.isBypassable;
switch (profile.type) {
case VpnProfile.TYPE_IKEV2_IPSEC_USER_PASS:
@@ -4026,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.
*
@@ -4042,13 +4099,12 @@
// To stop the VPN profile, the caller must be the current prepared package and must be
// running an Ikev2VpnProfile.
if (isCurrentIkev2VpnLocked(packageName)) {
- notifyVpnManagerVpnStopped(packageName, mOwnerUID);
-
- mVpnRunner.exit();
+ stopVpnRunnerAndNotifyAppLocked(packageName);
}
}
- private synchronized void notifyVpnManagerVpnStopped(String packageName, int ownerUID) {
+ private synchronized void notifyVpnManagerVpnStopped(String packageName, int ownerUID,
+ Intent intent) {
mAppOpsManager.finishOp(
AppOpsManager.OPSTR_ESTABLISH_VPN_MANAGER, ownerUID, packageName, null);
// The underlying network, NetworkCapabilities and LinkProperties are not
@@ -4057,10 +4113,7 @@
// TODO(b/230548427): Remove SDK check once VPN related stuff are decoupled from
// ConnectivityServiceTest.
if (SdkLevel.isAtLeastT()) {
- sendEventToVpnManagerApp(VpnManager.CATEGORY_EVENT_DEACTIVATED_BY_USER,
- -1 /* errorClass */, -1 /* errorCode*/, packageName,
- getSessionKeyLocked(), makeVpnProfileStateLocked(),
- null /* underlyingNetwork */, null /* nc */, null /* lp */);
+ sendEventToVpnManagerApp(intent, packageName);
}
}
diff --git a/services/core/java/com/android/server/location/gnss/GnssNetworkConnectivityHandler.java b/services/core/java/com/android/server/location/gnss/GnssNetworkConnectivityHandler.java
index aba7572..d9ca4d3 100644
--- a/services/core/java/com/android/server/location/gnss/GnssNetworkConnectivityHandler.java
+++ b/services/core/java/com/android/server/location/gnss/GnssNetworkConnectivityHandler.java
@@ -554,7 +554,7 @@
mAGpsDataConnectionIpAddr = InetAddress.getByAddress(suplIpAddr);
if (DEBUG) Log.d(TAG, "IP address converted to: " + mAGpsDataConnectionIpAddr);
} catch (UnknownHostException e) {
- Log.e(TAG, "Bad IP Address: " + suplIpAddr, e);
+ Log.e(TAG, "Bad IP Address: " + Arrays.toString(suplIpAddr), e);
}
}
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/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index c73c5a0..e2c4cbd 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -123,6 +123,7 @@
import static android.telephony.CarrierConfigManager.KEY_DATA_WARNING_NOTIFICATION_BOOL;
import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+import static com.android.internal.annotations.VisibleForTesting.Visibility.PRIVATE;
import static com.android.internal.util.ArrayUtils.appendInt;
import static com.android.internal.util.XmlUtils.readBooleanAttribute;
import static com.android.internal.util.XmlUtils.readIntAttribute;
@@ -3158,7 +3159,8 @@
* active merge set [A,B], we'd return a new template that primarily matches
* A, but also matches B.
*/
- private static NetworkTemplate normalizeTemplate(@NonNull NetworkTemplate template,
+ @VisibleForTesting(visibility = PRIVATE)
+ static NetworkTemplate normalizeTemplate(@NonNull NetworkTemplate template,
@NonNull List<String[]> mergedList) {
// Now there are several types of network which uses Subscriber Id to store network
// information. For instance:
@@ -3168,6 +3170,12 @@
if (template.getSubscriberIds().isEmpty()) return template;
for (final String[] merged : mergedList) {
+ // In some rare cases (e.g. b/243015487), merged subscriberId list might contain
+ // duplicated items. Deduplication for better error handling.
+ final ArraySet mergedSet = new ArraySet(merged);
+ if (mergedSet.size() != merged.length) {
+ Log.wtf(TAG, "Duplicated merged list detected: " + Arrays.toString(merged));
+ }
// TODO: Handle incompatible subscriberIds if that happens in practice.
for (final String subscriberId : template.getSubscriberIds()) {
if (com.android.net.module.util.CollectionUtils.contains(merged, subscriberId)) {
@@ -3175,7 +3183,7 @@
// a template that matches all merged subscribers.
return new NetworkTemplate.Builder(template.getMatchRule())
.setWifiNetworkKeys(template.getWifiNetworkKeys())
- .setSubscriberIds(Set.of(merged))
+ .setSubscriberIds(mergedSet)
.setMeteredness(template.getMeteredness())
.build();
}
diff --git a/services/core/java/com/android/server/net/watchlist/WatchlistLoggingHandler.java b/services/core/java/com/android/server/net/watchlist/WatchlistLoggingHandler.java
index 5599b0c..8ce7b57 100644
--- a/services/core/java/com/android/server/net/watchlist/WatchlistLoggingHandler.java
+++ b/services/core/java/com/android/server/net/watchlist/WatchlistLoggingHandler.java
@@ -36,7 +36,6 @@
import android.text.TextUtils;
import android.util.Slog;
-import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.HexDump;
@@ -45,8 +44,8 @@
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.GregorianCalendar;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
@@ -155,7 +154,7 @@
try {
final String[] packageNames = mPm.getPackagesForUid(uid);
if (packageNames == null || packageNames.length == 0) {
- Slog.e(TAG, "Couldn't find package: " + packageNames);
+ Slog.e(TAG, "Couldn't find package: " + Arrays.toString(packageNames));
return false;
}
ai = mPm.getApplicationInfo(packageNames[0], 0);
diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java
index f1dbad61..d8e4b38 100644
--- a/services/core/java/com/android/server/wm/AccessibilityController.java
+++ b/services/core/java/com/android/server/wm/AccessibilityController.java
@@ -420,7 +420,7 @@
if (mAccessibilityTracing.isTracingEnabled(FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK)) {
mAccessibilityTracing.logTrace(TAG + ".onSomeWindowResizedOrMoved",
FLAGS_WINDOWS_FOR_ACCESSIBILITY_CALLBACK,
- "displayIds={" + displayIds.toString() + "}", "".getBytes(), callingUid);
+ "displayIds={" + Arrays.toString(displayIds) + "}", "".getBytes(), callingUid);
}
// Not relevant for the display magnifier.
for (int i = 0; i < displayIds.length; i++) {
diff --git a/services/core/java/com/android/server/wm/TaskPersister.java b/services/core/java/com/android/server/wm/TaskPersister.java
index b8d2feb..09fd900 100644
--- a/services/core/java/com/android/server/wm/TaskPersister.java
+++ b/services/core/java/com/android/server/wm/TaskPersister.java
@@ -53,6 +53,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -424,7 +425,7 @@
private static void removeObsoleteFiles(ArraySet<Integer> persistentTaskIds, File[] files) {
if (DEBUG) Slog.d(TAG, "removeObsoleteFiles: persistentTaskIds=" + persistentTaskIds +
- " files=" + files);
+ " files=" + Arrays.toString(files));
if (files == null) {
Slog.e(TAG, "File error accessing recents directory (directory doesn't exist?).");
return;
diff --git a/services/core/jni/OWNERS b/services/core/jni/OWNERS
index 8567110..9abf107 100644
--- a/services/core/jni/OWNERS
+++ b/services/core/jni/OWNERS
@@ -11,7 +11,7 @@
# BatteryStats
per-file com_android_server_am_BatteryStatsService.cpp = file:/BATTERY_STATS_OWNERS
-per-file Android.bp = file:platform/build/soong:/OWNERS
+per-file Android.bp = file:platform/build/soong:/OWNERS #{LAST_RESORT_SUGGESTION}
per-file com_android_server_Usb* = file:/services/usb/OWNERS
per-file com_android_server_Vibrator* = file:/services/core/java/com/android/server/vibrator/OWNERS
per-file com_android_server_hdmi_* = file:/core/java/android/hardware/hdmi/OWNERS
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/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
index d322290..3c68662 100644
--- a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
+++ b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
@@ -205,6 +205,7 @@
.setRequiresDeviceIdle(true)
.setRequiresCharging(true)
.setPeriodic(BG_PROCESS_PERIOD)
+ .setPriority(JobInfo.PRIORITY_MIN)
.build());
}
diff --git a/services/tests/servicestests/src/com/android/server/accessibility/MotionEventInjectorTest.java b/services/tests/servicestests/src/com/android/server/accessibility/MotionEventInjectorTest.java
index 59b69f9..233caf9 100644
--- a/services/tests/servicestests/src/com/android/server/accessibility/MotionEventInjectorTest.java
+++ b/services/tests/servicestests/src/com/android/server/accessibility/MotionEventInjectorTest.java
@@ -837,7 +837,7 @@
@Override
public void describeTo(Description description) {
- description.appendText("Contains points " + points);
+ description.appendText("Contains points " + Arrays.toString(points));
}
};
}
diff --git a/services/tests/servicestests/src/com/android/server/input/OWNERS b/services/tests/servicestests/src/com/android/server/input/OWNERS
index d701f23..6e9aa1d 100644
--- a/services/tests/servicestests/src/com/android/server/input/OWNERS
+++ b/services/tests/servicestests/src/com/android/server/input/OWNERS
@@ -1 +1,2 @@
-include /core/java/android/hardware/input/OWNERS
+include /services/core/java/com/android/server/input/OWNERS
+
diff --git a/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
index 0f2fe44..821ce5e 100644
--- a/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
@@ -75,6 +75,7 @@
import static com.android.server.net.NetworkPolicyManagerService.TYPE_RAPID;
import static com.android.server.net.NetworkPolicyManagerService.TYPE_WARNING;
import static com.android.server.net.NetworkPolicyManagerService.UidBlockedState.getEffectiveBlockedReasons;
+import static com.android.server.net.NetworkPolicyManagerService.normalizeTemplate;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -2030,6 +2031,18 @@
METERED_NO, actualPolicy.template.getMeteredness());
}
+ @Test
+ public void testNormalizeTemplate_duplicatedMergedImsiList() {
+ final NetworkTemplate template = new NetworkTemplate.Builder(MATCH_CARRIER)
+ .setSubscriberIds(Set.of(TEST_IMSI)).build();
+ final String[] mergedImsiGroup = new String[] {TEST_IMSI, TEST_IMSI};
+ final ArrayList<String[]> mergedList = new ArrayList<>();
+ mergedList.add(mergedImsiGroup);
+ // Verify the duplicated items in the merged IMSI list won't crash the system.
+ final NetworkTemplate result = normalizeTemplate(template, mergedList);
+ assertEquals(template, result);
+ }
+
private String formatBlockedStateError(int uid, int rule, boolean metered,
boolean backgroundRestricted) {
return String.format(
diff --git a/services/usage/java/com/android/server/usage/AppTimeLimitController.java b/services/usage/java/com/android/server/usage/AppTimeLimitController.java
index f169926..1b34b81 100644
--- a/services/usage/java/com/android/server/usage/AppTimeLimitController.java
+++ b/services/usage/java/com/android/server/usage/AppTimeLimitController.java
@@ -772,7 +772,7 @@
observerApp.appUsageGroups.append(observerId, group);
if (DEBUG) {
- Slog.d(TAG, "addObserver " + observed + " for " + timeLimit);
+ Slog.d(TAG, "addObserver " + Arrays.toString(observed) + " for " + timeLimit);
}
user.addUsageGroup(group);
@@ -881,7 +881,7 @@
observerApp.appUsageLimitGroups.append(observerId, group);
if (DEBUG) {
- Slog.d(TAG, "addObserver " + observed + " for " + timeLimit);
+ Slog.d(TAG, "addObserver " + Arrays.toString(observed) + " for " + timeLimit);
}
user.addUsageGroup(group);
diff --git a/telecomm/java/android/telecom/DisconnectCause.java b/telecomm/java/android/telecom/DisconnectCause.java
index 0f034ad..b003f59 100644
--- a/telecomm/java/android/telecom/DisconnectCause.java
+++ b/telecomm/java/android/telecom/DisconnectCause.java
@@ -88,8 +88,8 @@
public static final String REASON_WIFI_ON_BUT_WFC_OFF = "REASON_WIFI_ON_BUT_WFC_OFF";
/**
- * Reason code (returned via {@link #getReason()}), which indicates that the video telephony
- * call was disconnected because IMS access is blocked.
+ * Reason code (returned via {@link #getReason()}), which indicates that the call was
+ * disconnected because IMS access is blocked.
*/
public static final String REASON_IMS_ACCESS_BLOCKED = "REASON_IMS_ACCESS_BLOCKED";
diff --git a/telephony/common/com/google/android/mms/pdu/PduParser.java b/telephony/common/com/google/android/mms/pdu/PduParser.java
index 677fe2f..62eac7a 100755
--- a/telephony/common/com/google/android/mms/pdu/PduParser.java
+++ b/telephony/common/com/google/android/mms/pdu/PduParser.java
@@ -793,7 +793,7 @@
try {
if (LOCAL_LOGV) {
Log.v(LOG_TAG, "parseHeaders: CONTENT_TYPE: " + headerField +
- contentType.toString());
+ Arrays.toString(contentType));
}
headers.setTextString(contentType, PduHeaders.CONTENT_TYPE);
} catch(NullPointerException e) {
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/PhysicalChannelConfig.java b/telephony/java/android/telephony/PhysicalChannelConfig.java
index d978f57..212aaae 100644
--- a/telephony/java/android/telephony/PhysicalChannelConfig.java
+++ b/telephony/java/android/telephony/PhysicalChannelConfig.java
@@ -433,7 +433,8 @@
return Objects.hash(
mCellConnectionStatus, mCellBandwidthDownlinkKhz, mCellBandwidthUplinkKhz,
mNetworkType, mFrequencyRange, mDownlinkChannelNumber, mUplinkChannelNumber,
- mContextIds, mPhysicalCellId, mBand, mDownlinkFrequency, mUplinkFrequency);
+ Arrays.hashCode(mContextIds), mPhysicalCellId, mBand, mDownlinkFrequency,
+ mUplinkFrequency);
}
public static final
diff --git a/telephony/java/android/telephony/SignalThresholdInfo.java b/telephony/java/android/telephony/SignalThresholdInfo.java
index ae7d209..3c18245 100644
--- a/telephony/java/android/telephony/SignalThresholdInfo.java
+++ b/telephony/java/android/telephony/SignalThresholdInfo.java
@@ -574,8 +574,8 @@
@Override
public int hashCode() {
- return Objects.hash(mRan, mSignalMeasurementType, mHysteresisMs, mHysteresisDb, mThresholds,
- mIsEnabled);
+ return Objects.hash(mRan, mSignalMeasurementType, mHysteresisMs, mHysteresisDb,
+ Arrays.hashCode(mThresholds), mIsEnabled);
}
public static final @NonNull Parcelable.Creator<SignalThresholdInfo> CREATOR =
diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java
index cbd03c7..d670e55 100644
--- a/telephony/java/android/telephony/SmsManager.java
+++ b/telephony/java/android/telephony/SmsManager.java
@@ -1935,7 +1935,7 @@
+ " at calling enableCellBroadcastRangeForSubscriber. subId = " + subId);
}
} catch (RemoteException ex) {
- Rlog.d(TAG, "enableCellBroadcastRange: " + ex.getStackTrace());
+ Rlog.d(TAG, "enableCellBroadcastRange: ", ex);
// ignore it
}
@@ -1996,7 +1996,7 @@
+ " at calling disableCellBroadcastRangeForSubscriber. subId = " + subId);
}
} catch (RemoteException ex) {
- Rlog.d(TAG, "disableCellBroadcastRange: " + ex.getStackTrace());
+ Rlog.d(TAG, "disableCellBroadcastRange: ", ex);
// ignore it
}
diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java
index c36eb2f..cb985bf 100644
--- a/telephony/java/android/telephony/SubscriptionInfo.java
+++ b/telephony/java/android/telephony/SubscriptionInfo.java
@@ -967,9 +967,9 @@
public int hashCode() {
return Objects.hash(mId, mSimSlotIndex, mNameSource, mIconTint, mDataRoaming, mIsEmbedded,
mIsOpportunistic, mGroupUUID, mIccId, mNumber, mMcc, mMnc, mCountryIso, mCardString,
- mCardId, mDisplayName, mCarrierName, mNativeAccessRules, mIsGroupDisabled,
- mCarrierId, mProfileClass, mGroupOwner, mAreUiccApplicationsEnabled, mPortIndex,
- mUsageSetting);
+ mCardId, mDisplayName, mCarrierName, Arrays.hashCode(mNativeAccessRules),
+ mIsGroupDisabled, mCarrierId, mProfileClass, mGroupOwner,
+ mAreUiccApplicationsEnabled, mPortIndex, mUsageSetting);
}
@Override
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/android/telephony/TelephonyScanManager.java b/telephony/java/android/telephony/TelephonyScanManager.java
index e0c5298..19f2a9b 100644
--- a/telephony/java/android/telephony/TelephonyScanManager.java
+++ b/telephony/java/android/telephony/TelephonyScanManager.java
@@ -171,7 +171,7 @@
ci[i] = (CellInfo) parcelables[i];
}
executor.execute(() -> {
- Rlog.d(TAG, "onResults: " + ci.toString());
+ Rlog.d(TAG, "onResults: " + Arrays.toString(ci));
callback.onResults(Arrays.asList(ci));
});
} catch (Exception e) {
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/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java
index db48984..661dd84 100644
--- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java
+++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java
@@ -33,6 +33,8 @@
import android.widget.ImageView;
import android.widget.TextView;
+import java.util.Arrays;
+
public class MainInteractionSession extends VoiceInteractionSession
implements View.OnClickListener {
static final String TAG = "MainInteractionSession";
@@ -403,7 +405,7 @@
@Override
public void onRequestPickOption(PickOptionRequest request) {
Log.i(TAG, "onPickOption: prompt=" + request.getVoicePrompt() + " options="
- + request.getOptions() + " extras=" + request.getExtras());
+ + Arrays.toString(request.getOptions()) + " extras=" + request.getExtras());
mConfirmButton.setText("Pick Option");
mPendingRequest = request;
setPrompt(request.getVoicePrompt());
diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/StartVoiceInteractionActivity.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/StartVoiceInteractionActivity.java
index 733f602..8ae7186 100644
--- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/StartVoiceInteractionActivity.java
+++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/StartVoiceInteractionActivity.java
@@ -24,6 +24,8 @@
import android.widget.Button;
import android.widget.TextView;
+import java.util.Arrays;
+
public class StartVoiceInteractionActivity extends Activity implements View.OnClickListener {
static final String TAG = "LocalVoiceInteractionActivity";
@@ -187,7 +189,8 @@
}
@Override
public void onPickOptionResult(boolean finished, Option[] selections, Bundle result) {
- Log.i(TAG, "Pick result: finished=" + finished + " selections=" + selections
+ Log.i(TAG, "Pick result: finished=" + finished
+ + " selections=" + Arrays.toString(selections)
+ " result=" + result);
StringBuilder sb = new StringBuilder();
if (finished) {
diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/TestInteractionActivity.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/TestInteractionActivity.java
index ada0e21..4fc3a15 100644
--- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/TestInteractionActivity.java
+++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/TestInteractionActivity.java
@@ -28,6 +28,8 @@
import android.widget.Button;
import android.widget.TextView;
+import java.util.Arrays;
+
public class TestInteractionActivity extends Activity implements View.OnClickListener {
static final String TAG = "TestInteractionActivity";
@@ -240,7 +242,8 @@
}
@Override
public void onPickOptionResult(boolean finished, Option[] selections, Bundle result) {
- Log.i(TAG, "Pick result: finished=" + finished + " selections=" + selections
+ Log.i(TAG, "Pick result: finished=" + finished
+ + " selections=" + Arrays.toString(selections)
+ " result=" + result);
StringBuilder sb = new StringBuilder();
if (finished) {
diff --git a/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtilsTest.java b/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtilsTest.java
index 3b201f9..e4add80 100644
--- a/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtilsTest.java
+++ b/tests/vcn/java/android/net/vcn/persistablebundleutils/IkeSessionParamsUtilsTest.java
@@ -16,6 +16,9 @@
package android.net.vcn.persistablebundleutils;
+import static android.net.vcn.persistablebundleutils.IkeSessionParamsUtils.IKE_OPTION_AUTOMATIC_ADDRESS_FAMILY_SELECTION;
+import static android.net.vcn.persistablebundleutils.IkeSessionParamsUtils.IKE_OPTION_AUTOMATIC_NATT_KEEPALIVES;
+import static android.net.vcn.persistablebundleutils.IkeSessionParamsUtils.isIkeOptionValid;
import static android.system.OsConstants.AF_INET;
import static android.system.OsConstants.AF_INET6;
import static android.telephony.TelephonyManager.APPTYPE_USIM;
@@ -134,15 +137,37 @@
verifyPersistableBundleEncodeDecodeIsLossless(params);
}
+ private static IkeSessionParams.Builder createBuilderMinimumWithEap() throws Exception {
+ final X509Certificate serverCaCert = createCertFromPemFile("self-signed-ca.pem");
+
+ final byte[] eapId = "test@android.net".getBytes(StandardCharsets.US_ASCII);
+ final int subId = 1;
+ final EapSessionConfig eapConfig =
+ new EapSessionConfig.Builder()
+ .setEapIdentity(eapId)
+ .setEapSimConfig(subId, APPTYPE_USIM)
+ .setEapAkaConfig(subId, APPTYPE_USIM)
+ .build();
+ return createBuilderMinimum().setAuthEap(serverCaCert, eapConfig);
+ }
+
@Test
public void testEncodeDecodeParamsWithIkeOptions() throws Exception {
- final IkeSessionParams params =
- createBuilderMinimum()
+ final IkeSessionParams.Builder builder =
+ createBuilderMinimumWithEap()
.addIkeOption(IkeSessionParams.IKE_OPTION_ACCEPT_ANY_REMOTE_ID)
+ .addIkeOption(IkeSessionParams.IKE_OPTION_EAP_ONLY_AUTH)
.addIkeOption(IkeSessionParams.IKE_OPTION_MOBIKE)
+ .addIkeOption(IkeSessionParams.IKE_OPTION_FORCE_PORT_4500)
.addIkeOption(IkeSessionParams.IKE_OPTION_INITIAL_CONTACT)
- .build();
- verifyPersistableBundleEncodeDecodeIsLossless(params);
+ .addIkeOption(IkeSessionParams.IKE_OPTION_REKEY_MOBILITY);
+ if (isIkeOptionValid(IKE_OPTION_AUTOMATIC_ADDRESS_FAMILY_SELECTION)) {
+ builder.addIkeOption(IKE_OPTION_AUTOMATIC_ADDRESS_FAMILY_SELECTION);
+ }
+ if (isIkeOptionValid(IKE_OPTION_AUTOMATIC_NATT_KEEPALIVES)) {
+ builder.addIkeOption(IKE_OPTION_AUTOMATIC_NATT_KEEPALIVES);
+ }
+ verifyPersistableBundleEncodeDecodeIsLossless(builder.build());
}
private static InputStream openAssetsFile(String fileName) throws Exception {
@@ -176,19 +201,7 @@
@Test
public void testEncodeRecodeParamsWithEapAuth() throws Exception {
- final X509Certificate serverCaCert = createCertFromPemFile("self-signed-ca.pem");
-
- final byte[] eapId = "test@android.net".getBytes(StandardCharsets.US_ASCII);
- final int subId = 1;
- final EapSessionConfig eapConfig =
- new EapSessionConfig.Builder()
- .setEapIdentity(eapId)
- .setEapSimConfig(subId, APPTYPE_USIM)
- .setEapAkaConfig(subId, APPTYPE_USIM)
- .build();
-
- final IkeSessionParams params =
- createBuilderMinimum().setAuthEap(serverCaCert, eapConfig).build();
+ final IkeSessionParams params = createBuilderMinimumWithEap().build();
verifyPersistableBundleEncodeDecodeIsLossless(params);
}
}
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