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

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

Merge "Rename onPackageFailure to notifyPackageFailure" into main

parents c460047d da78e1df
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -456,7 +456,7 @@ public class PackageWatchdog {
     *
     * <p>This method could be called frequently if there is a severe problem on the device.
     */
    public void onPackageFailure(@NonNull List<VersionedPackage> packages,
    public void notifyPackageFailure(@NonNull List<VersionedPackage> packages,
            @FailureReasons int failureReason) {
        if (packages == null) {
            Slog.w(TAG, "Could not resolve a list of failing packages");
@@ -467,7 +467,7 @@ public class PackageWatchdog {
            if (Flags.recoverabilityDetection()) {
                if (now >= mLastMitigation
                        && (now - mLastMitigation) < getMitigationWindowMs()) {
                    Slog.i(TAG, "Skipping onPackageFailure mitigation");
                    Slog.i(TAG, "Skipping notifyPackageFailure mitigation");
                    return;
                }
            }
@@ -494,7 +494,7 @@ public class PackageWatchdog {
                            ObserverInternal observer = mAllObservers.valueAt(oIndex);
                            PackageHealthObserver registeredObserver = observer.registeredObserver;
                            if (registeredObserver != null
                                    && observer.onPackageFailureLocked(
                                    && observer.notifyPackageFailureLocked(
                                    versionedPackage.getPackageName())) {
                                MonitoredPackage p = observer.getMonitoredPackage(
                                        versionedPackage.getPackageName());
@@ -693,7 +693,7 @@ public class PackageWatchdog {
        // Check if native watchdog reported a crash
        if ("1".equals(SystemProperties.get("sys.init.updatable_crashing"))) {
            // We rollback all available low impact rollbacks when crash is unattributable
            onPackageFailure(Collections.EMPTY_LIST, FAILURE_REASON_NATIVE_CRASH);
            notifyPackageFailure(Collections.EMPTY_LIST, FAILURE_REASON_NATIVE_CRASH);
            // we stop polling after an attempt to execute rollback, regardless of whether the
            // attempt succeeds or not
        } else {
@@ -916,7 +916,7 @@ public class PackageWatchdog {
     * effectively behave as if the explicit health check hasn't passed for {@code packageName}.
     *
     * <p> {@code packageName} can still be considered failed if reported by
     * {@link #onPackageFailureLocked} before the package expires.
     * {@link #notifyPackageFailureLocked} before the package expires.
     *
     * <p> Triggered by components outside the system server when they are fully functional after an
     * update.
@@ -1460,7 +1460,7 @@ public class PackageWatchdog {
         * @hide
         */
        @GuardedBy("sLock")
        public boolean onPackageFailureLocked(String packageName) {
        public boolean notifyPackageFailureLocked(String packageName) {
            if (getMonitoredPackage(packageName) == null && registeredObserver.isPersistent()
                    && registeredObserver.mayObservePackage(packageName)) {
                putMonitoredPackage(sPackageWatchdog.newMonitoredPackage(
+7 −7
Original line number Diff line number Diff line
@@ -477,7 +477,7 @@ public class PackageWatchdog {
     *
     * <p>This method could be called frequently if there is a severe problem on the device.
     */
    public void onPackageFailure(@NonNull List<VersionedPackage> packages,
    public void notifyPackageFailure(@NonNull List<VersionedPackage> packages,
            @FailureReasons int failureReason) {
        if (packages == null) {
            Slog.w(TAG, "Could not resolve a list of failing packages");
@@ -488,7 +488,7 @@ public class PackageWatchdog {
            if (Flags.recoverabilityDetection()) {
                if (now >= mLastMitigation
                        && (now - mLastMitigation) < getMitigationWindowMs()) {
                    Slog.i(TAG, "Skipping onPackageFailure mitigation");
                    Slog.i(TAG, "Skipping notifyPackageFailure mitigation");
                    return;
                }
            }
@@ -515,7 +515,7 @@ public class PackageWatchdog {
                            ObserverInternal observer = mAllObservers.valueAt(oIndex);
                            PackageHealthObserver registeredObserver = observer.registeredObserver;
                            if (registeredObserver != null
                                    && observer.onPackageFailureLocked(
                                    && observer.notifyPackageFailureLocked(
                                    versionedPackage.getPackageName())) {
                                MonitoredPackage p = observer.getMonitoredPackage(
                                        versionedPackage.getPackageName());
@@ -714,7 +714,7 @@ public class PackageWatchdog {
        // Check if native watchdog reported a crash
        if ("1".equals(SystemProperties.get("sys.init.updatable_crashing"))) {
            // We rollback all available low impact rollbacks when crash is unattributable
            onPackageFailure(Collections.EMPTY_LIST, FAILURE_REASON_NATIVE_CRASH);
            notifyPackageFailure(Collections.EMPTY_LIST, FAILURE_REASON_NATIVE_CRASH);
            // we stop polling after an attempt to execute rollback, regardless of whether the
            // attempt succeeds or not
        } else {
@@ -926,7 +926,7 @@ public class PackageWatchdog {
     * effectively behave as if the explicit health check hasn't passed for {@code packageName}.
     *
     * <p> {@code packageName} can still be considered failed if reported by
     * {@link #onPackageFailureLocked} before the package expires.
     * {@link #notifyPackageFailureLocked} before the package expires.
     *
     * <p> Triggered by components outside the system server when they are fully functional after an
     * update.
@@ -1253,7 +1253,7 @@ public class PackageWatchdog {
                        return;
                    }
                    final List<VersionedPackage> pkgList = Collections.singletonList(pkg);
                    onPackageFailure(pkgList, FAILURE_REASON_EXPLICIT_HEALTH_CHECK);
                    notifyPackageFailure(pkgList, FAILURE_REASON_EXPLICIT_HEALTH_CHECK);
                });
    }

@@ -1467,7 +1467,7 @@ public class PackageWatchdog {
         * @hide
         */
        @GuardedBy("mLock")
        public boolean onPackageFailureLocked(String packageName) {
        public boolean notifyPackageFailureLocked(String packageName) {
            if (getMonitoredPackage(packageName) == null && registeredObserver.isPersistent()
                    && registeredObserver.mayObservePackage(packageName)) {
                putMonitoredPackage(sPackageWatchdog.newMonitoredPackage(
+2 −2
Original line number Diff line number Diff line
@@ -598,7 +598,7 @@ class AppErrors {
        }

        if (r != null) {
            mPackageWatchdog.onPackageFailure(r.getPackageListWithVersionCode(),
            mPackageWatchdog.notifyPackageFailure(r.getPackageListWithVersionCode(),
                    PackageWatchdog.FAILURE_REASON_APP_CRASH);

            synchronized (mService) {
@@ -1142,7 +1142,7 @@ class AppErrors {
        }
        // Notify PackageWatchdog without the lock held
        if (packageList != null) {
            mPackageWatchdog.onPackageFailure(packageList,
            mPackageWatchdog.notifyPackageFailure(packageList,
                    PackageWatchdog.FAILURE_REASON_APP_NOT_RESPONDING);
        }
    }
+2 −1
Original line number Diff line number Diff line
@@ -93,7 +93,8 @@ public final class CrashRecoveryHelper {
                    return;
                }
                final List<VersionedPackage> pkgList = Collections.singletonList(pkg);
                PackageWatchdog.getInstance(mContext).onPackageFailure(pkgList,  PackageWatchdog.FAILURE_REASON_EXPLICIT_HEALTH_CHECK);
                PackageWatchdog.getInstance(mContext).notifyPackageFailure(pkgList,
                        PackageWatchdog.FAILURE_REASON_EXPLICIT_HEALTH_CHECK);
            });
    }

+1 −1
Original line number Diff line number Diff line
@@ -1014,7 +1014,7 @@ public class CrashRecoveryTest {
            triggerFailureCount = 1;
        }
        for (int i = 0; i < triggerFailureCount; i++) {
            watchdog.onPackageFailure(packages, failureReason);
            watchdog.notifyPackageFailure(packages, failureReason);
        }
        mTestLooper.dispatchAll();
        if (Flags.recoverabilityDetection()) {
Loading