Skip to content

Commit

Permalink
Merge "If PackageUsage information is missing, treat as first boot an…
Browse files Browse the repository at this point in the history
…d compile everything"
  • Loading branch information
bdcgoogle authored and Gerrit Code Review committed May 9, 2014
2 parents 678f7ed + 7c5c864 commit b98ca5b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,12 @@ private class PackageUsage {
private final AtomicLong mLastWritten = new AtomicLong(0);
private final AtomicBoolean mBackgroundWriteRunning = new AtomicBoolean(false);

private boolean mIsFirstBoot = false;

boolean isFirstBoot() {
return mIsFirstBoot;
}

void write(boolean force) {
if (force) {
write();
Expand Down Expand Up @@ -691,6 +697,7 @@ void readLP() {
pkg.mLastPackageUsageTimeInMills = timeInMillis;
}
} catch (FileNotFoundException expected) {
mIsFirstBoot = true;
} catch (IOException e) {
Log.w(TAG, "Failed to read package usage times", e);
} finally {
Expand Down Expand Up @@ -1691,7 +1698,7 @@ private static void pruneDexFiles(File cacheDir) {

@Override
public boolean isFirstBoot() {
return !mRestoredSettings;
return !mRestoredSettings || mPackageUsage.isFirstBoot();
}

@Override
Expand Down

0 comments on commit b98ca5b

Please sign in to comment.