From 1d71935fa0438b2446706b8f615740118f14a863 Mon Sep 17 00:00:00 2001 From: ExtendedGuru4883 <152730089+ExtendedGuru4883@users.noreply.github.com> Date: Sat, 8 Nov 2025 23:20:45 +0100 Subject: [PATCH 1/3] [auth] Add Android Quick Settings tile to launch the app Users can now add a Quick Settings tile to quickly launch the app. This provides a convenient shortcut to access 2FA codes without searching for the app on the home screen or app drawer. Changes: - Android: Added QuickTileService to the manifest. - Android: Implemented QuickTileService, the tile launches the main activity. - Android: Included a monochrome icon for the tile. --- .../android/app/src/main/AndroidManifest.xml | 13 ++++++++ .../io/ente/authenticator/QuickTileService.kt | 31 +++++++++++++++++++ .../main/res/drawable/ic_qs_monochrome.xml | 5 +++ 3 files changed, 49 insertions(+) create mode 100644 mobile/apps/auth/android/app/src/main/kotlin/io/ente/authenticator/QuickTileService.kt create mode 100644 mobile/apps/auth/android/app/src/main/res/drawable/ic_qs_monochrome.xml diff --git a/mobile/apps/auth/android/app/src/main/AndroidManifest.xml b/mobile/apps/auth/android/app/src/main/AndroidManifest.xml index c8dcb3253fa..3953727aea9 100644 --- a/mobile/apps/auth/android/app/src/main/AndroidManifest.xml +++ b/mobile/apps/auth/android/app/src/main/AndroidManifest.xml @@ -43,6 +43,19 @@ + + + + + + + diff --git a/mobile/apps/auth/android/app/src/main/kotlin/io/ente/authenticator/QuickTileService.kt b/mobile/apps/auth/android/app/src/main/kotlin/io/ente/authenticator/QuickTileService.kt new file mode 100644 index 00000000000..5d652ed2678 --- /dev/null +++ b/mobile/apps/auth/android/app/src/main/kotlin/io/ente/authenticator/QuickTileService.kt @@ -0,0 +1,31 @@ +package io.ente.auth + +import android.annotation.SuppressLint +import android.app.PendingIntent +import android.content.Intent +import android.os.Build +import android.service.quicksettings.TileService +import androidx.annotation.RequiresApi + +@RequiresApi(Build.VERSION_CODES.N) +class QuickTileService : TileService() { + + @SuppressLint("StartActivityAndCollapseDeprecated") + override fun onClick() { + val intent = Intent(applicationContext, MainActivity::class.java).apply { + flags = Intent.FLAG_ACTIVITY_NEW_TASK + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { + startActivityAndCollapse( + PendingIntent.getActivity( + this, + 0, + intent, + PendingIntent.FLAG_IMMUTABLE, + ), + ) + } else { + startActivityAndCollapse(intent) + } + } +} diff --git a/mobile/apps/auth/android/app/src/main/res/drawable/ic_qs_monochrome.xml b/mobile/apps/auth/android/app/src/main/res/drawable/ic_qs_monochrome.xml new file mode 100644 index 00000000000..1060979a1e3 --- /dev/null +++ b/mobile/apps/auth/android/app/src/main/res/drawable/ic_qs_monochrome.xml @@ -0,0 +1,5 @@ + + + + + From 5821a6f6a740846ae6de633ca4c43187a7ab09d3 Mon Sep 17 00:00:00 2001 From: ExtendedGuru4883 <152730089+ExtendedGuru4883@users.noreply.github.com> Date: Wed, 12 Nov 2025 15:16:14 +0100 Subject: [PATCH 2/3] [auth] Adjust Quick Settings tile appearance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Marked tile as toggleable to remove the arrow icon. - Added subtitle to hide the "Off" label under the tile. Note: The tile is not functionally toggleable — TOGGLEABLE_TILE is used only for appearance consistency. --- mobile/apps/auth/android/app/src/main/AndroidManifest.xml | 3 +++ .../main/kotlin/io/ente/authenticator/QuickTileService.kt | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/mobile/apps/auth/android/app/src/main/AndroidManifest.xml b/mobile/apps/auth/android/app/src/main/AndroidManifest.xml index 3953727aea9..97c39138bf4 100644 --- a/mobile/apps/auth/android/app/src/main/AndroidManifest.xml +++ b/mobile/apps/auth/android/app/src/main/AndroidManifest.xml @@ -51,6 +51,9 @@ android:exported="true" tools:targetApi="24"> + + diff --git a/mobile/apps/auth/android/app/src/main/kotlin/io/ente/authenticator/QuickTileService.kt b/mobile/apps/auth/android/app/src/main/kotlin/io/ente/authenticator/QuickTileService.kt index 5d652ed2678..0f7eb3e438c 100644 --- a/mobile/apps/auth/android/app/src/main/kotlin/io/ente/authenticator/QuickTileService.kt +++ b/mobile/apps/auth/android/app/src/main/kotlin/io/ente/authenticator/QuickTileService.kt @@ -10,6 +10,12 @@ import androidx.annotation.RequiresApi @RequiresApi(Build.VERSION_CODES.N) class QuickTileService : TileService() { + override fun onStartListening() { + val tile = qsTile + tile.subtitle = "Open Ente Auth" + tile.updateTile() + } + @SuppressLint("StartActivityAndCollapseDeprecated") override fun onClick() { val intent = Intent(applicationContext, MainActivity::class.java).apply { From 512169374fa52c4d93d34809fc41ead19f3913e8 Mon Sep 17 00:00:00 2001 From: ExtendedGuru4883 <152730089+ExtendedGuru4883@users.noreply.github.com> Date: Wed, 12 Nov 2025 17:44:09 +0100 Subject: [PATCH 3/3] [auth] Fix Quick Settings tile crash on pre-Android 10 devices Guarded subtitle assignment in QuickTileService to prevent NoSuchMethodError on Android versions below API 29, where Tile.subtitle is not available. - Added version check before setting tile.subtitle - Verified on emulator with API 27. No crashes, tile works correctly --- .../src/main/kotlin/io/ente/authenticator/QuickTileService.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/mobile/apps/auth/android/app/src/main/kotlin/io/ente/authenticator/QuickTileService.kt b/mobile/apps/auth/android/app/src/main/kotlin/io/ente/authenticator/QuickTileService.kt index 0f7eb3e438c..4ac6258d17e 100644 --- a/mobile/apps/auth/android/app/src/main/kotlin/io/ente/authenticator/QuickTileService.kt +++ b/mobile/apps/auth/android/app/src/main/kotlin/io/ente/authenticator/QuickTileService.kt @@ -11,6 +11,7 @@ import androidx.annotation.RequiresApi class QuickTileService : TileService() { override fun onStartListening() { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) return val tile = qsTile tile.subtitle = "Open Ente Auth" tile.updateTile()