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

Commit 934a3b4e authored by Cintia Martins's avatar Cintia Martins
Browse files

Fix NullPointerException in AppServiceFinder

Bug: 434785320
Test: atest SupervisionServiceTest
Test: atest CtsSupervisionTestCases
Flag: android.app.supervision.flags.enable_supervision_app_service
Change-Id: I2011aef473f01bfe5a417a477654f86e03a1c67c
parent cd30839e
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -194,6 +194,10 @@ public abstract class AppServiceFinder<TServiceType, TServiceInterfaceType exten
            AppBindingConstants constants, String targetPackage) {
        synchronized (mLock) {
            HashMap<String, TargetServiceInfo> currServiceInfo = mServiceInfos.get(userId);
            if (currServiceInfo == null) {
                currServiceInfo = new HashMap<>();
                mServiceInfos.put(userId, currServiceInfo);
            }
            if (DEBUG) {
                Slog.d(TAG, getAppDescription() + " package=" + targetPackage);
            }
@@ -245,7 +249,7 @@ public abstract class AppServiceFinder<TServiceType, TServiceInterfaceType exten
            AppBindingConstants constants) {
        final Set<String> targetPackages = getTargetPackages(userId);
        synchronized (mLock) {
            mServiceInfos.put(userId, new HashMap<String, TargetServiceInfo>());
            mServiceInfos.put(userId, new HashMap<>());

            if (DEBUG) {
                Slog.d(TAG, getAppDescription() + " packages=" + targetPackages);