blob: c4412e2037ff00720224fbf8e20ce977f5acce59 [file] [log] [blame]
The Android Open Source Project0c908882009-03-03 19:32:16 -08001/*
2 * Copyright (C) 2006 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.browser;
18
The Android Open Source Project0c908882009-03-03 19:32:16 -080019import android.app.Application;
20import android.content.Intent;
John Reck84c2c092011-06-30 15:13:31 -070021import android.os.AsyncTask;
John Reck35e9dd62011-04-25 09:01:54 -070022import android.util.Log;
The Android Open Source Project0c908882009-03-03 19:32:16 -080023import android.webkit.CookieSyncManager;
24
25import dalvik.system.VMRuntime;
26
27public class Browser extends Application {
28
29 private final static String LOGTAG = "browser";
30
Dave Bort31a6d1c2009-04-13 15:56:49 -070031 // Set to true to enable extra debugging.
32 final static boolean DEBUG = false;
33
34 // Set to true to enable verbose logging.
35 final static boolean LOGV_ENABLED = DEBUG;
36
37 // Set to true to enable extra debug logging.
38 final static boolean LOGD_ENABLED = true;
39
The Android Open Source Project0c908882009-03-03 19:32:16 -080040 /**
41 * Specifies a heap utilization ratio that works better
42 * for the browser than the default ratio does.
43 */
44 private final static float TARGET_HEAP_UTILIZATION = 0.75f;
45
46 public Browser() {
47 }
48
John Reck6f48ba52010-12-03 16:03:14 -080049 @Override
The Android Open Source Project0c908882009-03-03 19:32:16 -080050 public void onCreate() {
Kristian Monsene800e8e2010-12-06 16:59:33 +000051 super.onCreate();
52
Dave Bort31a6d1c2009-04-13 15:56:49 -070053 if (LOGV_ENABLED)
The Android Open Source Project0c908882009-03-03 19:32:16 -080054 Log.v(LOGTAG, "Browser.onCreate: this=" + this);
Kristian Monsene800e8e2010-12-06 16:59:33 +000055
John Reck84c2c092011-06-30 15:13:31 -070056 // Fix AsyncTask to use multiple threads
57 AsyncTask.setDefaultExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
The Android Open Source Project0c908882009-03-03 19:32:16 -080058 // Fix heap utilization for better heap size characteristics.
59 VMRuntime.getRuntime().setTargetHeapUtilization(
60 TARGET_HEAP_UTILIZATION);
61 // create CookieSyncManager with current Context
62 CookieSyncManager.createInstance(this);
John Reck35e9dd62011-04-25 09:01:54 -070063 BrowserSettings.initialize(getApplicationContext());
Michael Kolb14612442011-06-24 13:06:29 -070064 Preloader.initialize(getApplicationContext());
The Android Open Source Project0c908882009-03-03 19:32:16 -080065 }
66
67 static Intent createBrowserViewIntent() {
68 Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
69 return intent;
70 }
71}
72