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

Commit 653235b3 authored by Gaurav Asati's avatar Gaurav Asati
Browse files

Bluetooth: Add NULL check before accessing Profile data

Add NULL check for profile data before accessing them
in case of stopping the profile.Framework test activity
and BT both can start service hence while clean-up check
for null.

This check is added for A2DP, HDP, HFP-AG and HFP client
profiles.
CRs-Fixed: 597242

Change-Id: I4a1f35842084bc6ae1b496adbe0b20cf7d1d68ef
parent c107026b
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -67,8 +67,12 @@ public class A2dpService extends ProfileService {
    }

    protected boolean stop() {
        if (mStateMachine != null) {
            mStateMachine.doQuit();
        }
        if (mAvrcp != null) {
            mAvrcp.doQuit();
        }
        return true;
    }

+6 −4
Original line number Diff line number Diff line
@@ -100,11 +100,13 @@ public class HealthService extends ProfileService {
    }

    protected boolean stop() {
        if(mHandler != null) {
            mHandler.removeCallbacksAndMessages(null);
            Looper looper = mHandler.getLooper();
            if (looper != null) {
                looper.quit();
            }
        }
        cleanupApps();
        return true;
    }
+3 −1
Original line number Diff line number Diff line
@@ -81,7 +81,9 @@ public class HeadsetService extends ProfileService {
        } catch (Exception e) {
            Log.w(TAG,"Unable to unregister headset receiver",e);
        }
        if (mStateMachine != null) {
            mStateMachine.doQuit();
        }
        return true;
    }

+3 −1
Original line number Diff line number Diff line
@@ -81,7 +81,9 @@ public class HandsfreeClientService extends ProfileService {
        } catch (Exception e) {
            Log.w(TAG, "Unable to unregister broadcast receiver", e);
        }
        if (mStateMachine != null) {
            mStateMachine.doQuit();
        }
        return true;
    }