Avoid triggering StrictMode for storage notifs.
Bug: 130129028
Test: none
Exempt-From-Owner-Approval: trivial bugfix
Change-Id: Ia9d9da589ee1f4d95a27bf327235f950f65c69a0
diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
index 329d029..de86f3d 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java
@@ -29,6 +29,7 @@
import android.content.pm.PackageManager.MoveCallback;
import android.os.Bundle;
import android.os.Handler;
+import android.os.StrictMode;
import android.os.UserHandle;
import android.os.storage.DiskInfo;
import android.os.storage.StorageEventListener;
@@ -639,11 +640,16 @@
}
private PendingIntent buildBrowsePendingIntent(VolumeInfo vol) {
- final Intent intent = vol.buildBrowseIntentForUser(vol.getMountUserId());
+ final StrictMode.VmPolicy oldPolicy = StrictMode.allowVmViolations();
+ try {
+ final Intent intent = vol.buildBrowseIntentForUser(vol.getMountUserId());
- final int requestKey = vol.getId().hashCode();
- return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
- PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
+ final int requestKey = vol.getId().hashCode();
+ return PendingIntent.getActivityAsUser(mContext, requestKey, intent,
+ PendingIntent.FLAG_CANCEL_CURRENT, null, UserHandle.CURRENT);
+ } finally {
+ StrictMode.setVmPolicy(oldPolicy);
+ }
}
private PendingIntent buildVolumeSettingsPendingIntent(VolumeInfo vol) {