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

Commit 54c6447f authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge changes from topic "am-2cfb180af8604b6fac1598107a7b546e" into oc-mr1-dev-plus-aosp

* changes:
  Merge changes from topic "mtp-user" into oc-mr1-dev am: 4de4655f
  Reset functions to null when user changes. am: e537a831
parents de9e8851 45629ed1
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
public class MtpDatabase implements AutoCloseable {
    private static final String TAG = "MtpDatabase";

    private final Context mUserContext;
    private final Context mContext;
    private final String mPackageName;
    private final ContentProviderClient mMediaProvider;
@@ -159,13 +160,14 @@ public class MtpDatabase implements AutoCloseable {
        }
    };

    public MtpDatabase(Context context, String volumeName, String storagePath,
    public MtpDatabase(Context context, Context userContext, String volumeName, String storagePath,
            String[] subDirectories) {
        native_setup();

        mContext = context;
        mUserContext = userContext;
        mPackageName = context.getPackageName();
        mMediaProvider = context.getContentResolver()
        mMediaProvider = userContext.getContentResolver()
                .acquireContentProviderClient(MediaStore.AUTHORITY);
        mVolumeName = volumeName;
        mMediaStoragePath = storagePath;
@@ -1114,7 +1116,7 @@ public class MtpDatabase implements AutoCloseable {

    private void sessionEnded() {
        if (mDatabaseModified) {
            mContext.sendBroadcast(new Intent(MediaStore.ACTION_MTP_SESSION_END));
            mUserContext.sendBroadcast(new Intent(MediaStore.ACTION_MTP_SESSION_END));
            mDatabaseModified = false;
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -1017,7 +1017,7 @@ public class UsbDeviceManager {
                            Slog.v(TAG, "Current user switched to " + msg.arg1
                                    + "; resetting USB host stack for MTP or PTP");
                            // avoid leaking sensitive data from previous user
                            setEnabledFunctions(mCurrentFunctions, true, false);
                            setEnabledFunctions(null, true, false);
                        }
                        mCurrentUser = msg.arg1;
                    }