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

Commit ac06dc0e authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Updating intent to use system services only." into main

parents e01eb960 0382496d
Loading
Loading
Loading
Loading
+27 −15
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */

package com.android.server;
import static android.crashrecovery.flags.Flags.refactorCrashrecovery;
import static android.service.watchdog.ExplicitHealthCheckService.EXTRA_HEALTH_CHECK_PASSED_PACKAGE;
import static android.service.watchdog.ExplicitHealthCheckService.EXTRA_REQUESTED_PACKAGES;
import static android.service.watchdog.ExplicitHealthCheckService.EXTRA_SUPPORTED_PACKAGES;
@@ -41,7 +42,6 @@ import android.util.ArraySet;
import android.util.Slog;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.util.Preconditions;

import java.util.Collection;
import java.util.Collections;
@@ -363,6 +363,17 @@ class ExplicitHealthCheckController {
    @GuardedBy("mLock")
    @Nullable
    private ServiceInfo getServiceInfoLocked() {
        if (refactorCrashrecovery()) {
            final Intent intent = new Intent(ExplicitHealthCheckService.SERVICE_INTERFACE);
            final ResolveInfo resolveInfo = mContext.getPackageManager().resolveService(intent,
                    PackageManager.GET_SERVICES | PackageManager.GET_META_DATA
                            |  PackageManager.MATCH_SYSTEM_ONLY);
            if (resolveInfo == null || resolveInfo.serviceInfo == null) {
                Slog.w(TAG, "No valid components found.");
                return null;
            }
            return resolveInfo.serviceInfo;
        } else {
            final String packageName =
                    mContext.getPackageManager().getServicesSystemSharedLibraryPackageName();
            if (packageName == null) {
@@ -380,6 +391,7 @@ class ExplicitHealthCheckController {
            }
            return resolveInfo.serviceInfo;
        }
    }

    @GuardedBy("mLock")
    @Nullable