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

Commit 313d4a35 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7302914 from 73f0dfd4 to sc-v2-release

Change-Id: I4ca6ad490f31eb10d11ff1685cc7b47ecaa7e9b1
parents 45ef5f4b 73f0dfd4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -274,7 +274,7 @@ void CrasherTest::AssertDeath(int signo) {
  }

  if (signo == 0) {
    ASSERT_TRUE(WIFEXITED(status));
    ASSERT_TRUE(WIFEXITED(status)) << "Terminated due to unexpected signal " << WTERMSIG(status);
    ASSERT_EQ(0, WEXITSTATUS(signo));
  } else {
    ASSERT_FALSE(WIFEXITED(status));
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ tgkill: 1
rt_sigprocmask: 1
rt_sigaction: 1
rt_tgsigqueueinfo: 1
prctl: arg0 == PR_GET_NO_NEW_PRIVS || arg0 == 0x53564d41
prctl: arg0 == PR_GET_NO_NEW_PRIVS || arg0 == 0x53564d41 || arg0 == PR_PAC_RESET_KEYS
madvise: 1
mprotect: arg2 in 0x1|0x2
munmap: 1
+5 −0
Original line number Diff line number Diff line
@@ -34,7 +34,12 @@ rt_sigaction: 1
rt_tgsigqueueinfo: 1

#define PR_SET_VMA 0x53564d41
#if defined(__aarch64__)
// PR_PAC_RESET_KEYS happens on aarch64 in pthread_create path.
prctl: arg0 == PR_GET_NO_NEW_PRIVS || arg0 == PR_SET_VMA || arg0 == PR_PAC_RESET_KEYS
#else
prctl: arg0 == PR_GET_NO_NEW_PRIVS || arg0 == PR_SET_VMA
#endif

#if 0
libminijail on vendor partitions older than P does not have constants from <sys/mman.h>.
+25 −1
Original line number Diff line number Diff line
@@ -139,7 +139,28 @@ enum UpdateState {
    Cancelled = 7;
};

// Next: 7
// Next 14:
//
// To understand the source of each failure, read snapshot.cpp. To handle new
// sources of failure, avoid reusing an existing code; add a new code instead.
enum MergeFailureCode {
    Ok = 0;
    ReadStatus = 1;
    GetTableInfo = 2;
    UnknownTable = 3;
    GetTableParams = 4;
    ActivateNewTable = 5;
    AcquireLock = 6;
    ListSnapshots = 7;
    WriteStatus = 8;
    UnknownTargetType = 9;
    QuerySnapshotStatus = 10;
    ExpectedMergeTarget = 11;
    UnmergedSectorsAfterCompletion = 12;
    UnexpectedMergeState = 13;
};

// Next: 8
message SnapshotUpdateStatus {
    UpdateState state = 1;

@@ -160,6 +181,9 @@ message SnapshotUpdateStatus {

    // Merge phase (if state == MERGING).
    MergePhase merge_phase = 6;

    // Merge failure code, filled if state == MergeFailed.
    MergeFailureCode merge_failure_code = 7;
}

// Next: 9
+18 −8
Original line number Diff line number Diff line
@@ -381,6 +381,7 @@ class SnapshotManager final : public ISnapshotManager {
    FRIEND_TEST(SnapshotTest, MapPartialSnapshot);
    FRIEND_TEST(SnapshotTest, MapSnapshot);
    FRIEND_TEST(SnapshotTest, Merge);
    FRIEND_TEST(SnapshotTest, MergeFailureCode);
    FRIEND_TEST(SnapshotTest, NoMergeBeforeReboot);
    FRIEND_TEST(SnapshotTest, UpdateBootControlHal);
    FRIEND_TEST(SnapshotUpdateTest, DaemonTransition);
@@ -532,7 +533,8 @@ class SnapshotManager final : public ISnapshotManager {
    // Interact with /metadata/ota/state.
    UpdateState ReadUpdateState(LockedFile* file);
    SnapshotUpdateStatus ReadSnapshotUpdateStatus(LockedFile* file);
    bool WriteUpdateState(LockedFile* file, UpdateState state);
    bool WriteUpdateState(LockedFile* file, UpdateState state,
                          MergeFailureCode failure_code = MergeFailureCode::Ok);
    bool WriteSnapshotUpdateStatus(LockedFile* file, const SnapshotUpdateStatus& status);
    std::string GetStateFilePath() const;

@@ -541,12 +543,12 @@ class SnapshotManager final : public ISnapshotManager {
    std::string GetMergeStateFilePath() const;

    // Helpers for merging.
    bool MergeSecondPhaseSnapshots(LockedFile* lock);
    bool SwitchSnapshotToMerge(LockedFile* lock, const std::string& name);
    bool RewriteSnapshotDeviceTable(const std::string& dm_name);
    MergeFailureCode MergeSecondPhaseSnapshots(LockedFile* lock);
    MergeFailureCode SwitchSnapshotToMerge(LockedFile* lock, const std::string& name);
    MergeFailureCode RewriteSnapshotDeviceTable(const std::string& dm_name);
    bool MarkSnapshotMergeCompleted(LockedFile* snapshot_lock, const std::string& snapshot_name);
    void AcknowledgeMergeSuccess(LockedFile* lock);
    void AcknowledgeMergeFailure();
    void AcknowledgeMergeFailure(MergeFailureCode failure_code);
    MergePhase DecideMergePhase(const SnapshotStatus& status);
    std::unique_ptr<LpMetadata> ReadCurrentMetadata();

@@ -573,14 +575,22 @@ class SnapshotManager final : public ISnapshotManager {
                                 const SnapshotStatus& status);
    bool CollapseSnapshotDevice(const std::string& name, const SnapshotStatus& status);

    struct MergeResult {
        explicit MergeResult(UpdateState state,
                             MergeFailureCode failure_code = MergeFailureCode::Ok)
            : state(state), failure_code(failure_code) {}
        UpdateState state;
        MergeFailureCode failure_code;
    };

    // Only the following UpdateStates are used here:
    //   UpdateState::Merging
    //   UpdateState::MergeCompleted
    //   UpdateState::MergeFailed
    //   UpdateState::MergeNeedsReboot
    UpdateState CheckMergeState(const std::function<bool()>& before_cancel);
    UpdateState CheckMergeState(LockedFile* lock, const std::function<bool()>& before_cancel);
    UpdateState CheckTargetMergeState(LockedFile* lock, const std::string& name,
    MergeResult CheckMergeState(const std::function<bool()>& before_cancel);
    MergeResult CheckMergeState(LockedFile* lock, const std::function<bool()>& before_cancel);
    MergeResult CheckTargetMergeState(LockedFile* lock, const std::string& name,
                                      const SnapshotUpdateStatus& update_status);

    // Interact with status files under /metadata/ota/snapshots.
Loading