Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Commit

Permalink
Add ChromePublic target
Browse files Browse the repository at this point in the history
  • Loading branch information
wchen342 committed Jan 14, 2020
1 parent 0c450d9 commit 68ed09a
Show file tree
Hide file tree
Showing 13 changed files with 163 additions and 126 deletions.
71 changes: 38 additions & 33 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,52 @@
# 74.0.3729.169-1
* First release
# 79.0.3945.117-2
* Add ChromePublic target (API 19)
* Fix build failure for safe browsing
* Update `README`

# 75.0.3770.80-1
* Reduce downloaded dependencies on gclient sync
* Prune more binaries
* Build gcm-client, eu-strip, closure-compiler from source; change error-prone to Maven version
* Domain substitution on all non-binary files
# 79.0.3945.117-1
* Update NDK to r20b
* Remove split installer dependencies (Google Play), disable DFM
* Other source fixes
* Known issue: ~~some pages, including `chrome://flags`, `chrome://gpu` are not working~~ (Fixed)

# 75.0.3770.100-1
* Change package name to avoid conflict with chromium
# 78.0.3904.97-1
* Update scripts and patches to new version
* Merge patches from Bromite and Unobtainium
* New dependencies: nodejs binaries, lib files from ndk

# 75.0.3770.142-1
* Fix [#3](https://github.com/wchen342/ungoogled-chromium-android/issues/3)
* Disable resource obfuscation
* Add arm build
# 77.0.3865.90-1
* Update patches to new version
* Update GN to latest commit
* Minor fixes

# 75.0.3770.142-2
* Remove all Google Play related libraries
* Uncheck "Send statistics" on first run
# 76.0.3809.132-1
* No change

# 76.0.3809.100-1
* Change default setting of contextual search to false

# 76.0.3809.87-1
* Add WebView builds
* Since `aapt` no longer works, bundled `aapt2` will be used until a rebuild of SDK 29 exists
* Minor bug fixes

# 76.0.3809.100-1
* Change default setting of contextual search to false
# 75.0.3770.142-2
* Remove all Google Play related libraries
* Uncheck "Send statistics" on first run

# 76.0.3809.132-1
* No change
# 75.0.3770.142-1
* Fix [#3](https://github.com/wchen342/ungoogled-chromium-android/issues/3)
* Disable resource obfuscation
* Add arm build

# 77.0.3865.90-1
* Update patches to new version
* Update GN to latest commit
* Minor fixes
# 75.0.3770.100-1
* Change package name to avoid conflict with chromium

# 78.0.3904.97-1
* Update scripts and patches to new version
* Merge patches from Bromite and Unobtainium
* New dependencies: nodejs binaries, lib files from ndk
# 75.0.3770.80-1
* Reduce downloaded dependencies on gclient sync
* Prune more binaries
* Build gcm-client, eu-strip, closure-compiler from source; change error-prone to Maven version
* Domain substitution on all non-binary files

# 79.0.3945.117-1
* Update NDK to r20b
* Remove split installer dependencies (Google Play), disable DFM
* Other source fixes
* Known issue: ~~some pages, including `chrome://flags`, `chrome://gpu` are not working~~ (Fixed)
# 74.0.3729.169-1
* First release
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ For more information on `ungoogled-chromium`, please visit the original repo: [E
## Content Overview

* [Differences from ungoogled-chromium](#differences-from-ungoogled-chromium)
* [Supported Platforms](#supported-platforms)
* [Platforms and Versions](#platforms-and-versions)
* [Building Instructions](#building-instructions)
* [Reporting and Contributing](#reporting-and-contributing)
* [F-droid Repository](#f-droid-repository)
Expand All @@ -29,20 +29,23 @@ For more information on `ungoogled-chromium`, please visit the original repo: [E
* Android specific patches and fixes are applied.
* Default configuration builds for `arm64` instead of `x64`.

## Supported Platforms
## Platforms and Versions

The current build has been tested on:
* cpu_arch: `x86`, `arm`, `arm64`
* OS: API 28 (Android 9.0), API 27 (Android 8.1), LineageOS 16.0

Theoretically it will run on any device with a minimum API of 24 (Nougat).
Pre-built apks are named as `{BUILD_TARGET}_{CPU_ARCH}.apk`, where:
* `{BUILD_TARGET}` is one of `ChromePublic`, `MonoChromePublic`, `SystemWebview`.
* `ChromePublic` is for API > 19 (Android 4.4) and only contains the browser.
* `MonoChromePublic` is for API > 24 (Android 7.0) and contains both the browser and the webview.
* `SystemWebview` is for API 21 - 23 (Android 5.0 - 6.0) and only contains the webview.
* `{CPU_ARCH}` is one of `x86`, `arm` (armeabi-v7a), `arm64` (arm64-v8a).
* Please also read this [important note](https://chromium.googlesource.com/chromium/src/+/HEAD/android_webview/docs/build-instructions.md#Important-notes-for-N_P) about Webview on Android N-P.
* The [Bromite Wiki](https://github.com/bromite/bromite/wiki/Installing-SystemWebView) can also be helpful.


## Building Instructions
*This build is built from Sylvain Beucler's [libre Android rebuilds](https://android-rebuilds.beuc.net/) instead of SDK/NDK binaries from Google.*

* Clone this repository
* If you want to enable proprietary codecs (h264, mp3, mp4, etc.), add `proprietary_codecs=true` to the end of `android_flags.gn`
* ~~If you want to enable proprietary codecs (h264, mp3, mp4, etc.), add `proprietary_codecs=true` to the end of `android_flags.gn`.~~ It is now the default, since `proprietary_codecs` does not add the actual codecs, only codes to handle those file types.
* enter repo directory and run `./build.sh`.

Build time dependencies can be roughly referred from [AUR](https://aur.archlinux.org/packages/ungoogled-chromium/).
Expand Down
2 changes: 0 additions & 2 deletions android_flags.gn
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
android_channel="stable"
android32_ndk_api_level=21
android64_ndk_api_level=21
android_ndk_root = "//third_party/android_ndk"
android_ndk_version = "r20b"
android_ndk_major_version = 20
Expand Down
6 changes: 4 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ set -eux -o pipefail

chromium_version=79.0.3945.117
ungoogled_chromium_revision=1
chrome_target=chrome_public_apk
monochrome_target=monochrome_public_apk
monochrome_webview_target=system_webview_apk
webview_target=system_webview_apk

# Required tools: python2, python3, ninja, git, clang, lld, llvm, curl, wget, npm
# Assuming default python to be python2. This is true on most Linux distributions.
Expand Down Expand Up @@ -218,6 +219,7 @@ patch -p1 --ignore-whitespace -i patches/ignore-aidl-assertion-error.patch --no-

## Build
pushd src
/usr/bin/ninja -C out/Default ${chrome_target}
/usr/bin/ninja -C out/Default ${monochrome_target}
/usr/bin/ninja -C out/Default ${monochrome_webview_target}
/usr/bin/ninja -C out/Default ${webview_target}
popd
9 changes: 5 additions & 4 deletions misc/android_studio_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
set -eux -o pipefail

chromium_version=79.0.3945.117
target=monochrome_public_apk
#target=system_webview_apk
chrome_target=chrome_public_apk
monochrome_target=monochrome_public_apk
webview_target=system_webview_apk

# Create symbol links to gn, depot-tools
pushd src
Expand Down Expand Up @@ -38,7 +39,7 @@ cat ../android_flags.debug.gn ../android_flags.gn > ${output_folder}/args.gn
tools/gn/out/gn gen ${output_folder} --fail-on-unused-args

# Compile apk
/usr/bin/ninja -C ${output_folder} ${target}
/usr/bin/ninja -C ${output_folder} ${monochrome_target}
popd

###
Expand All @@ -56,5 +57,5 @@ tools/gn/out/gn gen ${output_folder} --fail-on-unused-args
pushd ..
patch -p1 --ignore-whitespace -i patches/generate_gradle.patch --no-backup-if-mismatch
popd
python build/android/gradle/generate_gradle.py --target //chrome/android:${target} --output-directory ${output_folder}
python build/android/gradle/generate_gradle.py --target //chrome/android:${monochrome_target} --output-directory ${output_folder}
popd
12 changes: 6 additions & 6 deletions patches/Unobtainium/kill-GCM.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ Subject: kill GCM
.../browser/services/gcm/GCMBackgroundTask.java | 2 +-
.../gcm/InvalidationGcmUpstreamSender.java | 18 --
components/background_task_scheduler/BUILD.gn | 1 -
.../BackgroundTaskSchedulerGcmNetworkManager.java | 208 +--------------------
.../BackgroundTaskSchedulerGcmNetworkManager.java | 206 +--------------------
components/gcm_driver/android/BUILD.gn | 1 -
components/gcm_driver/instance_id/android/BUILD.gn | 1 -
.../gcm_driver/instance_id/InstanceIDBridge.java | 52 +-----
components/sync/android/BUILD.gn | 1 -
third_party/cacheinvalidation/BUILD.gn | 6 -
.../client/contrib/MultiplexingGcmListener.java | 91 +--------
.../android2/channel/AndroidNetworkChannel.java | 6 +-
16 files changed, 10 insertions(+), 496 deletions(-)
16 files changed, 10 insertions(+), 494 deletions(-)

diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
--- a/chrome/android/BUILD.gn
Expand All @@ -43,7 +43,7 @@ diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java
"java/src/org/chromium/chrome/browser/ChromeBackupAgent.java",
"java/src/org/chromium/chrome/browser/ChromeBackupWatcher.java",
"java/src/org/chromium/chrome/browser/ChromeBaseAppCompatActivity.java",
@@ -1438,11 +1437,6 @@ chrome_java_sources = [
@@ -1437,11 +1436,6 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/services/AndroidEduAndChildAccountHelper.java",
"java/src/org/chromium/chrome/browser/services/AndroidEduOwnerCheckCallback.java",
"java/src/org/chromium/chrome/browser/services/GoogleServicesManager.java",
Expand Down Expand Up @@ -354,7 +354,7 @@ diff --git a/components/background_task_scheduler/android/java/src/org/chromium/
import org.chromium.base.Log;
import org.chromium.base.ThreadUtils;
import org.chromium.base.VisibleForTesting;
@@ -43,212 +35,14 @@ class BackgroundTaskSchedulerGcmNetworkManager implements BackgroundTaskSchedule
@@ -43,212 +35,16 @@ class BackgroundTaskSchedulerGcmNetworkManager implements BackgroundTaskSchedule
sClock = clock;
}

Expand Down Expand Up @@ -517,7 +517,7 @@ diff --git a/components/background_task_scheduler/android/java/src/org/chromium/
- return Task.NETWORK_STATE_ANY;
- }
-
- @Override
@Override
public boolean schedule(Context context, @NonNull TaskInfo taskInfo) {
ThreadUtils.assertOnUiThread();

Expand All @@ -541,7 +541,7 @@ diff --git a/components/background_task_scheduler/android/java/src/org/chromium/
+ return false;
}

- @Override
@Override
public void cancel(Context context, int taskId) {
ThreadUtils.assertOnUiThread();
-
Expand Down
2 changes: 1 addition & 1 deletion patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ src-fix/fix-null-mInstanceID.patch
src-fix/fix-unkown-warning-clang-9.patch
src-fix/fix-safe-browsing-prefs.patch
src-fix/fix-wrong-macro-kSigninAllowedOnNextStartup.patch
src-fix/fix-extra-safe-browsing.patch
Vanadium/0020-disable-media-router-media-remoting-by-default.patch
Vanadium/0021-disable-media-router-by-default.patch
Unobtainium/kill-Auth.patch
Expand All @@ -12,7 +13,6 @@ Unobtainium/kill-Vision.patch
Unobtainium/kill-Translate.patch
Unobtainium/kill-TOS-and-metrics-opt-out.patch
ungoogled-chromium-android/change-package-name-chromium.patch
ungoogled-chromium-android/linker-android-support-remove.patch
ungoogled-chromium-android/Remove-dependency-on-com.google.android.gcm.patch
ungoogled-chromium-android/Remove-dependency-on-com.google.android.gms.gcm.patch
ungoogled-chromium-android/Remove-dependency-on-com.google.android.gms.auth.patch
Expand Down
52 changes: 52 additions & 0 deletions patches/src-fix/fix-extra-safe-browsing.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
From: Wengling Chen <[email protected]>
Date: Mon, 13 Jan 2020 23:03:53 -0500
Subject: Extra fix for build without safe browsing

---
chrome/android/BUILD.gn | 1 -
chrome/android/chrome_java_sources.gni | 1 -
.../src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java | 3 +--
3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@@ -2659,7 +2659,6 @@ generate_jni("chrome_jni_headers") {
"java/src/org/chromium/chrome/browser/rappor/RapporServiceBridge.java",
"java/src/org/chromium/chrome/browser/rlz/RevenueStats.java",
"java/src/org/chromium/chrome/browser/rlz/RlzPingHandler.java",
- "java/src/org/chromium/chrome/browser/safe_browsing/FileTypePolicies.java",
"java/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceFactory.java",
"java/src/org/chromium/chrome/browser/send_tab_to_self/NotificationManager.java",
"java/src/org/chromium/chrome/browser/send_tab_to_self/SendTabToSelfAndroidBridge.java",
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni
--- a/chrome/android/chrome_java_sources.gni
+++ b/chrome/android/chrome_java_sources.gni
@@ -1413,7 +1413,6 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/rappor/RapporServiceBridge.java",
"java/src/org/chromium/chrome/browser/rlz/RevenueStats.java",
"java/src/org/chromium/chrome/browser/rlz/RlzPingHandler.java",
- "java/src/org/chromium/chrome/browser/safe_browsing/FileTypePolicies.java",
"java/src/org/chromium/chrome/browser/search_engines/SearchEngineChoiceMetrics.java",
"java/src/org/chromium/chrome/browser/search_engines/SearchEngineChoiceNotification.java",
"java/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceFactory.java",
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java
@@ -19,7 +19,6 @@ import org.chromium.base.task.AsyncTask;
import org.chromium.base.task.PostTask;
import org.chromium.base.task.TaskRunner;
import org.chromium.base.task.TaskTraits;
-import org.chromium.chrome.browser.safe_browsing.FileTypePolicies;
import org.chromium.chrome.browser.share.ShareHelper;
import org.chromium.chrome.browser.share.ShareParams;
import org.chromium.content_public.browser.WebContents;
@@ -196,7 +195,7 @@ public class ShareServiceImpl implements ShareService {

for (SharedFile file : files) {
RecordHistogram.recordSparseHistogram(
- "WebShare.Unverified", FileTypePolicies.umaValueForFile(file.name));
+ "WebShare.Unverified", 1);
}

for (SharedFile file : files) {
48 changes: 28 additions & 20 deletions patches/src-fix/fix-wrong-macro-kSigninAllowedOnNextStartup.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,60 @@ Date: Fri, 10 Jan 2020 23:04:00 -0500
Subject: Fix wrong macro definition related to kSigninAllowedOnNextStartup

---
chrome/browser/policy/browser_signin_policy_handler.cc | 12 ------------
.../policy/configuration_policy_handler_list_factory.cc | 6 ------
2 files changed, 18 deletions(-)
.../policy/browser_signin_policy_handler.cc | 23 ----------------------
.../configuration_policy_handler_list_factory.cc | 10 ----------
2 files changed, 33 deletions(-)

diff --git a/chrome/browser/policy/browser_signin_policy_handler.cc b/chrome/browser/policy/browser_signin_policy_handler.cc
--- a/chrome/browser/policy/browser_signin_policy_handler.cc
+++ b/chrome/browser/policy/browser_signin_policy_handler.cc
@@ -44,24 +44,12 @@ void BrowserSigninPolicyHandler::ApplyPolicySettings(const PolicyMap& policies,
FALLTHROUGH;
case BrowserSigninMode::kEnabled:
prefs->SetValue(
@@ -41,29 +41,6 @@ void BrowserSigninPolicyHandler::ApplyPolicySettings(const PolicyMap& policies,
#if !defined(OS_LINUX)
prefs->SetValue(prefs::kForceBrowserSignin, base::Value(true));
#endif
- FALLTHROUGH;
- case BrowserSigninMode::kEnabled:
- prefs->SetValue(
-#if defined(OS_ANDROID)
- // The new kSigninAllowedOnNextStartup pref is only used on Desktop.
- // Keep the old kSigninAllowed pref for Android until the policy is
- // fully deprecated in M71 and can be removed.
-#else
prefs::kSigninAllowedOnNextStartup,
- prefs::kSigninAllowedOnNextStartup,
-#endif
base::Value(true));
break;
case BrowserSigninMode::kDisabled:
prefs->SetValue(
- base::Value(true));
- break;
- case BrowserSigninMode::kDisabled:
- prefs->SetValue(
-#if defined(OS_ANDROID)
- // The new kSigninAllowedOnNextStartup pref is only used on Desktop.
- // Keep the old kSigninAllowed pref for Android until the policy is
- // fully deprecated in M71 and can be removed.
-#else
prefs::kSigninAllowedOnNextStartup,
- prefs::kSigninAllowedOnNextStartup,
-#endif
base::Value(false));
break;
- base::Value(false));
- break;
}
}
}
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
--- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc
+++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -1398,13 +1398,7 @@ std::unique_ptr<ConfigurationPolicyHandlerList> BuildHandlerList(
base::Value::Type::BOOLEAN));
@@ -1396,16 +1396,6 @@ std::unique_ptr<ConfigurationPolicyHandlerList> BuildHandlerList(
signin_legacy_policies.push_back(std::make_unique<SimplePolicyHandler>(
key::kSigninAllowed,
key::kForceBrowserSignin, prefs::kForceBrowserSignin,
base::Value::Type::BOOLEAN));
- signin_legacy_policies.push_back(std::make_unique<SimplePolicyHandler>(
- key::kSigninAllowed,
-#if defined(OS_ANDROID)
- // The new kSigninAllowedOnNextStartup pref is only used on Desktop.
- // Keep the old kSigninAllowed pref for Android until the policy is
- // fully deprecated in M71 and can be removed.
-#else
prefs::kSigninAllowedOnNextStartup,
- prefs::kSigninAllowedOnNextStartup,
-#endif
base::Value::Type::BOOLEAN));
- base::Value::Type::BOOLEAN));
handlers->AddHandler(std::make_unique<LegacyPoliciesDeprecatingPolicyHandler>(
std::move(signin_legacy_policies),
std::make_unique<BrowserSigninPolicyHandler>(chrome_schema)));
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/
clientKey = "";
try {
- registrationId = GCMRegistrar.getRegistrationId(context);
+ registrationId = null;
+ registrationId = null;
} catch (RuntimeException exception) {
// GCMRegistrar#getRegistrationId occasionally throws a runtime exception. Catching the
// exception rather than crashing.
Expand Down
Loading

0 comments on commit 68ed09a

Please sign in to comment.