Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be9c9900 authored by Anton Hansson's avatar Anton Hansson
Browse files

Fix AppFuseMountScope.close()

The boolean tracking whether the scope had been opened or not
was never set before. Set it in open(), as was the case in the
previous (non-binder) version of this class.

Bug: 132901939
Test: monitor `adb shell mount` while browsing photos and
      verify the appfuse mounts don't build up over time
Change-Id: Ia164ac4209126ed7e4d273c5fca4ababc0c66f2a
parent 2cf040d6
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -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;
            }
        }
    }