Loading android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +3 −52 Original line number Original line Diff line number Diff line Loading @@ -79,7 +79,6 @@ static jmethodID method_discoveryStateChangeCallback; static jmethodID method_linkQualityReportCallback; static jmethodID method_linkQualityReportCallback; static jmethodID method_switchBufferSizeCallback; static jmethodID method_switchBufferSizeCallback; static jmethodID method_switchCodecCallback; static jmethodID method_switchCodecCallback; static jmethodID method_setWakeAlarm; static jmethodID method_acquireWakeLock; static jmethodID method_acquireWakeLock; static jmethodID method_releaseWakeLock; static jmethodID method_releaseWakeLock; static jmethodID method_energyInfo; static jmethodID method_energyInfo; Loading Loading @@ -845,12 +844,6 @@ static bt_callbacks_t sBluetoothCallbacks = {sizeof(sBluetoothCallbacks), switch_codec_callback, switch_codec_callback, le_rand_callback}; le_rand_callback}; // The callback to call when the wake alarm fires. static alarm_cb sAlarmCallback; // The data to pass to the wake alarm callback. static void* sAlarmCallbackData; class JNIThreadAttacher { class JNIThreadAttacher { public: public: JNIThreadAttacher(JavaVM* vm) : vm_(vm), env_(nullptr) { JNIThreadAttacher(JavaVM* vm) : vm_(vm), env_(nullptr) { Loading Loading @@ -897,37 +890,6 @@ class JNIThreadAttacher { jint status_; jint status_; }; }; static bool set_wake_alarm_callout(uint64_t delay_millis, bool should_wake, alarm_cb cb, void* data) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniAdapterServiceObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return false; } JNIThreadAttacher attacher(vm); JNIEnv* env = attacher.getEnv(); if (env == nullptr) { ALOGE("%s: Unable to get JNI Env", __func__); return false; } sAlarmCallback = cb; sAlarmCallbackData = data; jboolean jshould_wake = should_wake ? JNI_TRUE : JNI_FALSE; jboolean ret = env->CallBooleanMethod(sJniAdapterServiceObj, method_setWakeAlarm, (jlong)delay_millis, jshould_wake); if (!ret) { sAlarmCallback = NULL; sAlarmCallbackData = NULL; } return (ret == JNI_TRUE); } static int acquire_wake_lock_callout(const char* lock_name) { static int acquire_wake_lock_callout(const char* lock_name) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniAdapterServiceObj) { if (!sJniAdapterServiceObj) { Loading Loading @@ -990,19 +952,10 @@ static int release_wake_lock_callout(const char* lock_name) { return ret; return ret; } } // Called by Java code when alarm is fired. A wake lock is held by the caller // over the duration of this callback. static void alarmFiredNative(JNIEnv* env, jobject obj) { if (sAlarmCallback) { sAlarmCallback(sAlarmCallbackData); } else { ALOGE("%s() - Alarm fired with callback not set!", __func__); } } static bt_os_callouts_t sBluetoothOsCallouts = { static bt_os_callouts_t sBluetoothOsCallouts = { sizeof(sBluetoothOsCallouts), set_wake_alarm_callout, sizeof(sBluetoothOsCallouts), acquire_wake_lock_callout, release_wake_lock_callout, acquire_wake_lock_callout, release_wake_lock_callout, }; }; int hal_util_load_bt_library(const bt_interface_t** interface) { int hal_util_load_bt_library(const bt_interface_t** interface) { Loading Loading @@ -1094,7 +1047,6 @@ static void classInitNative(JNIEnv* env, jclass clazz) { method_switchCodecCallback = method_switchCodecCallback = env->GetMethodID(jniCallbackClass, "switchCodecCallback", "(Z)V"); env->GetMethodID(jniCallbackClass, "switchCodecCallback", "(Z)V"); method_setWakeAlarm = env->GetMethodID(clazz, "setWakeAlarm", "(JZ)Z"); method_acquireWakeLock = method_acquireWakeLock = env->GetMethodID(clazz, "acquireWakeLock", "(Ljava/lang/String;)Z"); env->GetMethodID(clazz, "acquireWakeLock", "(Ljava/lang/String;)Z"); method_releaseWakeLock = method_releaseWakeLock = Loading Loading @@ -2229,7 +2181,6 @@ static JNINativeMethod sMethods[] = { {"pinReplyNative", "([BZI[B)Z", (void*)pinReplyNative}, {"pinReplyNative", "([BZI[B)Z", (void*)pinReplyNative}, {"sspReplyNative", "([BIZI)Z", (void*)sspReplyNative}, {"sspReplyNative", "([BIZI)Z", (void*)sspReplyNative}, {"getRemoteServicesNative", "([BI)Z", (void*)getRemoteServicesNative}, {"getRemoteServicesNative", "([BI)Z", (void*)getRemoteServicesNative}, {"alarmFiredNative", "()V", (void*)alarmFiredNative}, {"readEnergyInfo", "()I", (void*)readEnergyInfo}, {"readEnergyInfo", "()I", (void*)readEnergyInfo}, {"dumpNative", "(Ljava/io/FileDescriptor;[Ljava/lang/String;)V", {"dumpNative", "(Ljava/io/FileDescriptor;[Ljava/lang/String;)V", (void*)dumpNative}, (void*)dumpNative}, Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +0 −60 Original line number Original line Diff line number Diff line Loading @@ -40,7 +40,6 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.RequiresPermission; import android.annotation.SuppressLint; import android.annotation.SuppressLint; import android.app.AlarmManager; import android.app.AppOpsManager; import android.app.AppOpsManager; import android.app.PendingIntent; import android.app.PendingIntent; import android.app.Service; import android.app.Service; Loading Loading @@ -78,10 +77,8 @@ import android.bluetooth.OobData; import android.bluetooth.UidTraffic; import android.bluetooth.UidTraffic; import android.companion.CompanionDeviceManager; import android.companion.CompanionDeviceManager; import android.content.AttributionSource; import android.content.AttributionSource; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.os.AsyncTask; import android.os.AsyncTask; Loading Loading @@ -206,9 +203,6 @@ public class AdapterService extends Service { public static final String EXTRA_ACTION = "action"; public static final String EXTRA_ACTION = "action"; public static final int PROFILE_CONN_REJECTED = 2; public static final int PROFILE_CONN_REJECTED = 2; private static final String ACTION_ALARM_WAKEUP = "com.android.bluetooth.btservice.action.ALARM_WAKEUP"; private static BluetoothProperties.snoop_log_mode_values sSnoopLogSettingAtEnable = private static BluetoothProperties.snoop_log_mode_values sSnoopLogSettingAtEnable = BluetoothProperties.snoop_log_mode_values.EMPTY; BluetoothProperties.snoop_log_mode_values.EMPTY; private static String sDefaultSnoopLogSettingAtEnable = "empty"; private static String sDefaultSnoopLogSettingAtEnable = "empty"; Loading Loading @@ -341,8 +335,6 @@ public class AdapterService extends Service { private final Map<UUID, RfcommListenerData> mBluetoothServerSockets = new ConcurrentHashMap<>(); private final Map<UUID, RfcommListenerData> mBluetoothServerSockets = new ConcurrentHashMap<>(); private final Executor mSocketServersExecutor = r -> new Thread(r).start(); private final Executor mSocketServersExecutor = r -> new Thread(r).start(); private AlarmManager mAlarmManager; private PendingIntent mPendingAlarm; private BatteryStatsManager mBatteryStatsManager; private BatteryStatsManager mBatteryStatsManager; private PowerManager mPowerManager; private PowerManager mPowerManager; private PowerManager.WakeLock mWakeLock; private PowerManager.WakeLock mWakeLock; Loading Loading @@ -611,7 +603,6 @@ public class AdapterService extends Service { mUserManager = getNonNullSystemService(UserManager.class); mUserManager = getNonNullSystemService(UserManager.class); mAppOps = getNonNullSystemService(AppOpsManager.class); mAppOps = getNonNullSystemService(AppOpsManager.class); mAlarmManager = getNonNullSystemService(AlarmManager.class); mPowerManager = getNonNullSystemService(PowerManager.class); mPowerManager = getNonNullSystemService(PowerManager.class); mBatteryStatsManager = getNonNullSystemService(BatteryStatsManager.class); mBatteryStatsManager = getNonNullSystemService(BatteryStatsManager.class); mCompanionDeviceManager = getNonNullSystemService(CompanionDeviceManager.class); mCompanionDeviceManager = getNonNullSystemService(CompanionDeviceManager.class); Loading Loading @@ -665,9 +656,6 @@ public class AdapterService extends Service { mBluetoothQualityReportNativeInterface.init(); mBluetoothQualityReportNativeInterface.init(); mSdpManager = SdpManager.init(this); mSdpManager = SdpManager.init(this); IntentFilter filter = new IntentFilter(ACTION_ALARM_WAKEUP); filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); registerReceiver(mAlarmBroadcastReceiver, filter); loadLeAudioAllowDevices(); loadLeAudioAllowDevices(); mDatabaseManager = new DatabaseManager(this); mDatabaseManager = new DatabaseManager(this); Loading Loading @@ -1264,15 +1252,8 @@ public class AdapterService extends Service { mCleaningUp = true; mCleaningUp = true; invalidateBluetoothCaches(); invalidateBluetoothCaches(); unregisterReceiver(mAlarmBroadcastReceiver); stopRfcommServerSockets(); stopRfcommServerSockets(); if (mPendingAlarm != null) { mAlarmManager.cancel(mPendingAlarm); mPendingAlarm = null; } // This wake lock release may also be called concurrently by // This wake lock release may also be called concurrently by // {@link #releaseWakeLock(String lockName)}, so a synchronization is needed here. // {@link #releaseWakeLock(String lockName)}, so a synchronization is needed here. synchronized (this) { synchronized (this) { Loading Loading @@ -6876,34 +6857,6 @@ public class AdapterService extends Service { return -1; return -1; } } // This function is called from JNI. It allows native code to set a single wake // alarm. If an alarm is already pending and a new request comes in, the alarm // will be rescheduled (i.e. the previously set alarm will be cancelled). @RequiresPermission(android.Manifest.permission.SCHEDULE_EXACT_ALARM) private boolean setWakeAlarm(long delayMillis, boolean shouldWake) { synchronized (this) { if (mPendingAlarm != null) { mAlarmManager.cancel(mPendingAlarm); } long wakeupTime = SystemClock.elapsedRealtime() + delayMillis; int type = shouldWake ? AlarmManager.ELAPSED_REALTIME_WAKEUP : AlarmManager.ELAPSED_REALTIME; Intent intent = new Intent(ACTION_ALARM_WAKEUP); mPendingAlarm = PendingIntent.getBroadcast( this, 0, intent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE); mAlarmManager.setExact(type, wakeupTime, mPendingAlarm); return true; } } // This function is called from JNI. It allows native code to acquire a single wake lock. // This function is called from JNI. It allows native code to acquire a single wake lock. // If the wake lock is already held, this function returns success. Although this function // If the wake lock is already held, this function returns success. Although this function // only supports acquiring a single wake lock at a time right now, it will eventually be // only supports acquiring a single wake lock at a time right now, it will eventually be Loading Loading @@ -7164,17 +7117,6 @@ public class AdapterService extends Service { Log.e(TAG, msg); Log.e(TAG, msg); } } private final BroadcastReceiver mAlarmBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { synchronized (AdapterService.this) { mPendingAlarm = null; alarmFiredNative(); } } }; private boolean isCommonCriteriaMode() { private boolean isCommonCriteriaMode() { return getNonNullSystemService(DevicePolicyManager.class).isCommonCriteriaModeEnabled(null); return getNonNullSystemService(DevicePolicyManager.class).isCommonCriteriaModeEnabled(null); } } Loading Loading @@ -7803,8 +7745,6 @@ public class AdapterService extends Service { /*package*/ /*package*/ native boolean factoryResetNative(); native boolean factoryResetNative(); private native void alarmFiredNative(); private native void dumpNative(FileDescriptor fd, String[] arguments); private native void dumpNative(FileDescriptor fd, String[] arguments); private native byte[] dumpMetricsNative(); private native byte[] dumpMetricsNative(); Loading system/btif/src/bluetooth.cc +0 −1 Original line number Original line Diff line number Diff line Loading @@ -999,7 +999,6 @@ static int release_wake_lock_cb(const char* lock_name) { static bt_os_callouts_t wakelock_os_callouts_jni = { static bt_os_callouts_t wakelock_os_callouts_jni = { sizeof(wakelock_os_callouts_jni), sizeof(wakelock_os_callouts_jni), nullptr /* not used */, acquire_wake_lock_cb, acquire_wake_lock_cb, release_wake_lock_cb, release_wake_lock_cb, }; }; Loading system/gd/rust/topshim/src/btif.rs +0 −1 Original line number Original line Diff line number Diff line Loading @@ -1124,7 +1124,6 @@ impl BluetoothInterface { // gd/rust/linux/stack. // gd/rust/linux/stack. let mut callouts = Box::new(bindings::bt_os_callouts_t { let mut callouts = Box::new(bindings::bt_os_callouts_t { size: std::mem::size_of::<bindings::bt_os_callouts_t>(), size: std::mem::size_of::<bindings::bt_os_callouts_t>(), set_wake_alarm: None, // Not used acquire_wake_lock: Some(wake_lock_noop), acquire_wake_lock: Some(wake_lock_noop), release_wake_lock: Some(wake_lock_noop), release_wake_lock: Some(wake_lock_noop), }); }); Loading system/include/hardware/bluetooth.h +0 −4 Original line number Original line Diff line number Diff line Loading @@ -603,9 +603,6 @@ typedef struct { le_rand_callback le_rand_cb; le_rand_callback le_rand_cb; } bt_callbacks_t; } bt_callbacks_t; typedef void (*alarm_cb)(void* data); typedef bool (*set_wake_alarm_callout)(uint64_t delay_millis, bool should_wake, alarm_cb cb, void* data); typedef int (*acquire_wake_lock_callout)(const char* lock_name); typedef int (*acquire_wake_lock_callout)(const char* lock_name); typedef int (*release_wake_lock_callout)(const char* lock_name); typedef int (*release_wake_lock_callout)(const char* lock_name); Loading @@ -617,7 +614,6 @@ typedef struct { /* set to sizeof(bt_os_callouts_t) */ /* set to sizeof(bt_os_callouts_t) */ size_t size; size_t size; set_wake_alarm_callout set_wake_alarm; acquire_wake_lock_callout acquire_wake_lock; acquire_wake_lock_callout acquire_wake_lock; release_wake_lock_callout release_wake_lock; release_wake_lock_callout release_wake_lock; } bt_os_callouts_t; } bt_os_callouts_t; Loading Loading
android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +3 −52 Original line number Original line Diff line number Diff line Loading @@ -79,7 +79,6 @@ static jmethodID method_discoveryStateChangeCallback; static jmethodID method_linkQualityReportCallback; static jmethodID method_linkQualityReportCallback; static jmethodID method_switchBufferSizeCallback; static jmethodID method_switchBufferSizeCallback; static jmethodID method_switchCodecCallback; static jmethodID method_switchCodecCallback; static jmethodID method_setWakeAlarm; static jmethodID method_acquireWakeLock; static jmethodID method_acquireWakeLock; static jmethodID method_releaseWakeLock; static jmethodID method_releaseWakeLock; static jmethodID method_energyInfo; static jmethodID method_energyInfo; Loading Loading @@ -845,12 +844,6 @@ static bt_callbacks_t sBluetoothCallbacks = {sizeof(sBluetoothCallbacks), switch_codec_callback, switch_codec_callback, le_rand_callback}; le_rand_callback}; // The callback to call when the wake alarm fires. static alarm_cb sAlarmCallback; // The data to pass to the wake alarm callback. static void* sAlarmCallbackData; class JNIThreadAttacher { class JNIThreadAttacher { public: public: JNIThreadAttacher(JavaVM* vm) : vm_(vm), env_(nullptr) { JNIThreadAttacher(JavaVM* vm) : vm_(vm), env_(nullptr) { Loading Loading @@ -897,37 +890,6 @@ class JNIThreadAttacher { jint status_; jint status_; }; }; static bool set_wake_alarm_callout(uint64_t delay_millis, bool should_wake, alarm_cb cb, void* data) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniAdapterServiceObj) { ALOGE("%s, JNI obj is null. Failed to call JNI callback", __func__); return false; } JNIThreadAttacher attacher(vm); JNIEnv* env = attacher.getEnv(); if (env == nullptr) { ALOGE("%s: Unable to get JNI Env", __func__); return false; } sAlarmCallback = cb; sAlarmCallbackData = data; jboolean jshould_wake = should_wake ? JNI_TRUE : JNI_FALSE; jboolean ret = env->CallBooleanMethod(sJniAdapterServiceObj, method_setWakeAlarm, (jlong)delay_millis, jshould_wake); if (!ret) { sAlarmCallback = NULL; sAlarmCallbackData = NULL; } return (ret == JNI_TRUE); } static int acquire_wake_lock_callout(const char* lock_name) { static int acquire_wake_lock_callout(const char* lock_name) { std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); std::shared_lock<std::shared_timed_mutex> lock(jniObjMutex); if (!sJniAdapterServiceObj) { if (!sJniAdapterServiceObj) { Loading Loading @@ -990,19 +952,10 @@ static int release_wake_lock_callout(const char* lock_name) { return ret; return ret; } } // Called by Java code when alarm is fired. A wake lock is held by the caller // over the duration of this callback. static void alarmFiredNative(JNIEnv* env, jobject obj) { if (sAlarmCallback) { sAlarmCallback(sAlarmCallbackData); } else { ALOGE("%s() - Alarm fired with callback not set!", __func__); } } static bt_os_callouts_t sBluetoothOsCallouts = { static bt_os_callouts_t sBluetoothOsCallouts = { sizeof(sBluetoothOsCallouts), set_wake_alarm_callout, sizeof(sBluetoothOsCallouts), acquire_wake_lock_callout, release_wake_lock_callout, acquire_wake_lock_callout, release_wake_lock_callout, }; }; int hal_util_load_bt_library(const bt_interface_t** interface) { int hal_util_load_bt_library(const bt_interface_t** interface) { Loading Loading @@ -1094,7 +1047,6 @@ static void classInitNative(JNIEnv* env, jclass clazz) { method_switchCodecCallback = method_switchCodecCallback = env->GetMethodID(jniCallbackClass, "switchCodecCallback", "(Z)V"); env->GetMethodID(jniCallbackClass, "switchCodecCallback", "(Z)V"); method_setWakeAlarm = env->GetMethodID(clazz, "setWakeAlarm", "(JZ)Z"); method_acquireWakeLock = method_acquireWakeLock = env->GetMethodID(clazz, "acquireWakeLock", "(Ljava/lang/String;)Z"); env->GetMethodID(clazz, "acquireWakeLock", "(Ljava/lang/String;)Z"); method_releaseWakeLock = method_releaseWakeLock = Loading Loading @@ -2229,7 +2181,6 @@ static JNINativeMethod sMethods[] = { {"pinReplyNative", "([BZI[B)Z", (void*)pinReplyNative}, {"pinReplyNative", "([BZI[B)Z", (void*)pinReplyNative}, {"sspReplyNative", "([BIZI)Z", (void*)sspReplyNative}, {"sspReplyNative", "([BIZI)Z", (void*)sspReplyNative}, {"getRemoteServicesNative", "([BI)Z", (void*)getRemoteServicesNative}, {"getRemoteServicesNative", "([BI)Z", (void*)getRemoteServicesNative}, {"alarmFiredNative", "()V", (void*)alarmFiredNative}, {"readEnergyInfo", "()I", (void*)readEnergyInfo}, {"readEnergyInfo", "()I", (void*)readEnergyInfo}, {"dumpNative", "(Ljava/io/FileDescriptor;[Ljava/lang/String;)V", {"dumpNative", "(Ljava/io/FileDescriptor;[Ljava/lang/String;)V", (void*)dumpNative}, (void*)dumpNative}, Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +0 −60 Original line number Original line Diff line number Diff line Loading @@ -40,7 +40,6 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.RequiresPermission; import android.annotation.SuppressLint; import android.annotation.SuppressLint; import android.app.AlarmManager; import android.app.AppOpsManager; import android.app.AppOpsManager; import android.app.PendingIntent; import android.app.PendingIntent; import android.app.Service; import android.app.Service; Loading Loading @@ -78,10 +77,8 @@ import android.bluetooth.OobData; import android.bluetooth.UidTraffic; import android.bluetooth.UidTraffic; import android.companion.CompanionDeviceManager; import android.companion.CompanionDeviceManager; import android.content.AttributionSource; import android.content.AttributionSource; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.os.AsyncTask; import android.os.AsyncTask; Loading Loading @@ -206,9 +203,6 @@ public class AdapterService extends Service { public static final String EXTRA_ACTION = "action"; public static final String EXTRA_ACTION = "action"; public static final int PROFILE_CONN_REJECTED = 2; public static final int PROFILE_CONN_REJECTED = 2; private static final String ACTION_ALARM_WAKEUP = "com.android.bluetooth.btservice.action.ALARM_WAKEUP"; private static BluetoothProperties.snoop_log_mode_values sSnoopLogSettingAtEnable = private static BluetoothProperties.snoop_log_mode_values sSnoopLogSettingAtEnable = BluetoothProperties.snoop_log_mode_values.EMPTY; BluetoothProperties.snoop_log_mode_values.EMPTY; private static String sDefaultSnoopLogSettingAtEnable = "empty"; private static String sDefaultSnoopLogSettingAtEnable = "empty"; Loading Loading @@ -341,8 +335,6 @@ public class AdapterService extends Service { private final Map<UUID, RfcommListenerData> mBluetoothServerSockets = new ConcurrentHashMap<>(); private final Map<UUID, RfcommListenerData> mBluetoothServerSockets = new ConcurrentHashMap<>(); private final Executor mSocketServersExecutor = r -> new Thread(r).start(); private final Executor mSocketServersExecutor = r -> new Thread(r).start(); private AlarmManager mAlarmManager; private PendingIntent mPendingAlarm; private BatteryStatsManager mBatteryStatsManager; private BatteryStatsManager mBatteryStatsManager; private PowerManager mPowerManager; private PowerManager mPowerManager; private PowerManager.WakeLock mWakeLock; private PowerManager.WakeLock mWakeLock; Loading Loading @@ -611,7 +603,6 @@ public class AdapterService extends Service { mUserManager = getNonNullSystemService(UserManager.class); mUserManager = getNonNullSystemService(UserManager.class); mAppOps = getNonNullSystemService(AppOpsManager.class); mAppOps = getNonNullSystemService(AppOpsManager.class); mAlarmManager = getNonNullSystemService(AlarmManager.class); mPowerManager = getNonNullSystemService(PowerManager.class); mPowerManager = getNonNullSystemService(PowerManager.class); mBatteryStatsManager = getNonNullSystemService(BatteryStatsManager.class); mBatteryStatsManager = getNonNullSystemService(BatteryStatsManager.class); mCompanionDeviceManager = getNonNullSystemService(CompanionDeviceManager.class); mCompanionDeviceManager = getNonNullSystemService(CompanionDeviceManager.class); Loading Loading @@ -665,9 +656,6 @@ public class AdapterService extends Service { mBluetoothQualityReportNativeInterface.init(); mBluetoothQualityReportNativeInterface.init(); mSdpManager = SdpManager.init(this); mSdpManager = SdpManager.init(this); IntentFilter filter = new IntentFilter(ACTION_ALARM_WAKEUP); filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); registerReceiver(mAlarmBroadcastReceiver, filter); loadLeAudioAllowDevices(); loadLeAudioAllowDevices(); mDatabaseManager = new DatabaseManager(this); mDatabaseManager = new DatabaseManager(this); Loading Loading @@ -1264,15 +1252,8 @@ public class AdapterService extends Service { mCleaningUp = true; mCleaningUp = true; invalidateBluetoothCaches(); invalidateBluetoothCaches(); unregisterReceiver(mAlarmBroadcastReceiver); stopRfcommServerSockets(); stopRfcommServerSockets(); if (mPendingAlarm != null) { mAlarmManager.cancel(mPendingAlarm); mPendingAlarm = null; } // This wake lock release may also be called concurrently by // This wake lock release may also be called concurrently by // {@link #releaseWakeLock(String lockName)}, so a synchronization is needed here. // {@link #releaseWakeLock(String lockName)}, so a synchronization is needed here. synchronized (this) { synchronized (this) { Loading Loading @@ -6876,34 +6857,6 @@ public class AdapterService extends Service { return -1; return -1; } } // This function is called from JNI. It allows native code to set a single wake // alarm. If an alarm is already pending and a new request comes in, the alarm // will be rescheduled (i.e. the previously set alarm will be cancelled). @RequiresPermission(android.Manifest.permission.SCHEDULE_EXACT_ALARM) private boolean setWakeAlarm(long delayMillis, boolean shouldWake) { synchronized (this) { if (mPendingAlarm != null) { mAlarmManager.cancel(mPendingAlarm); } long wakeupTime = SystemClock.elapsedRealtime() + delayMillis; int type = shouldWake ? AlarmManager.ELAPSED_REALTIME_WAKEUP : AlarmManager.ELAPSED_REALTIME; Intent intent = new Intent(ACTION_ALARM_WAKEUP); mPendingAlarm = PendingIntent.getBroadcast( this, 0, intent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE); mAlarmManager.setExact(type, wakeupTime, mPendingAlarm); return true; } } // This function is called from JNI. It allows native code to acquire a single wake lock. // This function is called from JNI. It allows native code to acquire a single wake lock. // If the wake lock is already held, this function returns success. Although this function // If the wake lock is already held, this function returns success. Although this function // only supports acquiring a single wake lock at a time right now, it will eventually be // only supports acquiring a single wake lock at a time right now, it will eventually be Loading Loading @@ -7164,17 +7117,6 @@ public class AdapterService extends Service { Log.e(TAG, msg); Log.e(TAG, msg); } } private final BroadcastReceiver mAlarmBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { synchronized (AdapterService.this) { mPendingAlarm = null; alarmFiredNative(); } } }; private boolean isCommonCriteriaMode() { private boolean isCommonCriteriaMode() { return getNonNullSystemService(DevicePolicyManager.class).isCommonCriteriaModeEnabled(null); return getNonNullSystemService(DevicePolicyManager.class).isCommonCriteriaModeEnabled(null); } } Loading Loading @@ -7803,8 +7745,6 @@ public class AdapterService extends Service { /*package*/ /*package*/ native boolean factoryResetNative(); native boolean factoryResetNative(); private native void alarmFiredNative(); private native void dumpNative(FileDescriptor fd, String[] arguments); private native void dumpNative(FileDescriptor fd, String[] arguments); private native byte[] dumpMetricsNative(); private native byte[] dumpMetricsNative(); Loading
system/btif/src/bluetooth.cc +0 −1 Original line number Original line Diff line number Diff line Loading @@ -999,7 +999,6 @@ static int release_wake_lock_cb(const char* lock_name) { static bt_os_callouts_t wakelock_os_callouts_jni = { static bt_os_callouts_t wakelock_os_callouts_jni = { sizeof(wakelock_os_callouts_jni), sizeof(wakelock_os_callouts_jni), nullptr /* not used */, acquire_wake_lock_cb, acquire_wake_lock_cb, release_wake_lock_cb, release_wake_lock_cb, }; }; Loading
system/gd/rust/topshim/src/btif.rs +0 −1 Original line number Original line Diff line number Diff line Loading @@ -1124,7 +1124,6 @@ impl BluetoothInterface { // gd/rust/linux/stack. // gd/rust/linux/stack. let mut callouts = Box::new(bindings::bt_os_callouts_t { let mut callouts = Box::new(bindings::bt_os_callouts_t { size: std::mem::size_of::<bindings::bt_os_callouts_t>(), size: std::mem::size_of::<bindings::bt_os_callouts_t>(), set_wake_alarm: None, // Not used acquire_wake_lock: Some(wake_lock_noop), acquire_wake_lock: Some(wake_lock_noop), release_wake_lock: Some(wake_lock_noop), release_wake_lock: Some(wake_lock_noop), }); }); Loading
system/include/hardware/bluetooth.h +0 −4 Original line number Original line Diff line number Diff line Loading @@ -603,9 +603,6 @@ typedef struct { le_rand_callback le_rand_cb; le_rand_callback le_rand_cb; } bt_callbacks_t; } bt_callbacks_t; typedef void (*alarm_cb)(void* data); typedef bool (*set_wake_alarm_callout)(uint64_t delay_millis, bool should_wake, alarm_cb cb, void* data); typedef int (*acquire_wake_lock_callout)(const char* lock_name); typedef int (*acquire_wake_lock_callout)(const char* lock_name); typedef int (*release_wake_lock_callout)(const char* lock_name); typedef int (*release_wake_lock_callout)(const char* lock_name); Loading @@ -617,7 +614,6 @@ typedef struct { /* set to sizeof(bt_os_callouts_t) */ /* set to sizeof(bt_os_callouts_t) */ size_t size; size_t size; set_wake_alarm_callout set_wake_alarm; acquire_wake_lock_callout acquire_wake_lock; acquire_wake_lock_callout acquire_wake_lock; release_wake_lock_callout release_wake_lock; release_wake_lock_callout release_wake_lock; } bt_os_callouts_t; } bt_os_callouts_t; Loading