Merge "Move dump shared libraries into the ComputerEngine" into sc-dev
This commit is contained in:
@@ -56,6 +56,7 @@ public final class DumpState {
|
||||
|
||||
private boolean mTitlePrinted;
|
||||
private boolean mFullPreferred;
|
||||
private boolean mCheckIn;
|
||||
|
||||
private String mTargetPackageName;
|
||||
|
||||
@@ -118,4 +119,12 @@ public final class DumpState {
|
||||
public void setFullPreferred(boolean fullPreferred) {
|
||||
mFullPreferred = fullPreferred;
|
||||
}
|
||||
|
||||
public boolean isCheckIn() {
|
||||
return mCheckIn;
|
||||
}
|
||||
|
||||
public void setCheckIn(boolean checkIn) {
|
||||
mCheckIn = checkIn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4403,6 +4403,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
|
||||
public void dump(int type, FileDescriptor fd, PrintWriter pw, DumpState dumpState) {
|
||||
final String packageName = dumpState.getTargetPackageName();
|
||||
final boolean checkin = dumpState.isCheckIn();
|
||||
|
||||
switch (type) {
|
||||
case DumpState.DUMP_VERSION:
|
||||
@@ -4415,6 +4416,56 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
break;
|
||||
}
|
||||
|
||||
case DumpState.DUMP_LIBS:
|
||||
{
|
||||
boolean printedHeader = false;
|
||||
final int numSharedLibraries = mSharedLibraries.size();
|
||||
for (int index = 0; index < numSharedLibraries; index++) {
|
||||
final String libName = mSharedLibraries.keyAt(index);
|
||||
final WatchedLongSparseArray<SharedLibraryInfo> versionedLib =
|
||||
mSharedLibraries.get(libName);
|
||||
if (versionedLib == null) {
|
||||
continue;
|
||||
}
|
||||
final int versionCount = versionedLib.size();
|
||||
for (int i = 0; i < versionCount; i++) {
|
||||
SharedLibraryInfo libraryInfo = versionedLib.valueAt(i);
|
||||
if (!checkin) {
|
||||
if (!printedHeader) {
|
||||
if (dumpState.onTitlePrinted()) {
|
||||
pw.println();
|
||||
}
|
||||
pw.println("Libraries:");
|
||||
printedHeader = true;
|
||||
}
|
||||
pw.print(" ");
|
||||
} else {
|
||||
pw.print("lib,");
|
||||
}
|
||||
pw.print(libraryInfo.getName());
|
||||
if (libraryInfo.isStatic()) {
|
||||
pw.print(" version=" + libraryInfo.getLongVersion());
|
||||
}
|
||||
if (!checkin) {
|
||||
pw.print(" -> ");
|
||||
}
|
||||
if (libraryInfo.getPath() != null) {
|
||||
if (libraryInfo.isNative()) {
|
||||
pw.print(" (so) ");
|
||||
} else {
|
||||
pw.print(" (jar) ");
|
||||
}
|
||||
pw.print(libraryInfo.getPath());
|
||||
} else {
|
||||
pw.print(" (apk) ");
|
||||
pw.print(libraryInfo.getPackageName());
|
||||
}
|
||||
pw.println();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DumpState.DUMP_PREFERRED_XML:
|
||||
{
|
||||
pw.flush();
|
||||
@@ -23704,8 +23755,6 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
if (!DumpUtils.checkDumpAndUsageStatsPermission(mContext, TAG, pw)) return;
|
||||
|
||||
DumpState dumpState = new DumpState();
|
||||
boolean checkin = false;
|
||||
|
||||
ArraySet<String> permissionNames = null;
|
||||
|
||||
int opti = 0;
|
||||
@@ -23755,7 +23804,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
pw.println(" <package.name>: info about given package");
|
||||
return;
|
||||
} else if ("--checkin".equals(opt)) {
|
||||
checkin = true;
|
||||
dumpState.setCheckIn(true);
|
||||
} else if ("--all-components".equals(opt)) {
|
||||
dumpState.setOptionEnabled(DumpState.OPTION_DUMP_ALL_COMPONENTS);
|
||||
} else if ("-f".equals(opt)) {
|
||||
@@ -23909,6 +23958,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
}
|
||||
|
||||
final String packageName = dumpState.getTargetPackageName();
|
||||
final boolean checkin = dumpState.isCheckIn();
|
||||
if (checkin) {
|
||||
pw.println("vers,1");
|
||||
}
|
||||
@@ -23997,11 +24047,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
}
|
||||
|
||||
if (dumpState.isDumping(DumpState.DUMP_LIBS) && packageName == null) {
|
||||
// TODO: Move it to ComputerEngine once LongSparseArray<SharedLibraryInfo> is copied
|
||||
// in snapshot.
|
||||
synchronized (mLock) {
|
||||
dumpSharedLibrariesLPr(pw, dumpState, checkin);
|
||||
}
|
||||
dump(DumpState.DUMP_LIBS, fd, pw, dumpState);
|
||||
}
|
||||
|
||||
if (dumpState.isDumping(DumpState.DUMP_FEATURES) && packageName == null) {
|
||||
@@ -24342,53 +24388,6 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
private void dumpSharedLibrariesLPr(PrintWriter pw, DumpState dumpState, boolean checkin) {
|
||||
boolean printedHeader = false;
|
||||
final int numSharedLibraries = mSharedLibraries.size();
|
||||
for (int index = 0; index < numSharedLibraries; index++) {
|
||||
final String libName = mSharedLibraries.keyAt(index);
|
||||
WatchedLongSparseArray<SharedLibraryInfo> versionedLib = mSharedLibraries.get(libName);
|
||||
if (versionedLib == null) {
|
||||
continue;
|
||||
}
|
||||
final int versionCount = versionedLib.size();
|
||||
for (int i = 0; i < versionCount; i++) {
|
||||
SharedLibraryInfo libraryInfo = versionedLib.valueAt(i);
|
||||
if (!checkin) {
|
||||
if (!printedHeader) {
|
||||
if (dumpState.onTitlePrinted()) {
|
||||
pw.println();
|
||||
}
|
||||
pw.println("Libraries:");
|
||||
printedHeader = true;
|
||||
}
|
||||
pw.print(" ");
|
||||
} else {
|
||||
pw.print("lib,");
|
||||
}
|
||||
pw.print(libraryInfo.getName());
|
||||
if (libraryInfo.isStatic()) {
|
||||
pw.print(" version=" + libraryInfo.getLongVersion());
|
||||
}
|
||||
if (!checkin) {
|
||||
pw.print(" -> ");
|
||||
}
|
||||
if (libraryInfo.getPath() != null) {
|
||||
if (libraryInfo.isNative()) {
|
||||
pw.print(" (so) ");
|
||||
} else {
|
||||
pw.print(" (jar) ");
|
||||
}
|
||||
pw.print(libraryInfo.getPath());
|
||||
} else {
|
||||
pw.print(" (apk) ");
|
||||
pw.print(libraryInfo.getPackageName());
|
||||
}
|
||||
pw.println();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------- apps on sdcard specific code -------
|
||||
static final boolean DEBUG_SD_INSTALL = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user