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

Commit 4da143ca authored by Veena Arvind's avatar Veena Arvind
Browse files

Don't report metric for no escrow data

Since the RoR flow is called for every reboot, this metric captures when
RoR is not attempted which is an ineffective metric.

Bug: 362363906
Test: atest CtsResumeOnRebootHostTestCases \
FrameworksServicesTests: RebootEscrowDataTest \
FrameworksServicesTests: LockSettingsServiceTests \
FrameworksServicesTests: RecoverySystemServiceTest \
FrameworksServicesTests: RebootEscrowManagerTests \
FrameworksServicesTests: RebootEscrowProviderServerBasedImplTests
Change-Id: Ia701790e5768510791de2b3b78eb8063bca84046
parent 03c977c2
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