PreloadReceiver.java revision b6a4d983b8ddec80033f371c71270beea3ad912a
1b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu/*
2b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu * Copyright (C) 2012 The Android Open Source Project
3b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu *
4b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu * Licensed under the Apache License, Version 2.0 (the "License");
5b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu * you may not use this file except in compliance with the License.
6b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu * You may obtain a copy of the License at
7b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu *
8b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu *      http://www.apache.org/licenses/LICENSE-2.0
9b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu *
10b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu * Unless required by applicable law or agreed to in writing, software
11b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu * distributed under the License is distributed on an "AS IS" BASIS,
12b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu * See the License for the specific language governing permissions and
14b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu * limitations under the License.
15b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu */
16b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu
17b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsupackage com.android.launcher2;
18b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu
19b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsuimport android.content.BroadcastReceiver;
20b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsuimport android.content.Context;
21b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsuimport android.content.Intent;
22b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsuimport android.util.Log;
23b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu
24b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsupublic class PreloadReceiver extends BroadcastReceiver {
25b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu    @Override
26b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu    public void onReceive(Context context, Intent intent) {
27b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu        final LauncherApplication app = (LauncherApplication) context.getApplicationContext();
28b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu        final LauncherProvider provider = app.getLauncherProvider();
29b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu        if (provider != null) {
30b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu            new Thread(new Runnable() {
31b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu                public void run() {
32b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu                    provider.loadDefaultFavoritesIfNecessary();
33b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu                }
34b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu            }).start();
35b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu        }
36b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu    }
37b6a4d983b8ddec80033f371c71270beea3ad912aBrian Muramatsu}
38