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

Commit 0bfc633b authored by Dipankar Bhardwaj's avatar Dipankar Bhardwaj Committed by Android (Google) Code Review
Browse files

Merge "Clear calling identity before call to UserManagerService" into main

parents 68dc9455 d8451a74
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.content.pm.ProviderInfo;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.content.pm.UserInfo;
import android.os.Binder;
import android.os.IVold;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
@@ -246,17 +247,18 @@ public final class StorageSessionController {
     * Call {@link #onVolumeRemove} to remove the connection without waiting for exit
     */
    public void onVolumeUnmount(VolumeInfo vol) {
        String sessionId = vol.getId();
        final long token = Binder.clearCallingIdentity();
        try {
            StorageUserConnection connection = onVolumeRemove(vol);

            Slog.i(TAG, "On volume unmount " + vol);
            if (connection != null) {
            String sessionId = vol.getId();

            try {
              connection.removeSessionAndWait(sessionId);
            }
        } catch (ExternalStorageServiceException e) {
            Slog.e(TAG, "Failed to end session for vol with id: " + sessionId, e);
            }
        } finally {
            Binder.restoreCallingIdentity(token);
        }
    }