2 * Copyright (C) 2006 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.android.browser;
19 import android.util.Log;
21 import android.app.Application;
22 import android.content.Intent;
23 import android.webkit.CookieManager;
24 import android.webkit.CookieSyncManager;
26 import dalvik.system.VMRuntime;
28 public class Browser extends Application {
30 private final static String LOGTAG = "browser";
32 // Set to true to enable extra debugging.
33 final static boolean DEBUG = false;
35 // Set to true to enable verbose logging.
36 final static boolean LOGV_ENABLED = DEBUG;
38 // Set to true to enable extra debug logging.
39 final static boolean LOGD_ENABLED = true;
42 * Specifies a heap utilization ratio that works better
43 * for the browser than the default ratio does.
45 private final static float TARGET_HEAP_UTILIZATION = 0.75f;
50 public void onCreate() {
52 Log.v(LOGTAG, "Browser.onCreate: this=" + this);
53 // Fix heap utilization for better heap size characteristics.
54 VMRuntime.getRuntime().setTargetHeapUtilization(
55 TARGET_HEAP_UTILIZATION);
56 // create CookieSyncManager with current Context
57 CookieSyncManager.createInstance(this);
58 // remove all expired cookies
59 CookieManager.getInstance().removeExpiredCookie();
62 static Intent createBrowserViewIntent() {
63 Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);