• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* //device/content/providers/media/src/com/android/providers/media/MediaScannerReceiver.java
2 **
3 ** Copyright 2007, The Android Open Source Project
4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
8 **
9 **     http://www.apache.org/licenses/LICENSE-2.0
10 **
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 */
17 
18 package com.android.providers.media;
19 
20 import android.content.BroadcastReceiver;
21 import android.content.ComponentName;
22 import android.content.Context;
23 import android.content.Intent;
24 
25 public class MediaReceiver extends BroadcastReceiver {
26     @Override
onReceive(Context context, Intent intent)27     public void onReceive(Context context, Intent intent) {
28         final String action = intent.getAction();
29         if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
30             // Register our idle maintenance service
31             IdleService.scheduleIdlePass(context);
32 
33         } else {
34             // All other operations are heavier-weight, so redirect them through
35             // service to ensure they have breathing room to finish
36             intent.setComponent(new ComponentName(context, MediaService.class));
37             MediaService.enqueueWork(context, intent);
38         }
39     }
40 }
41