Only call requestUnbind if we are connected.

Somethimes onSettingChanged can come after the connected has disconnected because
of posting message on the different thread.

Bug: 110929527
Change-Id: I09f503c2f2f437c8656d491a7fdec3ce4e82257b
This commit is contained in:
Sunny Goyal
2018-07-09 15:08:03 -07:00
parent ce368154ce
commit 7edf3d3f9a

View File

@@ -197,7 +197,7 @@ public class NotificationListener extends NotificationListenerService {
mNotificationBadgingObserver = new SettingsObserver.Secure(getContentResolver()) {
@Override
public void onSettingChanged(boolean isNotificationBadgingEnabled) {
if (!isNotificationBadgingEnabled) {
if (!isNotificationBadgingEnabled && sIsConnected) {
requestUnbind();
}
}