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

Commit c684b7d3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Change database package name align with the directory name"

parents 34c2176a 66abcbb7
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -26,10 +26,10 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
        services.net \
        services.net \
        libprotobuf-java-lite \
        libprotobuf-java-lite \
        bluetooth-protos-lite \
        bluetooth-protos-lite \
        androidx.lifecycle_lifecycle-livedata \


LOCAL_STATIC_ANDROID_LIBRARIES := \
LOCAL_STATIC_ANDROID_LIBRARIES := \
        androidx.core_core \
        androidx.core_core \
        androidx.lifecycle_lifecycle-livedata \
        androidx.room_room-runtime \
        androidx.room_room-runtime \


LOCAL_ANNOTATION_PROCESSORS := \
LOCAL_ANNOTATION_PROCESSORS := \
@@ -47,6 +47,9 @@ LOCAL_ANNOTATION_PROCESSORS := \
        guava-21.0 \
        guava-21.0 \
        kotlin-stdlib
        kotlin-stdlib


LOCAL_ANNOTATION_PROCESSOR_CLASSES := \
        androidx.room.RoomProcessor

LOCAL_REQUIRED_MODULES := libbluetooth
LOCAL_REQUIRED_MODULES := libbluetooth
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_PROGUARD_ENABLED := disabled
include $(BUILD_PACKAGE)
include $(BUILD_PACKAGE)
+2 −0
Original line number Original line Diff line number Diff line
@@ -70,6 +70,8 @@ import androidx.room.Room;
import com.android.bluetooth.BluetoothMetricsProto;
import com.android.bluetooth.BluetoothMetricsProto;
import com.android.bluetooth.Utils;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.RemoteDevices.DeviceProperties;
import com.android.bluetooth.btservice.RemoteDevices.DeviceProperties;
import com.android.bluetooth.btservice.storage.DatabaseManager;
import com.android.bluetooth.btservice.storage.MetadataDatabase;
import com.android.bluetooth.gatt.GattService;
import com.android.bluetooth.gatt.GattService;
import com.android.bluetooth.sdp.SdpManager;
import com.android.bluetooth.sdp.SdpManager;
import com.android.internal.R;
import com.android.internal.R;
+1 −1
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


package com.android.bluetooth.btservice;
package com.android.bluetooth.btservice.storage;


import androidx.room.Entity;
import androidx.room.Entity;


+20 −5
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


package com.android.bluetooth.btservice;
package com.android.bluetooth.btservice.storage;


import android.bluetooth.BluetoothA2dp;
import android.bluetooth.BluetoothA2dp;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothAdapter;
@@ -32,6 +32,7 @@ import android.os.Message;
import android.provider.Settings;
import android.provider.Settings;
import android.util.Log;
import android.util.Log;


import com.android.bluetooth.btservice.AdapterService;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;


import java.util.HashMap;
import java.util.HashMap;
@@ -67,7 +68,10 @@ public class DatabaseManager {
    private static final int MSG_CLEAR_DATABASE = 100;
    private static final int MSG_CLEAR_DATABASE = 100;
    private static final String LOCAL_STORAGE = "LocalStorage";
    private static final String LOCAL_STORAGE = "LocalStorage";


    DatabaseManager(AdapterService service) {
    /**
     * Constructor of the DatabaseManager
     */
    public DatabaseManager(AdapterService service) {
        mAdapterService = service;
        mAdapterService = service;
    }
    }


@@ -500,7 +504,12 @@ public class DatabaseManager {
        return mHandlerThread.getLooper();
        return mHandlerThread.getLooper();
    }
    }


    void start(MetadataDatabase database) {
    /**
     * Start and initialize the DatabaseManager
     *
     * @param database the Bluetooth storage {@link MetadataDatabase}
     */
    public void start(MetadataDatabase database) {
        if (DBG) {
        if (DBG) {
            Log.d(TAG, "start()");
            Log.d(TAG, "start()");
        }
        }
@@ -535,13 +544,19 @@ public class DatabaseManager {
                .getAbsolutePath();
                .getAbsolutePath();
    }
    }


    void factoryReset() {
    /**
     * Clear all persistence data in database
     */
    public void factoryReset() {
        Log.w(TAG, "factoryReset");
        Log.w(TAG, "factoryReset");
        Message message = mHandler.obtainMessage(MSG_CLEAR_DATABASE);
        Message message = mHandler.obtainMessage(MSG_CLEAR_DATABASE);
        mHandler.sendMessage(message);
        mHandler.sendMessage(message);
    }
    }


    void cleanup() {
    /**
     * Close and de-init the DatabaseManager
     */
    public void cleanup() {
        removeUnusedMetadata();
        removeUnusedMetadata();
        mAdapterService.unregisterReceiver(mReceiver);
        mAdapterService.unregisterReceiver(mReceiver);
        if (mHandlerThread != null) {
        if (mHandlerThread != null) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


package com.android.bluetooth.btservice;
package com.android.bluetooth.btservice.storage;


import android.bluetooth.BluetoothA2dp;
import android.bluetooth.BluetoothA2dp;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothDevice;
Loading