Skip to content
Open
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
1 change: 1 addition & 0 deletions graphics/quick_settings/ic_quick_settings_tile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/keepass2android-app/Manifests/AndroidManifest_debug.xml
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,16 @@ The scheme=file is still there for old OS devices. It's also queried by apps lik
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:value="426.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:value="360.0dip" />
<service
android:name="keepass2android.QuickSettingsTileService"
android:icon="@drawable/ic_quick_settings_tile"
android:label="@string/app_name"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:exported="true">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
</application>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Expand Down
12 changes: 11 additions & 1 deletion src/keepass2android-app/Manifests/AndroidManifest_net.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of Keepass2Android, Copyright 2025 Philipp Crocoll.

Expand Down Expand Up @@ -290,6 +290,16 @@ The scheme=file is still there for old OS devices. It's also queried by apps lik
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:value="426.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:value="360.0dip" />
<service
android:name="keepass2android.QuickSettingsTileService"
android:icon="@drawable/ic_quick_settings_tile"
android:label="@string/app_name"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:exported="true">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
</application>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Expand Down
12 changes: 11 additions & 1 deletion src/keepass2android-app/Manifests/AndroidManifest_nonet.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is part of Keepass2Android, Copyright 2025 Philipp Crocoll.

Expand Down Expand Up @@ -266,6 +266,16 @@ The scheme=file is still there for old OS devices. It's also queried by apps lik
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:value="426.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:value="360.0dip" />
<service
android:name="keepass2android.QuickSettingsTileService"
android:icon="@drawable/ic_quick_settings_tile"
android:label="@string/app_name"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:exported="true">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
</application>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Expand Down
78 changes: 78 additions & 0 deletions src/keepass2android-app/QuickSettingsTileService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Keepass2Android - Password Manager for Android
* Copyright (C) 2025 Philipp Crocoll
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* * ---
* Module: QuickSettingsTileService
* Description: Provides a system-wide Quick Settings Tile to launch the application.
* This service allows users to quickly access their password database from the
* Android notification shade.
*/

using System;
using Android.App;
using Android.Content;
using Android.Service.QuickSettings;
using Android.Graphics.Drawables;

namespace keepass2android
{
/// <summary>
/// Service to provide a Quick Settings Tile for the Android notification shade.
/// </summary>
[Service(Name = "keepass2android.QuickSettingsTileService",
Permission = Android.Manifest.Permission.BindQuickSettingsTile,
Label = "@string/app_name",
Icon = "@drawable/ic_quick_settings_tile",
Exported = true)]
[IntentFilter(new[] { TileService.ActionQsTile })]
public class QuickSettingsTileService : TileService
{
/// <summary>
/// Called when the user taps the tile in the Quick Settings panel.
/// </summary>
public override void OnClick()
{
base.OnClick();

// Security check: prompt for device unlock if the phone is currently locked.
if (IsLocked)
{
UnlockAndRun(new Java.Lang.Runnable(() => {
StartKp2a();
}));
}
else
{
StartKp2a();
}
}

/// <summary>
/// Launches the main application entry point.
/// </summary>
private void StartKp2a()
{
// Redirect to LaunchActivity to handle database lock/unlock state.
Intent intent = new Intent(this, typeof(LaunchActivity));

// Flags to handle activity stack and background-to-foreground transition.
intent.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTop);

// Closes the notification drawer and executes the intent.
StartActivityAndCollapse(intent);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd"
android:pathData="M8.6,7a0.88,0.88 0,1 1,-0.89 0.88A0.88,0.88 0,0 1,8.6,7Zm4.88,0.88A0.89,0.89 0,1 0,14.37 7,0.88 0.88,0 0,0 13.48,7.83ZM2.13,20.3V22H20.87V20.3Zm0,-9V13H20.87V11.25Zm0,4.72h7A2.3,2.3 0,0 1,9 15.52a2.39,2.39 0,0 1,0.36 -1.25H2.13Zm18.74,0v-1.7H13.53a2.27,2.27 0,0 1,0.31 1.7ZM2.13,17.28V19H8.89l0.52,-1.71Zm11.38,0L14,19h6.84V17.28ZM12.73,19,12,16.54l0.1,-0.06a1.19,1.19 0,0 0,0.6 -1,1.21,1.21 0,0 0,-2.41 0,1.19,1.19 0,0 0,0.6 1l0.1,0.06L10.2,19ZM15.44,4.28h0l1.29,-1.86A0.26,0.26 0,0 0,16.68 2a0.27,0.27 0,0 0,-0.37 0.09L15,4.07h0a9.32,9.32 0,0 0,-3.5 -0.67,9.6,9.6 0,0 0,-3.56 0.68l-1.36,-2A0.27,0.27 0,0 0,6.17 2a0.26,0.26 0,0 0,0 0.37l1.31,1.9a6.63,6.63 0,0 0,-4 5.84H4.93C4.93,7.28 7.86,5 11.45,5S18,7.28 18,10.15h1.55A6.64,6.64 0,0 0,15.44,4.28Z" />
</vector>