Loading core/java/com/android/internal/widget/LockSettingsInternal.java +2 −2 Original line number Diff line number Diff line Loading @@ -110,7 +110,7 @@ public abstract class LockSettingsInternal { * #setRebootEscrowListener}, then {@link #armRebootEscrow()} should be called before * rebooting to apply the update. */ public abstract void prepareRebootEscrow(); public abstract boolean prepareRebootEscrow(); /** * Registers a listener for when the RebootEscrow HAL has stored its data needed for rebooting Loading @@ -124,7 +124,7 @@ public abstract class LockSettingsInternal { /** * Requests that any data needed for rebooting is cleared from the RebootEscrow HAL. */ public abstract void clearRebootEscrow(); public abstract boolean clearRebootEscrow(); /** * Should be called immediately before rebooting for an update. This depends on {@link Loading services/core/java/com/android/server/locksettings/LockSettingsService.java +6 −4 Original line number Diff line number Diff line Loading @@ -3467,11 +3467,12 @@ public class LockSettingsService extends ILockSettings.Stub { } @Override public void prepareRebootEscrow() { public boolean prepareRebootEscrow() { if (!mRebootEscrowManager.prepareRebootEscrow()) { return; return false; } mStrongAuth.requireStrongAuth(STRONG_AUTH_REQUIRED_FOR_UNATTENDED_UPDATE, USER_ALL); return true; } @Override Loading @@ -3480,12 +3481,13 @@ public class LockSettingsService extends ILockSettings.Stub { } @Override public void clearRebootEscrow() { public boolean clearRebootEscrow() { if (!mRebootEscrowManager.clearRebootEscrow()) { return; return false; } mStrongAuth.noLongerRequireStrongAuth(STRONG_AUTH_REQUIRED_FOR_UNATTENDED_UPDATE, USER_ALL); return true; } @Override Loading services/core/java/com/android/server/recoverysystem/RecoverySystemService.java +13 −8 Original line number Diff line number Diff line Loading @@ -554,11 +554,15 @@ public class RecoverySystemService extends IRecoverySystem.Stub implements Reboo case ROR_NEED_PREPARATION: final long origId = Binder.clearCallingIdentity(); try { mInjector.getLockSettingsService().prepareRebootEscrow(); boolean result = mInjector.getLockSettingsService().prepareRebootEscrow(); // Clear the RoR preparation state if lock settings reports an failure. if (!result) { clearRoRPreparationState(); } return result; } finally { Binder.restoreCallingIdentity(origId); } return true; default: throw new IllegalStateException("Unsupported action type on new request " + action); } Loading Loading @@ -670,11 +674,10 @@ public class RecoverySystemService extends IRecoverySystem.Stub implements Reboo case ROR_REQUESTED_NEED_CLEAR: final long origId = Binder.clearCallingIdentity(); try { mInjector.getLockSettingsService().clearRebootEscrow(); return mInjector.getLockSettingsService().clearRebootEscrow(); } finally { Binder.restoreCallingIdentity(origId); } return true; default: throw new IllegalStateException("Unsupported action type on clear " + action); } Loading Loading @@ -820,6 +823,11 @@ public class RecoverySystemService extends IRecoverySystem.Stub implements Reboo lskfCapturedCount); } private synchronized void clearRoRPreparationState() { mCallerPendingRequest.clear(); mCallerPreparedForReboot.clear(); } private void clearRoRPreparationStateOnRebootFailure(RebootPreparationError escrowError) { if (!FATAL_ARM_ESCROW_ERRORS.contains(escrowError.mProviderErrorCode)) { return; Loading @@ -827,10 +835,7 @@ public class RecoverySystemService extends IRecoverySystem.Stub implements Reboo Slog.w(TAG, "Clearing resume on reboot states for all clients on arm escrow error: " + escrowError.mProviderErrorCode); synchronized (this) { mCallerPendingRequest.clear(); mCallerPreparedForReboot.clear(); } clearRoRPreparationState(); } private @ResumeOnRebootRebootErrorCode int rebootWithLskfImpl(String packageName, String reason, Loading services/tests/servicestests/src/com/android/server/recoverysystem/RecoverySystemServiceTest.java +10 −1 Original line number Diff line number Diff line Loading @@ -95,6 +95,8 @@ public class RecoverySystemServiceTest { mUncryptUpdateFileWriter = mock(FileWriter.class); mLockSettingsInternal = mock(LockSettingsInternal.class); doReturn(true).when(mLockSettingsInternal).prepareRebootEscrow(); doReturn(true).when(mLockSettingsInternal).clearRebootEscrow(); doReturn(LockSettingsInternal.ARM_REBOOT_ERROR_NONE).when(mLockSettingsInternal) .armRebootEscrow(); Loading Loading @@ -254,7 +256,6 @@ public class RecoverySystemServiceTest { + RecoverySystemService.REQUEST_LSKF_TIMESTAMP_PREF_SUFFIX), eq(100_000L)); } @Test public void requestLskf_success() throws Exception { IntentSender intentSender = mock(IntentSender.class); Loading Loading @@ -298,6 +299,14 @@ public class RecoverySystemServiceTest { anyInt(), anyInt(), anyInt()); } @Test public void requestLskf_lockSettingsError() throws Exception { IntentSender intentSender = mock(IntentSender.class); doReturn(false).when(mLockSettingsInternal).prepareRebootEscrow(); assertFalse(mRecoverySystemService.requestLskf(FAKE_OTA_PACKAGE_NAME, intentSender)); } @Test public void isLskfCaptured_requestedButNotPrepared() throws Exception { IntentSender intentSender = mock(IntentSender.class); Loading services/tests/servicestests/src/com/android/server/recoverysystem/TEST_MAPPING 0 → 100644 +15 −0 Original line number Diff line number Diff line { "presubmit": [ { "name": "FrameworksServicesTests", "options": [ { "include-filter": "com.android.server.recoverysystem." }, { "exclude-annotation": "android.platform.test.annotations.FlakyTest" } ] } ] } No newline at end of file Loading
core/java/com/android/internal/widget/LockSettingsInternal.java +2 −2 Original line number Diff line number Diff line Loading @@ -110,7 +110,7 @@ public abstract class LockSettingsInternal { * #setRebootEscrowListener}, then {@link #armRebootEscrow()} should be called before * rebooting to apply the update. */ public abstract void prepareRebootEscrow(); public abstract boolean prepareRebootEscrow(); /** * Registers a listener for when the RebootEscrow HAL has stored its data needed for rebooting Loading @@ -124,7 +124,7 @@ public abstract class LockSettingsInternal { /** * Requests that any data needed for rebooting is cleared from the RebootEscrow HAL. */ public abstract void clearRebootEscrow(); public abstract boolean clearRebootEscrow(); /** * Should be called immediately before rebooting for an update. This depends on {@link Loading
services/core/java/com/android/server/locksettings/LockSettingsService.java +6 −4 Original line number Diff line number Diff line Loading @@ -3467,11 +3467,12 @@ public class LockSettingsService extends ILockSettings.Stub { } @Override public void prepareRebootEscrow() { public boolean prepareRebootEscrow() { if (!mRebootEscrowManager.prepareRebootEscrow()) { return; return false; } mStrongAuth.requireStrongAuth(STRONG_AUTH_REQUIRED_FOR_UNATTENDED_UPDATE, USER_ALL); return true; } @Override Loading @@ -3480,12 +3481,13 @@ public class LockSettingsService extends ILockSettings.Stub { } @Override public void clearRebootEscrow() { public boolean clearRebootEscrow() { if (!mRebootEscrowManager.clearRebootEscrow()) { return; return false; } mStrongAuth.noLongerRequireStrongAuth(STRONG_AUTH_REQUIRED_FOR_UNATTENDED_UPDATE, USER_ALL); return true; } @Override Loading
services/core/java/com/android/server/recoverysystem/RecoverySystemService.java +13 −8 Original line number Diff line number Diff line Loading @@ -554,11 +554,15 @@ public class RecoverySystemService extends IRecoverySystem.Stub implements Reboo case ROR_NEED_PREPARATION: final long origId = Binder.clearCallingIdentity(); try { mInjector.getLockSettingsService().prepareRebootEscrow(); boolean result = mInjector.getLockSettingsService().prepareRebootEscrow(); // Clear the RoR preparation state if lock settings reports an failure. if (!result) { clearRoRPreparationState(); } return result; } finally { Binder.restoreCallingIdentity(origId); } return true; default: throw new IllegalStateException("Unsupported action type on new request " + action); } Loading Loading @@ -670,11 +674,10 @@ public class RecoverySystemService extends IRecoverySystem.Stub implements Reboo case ROR_REQUESTED_NEED_CLEAR: final long origId = Binder.clearCallingIdentity(); try { mInjector.getLockSettingsService().clearRebootEscrow(); return mInjector.getLockSettingsService().clearRebootEscrow(); } finally { Binder.restoreCallingIdentity(origId); } return true; default: throw new IllegalStateException("Unsupported action type on clear " + action); } Loading Loading @@ -820,6 +823,11 @@ public class RecoverySystemService extends IRecoverySystem.Stub implements Reboo lskfCapturedCount); } private synchronized void clearRoRPreparationState() { mCallerPendingRequest.clear(); mCallerPreparedForReboot.clear(); } private void clearRoRPreparationStateOnRebootFailure(RebootPreparationError escrowError) { if (!FATAL_ARM_ESCROW_ERRORS.contains(escrowError.mProviderErrorCode)) { return; Loading @@ -827,10 +835,7 @@ public class RecoverySystemService extends IRecoverySystem.Stub implements Reboo Slog.w(TAG, "Clearing resume on reboot states for all clients on arm escrow error: " + escrowError.mProviderErrorCode); synchronized (this) { mCallerPendingRequest.clear(); mCallerPreparedForReboot.clear(); } clearRoRPreparationState(); } private @ResumeOnRebootRebootErrorCode int rebootWithLskfImpl(String packageName, String reason, Loading
services/tests/servicestests/src/com/android/server/recoverysystem/RecoverySystemServiceTest.java +10 −1 Original line number Diff line number Diff line Loading @@ -95,6 +95,8 @@ public class RecoverySystemServiceTest { mUncryptUpdateFileWriter = mock(FileWriter.class); mLockSettingsInternal = mock(LockSettingsInternal.class); doReturn(true).when(mLockSettingsInternal).prepareRebootEscrow(); doReturn(true).when(mLockSettingsInternal).clearRebootEscrow(); doReturn(LockSettingsInternal.ARM_REBOOT_ERROR_NONE).when(mLockSettingsInternal) .armRebootEscrow(); Loading Loading @@ -254,7 +256,6 @@ public class RecoverySystemServiceTest { + RecoverySystemService.REQUEST_LSKF_TIMESTAMP_PREF_SUFFIX), eq(100_000L)); } @Test public void requestLskf_success() throws Exception { IntentSender intentSender = mock(IntentSender.class); Loading Loading @@ -298,6 +299,14 @@ public class RecoverySystemServiceTest { anyInt(), anyInt(), anyInt()); } @Test public void requestLskf_lockSettingsError() throws Exception { IntentSender intentSender = mock(IntentSender.class); doReturn(false).when(mLockSettingsInternal).prepareRebootEscrow(); assertFalse(mRecoverySystemService.requestLskf(FAKE_OTA_PACKAGE_NAME, intentSender)); } @Test public void isLskfCaptured_requestedButNotPrepared() throws Exception { IntentSender intentSender = mock(IntentSender.class); Loading
services/tests/servicestests/src/com/android/server/recoverysystem/TEST_MAPPING 0 → 100644 +15 −0 Original line number Diff line number Diff line { "presubmit": [ { "name": "FrameworksServicesTests", "options": [ { "include-filter": "com.android.server.recoverysystem." }, { "exclude-annotation": "android.platform.test.annotations.FlakyTest" } ] } ] } No newline at end of file