Пример #1
0
 public void onReceive(Context context, Intent intent) {
   String action = intent.getAction();
   // Slog.d(TAG, "received " + action);
   if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
     int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL);
     if (userId >= 0) {
       getImplForUser(userId).sendInitialBroadcasts();
     } else {
       Slog.w(TAG, "Incorrect user handle supplied in " + intent);
     }
   } else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
     for (int i = 0; i < mAppWidgetServices.size(); i++) {
       AppWidgetServiceImpl service = mAppWidgetServices.valueAt(i);
       service.onConfigurationChanged();
     }
   } else {
     int sendingUser = getSendingUserId();
     if (sendingUser == UserHandle.USER_ALL) {
       for (int i = 0; i < mAppWidgetServices.size(); i++) {
         AppWidgetServiceImpl service = mAppWidgetServices.valueAt(i);
         service.onBroadcastReceived(intent);
       }
     } else {
       AppWidgetServiceImpl service = mAppWidgetServices.get(sendingUser);
       if (service != null) {
         service.onBroadcastReceived(intent);
       }
     }
   }
 }
Пример #2
0
 @Override
 public void onReceive(Context context, Intent intent) {
   String action = intent.getAction();
   DebugLog.d(LOG_TAG, "onReceive action: " + action);
   if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
     mHandler.sendEmptyMessage(MSG_CONFIGURATION_CHANGED);
   }
 }