| Index: chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAServiceClient.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAServiceClient.java b/chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAServiceClient.java
|
| index 44ddeabd01cf46032143d55b7d83605bed6f492f..17dbf535fa9b3e7ab7dff674c6743f0cbc380180 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAServiceClient.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAServiceClient.java
|
| @@ -9,7 +9,6 @@ import android.content.Context;
|
| import android.content.Intent;
|
| import android.content.ServiceConnection;
|
| import android.os.Bundle;
|
| -import android.os.Handler;
|
| import android.os.IBinder;
|
| import android.os.Message;
|
| import android.os.Messenger;
|
| @@ -18,6 +17,7 @@ import android.util.Log;
|
|
|
| import org.chromium.base.annotations.SuppressFBWarnings;
|
| import org.chromium.chrome.browser.ChromeApplication;
|
| +import org.chromium.chrome.browser.TidyHandler;
|
|
|
| /**
|
| * A simple client that connects and talks to the GSAService using Messages.
|
| @@ -39,7 +39,7 @@ public class GSAServiceClient {
|
| public static final String KEY_GSA_PACKAGE_NAME = "ssb_service:ssb_package_name";
|
|
|
| /** Messenger to handle incoming messages from the service */
|
| - private final Messenger mMessenger = new Messenger(new IncomingHandler());
|
| + private final Messenger mMessenger = new Messenger(new IncomingHandler(this));
|
| private final GSAServiceConnection mConnection;
|
| private final GSAHelper mGsaHelper;
|
| private Context mContext;
|
| @@ -47,22 +47,27 @@ public class GSAServiceClient {
|
| /** Messenger for communicating with service. */
|
| private Messenger mService;
|
|
|
| -
|
| /**
|
| - * Handler of incoming messages from service.
|
| + * Handler of incoming messages from a service.
|
| */
|
| @SuppressFBWarnings("BC_IMPOSSIBLE_CAST")
|
| - private class IncomingHandler extends Handler {
|
| + private static class IncomingHandler extends TidyHandler<GSAServiceClient> {
|
| +
|
| + public IncomingHandler(GSAServiceClient instance) {
|
| + super(instance);
|
| + }
|
| +
|
| @Override
|
| - public void handleMessage(Message msg) {
|
| + public void handleMessage(Message msg, GSAServiceClient instance) {
|
| if (msg.what == RESPONSE_UPDATE_SSB) {
|
| - if (mService == null) return;
|
| + if (instance.mService == null) return;
|
| Bundle bundle = (Bundle) msg.obj;
|
| - String account =
|
| - mGsaHelper.getGSAAccountFromState(bundle.getByteArray(KEY_GSA_STATE));
|
| - GSAState.getInstance(mContext.getApplicationContext()).setGsaAccount(account);
|
| + String account = instance.mGsaHelper
|
| + .getGSAAccountFromState(bundle.getByteArray(KEY_GSA_STATE));
|
| + GSAState.getInstance(instance.mContext.getApplicationContext())
|
| + .setGsaAccount(account);
|
| } else {
|
| - super.handleMessage(msg);
|
| + baseHandlerHandleMessage(msg);
|
| }
|
| }
|
| }
|
|
|