SWE Browser to use generated android manifest xml

Keep single android manifest for all SWE Browser flavors.
Delete src_system/AndrodManifest.xml and use 'swe_browser_type'
gyp (jinja) variable to differentiate between standalone vs
system browser.

Change-Id: I85e5ddce48f95c398959a2e64141c87e4c83e110
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 5e009b5..54cf09b 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -18,10 +18,10 @@
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.browser">
 
-    <permission android:name="org.codeaurora.swe.browser.beta.permission.PRELOAD"
+    <permission android:name="{{ package_name }}.permission.PRELOAD"
         android:label="@string/permission_preload_label"
         android:protectionLevel="signatureOrSystem" />
-    <permission android:name="org.codeaurora.swe.browser.beta.permission.INITIALIZE_DATABASE"
+    <permission android:name="{{ package_name }}.permission.INITIALIZE_DATABASE"
         android:protectionLevel="signatureOrSystem" />
 
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
@@ -44,27 +44,28 @@
     <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>
     <uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"/>
     <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
-    <uses-permission android:name="org.codeaurora.swe.browser.beta.permission.READ_HOMEPAGE" />
-    <uses-permission android:name="org.codeaurora.swe.browser.beta.permission.WRITE_HOMEPAGE" />
-    <uses-permission android:name="org.codeaurora.swe.browser.beta.permission.INITIALIZE_DATABASE"/>
+    <uses-permission android:name="{{ package_name }}.permission.READ_HOMEPAGE" />
+    <uses-permission android:name="{{ package_name }}.permission.WRITE_HOMEPAGE" />
+    <uses-permission android:name="{{ package_name }}.permission.INITIALIZE_DATABASE"/>
     <uses-permission android:name="android.permission.VIBRATE"/>
     <uses-permission android:name="android.permission.RECORD_AUDIO"/>
     <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
     <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
-
+    <!-- Templatize taskAffinity otherwise it will default to 'package'
+        defined in manifest -->
     <application   android:name="Browser"
-                   android:label="@string/application_name_swe"
-                   android:icon="@mipmap/ic_launcher_browser_swe_beta"
+                   android:label="{{ apk_label }}"
+                   android:icon="{{ apk_icon }}"
                    android:backupAgent=".BrowserBackupAgent"
                    android:hardwareAccelerated="true"
-                   android:taskAffinity="android.task.swe.browser.beta"
+                   android:taskAffinity="{{ apk_task_affinity }}"
                    android:theme="@style/BrowserBase" >
 
         <uses-library android:name="com.qrd.useragent"
                       android:required="false" />
 
         <provider android:name=".provider.BrowserProvider2"
-                  android:authorities="org.codeaurora.swe.browser.beta;swe.browser.beta"
+                  android:authorities="{{ package_name }};{{apk_authorities}}"
                   android:multiprocess="false"
                   android:exported="true"
                   android:readPermission="com.android.browser.permission.READ_HISTORY_BOOKMARKS"
@@ -72,8 +73,8 @@
             <path-permission android:path="/bookmarks/search_suggest_query"
                     android:readPermission="android.permission.GLOBAL_SEARCH" />
             <path-permission android:path="/homepage"
-                    android:readPermission="org.codeaurora.swe.browser.beta.permission.READ_HOMEPAGE"
-                    android:writePermission="org.codeaurora.swe.browser.beta.permission.WRITE_HOMEPAGE" />
+                    android:readPermission="{{ package_name }}.permission.READ_HOMEPAGE"
+                    android:writePermission="{{ package_name }}.permission.WRITE_HOMEPAGE" />
         </provider>
 
         <activity android:name="BrowserLauncher"
@@ -89,7 +90,7 @@
         </activity>
 
         <activity android:name="BrowserActivity"
-                  android:label="@string/application_name_swe"
+                  android:label="{{ apk_label }}"
                   android:launchMode="singleTask"
                   android:alwaysRetainTaskState="true"
                   android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
@@ -284,7 +285,7 @@
         <!-- For custom home pages (like most visited) -->
         <provider
             android:name=".homepages.HomeProvider"
-            android:authorities="org.codeaurora.swe.browser.beta.home"
+            android:authorities="{{ package_name }}.home"
             android:grantUriPermissions="true"
             android:readPermission="com.android.browser.permission.READ_HISTORY_BOOKMARKS"
             android:exported="false" />
@@ -302,7 +303,7 @@
         </receiver>
 
         <receiver android:name=".PreloadRequestReceiver"
-             android:permission="org.codeaurora.swe.browser.beta.permission.PRELOAD" >
+             android:permission="{{ package_name }}.permission.PRELOAD" >
              <intent-filter>
                  <action android:name="android.intent.action.PRELOAD"/>
                  <data android:scheme="http" />
@@ -310,139 +311,38 @@
          </receiver>
 
         <provider android:name=".provider.SnapshotProvider"
-                  android:authorities="org.codeaurora.swe.browser.beta.snapshots"
+                  android:authorities="{{ package_name }}.snapshots"
                   android:exported="false" />
         <provider
             android:name=".provider.MyNavigationProvider"
-            android:authorities="org.codeaurora.swe.browser.beta.mynavigation"
+            android:authorities="{{ package_name }}.mynavigation"
             android:exported="false"
             android:grantUriPermissions="true"/>
 
-        <meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES"
-                   android:value="3"/>
-
-        <service android:name="org.chromium.content.app.PrivilegedProcessService0"
-                 android:process=":privileged_process0"
-                 android:isolatedProcess="false"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.PrivilegedProcessService1"
-                 android:process=":privileged_process1"
-                 android:isolatedProcess="false"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.PrivilegedProcessService2"
-                 android:process=":privileged_process2"
-                 android:isolatedProcess="false"
-                 android:exported="false" />
-
-
+        {% set num_sandboxed_services = 20 %}
         <meta-data android:name="org.chromium.content.browser.NUM_SANDBOXED_SERVICES"
-           android:value="20"/>
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService0"
-                 android:process=":sandboxed_process0"
+                   android:value="{{ num_sandboxed_services }}"/>
+        {% for i in range(num_sandboxed_services) %}
+        <service android:name="org.chromium.content.app.SandboxedProcessService{{ i }}"
+                 android:process=":sandboxed_process{{ i }}"
                  android:isolatedProcess="true"
                  android:exported="false" />
+        {% endfor %}
 
-        <service android:name="org.chromium.content.app.SandboxedProcessService1"
-                 android:process=":sandboxed_process1"
-                 android:isolatedProcess="true"
+        {% set num_privileged_services = 3 %}
+        <meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES"
+                   android:value="{{ num_privileged_services }}"/>
+        {% for i in range(num_privileged_services) %}
+        <service android:name="org.chromium.content.app.PrivilegedProcessService{{ i }}"
+                 android:process=":privileged_process{{ i }}"
+                 android:isolatedProcess="false"
                  android:exported="false" />
+        {% endfor %}
 
-        <service android:name="org.chromium.content.app.SandboxedProcessService2"
-                 android:process=":sandboxed_process2"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService3"
-                 android:process=":sandboxed_process3"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService4"
-                 android:process=":sandboxed_process4"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService5"
-                 android:process=":sandboxed_process5"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService6"
-                 android:process=":sandboxed_process6"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService7"
-                 android:process=":sandboxed_process7"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService8"
-                 android:process=":sandboxed_process8"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService9"
-                 android:process=":sandboxed_process9"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService10"
-                 android:process=":sandboxed_process10"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService11"
-                 android:process=":sandboxed_process11"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService12"
-                 android:process=":sandboxed_process12"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService13"
-                 android:process=":sandboxed_process13"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService14"
-                 android:process=":sandboxed_process14"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService15"
-                 android:process=":sandboxed_process15"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService16"
-                 android:process=":sandboxed_process16"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService17"
-                 android:process=":sandboxed_process17"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService18"
-                 android:process=":sandboxed_process18"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService19"
-                 android:process=":sandboxed_process19"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
 
         <!-- Provider for FileProvider. -->
         <provider android:name="android.support.v4.content.FileProvider"
-            android:authorities="org.codeaurora.swe.browser.beta.FileProvider"
+            android:authorities="{{ package_name }}.FileProvider"
             android:exported="false"
             android:grantUriPermissions="true">
             <meta-data android:name="android.support.FILE_PROVIDER_PATHS"
diff --git a/src_system/AndroidManifest.xml b/src_system/AndroidManifest.xml
deleted file mode 100644
index 9a97b58..0000000
--- a/src_system/AndroidManifest.xml
+++ /dev/null
@@ -1,454 +0,0 @@
-<!--
-/*
- * Copyright 2006, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.browser">
-
-    <original-package android:name="com.android.browser" />
-
-    <permission android:name="com.android.browser.permission.PRELOAD"
-        android:label="@string/permission_preload_label"
-        android:protectionLevel="signatureOrSystem" />
-    <permission android:name="com.android.browser.permission.INITIALIZE_DATABASE"
-        android:protectionLevel="signatureOrSystem" />
-
-    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
-    <uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER"/>
-    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
-    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
-    <uses-permission android:name="android.permission.CAMERA" />
-    <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.NFC" />
-    <uses-permission android:name="android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS" />
-    <uses-permission android:name="android.permission.SET_WALLPAPER" />
-    <uses-permission android:name="android.permission.WAKE_LOCK"/>
-    <uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
-    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
-    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
-    <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
-    <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>
-    <uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"/>
-    <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
-    <uses-permission android:name="com.android.browser.permission.READ_HOMEPAGE" />
-    <uses-permission android:name="com.android.browser.permission.WRITE_HOMEPAGE" />
-    <uses-permission android:name="com.android.browser.permission.INITIALIZE_DATABASE"/>
-    <uses-permission android:name="android.permission.VIBRATE"/>
-    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
-    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
-    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
-
-    <application   android:name="Browser"
-                   android:label="@string/application_name"
-                   android:icon="@mipmap/ic_launcher_browser"
-                   android:backupAgent=".BrowserBackupAgent"
-                   android:hardwareAccelerated="true"
-                   android:taskAffinity="android.task.browser"
-                   android:theme="@style/BrowserBase" >
-
-        <uses-library android:name="com.qrd.useragent"
-                      android:required="false" />
-
-        <provider android:name=".provider.BrowserProvider2"
-                  android:authorities="com.android.browser;browser"
-                  android:multiprocess="false"
-                  android:exported="true"
-                  android:readPermission="com.android.browser.permission.READ_HISTORY_BOOKMARKS"
-                  android:writePermission="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS">
-            <path-permission android:path="/bookmarks/search_suggest_query"
-                    android:readPermission="android.permission.GLOBAL_SEARCH" />
-            <path-permission android:path="/homepage"
-                    android:readPermission="com.android.browser.permission.READ_HOMEPAGE"
-                    android:writePermission="com.android.browser.permission.WRITE_HOMEPAGE" />
-        </provider>
-        <activity android:name="BrowserActivity"
-                  android:label="@string/application_name"
-                  android:launchMode="singleTask"
-                  android:alwaysRetainTaskState="true"
-                  android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
-                  android:theme="@style/BrowserTheme"
-                  android:windowSoftInputMode="adjustResize" >
-            <intent-filter>
-                <action android:name="android.speech.action.VOICE_SEARCH_RESULTS" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-            <!-- For these schemes were not particular MIME type has been
-                 supplied, we are a good candidate. -->
-            <intent-filter>
-                <action android:name="android.intent.action.VIEW" />
-                <category android:name="android.intent.category.DEFAULT" />
-                <category android:name="android.intent.category.BROWSABLE" />
-                <data android:scheme="http" />
-                <data android:scheme="https" />
-                <data android:scheme="about" />
-                <data android:scheme="javascript" />
-            </intent-filter>
-            <!--  For these schemes where any of these particular MIME types
-                  have been supplied, we are a good candidate. -->
-            <intent-filter>
-                <action android:name="android.intent.action.VIEW" />
-                <category android:name="android.intent.category.BROWSABLE" />
-                <category android:name="android.intent.category.DEFAULT" />
-                <data android:scheme="http" />
-                <data android:scheme="https" />
-                <data android:scheme="inline" />
-                <data android:mimeType="text/html"/>
-                <data android:mimeType="text/plain"/>
-                <data android:mimeType="application/xhtml+xml"/>
-                <data android:mimeType="application/vnd.wap.xhtml+xml"/>
-            </intent-filter>
-            <!-- For viewing saved web archives. -->
-            <intent-filter>
-                <action android:name="android.intent.action.VIEW" />
-                <category android:name="android.intent.category.BROWSABLE" />
-                <category android:name="android.intent.category.DEFAULT" />
-                <data android:scheme="http" />
-                <data android:scheme="https" />
-                <data android:scheme="file" />
-                <data android:mimeType="application/x-webarchive-xml"/>
-            </intent-filter>
-            <!-- Accept inbound NFC URLs at a low priority -->
-            <intent-filter android:priority="-101">
-                <action android:name="android.nfc.action.NDEF_DISCOVERED" />
-                <category android:name="android.intent.category.DEFAULT" />
-                <data android:scheme="http" />
-                <data android:scheme="https" />
-            </intent-filter>
-            <!-- We are also the main entry point of the browser. -->
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.DEFAULT" />
-                <category android:name="android.intent.category.LAUNCHER" />
-                <category android:name="android.intent.category.BROWSABLE" />
-                <category android:name="android.intent.category.APP_BROWSER" />
-            </intent-filter>
-            <!-- The maps app is a much better experience, so it's not
-                 worth having this at all... especially for a demo!
-            <intent-filter android:label="Map In Browser">
-                <action android:name="android.intent.action.VIEW" />
-                <category android:name="android.intent.category.DEFAULT" />
-                <data android:mimeType="vnd.android.cursor.item/postal-address" />
-            </intent-filter>
-            -->
-            <intent-filter>
-                <action android:name="android.intent.action.WEB_SEARCH" />
-                <category android:name="android.intent.category.DEFAULT" />
-                <category android:name="android.intent.category.BROWSABLE" />
-                <data android:scheme="" />
-                <data android:scheme="http" />
-                <data android:scheme="https" />
-            </intent-filter>
-            <intent-filter>
-                <action android:name="android.intent.action.MEDIA_SEARCH" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-            <intent-filter>
-                <action android:name="android.intent.action.SEARCH" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-            <meta-data android:name="android.app.searchable"
-                    android:resource="@xml/searchable" />
-        </activity>
-
-        <activity android:name="ShortcutActivity"
-            android:theme="@style/ShortcutTheme"
-            android:label="@string/shortcut_bookmark"
-            android:icon="@mipmap/ic_launcher_shortcut_browser_bookmark">
-            <intent-filter>
-                <action android:name="android.intent.action.CREATE_SHORTCUT" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name="BrowserPreferencesPage" android:label="@string/menu_preferences"
-            android:parentActivityName=".BrowserActivity"
-            android:theme="@style/SettingsTheme">
-            <intent-filter>
-               <action android:name="android.intent.action.MANAGE_NETWORK_USAGE" />
-               <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name="BookmarkSearch"
-                  android:label="@string/bookmarks_search"
-                  android:stateNotNeeded="true"
-                  android:theme="@android:style/Theme.NoDisplay"
-                  android:excludeFromRecents="true">
-            <intent-filter>
-                <action android:name="android.intent.action.SEARCH" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-            <meta-data android:name="android.app.searchable"
-                    android:resource="@xml/bookmarks_searchable" />
-        </activity>
-
-        <activity android:name="AddBookmarkPage" android:label="@string/bookmarks_add_page"
-                  android:theme="@style/DialogWhenLarge"
-                  android:configChanges="orientation|keyboardHidden|screenSize"
-                  android:windowSoftInputMode="adjustResize">
-            <intent-filter>
-                <action android:name="android.intent.action.INSERT" />
-                <category android:name="android.intent.category.DEFAULT" />
-                <data android:mimeType="vnd.android.cursor.dir/bookmark"/>
-            </intent-filter>
-        </activity>
-
-        <activity android:name="DownloadSettings" android:label="@string/download_settings_title"
-                  android:theme="@style/DialogWhenLarge"
-                  android:launchMode="singleTask"
-                  android:configChanges="orientation|keyboardHidden|screenSize"
-                  android:windowSoftInputMode="adjustResize">
-            <intent-filter>
-                <action android:name="android.intent.action.BROWSERDOWNLOAD" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-
-        <!-- For creating new folder in bookmarks page -->
-        <activity android:name="AddBookmarkFolder" android:label="@string/save_bookmark_folder"
-                  android:theme="@style/DialogWhenLarge"
-                  android:configChanges="orientation|keyboardHidden|screenSize">
-                  <intent-filter>
-                      <category android:name="android.intent.category.DEFAULT" />
-                      <data android:mimeType="vnd.android.cursor.dir/bookmark"/>
-                  </intent-filter>
-        </activity>
-
-        <activity android:name="ComboViewActivity">
-        </activity>
-
-        <!-- Bookmark thumbnail homescreen widget -->
-        <receiver
-            android:name=".widget.BookmarkThumbnailWidgetProvider"
-            android:label="@string/bookmarks">
-            <intent-filter>
-                <action
-                    android:name="android.appwidget.action.APPWIDGET_UPDATE" />
-                <action
-                    android:name="com.android.browser.BOOKMARK_APPWIDGET_UPDATE" />
-            </intent-filter>
-            <meta-data
-                android:name="android.appwidget.provider"
-                android:resource="@xml/bookmarkthumbnailwidget_info" />
-        </receiver>
-        <service
-            android:name=".widget.BookmarkThumbnailWidgetService"
-            android:permission="android.permission.BIND_REMOTEVIEWS"
-            android:exported="false" />
-        <receiver
-            android:name=".widget.BookmarkWidgetProxy"
-            android:exported="false" />
-        <activity android:name=".widget.BookmarkWidgetConfigure"
-            android:theme="@style/DialogWhenLarge">
-            <intent-filter>
-                <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
-            </intent-filter>
-        </activity>
-        <!-- add or edit my navigation activity -->
-        <activity android:name=".mynavigation.AddMyNavigationPage"
-            android:label="@string/my_navigation_page_title"
-            android:configChanges="orientation|keyboardHidden"
-            android:windowSoftInputMode="stateHidden">
-        </activity>
-
-        <!-- Makes .BrowserActivity the search target for any activity in Browser -->
-        <meta-data android:name="android.app.default_searchable" android:value=".BrowserActivity" />
-
-        <receiver android:name=".OpenDownloadReceiver">
-            <intent-filter>
-                <action android:name="android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED"/>
-            </intent-filter>
-        </receiver>
-
-        <!-- For custom home pages (like most visited) -->
-        <provider
-            android:name=".homepages.HomeProvider"
-            android:authorities="com.android.browser.home"
-            android:grantUriPermissions="true"
-            android:readPermission="com.android.browser.permission.READ_HISTORY_BOOKMARKS"
-            android:exported="false" />
-
-        <receiver android:name=".AccountsChangedReceiver">
-            <intent-filter>
-                <action android:name="android.accounts.LOGIN_ACCOUNTS_CHANGED" />
-            </intent-filter>
-        </receiver>
-
-         <receiver android:name=".MessagesReceiver">
-            <intent-filter>
-                <action android:name="com.android.mms.transaction.MESSAGE_RECEIVED" />
-            </intent-filter>
-        </receiver>
-
-        <receiver android:name=".PreloadRequestReceiver"
-             android:permission="com.android.browser.permission.PRELOAD" >
-             <intent-filter>
-                 <action android:name="android.intent.action.PRELOAD"/>
-                 <data android:scheme="http" />
-             </intent-filter>
-         </receiver>
-
-        <provider android:name=".provider.SnapshotProvider"
-                  android:authorities="com.android.browser.snapshots"
-                  android:exported="false" />
-        <provider
-            android:name=".provider.MyNavigationProvider"
-            android:authorities="com.android.browser.mynavigation"
-            android:exported="false"
-            android:grantUriPermissions="true"/>
-
-
-        <meta-data android:name="org.chromium.content.browser.NUM_PRIVILEGED_SERVICES"
-                   android:value="3"/>
-
-        <service android:name="org.chromium.content.app.PrivilegedProcessService0"
-                 android:process=":privileged_process0"
-                 android:isolatedProcess="false"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.PrivilegedProcessService1"
-                 android:process=":privileged_process1"
-                 android:isolatedProcess="false"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.PrivilegedProcessService2"
-                 android:process=":privileged_process2"
-                 android:isolatedProcess="false"
-                 android:exported="false" />
-
-
-        <meta-data android:name="org.chromium.content.browser.NUM_SANDBOXED_SERVICES"
-           android:value="20"/>
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService0"
-                 android:process=":sandboxed_process0"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService1"
-                 android:process=":sandboxed_process1"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService2"
-                 android:process=":sandboxed_process2"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService3"
-                 android:process=":sandboxed_process3"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService4"
-                 android:process=":sandboxed_process4"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService5"
-                 android:process=":sandboxed_process5"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService6"
-                 android:process=":sandboxed_process6"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService7"
-                 android:process=":sandboxed_process7"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService8"
-                 android:process=":sandboxed_process8"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService9"
-                 android:process=":sandboxed_process9"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService10"
-                 android:process=":sandboxed_process10"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService11"
-                 android:process=":sandboxed_process11"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService12"
-                 android:process=":sandboxed_process12"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService13"
-                 android:process=":sandboxed_process13"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService14"
-                 android:process=":sandboxed_process14"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService15"
-                 android:process=":sandboxed_process15"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService16"
-                 android:process=":sandboxed_process16"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService17"
-                 android:process=":sandboxed_process17"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService18"
-                 android:process=":sandboxed_process18"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <service android:name="org.chromium.content.app.SandboxedProcessService19"
-                 android:process=":sandboxed_process19"
-                 android:isolatedProcess="true"
-                 android:exported="false" />
-
-        <!-- Provider for FileProvider. -->
-        <provider android:name="android.support.v4.content.FileProvider"
-            android:authorities="com.android.browser.FileProvider"
-            android:exported="false"
-            android:grantUriPermissions="true">
-            <meta-data android:name="android.support.FILE_PROVIDER_PATHS"
-                android:resource="@xml/file_paths" />
-        </provider>
-    </application>
-
-    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="19" />
-
-    <uses-feature android:name="android.hardware.location.gps" android:required="false" />
-
-</manifest>
-
diff --git a/swe_android_browser.gypi b/swe_android_browser.gypi
index 4d3a70a..ce875e5 100644
--- a/swe_android_browser.gypi
+++ b/swe_android_browser.gypi
@@ -1,4 +1,7 @@
 {
+  'variables' : {
+    'manifest_package_name%' : 'org.codeaurora.swe.browser.beta',
+  },
   'targets' : [
     {
       'target_name': 'swe_android_browser_apk',
@@ -12,9 +15,7 @@
       ],
       'variables': {
         'apk_name': 'SWE_AndroidBrowser',
-        'manifest_package_name': 'com.android.browser',
         'native_lib_version_name': '<(version_full)',
-        #'package_name': 'swe_android_browser_apk',
         'java_in_dir': '.',
         'resource_dir': '../browser/res',
         'assets_dir': '../../swe/browser/assets',
@@ -44,8 +45,8 @@
         'additional_input_paths': [
           '<@(chrome_android_pak_output_resources)',
         ],
-        'override_package_name': 'org.codeaurora.swe.browser.beta',
-        'android_manifest_path': '../../swe/browser/AndroidManifest.xml',
+        'override_package_name': '<(manifest_package_name)',
+        'android_manifest_path': '<(SHARED_INTERMEDIATE_DIR)/swe_android_browser_apk/AndroidManifest.xml',
         'additional_src_dirs': ['<(DEPTH)/swe/browser/src_standalone/com/android/browser'],
       },
 
@@ -67,5 +68,21 @@
       ],
       'includes': [ '../../build/java_apk.gypi' ],
     },
+    {
+      'target_name': 'swe_android_browser_apk_manifest',
+      'type': 'none',
+      'variables': {
+        'jinja_inputs': ['<(DEPTH)/swe/browser/AndroidManifest.xml',
+                        ],
+        'jinja_output': '<(SHARED_INTERMEDIATE_DIR)/swe_android_browser_apk/AndroidManifest.xml',
+        'standalone_manifest_package_name' : 'org.codeaurora.swe.browser.beta',
+        'jinja_variables': ['package_name=<(standalone_manifest_package_name)',
+                            'apk_label=@string/application_name_swe',
+                            'apk_icon=@mipmap/ic_launcher_browser_swe_beta',
+                            'apk_task_affinity=<(standalone_manifest_package_name)',
+                            'apk_authorities=swe.browser.beta',],
+      },
+      'includes': [ '../../build/android/jinja_template.gypi' ],
+    },
   ],
 }