Merge "Fix AppFuseMountScope.close()" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ab09bd96ac
@@ -2842,8 +2842,9 @@ class StorageManagerService extends IStorageManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Not thread safe */
|
||||||
class AppFuseMountScope extends AppFuseBridge.MountScope {
|
class AppFuseMountScope extends AppFuseBridge.MountScope {
|
||||||
boolean opened = false;
|
private boolean mMounted = false;
|
||||||
|
|
||||||
public AppFuseMountScope(int uid, int mountId) {
|
public AppFuseMountScope(int uid, int mountId) {
|
||||||
super(uid, mountId);
|
super(uid, mountId);
|
||||||
@@ -2852,8 +2853,9 @@ class StorageManagerService extends IStorageManager.Stub
|
|||||||
@Override
|
@Override
|
||||||
public ParcelFileDescriptor open() throws NativeDaemonConnectorException {
|
public ParcelFileDescriptor open() throws NativeDaemonConnectorException {
|
||||||
try {
|
try {
|
||||||
return new ParcelFileDescriptor(
|
final FileDescriptor fd = mVold.mountAppFuse(uid, mountId);
|
||||||
mVold.mountAppFuse(uid, mountId));
|
mMounted = true;
|
||||||
|
return new ParcelFileDescriptor(fd);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new NativeDaemonConnectorException("Failed to mount", e);
|
throw new NativeDaemonConnectorException("Failed to mount", e);
|
||||||
}
|
}
|
||||||
@@ -2872,9 +2874,9 @@ class StorageManagerService extends IStorageManager.Stub
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws Exception {
|
public void close() throws Exception {
|
||||||
if (opened) {
|
if (mMounted) {
|
||||||
mVold.unmountAppFuse(uid, mountId);
|
mVold.unmountAppFuse(uid, mountId);
|
||||||
opened = false;
|
mMounted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user