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

Commit 894aa6dd authored by Vance Yu's avatar Vance Yu Committed by William Escande
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.
Merged-In: I3adccd699e10fef79579880f0110ae8474f36955
Change-Id: I3adccd699e10fef79579880f0110ae8474f36955
(cherry picked from commit 6e9bd12e)
parent a3dcfa6b
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -194,7 +194,8 @@ import java.util.UUID;

    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 **/
    private Set<Connection> mConnections = new HashSet<Connection>();
@@ -244,10 +245,6 @@ import java.util.UUID;
                app = new App(appUid, callback, appName);
                mApps.add(app);
            }

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