Add a flag to dumpProfiles to send --dump-classes-and-methods to profman.
Test: adb root
adb shell kill -SIGUSR1 '$(pidof com.android.systemui)' && \
sleep 1 && \
adb shell pm compile -m speed-profile com.android.systemui
adb unroot
adb shell pm dump-profiles --dump-classes-and-methods \
com.android.systemui && \
adb pull data/misc/profman/com.android.systemui-primary.prof.txt
Check that the output is the same as:
adb root && adb shell profman --dump-classes-and-methods \
--reference-profile-file=data/misc/profiles/ref/com.android.systemui/primary.prof \
--profile-file=data/misc/profiles/cur/0/com.android.systemui/primary.prof \
--apk=system_ext/priv-app/SystemUI/SystemUI.apk
Test: adb shell pm dump-profiles \
com.android.systemui && \
adb pull data/misc/profman/com.android.systemui-primary.prof.txt
Check that the output is in the usual `profman --dump-only` format
Bug: 198506529
Ignore-AOSP-First: Goes together with a change in PackageManager which
is developed in internal.
Change-Id: I84ba3e3ee6c4077500d7cd5e077ac6a3bfeff265
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index 397d432..b4aa88e 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -2976,13 +2976,15 @@
// Dumps the contents of a profile file, using pkgname's dex files for pretty
// printing the result.
binder::Status InstalldNativeService::dumpProfiles(int32_t uid, const std::string& packageName,
- const std::string& profileName, const std::string& codePath, bool* _aidl_return) {
+ const std::string& profileName,
+ const std::string& codePath,
+ bool dumpClassesAndMethods, bool* _aidl_return) {
ENFORCE_UID(AID_SYSTEM);
CHECK_ARGUMENT_PACKAGE_NAME(packageName);
CHECK_ARGUMENT_PATH(codePath);
LOCK_PACKAGE();
- *_aidl_return = dump_profiles(uid, packageName, profileName, codePath);
+ *_aidl_return = dump_profiles(uid, packageName, profileName, codePath, dumpClassesAndMethods);
return ok();
}
diff --git a/cmds/installd/InstalldNativeService.h b/cmds/installd/InstalldNativeService.h
index 0432222..521afc3 100644
--- a/cmds/installd/InstalldNativeService.h
+++ b/cmds/installd/InstalldNativeService.h
@@ -134,7 +134,8 @@
binder::Status mergeProfiles(int32_t uid, const std::string& packageName,
const std::string& profileName, int* _aidl_return);
binder::Status dumpProfiles(int32_t uid, const std::string& packageName,
- const std::string& profileName, const std::string& codePath, bool* _aidl_return);
+ const std::string& profileName, const std::string& codePath,
+ bool dumpClassesAndMethods, bool* _aidl_return);
binder::Status copySystemProfile(const std::string& systemProfile,
int32_t uid, const std::string& packageName, const std::string& profileName,
bool* _aidl_return);
diff --git a/cmds/installd/binder/android/os/IInstalld.aidl b/cmds/installd/binder/android/os/IInstalld.aidl
index db03411..9ad853b 100644
--- a/cmds/installd/binder/android/os/IInstalld.aidl
+++ b/cmds/installd/binder/android/os/IInstalld.aidl
@@ -77,7 +77,7 @@
int mergeProfiles(int uid, @utf8InCpp String packageName, @utf8InCpp String profileName);
boolean dumpProfiles(int uid, @utf8InCpp String packageName, @utf8InCpp String profileName,
- @utf8InCpp String codePath);
+ @utf8InCpp String codePath, boolean dumpClassesAndMethods);
boolean copySystemProfile(@utf8InCpp String systemProfile, int uid,
@utf8InCpp String packageName, @utf8InCpp String profileName);
void clearAppProfiles(@utf8InCpp String packageName, @utf8InCpp String profileName);
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index 894c7d3..ebb7891 100644
--- a/cmds/installd/dexopt.cpp
+++ b/cmds/installd/dexopt.cpp
@@ -624,12 +624,15 @@
/*for_boot_image*/false);
}
- void SetupDump(const std::vector<unique_fd>& profiles_fd,
- const unique_fd& reference_profile_fd,
+ void SetupDump(const std::vector<unique_fd>& profiles_fd, const unique_fd& reference_profile_fd,
const std::vector<std::string>& dex_locations,
- const std::vector<unique_fd>& apk_fds,
+ const std::vector<unique_fd>& apk_fds, bool dump_classes_and_methods,
const unique_fd& output_fd) {
- AddArg("--dump-only");
+ if (dump_classes_and_methods) {
+ AddArg("--dump-classes-and-methods");
+ } else {
+ AddArg("--dump-only");
+ }
AddArg(StringPrintf("--dump-output-to-fd=%d", output_fd.get()));
SetupArgs(profiles_fd,
reference_profile_fd,
@@ -772,7 +775,7 @@
}
bool dump_profiles(int32_t uid, const std::string& pkgname, const std::string& profile_name,
- const std::string& code_path) {
+ const std::string& code_path, bool dump_classes_and_methods) {
std::vector<unique_fd> profile_fds;
unique_fd reference_profile_fd;
std::string out_file_name = StringPrintf("/data/misc/profman/%s-%s.txt",
@@ -808,7 +811,8 @@
RunProfman profman_dump;
- profman_dump.SetupDump(profile_fds, reference_profile_fd, dex_locations, apk_fds, output_fd);
+ profman_dump.SetupDump(profile_fds, reference_profile_fd, dex_locations, apk_fds,
+ dump_classes_and_methods, output_fd);
pid_t pid = fork();
if (pid == 0) {
/* child -- drop privileges before continuing */
diff --git a/cmds/installd/dexopt.h b/cmds/installd/dexopt.h
index f7af929..5cf402c 100644
--- a/cmds/installd/dexopt.h
+++ b/cmds/installd/dexopt.h
@@ -88,10 +88,8 @@
const std::string& profile_name,
const std::string& classpath);
-bool dump_profiles(int32_t uid,
- const std::string& pkgname,
- const std::string& profile_name,
- const std::string& code_path);
+bool dump_profiles(int32_t uid, const std::string& pkgname, const std::string& profile_name,
+ const std::string& code_path, bool dump_classes_and_methods);
bool copy_system_profile(const std::string& system_profile,
uid_t packageUid,