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

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java

Issue 2228783002: [Remoting Android] Fix component build runtime error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 package org.chromium.chromoting.jni; 5 package org.chromium.chromoting.jni;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 8
9 import org.chromium.base.ContextUtils; 9 import org.chromium.base.ContextUtils;
10 import org.chromium.base.Log; 10 import org.chromium.base.Log;
11 import org.chromium.base.annotations.CalledByNative; 11 import org.chromium.base.annotations.CalledByNative;
12 import org.chromium.base.annotations.JNINamespace; 12 import org.chromium.base.annotations.JNINamespace;
13 import org.chromium.chromoting.OAuthTokenConsumer; 13 import org.chromium.chromoting.OAuthTokenConsumer;
14 import org.chromium.chromoting.base.OAuthTokenFetcher; 14 import org.chromium.chromoting.base.OAuthTokenFetcher;
15 15
16 /** 16 /**
17 * Initializes the Chromium remoting library, and provides JNI calls into it. 17 * Initializes the Chromium remoting library, and provides JNI calls into it.
18 * All interaction with the native code is centralized in this class. 18 * All interaction with the native code is centralized in this class.
19 */ 19 */
20 @JNINamespace("remoting") 20 @JNINamespace("remoting")
21 public class JniInterface { 21 public class JniInterface {
22 private static final String TAG = "Chromoting"; 22 private static final String TAG = "Chromoting";
23 23
24 private static final String TOKEN_SCOPE = "oauth2:https://www.googleapis.com /auth/chromoting"; 24 private static final String TOKEN_SCOPE = "oauth2:https://www.googleapis.com /auth/chromoting";
25 25
26 private static final String JNI_LIB_NAME = "remoting_client_jni";
Lambros 2016/08/09 00:51:54 Maybe just LIBRARY_NAME ?
Yuwei 2016/08/09 00:56:17 Done.
27
26 // Used to fetch auth token for native client. 28 // Used to fetch auth token for native client.
27 private static OAuthTokenConsumer sLoggerTokenConsumer; 29 private static OAuthTokenConsumer sLoggerTokenConsumer;
28 30
29 private static String sAccount; 31 private static String sAccount;
30 32
31 /** 33 /**
32 * To be called once from the Application context singleton. Loads and initi alizes the native 34 * To be called once from the Application context singleton. Loads and initi alizes the native
33 * code. Called on the UI thread. 35 * code. Called on the UI thread.
34 * @param context The Application context. 36 * @param context The Application context.
35 */ 37 */
36 public static void loadLibrary(Context context) { 38 public static void loadLibrary(Context context) {
37 ContextUtils.initApplicationContext(context.getApplicationContext()); 39 ContextUtils.initApplicationContext(context.getApplicationContext());
38 sLoggerTokenConsumer = new OAuthTokenConsumer(context.getApplicationCont ext(), TOKEN_SCOPE); 40 sLoggerTokenConsumer = new OAuthTokenConsumer(context.getApplicationCont ext(), TOKEN_SCOPE);
39 System.loadLibrary("remoting_client_jni"); 41 try {
42 System.loadLibrary(JNI_LIB_NAME);
43 } catch (UnsatisfiedLinkError e) {
44 Log.w(TAG, "Couldn't load " + JNI_LIB_NAME + ", trying " + JNI_LIB_N AME + ".cr");
45 System.loadLibrary(JNI_LIB_NAME + ".cr");
46 }
40 ContextUtils.initApplicationContextForNative(); 47 ContextUtils.initApplicationContextForNative();
41 nativeLoadNative(); 48 nativeLoadNative();
42 } 49 }
43 50
44 public static void setAccountForLogging(String account) { 51 public static void setAccountForLogging(String account) {
45 sAccount = account; 52 sAccount = account;
46 } 53 }
47 54
48 @CalledByNative 55 @CalledByNative
49 private static void fetchAuthToken() { 56 private static void fetchAuthToken() {
(...skipping 12 matching lines...) Expand all
62 } 69 }
63 }); 70 });
64 } 71 }
65 72
66 /** Performs the native portion of the initialization. */ 73 /** Performs the native portion of the initialization. */
67 private static native void nativeLoadNative(); 74 private static native void nativeLoadNative();
68 75
69 /** Notifies the native client with the new auth token */ 76 /** Notifies the native client with the new auth token */
70 private static native void nativeOnAuthTokenFetched(String token); 77 private static native void nativeOnAuthTokenFetched(String token);
71 } 78 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698