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

Commit 60dce691 authored by Matadeen Mishra's avatar Matadeen Mishra Committed by Gerrit - the friendly Code Review server
Browse files

Bluetooth: Fix to display Paired Devices when Settings App is killed

Whenever Settings process is killed,the bonded devices is erased.
After it starts, UI doesn't show any paired devices as the list is empty.

CRs-Fixed: 949161
Change-Id: I2fb2c7f8667e1c5cbe1eb3ac779f81947ad900b5
parent 739f7ac3
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -59,8 +59,6 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    <string name="def_wifi_wifihotspot_pass" translatable="false"></string>
    <!-- Default wi-fi direct name -->
    <string name="def_wifi_direct_name" translatable="false"></string>
    <!-- Setting customize default bluetooth name -->
    <string name="def_custom_bt_defname"></string>
    <!-- custom date format or not  -->
    <bool name="config_dateformat">false</bool>
</resources>
+0 −1
Original line number Diff line number Diff line
@@ -2405,7 +2405,6 @@
  <java-symbol type="integer" name="wifi_hotspot_security_type" />
  <java-symbol type="string" name="def_wifi_wifihotspot_pass" />
  <java-symbol type="string" name="def_wifi_direct_name" />
  <java-symbol type="string" name="def_custom_bt_defname" />
  <!-- config 2G/3G/4G RAT strings for carriers -->
  <java-symbol type="string" name="config_rat_unknown" />
  <java-symbol type="string" name="config_rat_2g" />
+0 −23
Original line number Diff line number Diff line
@@ -110,7 +110,6 @@ public final class BluetoothEventManager {
        addHandler(Intent.ACTION_DOCK_EVENT, new DockEventHandler());

        mContext.registerReceiver(mBroadcastReceiver, mAdapterIntentFilter, null, mReceiverHandler);
        setDefaultBtName();
    }

    void registerProfileIntentReceiver() {
@@ -124,25 +123,6 @@ public final class BluetoothEventManager {
        registerProfileIntentReceiver();
    }

    // set bluetooth default name
    private void setDefaultBtName() {
        String name = mContext.getResources().getString(
            com.android.internal.R.string.def_custom_bt_defname);
        boolean needSet = !TextUtils.isEmpty(name);
        Log.d(TAG, "custom bluetooth name: " + name);
        // This flag is to only set default bluetooth name once.
        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext);
        boolean notSet = preferences.getBoolean("is_first_boot",true);
        // only bluetooth state is on, set name will success, or, it will fail.
        boolean okToSet = mLocalAdapter.getBluetoothState() == BluetoothAdapter.STATE_ON;
        if (needSet && notSet && okToSet) {
            mLocalAdapter.setName(name);
            SharedPreferences.Editor edit = preferences.edit();
            edit.putBoolean("is_first_boot",false);
            edit.apply();
        }
    }

    /** Register to start receiving callbacks for Bluetooth events. */
    public void registerCallback(BluetoothCallback callback) {
        synchronized (mCallbacks) {
@@ -178,9 +158,6 @@ public final class BluetoothEventManager {
                                    BluetoothAdapter.ERROR);
            // update local profiles and get paired devices
            mLocalAdapter.setBluetoothStateInt(state);
            if (state == BluetoothAdapter.STATE_ON) {
                setDefaultBtName();
            }
            // send callback to update UI and possibly start scanning
            synchronized (mCallbacks) {
                for (BluetoothCallback callback : mCallbacks) {