Save package dex usage info after secondary dex reconciliation am: 61fd6eab46
am: ade90057c6
Change-Id: I094a69564b25f84ed36b51b9064c4bb499088802
This commit is contained in:
@@ -291,6 +291,7 @@ public class DexManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Set<String> dexFilesToRemove = new HashSet<>();
|
Set<String> dexFilesToRemove = new HashSet<>();
|
||||||
|
boolean updated = false;
|
||||||
for (Map.Entry<String, DexUseInfo> entry : useInfo.getDexUseInfoMap().entrySet()) {
|
for (Map.Entry<String, DexUseInfo> entry : useInfo.getDexUseInfoMap().entrySet()) {
|
||||||
String dexPath = entry.getKey();
|
String dexPath = entry.getKey();
|
||||||
DexUseInfo dexUseInfo = entry.getValue();
|
DexUseInfo dexUseInfo = entry.getValue();
|
||||||
@@ -311,7 +312,8 @@ public class DexManager {
|
|||||||
Slog.d(TAG, "Could not find package when compiling secondary dex " + packageName
|
Slog.d(TAG, "Could not find package when compiling secondary dex " + packageName
|
||||||
+ " for user " + dexUseInfo.getOwnerUserId());
|
+ " for user " + dexUseInfo.getOwnerUserId());
|
||||||
// Update the usage and continue, another user might still have the package.
|
// Update the usage and continue, another user might still have the package.
|
||||||
mPackageDexUsage.removeUserPackage(packageName, dexUseInfo.getOwnerUserId());
|
updated = mPackageDexUsage.removeUserPackage(
|
||||||
|
packageName, dexUseInfo.getOwnerUserId()) || updated;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ApplicationInfo info = pkg.applicationInfo;
|
ApplicationInfo info = pkg.applicationInfo;
|
||||||
@@ -322,7 +324,8 @@ public class DexManager {
|
|||||||
flags |= StorageManager.FLAG_STORAGE_CE;
|
flags |= StorageManager.FLAG_STORAGE_CE;
|
||||||
} else {
|
} else {
|
||||||
Slog.e(TAG, "Could not infer CE/DE storage for package " + info.packageName);
|
Slog.e(TAG, "Could not infer CE/DE storage for package " + info.packageName);
|
||||||
mPackageDexUsage.removeUserPackage(packageName, dexUseInfo.getOwnerUserId());
|
updated = mPackageDexUsage.removeUserPackage(
|
||||||
|
packageName, dexUseInfo.getOwnerUserId()) || updated;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,8 +341,13 @@ public class DexManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!dexStillExists) {
|
if (!dexStillExists) {
|
||||||
mPackageDexUsage.removeDexFile(packageName, dexPath, dexUseInfo.getOwnerUserId());
|
updated = mPackageDexUsage.removeDexFile(
|
||||||
|
packageName, dexPath, dexUseInfo.getOwnerUserId()) || updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (updated) {
|
||||||
|
mPackageDexUsage.maybeWriteAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -378,6 +378,8 @@ public class PackageDexUsage extends AbstractStatsBase<Void> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all the records about package {@code packageName} belonging to user {@code userId}.
|
* Remove all the records about package {@code packageName} belonging to user {@code userId}.
|
||||||
|
* @return true if the record was found and actually deleted,
|
||||||
|
* false if the record doesn't exist
|
||||||
*/
|
*/
|
||||||
public boolean removeUserPackage(String packageName, int userId) {
|
public boolean removeUserPackage(String packageName, int userId) {
|
||||||
synchronized (mPackageUseInfoMap) {
|
synchronized (mPackageUseInfoMap) {
|
||||||
@@ -402,6 +404,8 @@ public class PackageDexUsage extends AbstractStatsBase<Void> {
|
|||||||
/**
|
/**
|
||||||
* Remove the secondary dex file record belonging to the package {@code packageName}
|
* Remove the secondary dex file record belonging to the package {@code packageName}
|
||||||
* and user {@code userId}.
|
* and user {@code userId}.
|
||||||
|
* @return true if the record was found and actually deleted,
|
||||||
|
* false if the record doesn't exist
|
||||||
*/
|
*/
|
||||||
public boolean removeDexFile(String packageName, String dexFile, int userId) {
|
public boolean removeDexFile(String packageName, String dexFile, int userId) {
|
||||||
synchronized (mPackageUseInfoMap) {
|
synchronized (mPackageUseInfoMap) {
|
||||||
|
|||||||
Reference in New Issue
Block a user