Skip to content

chore(status-bar): add SuppressWarnings annotation to StatusBar plugin (Android) - #2438

Merged
andredestro merged 1 commit into
mainfrom
chore/statusbar-deprecation-warnings
Nov 12, 2025
Merged

chore(status-bar): add SuppressWarnings annotation to StatusBar plugin (Android)#2438
andredestro merged 1 commit into
mainfrom
chore/statusbar-deprecation-warnings

Conversation

@andredestro

Copy link
Copy Markdown
Contributor

No description provided.

@andredestro andredestro self-assigned this Nov 11, 2025
@github-actions

github-actions Bot commented Nov 11, 2025

Copy link
Copy Markdown

Released dev build of status-bar with dev version: 8.0.0-dev-2438-20251112T093311.0

@jcesarmobile jcesarmobile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of annotating the whole methods, can the deprecated calls me moved to new separate private methods and only suppress the new ones with the deprecated code?

Annotating the whole methods can cause that we miss future deprecations.

@andredestro
andredestro force-pushed the chore/statusbar-deprecation-warnings branch from 425eef1 to f6ca182 Compare November 11, 2025 16:33
@andredestro
andredestro force-pushed the chore/statusbar-deprecation-warnings branch from f6ca182 to 9eeac8b Compare November 11, 2025 16:39

@jcesarmobile jcesarmobile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only meant to move the the deprecated code for the new deprecations, the old ones are on methods that no longer work on Android 15+, so there is no need. But since you did it, we can keep it that way.

activity is available in all the plugin, so you can call activity.getWindow() from inside the methods when you need the window instead of passing the window to methods such as getStatusBarColorDeprecated

@andredestro
andredestro force-pushed the chore/statusbar-deprecation-warnings branch from 9eeac8b to 37a13d0 Compare November 12, 2025 09:32
@andredestro
andredestro merged commit 8016b66 into main Nov 12, 2025
9 checks passed
@andredestro
andredestro deleted the chore/statusbar-deprecation-warnings branch November 12, 2025 14:18
@crossan007

crossan007 commented Nov 12, 2025

Copy link
Copy Markdown

Will adding the SuppressWarnings decorator affect the Google Play Console "Production Recommended Actions" for the functions in question?

Both:

Edge-to-edge may not display for all users

From Android 15, apps targeting SDK 35 will display edge-to-edge by default. Apps targeting SDK 35 should handle insets to make sure that their app displays correctly on Android 15 and later. Investigate this issue and allow time to test edge-to-edge and make the required updates. Alternatively, call enableEdgeToEdge() for Kotlin or EdgeToEdge.enable() for Java for backward compatibility.

and

Your app uses deprecated APIs or parameters for edge-to-edge

One or more of the APIs you use or parameters that you set for edge-to-edge and window display have been deprecated in Android 15. Your app uses the following deprecated APIs or parameters:

    android.view.Window.getStatusBarColor
    android.view.Window.setStatusBarColor
    android.view.Window.setNavigationBarColor

These start in the following places:

    com.capacitorjs.plugins.statusbar.StatusBar.<init>
    com.capacitorjs.plugins.statusbar.StatusBar.getInfo
    com.capacitorjs.plugins.statusbar.StatusBar.setBackgroundColor
    com.capacitorjs.plugins.statusbar.StatusBar.setOverlaysWebView
    com.google.android.material.bottomsheet.BottomSheetDialog.onCreate
    com.google.android.material.internal.EdgeToEdgeUtils.applyEdgeToEdge
    com.google.android.material.sidesheet.SheetDialog.onCreate

To fix this, migrate away from these APIs or parameters.

@OS-pedrogustavobilro

Copy link
Copy Markdown
Contributor

Will adding the SuppressWarnings decorator affect the Google Play Console "Production Recommended Actions" for the functions in question?

@crossan007 doubt it will, the source code is still there, and Google Play will probably still inform you of that.

Android 15 and 16 apps are edge to edge, regardless of the StatusBar Plugin using these APIs (that may not have effect on Android 15+, but still do when your app is running on lower Android versions). For some better control of your edge-to-edge application, refer to the SystemBars API introduced in Capacitor 8, part of @capacitor/core.

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants