Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Side by Side Diff: components/proximity_auth/proximity_monitor_impl.cc

Issue 2861913002: [EasyUnlock] Fix crash when the same user pod is refocused. (Closed)
Patch Set: fixes Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/proximity_auth/proximity_auth_system_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/proximity_auth/proximity_monitor_impl.h" 5 #include "components/proximity_auth/proximity_monitor_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 weight * connection_info.rssi + (1 - weight) * (*rssi_rolling_average_); 185 weight * connection_info.rssi + (1 - weight) * (*rssi_rolling_average_);
186 } 186 }
187 187
188 CheckForProximityStateChange(); 188 CheckForProximityStateChange();
189 } 189 }
190 190
191 void ProximityMonitorImpl::CheckForProximityStateChange() { 191 void ProximityMonitorImpl::CheckForProximityStateChange() {
192 bool is_now_in_proximity = 192 bool is_now_in_proximity =
193 rssi_rolling_average_ && *rssi_rolling_average_ > kRssiThreshold; 193 rssi_rolling_average_ && *rssi_rolling_average_ > kRssiThreshold;
194 194
195 if (rssi_rolling_average_) { 195 if (rssi_rolling_average_)
196 LOG(WARNING) << "RSSI: " << *rssi_rolling_average_; 196 PA_LOG(INFO) << " Rolling RSSI: " << *rssi_rolling_average_;
197 }
198 197
199 if (remote_device_is_in_proximity_ != is_now_in_proximity) { 198 if (remote_device_is_in_proximity_ != is_now_in_proximity) {
200 PA_LOG(INFO) << "[Proximity] Updated proximity state: " 199 PA_LOG(INFO) << "[Proximity] Updated proximity state: "
201 << (is_now_in_proximity ? "proximate" : "distant"); 200 << (is_now_in_proximity ? "proximate" : "distant");
202 remote_device_is_in_proximity_ = is_now_in_proximity; 201 remote_device_is_in_proximity_ = is_now_in_proximity;
203 for (auto& observer : observers_) 202 for (auto& observer : observers_)
204 observer.OnProximityStateChanged(); 203 observer.OnProximityStateChanged();
205 } 204 }
206 } 205 }
207 206
208 } // namespace proximity_auth 207 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/proximity_auth/proximity_auth_system_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698