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

Commit fe259319 authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Close MTP database when MtpServer's thread is terminated.

Fix: 28030321
Change-Id: I7efe59b651a62ca917ba74312a80b56c0564e060
(cherry picked from commit dd383597)
parent 03f1e026
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -23,12 +23,14 @@ package android.mtp;
public class MtpServer implements Runnable {

    private long mNativeContext; // accessed by native methods
    private final MtpDatabase mDatabase;

    static {
        System.loadLibrary("media_jni");
    }

    public MtpServer(MtpDatabase database, boolean usePtp) {
        mDatabase = database;
        native_setup(database, usePtp);
        database.setServer(this);
    }
@@ -42,6 +44,7 @@ public class MtpServer implements Runnable {
    public void run() {
        native_run();
        native_cleanup();
        mDatabase.close();
    }

    public void sendObjectAdded(int handle) {