summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-02-03 00:02:41 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-02-03 00:02:41 +0000
commitcfd23fa61794b168d4a160b46be3e4d3dfd1079d (patch)
tree245c95b3db824a4ecc7ced3525bc526ff8636e13
parent917147ba683ae01abdb80300b123ac74eb2edc65 (diff)
parent5ad0bfd84f29ccff05edd0823dece1d5117fba7a (diff)
downloadinterfaces-simpleperf-release.tar.gz
Snap for 11400057 from 5ad0bfd84f29ccff05edd0823dece1d5117fba7a to simpleperf-releasesimpleperf-release
Change-Id: Ib8279a2df7d39d7074676241d2688badf6cb9268
-rw-r--r--keystore2/aidl/Android.bp12
-rw-r--r--keystore2/aidl/aidl_api/android.system.keystore2/current/android/system/keystore2/ResponseCode.aidl1
-rw-r--r--keystore2/aidl/android/system/keystore2/ResponseCode.aidl10
-rw-r--r--media/aidl/android/media/audio/common/AudioDeviceDescription.aidl3
-rw-r--r--media/aidl/android/media/audio/common/AudioDeviceType.aidl19
-rw-r--r--media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceDescription.aidl3
-rw-r--r--media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceType.aidl2
-rw-r--r--suspend/1.0/default/SystemSuspend.cpp38
-rw-r--r--suspend/1.0/default/SystemSuspend.h1
9 files changed, 87 insertions, 2 deletions
diff --git a/keystore2/aidl/Android.bp b/keystore2/aidl/Android.bp
index cc2f90f..9544c70 100644
--- a/keystore2/aidl/Android.bp
+++ b/keystore2/aidl/Android.bp
@@ -52,6 +52,16 @@ aidl_interface {
},
],
- frozen: true,
+ frozen: false,
}
+
+// Note: This should always be one version ahead of the last frozen version
+latest_android_system_keystore = "android.system.keystore-V4"
+
+aidl_interface_defaults {
+ name: "latest_android_system_keystore_import_interface",
+ imports: [
+ latest_android_system_keystore,
+ ],
+}
diff --git a/keystore2/aidl/aidl_api/android.system.keystore2/current/android/system/keystore2/ResponseCode.aidl b/keystore2/aidl/aidl_api/android.system.keystore2/current/android/system/keystore2/ResponseCode.aidl
index 9a486e0..e1ff0bb 100644
--- a/keystore2/aidl/aidl_api/android.system.keystore2/current/android/system/keystore2/ResponseCode.aidl
+++ b/keystore2/aidl/aidl_api/android.system.keystore2/current/android/system/keystore2/ResponseCode.aidl
@@ -54,4 +54,5 @@ enum ResponseCode {
OUT_OF_KEYS_PENDING_INTERNET_CONNECTIVITY = 24,
OUT_OF_KEYS_TRANSIENT_ERROR = 25,
OUT_OF_KEYS_PERMANENT_ERROR = 26,
+ GET_ATTESTATION_APPLICATION_ID_FAILED = 27,
}
diff --git a/keystore2/aidl/android/system/keystore2/ResponseCode.aidl b/keystore2/aidl/android/system/keystore2/ResponseCode.aidl
index 6f2f585..4fe7db3 100644
--- a/keystore2/aidl/android/system/keystore2/ResponseCode.aidl
+++ b/keystore2/aidl/android/system/keystore2/ResponseCode.aidl
@@ -122,11 +122,19 @@ enum ResponseCode {
/**
* Indicates that this device will never be able to provision attestation keys using
- * the remote provsisioning server. This may be due to multiple causes, such as the
+ * the remote provisioning server. This may be due to multiple causes, such as the
* device is not registered with the remote provisioning backend or the device has
* been permanently revoked. Clients who receive this error should not attempt to
* retry key creation.
*/
OUT_OF_KEYS_PERMANENT_ERROR = 26,
+ /**
+ * Indicates that the device had an error when getting the attestation application
+ * id. This is a temporary error that can be retried. This can happen if there is a
+ * failure to make a binder call to the package manager from Keystore service.
+ * The attestation can be retried as this can be seen as a warning.
+ */
+ GET_ATTESTATION_APPLICATION_ID_FAILED = 27,
+
}
diff --git a/media/aidl/android/media/audio/common/AudioDeviceDescription.aidl b/media/aidl/android/media/audio/common/AudioDeviceDescription.aidl
index ac89ffc..002914f 100644
--- a/media/aidl/android/media/audio/common/AudioDeviceDescription.aidl
+++ b/media/aidl/android/media/audio/common/AudioDeviceDescription.aidl
@@ -68,6 +68,9 @@ parcelable AudioDeviceDescription {
*/
const @utf8InCpp String CONNECTION_BT_SCO = "bt-sco";
/**
+ * @deprecated Bus devices are attached, and must be represented using
+ * `{IN|OUT}_BUS` type + empty connection.
+ *
* Bus connection. Mostly used in automotive scenarios.
*/
const @utf8InCpp String CONNECTION_BUS = "bus";
diff --git a/media/aidl/android/media/audio/common/AudioDeviceType.aidl b/media/aidl/android/media/audio/common/AudioDeviceType.aidl
index 43b32d6..5a75da7 100644
--- a/media/aidl/android/media/audio/common/AudioDeviceType.aidl
+++ b/media/aidl/android/media/audio/common/AudioDeviceType.aidl
@@ -100,6 +100,19 @@ enum AudioDeviceType {
*/
IN_DOCK = 14,
/**
+ * An alias for "bus" devices. Must have an empty connection type.
+ *
+ * Note: Since bus devices are non-removable, they need to be represented by
+ * a dedicated type with an empty connection type. However, there has been a
+ * historic accident of defining them as an `{IN|OUT}_DEVICE` type with
+ * `CONNECTION_BUS`. It was fixed by reserving the pair of `{IN|OUT}_DEVICE`
+ * type + empty connection for bus devices. This alias is added for clarity.
+ *
+ * Important: since `{IN|OUT}_BUS` is an alias, always check the connection
+ * type, it must be empty.
+ */
+ IN_BUS = IN_DEVICE,
+ /**
* The "default" device is used when the client does not have any
* preference for a particular device.
*/
@@ -173,4 +186,10 @@ enum AudioDeviceType {
* Output to a broadcast group.
*/
OUT_BROADCAST = 146,
+ /**
+ * An alias for "bus" devices. Must have an empty connection type.
+ *
+ * See the note on `IN_BUS` for details.
+ */
+ OUT_BUS = OUT_DEVICE,
}
diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceDescription.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceDescription.aidl
index a17f46d..d1bcfed 100644
--- a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceDescription.aidl
+++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceDescription.aidl
@@ -41,6 +41,9 @@ parcelable AudioDeviceDescription {
const @utf8InCpp String CONNECTION_BT_A2DP = "bt-a2dp";
const @utf8InCpp String CONNECTION_BT_LE = "bt-le";
const @utf8InCpp String CONNECTION_BT_SCO = "bt-sco";
+ /**
+ * @deprecated Bus devices are attached, and must be represented using `{IN|OUT}_BUS` type + empty connection. Bus connection. Mostly used in automotive scenarios.
+ */
const @utf8InCpp String CONNECTION_BUS = "bus";
const @utf8InCpp String CONNECTION_HDMI = "hdmi";
const @utf8InCpp String CONNECTION_HDMI_ARC = "hdmi-arc";
diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceType.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceType.aidl
index 2617dfa..f7d1b77 100644
--- a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceType.aidl
+++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceType.aidl
@@ -50,6 +50,7 @@ enum AudioDeviceType {
IN_TELEPHONY_RX = 12,
IN_TV_TUNER = 13,
IN_DOCK = 14,
+ IN_BUS = IN_DEVICE /* 4 */,
OUT_DEFAULT = 129,
OUT_ACCESSORY = 130,
OUT_AFE_PROXY = 131,
@@ -68,4 +69,5 @@ enum AudioDeviceType {
OUT_TELEPHONY_TX = 144,
OUT_DOCK = 145,
OUT_BROADCAST = 146,
+ OUT_BUS = OUT_DEVICE /* 133 */,
}
diff --git a/suspend/1.0/default/SystemSuspend.cpp b/suspend/1.0/default/SystemSuspend.cpp
index 1c9ffe9..4aa5189 100644
--- a/suspend/1.0/default/SystemSuspend.cpp
+++ b/suspend/1.0/default/SystemSuspend.cpp
@@ -14,12 +14,16 @@
* limitations under the License.
*/
+#define ATRACE_TAG ATRACE_TAG_POWER
+#define ATRACE_TRACK_BACKOFF "suspend_backoff"
+
#include "SystemSuspend.h"
#include <aidl/android/system/suspend/ISystemSuspend.h>
#include <aidl/android/system/suspend/IWakeLock.h>
#include <android-base/file.h>
#include <android-base/logging.h>
+#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <android/binder_manager.h>
@@ -28,6 +32,7 @@
#include <sys/types.h>
#include <chrono>
+#include <cstdlib>
#include <string>
#include <thread>
using namespace std::chrono_literals;
@@ -35,8 +40,10 @@ using namespace std::chrono_literals;
using ::aidl::android::system::suspend::ISystemSuspend;
using ::aidl::android::system::suspend::IWakeLock;
using ::aidl::android::system::suspend::WakeLockType;
+using ::android::base::CachedProperty;
using ::android::base::Error;
using ::android::base::ReadFdToString;
+using ::android::base::StringPrintf;
using ::android::base::WriteStringToFd;
using ::std::string;
@@ -396,6 +403,8 @@ void SystemSuspend::initAutosuspendLocked() {
mControlService->notifyWakeup(success, wakeupReasons);
+ logKernelWakeLockStats();
+
// Take the lock before returning to the start of the loop
autosuspendLock.lock();
}
@@ -405,6 +414,25 @@ void SystemSuspend::initAutosuspendLocked() {
LOG(INFO) << "automatic system suspend enabled";
}
+void SystemSuspend::logKernelWakeLockStats() {
+ [[clang::no_destroy]] static CachedProperty logStatsProp("suspend.debug.wakestats_log.enabled");
+ std::string prop(logStatsProp.Get(NULL));
+
+ if ((prop.compare("true") != 0) && (prop.compare("1") != 0)) return;
+
+ std::stringstream klStats;
+ klStats << "Kernel wakesource stats: ";
+ std::vector<WakeLockInfo> wlStats;
+ mStatsList.getWakeLockStats(&wlStats);
+
+ for (const WakeLockInfo& wake : wlStats) {
+ if ((wake.isKernelWakelock) && (wake.activeCount > 0)) {
+ klStats << wake.name << "," << wake.totalTime << "," << wake.activeCount << ";";
+ }
+ }
+ LOG(INFO) << klStats.rdbuf();
+}
+
/**
* Updates sleep time depending on the result of suspend attempt.
* Time (in milliseconds) between suspend attempts is described the formula
@@ -453,17 +481,22 @@ void SystemSuspend::updateSleepTime(bool success, const struct SuspendTime& susp
}
if (!badSuspend) {
+ ATRACE_INSTANT_FOR_TRACK(ATRACE_TRACK_BACKOFF, "good");
mNumConsecutiveBadSuspends = 0;
mSleepTime = kSleepTimeConfig.baseSleepTime;
return;
}
+ const char* backoffDecision = "defer";
+
// Suspend attempt was bad (failed or short suspend)
if (mNumConsecutiveBadSuspends >= kSleepTimeConfig.backoffThreshold) {
if (mNumConsecutiveBadSuspends == kSleepTimeConfig.backoffThreshold) {
mSuspendInfo.newBackoffCount++;
+ backoffDecision = "new";
} else {
mSuspendInfo.backoffContinueCount++;
+ backoffDecision = "continue";
}
mSleepTime = std::min(std::chrono::round<std::chrono::milliseconds>(
@@ -472,6 +505,11 @@ void SystemSuspend::updateSleepTime(bool success, const struct SuspendTime& susp
}
mNumConsecutiveBadSuspends++;
+
+ std::string msg =
+ base::StringPrintf("bad %s %s %d %lld", backoffDecision, shortSuspend ? "short" : "failed",
+ mNumConsecutiveBadSuspends, mSleepTime.count());
+ ATRACE_INSTANT_FOR_TRACK(ATRACE_TRACK_BACKOFF, msg.c_str());
}
void SystemSuspend::updateWakeLockStatOnAcquire(const std::string& name, int pid) {
diff --git a/suspend/1.0/default/SystemSuspend.h b/suspend/1.0/default/SystemSuspend.h
index a3f9a00..5f69ce8 100644
--- a/suspend/1.0/default/SystemSuspend.h
+++ b/suspend/1.0/default/SystemSuspend.h
@@ -112,6 +112,7 @@ class SystemSuspend : public RefBase {
void checkAutosuspendClientsLivenessLocked()
EXCLUSIVE_LOCKS_REQUIRED(mAutosuspendClientTokensLock);
bool hasAliveAutosuspendTokenLocked() EXCLUSIVE_LOCKS_REQUIRED(mAutosuspendClientTokensLock);
+ void logKernelWakeLockStats();
std::condition_variable mAutosuspendCondVar GUARDED_BY(mAutosuspendLock);
uint32_t mSuspendCounter GUARDED_BY(mAutosuspendLock);