Skip to content

Commit

Permalink
Merge pull request square#111 from square/py/media_scanner
Browse files Browse the repository at this point in the history
Ignore MediaScannerConnection leak
  • Loading branch information
pyricau committed May 17, 2015
2 parents 3e1b840 + 1d3478e commit bd94bbe
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,17 @@ public enum AndroidExcludedRefs {
}
},

MEDIA_SCANNER_CONNECTION(SDK_INT <= LOLLIPOP_MR1) {
@Override void add(ExcludedRefs.Builder excluded) {
// The static method MediaScannerConnection.scanFile() takes an activity context but the
// service might not disconnect after the activity has been destroyed.
// Tracked here: https://code.google.com/p/android/issues/detail?id=173788
// Fix: Create an instance of MediaScannerConnection yourself and pass in the application
// context. Call connect() and disconnect() manually.
excluded.instanceField("android.media.MediaScannerConnection", "mContext");
}
},

DEVICE_POLICY_MANAGER__SETTINGS_OBSERVER(MOTOROLA.equals(MANUFACTURER) && SDK_INT == KITKAT) {
@Override void add(ExcludedRefs.Builder excluded) {
if (MOTOROLA.equals(MANUFACTURER) && SDK_INT == KITKAT) {
Expand Down

0 comments on commit bd94bbe

Please sign in to comment.