Merge "Replace String for 'path' to File" into rvc-dev am: e8de8f21bd

Change-Id: I31bd348037ac3d9d6098db868e946f5b479f6b07
This commit is contained in:
Automerger Merge Worker
2020-03-04 22:42:29 +00:00
2 changed files with 13 additions and 4 deletions

View File

@@ -10338,7 +10338,7 @@ package android.service.storage {
ctor public ExternalStorageService();
method @NonNull public final android.os.IBinder onBind(@NonNull android.content.Intent);
method public abstract void onEndSession(@NonNull String) throws java.io.IOException;
method public abstract void onStartSession(@NonNull String, int, @NonNull android.os.ParcelFileDescriptor, @NonNull String, @NonNull String) throws java.io.IOException;
method public abstract void onStartSession(@NonNull String, int, @NonNull android.os.ParcelFileDescriptor, @NonNull java.io.File, @NonNull java.io.File) throws java.io.IOException;
field public static final int FLAG_SESSION_ATTRIBUTE_INDEXABLE = 2; // 0x2
field public static final int FLAG_SESSION_TYPE_FUSE = 1; // 0x1
field public static final String SERVICE_INTERFACE = "android.service.storage.ExternalStorageService";

View File

@@ -31,6 +31,7 @@ import android.os.ParcelableException;
import android.os.RemoteCallback;
import android.os.RemoteException;
import java.io.File;
import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -109,10 +110,17 @@ public abstract class ExternalStorageService extends Service {
*
* <p> Additional calls to start a session for the same {@code sessionId} while the session
* is still starting or already started should have no effect.
*
* @param sessionId uniquely identifies a running session and used in {@link #onEndSession}
* @param flag specifies the type or additional attributes of a session
* @param deviceFd for intercepting IO from other apps
* @param upperFileSystemPath is the root path on which we are intercepting IO from other apps
* @param lowerFileSystemPath is the root path matching {@code upperFileSystemPath} containing
* the actual data apps are trying to access
*/
public abstract void onStartSession(@NonNull String sessionId, @SessionFlag int flag,
@NonNull ParcelFileDescriptor deviceFd, @NonNull String upperFileSystemPath,
@NonNull String lowerFileSystemPath) throws IOException;
@NonNull ParcelFileDescriptor deviceFd, @NonNull File upperFileSystemPath,
@NonNull File lowerFileSystemPath) throws IOException;
/**
* Called when the system ends the session identified by {@code sessionId}. Implementors should
@@ -136,7 +144,8 @@ public abstract class ExternalStorageService extends Service {
RemoteCallback callback) throws RemoteException {
mHandler.post(() -> {
try {
onStartSession(sessionId, flag, deviceFd, upperPath, lowerPath);
onStartSession(sessionId, flag, deviceFd, new File(upperPath),
new File(lowerPath));
sendResult(sessionId, null /* throwable */, callback);
} catch (Throwable t) {
sendResult(sessionId, t, callback);