Skip to content

Commit

Permalink
Upgrade Android Component version to 121.0
Browse files Browse the repository at this point in the history
Upgrade AGP to 8.0.2

An R8 error stops us from upgrading to 8.2.0:
https://issuetracker.google.com/issues/277166577

Since we don't use `whenTaskAdded` anywhere, maybe it's
caused by one of our dependency

Signed-off-by: Songlin Jiang <[email protected]>
  • Loading branch information
HollowMan6 committed Dec 31, 2023
1 parent f070274 commit 6ab0fa7
Show file tree
Hide file tree
Showing 21 changed files with 111 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
description: 'Gradle version'
required: false
type: string
default: "7.5"
default: "8.0"

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ dependencies {
// HVR
hvrImplementation fileTree(dir: "${project.rootDir}/third_party/hvr", include: ['*.jar'])
hvrImplementation 'com.huawei.agconnect:agconnect-core-harmony:1.1.0.300'
hvrImplementation 'com.huawei.agconnect:agconnect-core:1.6.5.300'
hvrImplementation 'com.huawei.agconnect:agconnect-core:1.9.1.301'
hvrImplementation 'com.huawei.hms:hianalytics:6.3.2.300'
hvrImplementation 'com.huawei.hms:ml-computer-voice-asr:3.1.0.300'
hvrImplementation 'com.huawei.hms:location:6.2.0.300'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,20 +342,29 @@ class GeckoWebExtension(
*/
override fun getMetadata(): Metadata {
return nativeExtension.metaData.let {
Metadata(
mozilla.components.concept.engine.webextension.Metadata(
name = it.name,
description = it.description,
developerName = it.creatorName,
developerUrl = it.creatorUrl,
homePageUrl = it.homepageUrl,
homepageUrl = it.homepageUrl,
version = it.version,
permissions = it.permissions.toList(),
// Origins is marked as @NonNull but may be null: https://bugzilla.mozilla.org/show_bug.cgi?id=1629957
hostPermissions = it.origins.orEmpty().toList(),
disabledFlags = DisabledFlags.select(it.disabledFlags),
optionsPageUrl = it.optionsPageUrl,
openOptionsPageInTab = it.openOptionsPageInTab,
baseUrl = it.baseUrl
baseUrl = it.baseUrl,
averageRating = it.averageRating.toFloat(),
creatorName = it.creatorName,
creatorUrl = it.creatorUrl,
detailUrl = it.homepageUrl,
downloadUrl = it.downloadUrl,
fullDescription = it.fullDescription,
reviewCount = it.reviewCount,
reviewUrl = it.reviewUrl,
updateDate = it.updateDate
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import mozilla.components.feature.addons.Addon
import mozilla.components.feature.addons.amo.AddonCollectionProvider
import mozilla.components.feature.addons.amo.AMOAddonsProvider
import mozilla.components.feature.addons.ui.AddonsManagerAdapterDelegate
import mozilla.components.feature.addons.ui.CustomViewHolder
import mozilla.components.feature.addons.ui.CustomViewHolder.AddonViewHolder
Expand All @@ -57,7 +57,7 @@ private const val VIEW_HOLDER_TYPE_ADDON = 1
*/
@Suppress("TooManyFunctions", "LargeClass")
class AddonsManagerAdapter(
private val addonCollectionProvider: AddonCollectionProvider,
private val addonCollectionProvider: AMOAddonsProvider,
private val addonsManagerDelegate: AddonsManagerAdapterDelegate,
addons: List<Addon>,
private val style: Style? = null
Expand Down Expand Up @@ -105,6 +105,7 @@ class AddonsManagerAdapter(
val userCountView = view.findViewById<TextView>(R.id.users_count)
val addButton = view.findViewById<ImageView>(R.id.add_button)
val allowedInPrivateBrowsingLabel = view.findViewById<ImageView>(R.id.allowed_in_private_browsing_label)
val statusErrorView = view.findViewById<TextView>(R.id.add_on_status_error_message)
return AddonViewHolder(
view,
iconView,
Expand All @@ -114,7 +115,8 @@ class AddonsManagerAdapter(
ratingAccessibleView,
userCountView,
addButton,
allowedInPrivateBrowsingLabel
allowedInPrivateBrowsingLabel,
statusErrorView
)
}

Expand Down Expand Up @@ -158,15 +160,12 @@ class AddonsManagerAdapter(
// for contentDescription for the TalkBack feature
holder.ratingAccessibleView.text = ratingContentDescription
holder.ratingView.rating = addon.rating!!.average
holder.userCountView.text = String.format(userCount, getFormattedAmount(addon.rating!!.reviews))

holder.ratingView.visibility = View.VISIBLE
holder.ratingAccessibleView.visibility = View.VISIBLE
holder.userCountView.visibility = View.VISIBLE
} else {
holder.ratingView.visibility = View.GONE
holder.ratingAccessibleView.visibility = View.GONE
holder.userCountView.visibility = View.GONE
}

val displayLanguage = LocaleUtils.getDisplayLanguage(context).locale.language
Expand Down Expand Up @@ -236,7 +235,7 @@ class AddonsManagerAdapter(
// if takes less than a second, we assume it comes
// from a cache and we don't show any transition animation.
val startTime = System.currentTimeMillis()
val iconBitmap = addonCollectionProvider.getAddonIconBitmap(addon) ?: addon.installedState?.icon
val iconBitmap = addon.icon?: addon.installedState?.icon
val timeToFetch: Double = (System.currentTimeMillis() - startTime) / 1000.0
val isFromCache = timeToFetch < 1
if (iconBitmap != null) iconDrawable = BitmapDrawable(iconView.resources, iconBitmap)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void bind(Addon addon) {
// If the addon is not installed we set the homepage link
mBinding.homepage.setOnClickListener(view -> {
view.requestFocusFromTouch();
mWidgetManager.openNewTabForeground(mBinding.getAddon().getSiteUrl());
mWidgetManager.openNewTabForeground(mBinding.getAddon().getHomepageUrl());
});

bindTranslatedDescription(mBinding.addonDescription, addon);
Expand Down Expand Up @@ -133,9 +133,7 @@ public void onClick(@NonNull View view) {
private void bindAuthors(@NonNull TextView view, Addon addon) {
String text = view.getContext().getString(R.string.addons_no_authors);
if (addon != null) {
String authors = addon.getAuthors().stream()
.map(Addon.Author::getName)
.collect(Collectors.joining( "," ));
String authors = addon.getAuthor().getName();
if (!authors.isEmpty()) {
text = authors;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,4 +275,16 @@ public void onAddonsUpdated() {
});
}

@Override
public void onFindMoreAddonsButtonClicked() {
}

@Override
public boolean shouldShowFindMoreAddonsButton() {
return false;
}

@Override
public void onLearnMoreLinkClicked(@NonNull LearnMoreLinks learnMoreLinks, @NonNull Addon addon) {
}
}
8 changes: 4 additions & 4 deletions app/src/common/shared/com/igalia/wolvic/browser/Addons.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import mozilla.components.concept.engine.webextension.Action
import mozilla.components.concept.engine.webextension.EnableSource
import mozilla.components.feature.addons.Addon
import mozilla.components.feature.addons.AddonManager
import mozilla.components.feature.addons.amo.AddonCollectionProvider
import mozilla.components.feature.addons.amo.AMOAddonsProvider
import mozilla.components.feature.addons.update.DefaultAddonUpdater
import mozilla.components.feature.addons.update.GlobalAddonDependencyProvider
import mozilla.components.support.base.android.NotificationsDelegate
Expand All @@ -52,14 +52,14 @@ class Addons(val context: Context, private val sessionStore: SessionStore) {

val addonCollectionProvider by lazy {
if (BuildConfig.AMO_COLLECTION.isNotEmpty()) {
AddonCollectionProvider(
AMOAddonsProvider(
context,
EngineProvider.getDefaultClient(context),
collectionName = BuildConfig.AMO_COLLECTION,
maxCacheAgeInMinutes = DAY_IN_MINUTES
)
} else {
AddonCollectionProvider(
AMOAddonsProvider(
context,
EngineProvider.getDefaultClient(context),
maxCacheAgeInMinutes = DAY_IN_MINUTES)
Expand Down Expand Up @@ -220,7 +220,7 @@ class Addons(val context: Context, private val sessionStore: SessionStore) {
val enabled = installedExtensions[addons[i].id]?.isEnabled() ?: false
val icon = CoroutineScope(Dispatchers.Main).future {
try {
installedExtensions[addons[i].id]?.loadIcon(AddonManager.TEMPORARY_ADDON_ICON_SIZE)
installedExtensions[addons[i].id]?.loadIcon(AddonManager.ADDON_ICON_SIZE)
} catch (throwable: Throwable) {
Logger.warn("Failed to load addon icon.", throwable)
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class HistoryStore constructor(val context: Context) {

fun getDetailedHistory(): CompletableFuture<List<VisitInfo>?> = GlobalScope.future {
storage.getDetailedVisits(0, excludeTypes = listOf(
VisitType.NOT_A_VISIT,
VisitType.DOWNLOAD,
VisitType.REDIRECT_TEMPORARY,
VisitType.RELOAD,
Expand All @@ -94,7 +93,6 @@ class HistoryStore constructor(val context: Context) {

fun getVisitsPaginated(offset: Long, count: Long): CompletableFuture<List<VisitInfo>?> = GlobalScope.future {
storage.getVisitsPaginated(offset, count, excludeTypes = listOf(
VisitType.NOT_A_VISIT,
VisitType.DOWNLOAD,
VisitType.REDIRECT_TEMPORARY,
VisitType.RELOAD,
Expand Down
3 changes: 2 additions & 1 deletion app/src/common/shared/com/igalia/wolvic/browser/Services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import mozilla.appservices.Megazord
import mozilla.appservices.fxaclient.FxaServer
import mozilla.appservices.rustlog.LogAdapterCannotEnable
import mozilla.components.concept.sync.*
import mozilla.components.service.fxa.*
Expand Down Expand Up @@ -86,7 +87,7 @@ class Services(val context: Context, places: Places): WSession.NavigationDelegat
}
}
}
val serverConfig = ServerConfig(if (BuildConfig.FXA_USE_CHINA_SERVER) Server.CHINA else Server.RELEASE, CLIENT_ID, REDIRECT_URL)
val serverConfig = ServerConfig(if (BuildConfig.FXA_USE_CHINA_SERVER) FxaServer.China else FxaServer.Release, CLIENT_ID, REDIRECT_URL)

val accountManager = FxaAccountManager(
context = context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import com.igalia.wolvic.browser.engine.Session
import mozilla.components.concept.engine.EngineSession
import mozilla.components.concept.engine.EngineSessionState
import mozilla.components.concept.engine.Settings
import mozilla.components.concept.engine.shopping.ProductAnalysis
import mozilla.components.concept.engine.shopping.ProductRecommendation
import mozilla.components.concept.engine.translate.TranslationOptions
import org.json.JSONObject

class WolvicEngineSession(
Expand All @@ -36,13 +39,44 @@ class WolvicEngineSession(
) = Unit
override fun loadData(data: String, mimeType: String, encoding: String) = Unit
override fun reload(flags: LoadUrlFlags) = Unit
override fun requestAnalysisStatus(
url: String,
onResult: (String) -> Unit,
onException: (Throwable) -> Unit
) = Unit;

override fun requestPdfToDownload() = Unit
override fun requestPrintContent() = Unit
override fun requestProductAnalysis(
url: String,
onResult: (ProductAnalysis) -> Unit,
onException: (Throwable) -> Unit
) = Unit

override fun requestProductRecommendations(
url: String,
onResult: (List<ProductRecommendation>) -> Unit,
onException: (Throwable) -> Unit
) = Unit

override fun requestTranslate(fromLanguage: String, toLanguage: String, options: TranslationOptions?) = Unit

override fun requestTranslationRestore() = Unit

override fun restoreState(state: EngineSessionState) = true
override fun sendClickAttributionEvent(aid: String, onResult: (Boolean) -> Unit, onException: (Throwable) -> Unit) = Unit

override fun sendImpressionAttributionEvent(aid: String, onResult: (Boolean) -> Unit, onException: (Throwable) -> Unit) = Unit

override fun stopLoading() = Unit
override fun toggleDesktopMode(enable: Boolean, reload: Boolean) = Unit
override fun updateTrackingProtection(policy: TrackingProtectionPolicy) = Unit
override fun purgeHistory() = Unit;
override fun reanalyzeProduct(
url: String,
onResult: (String) -> Unit,
onException: (Throwable) -> Unit
) = Unit;
}

private class DummyEngineSessionState : EngineSessionState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class SearchEngineWrapper private constructor(aContext: Context) :
private get() = if (hasContext() && context is VRBrowserActivity) context as VRBrowserActivity? else null

// SharedPreferences.OnSharedPreferenceChangeListener
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
if (mContextRef.get() != null) {
if (key == mContextRef.get()!!
.getString(R.string.settings_key_geolocation_data) || key == mContextRef.get()!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void removeItem(VisitInfo historyItem) {
public int itemCount() {
if (mHistoryList != null) {
return mHistoryList.stream().allMatch(item ->
item.getVisitType() == VisitType.NOT_A_VISIT) ?
item.getVisitType() == VisitType.TYPED) ?
0 :
mHistoryList.size();
}
Expand Down Expand Up @@ -271,7 +271,7 @@ public int getItemViewType(int position) {
}

private boolean isPositionHeader(int position) {
return mHistoryList.get(position).getVisitType() == VisitType.NOT_A_VISIT;
return mHistoryList.get(position).getVisitType() == VisitType.TYPED;
}

private View.OnHoverListener mIconHoverListener = (view, motionEvent) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,15 +403,15 @@ private void updateHistory() {

private void addSection(final @NonNull List<VisitInfo> items, @NonNull String section, long rangeStart, long rangeEnd) {
for (int i = 0; i < items.size(); i++) {
if (items.get(i).getVisitTime() == rangeStart && items.get(i).getVisitType() == VisitType.NOT_A_VISIT)
if (items.get(i).getVisitTime() == rangeStart && items.get(i).getVisitType() == VisitType.TYPED)
break;

if (items.get(i).getVisitTime() < rangeStart && items.get(i).getVisitTime() > rangeEnd) {
items.add(i, new VisitInfo(
section,
section,
rangeStart,
VisitType.NOT_A_VISIT,
VisitType.TYPED,
null,
false
));
Expand Down
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:extractNativeLibs="true"
android:theme="@style/FxR.Dark">
<activity
android:name="com.igalia.wolvic.VRBrowserActivity"
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/layout/addons_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@

</LinearLayout>

<TextView
android:id="@+id/add_on_status_error_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="@color/mozac_feature_addons_error_text_color"
tools:text="@string/mozac_feature_addons_status_blocklisted" />

<TextView
android:id="@+id/add_on_description"
android:layout_width="match_parent"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/deprecated_version_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/mozac_ic_warning"
android:src="@drawable/mozac_ic_warning_fill_24"
android:layout_gravity="center_vertical|start" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/mozac_ic_warning"
android:src="@drawable/mozac_ic_warning_fill_24"
android:layout_gravity="center_vertical|end" />

<TextView
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ buildscript {
apply from: 'versions.gradle'
addRepos(repositories)
dependencies {
classpath "org.mozilla.telemetry:glean-gradle-plugin:53.2.0"
classpath "org.mozilla.telemetry:glean-gradle-plugin:56.0.0"
classpath "com.android.tools.build:gradle:$versions.android_gradle_plugin"
classpath 'com.android.tools:r8:8.2.33'
classpath "$deps.kotlin.plugin"
classpath 'com.huawei.agconnect:agcp:1.6.5.300'
classpath 'com.huawei.agconnect:agcp:1.9.1.301'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -22,7 +22,7 @@ allprojects {
addRepos(repositories)
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
delete "${rootDir}/third_party/wavesdk/build"
}
4 changes: 2 additions & 2 deletions docs/metrics.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- AUTOGENERATED BY glean_parser v8.1.1. DO NOT EDIT. -->
<!-- AUTOGENERATED BY glean_parser v10.0.3. DO NOT EDIT. -->

# Metrics

Expand All @@ -11,5 +11,5 @@ This means you might have to go searching through the dependency tree to get a f

Data categories are [defined here](https://wiki.mozilla.org/Firefox/Data_Collection).

<!-- AUTOGENERATED BY glean_parser v8.1.1. DO NOT EDIT. -->
<!-- AUTOGENERATED BY glean_parser v10.0.3. DO NOT EDIT. -->

4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ android.injected.testOnly=false

android.useAndroidX=true
android.enableJetifier=true

android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
Loading

0 comments on commit 6ab0fa7

Please sign in to comment.