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

Commit 1b37c3bd authored by Mattias Nilsson's avatar Mattias Nilsson Committed by Takeshi Aimi
Browse files

Release DrmManagerClient resources

Call release for DrmManagerClient to avoid resource leaks

Introduced by following commit (5d143ad4...),
"Media scanner support for FL(Forward Lock) DRM file types"

Change-Id: Ic3c458579f4e99b3b072a2e13362d1996b982589
parent aa19a2f6
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1280,6 +1280,14 @@ public class MediaScanner
        mMediaProvider = null;
    }

    private void releaseResources() {
        // release the DrmManagerClient resources
        if (mDrmManagerClient != null) {
            mDrmManagerClient.release();
            mDrmManagerClient = null;
        }
    }

    private void initialize(String volumeName) {
        mMediaProvider = mContext.getContentResolver().acquireProvider("media");

@@ -1340,6 +1348,8 @@ public class MediaScanner
            Log.e(TAG, "UnsupportedOperationException in MediaScanner.scan()", e);
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException in MediaScanner.scan()", e);
        } finally {
            releaseResources();
        }
    }

@@ -1363,6 +1373,8 @@ public class MediaScanner
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException in MediaScanner.scanFile()", e);
            return null;
        } finally {
            releaseResources();
        }
    }

@@ -1477,6 +1489,7 @@ public class MediaScanner
            if (fileList != null) {
                fileList.close();
            }
            releaseResources();
        }
    }