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

Author: Masala <[email protected]> #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mixmasala
Copy link
Contributor

This PR is to extend the gogio tool to support adding the android permission for FOREGROUND_SERVICE to the generated android manifest.xml metadata. Originally part of gioui/gio#67

@eliasnaur
Copy link
Contributor

This PR seems to mix two features: adding a new permission and adding .java support to gogio. The former seems ok, but the latter not because it adds a dependency on a Java compiler. In future, I'd like gogio to be implemented completely in Go.

@mixmasala
Copy link
Contributor Author

I believe the java compiler dependency already exists for buildandroid.go and the changes above are necessary to implement this feature (generating AndroidManifest.xml with the right class names). When do you think you will manage to eliminate the java compiler dependecy?

@eliasnaur
Copy link
Contributor

I believe the java compiler dependency already exists for buildandroid.go.

It's true that buildandroid.go depends on a Java compiler today. My point is that your change will make it much harder to avoid that dependency in future. Without your change, we can check in .class files (or a .jar) for the Java files from package gioui.org/app and add //go:generate commands to update them (which will require a Java compiler).

When do you think you will manage to eliminate the java compiler dependecy?

I don't have the work planned.

the changes above are necessary to implement this feature (generating AndroidManifest.xml with the right class names)

Can you point to the changes that require a java compiler to implement this change? I couldn't find any.

@mixmasala
Copy link
Contributor Author

Thanks. Looking closer, I see those changes were no longer necessary because the notification icon is now using the package icon.

@@ -446,6 +448,7 @@ func exeAndroid(tmpDir string, tools *androidTools, bi *buildInfo, extraJars, pe
Features: features,
IconSnip: iconSnip,
AppName: appName,
HasService: stringsContains(permissions, foregroundPermission),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's more canonical to search for "foreground" in perms.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed.

@@ -468,6 +471,19 @@ func exeAndroid(tmpDir string, tools *androidTools, bi *buildInfo, extraJars, pe
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
{{if .HasService}}
<service android:name="org.gioui.GioForegroundService"
Copy link
Contributor

Choose a reason for hiding this comment

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

We can't submit this change before your change that adds GioForegroundService, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct

Comment on lines 481 to 482
<meta-data android:name="org.gioui.ForegroundChannelDesc"
android:value="" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this empty value be omitted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, if the corresponding getString() method in gio returns a default empty string.

@MatejMagat305
Copy link

I do not want toplay to clever, but if you want got permision you can use https://github.com/MatejMagat305/golang-prototype-permision

This adds the permission android.permission.FOREGROUND_SERVICE to the
android application Metadata

Signed-off-by: Masala <[email protected]>
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.

3 participants