Reland of moves usage of native base::android::GetApplicationContext() (patchset #1 id:1 of https://codereview.webrtc.org/2894593002/ )

Reason for revert:
Fix issue.

Original issue's description:
> Revert of Removes usage of native base::android::GetApplicationContext() (patchset #6 id:120001 of https://codereview.webrtc.org/2888093004/ )
>
> Reason for revert:
> Breaks bot on chromium.webrtc.fyi.
>
> Original issue's description:
> > Removes usage of native base::android::GetApplicationContext()
> >
> > BUG=webrtc:7665
> >
> > Review-Url: https://codereview.webrtc.org/2888093004
> > Cr-Commit-Position: refs/heads/master@{#18195}
> > Committed: bc83e2ee69
>
> TBR=magjed@webrtc.org,henrika@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7665
>
> Review-Url: https://codereview.webrtc.org/2894593002
> Cr-Commit-Position: refs/heads/master@{#18196}
> Committed: 40d224814a

BUG=webrtc:7665

Review-Url: https://codereview.webrtc.org/2889183002
Cr-Commit-Position: refs/heads/master@{#18235}
This commit is contained in:
sakal
2017-05-23 07:34:17 -07:00
committed by Commit bot
parent 18d023f9ee
commit 7855fff5bf
17 changed files with 178 additions and 54 deletions

View File

@ -10,6 +10,7 @@
package org.webrtc;
import android.content.Context;
import java.util.List;
/**
@ -30,6 +31,7 @@ public class PeerConnectionFactory {
private static final String TAG = "PeerConnectionFactory";
private final long nativeFactory;
private static Context applicationContext;
private static Thread networkThread;
private static Thread workerThread;
private static Thread signalingThread;
@ -52,14 +54,19 @@ public class PeerConnectionFactory {
// Must be called at least once before creating a PeerConnectionFactory
// (for example, at application startup time).
public static native void initializeAndroidGlobals(
android.content.Context context, boolean videoHwAcceleration);
public static native void nativeInitializeAndroidGlobals(
Context context, boolean videoHwAcceleration);
public static void initializeAndroidGlobals(Context context, boolean videoHwAcceleration) {
ContextUtils.initialize(context);
nativeInitializeAndroidGlobals(context, videoHwAcceleration);
}
// Older signature of initializeAndroidGlobals. The extra parameters are now meaningless.
@Deprecated
public static boolean initializeAndroidGlobals(Object context, boolean initializeAudio,
boolean initializeVideo, boolean videoHwAcceleration) {
initializeAndroidGlobals((android.content.Context) context, videoHwAcceleration);
initializeAndroidGlobals((Context) context, videoHwAcceleration);
return true;
}