Merge "If PackageUsage information is missing, treat as first boot and compile everything"
This commit is contained in:
@@ -603,6 +603,12 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
private final AtomicLong mLastWritten = new AtomicLong(0);
|
private final AtomicLong mLastWritten = new AtomicLong(0);
|
||||||
private final AtomicBoolean mBackgroundWriteRunning = new AtomicBoolean(false);
|
private final AtomicBoolean mBackgroundWriteRunning = new AtomicBoolean(false);
|
||||||
|
|
||||||
|
private boolean mIsFirstBoot = false;
|
||||||
|
|
||||||
|
boolean isFirstBoot() {
|
||||||
|
return mIsFirstBoot;
|
||||||
|
}
|
||||||
|
|
||||||
void write(boolean force) {
|
void write(boolean force) {
|
||||||
if (force) {
|
if (force) {
|
||||||
write();
|
write();
|
||||||
@@ -691,6 +697,7 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
pkg.mLastPackageUsageTimeInMills = timeInMillis;
|
pkg.mLastPackageUsageTimeInMills = timeInMillis;
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException expected) {
|
} catch (FileNotFoundException expected) {
|
||||||
|
mIsFirstBoot = true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG, "Failed to read package usage times", e);
|
Log.w(TAG, "Failed to read package usage times", e);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -1691,7 +1698,7 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFirstBoot() {
|
public boolean isFirstBoot() {
|
||||||
return !mRestoredSettings;
|
return !mRestoredSettings || mPackageUsage.isFirstBoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user