Loading core/java/android/app/timezone/RulesState.java +0 −3 Original line number Diff line number Diff line Loading @@ -126,9 +126,6 @@ public final class RulesState implements Parcelable { mStagedOperationType == STAGED_OPERATION_INSTALL /* requireNotNull */, "stagedDistroRulesVersion", stagedDistroRulesVersion); if (operationInProgress && distroStatus != DISTRO_STATUS_UNKNOWN) { throw new IllegalArgumentException("distroInstalled != DISTRO_STATUS_UNKNOWN"); } this.mDistroStatus = validateDistroStatus(distroStatus); this.mInstalledDistroRulesVersion = validateConditionalNull( mDistroStatus == DISTRO_STATUS_INSTALLED/* requireNotNull */, Loading services/core/java/com/android/server/timezone/RulesManagerService.java +20 −21 Original line number Diff line number Diff line Loading @@ -143,6 +143,26 @@ public final class RulesManagerService extends IRulesManager.Stub { return null; } // Determine the installed distro state. This should be possible regardless of whether // there's an operation in progress. DistroVersion installedDistroVersion; int distroStatus = DISTRO_STATUS_UNKNOWN; DistroRulesVersion installedDistroRulesVersion = null; try { installedDistroVersion = mInstaller.getInstalledDistroVersion(); if (installedDistroVersion == null) { distroStatus = DISTRO_STATUS_NONE; installedDistroRulesVersion = null; } else { distroStatus = DISTRO_STATUS_INSTALLED; installedDistroRulesVersion = new DistroRulesVersion( installedDistroVersion.rulesVersion, installedDistroVersion.revision); } } catch (DistroException | IOException e) { Slog.w(TAG, "Failed to read installed distro.", e); } boolean operationInProgress = this.mOperationInProgress.get(); // Determine the staged operation status, if possible. Loading @@ -168,27 +188,6 @@ public final class RulesManagerService extends IRulesManager.Stub { Slog.w(TAG, "Failed to read staged distro.", e); } } // Determine the installed distro state, if possible. DistroVersion installedDistroVersion; int distroStatus = DISTRO_STATUS_UNKNOWN; DistroRulesVersion installedDistroRulesVersion = null; if (!operationInProgress) { try { installedDistroVersion = mInstaller.getInstalledDistroVersion(); if (installedDistroVersion == null) { distroStatus = DISTRO_STATUS_NONE; installedDistroRulesVersion = null; } else { distroStatus = DISTRO_STATUS_INSTALLED; installedDistroRulesVersion = new DistroRulesVersion( installedDistroVersion.rulesVersion, installedDistroVersion.revision); } } catch (DistroException | IOException e) { Slog.w(TAG, "Failed to read installed distro.", e); } } return new RulesState(systemRulesVersion, DISTRO_FORMAT_VERSION_SUPPORTED, operationInProgress, stagedOperationStatus, stagedDistroRulesVersion, distroStatus, installedDistroRulesVersion); Loading services/tests/servicestests/src/com/android/server/timezone/RulesManagerServiceTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -289,11 +289,13 @@ public class RulesManagerServiceTest { // Request the rules state while the async operation is "happening". RulesState actualRulesState = mRulesManagerService.getRulesState(); DistroRulesVersion expectedInstalledDistroRulesVersion = new DistroRulesVersion(installedRulesVersion, revision); RulesState expectedRuleState = new RulesState( systemRulesVersion, RulesManagerService.DISTRO_FORMAT_VERSION_SUPPORTED, true /* operationInProgress */, RulesState.STAGED_OPERATION_UNKNOWN, null /* stagedDistroRulesVersion */, RulesState.DISTRO_STATUS_UNKNOWN, null /* installedDistroRulesVersion */); RulesState.DISTRO_STATUS_INSTALLED, expectedInstalledDistroRulesVersion); assertEquals(expectedRuleState, actualRulesState); } Loading Loading
core/java/android/app/timezone/RulesState.java +0 −3 Original line number Diff line number Diff line Loading @@ -126,9 +126,6 @@ public final class RulesState implements Parcelable { mStagedOperationType == STAGED_OPERATION_INSTALL /* requireNotNull */, "stagedDistroRulesVersion", stagedDistroRulesVersion); if (operationInProgress && distroStatus != DISTRO_STATUS_UNKNOWN) { throw new IllegalArgumentException("distroInstalled != DISTRO_STATUS_UNKNOWN"); } this.mDistroStatus = validateDistroStatus(distroStatus); this.mInstalledDistroRulesVersion = validateConditionalNull( mDistroStatus == DISTRO_STATUS_INSTALLED/* requireNotNull */, Loading
services/core/java/com/android/server/timezone/RulesManagerService.java +20 −21 Original line number Diff line number Diff line Loading @@ -143,6 +143,26 @@ public final class RulesManagerService extends IRulesManager.Stub { return null; } // Determine the installed distro state. This should be possible regardless of whether // there's an operation in progress. DistroVersion installedDistroVersion; int distroStatus = DISTRO_STATUS_UNKNOWN; DistroRulesVersion installedDistroRulesVersion = null; try { installedDistroVersion = mInstaller.getInstalledDistroVersion(); if (installedDistroVersion == null) { distroStatus = DISTRO_STATUS_NONE; installedDistroRulesVersion = null; } else { distroStatus = DISTRO_STATUS_INSTALLED; installedDistroRulesVersion = new DistroRulesVersion( installedDistroVersion.rulesVersion, installedDistroVersion.revision); } } catch (DistroException | IOException e) { Slog.w(TAG, "Failed to read installed distro.", e); } boolean operationInProgress = this.mOperationInProgress.get(); // Determine the staged operation status, if possible. Loading @@ -168,27 +188,6 @@ public final class RulesManagerService extends IRulesManager.Stub { Slog.w(TAG, "Failed to read staged distro.", e); } } // Determine the installed distro state, if possible. DistroVersion installedDistroVersion; int distroStatus = DISTRO_STATUS_UNKNOWN; DistroRulesVersion installedDistroRulesVersion = null; if (!operationInProgress) { try { installedDistroVersion = mInstaller.getInstalledDistroVersion(); if (installedDistroVersion == null) { distroStatus = DISTRO_STATUS_NONE; installedDistroRulesVersion = null; } else { distroStatus = DISTRO_STATUS_INSTALLED; installedDistroRulesVersion = new DistroRulesVersion( installedDistroVersion.rulesVersion, installedDistroVersion.revision); } } catch (DistroException | IOException e) { Slog.w(TAG, "Failed to read installed distro.", e); } } return new RulesState(systemRulesVersion, DISTRO_FORMAT_VERSION_SUPPORTED, operationInProgress, stagedOperationStatus, stagedDistroRulesVersion, distroStatus, installedDistroRulesVersion); Loading
services/tests/servicestests/src/com/android/server/timezone/RulesManagerServiceTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -289,11 +289,13 @@ public class RulesManagerServiceTest { // Request the rules state while the async operation is "happening". RulesState actualRulesState = mRulesManagerService.getRulesState(); DistroRulesVersion expectedInstalledDistroRulesVersion = new DistroRulesVersion(installedRulesVersion, revision); RulesState expectedRuleState = new RulesState( systemRulesVersion, RulesManagerService.DISTRO_FORMAT_VERSION_SUPPORTED, true /* operationInProgress */, RulesState.STAGED_OPERATION_UNKNOWN, null /* stagedDistroRulesVersion */, RulesState.DISTRO_STATUS_UNKNOWN, null /* installedDistroRulesVersion */); RulesState.DISTRO_STATUS_INSTALLED, expectedInstalledDistroRulesVersion); assertEquals(expectedRuleState, actualRulesState); } Loading