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

Commit 6e9bd12e authored by Vance Yu's avatar Vance Yu Committed by Jayden Kim
Browse files

Fix the BT settings is crashing after Toggle OFF/ON

Fix java NullPointerException since some object was not created
when users didn't performed BLE advertising.

Bug: 213610155
Bug: 242230899
Tag: #stability
Test: turn on/off Bluetooth in the setting then check if Bluetooth crashes happen.
Ignore-AOSP-First: patch for wear os
Change-Id: I3adccd699e10fef79579880f0110ae8474f36955
parent e6977064
Loading
Loading
Loading
Loading
+5 −6
Original line number Original line Diff line number Diff line
@@ -195,7 +195,8 @@ import java.util.UUID;


    private static final int ADVERTISE_STATE_MAX_SIZE = 5;
    private static final int ADVERTISE_STATE_MAX_SIZE = 5;


    private EvictingQueue<AppAdvertiseStats> mLastAdvertises;
    private final EvictingQueue<AppAdvertiseStats> mLastAdvertises =
            EvictingQueue.create(ADVERTISE_STATE_MAX_SIZE);


    /** Internal list of connected devices **/
    /** Internal list of connected devices **/
    private Set<Connection> mConnections = new HashSet<Connection>();
    private Set<Connection> mConnections = new HashSet<Connection>();
@@ -246,10 +247,6 @@ import java.util.UUID;
                app = new App(appUid, callback, appName);
                app = new App(appUid, callback, appName);
                mApps.add(app);
                mApps.add(app);
            }
            }

            if (mLastAdvertises == null) {
                mLastAdvertises = EvictingQueue.create(ADVERTISE_STATE_MAX_SIZE);
            }
            return app;
            return app;
        }
        }
    }
    }
@@ -630,7 +627,9 @@ import java.util.UUID;
            while (i.hasNext()) {
            while (i.hasNext()) {
                App entry = i.next();
                App entry = i.next();
                entry.unlinkToDeath();
                entry.unlinkToDeath();
                if (entry.appScanStats != null) {
                    entry.appScanStats.isRegistered = false;
                    entry.appScanStats.isRegistered = false;
                }
                i.remove();
                i.remove();
            }
            }
        }
        }