aboutsummaryrefslogtreecommitdiff
path: root/cpp/watchdog
diff options
context:
space:
mode:
authorLakshman Annadorai <lakshmana@google.com>2021-11-09 20:32:14 +0000
committerLakshman Annadorai <lakshmana@google.com>2021-11-10 18:20:19 +0000
commit7a46ea77fe23e8bae35ece0d67464a279befa0a1 (patch)
treedec035bd1f08dc7a39be77aecf7e8f72945388a1 /cpp/watchdog
parent1bcec22d762c585f0e459baf3b5134006b53bede (diff)
downloadCar-7a46ea77fe23e8bae35ece0d67464a279befa0a1.tar.gz
Remove unused actionTakenOnResourceOveruse watchdog daemon AIDL method.
- actionTakenOnResourceOveruse is supposed to be used by CarService to notify watchdog daemon of the actions taken on packages on resource overuse. And the watchdog daemon will use the notification to upload metrics. - However, the metrics logging was moved to Carservice and watchdog daemon doesn't need to be notified of the actions taken on resource overuse. Test: CarWatchdogServiceUnitTest WatchdogStorageUnitTest \ libwatchdog_test CarWatchdogDaemonHelperTest Bug: 203247108 Change-Id: Ie14e79c988adc6ab2ea8b06775d65459d1b1db5b Merged-In: Ie14e79c988adc6ab2ea8b06775d65459d1b1db5b (cherry picked from commit 98b6b1b3a5460873f1ee915775e0d1ee4efe221f)
Diffstat (limited to 'cpp/watchdog')
-rw-r--r--cpp/watchdog/aidl/android/automotive/watchdog/internal/ICarWatchdog.aidl9
-rw-r--r--cpp/watchdog/aidl/android/automotive/watchdog/internal/PackageResourceOveruseAction.aidl41
-rw-r--r--cpp/watchdog/aidl/android/automotive/watchdog/internal/ResourceOveruseActionType.aidl44
-rw-r--r--cpp/watchdog/car-watchdog-lib/src/android/car/watchdoglib/CarWatchdogDaemonHelper.java13
-rw-r--r--cpp/watchdog/server/src/IoOveruseMonitor.cpp11
-rw-r--r--cpp/watchdog/server/src/IoOveruseMonitor.h10
-rw-r--r--cpp/watchdog/server/src/WatchdogInternalHandler.cpp13
-rw-r--r--cpp/watchdog/server/src/WatchdogInternalHandler.h5
-rw-r--r--cpp/watchdog/server/tests/MockIoOveruseMonitor.h5
-rw-r--r--cpp/watchdog/server/tests/WatchdogInternalHandlerTest.cpp17
10 files changed, 0 insertions, 168 deletions
diff --git a/cpp/watchdog/aidl/android/automotive/watchdog/internal/ICarWatchdog.aidl b/cpp/watchdog/aidl/android/automotive/watchdog/internal/ICarWatchdog.aidl
index c9ece218b0..61b65c7883 100644
--- a/cpp/watchdog/aidl/android/automotive/watchdog/internal/ICarWatchdog.aidl
+++ b/cpp/watchdog/aidl/android/automotive/watchdog/internal/ICarWatchdog.aidl
@@ -19,7 +19,6 @@ package android.automotive.watchdog.internal;
import android.automotive.watchdog.internal.ComponentType;
import android.automotive.watchdog.internal.ICarWatchdogMonitor;
import android.automotive.watchdog.internal.ICarWatchdogServiceForSystem;
-import android.automotive.watchdog.internal.PackageResourceOveruseAction;
import android.automotive.watchdog.internal.ResourceOveruseConfiguration;
import android.automotive.watchdog.internal.StateType;
@@ -121,14 +120,6 @@ interface ICarWatchdog {
*/
List<ResourceOveruseConfiguration> getResourceOveruseConfigurations();
- /**
- * CarWatchdogService notifies the native service with the actions taken on the resource overusing
- * applications.
- *
- * @param actions List of actions take on resource overusing packages.
- */
- void actionTakenOnResourceOveruse(in List<PackageResourceOveruseAction> actions);
-
/**
* Enable/disable the internal client health check process.
* Disabling would stop the ANR killing process.
diff --git a/cpp/watchdog/aidl/android/automotive/watchdog/internal/PackageResourceOveruseAction.aidl b/cpp/watchdog/aidl/android/automotive/watchdog/internal/PackageResourceOveruseAction.aidl
deleted file mode 100644
index 521b6040ca..0000000000
--- a/cpp/watchdog/aidl/android/automotive/watchdog/internal/PackageResourceOveruseAction.aidl
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2021 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.automotive.watchdog.internal;
-
-import android.automotive.watchdog.internal.PackageIdentifier;
-import android.automotive.watchdog.internal.ResourceOveruseActionType;
-import android.automotive.watchdog.ResourceType;
-
-/**
- * Structure that describes the action taken on a package due to resource overuse.
- */
-parcelable PackageResourceOveruseAction {
- /**
- * Identifier for the package.
- */
- PackageIdentifier packageIdentifier;
-
- /**
- * Resources that were overused.
- */
- ResourceType[] resourceTypes;
-
- /**
- * Action taken on the package.
- */
- ResourceOveruseActionType resourceOveruseActionType = ResourceOveruseActionType.NOT_KILLED;
-}
diff --git a/cpp/watchdog/aidl/android/automotive/watchdog/internal/ResourceOveruseActionType.aidl b/cpp/watchdog/aidl/android/automotive/watchdog/internal/ResourceOveruseActionType.aidl
deleted file mode 100644
index 0d7d93582e..0000000000
--- a/cpp/watchdog/aidl/android/automotive/watchdog/internal/ResourceOveruseActionType.aidl
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2021 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.automotive.watchdog.internal;
-
-/**
- * Describes the action taken on resource overuse.
- */
-@Backing(type="int")
-enum ResourceOveruseActionType {
- /**
- * The package is not killed because either it is not killable, internal error occurred, or
- * already disabled.
- */
- NOT_KILLED,
-
- /**
- * The package is not killed as the user opted-out the package from killing on resource overuse.
- */
- NOT_KILLED_USER_OPTED,
-
- /**
- * The package is killed on resource overuse.
- */
- KILLED,
-
- /**
- * The package is killed as it has recurring resource overuse pattern.
- */
- KILLED_RECURRING_OVERUSE,
-}
diff --git a/cpp/watchdog/car-watchdog-lib/src/android/car/watchdoglib/CarWatchdogDaemonHelper.java b/cpp/watchdog/car-watchdog-lib/src/android/car/watchdoglib/CarWatchdogDaemonHelper.java
index e7229baf94..945383a137 100644
--- a/cpp/watchdog/car-watchdog-lib/src/android/car/watchdoglib/CarWatchdogDaemonHelper.java
+++ b/cpp/watchdog/car-watchdog-lib/src/android/car/watchdoglib/CarWatchdogDaemonHelper.java
@@ -23,7 +23,6 @@ import android.annotation.Nullable;
import android.automotive.watchdog.internal.ICarWatchdog;
import android.automotive.watchdog.internal.ICarWatchdogMonitor;
import android.automotive.watchdog.internal.ICarWatchdogServiceForSystem;
-import android.automotive.watchdog.internal.PackageResourceOveruseAction;
import android.automotive.watchdog.internal.ResourceOveruseConfiguration;
import android.os.Handler;
import android.os.IBinder;
@@ -280,18 +279,6 @@ public final class CarWatchdogDaemonHelper {
}
/**
- * Notifies car watchdog daemon with the actions taken on resource overuse.
- *
- * @param actions List of actions taken on resource overuse. One action taken per resource
- * overusing user package.
- * @throws RemoteException
- */
- public void actionTakenOnResourceOveruse(List<PackageResourceOveruseAction> actions)
- throws RemoteException {
- invokeDaemonMethod((daemon) -> daemon.actionTakenOnResourceOveruse(actions));
- }
-
- /**
* Enable/disable the internal client health check process.
* Disabling would stop the ANR killing process.
*
diff --git a/cpp/watchdog/server/src/IoOveruseMonitor.cpp b/cpp/watchdog/server/src/IoOveruseMonitor.cpp
index 1164a2a45d..0ebe0d494e 100644
--- a/cpp/watchdog/server/src/IoOveruseMonitor.cpp
+++ b/cpp/watchdog/server/src/IoOveruseMonitor.cpp
@@ -50,7 +50,6 @@ using ::android::automotive::watchdog::internal::IoUsageStats;
using ::android::automotive::watchdog::internal::PackageIdentifier;
using ::android::automotive::watchdog::internal::PackageInfo;
using ::android::automotive::watchdog::internal::PackageIoOveruseStats;
-using ::android::automotive::watchdog::internal::PackageResourceOveruseAction;
using ::android::automotive::watchdog::internal::ResourceOveruseConfiguration;
using ::android::automotive::watchdog::internal::UidType;
using ::android::automotive::watchdog::internal::UserPackageIoUsageStats;
@@ -472,7 +471,6 @@ void IoOveruseMonitor::notifyNativePackagesLocked(
if (DEBUG) {
ALOGD("Notified native packages on I/O overuse");
}
- // TODO(b/184310189): Upload I/O overuse metrics for native packages.
}
Result<void> IoOveruseMonitor::updateResourceOveruseConfigurations(
@@ -512,15 +510,6 @@ Result<void> IoOveruseMonitor::getResourceOveruseConfigurations(
return {};
}
-Result<void> IoOveruseMonitor::actionTakenOnIoOveruse(
- [[maybe_unused]] const std::vector<PackageResourceOveruseAction>& actions) {
- // TODO(b/184310189): Upload metrics.
- if (DEBUG) {
- ALOGD("Recorded action taken on I/O overuse");
- }
- return {};
-}
-
Result<void> IoOveruseMonitor::addIoOveruseListener(const sp<IResourceOveruseListener>& listener) {
pid_t callingPid = IPCThreadState::self()->getCallingPid();
uid_t callingUid = IPCThreadState::self()->getCallingUid();
diff --git a/cpp/watchdog/server/src/IoOveruseMonitor.h b/cpp/watchdog/server/src/IoOveruseMonitor.h
index 57c01c08aa..5fa91aae24 100644
--- a/cpp/watchdog/server/src/IoOveruseMonitor.h
+++ b/cpp/watchdog/server/src/IoOveruseMonitor.h
@@ -31,7 +31,6 @@
#include <android/automotive/watchdog/internal/IoOveruseConfiguration.h>
#include <android/automotive/watchdog/internal/PackageInfo.h>
#include <android/automotive/watchdog/internal/PackageIoOveruseStats.h>
-#include <android/automotive/watchdog/internal/PackageResourceOveruseAction.h>
#include <utils/Mutex.h>
#include <time.h>
@@ -81,10 +80,6 @@ public:
virtual android::base::Result<void> getResourceOveruseConfigurations(
std::vector<android::automotive::watchdog::internal::ResourceOveruseConfiguration>*
configs) const = 0;
- virtual android::base::Result<void> actionTakenOnIoOveruse(
- const std::vector<
- android::automotive::watchdog::internal::PackageResourceOveruseAction>&
- actions) = 0;
// Below methods support APIs from ICarWatchdog.aidl. Please refer to the AIDL for description.
virtual android::base::Result<void> addIoOveruseListener(
@@ -155,11 +150,6 @@ public:
std::vector<android::automotive::watchdog::internal::ResourceOveruseConfiguration>*
configs) const override;
- android::base::Result<void> actionTakenOnIoOveruse(
- const std::vector<
- android::automotive::watchdog::internal::PackageResourceOveruseAction>& actions)
- override;
-
android::base::Result<void> addIoOveruseListener(
const sp<IResourceOveruseListener>& listener) override;
diff --git a/cpp/watchdog/server/src/WatchdogInternalHandler.cpp b/cpp/watchdog/server/src/WatchdogInternalHandler.cpp
index be49ff9359..2441ccf7f4 100644
--- a/cpp/watchdog/server/src/WatchdogInternalHandler.cpp
+++ b/cpp/watchdog/server/src/WatchdogInternalHandler.cpp
@@ -36,7 +36,6 @@ namespace aawi = ::android::automotive::watchdog::internal;
using aawi::ComponentType;
using aawi::GarageMode;
using aawi::ICarWatchdogServiceForSystem;
-using aawi::PackageResourceOveruseAction;
using aawi::PowerCycle;
using aawi::ResourceOveruseConfiguration;
using ::android::sp;
@@ -256,18 +255,6 @@ Status WatchdogInternalHandler::getResourceOveruseConfigurations(
return Status::ok();
}
-Status WatchdogInternalHandler::actionTakenOnResourceOveruse(
- const std::vector<PackageResourceOveruseAction>& actions) {
- Status status = checkSystemUser();
- if (!status.isOk()) {
- return status;
- }
- if (const auto result = mIoOveruseMonitor->actionTakenOnIoOveruse(actions); !result.ok()) {
- return fromExceptionCode(result.error().code(), result.error().message());
- }
- return Status::ok();
-}
-
Status WatchdogInternalHandler::controlProcessHealthCheck(bool disable) {
Status status = checkSystemUser();
if (!status.isOk()) {
diff --git a/cpp/watchdog/server/src/WatchdogInternalHandler.h b/cpp/watchdog/server/src/WatchdogInternalHandler.h
index e23620eb87..1000c8e218 100644
--- a/cpp/watchdog/server/src/WatchdogInternalHandler.h
+++ b/cpp/watchdog/server/src/WatchdogInternalHandler.h
@@ -26,7 +26,6 @@
#include <android/automotive/watchdog/internal/ComponentType.h>
#include <android/automotive/watchdog/internal/ICarWatchdogMonitor.h>
#include <android/automotive/watchdog/internal/ICarWatchdogServiceForSystem.h>
-#include <android/automotive/watchdog/internal/PackageResourceOveruseAction.h>
#include <android/automotive/watchdog/internal/ResourceOveruseConfiguration.h>
#include <android/automotive/watchdog/internal/StateType.h>
#include <binder/Status.h>
@@ -89,10 +88,6 @@ public:
android::binder::Status getResourceOveruseConfigurations(
std::vector<android::automotive::watchdog::internal::ResourceOveruseConfiguration>*
configs) override;
- android::binder::Status actionTakenOnResourceOveruse(
- const std::vector<
- android::automotive::watchdog::internal::PackageResourceOveruseAction>& actions)
- override;
android::binder::Status controlProcessHealthCheck(bool disable) override;
protected:
diff --git a/cpp/watchdog/server/tests/MockIoOveruseMonitor.h b/cpp/watchdog/server/tests/MockIoOveruseMonitor.h
index a9d677e42d..294276bb48 100644
--- a/cpp/watchdog/server/tests/MockIoOveruseMonitor.h
+++ b/cpp/watchdog/server/tests/MockIoOveruseMonitor.h
@@ -45,11 +45,6 @@ public:
android::base::Result<void>, getResourceOveruseConfigurations,
(std::vector<android::automotive::watchdog::internal::ResourceOveruseConfiguration>*),
(const, override));
- MOCK_METHOD(android::base::Result<void>, actionTakenOnIoOveruse,
- (const std::vector<
- android::automotive::watchdog::internal::PackageResourceOveruseAction>&
- actions),
- (override));
MOCK_METHOD(android::base::Result<void>, addIoOveruseListener,
(const sp<IResourceOveruseListener>&), (override));
MOCK_METHOD(android::base::Result<void>, removeIoOveruseListener,
diff --git a/cpp/watchdog/server/tests/WatchdogInternalHandlerTest.cpp b/cpp/watchdog/server/tests/WatchdogInternalHandlerTest.cpp
index 4646a11cf7..a5abbc4381 100644
--- a/cpp/watchdog/server/tests/WatchdogInternalHandlerTest.cpp
+++ b/cpp/watchdog/server/tests/WatchdogInternalHandlerTest.cpp
@@ -45,7 +45,6 @@ namespace aawi = ::android::automotive::watchdog::internal;
using aawi::GarageMode;
using aawi::ICarWatchdogServiceForSystem;
using aawi::ICarWatchdogServiceForSystemDefault;
-using aawi::PackageResourceOveruseAction;
using aawi::PowerCycle;
using aawi::ResourceOveruseConfiguration;
using ::android::sp;
@@ -454,22 +453,6 @@ TEST_F(WatchdogInternalHandlerTest,
ASSERT_FALSE(status.isOk()) << status;
}
-TEST_F(WatchdogInternalHandlerTest, TestActionTakenOnResourceOveruse) {
- setSystemCallingUid();
- EXPECT_CALL(*mMockIoOveruseMonitor, actionTakenOnIoOveruse(_)).WillOnce(Return(Result<void>()));
- Status status = mWatchdogInternalHandler->actionTakenOnResourceOveruse(
- std::vector<PackageResourceOveruseAction>{});
- ASSERT_TRUE(status.isOk()) << status;
-}
-
-TEST_F(WatchdogInternalHandlerTest,
- TestErrorOnActionTakenOnResourceOveruseWithNonSystemCallingUid) {
- EXPECT_CALL(*mMockIoOveruseMonitor, actionTakenOnIoOveruse(_)).Times(0);
- Status status = mWatchdogInternalHandler->actionTakenOnResourceOveruse(
- std::vector<PackageResourceOveruseAction>{});
- ASSERT_FALSE(status.isOk()) << status;
-}
-
TEST_F(WatchdogInternalHandlerTest, TestControlProcessHealthCheck) {
setSystemCallingUid();
EXPECT_CALL(*mMockWatchdogProcessService, setEnabled(/*isEnabled=*/true)).Times(1);