| 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" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 jmethodID j_get_content_resolver_method = GetMethodID( | 44 jmethodID j_get_content_resolver_method = GetMethodID( |
| 45 env, clazz,"getContentResolver", "()Landroid/content/ContentResolver;"); | 45 env, clazz,"getContentResolver", "()Landroid/content/ContentResolver;"); |
| 46 jobject content_resolver = env->CallObjectMethod( | 46 jobject content_resolver = env->CallObjectMethod( |
| 47 GetApplicationContext(), j_get_content_resolver_method); | 47 GetApplicationContext(), j_get_content_resolver_method); |
| 48 CheckException(env); | 48 CheckException(env); |
| 49 return ScopedJavaLocalRef<jobject>(env, content_resolver); | 49 return ScopedJavaLocalRef<jobject>(env, content_resolver); |
| 50 } | 50 } |
| 51 | 51 |
| 52 } | 52 } |
| 53 | 53 |
| 54 namespace csync { | 54 namespace syncer { |
| 55 namespace internal { | 55 namespace internal { |
| 56 | 56 |
| 57 std::string GetAndroidId() { | 57 std::string GetAndroidId() { |
| 58 JNIEnv* env = AttachCurrentThread(); | 58 JNIEnv* env = AttachCurrentThread(); |
| 59 ScopedJavaLocalRef<jstring> android_id = | 59 ScopedJavaLocalRef<jstring> android_id = |
| 60 GetAndroidIdJNI(env, GetContentResolver(env)); | 60 GetAndroidIdJNI(env, GetContentResolver(env)); |
| 61 return ConvertJavaStringToUTF8(android_id); | 61 return ConvertJavaStringToUTF8(android_id); |
| 62 } | 62 } |
| 63 | 63 |
| 64 std::string GetModel() { | 64 std::string GetModel() { |
| 65 char model[PROP_VALUE_MAX]; | 65 char model[PROP_VALUE_MAX]; |
| 66 __system_property_get("ro.product.model", model); | 66 __system_property_get("ro.product.model", model); |
| 67 return model; | 67 return model; |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool IsTabletUi() { | 70 bool IsTabletUi() { |
| 71 NOTIMPLEMENTED() << "TODO(yfriedman): Upstream this"; | 71 NOTIMPLEMENTED() << "TODO(yfriedman): Upstream this"; |
| 72 return true; | 72 return true; |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace internal | 75 } // namespace internal |
| 76 } // namespace csync | 76 } // namespace syncer |
| OLD | NEW |