OSDN Git Service

Add null pointer checks when updating A2DP configuration values
authorPavlin Radoslavov <pavlin@google.com>
Fri, 10 Feb 2017 20:52:04 +0000 (12:52 -0800)
committerPavlin Radoslavov <pavlin@google.com>
Fri, 10 Feb 2017 20:52:04 +0000 (12:52 -0800)
commitc851f854bbb0ec671270ff54e75b4a01f02f9281
tree226f3e4ab6ee4e83464bface5230af3d683f8038
parentb65c7fc810629443bfae4c7ac164dce442cafb83
Add null pointer checks when updating A2DP configuration values

Under expected circumstances, those null pointer checks are not
needed: onCreate() is always called before onCreateView(),
and the former creates the objects: mBluetoothSelectA2dpCodec,
mBluetoothSelectA2dpSampleRate, mBluetoothSelectA2dpBitsPerSample,
mBluetoothSelectA2dpChannelMode, mBluetoothSelectA2dpLdacPlaybackQuality .

For some unknown reason, somehow the following chain of calls is executed
before onCreate() :
  onCreateView() ->
  getActivity().registerReceiver(mBluetoothA2dpReceiver, ...) ->
  mBluetoothA2dpReceiver.onReceive(...) ->
  updateBluetoothA2dpConfigurationValues()

Adding the null pointer checks until the issue is understood.

Test: Code compilation
Bug: 35204511
Change-Id: I7c1d81015e66b26544b7b26f36cbc75f11713496
src/com/android/settings/DevelopmentSettings.java