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

Commit 29e27def authored by Kweku Adams's avatar Kweku Adams Committed by Android (Google) Code Review
Browse files

Merge "Avoid relocking."

parents 8e4443e4 ba22887a
Loading
Loading
Loading
Loading
+29 −27
Original line number Diff line number Diff line
@@ -1033,10 +1033,10 @@ public final class JobStore {
            }
            boolean needFileMigration = false;
            long nowElapsed = sElapsedRealtimeClock.millis();
            synchronized (mLock) {
                for (File file : files) {
                    final AtomicFile aFile = createJobFile(file);
                    try (FileInputStream fis = aFile.openRead()) {
                    synchronized (mLock) {
                        jobs = readJobMapImpl(fis, rtcGood, nowElapsed);
                        if (jobs != null) {
                            for (int i = 0; i < jobs.size(); i++) {
@@ -1054,26 +1054,27 @@ public final class JobStore {
                                }
                            }
                        }
                    }
                    } catch (FileNotFoundException e) {
                        // mJobFileDirectory.listFiles() gave us this file...why can't we find it???
                        Slog.e(TAG, "Could not find jobs file: " + file.getName());
                    } catch (XmlPullParserException | IOException e) {
                        Slog.wtf(TAG, "Error in " + file.getName(), e);
                    } catch (Exception e) {
                    // Crashing at this point would result in a boot loop, so live with a general
                    // Exception for system stability's sake.
                        // Crashing at this point would result in a boot loop, so live with a
                        // generic Exception for system stability's sake.
                        Slog.wtf(TAG, "Unexpected exception", e);
                    }
                    if (mUseSplitFiles) {
                        if (!file.getName().startsWith(JOB_FILE_SPLIT_PREFIX)) {
                        // We're supposed to be using the split file architecture, but we still have
                            // We're supposed to be using the split file architecture,
                            // but we still have
                            // the old job file around. Fully migrate and remove the old file.
                            needFileMigration = true;
                        }
                    } else if (file.getName().startsWith(JOB_FILE_SPLIT_PREFIX)) {
                    // We're supposed to be using the legacy single file architecture, but we still
                    // have some job split files around. Fully migrate and remove the split files.
                        // We're supposed to be using the legacy single file architecture,
                        // but we still have some job split files around. Fully migrate
                        // and remove the split files.
                        needFileMigration = true;
                    }
                }
@@ -1082,6 +1083,7 @@ public final class JobStore {
                    mPersistInfo.countSystemServerJobsLoaded = numSystemJobs;
                    mPersistInfo.countSystemSyncManagerJobsLoaded = numSyncJobs;
                }
            }
            Slog.i(TAG, "Read " + numJobs + " jobs");
            if (needFileMigration) {
                migrateJobFilesAsync();