Commit 421558d4 authored by Tiger Oakes's avatar Tiger Oakes Committed by Commit Bot

Removed context#getApplicationContext calls from /components/gcm_driver

Continuation of work in bug 646094.

This CL was uploaded by git cl split.

R=jianli@chromium.org

Bug: 846456
Change-Id: Ife19a981980ee18798721000d8d12d8730231e12
Reviewed-on: https://chromium-review.googlesource.com/1095991Reviewed-by: default avatarJian Li <jianli@chromium.org>
Commit-Queue: Tiger Oakes <tigero@google.com>
Cr-Commit-Position: refs/heads/master@{#566398}
parent 0352377a
......@@ -7,7 +7,6 @@ package org.chromium.components.gcm_driver.instance_id;
import android.os.AsyncTask;
import android.os.Bundle;
import org.chromium.base.ContextUtils;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
......@@ -193,8 +192,7 @@ public class InstanceIDBridge {
protected Result doInBackground(Void... params) {
synchronized (InstanceIDBridge.this) {
if (mInstanceID == null) {
mInstanceID = InstanceIDWithSubtype.getInstance(
ContextUtils.getApplicationContext(), mSubtype);
mInstanceID = InstanceIDWithSubtype.getInstance(mSubtype);
}
}
return doBackgroundWork();
......
......@@ -10,6 +10,7 @@ import android.text.TextUtils;
import com.google.android.gms.iid.InstanceID;
import org.chromium.base.ContextUtils;
import org.chromium.base.VisibleForTesting;
import java.io.IOException;
......@@ -45,11 +46,10 @@ public class InstanceIDWithSubtype {
* Returns an instance of this class. Unlike {@link InstanceID#getInstance(Context)}, it is not
* a singleton, but instead a different instance will be returned for each {@code subtype}.
*/
public static InstanceIDWithSubtype getInstance(Context context, String subtype) {
public static InstanceIDWithSubtype getInstance(String subtype) {
if (TextUtils.isEmpty(subtype)) {
throw new IllegalArgumentException("subtype must not be empty");
}
context = context.getApplicationContext();
synchronized (sSubtypeInstancesLock) {
InstanceIDWithSubtype existing = sSubtypeInstances.get(subtype);
......@@ -59,7 +59,8 @@ public class InstanceIDWithSubtype {
} else {
Bundle options = new Bundle();
options.putCharSequence(OPTION_SUBTYPE, subtype);
InstanceID instanceID = InstanceID.getInstance(context, options);
InstanceID instanceID =
InstanceID.getInstance(ContextUtils.getApplicationContext(), options);
existing = new InstanceIDWithSubtype(instanceID);
}
sSubtypeInstances.put(subtype, existing);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment