Storing the app who sets a CrossProfileIntentFilter.
When we add a CrossProfileIntentFilter, we store the package and userId of the calling app
inside the CrossProfileIntentFilter.
When an app calls clearCrossProfileIntentFilters, we only remove the filters that the calling app
has set itself.
BUG: 16537557
Change-Id: I6e7bc859383ea66553d9f4230365df8ba27525f3
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index 68d4cf1..2fef250 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -1583,7 +1583,8 @@
public void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId, int targetUserId,
int flags) {
try {
- mPM.addCrossProfileIntentFilter(filter, sourceUserId, targetUserId, flags);
+ mPM.addCrossProfileIntentFilter(filter, mContext.getOpPackageName(),
+ mContext.getUserId(), sourceUserId, targetUserId, flags);
} catch (RemoteException e) {
// Should never happen!
}
@@ -1607,7 +1608,8 @@
@Override
public void clearCrossProfileIntentFilters(int sourceUserId) {
try {
- mPM.clearCrossProfileIntentFilters(sourceUserId);
+ mPM.clearCrossProfileIntentFilters(sourceUserId, mContext.getOpPackageName(),
+ mContext.getUserId());
} catch (RemoteException e) {
// Should never happen!
}