Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 970cb63c authored by Austin Borger's avatar Austin Borger Committed by Android (Google) Code Review
Browse files

Merge "HintManagerService: Use the default UidObserver implementation." into udc-dev

parents 333a8d41 35d65d6d
Loading
Loading
Loading
Loading
+9 −9
Original line number Original line Diff line number Diff line
@@ -9213,7 +9213,7 @@ HSPLcom/android/server/power/hint/HintManagerService$AppHintSession;-><init>(Lco
HPLcom/android/server/power/hint/HintManagerService$AppHintSession;->close()V
HPLcom/android/server/power/hint/HintManagerService$AppHintSession;->close()V
HSPLcom/android/server/power/hint/HintManagerService$AppHintSession;->reportActualWorkDuration([J[J)V+]Lcom/android/server/power/hint/HintManagerService$NativeWrapper;Lcom/android/server/power/hint/HintManagerService$NativeWrapper;]Lcom/android/server/power/hint/HintManagerService$AppHintSession;Lcom/android/server/power/hint/HintManagerService$AppHintSession;
HSPLcom/android/server/power/hint/HintManagerService$AppHintSession;->reportActualWorkDuration([J[J)V+]Lcom/android/server/power/hint/HintManagerService$NativeWrapper;Lcom/android/server/power/hint/HintManagerService$NativeWrapper;]Lcom/android/server/power/hint/HintManagerService$AppHintSession;Lcom/android/server/power/hint/HintManagerService$AppHintSession;
HSPLcom/android/server/power/hint/HintManagerService$AppHintSession;->sendHint(I)V+]Lcom/android/server/power/hint/HintManagerService$NativeWrapper;Lcom/android/server/power/hint/HintManagerService$NativeWrapper;]Lcom/android/server/power/hint/HintManagerService$AppHintSession;Lcom/android/server/power/hint/HintManagerService$AppHintSession;
HSPLcom/android/server/power/hint/HintManagerService$AppHintSession;->sendHint(I)V+]Lcom/android/server/power/hint/HintManagerService$NativeWrapper;Lcom/android/server/power/hint/HintManagerService$NativeWrapper;]Lcom/android/server/power/hint/HintManagerService$AppHintSession;Lcom/android/server/power/hint/HintManagerService$AppHintSession;
HSPLcom/android/server/power/hint/HintManagerService$AppHintSession;->updateHintAllowed()Z+]Lcom/android/server/power/hint/HintManagerService$UidObserver;Lcom/android/server/power/hint/HintManagerService$UidObserver;]Lcom/android/server/power/hint/HintManagerService$AppHintSession;Lcom/android/server/power/hint/HintManagerService$AppHintSession;
HSPLcom/android/server/power/hint/HintManagerService$AppHintSession;->updateHintAllowed()Z+]Lcom/android/server/power/hint/HintManagerService$MyUidObserver;Lcom/android/server/power/hint/HintManagerService$MyUidObserver;]Lcom/android/server/power/hint/HintManagerService$AppHintSession;Lcom/android/server/power/hint/HintManagerService$AppHintSession;
HSPLcom/android/server/power/hint/HintManagerService$AppHintSession;->updateTargetWorkDuration(J)V
HSPLcom/android/server/power/hint/HintManagerService$AppHintSession;->updateTargetWorkDuration(J)V
HSPLcom/android/server/power/hint/HintManagerService$BinderService;-><init>(Lcom/android/server/power/hint/HintManagerService;)V
HSPLcom/android/server/power/hint/HintManagerService$BinderService;-><init>(Lcom/android/server/power/hint/HintManagerService;)V
HSPLcom/android/server/power/hint/HintManagerService$BinderService;->createHintSession(Landroid/os/IBinder;[IJ)Landroid/os/IHintSession;
HSPLcom/android/server/power/hint/HintManagerService$BinderService;->createHintSession(Landroid/os/IBinder;[IJ)Landroid/os/IHintSession;
@@ -9224,13 +9224,13 @@ HSPLcom/android/server/power/hint/HintManagerService$NativeWrapper;->halGetHintS
HSPLcom/android/server/power/hint/HintManagerService$NativeWrapper;->halInit()V
HSPLcom/android/server/power/hint/HintManagerService$NativeWrapper;->halInit()V
HSPLcom/android/server/power/hint/HintManagerService$NativeWrapper;->halReportActualWorkDuration(J[J[J)V
HSPLcom/android/server/power/hint/HintManagerService$NativeWrapper;->halReportActualWorkDuration(J[J[J)V
HSPLcom/android/server/power/hint/HintManagerService$NativeWrapper;->halSendHint(JI)V
HSPLcom/android/server/power/hint/HintManagerService$NativeWrapper;->halSendHint(JI)V
HSPLcom/android/server/power/hint/HintManagerService$UidObserver$$ExternalSyntheticLambda1;-><init>(Lcom/android/server/power/hint/HintManagerService$UidObserver;II)V
HSPLcom/android/server/power/hint/HintManagerService$MyUidObserver$$ExternalSyntheticLambda1;-><init>(Lcom/android/server/power/hint/HintManagerService$MyUidObserver;II)V
HSPLcom/android/server/power/hint/HintManagerService$UidObserver$$ExternalSyntheticLambda1;->run()V
HSPLcom/android/server/power/hint/HintManagerService$MyUidObserver$$ExternalSyntheticLambda1;->run()V
HSPLcom/android/server/power/hint/HintManagerService$UidObserver;->$r8$lambda$ej6eMAvAGZXPb5YUxpIPNazvUW4(Lcom/android/server/power/hint/HintManagerService$UidObserver;II)V
HSPLcom/android/server/power/hint/HintManagerService$MyUidObserver;->$r8$lambda$ej6eMAvAGZXPb5YUxpIPNazvUW4(Lcom/android/server/power/hint/HintManagerService$MyUidObserver;II)V
HSPLcom/android/server/power/hint/HintManagerService$UidObserver;-><init>(Lcom/android/server/power/hint/HintManagerService;)V
HSPLcom/android/server/power/hint/HintManagerService$MyUidObserver;-><init>(Lcom/android/server/power/hint/HintManagerService;)V
HSPLcom/android/server/power/hint/HintManagerService$UidObserver;->isUidForeground(I)Z+]Ljava/lang/Integer;Ljava/lang/Integer;]Landroid/util/SparseArray;Landroid/util/SparseArray;
HSPLcom/android/server/power/hint/HintManagerService$MyUidObserver;->isUidForeground(I)Z+]Ljava/lang/Integer;Ljava/lang/Integer;]Landroid/util/SparseArray;Landroid/util/SparseArray;
HSPLcom/android/server/power/hint/HintManagerService$UidObserver;->lambda$onUidStateChanged$1(II)V+]Landroid/util/ArrayMap;Landroid/util/ArrayMap;]Landroid/util/SparseArray;Landroid/util/SparseArray;]Ljava/util/Collection;Landroid/util/MapCollections$ValuesCollection;]Landroid/util/ArraySet;Landroid/util/ArraySet;]Ljava/util/Iterator;Landroid/util/MapCollections$ArrayIterator;
HSPLcom/android/server/power/hint/HintManagerService$MyUidObserver;->lambda$onUidStateChanged$1(II)V+]Landroid/util/ArrayMap;Landroid/util/ArrayMap;]Landroid/util/SparseArray;Landroid/util/SparseArray;]Ljava/util/Collection;Landroid/util/MapCollections$ValuesCollection;]Landroid/util/ArraySet;Landroid/util/ArraySet;]Ljava/util/Iterator;Landroid/util/MapCollections$ArrayIterator;
HSPLcom/android/server/power/hint/HintManagerService$UidObserver;->onUidStateChanged(IIJI)V+]Landroid/os/Handler;Landroid/os/Handler;
HSPLcom/android/server/power/hint/HintManagerService$MyUidObserver;->onUidStateChanged(IIJI)V+]Landroid/os/Handler;Landroid/os/Handler;
HSPLcom/android/server/power/hint/HintManagerService;->-$$Nest$fgetmActiveSessions(Lcom/android/server/power/hint/HintManagerService;)Landroid/util/ArrayMap;
HSPLcom/android/server/power/hint/HintManagerService;->-$$Nest$fgetmActiveSessions(Lcom/android/server/power/hint/HintManagerService;)Landroid/util/ArrayMap;
HSPLcom/android/server/power/hint/HintManagerService;->-$$Nest$fgetmLock(Lcom/android/server/power/hint/HintManagerService;)Ljava/lang/Object;
HSPLcom/android/server/power/hint/HintManagerService;->-$$Nest$fgetmLock(Lcom/android/server/power/hint/HintManagerService;)Ljava/lang/Object;
HSPLcom/android/server/power/hint/HintManagerService;->-$$Nest$fgetmNativeWrapper(Lcom/android/server/power/hint/HintManagerService;)Lcom/android/server/power/hint/HintManagerService$NativeWrapper;
HSPLcom/android/server/power/hint/HintManagerService;->-$$Nest$fgetmNativeWrapper(Lcom/android/server/power/hint/HintManagerService;)Lcom/android/server/power/hint/HintManagerService$NativeWrapper;
@@ -13493,7 +13493,7 @@ Lcom/android/server/power/batterysaver/BatterySavingStats;
Lcom/android/server/power/hint/HintManagerService$BinderService;
Lcom/android/server/power/hint/HintManagerService$BinderService;
Lcom/android/server/power/hint/HintManagerService$Injector;
Lcom/android/server/power/hint/HintManagerService$Injector;
Lcom/android/server/power/hint/HintManagerService$NativeWrapper;
Lcom/android/server/power/hint/HintManagerService$NativeWrapper;
Lcom/android/server/power/hint/HintManagerService$UidObserver;
Lcom/android/server/power/hint/HintManagerService$MyUidObserver;
Lcom/android/server/power/hint/HintManagerService;
Lcom/android/server/power/hint/HintManagerService;
Lcom/android/server/power/stats/BatteryExternalStatsWorker$$ExternalSyntheticLambda0;
Lcom/android/server/power/stats/BatteryExternalStatsWorker$$ExternalSyntheticLambda0;
Lcom/android/server/power/stats/BatteryExternalStatsWorker$$ExternalSyntheticLambda3;
Lcom/android/server/power/stats/BatteryExternalStatsWorker$$ExternalSyntheticLambda3;
+4 −20
Original line number Original line Diff line number Diff line
@@ -19,8 +19,8 @@ package com.android.server.power.hint;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.app.ActivityManager;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
import android.app.ActivityManagerInternal;
import android.app.IUidObserver;
import android.app.StatsManager;
import android.app.StatsManager;
import android.app.UidObserver;
import android.content.Context;
import android.content.Context;
import android.os.Binder;
import android.os.Binder;
import android.os.IBinder;
import android.os.IBinder;
@@ -69,7 +69,7 @@ public final class HintManagerService extends SystemService {
    /** Lock to protect HAL handles and listen list. */
    /** Lock to protect HAL handles and listen list. */
    private final Object mLock = new Object();
    private final Object mLock = new Object();


    @VisibleForTesting final UidObserver mUidObserver;
    @VisibleForTesting final MyUidObserver mUidObserver;


    private final NativeWrapper mNativeWrapper;
    private final NativeWrapper mNativeWrapper;


@@ -94,7 +94,7 @@ public final class HintManagerService extends SystemService {
        mNativeWrapper = injector.createNativeWrapper();
        mNativeWrapper = injector.createNativeWrapper();
        mNativeWrapper.halInit();
        mNativeWrapper.halInit();
        mHintSessionPreferredRate = mNativeWrapper.halGetHintSessionPreferredRate();
        mHintSessionPreferredRate = mNativeWrapper.halGetHintSessionPreferredRate();
        mUidObserver = new UidObserver();
        mUidObserver = new MyUidObserver();
        mAmInternal = Objects.requireNonNull(
        mAmInternal = Objects.requireNonNull(
                LocalServices.getService(ActivityManagerInternal.class));
                LocalServices.getService(ActivityManagerInternal.class));
    }
    }
@@ -246,7 +246,7 @@ public final class HintManagerService extends SystemService {
    }
    }


    @VisibleForTesting
    @VisibleForTesting
    final class UidObserver extends IUidObserver.Stub {
    final class MyUidObserver extends UidObserver {
        private final SparseArray<Integer> mProcStatesCache = new SparseArray<>();
        private final SparseArray<Integer> mProcStatesCache = new SparseArray<>();


        public boolean isUidForeground(int uid) {
        public boolean isUidForeground(int uid) {
@@ -276,14 +276,6 @@ public final class HintManagerService extends SystemService {
            });
            });
        }
        }


        @Override
        public void onUidActive(int uid) {
        }

        @Override
        public void onUidIdle(int uid, boolean disabled) {
        }

        /**
        /**
         * The IUidObserver callback is called from the system_server, so it'll be a direct function
         * The IUidObserver callback is called from the system_server, so it'll be a direct function
         * call from ActivityManagerService. Do not do heavy logic here.
         * call from ActivityManagerService. Do not do heavy logic here.
@@ -305,14 +297,6 @@ public final class HintManagerService extends SystemService {
                }
                }
            });
            });
        }
        }

        @Override
        public void onUidCachedChanged(int uid, boolean cached) {
        }

        @Override
        public void onUidProcAdjChanged(int uid) {
        }
    }
    }


    @VisibleForTesting
    @VisibleForTesting