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

Commit 14071194 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Don't report metric for no escrow data" into main

parents 4762c3de 4da143ca
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -142,7 +142,6 @@ class RebootEscrowManager {
            ERROR_KEYSTORE_FAILURE,
            ERROR_NO_NETWORK,
            ERROR_TIMEOUT_EXHAUSTED,
            ERROR_NO_REBOOT_ESCROW_DATA,
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface RebootEscrowErrorCode {
@@ -158,7 +157,6 @@ class RebootEscrowManager {
    static final int ERROR_KEYSTORE_FAILURE = 7;
    static final int ERROR_NO_NETWORK = 8;
    static final int ERROR_TIMEOUT_EXHAUSTED = 9;
    static final int ERROR_NO_REBOOT_ESCROW_DATA = 10;

    private @RebootEscrowErrorCode int mLoadEscrowDataErrorCode = ERROR_NONE;

@@ -507,9 +505,6 @@ class RebootEscrowManager {
        if (rebootEscrowUsers.isEmpty()) {
            Slog.i(TAG, "No reboot escrow data found for users,"
                    + " skipping loading escrow data");
            setLoadEscrowDataErrorCode(ERROR_NO_REBOOT_ESCROW_DATA, retryHandler);
            reportMetricOnRestoreComplete(
                    /* success= */ false, /* attemptCount= */ 1, retryHandler);
            clearMetricsStorage();
            return;
        }
+1 −16
Original line number Diff line number Diff line
@@ -625,25 +625,10 @@ public class RebootEscrowManagerTests {

        // pretend reboot happens here
        when(mInjected.getBootCount()).thenReturn(1);
        ArgumentCaptor<Boolean> metricsSuccessCaptor = ArgumentCaptor.forClass(Boolean.class);
        ArgumentCaptor<Integer> metricsErrorCodeCaptor = ArgumentCaptor.forClass(Integer.class);
        doNothing()
                .when(mInjected)
                .reportMetric(
                        metricsSuccessCaptor.capture(),
                        metricsErrorCodeCaptor.capture(),
                        eq(2) /* Server based */,
                        eq(1) /* attempt count */,
                        anyInt(),
                        eq(0) /* vbmeta status */,
                        anyInt());

        mService.loadRebootEscrowDataIfAvailable(null);
        verify(mServiceConnection, never()).unwrap(any(), anyLong());
        verify(mCallbacks, never()).onRebootEscrowRestored(anyByte(), any(), anyInt());
        assertFalse(metricsSuccessCaptor.getValue());
        assertEquals(
                Integer.valueOf(RebootEscrowManager.ERROR_NO_REBOOT_ESCROW_DATA),
                metricsErrorCodeCaptor.getValue());
    }

    @Test