blob: 34facf721110c9a942e17f8856d393235a76745e [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
Bijan Amirzada41242f22014-03-21 12:12:18 -070017package com.android.browser;
The Android Open Source Project0c908882009-03-03 19:32:16 -080018
Enrico Ros1c4d6b82014-10-14 16:23:17 -070019import android.Manifest;
The Android Open Source Project0c908882009-03-03 19:32:16 -080020import android.app.Application;
Bijan Amirzada9b1e9882014-02-26 17:15:46 -080021import android.content.Context;
22import android.content.pm.PackageManager;
Bijan Amirzada9b1e9882014-02-26 17:15:46 -080023import android.os.Process;
Enrico Ros1c4d6b82014-10-14 16:23:17 -070024import android.util.Log;
Tarun Nainaniea28dde2014-08-27 17:25:09 -070025
Vivek Sekhar0989b452014-08-01 12:30:35 -070026import org.codeaurora.swe.Engine;
Bijan Amirzada9b1e9882014-02-26 17:15:46 -080027
28public class Browser extends Application {
The Android Open Source Project0c908882009-03-03 19:32:16 -080029
30 private final static String LOGTAG = "browser";
Bijan Amirzada9b1e9882014-02-26 17:15:46 -080031
Dave Bort31a6d1c2009-04-13 15:56:49 -070032 // Set to true to enable verbose logging.
John Reck6c2e2f32011-08-22 13:41:23 -070033 final static boolean LOGV_ENABLED = false;
Dave Bort31a6d1c2009-04-13 15:56:49 -070034
35 // Set to true to enable extra debug logging.
36 final static boolean LOGD_ENABLED = true;
37
John Reck6f48ba52010-12-03 16:03:14 -080038 @Override
The Android Open Source Project0c908882009-03-03 19:32:16 -080039 public void onCreate() {
Kristian Monsene800e8e2010-12-06 16:59:33 +000040 super.onCreate();
Enrico Ros1c4d6b82014-10-14 16:23:17 -070041
Dave Bort31a6d1c2009-04-13 15:56:49 -070042 if (LOGV_ENABLED)
The Android Open Source Project0c908882009-03-03 19:32:16 -080043 Log.v(LOGTAG, "Browser.onCreate: this=" + this);
Kristian Monsene800e8e2010-12-06 16:59:33 +000044
Enrico Ros1c4d6b82014-10-14 16:23:17 -070045 // Chromium specific initialization.
Tarun Nainani8eb00912014-07-17 12:28:32 -070046 Engine.initializeApplicationParameters();
Enrico Ros1c4d6b82014-10-14 16:23:17 -070047
48 final boolean isSandboxContext = checkPermission(Manifest.permission.INTERNET,
49 Process.myPid(), Process.myUid()) != PackageManager.PERMISSION_GRANTED;
50
51 if (isSandboxContext) {
52 // SWE: Avoid initializing the engine for sandboxed processes.
53 } else {
Vivek Sekhar0989b452014-08-01 12:30:35 -070054 // Initialize the SWE engine.
Enrico Ros1c4d6b82014-10-14 16:23:17 -070055 Engine.initialize((Context) this);
56 BrowserSettings.initialize((Context) this);
57 Preloader.initialize((Context) this);
58 }
Tarun Nainaniea28dde2014-08-27 17:25:09 -070059
60 }
The Android Open Source Project0c908882009-03-03 19:32:16 -080061}
62