Merge changes from topic "am-2cfb180af8604b6fac1598107a7b546e" into oc-mr1-dev-plus-aosp
am: 54c6447f47
Change-Id: I13aeac421ecf7a54f16e0fd6aaa19be3f513be4a
diff --git a/media/java/android/mtp/MtpDatabase.java b/media/java/android/mtp/MtpDatabase.java
index 9847d705..80fd5c0 100755
--- a/media/java/android/mtp/MtpDatabase.java
+++ b/media/java/android/mtp/MtpDatabase.java
@@ -52,6 +52,7 @@
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 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 @@
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;
}
}
diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
index 3d05363..e65d360 100644
--- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
@@ -1018,7 +1018,7 @@
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;
}