diff options
6 files changed, 21 insertions, 128 deletions
diff --git a/services/core/Android.bp b/services/core/Android.bp index decac40d20f8..cf85dd957b3f 100644 --- a/services/core/Android.bp +++ b/services/core/Android.bp @@ -258,7 +258,6 @@ java_library_static { "dreams_flags_lib", "aconfig_new_storage_flags_lib", "powerstats_flags_lib", - "locksettings_flags_lib", "MmdProperties", "mmd_flags_lib", "profiling_flags_lib", diff --git a/services/core/java/com/android/server/locksettings/Android.bp b/services/core/java/com/android/server/locksettings/Android.bp deleted file mode 100644 index 53f1ac668e49..000000000000 --- a/services/core/java/com/android/server/locksettings/Android.bp +++ /dev/null @@ -1,11 +0,0 @@ -aconfig_declarations { - name: "locksettings_flags", - package: "com.android.server.locksettings", - container: "system", - srcs: ["*.aconfig"], -} - -java_aconfig_library { - name: "locksettings_flags_lib", - aconfig_declarations: "locksettings_flags", -} diff --git a/services/core/java/com/android/server/locksettings/RebootEscrowManager.java b/services/core/java/com/android/server/locksettings/RebootEscrowManager.java index 820c0efcc1cf..4b704d01c3b9 100644 --- a/services/core/java/com/android/server/locksettings/RebootEscrowManager.java +++ b/services/core/java/com/android/server/locksettings/RebootEscrowManager.java @@ -428,15 +428,11 @@ class RebootEscrowManager { /** Wrapper function to set error code serialized through handler, */ private void setLoadEscrowDataErrorCode(@RebootEscrowErrorCode int value, Handler handler) { - if (Flags.waitForInternetRor()) { - mInjector.post( - handler, - () -> { - mLoadEscrowDataErrorCode = value; - }); - } else { - mLoadEscrowDataErrorCode = value; - } + mInjector.post( + handler, + () -> { + mLoadEscrowDataErrorCode = value; + }); } /** Wrapper function to compare and set error code serialized through handler. */ @@ -511,23 +507,17 @@ class RebootEscrowManager { mWakeLock.acquire(mInjector.getWakeLockTimeoutMillis()); } - if (Flags.waitForInternetRor()) { - // Timeout to stop retrying same as the wake lock timeout. - mInjector.postDelayed( - retryHandler, - () -> { - mRebootEscrowTimedOut = true; - }, - mInjector.getLoadEscrowTimeoutMillis()); - - mInjector.post( - retryHandler, - () -> loadRebootEscrowDataOnInternet(retryHandler, users, rebootEscrowUsers)); - return; - } + // Timeout to stop retrying same as the wake lock timeout. + mInjector.postDelayed( + retryHandler, + () -> { + mRebootEscrowTimedOut = true; + }, + mInjector.getLoadEscrowTimeoutMillis()); - mInjector.post(retryHandler, () -> loadRebootEscrowDataWithRetry( - retryHandler, 0, users, rebootEscrowUsers)); + mInjector.post( + retryHandler, + () -> loadRebootEscrowDataOnInternet(retryHandler, users, rebootEscrowUsers)); } void scheduleLoadRebootEscrowDataOrFail( @@ -548,27 +538,13 @@ class RebootEscrowManager { return; } - if (Flags.waitForInternetRor()) { - if (mRebootEscrowTimedOut) { - Slog.w(TAG, "Failed to load reboot escrow data within timeout"); - compareAndSetLoadEscrowDataErrorCode( - ERROR_NONE, ERROR_TIMEOUT_EXHAUSTED, retryHandler); - } else { - Slog.w( - TAG, - "Failed to load reboot escrow data after " + attemptNumber + " attempts"); - compareAndSetLoadEscrowDataErrorCode( - ERROR_NONE, ERROR_RETRY_COUNT_EXHAUSTED, retryHandler); - } - onGetRebootEscrowKeyFailed(users, attemptNumber, retryHandler); - return; - } - - Slog.w(TAG, "Failed to load reboot escrow data after " + attemptNumber + " attempts"); - if (mInjector.serverBasedResumeOnReboot() && !mInjector.isNetworkConnected()) { - mLoadEscrowDataErrorCode = ERROR_NO_NETWORK; + if (mRebootEscrowTimedOut) { + Slog.w(TAG, "Failed to load reboot escrow data within timeout"); + compareAndSetLoadEscrowDataErrorCode(ERROR_NONE, ERROR_TIMEOUT_EXHAUSTED, retryHandler); } else { - mLoadEscrowDataErrorCode = ERROR_RETRY_COUNT_EXHAUSTED; + Slog.w(TAG, "Failed to load reboot escrow data after " + attemptNumber + " attempts"); + compareAndSetLoadEscrowDataErrorCode( + ERROR_NONE, ERROR_RETRY_COUNT_EXHAUSTED, retryHandler); } onGetRebootEscrowKeyFailed(users, attemptNumber, retryHandler); } diff --git a/services/core/java/com/android/server/locksettings/flags.aconfig b/services/core/java/com/android/server/locksettings/flags.aconfig deleted file mode 100644 index 6818de91c98e..000000000000 --- a/services/core/java/com/android/server/locksettings/flags.aconfig +++ /dev/null @@ -1,9 +0,0 @@ -package: "com.android.server.locksettings" -container: "system" - -flag { - name: "wait_for_internet_ror" - namespace: "sudo" - description: "Feature flag to wait for internet connectivity before calling resume on reboot server." - bug: "231660348" -}
\ No newline at end of file diff --git a/services/tests/servicestests/Android.bp b/services/tests/servicestests/Android.bp index 067fba9893e5..64e6d323bdfd 100644 --- a/services/tests/servicestests/Android.bp +++ b/services/tests/servicestests/Android.bp @@ -93,7 +93,6 @@ android_test { "net_flags_lib", "CtsVirtualDeviceCommonLib", "com_android_server_accessibility_flags_lib", - "locksettings_flags_lib", ] + select(soong_config_variable("ANDROID", "release_crashrecovery_module"), { "true": ["service-crashrecovery-pre-jarjar"], default: [], diff --git a/services/tests/servicestests/src/com/android/server/locksettings/RebootEscrowManagerTests.java b/services/tests/servicestests/src/com/android/server/locksettings/RebootEscrowManagerTests.java index ae781dcb834a..52c7c48cc8b7 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/RebootEscrowManagerTests.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/RebootEscrowManagerTests.java @@ -60,10 +60,6 @@ import android.os.RemoteException; import android.os.ServiceSpecificException; import android.os.UserManager; import android.platform.test.annotations.Presubmit; -import android.platform.test.annotations.RequiresFlagsDisabled; -import android.platform.test.annotations.RequiresFlagsEnabled; -import android.platform.test.flag.junit.CheckFlagsRule; -import android.platform.test.flag.junit.DeviceFlagsValueProvider; import androidx.test.InstrumentationRegistry; import androidx.test.filters.SmallTest; @@ -74,7 +70,6 @@ import com.android.server.locksettings.ResumeOnRebootServiceProvider.ResumeOnReb import com.android.server.pm.UserManagerInternal; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; @@ -113,9 +108,6 @@ public class RebootEscrowManagerTests { 0x26, 0x52, 0x72, 0x63, 0x63, 0x61, 0x78, 0x23, }; - @Rule - public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); - private Context mContext; private UserManager mUserManager; private UserManagerInternal mUserManagerInternal; @@ -847,53 +839,6 @@ public class RebootEscrowManagerTests { } @Test - @RequiresFlagsDisabled(Flags.FLAG_WAIT_FOR_INTERNET_ROR) - public void loadRebootEscrowDataIfAvailable_ServerBasedIoError_RetryFailure() throws Exception { - setServerBasedRebootEscrowProvider(); - - when(mInjected.getBootCount()).thenReturn(0); - RebootEscrowListener mockListener = mock(RebootEscrowListener.class); - mService.setRebootEscrowListener(mockListener); - mService.prepareRebootEscrow(); - - clearInvocations(mServiceConnection); - callToRebootEscrowIfNeededAndWait(PRIMARY_USER_ID); - verify(mockListener).onPreparedForReboot(eq(true)); - verify(mServiceConnection, never()).wrapBlob(any(), anyLong(), anyLong()); - - // Use x -> x for both wrap & unwrap functions. - when(mServiceConnection.wrapBlob(any(), anyLong(), anyLong())) - .thenAnswer(invocation -> invocation.getArgument(0)); - assertEquals(ARM_REBOOT_ERROR_NONE, mService.armRebootEscrowIfNeeded()); - verify(mServiceConnection).wrapBlob(any(), anyLong(), anyLong()); - assertTrue(mStorage.hasRebootEscrowServerBlob()); - - // 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(2) /* attempt count */, - anyInt(), - eq(0) /* vbmeta status */, - anyInt()); - when(mServiceConnection.unwrap(any(), anyLong())).thenThrow(IOException.class); - - mService.loadRebootEscrowDataIfAvailable(mHandler); - // Sleep 5s for the retry to complete - Thread.sleep(5 * 1000); - assertFalse(metricsSuccessCaptor.getValue()); - assertEquals( - Integer.valueOf(RebootEscrowManager.ERROR_NO_NETWORK), - metricsErrorCodeCaptor.getValue()); - } - - @Test public void loadRebootEscrowDataIfAvailable_ServerBased_RetrySuccess() throws Exception { setServerBasedRebootEscrowProvider(); @@ -941,7 +886,6 @@ public class RebootEscrowManagerTests { } @Test - @RequiresFlagsEnabled(Flags.FLAG_WAIT_FOR_INTERNET_ROR) public void loadRebootEscrowDataIfAvailable_waitForInternet_networkUnavailable() throws Exception { setServerBasedRebootEscrowProvider(); @@ -989,7 +933,6 @@ public class RebootEscrowManagerTests { } @Test - @RequiresFlagsEnabled(Flags.FLAG_WAIT_FOR_INTERNET_ROR) public void loadRebootEscrowDataIfAvailable_waitForInternet_networkLost() throws Exception { setServerBasedRebootEscrowProvider(); @@ -1044,7 +987,6 @@ public class RebootEscrowManagerTests { } @Test - @RequiresFlagsEnabled(Flags.FLAG_WAIT_FOR_INTERNET_ROR) public void loadRebootEscrowDataIfAvailable_waitForInternet_networkAvailableWithDelay() throws Exception { setServerBasedRebootEscrowProvider(); @@ -1103,7 +1045,6 @@ public class RebootEscrowManagerTests { } @Test - @RequiresFlagsEnabled(Flags.FLAG_WAIT_FOR_INTERNET_ROR) public void loadRebootEscrowDataIfAvailable_waitForInternet_timeoutExhausted() throws Exception { setServerBasedRebootEscrowProvider(); @@ -1163,7 +1104,6 @@ public class RebootEscrowManagerTests { } @Test - @RequiresFlagsEnabled(Flags.FLAG_WAIT_FOR_INTERNET_ROR) public void loadRebootEscrowDataIfAvailable_serverBasedWaitForNetwork_retryCountExhausted() throws Exception { setServerBasedRebootEscrowProvider(); @@ -1219,7 +1159,6 @@ public class RebootEscrowManagerTests { } @Test - @RequiresFlagsEnabled(Flags.FLAG_WAIT_FOR_INTERNET_ROR) public void loadRebootEscrowDataIfAvailable_ServerBasedWaitForInternet_RetrySuccess() throws Exception { setServerBasedRebootEscrowProvider(); |