summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alexander Dorokhine <adorokhine@google.com> 2021-06-15 16:43:28 -0700
committer Alexander Dorokhine <adorokhine@google.com> 2021-06-15 16:43:28 -0700
commit66e09afd5452426a9f032c37b84a46ff60c1a1d7 (patch)
tree679f91a0acd1eea73fa954dbfa61e4a63e9f32ca
parentad37babc9f00a47ff995c7e278338b908b56b067 (diff)
Switch to a non-hidden way to compute data path and switch to subdir.
We need to store other things in the appsearch data dir other than what Icing stores, such as the storage info cache. Bug: 177685938 Bug: 181787682 Test: Presubmit Change-Id: I903c34a2c891d617217d44f5126d0d31c8c6bf39
-rw-r--r--apex/appsearch/service/java/com/android/server/appsearch/ImplInstanceManager.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/apex/appsearch/service/java/com/android/server/appsearch/ImplInstanceManager.java b/apex/appsearch/service/java/com/android/server/appsearch/ImplInstanceManager.java
index 289413aebbb5..2181dab90681 100644
--- a/apex/appsearch/service/java/com/android/server/appsearch/ImplInstanceManager.java
+++ b/apex/appsearch/service/java/com/android/server/appsearch/ImplInstanceManager.java
@@ -24,6 +24,7 @@ import android.content.Context;
import android.os.Environment;
import android.os.UserHandle;
import android.util.ArrayMap;
+import android.util.Log;
import com.android.internal.annotations.GuardedBy;
import com.android.server.appsearch.external.localstorage.AppSearchImpl;
@@ -38,9 +39,10 @@ import java.util.Objects;
* Manages the lifecycle of instances of {@link AppSearchImpl}.
*
* <p>These instances are managed per unique device-user.
+ * @hide
*/
public final class ImplInstanceManager {
- private static final String APP_SEARCH_DIR = "appSearch";
+ private static final String TAG = "AppSearchImplInstanceMa";
private static ImplInstanceManager sImplInstanceManager;
@@ -71,8 +73,11 @@ public final class ImplInstanceManager {
* <p>This folder should only be accessed after unlock.
*/
public static File getAppSearchDir(@NonNull UserHandle userHandle) {
- return new File(
- Environment.getDataSystemCeDirectory(userHandle.getIdentifier()), APP_SEARCH_DIR);
+ // Duplicates the implementation of Environment#getDataSystemCeDirectory
+ // TODO(b/191059409): Unhide Environment#getDataSystemCeDirectory and switch to it.
+ File systemCeDir = new File(Environment.getDataDirectory(), "system_ce");
+ File systemCeUserDir = new File(systemCeDir, String.valueOf(userHandle.getIdentifier()));
+ return new File(systemCeUserDir, "appSearch");
}
/**
@@ -154,8 +159,10 @@ public final class ImplInstanceManager {
@Nullable AppSearchLogger logger)
throws AppSearchException {
File appSearchDir = getAppSearchDir(userHandle);
+ File icingDir = new File(appSearchDir, "icing");
+ Log.i(TAG, "Creating new AppSearch instance at: " + icingDir);
return AppSearchImpl.create(
- appSearchDir,
+ icingDir,
userContext,
/*logger=*/ null,
new FrameworkOptimizeStrategy());