Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zhani/adapt new backend api #160

Merged
merged 5 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
java-version: 17
- name: Check Code Format
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v2.4.2
with:
arguments: checkFormat

Expand All @@ -31,7 +31,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
java-version: 17
- name: Check JNI
run: |
cd tools/jni-test && \
Expand All @@ -50,13 +50,13 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
java-version: 17
- name: Execute Android Linter
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v2.4.2
with:
arguments: lint
- name: Build Project
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v2.4.2
with:
arguments: assemble${{ inputs.build_type }}
- name: Save MiniBrowser Artifacts
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ You can optionally create a debug build of WPEWebKit passing the `--debug` optio
```

Finally, the bootstrap option accepts the `--arch` option to set the target architecture.
Currently supported architectures are `arm64`, `armv7`, `x86` and `x86_64`.
Currently supported architectures are `arm64` and `x86_64`.


### Android Studio
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'com.android.application' version '7.4.0' apply false
id 'com.android.library' version '7.4.0' apply false
id 'com.android.application' version '8.1.2' apply false
id 'com.android.library' version '8.1.2' apply false
}

tasks.register("clean", Delete) {
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ kotlin.code.style=official
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
20 changes: 14 additions & 6 deletions tools/mediaplayer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ plugins {

android {
namespace 'com.wpe.tools.mediaplayer'
compileSdk 33
buildToolsVersion '33.0.1'
compileSdk 34

defaultConfig {
minSdk 29
targetSdk 33
minSdk 31
targetSdk 34
versionCode 1
versionName '1.0'
}

buildTypes {
release {
minifyEnabled true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
}
}
Expand All @@ -35,5 +34,14 @@ android {

dependencies {
implementation project(':wpe')
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'androidx.appcompat:appcompat:1.6.1'

modules {
module("org.jetbrains.kotlin:kotlin-stdlib-jdk7") {
replacedBy("org.jetbrains.kotlin:kotlin-stdlib", "kotlin-stdlib-jdk7 is now part of kotlin-stdlib")
}
module("org.jetbrains.kotlin:kotlin-stdlib-jdk8") {
replacedBy("org.jetbrains.kotlin:kotlin-stdlib", "kotlin-stdlib-jdk8 is now part of kotlin-stdlib")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,8 @@ public void onWindowFocusChanged(boolean hasFocus) {
if (hasFocus) {
View rootView = findViewById(android.R.id.content);
if (rootView != null) {
if (Build.VERSION.SDK_INT >= 30) {
rootView.getWindowInsetsController().hide(WindowInsets.Type.statusBars() |
WindowInsets.Type.navigationBars());
} else {
rootView = rootView.getRootView();
if (rootView != null) {
rootView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
rootView.getWindowInsetsController().hide(WindowInsets.Type.statusBars() |
WindowInsets.Type.navigationBars());
}
}
}
Expand Down
30 changes: 19 additions & 11 deletions tools/minibrowser/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ plugins {

android {
namespace 'com.wpe.tools.minibrowser'
compileSdk 33
buildToolsVersion '33.0.1'
compileSdk 34

defaultConfig {
minSdk 29
targetSdk 33
minSdk 31
targetSdk 34
versionCode 1
versionName '1.0'
}
Expand Down Expand Up @@ -45,11 +44,20 @@ android {

dependencies {
implementation project(':wpe')
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.fragment:fragment-ktx:1.5.5'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.fragment:fragment-ktx:1.6.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.4'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.4'
implementation 'androidx.preference:preference-ktx:1.2.1'

modules {
module("org.jetbrains.kotlin:kotlin-stdlib-jdk7") {
replacedBy("org.jetbrains.kotlin:kotlin-stdlib", "kotlin-stdlib-jdk7 is now part of kotlin-stdlib")
}
module("org.jetbrains.kotlin:kotlin-stdlib-jdk8") {
replacedBy("org.jetbrains.kotlin:kotlin-stdlib", "kotlin-stdlib-jdk8 is now part of kotlin-stdlib")
}
}
}
10 changes: 3 additions & 7 deletions tools/scripts/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

class Bootstrap:
default_arch = "arm64"
default_version = "2.38.3"
default_version = "2.42.1"

_cerbero_origin = "https://github.com/Igalia/cerbero.git"
_cerbero_branch = "wpe-android"
Expand Down Expand Up @@ -448,10 +448,6 @@ def install_deps(self):

if self._arch == "arm64":
android_abi = "arm64-v8a"
elif self._arch == "armv7":
android_abi = "armeabi-v7a"
elif self._arch == "x86":
android_abi = "x86"
elif self._arch == "x86_64":
android_abi = "x86_64"
else:
Expand Down Expand Up @@ -493,7 +489,7 @@ def run(self):
)

parser.add_argument("-a", "--arch", metavar="architecture", required=False, default=Bootstrap.default_arch,
choices=["arm64", "armv7", "x86", "x86_64", "all"], help="The target architecture")
choices=["arm64", "x86_64", "all"], help="The target architecture")
parser.add_argument("-v", "--version", metavar="version", required=False, default=Bootstrap.default_version,
help="Specify the wpewebkit version to use (ignored if using --cerbero or --build, "
"in these cases the version is taken from the Cerbero build)")
Expand All @@ -510,7 +506,7 @@ def run(self):

args = parser.parse_args()
if args.arch == "all":
for arch in ["arm64", "armv7", "x86", "x86_64"]:
for arch in ["arm64", "x86_64"]:
args.arch = arch
print(args)
Bootstrap(args).run()
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/build-patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def run(self):
)

parser.add_argument("-a", "--arch", metavar="architecture", required=False, default=Bootstrap.default_arch,
choices=["arm64", "armv7", "x86", "x86_64"], help="The target architecture")
choices=["arm64", "x86_64"], help="The target architecture")
parser.add_argument("-r", "--recipe", metavar="recipe", required=False, default=BuildPatch.default_recipe,
help="Specify the Cerbero recipe to build")
parser.add_argument("-c", "--cerbero", metavar="path", required=False, help="Path to an external Cerbero build")
Expand Down
20 changes: 13 additions & 7 deletions wpe/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ plugins {

android {
namespace 'com.wpe.wpe'
compileSdk 33
buildToolsVersion '33.0.1'
ndkVersion '25.1.8937393'
compileSdk 34
ndkVersion '25.2.9519653'

defaultConfig {
minSdk 29
targetSdk 33
minSdk 31
targetSdk 34
}

lintOptions {
disable 'ChromeOsAbiSupport'
}

buildTypes {
Expand Down Expand Up @@ -39,6 +42,9 @@ android {
// entry for each Service we expect to launch. This magic number is taken from GeckoView,
// which uses a similar approach.
final NUMBER_OF_AUX_PROCESSES = 40
buildFeatures {
aidl true
}

libraryVariants.all { variant ->
def genDir = new File(project.buildDir, "generated/source/services/${variant.name}")
Expand Down Expand Up @@ -83,13 +89,13 @@ android {
}

dependencies {
implementation 'androidx.annotation:annotation:1.5.0'
implementation 'androidx.annotation:annotation:1.7.0'
}

gradle.afterProject { project ->
if (project == getProject()) {
def abiList = []
for (abi in ['x86_64', 'x86', 'arm64-v8a', 'armeabi-v7a']) {
for (abi in ['x86_64', 'arm64-v8a']) {
if (file("src/main/jniLibs/$abi").isDirectory())
abiList.add(abi)
}
Expand Down
48 changes: 48 additions & 0 deletions wpe/src/main/cpp/Browser/Fence.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Copyright (C) 2023 Igalia S.L. <[email protected]>
* Author: Jani Hautakangas <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "Fence.h"

#include <algorithm>
#include <android/sync.h>
#include <memory>
#include <poll.h>

using sync_file_info_data = struct sync_file_info;

Fence::FenceStatus Fence::getStatus(int fileDescriptor)
{
auto info = std::unique_ptr<sync_file_info_data, void (*)(sync_file_info_data*)> {
sync_file_info(fileDescriptor), sync_file_info_free};
if (info == nullptr) {
return FenceStatus::Invalid;
}

if (info->status != 1) {
return FenceStatus::NotSignaled;
}

__u64 timestamp = 0U;
auto* fenceInfo = sync_get_fence_info(info.get());
for (size_t i = 0; i < info->num_fences; i++) {
timestamp = std::max(timestamp, fenceInfo->timestamp_ns);
}

return FenceStatus::Signaled;
}
31 changes: 31 additions & 0 deletions wpe/src/main/cpp/Browser/Fence.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Copyright (C) 2023 Igalia S.L. <[email protected]>
* Author: Jani Hautakangas <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#pragma once

class Fence {
public:
enum FenceStatus {
Signaled,
NotSignaled,
Invalid
};

static FenceStatus getStatus(int fileDescriptor);
};
Loading