OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <jni.h> | 5 #include <jni.h> |
6 #include <sys/system_properties.h> | 6 #include <sys/system_properties.h> |
7 | 7 |
8 #include "sync/util/session_utils_android.h" | 8 #include "sync/util/session_utils_android.h" |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
11 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 | 14 |
15 using base::android::AttachCurrentThread; | 15 using base::android::AttachCurrentThread; |
16 using base::android::CheckException; | 16 using base::android::CheckException; |
17 using base::android::ConvertUTF8ToJavaString; | 17 using base::android::ConvertUTF8ToJavaString; |
18 using base::android::GetApplicationContext; | 18 using base::android::GetApplicationContext; |
19 using base::android::GetClass; | 19 using base::android::GetClass; |
| 20 using base::android::JavaRef; |
20 using base::android::MethodID; | 21 using base::android::MethodID; |
21 using base::android::JavaRef; | |
22 using base::android::ScopedJavaLocalRef; | 22 using base::android::ScopedJavaLocalRef; |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 ScopedJavaLocalRef<jstring> GetAndroidIdJNI( | 26 ScopedJavaLocalRef<jstring> GetAndroidIdJNI( |
27 JNIEnv* env, const JavaRef<jobject>& content_resolver) { | 27 JNIEnv* env, const JavaRef<jobject>& content_resolver) { |
28 ScopedJavaLocalRef<jclass> clazz( | 28 ScopedJavaLocalRef<jclass> clazz( |
29 GetClass(env, "android/provider/Settings$Secure")); | 29 GetClass(env, "android/provider/Settings$Secure")); |
30 jmethodID j_get_string = MethodID::Get<MethodID::TYPE_STATIC>( | 30 jmethodID j_get_string = MethodID::Get<MethodID::TYPE_STATIC>( |
31 env, clazz.obj(), "getString", | 31 env, clazz.obj(), "getString", |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 std::string GetModel() { | 68 std::string GetModel() { |
69 char model[PROP_VALUE_MAX]; | 69 char model[PROP_VALUE_MAX]; |
70 __system_property_get("ro.product.model", model); | 70 __system_property_get("ro.product.model", model); |
71 return model; | 71 return model; |
72 } | 72 } |
73 | 73 |
74 } // namespace internal | 74 } // namespace internal |
75 } // namespace syncer | 75 } // namespace syncer |
OLD | NEW |