Replace handler.sendMessage* with handler.post* methods in CarWatchdogService.

CarWatchdogService shouldn't use the obtainMessage as consequence of
mainlining effort.

Test: atest CarWatchdogServiceUnitTest
Bug: 196243838

Change-Id: I0299c937773bffe3e914efbc770a3b82ce0a29a4
Merged-in: I0299c937773bffe3e914efbc770a3b82ce0a29a4
(cherry picked from commit c89974817c74cdcb60f8eb9576bdc7a1a77b09f3)
diff --git a/service/src/com/android/car/watchdog/WatchdogPerfHandler.java b/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
index 7f4a48e..19523b6 100644
--- a/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
+++ b/service/src/com/android/car/watchdog/WatchdogPerfHandler.java
@@ -31,7 +31,6 @@
 import static com.android.car.watchdog.CarWatchdogService.DEBUG;
 import static com.android.car.watchdog.CarWatchdogService.TAG;
 import static com.android.car.watchdog.PackageInfoHandler.SHARED_PACKAGE_PREFIX;
-import static com.android.internal.util.function.pooled.PooledLambda.obtainMessage;
 
 import android.annotation.NonNull;
 import android.annotation.UserIdInt;
@@ -163,9 +162,7 @@
         synchronized (mLock) {
             checkAndHandleDateChangeLocked();
         }
-        mMainHandler.sendMessage(
-                obtainMessage(WatchdogPerfHandler::fetchAndSyncResourceOveruseConfigurations,
-                        this));
+        mMainHandler.post(this::fetchAndSyncResourceOveruseConfigurations);
         if (DEBUG) {
             Slogf.d(TAG, "WatchdogPerfHandler is initialized");
         }
@@ -625,13 +622,12 @@
                 recurringIoOverusesByUid.put(stats.uid, hasRecurringOveruse);
             }
             if (!mOveruseActionsByUserPackage.isEmpty()) {
-                mMainHandler.sendMessage(obtainMessage(
-                        WatchdogPerfHandler::notifyActionsTakenOnOveruse, this));
+                mMainHandler.post(this::notifyActionsTakenOnOveruse);
             }
             if (recurringIoOverusesByUid.size() > 0) {
-                mMainHandler.sendMessageDelayed(
-                        obtainMessage(WatchdogPerfHandler::handleIoOveruseKilling,
-                                this, recurringIoOverusesByUid, genericPackageNamesByUid),
+                mMainHandler.postDelayed(
+                        () -> handleIoOveruseKilling(
+                                recurringIoOverusesByUid, genericPackageNamesByUid),
                         mResourceOveruseKillingDelayMills);
             }
         }
@@ -1014,9 +1010,7 @@
         boolean doClearPendingRequest = isPendingRequest;
         try {
             mCarWatchdogDaemonHelper.updateResourceOveruseConfigurations(configs);
-            mMainHandler.sendMessage(
-                    obtainMessage(WatchdogPerfHandler::fetchAndSyncResourceOveruseConfigurations,
-                            this));
+            mMainHandler.post(this::fetchAndSyncResourceOveruseConfigurations);
         } catch (RemoteException e) {
             if (e instanceof TransactionTooLargeException) {
                 throw e;