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

Commit c6064cbe authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge "DatabaseManager: Allow more flexible cleanup" into main

parents 1e5aa55a f7bbdc81
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -1084,12 +1084,11 @@ public class DatabaseManager {
     * @param database the Bluetooth storage {@link MetadataDatabase}
     */
    public void start(MetadataDatabase database) {
        Log.d(TAG, "start()");

        if (database == null) {
            Log.e(TAG, "stat failed, database is null.");
            Log.e(TAG, "start failed, database is null.");
            return;
        }
        Log.d(TAG, "start()");

        synchronized (mDatabaseLock) {
            mDatabase = database;
@@ -1124,6 +1123,12 @@ public class DatabaseManager {

    /** Close and de-init the DatabaseManager */
    public void cleanup() {
        synchronized (mDatabaseLock) {
            if (mDatabase == null) {
                Log.w(TAG, "cleanup called on non started database");
                return;
            }
        }
        removeUnusedMetadata();
        mAdapterService.unregisterReceiver(mReceiver);
        if (mHandlerThread != null) {