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 {
|
||||
boolean opened = false;
|
||||
private boolean mMounted = false;
|
||||
|
||||
public AppFuseMountScope(int uid, int mountId) {
|
||||
super(uid, mountId);
|
||||
@@ -2852,8 +2853,9 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
@Override
|
||||
public ParcelFileDescriptor open() throws NativeDaemonConnectorException {
|
||||
try {
|
||||
return new ParcelFileDescriptor(
|
||||
mVold.mountAppFuse(uid, mountId));
|
||||
final FileDescriptor fd = mVold.mountAppFuse(uid, mountId);
|
||||
mMounted = true;
|
||||
return new ParcelFileDescriptor(fd);
|
||||
} catch (Exception e) {
|
||||
throw new NativeDaemonConnectorException("Failed to mount", e);
|
||||
}
|
||||
@@ -2872,9 +2874,9 @@ class StorageManagerService extends IStorageManager.Stub
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
if (opened) {
|
||||
if (mMounted) {
|
||||
mVold.unmountAppFuse(uid, mountId);
|
||||
opened = false;
|
||||
mMounted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user