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

feat(deps): Update Android SDK Version to 34 #6

Closed
wants to merge 5 commits into from
Closed
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
6 changes: 5 additions & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,8 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: app-debug
path: app/build/outputs/apk/debug/

path: app/build/outputs/apk/debug/



3 changes: 1 addition & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ android {
targetSdk = 33
versionCode = 450
versionName = "4.5"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -45,4 +44,4 @@ dependencies {
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.2.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
}
}
26 changes: 21 additions & 5 deletions app/src/main/java/com/wstxda/gsl/MusicSearchQuickSettings.kt
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
package com.wstxda.gsl

import android.annotation.SuppressLint
import android.app.PendingIntent
import android.content.Intent
import android.os.Build
import android.service.quicksettings.TileService

@Suppress("DEPRECATION")
class MusicSearchQuickSettings : TileService() {
@SuppressLint("StartActivityAndCollapseDeprecated")
override fun onClick() {
super.onClick()
startActivityAndCollapse(
Intent("com.google.android.googlequicksearchbox.MUSIC_SEARCH").setFlags(
Intent.FLAG_ACTIVITY_NEW_TASK
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
/* use PendingIntent for the SDK and above */
val pendingIntent = PendingIntent.getActivity(
this,
0,
Intent("com.google.android.googlequicksearchbox.MUSIC_SEARCH").apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK
},
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
Comment on lines +14 to 23
Copy link
Owner

Choose a reason for hiding this comment

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

This method is correct, although it cannot collapse system qs panel, apparently this behavior is now managed by the activity being opened or by the system itself. you could probably try some workarounds but honestly I feel like it's not worth it.

I was able to try the changes and the activity is also not invoked on HyperOS A14 for some reason (stupid probably)

Copy link
Author

Choose a reason for hiding this comment

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

This method is correct, although it cannot collapse system qs panel, apparently this behavior is now managed by the activity being opened or by the system itself. you could probably try some workarounds but honestly I feel like it's not worth it.

I was able to try the changes and the activity is also not invoked on HyperOS A14 for some reason (stupid probably)

Hmm, unfortunately I don't have Android 14 to test.

Copy link
Owner

Choose a reason for hiding this comment

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

code=START_ABORTED apparently the system is blocking launch of the intent for security policy reason.

BAL_BLOCK suggests that the action was blocked by Activity Management, which reinforces that somehow opening the intent is outside of security

08-25 01:15:03.157 1062 2196 I ActivityTaskManager: START u0 {act=com.google.android.googlequicksearchbox.MUSIC_SEARCH flg=0x10000000 cmp=com.google.android.googlequicksearchbox/.MusicSearchGatewayInternal} with LAUNCH_MULTIPLE from uid 10031 pid -1 (BAL_BLOCK) result code=START_ABORTED

Maybe that's why it doesn't initialize, maybe exploiting an internal API is the solution?

Copy link
Author

Choose a reason for hiding this comment

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

Well, I just don't understand one thing, in SDK 34, what happens, what would this collapse be?

Copy link
Owner

Choose a reason for hiding this comment

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

We currently use StartActivityAndCollapse to get the behavior of, when tapping, launch the intent and close the system quick settings panel. This is required to display the search and display the results in the browser.

Without this behavior the entire process above is done without closing the panel.

As of sdk 34 this is no longer allowed, and apparently there are security restrictions. For this reason i kept the project with sdk 33.

Copy link
Author

Choose a reason for hiding this comment

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

aaa, so when the tile is clicked the panel is not closed, now I understand.

Copy link
Owner

Choose a reason for hiding this comment

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

Exactly, and open intent is blocked for security reason

)
pendingIntent.send()
} else {
/* use normal Intent for the SDK 33 and lower */
startActivityAndCollapse(
Intent("com.google.android.googlequicksearchbox.MUSIC_SEARCH").apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK
}
)
}
}
}
}