Merge "Switch to a non-hidden way to compute data path and switch to subdir." into sc-dev am: aafffec2e3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14675867 Change-Id: Ia3ef2e833e105b2743004d8a72ed9212fb693493
This commit is contained in:
committed by
Automerger Merge Worker
commit
9053769983
@@ -24,6 +24,7 @@ import android.content.Context;
|
|||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.server.appsearch.external.localstorage.AppSearchImpl;
|
import com.android.server.appsearch.external.localstorage.AppSearchImpl;
|
||||||
@@ -38,9 +39,10 @@ import java.util.Objects;
|
|||||||
* Manages the lifecycle of instances of {@link AppSearchImpl}.
|
* Manages the lifecycle of instances of {@link AppSearchImpl}.
|
||||||
*
|
*
|
||||||
* <p>These instances are managed per unique device-user.
|
* <p>These instances are managed per unique device-user.
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
public final class ImplInstanceManager {
|
public final class ImplInstanceManager {
|
||||||
private static final String APP_SEARCH_DIR = "appSearch";
|
private static final String TAG = "AppSearchImplInstanceMa";
|
||||||
|
|
||||||
private static ImplInstanceManager sImplInstanceManager;
|
private static ImplInstanceManager sImplInstanceManager;
|
||||||
|
|
||||||
@@ -71,8 +73,11 @@ public final class ImplInstanceManager {
|
|||||||
* <p>This folder should only be accessed after unlock.
|
* <p>This folder should only be accessed after unlock.
|
||||||
*/
|
*/
|
||||||
public static File getAppSearchDir(@NonNull UserHandle userHandle) {
|
public static File getAppSearchDir(@NonNull UserHandle userHandle) {
|
||||||
return new File(
|
// Duplicates the implementation of Environment#getDataSystemCeDirectory
|
||||||
Environment.getDataSystemCeDirectory(userHandle.getIdentifier()), APP_SEARCH_DIR);
|
// 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)
|
@Nullable AppSearchLogger logger)
|
||||||
throws AppSearchException {
|
throws AppSearchException {
|
||||||
File appSearchDir = getAppSearchDir(userHandle);
|
File appSearchDir = getAppSearchDir(userHandle);
|
||||||
|
File icingDir = new File(appSearchDir, "icing");
|
||||||
|
Log.i(TAG, "Creating new AppSearch instance at: " + icingDir);
|
||||||
return AppSearchImpl.create(
|
return AppSearchImpl.create(
|
||||||
appSearchDir,
|
icingDir,
|
||||||
userContext,
|
userContext,
|
||||||
/*logger=*/ null,
|
/*logger=*/ null,
|
||||||
new FrameworkOptimizeStrategy());
|
new FrameworkOptimizeStrategy());
|
||||||
|
|||||||
Reference in New Issue
Block a user