The Android Open Source Project | 0c90888 | 2009-03-03 19:32:16 -0800 | [diff] [blame^] | 1 | /* |
| 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 | |
| 17 | package com.android.browser; |
| 18 | |
| 19 | import android.util.Config; |
| 20 | import android.util.Log; |
| 21 | |
| 22 | import android.app.Application; |
| 23 | import android.content.Intent; |
| 24 | import android.webkit.CookieManager; |
| 25 | import android.webkit.CookieSyncManager; |
| 26 | |
| 27 | import dalvik.system.VMRuntime; |
| 28 | |
| 29 | public class Browser extends Application { |
| 30 | |
| 31 | private final static String LOGTAG = "browser"; |
| 32 | |
| 33 | /** |
| 34 | * Specifies a heap utilization ratio that works better |
| 35 | * for the browser than the default ratio does. |
| 36 | */ |
| 37 | private final static float TARGET_HEAP_UTILIZATION = 0.75f; |
| 38 | |
| 39 | public Browser() { |
| 40 | } |
| 41 | |
| 42 | public void onCreate() { |
| 43 | if (Config.LOGV) |
| 44 | Log.v(LOGTAG, "Browser.onCreate: this=" + this); |
| 45 | // Fix heap utilization for better heap size characteristics. |
| 46 | VMRuntime.getRuntime().setTargetHeapUtilization( |
| 47 | TARGET_HEAP_UTILIZATION); |
| 48 | // create CookieSyncManager with current Context |
| 49 | CookieSyncManager.createInstance(this); |
| 50 | // remove all expired cookies |
| 51 | CookieManager.getInstance().removeExpiredCookie(); |
| 52 | } |
| 53 | |
| 54 | static Intent createBrowserViewIntent() { |
| 55 | Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); |
| 56 | return intent; |
| 57 | } |
| 58 | } |
| 59 | |