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

Commit 431f4508 authored by William Escande's avatar William Escande
Browse files

Adapter: Load native only with AdapterService

We should be able to initialized AdapterApp without bringing the whole
native. By moving the load library to AdapterService, we are opening
the possibility to have a service that does not depend on native.

Test: m Bluetooth
Test: Boot and check log for initialization order
Bug: 290403852
Change-Id: If25df66b4f6c7cece6dfcc289ee5d664133cfe93
parent d6f23d8c
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -18,25 +18,12 @@ package com.android.bluetooth.btservice;
import android.app.Application;
import android.util.Log;

import com.android.bluetooth.Utils;

public class AdapterApp extends Application {
    private static final String TAG = "BluetoothAdapterApp";
    private static final boolean DBG = false;
    //For Debugging only
    private static int sRefCount = 0;

    static {
        if (DBG) {
            Log.d(TAG, "Loading JNI Library");
        }
        if (Utils.isInstrumentationTestMode()) {
            Log.w(TAG, "App is instrumented. Skip loading the native");
        } else {
            System.loadLibrary("bluetooth_jni");
        }
    }

    public AdapterApp() {
        super();
        if (DBG) {
+12 −0
Original line number Diff line number Diff line
@@ -173,6 +173,18 @@ public class AdapterService extends Service {
    private static final String TAG = "BluetoothAdapterService";
    private static final boolean DBG = true;
    private static final boolean VERBOSE = false;

    static {
        if (DBG) {
            Log.d(TAG, "Loading JNI Library");
        }
        if (Utils.isInstrumentationTestMode()) {
            Log.w(TAG, "App is instrumented. Skip loading the native");
        } else {
            System.loadLibrary("bluetooth_jni");
        }
    }

    private static final int MIN_ADVT_INSTANCES_FOR_MA = 5;
    private static final int MIN_OFFLOADED_FILTERS = 10;
    private static final int MIN_OFFLOADED_SCAN_STORAGE_BYTES = 1024;