blob: 1e5c14e02bab7ba12e5342f5fad727fcca5c0226 [file] [log] [blame]
Dmitri Plotnikovf049ff02010-11-29 10:15:24 -08001/*
2 * Copyright (C) 2010 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.contacts;
18
19import android.app.Application;
Dmitri Plotnikov3b7dedd2010-11-29 14:46:10 -080020import android.content.Context;
Dmitri Plotnikovf049ff02010-11-29 10:15:24 -080021import android.os.StrictMode;
Dmitri Plotnikov3b7dedd2010-11-29 14:46:10 -080022import android.preference.PreferenceManager;
23
24import java.util.Locale;
25
26import com.android.contacts.model.AccountTypes;
27import com.google.i18n.phonenumbers.PhoneNumberUtil;
Dmitri Plotnikovf049ff02010-11-29 10:15:24 -080028
29public final class ContactsApplication extends Application {
30
31 @Override
32 public void onCreate() {
33 super.onCreate();
34
Dmitri Plotnikov3b7dedd2010-11-29 14:46:10 -080035 // Priming caches to placate the StrictMode police
36 Context context = getApplicationContext();
37 PreferenceManager.getDefaultSharedPreferences(context);
38 PhoneNumberUtil.getInstance().getAsYouTypeFormatter(Locale.getDefault().getCountry());
39 AccountTypes.getInstance(context);
40
Dmitri Plotnikovf049ff02010-11-29 10:15:24 -080041 StrictMode.setThreadPolicy(
42 new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
43 }
44}