OLD | NEW |
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.sync.signin; | 5 package org.chromium.sync.signin; |
6 | 6 |
7 import android.accounts.Account; | 7 import android.accounts.Account; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.os.AsyncTask; | 9 import android.os.AsyncTask; |
10 import android.preference.PreferenceManager; | 10 import android.preference.PreferenceManager; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 * Registers for Google Cloud Messaging (GCM) if there is no existing regist
ration. | 123 * Registers for Google Cloud Messaging (GCM) if there is no existing regist
ration. |
124 */ | 124 */ |
125 public void ensureGcmIsInitialized() { | 125 public void ensureGcmIsInitialized() { |
126 if (mGcmInitialized) return; | 126 if (mGcmInitialized) return; |
127 mGcmInitialized = true; | 127 mGcmInitialized = true; |
128 new AsyncTask<Void, Void, Void>() { | 128 new AsyncTask<Void, Void, Void>() { |
129 @Override | 129 @Override |
130 protected Void doInBackground(Void... arg0) { | 130 protected Void doInBackground(Void... arg0) { |
131 try { | 131 try { |
132 String regId = MultiplexingGcmListener.initializeGcm(mApplic
ationContext); | 132 String regId = MultiplexingGcmListener.initializeGcm(mApplic
ationContext); |
133 if (!regId.isEmpty()) | 133 if (!regId.isEmpty()) Log.d(TAG, "Already registered with GC
M"); |
134 Log.d(TAG, "Already registered with GCM"); | |
135 } catch (IllegalStateException exception) { | 134 } catch (IllegalStateException exception) { |
136 Log.w(TAG, "Application manifest does not correctly configur
e GCM; " | 135 Log.w(TAG, "Application manifest does not correctly configur
e GCM; " |
137 + "sync notifications will not work", exception); | 136 + "sync notifications will not work", exception); |
138 } catch (UnsupportedOperationException exception) { | 137 } catch (UnsupportedOperationException exception) { |
139 Log.w(TAG, "Device does not support GCM; sync notifications
will not work", | 138 Log.w(TAG, "Device does not support GCM; sync notifications
will not work", |
140 exception); | 139 exception); |
141 } | 140 } |
142 return null; | 141 return null; |
143 } | 142 } |
144 }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); | 143 }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); |
145 } | 144 } |
146 } | 145 } |
OLD | NEW |