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

Commit 14fb81af authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Fix for 2221718: Hang in BatteryStatsService.noteBluetoothOn

This should remove the deadlock. I'm not absolutely positive that
it fixes it, as it's not easy to reproduce.
parent 67b69292
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.am;

import android.bluetooth.BluetoothHeadset;
import android.content.Context;
import android.os.Binder;
import android.os.IBinder;
@@ -23,7 +24,6 @@ import android.os.Parcel;
import android.os.Process;
import android.os.ServiceManager;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
import android.util.Log;

import com.android.internal.app.IBatteryStats;
@@ -263,9 +263,10 @@ public final class BatteryStatsService extends IBatteryStats.Stub {

    public void noteBluetoothOn() {
        enforceCallingPermission();
        BluetoothHeadset headset = new BluetoothHeadset(mContext, null);
        synchronized (mStats) {
            mStats.noteBluetoothOnLocked();
            mStats.setBtHeadset(new android.bluetooth.BluetoothHeadset(mContext, null));
            mStats.setBtHeadset(headset);
        }
    }