blob: c18fe0e428c41090ffd4a2759085c059ae34bd0e [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.server;
18
Amith Yamasani8fd96ec2012-09-21 17:48:49 -070019import android.app.ActivityManagerNative;
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -070020import android.appwidget.AppWidgetProviderInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.content.BroadcastReceiver;
22import android.content.ComponentName;
23import android.content.Context;
24import android.content.Intent;
25import android.content.IntentFilter;
Winson Chung81f39eb2011-01-11 18:05:01 -080026import android.content.pm.PackageManager;
Amith Yamasani8fd96ec2012-09-21 17:48:49 -070027import android.os.Binder;
Adam Cohene8724c82012-04-19 17:11:40 -070028import android.os.Bundle;
Winson Chung81f39eb2011-01-11 18:05:01 -080029import android.os.IBinder;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.os.RemoteException;
Dianne Hackborn41203752012-08-31 14:05:51 -070031import android.os.UserHandle;
Joe Onorato8a9b2202010-02-26 18:56:32 -080032import android.util.Slog;
Amith Yamasani742a6712011-05-04 14:49:28 -070033import android.util.SparseArray;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.widget.RemoteViews;
35
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -070036import com.android.internal.appwidget.IAppWidgetHost;
Winson Chung81f39eb2011-01-11 18:05:01 -080037import com.android.internal.appwidget.IAppWidgetService;
Amith Yamasani8320de82012-10-05 16:10:38 -070038import com.android.internal.util.IndentingPrintWriter;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039
Adam Cohen97300312011-10-12 15:48:13 -070040import java.io.FileDescriptor;
Adam Cohen97300312011-10-12 15:48:13 -070041import java.io.PrintWriter;
Adam Cohen97300312011-10-12 15:48:13 -070042import java.util.List;
43import java.util.Locale;
44
Amith Yamasani742a6712011-05-04 14:49:28 -070045
46/**
47 * Redirects calls to this service to the instance of the service for the appropriate user.
48 */
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -070049class AppWidgetService extends IAppWidgetService.Stub
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050{
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -070051 private static final String TAG = "AppWidgetService";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053 Context mContext;
Eric Fischer63c2d9e2009-10-22 15:22:50 -070054 Locale mLocale;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080055 PackageManager mPackageManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056 boolean mSafeMode;
57
Amith Yamasani742a6712011-05-04 14:49:28 -070058 private final SparseArray<AppWidgetServiceImpl> mAppWidgetServices;
Adam Cohen7bb98832011-10-05 18:10:13 -070059
The Android Open Source Projectc39a6e02009-03-11 12:11:56 -070060 AppWidgetService(Context context) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061 mContext = context;
Amith Yamasani742a6712011-05-04 14:49:28 -070062 mAppWidgetServices = new SparseArray<AppWidgetServiceImpl>(5);
63 AppWidgetServiceImpl primary = new AppWidgetServiceImpl(context, 0);
64 mAppWidgetServices.append(0, primary);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080065 }
66
67 public void systemReady(boolean safeMode) {
68 mSafeMode = safeMode;
69
Amith Yamasani742a6712011-05-04 14:49:28 -070070 mAppWidgetServices.get(0).systemReady(safeMode);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080071
72 // Register for the boot completed broadcast, so we can send the
Amith Yamasani742a6712011-05-04 14:49:28 -070073 // ENABLE broacasts. If we try to send them now, they time out,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 // because the system isn't ready to handle them yet.
Dianne Hackborn20e80982012-08-31 19:00:44 -070075 mContext.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076 new IntentFilter(Intent.ACTION_BOOT_COMPLETED), null, null);
77
Eric Fischer63c2d9e2009-10-22 15:22:50 -070078 // Register for configuration changes so we can update the names
79 // of the widgets when the locale changes.
Dianne Hackbornfd8bf5c2012-09-04 18:48:37 -070080 mContext.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL,
81 new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED), null, null);
Eric Fischer63c2d9e2009-10-22 15:22:50 -070082
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 // Register for broadcasts about package install, etc., so we can
84 // update the provider list.
85 IntentFilter filter = new IntentFilter();
86 filter.addAction(Intent.ACTION_PACKAGE_ADDED);
Joe Onoratod070e892011-01-07 20:50:37 -080087 filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088 filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
89 filter.addDataScheme("package");
Dianne Hackborn20e80982012-08-31 19:00:44 -070090 mContext.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL,
91 filter, null, null);
Suchi Amalapurapu08675a32010-01-28 09:57:30 -080092 // Register for events related to sdcard installation.
93 IntentFilter sdFilter = new IntentFilter();
Suchi Amalapurapub56ae202010-02-04 22:51:07 -080094 sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE);
95 sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
Dianne Hackborn20e80982012-08-31 19:00:44 -070096 mContext.registerReceiverAsUser(mBroadcastReceiver, UserHandle.ALL,
97 sdFilter, null, null);
Amith Yamasani13593602012-03-22 16:16:17 -070098
99 IntentFilter userFilter = new IntentFilter();
100 userFilter.addAction(Intent.ACTION_USER_REMOVED);
101 mContext.registerReceiver(new BroadcastReceiver() {
102 @Override
103 public void onReceive(Context context, Intent intent) {
Amith Yamasani2a003292012-08-14 18:25:45 -0700104 onUserRemoved(intent.getIntExtra(Intent.EXTRA_USER_HANDLE, -1));
Amith Yamasani13593602012-03-22 16:16:17 -0700105 }
106 }, userFilter);
Dianne Hackborn20e80982012-08-31 19:00:44 -0700107
108 IntentFilter userStopFilter = new IntentFilter();
109 userStopFilter.addAction(Intent.ACTION_USER_STOPPED);
110 mContext.registerReceiverAsUser(new BroadcastReceiver() {
111 @Override
112 public void onReceive(Context context, Intent intent) {
113 onUserStopped(getSendingUserId());
114 }
115 }, UserHandle.ALL, userFilter, null, null);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800116 }
117
Amith Yamasani8320de82012-10-05 16:10:38 -0700118 /**
119 * This returns the user id of the caller, if the caller is not the system process,
120 * otherwise it assumes that the calls are from the lockscreen and hence are meant for the
121 * current user. TODO: Instead, have lockscreen make explicit calls with userId
122 */
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700123 private int getCallingOrCurrentUserId() {
124 int callingUid = Binder.getCallingUid();
Amith Yamasani8320de82012-10-05 16:10:38 -0700125 // Also check the PID because Settings (power control widget) also runs as System UID
126 if (callingUid == android.os.Process.myUid()
127 && Binder.getCallingPid() == android.os.Process.myPid()) {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700128 try {
129 return ActivityManagerNative.getDefault().getCurrentUser().id;
130 } catch (RemoteException re) {
131 return UserHandle.getUserId(callingUid);
132 }
133 } else {
134 return UserHandle.getUserId(callingUid);
135 }
136 }
137
Amith Yamasani742a6712011-05-04 14:49:28 -0700138 @Override
139 public int allocateAppWidgetId(String packageName, int hostId) throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700140 return getImplForUser(getCallingOrCurrentUserId()).allocateAppWidgetId(
Dianne Hackborn41203752012-08-31 14:05:51 -0700141 packageName, hostId);
Jeff Sharkey15d161f2011-09-01 21:30:56 -0700142 }
Amith Yamasani742a6712011-05-04 14:49:28 -0700143
144 @Override
145 public void deleteAppWidgetId(int appWidgetId) throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700146 getImplForUser(getCallingOrCurrentUserId()).deleteAppWidgetId(appWidgetId);
Adam Cohen7bb98832011-10-05 18:10:13 -0700147 }
148
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800149 @Override
Amith Yamasani742a6712011-05-04 14:49:28 -0700150 public void deleteHost(int hostId) throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700151 getImplForUser(getCallingOrCurrentUserId()).deleteHost(hostId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800152 }
153
Amith Yamasani742a6712011-05-04 14:49:28 -0700154 @Override
155 public void deleteAllHosts() throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700156 getImplForUser(getCallingOrCurrentUserId()).deleteAllHosts();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800157 }
158
Amith Yamasani742a6712011-05-04 14:49:28 -0700159 @Override
Adam Cohen0aa2d422012-09-07 17:37:26 -0700160 public void bindAppWidgetId(int appWidgetId, ComponentName provider, Bundle options)
161 throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700162 getImplForUser(getCallingOrCurrentUserId()).bindAppWidgetId(appWidgetId, provider,
Adam Cohen0aa2d422012-09-07 17:37:26 -0700163 options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800164 }
165
Amith Yamasani742a6712011-05-04 14:49:28 -0700166 @Override
Michael Jurka61a5b012012-04-13 10:39:45 -0700167 public boolean bindAppWidgetIdIfAllowed(
Adam Cohen0aa2d422012-09-07 17:37:26 -0700168 String packageName, int appWidgetId, ComponentName provider, Bundle options)
169 throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700170 return getImplForUser(getCallingOrCurrentUserId()).bindAppWidgetIdIfAllowed(
Adam Cohen0aa2d422012-09-07 17:37:26 -0700171 packageName, appWidgetId, provider, options);
Michael Jurka61a5b012012-04-13 10:39:45 -0700172 }
173
174 @Override
175 public boolean hasBindAppWidgetPermission(String packageName) throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700176 return getImplForUser(getCallingOrCurrentUserId()).hasBindAppWidgetPermission(
Dianne Hackborn41203752012-08-31 14:05:51 -0700177 packageName);
Michael Jurka61a5b012012-04-13 10:39:45 -0700178 }
179
180 @Override
181 public void setBindAppWidgetPermission(String packageName, boolean permission)
182 throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700183 getImplForUser(getCallingOrCurrentUserId()).setBindAppWidgetPermission(
Dianne Hackborn41203752012-08-31 14:05:51 -0700184 packageName, permission);
Michael Jurka61a5b012012-04-13 10:39:45 -0700185 }
186
187 @Override
Amith Yamasani742a6712011-05-04 14:49:28 -0700188 public void bindRemoteViewsService(int appWidgetId, Intent intent, IBinder connection)
189 throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700190 getImplForUser(getCallingOrCurrentUserId()).bindRemoteViewsService(
Dianne Hackborn41203752012-08-31 14:05:51 -0700191 appWidgetId, intent, connection);
Winson Chung81f39eb2011-01-11 18:05:01 -0800192 }
193
Amith Yamasani742a6712011-05-04 14:49:28 -0700194 @Override
195 public int[] startListening(IAppWidgetHost host, String packageName, int hostId,
196 List<RemoteViews> updatedViews) throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700197 return getImplForUser(getCallingOrCurrentUserId()).startListening(host,
Dianne Hackborn41203752012-08-31 14:05:51 -0700198 packageName, hostId, updatedViews);
Winson Chung81f39eb2011-01-11 18:05:01 -0800199 }
200
Amith Yamasani13593602012-03-22 16:16:17 -0700201 public void onUserRemoved(int userId) {
Amith Yamasani13593602012-03-22 16:16:17 -0700202 if (userId < 1) return;
Amith Yamasani8320de82012-10-05 16:10:38 -0700203 synchronized (mAppWidgetServices) {
204 AppWidgetServiceImpl impl = mAppWidgetServices.get(userId);
205 mAppWidgetServices.remove(userId);
206
207 if (impl == null) {
208 AppWidgetServiceImpl.getSettingsFile(userId).delete();
209 } else {
210 impl.onUserRemoved();
211 }
Amith Yamasani13593602012-03-22 16:16:17 -0700212 }
Winson Chung84bbb022011-02-21 13:57:45 -0800213 }
214
Dianne Hackborn20e80982012-08-31 19:00:44 -0700215 public void onUserStopped(int userId) {
216 }
217
Dianne Hackborn41203752012-08-31 14:05:51 -0700218 private AppWidgetServiceImpl getImplForUser(int userId) {
Amith Yamasani8320de82012-10-05 16:10:38 -0700219 boolean sendInitial = false;
220 AppWidgetServiceImpl service;
221 synchronized (mAppWidgetServices) {
222 service = mAppWidgetServices.get(userId);
223 if (service == null) {
224 Slog.i(TAG, "Unable to find AppWidgetServiceImpl for user " + userId + ", adding");
225 // TODO: Verify that it's a valid user
226 service = new AppWidgetServiceImpl(mContext, userId);
227 service.systemReady(mSafeMode);
228 // Assume that BOOT_COMPLETED was received, as this is a non-primary user.
229 mAppWidgetServices.append(userId, service);
230 sendInitial = true;
231 }
Winson Chung84bbb022011-02-21 13:57:45 -0800232 }
Amith Yamasani8320de82012-10-05 16:10:38 -0700233 if (sendInitial) {
234 service.sendInitialBroadcasts();
235 }
Amith Yamasani742a6712011-05-04 14:49:28 -0700236 return service;
Winson Chung84bbb022011-02-21 13:57:45 -0800237 }
238
Amith Yamasani742a6712011-05-04 14:49:28 -0700239 @Override
240 public int[] getAppWidgetIds(ComponentName provider) throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700241 return getImplForUser(getCallingOrCurrentUserId()).getAppWidgetIds(provider);
Winson Chung84bbb022011-02-21 13:57:45 -0800242 }
243
Amith Yamasani742a6712011-05-04 14:49:28 -0700244 @Override
245 public AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId) throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700246 return getImplForUser(getCallingOrCurrentUserId()).getAppWidgetInfo(appWidgetId);
Winson Chung81f39eb2011-01-11 18:05:01 -0800247 }
248
Amith Yamasani742a6712011-05-04 14:49:28 -0700249 @Override
250 public RemoteViews getAppWidgetViews(int appWidgetId) throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700251 return getImplForUser(getCallingOrCurrentUserId()).getAppWidgetViews(appWidgetId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800252 }
253
Adam Cohene8724c82012-04-19 17:11:40 -0700254 @Override
Adam Cohend2097eb2012-05-01 18:10:28 -0700255 public void updateAppWidgetOptions(int appWidgetId, Bundle options) {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700256 getImplForUser(getCallingOrCurrentUserId()).updateAppWidgetOptions(appWidgetId, options);
Adam Cohene8724c82012-04-19 17:11:40 -0700257 }
258
259 @Override
Adam Cohend2097eb2012-05-01 18:10:28 -0700260 public Bundle getAppWidgetOptions(int appWidgetId) {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700261 return getImplForUser(getCallingOrCurrentUserId()).getAppWidgetOptions(appWidgetId);
Adam Cohene8724c82012-04-19 17:11:40 -0700262 }
263
Amith Yamasani742a6712011-05-04 14:49:28 -0700264 @Override
265 public List<AppWidgetProviderInfo> getInstalledProviders() throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700266 return getImplForUser(getCallingOrCurrentUserId()).getInstalledProviders();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800267 }
268
Amith Yamasani742a6712011-05-04 14:49:28 -0700269 @Override
270 public void notifyAppWidgetViewDataChanged(int[] appWidgetIds, int viewId)
271 throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700272 getImplForUser(getCallingOrCurrentUserId()).notifyAppWidgetViewDataChanged(
Dianne Hackborn41203752012-08-31 14:05:51 -0700273 appWidgetIds, viewId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800274 }
275
Amith Yamasani742a6712011-05-04 14:49:28 -0700276 @Override
277 public void partiallyUpdateAppWidgetIds(int[] appWidgetIds, RemoteViews views)
278 throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700279 getImplForUser(getCallingOrCurrentUserId()).partiallyUpdateAppWidgetIds(
Dianne Hackborn41203752012-08-31 14:05:51 -0700280 appWidgetIds, views);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800281 }
282
Amith Yamasani742a6712011-05-04 14:49:28 -0700283 @Override
284 public void stopListening(int hostId) throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700285 getImplForUser(getCallingOrCurrentUserId()).stopListening(hostId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800286 }
287
Amith Yamasani742a6712011-05-04 14:49:28 -0700288 @Override
289 public void unbindRemoteViewsService(int appWidgetId, Intent intent) throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700290 getImplForUser(getCallingOrCurrentUserId()).unbindRemoteViewsService(
Dianne Hackborn41203752012-08-31 14:05:51 -0700291 appWidgetId, intent);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800292 }
293
Amith Yamasani742a6712011-05-04 14:49:28 -0700294 @Override
295 public void updateAppWidgetIds(int[] appWidgetIds, RemoteViews views) throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700296 getImplForUser(getCallingOrCurrentUserId()).updateAppWidgetIds(appWidgetIds, views);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800297 }
Adam Cohen97300312011-10-12 15:48:13 -0700298
Amith Yamasani742a6712011-05-04 14:49:28 -0700299 @Override
300 public void updateAppWidgetProvider(ComponentName provider, RemoteViews views)
301 throws RemoteException {
Amith Yamasani8fd96ec2012-09-21 17:48:49 -0700302 getImplForUser(getCallingOrCurrentUserId()).updateAppWidgetProvider(provider, views);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800303 }
304
Amith Yamasani742a6712011-05-04 14:49:28 -0700305 @Override
306 public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
307 // Dump the state of all the app widget providers
Amith Yamasani8320de82012-10-05 16:10:38 -0700308 synchronized (mAppWidgetServices) {
309 IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " ");
310 for (int i = 0; i < mAppWidgetServices.size(); i++) {
311 pw.println("User: " + mAppWidgetServices.keyAt(i));
312 ipw.increaseIndent();
313 AppWidgetServiceImpl service = mAppWidgetServices.valueAt(i);
314 service.dump(fd, ipw, args);
315 ipw.decreaseIndent();
316 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800317 }
318 }
319
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800320 BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
321 public void onReceive(Context context, Intent intent) {
322 String action = intent.getAction();
Amith Yamasani742a6712011-05-04 14:49:28 -0700323 // Slog.d(TAG, "received " + action);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800324 if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
Dianne Hackborn41203752012-08-31 14:05:51 -0700325 int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, -1);
326 if (userId >= 0) {
327 getImplForUser(userId).sendInitialBroadcasts();
328 } else {
329 Slog.w(TAG, "Not user handle supplied in " + intent);
330 }
Eric Fischer63c2d9e2009-10-22 15:22:50 -0700331 } else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
Amith Yamasani742a6712011-05-04 14:49:28 -0700332 for (int i = 0; i < mAppWidgetServices.size(); i++) {
333 AppWidgetServiceImpl service = mAppWidgetServices.valueAt(i);
334 service.onConfigurationChanged();
Eric Fischer63c2d9e2009-10-22 15:22:50 -0700335 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800336 } else {
Dianne Hackborn20e80982012-08-31 19:00:44 -0700337 int sendingUser = getSendingUserId();
338 if (sendingUser == UserHandle.USER_ALL) {
339 for (int i = 0; i < mAppWidgetServices.size(); i++) {
340 AppWidgetServiceImpl service = mAppWidgetServices.valueAt(i);
341 service.onBroadcastReceived(intent);
342 }
343 } else {
344 AppWidgetServiceImpl service = mAppWidgetServices.get(sendingUser);
345 if (service != null) {
346 service.onBroadcastReceived(intent);
347 }
Amith Yamasani483f3b02012-03-13 16:08:00 -0700348 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800349 }
350 }
351 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800352}