Rename snapshotProfile to createProfileSnapshot for better consistency
Test: installd_dexopt_test
Bug: 30934496
(cherry picked from commit c41dac27c540971d8877911d6a3908af2046c9eb)
Change-Id: I5ef302ef714d47150790e3a97a9d0c0bbf36adc3
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index 04e39f9..6877fb7 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -1863,13 +1863,13 @@
return ok();
}
-binder::Status InstalldNativeService::snapshotProfile(int32_t appId, const std::string& packageName,
- const std::string& codePath, bool* _aidl_return) {
+binder::Status InstalldNativeService::createProfileSnapshot(int32_t appId,
+ const std::string& packageName, const std::string& codePath, bool* _aidl_return) {
ENFORCE_UID(AID_SYSTEM);
CHECK_ARGUMENT_PACKAGE_NAME(packageName);
std::lock_guard<std::recursive_mutex> lock(mLock);
- *_aidl_return = snapshot_profile(appId, packageName, codePath);
+ *_aidl_return = create_profile_snapshot(appId, packageName, codePath);
return ok();
}
diff --git a/cmds/installd/InstalldNativeService.h b/cmds/installd/InstalldNativeService.h
index f205efc..2d22934 100644
--- a/cmds/installd/InstalldNativeService.h
+++ b/cmds/installd/InstalldNativeService.h
@@ -96,7 +96,7 @@
binder::Status clearAppProfiles(const std::string& packageName);
binder::Status destroyAppProfiles(const std::string& packageName);
- binder::Status snapshotProfile(int32_t appId, const std::string& packageName,
+ binder::Status createProfileSnapshot(int32_t appId, const std::string& packageName,
const std::string& codePath, bool* _aidl_return);
binder::Status destroyProfileSnapshot(const std::string& packageName,
const std::string& codePath);
diff --git a/cmds/installd/binder/android/os/IInstalld.aidl b/cmds/installd/binder/android/os/IInstalld.aidl
index 3374106..dbd89f5 100644
--- a/cmds/installd/binder/android/os/IInstalld.aidl
+++ b/cmds/installd/binder/android/os/IInstalld.aidl
@@ -62,7 +62,8 @@
void clearAppProfiles(@utf8InCpp String packageName);
void destroyAppProfiles(@utf8InCpp String packageName);
- boolean snapshotProfile(int appId, @utf8InCpp String packageName, @utf8InCpp String codePath);
+ boolean createProfileSnapshot(int appId, @utf8InCpp String packageName,
+ @utf8InCpp String codePath);
void destroyProfileSnapshot(@utf8InCpp String packageName, @utf8InCpp String codePath);
void idmap(@utf8InCpp String targetApkPath, @utf8InCpp String overlayApkPath, int uid);
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index 8917684..88edd0a 100644
--- a/cmds/installd/dexopt.cpp
+++ b/cmds/installd/dexopt.cpp
@@ -2310,7 +2310,7 @@
}
}
-bool snapshot_profile(int32_t app_id, const std::string& package_name,
+bool create_profile_snapshot(int32_t app_id, const std::string& package_name,
const std::string& code_path) {
int app_shared_gid = multiuser_get_shared_gid(/*user_id*/ 0, app_id);
diff --git a/cmds/installd/dexopt.h b/cmds/installd/dexopt.h
index 8ece893..8d81611 100644
--- a/cmds/installd/dexopt.h
+++ b/cmds/installd/dexopt.h
@@ -59,7 +59,8 @@
// ownership is assigned to AID_SYSTEM.
// The snapshot location is reference_profile_location.snapshot. If a snapshot is already
// there, it will be truncated and overwritten.
-bool snapshot_profile(int32_t app_id, const std::string& package, const std::string& code_path);
+bool create_profile_snapshot(int32_t app_id, const std::string& package,
+ const std::string& code_path);
bool dump_profiles(int32_t uid, const std::string& pkgname, const char* code_paths);
diff --git a/cmds/installd/tests/installd_dexopt_test.cpp b/cmds/installd/tests/installd_dexopt_test.cpp
index 05d7b6c..eaf0aa1 100644
--- a/cmds/installd/tests/installd_dexopt_test.cpp
+++ b/cmds/installd/tests/installd_dexopt_test.cpp
@@ -451,9 +451,10 @@
}
}
- void SnapshotProfile(int32_t appid, const std::string& package_name, bool expected_result) {
+ void createProfileSnapshot(int32_t appid, const std::string& package_name,
+ bool expected_result) {
bool result;
- binder::Status binder_result = service_->snapshotProfile(
+ binder::Status binder_result = service_->createProfileSnapshot(
appid, package_name, "base.jar", &result);
ASSERT_TRUE(binder_result.isOk());
ASSERT_EQ(expected_result, result);
@@ -531,7 +532,7 @@
LOG(INFO) << "ProfileSnapshotOk";
SetupProfiles(/*setup_ref*/ true);
- SnapshotProfile(kTestAppId, package_name_, /*expected_result*/ true);
+ createProfileSnapshot(kTestAppId, package_name_, /*expected_result*/ true);
}
// The reference profile is created on the fly. We need to be able to
@@ -540,21 +541,21 @@
LOG(INFO) << "ProfileSnapshotOkNoReference";
SetupProfiles(/*setup_ref*/ false);
- SnapshotProfile(kTestAppId, package_name_, /*expected_result*/ true);
+ createProfileSnapshot(kTestAppId, package_name_, /*expected_result*/ true);
}
TEST_F(ProfileTest, ProfileSnapshotFailWrongPackage) {
LOG(INFO) << "ProfileSnapshotFailWrongPackage";
SetupProfiles(/*setup_ref*/ true);
- SnapshotProfile(kTestAppId, "not.there", /*expected_result*/ false);
+ createProfileSnapshot(kTestAppId, "not.there", /*expected_result*/ false);
}
TEST_F(ProfileTest, ProfileSnapshotDestroySnapshot) {
LOG(INFO) << "ProfileSnapshotDestroySnapshot";
SetupProfiles(/*setup_ref*/ true);
- SnapshotProfile(kTestAppId, package_name_, /*expected_result*/ true);
+ createProfileSnapshot(kTestAppId, package_name_, /*expected_result*/ true);
binder::Status binder_result = service_->destroyProfileSnapshot(package_name_, "base.jar");
ASSERT_TRUE(binder_result.isOk());