| OLD | NEW |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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 "services/device/android/register_jni.h" | 5 #include "services/device/android/register_jni.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "services/device/generic_sensor/android/sensors_jni_registrar.h" |
| 8 #include "services/device/time_zone_monitor/android/time_zone_monitor_jni_regist
rar.h" | 9 #include "services/device/time_zone_monitor/android/time_zone_monitor_jni_regist
rar.h" |
| 9 | 10 |
| 10 namespace device { | 11 namespace device { |
| 11 | 12 |
| 12 bool EnsureJniRegistered() { | 13 bool EnsureJniRegistered() { |
| 13 static bool g_jni_init_done = false; | 14 static bool g_jni_init_done = false; |
| 14 | 15 |
| 15 if (!g_jni_init_done) { | 16 if (!g_jni_init_done) { |
| 16 JNIEnv* env = base::android::AttachCurrentThread(); | 17 JNIEnv* env = base::android::AttachCurrentThread(); |
| 17 | 18 |
| 19 if (!android::RegisterSensorsJni(env)) |
| 20 return false; |
| 21 |
| 18 if (!android::RegisterTimeZoneMonitorJni(env)) | 22 if (!android::RegisterTimeZoneMonitorJni(env)) |
| 19 return false; | 23 return false; |
| 20 | 24 |
| 21 g_jni_init_done = true; | 25 g_jni_init_done = true; |
| 22 } | 26 } |
| 23 | 27 |
| 24 return true; | 28 return true; |
| 25 } | 29 } |
| 26 | 30 |
| 27 } // namespace device | 31 } // namespace device |
| OLD | NEW |