From 4b3f6657a837f8df240612497b81457993ab4c90 Mon Sep 17 00:00:00 2001 From: Philipp Crocoll Date: Mon, 23 Jan 2023 10:07:15 +0100 Subject: [PATCH] * update target-sdk version to 33. update some packages (build currently fails for flavor=Net, but works with NoNet) * make changes to comply with new target sdk version requirements (mostly Exported-attribute and mutability flags) * drop samsung fingerprint support (as suggested by Samsung), would require more hacks to keep it with the new target sdk version * add build-properties.props to allow specifying a flavor in VS builds. --- src/KeePass.sln | 30 +--- .../Kp2aBusinessLogic.csproj | 20 ++- src/build-properties.props | 9 + src/java/JavaFileStorage/app/build.gradle | 2 +- src/java/KP2ASoftkeyboard_AS/app/build.gradle | 2 + src/keepass2android/AboutActivity.cs | 3 +- .../ConfigureChildDatabasesActivity.cs | 2 +- .../DisableAutofillForQueryActivity.cs | 6 + src/keepass2android/ExportDatabaseActivity.cs | 2 +- .../FingerprintSamsungIdentifier.cs | 157 ------------------ .../FingerprintSetupActivity.cs | 44 +---- src/keepass2android/GroupActivity.cs | 2 +- src/keepass2android/KeePass.cs | 2 +- src/keepass2android/NfcOtpActivity.cs | 1 + .../Properties/AndroidManifest_net.xml | 13 +- .../Properties/AndroidManifest_nonet.xml | 16 +- .../Properties/AssemblyInfo.cs | 1 + .../QueryCredentialsActivity.cs | 1 + src/keepass2android/QuickUnlock.cs | 26 +-- .../SelectCurrentDbActivity.cs | 1 + src/keepass2android/ShareUrlResults.cs | 2 +- src/keepass2android/Utils/Util.cs | 10 +- .../keepass2android-app.csproj | 23 +-- .../pluginhost/PluginDetailsActivity.cs | 2 +- src/keepass2android/pluginhost/PluginHost.cs | 3 +- .../pluginhost/PluginListActivity.cs | 2 +- src/keepass2android/search/SearchResults.cs | 2 +- .../services/AutofillBase/AutofillHelper.cs | 14 +- .../AutofillBase/AutofillServiceBase.cs | 30 ++-- .../services/CopyToClipboardService.cs | 7 +- .../Kp2aAutofill/Kp2aAutofillService.cs | 2 +- .../services/Kp2aAutofillIntentBuilder.cs | 13 +- .../services/OngoingNotificationsService.cs | 6 +- src/keepass2android/timeout/TimeoutHelper.cs | 2 +- 34 files changed, 127 insertions(+), 331 deletions(-) create mode 100644 src/build-properties.props delete mode 100644 src/keepass2android/FingerprintSamsungIdentifier.cs diff --git a/src/KeePass.sln b/src/KeePass.sln index 55081b4e..07b0f025 100644 --- a/src/KeePass.sln +++ b/src/KeePass.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29418.71 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33205.214 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeePassLib2Android", "KeePassLib2Android\KeePassLib2Android.csproj", "{545B4A6B-8BBA-4FBE-92FC-4AC060122A54}" EndProject @@ -25,8 +25,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PCloudBindings", "PCloudBin EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "keepass2android-app", "keepass2android\keepass2android-app.csproj", "{D4C32E0A-0193-4496-9DB4-02CC126FD9F3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamsungPass", "SamsungPass\Xamarin.SamsungPass\SamsungPass\SamsungPass.csproj", "{3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -285,30 +283,6 @@ Global {D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU {D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.ReleaseNoNet|x64.Build.0 = Release|Any CPU {D4C32E0A-0193-4496-9DB4-02CC126FD9F3}.ReleaseNoNet|x64.Deploy.0 = Release|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Debug|Win32.ActiveCfg = Debug|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Debug|Win32.Build.0 = Debug|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Debug|x64.ActiveCfg = Debug|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Debug|x64.Build.0 = Debug|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Release|Any CPU.Build.0 = Release|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Release|Win32.ActiveCfg = Release|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Release|Win32.Build.0 = Release|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Release|x64.ActiveCfg = Release|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.Release|x64.Build.0 = Release|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.ReleaseNoNet|Any CPU.ActiveCfg = ReleaseNoNet|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.ReleaseNoNet|Any CPU.Build.0 = ReleaseNoNet|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.ReleaseNoNet|Mixed Platforms.ActiveCfg = ReleaseNoNet|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.ReleaseNoNet|Mixed Platforms.Build.0 = ReleaseNoNet|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.ReleaseNoNet|Win32.ActiveCfg = ReleaseNoNet|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.ReleaseNoNet|Win32.Build.0 = ReleaseNoNet|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.ReleaseNoNet|x64.ActiveCfg = ReleaseNoNet|Any CPU - {3A4B8E88-FA9B-4663-BCDA-21C12E3AF98A}.ReleaseNoNet|x64.Build.0 = ReleaseNoNet|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Kp2aBusinessLogic/Kp2aBusinessLogic.csproj b/src/Kp2aBusinessLogic/Kp2aBusinessLogic.csproj index 370922bc..037bb5cd 100644 --- a/src/Kp2aBusinessLogic/Kp2aBusinessLogic.csproj +++ b/src/Kp2aBusinessLogic/Kp2aBusinessLogic.csproj @@ -1,5 +1,9 @@  - + + + + + Debug AnyCPU @@ -12,7 +16,7 @@ 512 Resources\Resource.designer.cs Off - v11.0 + v13.0 false $(Flavor) @@ -66,7 +70,7 @@ - + @@ -181,16 +185,16 @@ 31.3.1 - 1.10.2 + 1.10.3 1.21.0 - 1.0.0-preview.1 + 1.0.0-preview.7 - 4.8.2 + 4.49.1 @@ -297,7 +301,7 @@ 28.0.0.3 - 1.1.1.11 + 1.2.0.3 @@ -308,4 +312,4 @@ --> - + \ No newline at end of file diff --git a/src/build-properties.props b/src/build-properties.props new file mode 100644 index 00000000..8dc23bd2 --- /dev/null +++ b/src/build-properties.props @@ -0,0 +1,9 @@ + + + + +NoNet + + + + diff --git a/src/java/JavaFileStorage/app/build.gradle b/src/java/JavaFileStorage/app/build.gradle index e94e9c6a..a1f9883d 100644 --- a/src/java/JavaFileStorage/app/build.gradle +++ b/src/java/JavaFileStorage/app/build.gradle @@ -39,7 +39,7 @@ dependencies { implementation 'com.google.api-client:google-api-client:1.30.5' implementation 'com.google.api-client:google-api-client-android:1.30.5' - implementation 'com.google.android.gms:play-services-auth:19.2.0' + implementation 'com.google.android.gms:play-services-auth:20.4.0' //onedrive: compile('com.onedrive.sdk:onedrive-sdk-android:1.2.0') { transitive = false diff --git a/src/java/KP2ASoftkeyboard_AS/app/build.gradle b/src/java/KP2ASoftkeyboard_AS/app/build.gradle index 124e7ac5..d2427553 100644 --- a/src/java/KP2ASoftkeyboard_AS/app/build.gradle +++ b/src/java/KP2ASoftkeyboard_AS/app/build.gradle @@ -3,6 +3,8 @@ android { compileSdkVersion 23 buildToolsVersion '28.0.3' + ndkVersion '21.0.6113669' + defaultConfig { minSdkVersion 18 } diff --git a/src/keepass2android/AboutActivity.cs b/src/keepass2android/AboutActivity.cs index 573d6341..11029c60 100644 --- a/src/keepass2android/AboutActivity.cs +++ b/src/keepass2android/AboutActivity.cs @@ -10,7 +10,8 @@ namespace keepass2android { [Activity(Label = "@string/app_name", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden, - Theme = "@style/MyTheme_ActionBar")] + Theme = "@style/MyTheme_ActionBar", + Exported = true)] [IntentFilter(new[] { "kp2a.action.AboutActivity" }, Categories = new[] { Intent.CategoryDefault })] public class AboutActivity: Activity, IDialogInterfaceOnDismissListener { diff --git a/src/keepass2android/ConfigureChildDatabasesActivity.cs b/src/keepass2android/ConfigureChildDatabasesActivity.cs index 7147f4db..293e9f86 100644 --- a/src/keepass2android/ConfigureChildDatabasesActivity.cs +++ b/src/keepass2android/ConfigureChildDatabasesActivity.cs @@ -28,7 +28,7 @@ using Object = Java.Lang.Object; namespace keepass2android { - [Activity(Label = "@string/child_dbs_title", MainLauncher = false, Theme = "@style/MyTheme_Blue", LaunchMode = LaunchMode.SingleInstance, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)] + [Activity(Label = "@string/child_dbs_title", MainLauncher = false, Theme = "@style/MyTheme_Blue", LaunchMode = LaunchMode.SingleInstance, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden, Exported = true)] [IntentFilter(new[] { "kp2a.action.ConfigureChildDatabasesActivity" }, Categories = new[] { Intent.CategoryDefault })] public class ConfigureChildDatabasesActivity : LockCloseActivity { diff --git a/src/keepass2android/DisableAutofillForQueryActivity.cs b/src/keepass2android/DisableAutofillForQueryActivity.cs index 97f2f5ca..df6e3101 100644 --- a/src/keepass2android/DisableAutofillForQueryActivity.cs +++ b/src/keepass2android/DisableAutofillForQueryActivity.cs @@ -68,6 +68,12 @@ namespace keepass2android Intent reply = new Intent(); FillResponse.Builder builder = new FillResponse.Builder(); AssistStructure structure = (AssistStructure)Intent.GetParcelableExtra(AutofillManager.ExtraAssistStructure); + if (structure == null) + { + SetResult(Result.Canceled); + Finish(); + return; + } StructureParser parser = new StructureParser(this, structure); try { diff --git a/src/keepass2android/ExportDatabaseActivity.cs b/src/keepass2android/ExportDatabaseActivity.cs index d7277fbb..1aa16dc4 100644 --- a/src/keepass2android/ExportDatabaseActivity.cs +++ b/src/keepass2android/ExportDatabaseActivity.cs @@ -41,7 +41,7 @@ namespace keepass2android [Activity(Label = "@string/app_name", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden, - Theme = "@style/MyTheme_ActionBar")] + Theme = "@style/MyTheme_ActionBar", Exported = true)] [IntentFilter(new[] {"kp2a.action.ExportDatabaseActivity"}, Categories = new[] {Intent.CategoryDefault})] public class ExportDatabaseActivity : LockCloseActivity { diff --git a/src/keepass2android/FingerprintSamsungIdentifier.cs b/src/keepass2android/FingerprintSamsungIdentifier.cs deleted file mode 100644 index 8980d601..00000000 --- a/src/keepass2android/FingerprintSamsungIdentifier.cs +++ /dev/null @@ -1,157 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Android.App; -using Android.Content; -using Android.Hardware.Biometrics; -using Android.OS; -using Android.Runtime; -using Android.Util; -using Android.Views; -using Android.Widget; -using Com.Samsung.Android.Sdk; -using Com.Samsung.Android.Sdk.Pass; -using Java.Lang; - -namespace keepass2android -{ - class BiometrySamsungIdentifier: IBiometricIdentifier - { - private readonly Context _context; - SpassFingerprint _spassFingerprint; - Spass _spass; - public BiometrySamsungIdentifier(Context context) - { - _context = context; - _spass = new Spass(); - - try - { - _spass.Initialize(context); - } - catch (SecurityException) - { - //"Did you add the permission to the AndroidManifest.xml?"); - throw; - } - - if (_spass.IsFeatureEnabled(Spass.DeviceFingerprint)) - { - _spassFingerprint = new SpassFingerprint(context); - } - else - { - throw new RuntimeException("Fingerprint Featue not available."); - } - - - } - - public bool Init() - { - try - { - return _spassFingerprint.HasRegisteredFinger; - } - catch (UnsupportedOperationException) - { - return false; - } - - - } - class IdentifyListener : Java.Lang.Object, IIdentifyListener - { - private readonly IBiometricAuthCallback _callback; - private readonly Context _context; - private readonly BiometrySamsungIdentifier _id; - - - public IdentifyListener(IBiometricAuthCallback callback, Context context, BiometrySamsungIdentifier id) - { - _callback = callback; - _context = context; - _id = id; - } - - - - public void OnFinished (int responseCode) - { - _id.Listening = false; - if (responseCode == SpassFingerprint.StatusAuthentificationSuccess) - { - _callback.OnBiometricAuthSucceeded(); - } - else if (responseCode == SpassFingerprint.StatusAuthentificationPasswordSuccess) - { - _callback.OnBiometricAuthSucceeded(); - } - - } - - public void OnReady () - { - - } - public void OnCompleted() - { - // TODO - } - - public void OnStarted () - { - - } - } - - internal bool Listening - { - get; set; - } - - - public void StartListening(IBiometricAuthCallback callback) - { - if (Listening) return; - - try - { - _spassFingerprint.StartIdentifyWithDialog(_context, new IdentifyListener(callback, _context, this), false); - Listening = true; - } - catch (SpassInvalidStateException m) - { - callback.OnBiometricError(m.Message); - } - catch (IllegalStateException ex) - { - callback.OnBiometricError(ex.Message); - } - } - - public void StopListening() - { - try - { - _spassFingerprint.CancelIdentify(); - Listening = false; - } - catch (IllegalStateException ise) - { - Kp2aLog.Log(ise.ToString()); - } - catch (System.Exception e) - { - Kp2aLog.LogUnexpectedError(e); - } - } - - public bool HasUserInterface - { - get { return false; } - } - } -} \ No newline at end of file diff --git a/src/keepass2android/FingerprintSetupActivity.cs b/src/keepass2android/FingerprintSetupActivity.cs index d3906cf5..b6ebeccb 100644 --- a/src/keepass2android/FingerprintSetupActivity.cs +++ b/src/keepass2android/FingerprintSetupActivity.cs @@ -22,7 +22,7 @@ namespace keepass2android { [Activity(Label = "@string/app_name", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden, - Theme = "@style/MyTheme_ActionBar", MainLauncher = false)] + Theme = "@style/MyTheme_ActionBar", MainLauncher = false, Exported = true)] [IntentFilter(new[] { "kp2a.action.FingerprintSetupActivity" }, Categories = new[] { Intent.CategoryDefault })] public class BiometricSetupActivity : LockCloseActivity, IBiometricAuthCallback { @@ -141,30 +141,7 @@ namespace keepass2android { FindViewById(Resource.Id.close_database_after_failed).Visibility = _unlockMode == FingerprintUnlockMode.QuickUnlock ? ViewStates.Visible : ViewStates.Gone; } - - private bool TrySetupSamsung() - { - try - { - //try to create a Samsung ID object - _samsungBiometry = new BiometrySamsungIdentifier(this); - if (!_samsungBiometry.Init()) - { - SetError(Resource.String.fingerprint_no_enrolled); - } - ShowRadioButtons(); - FindViewById(Resource.Id.container_fingerprint_unlock).Visibility = _samsungBiometry == null - ? ViewStates.Visible - : ViewStates.Gone; - return true; - } - catch (Exception) - { - _samsungBiometry = null; - return false; - } - } - + string CurrentPreferenceKey { get { return App.Kp2a.CurrentDb.CurrentFingerprintPrefKey; } @@ -245,18 +222,7 @@ namespace keepass2android if (oldMode == newMode) return; - - if (_samsungBiometry != null) - { - _unlockMode = newMode; - UpdateCloseDatabaseAfterFailedBiometricQuickUnlockVisibility(); - ISharedPreferencesEditor edit = PreferenceManager.GetDefaultSharedPreferences(this).Edit(); - edit.PutString(App.Kp2a.CurrentDb.CurrentFingerprintModePrefKey, _unlockMode.ToString()); - edit.Commit(); - return; - } - if (newMode == FingerprintUnlockMode.Disabled) { _unlockMode = newMode; @@ -296,8 +262,6 @@ namespace keepass2android private ImageView _fpIcon; private TextView _fpTextView; - private BiometrySamsungIdentifier _samsungBiometry; - public void OnBiometricAuthSucceeded() { _unlockMode = _desiredUnlockMode; @@ -353,9 +317,7 @@ namespace keepass2android HideRadioButtons(); if (!fpModule.IsHardwareAvailable) { - //seems like not all Samsung Devices (e.g. Note 4) don't support the Android 6 fingerprint API - if (!TrySetupSamsung()) - SetError(Resource.String.fingerprint_hardware_error); + SetError(Resource.String.fingerprint_hardware_error); UpdateCloseDatabaseAfterFailedBiometricQuickUnlockVisibility(); return; } diff --git a/src/keepass2android/GroupActivity.cs b/src/keepass2android/GroupActivity.cs index 4008d44c..365382ac 100644 --- a/src/keepass2android/GroupActivity.cs +++ b/src/keepass2android/GroupActivity.cs @@ -42,7 +42,7 @@ using Object = Java.Lang.Object; namespace keepass2android { - [Activity(Label = "@string/app_name", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden, Theme = "@style/MyTheme_ActionBar")] + [Activity(Label = "@string/app_name", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden, Theme = "@style/MyTheme_ActionBar", Exported = true)] [MetaData("android.app.default_searchable", Value = "keepass2android.search.SearchResults")] #if NoNet [MetaData("android.app.searchable", Resource = "@xml/searchable_offline")] diff --git a/src/keepass2android/KeePass.cs b/src/keepass2android/KeePass.cs index 0a28adb1..8e5cb56b 100644 --- a/src/keepass2android/KeePass.cs +++ b/src/keepass2android/KeePass.cs @@ -68,7 +68,7 @@ namespace keepass2android /// /// Launcher activity of Keepass2Android. This activity usually forwards to SelectCurrentDb but may show the revision dialog after installation or updates. /// - [Activity(Label = AppNames.AppName, MainLauncher = false, Theme = "@style/MyTheme_Blue")] + [Activity(Label = AppNames.AppName, MainLauncher = false, Theme = "@style/MyTheme_Blue", Exported = true)] [IntentFilter(new[] { Intent.ActionMain }, Categories = new[] { "android.intent.category.LAUNCHER", "android.intent.category.MULTIWINDOW_LAUNCHER" })] public class KeePass : LifecycleAwareActivity, IDialogInterfaceOnDismissListener { diff --git a/src/keepass2android/NfcOtpActivity.cs b/src/keepass2android/NfcOtpActivity.cs index b5781eae..ceafc5dd 100644 --- a/src/keepass2android/NfcOtpActivity.cs +++ b/src/keepass2android/NfcOtpActivity.cs @@ -17,6 +17,7 @@ namespace keepass2android ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden, NoHistory = true, + Exported = true, ExcludeFromRecents = true, Theme = "@android:style/Theme.Dialog")] [IntentFilter(new[] { "android.nfc.action.NDEF_DISCOVERED" }, diff --git a/src/keepass2android/Properties/AndroidManifest_net.xml b/src/keepass2android/Properties/AndroidManifest_net.xml index 555d21a0..e1719caf 100644 --- a/src/keepass2android/Properties/AndroidManifest_net.xml +++ b/src/keepass2android/Properties/AndroidManifest_net.xml @@ -43,7 +43,7 @@ - + @@ -87,13 +87,13 @@ - + - + @@ -103,14 +103,15 @@ + android:label="@string/language_selection_title" + android:exported="true"> - + @@ -272,6 +273,4 @@ The scheme=file is still there for old OS devices. It's also queried by apps lik - - diff --git a/src/keepass2android/Properties/AndroidManifest_nonet.xml b/src/keepass2android/Properties/AndroidManifest_nonet.xml index 53a27397..fc7b795e 100644 --- a/src/keepass2android/Properties/AndroidManifest_nonet.xml +++ b/src/keepass2android/Properties/AndroidManifest_nonet.xml @@ -40,7 +40,7 @@ - + - + - + @@ -73,7 +73,8 @@ + android:label="@string/language_selection_title" + android:exported="true"> @@ -81,7 +82,8 @@ - + @@ -244,9 +246,5 @@ The scheme=file is still there for old OS devices. It's also queried by apps lik - - - - diff --git a/src/keepass2android/Properties/AssemblyInfo.cs b/src/keepass2android/Properties/AssemblyInfo.cs index 3dfc3679..a26ba49a 100644 --- a/src/keepass2android/Properties/AssemblyInfo.cs +++ b/src/keepass2android/Properties/AssemblyInfo.cs @@ -46,3 +46,4 @@ using keepass2android; [assembly: Permission(Name = "keepass2android."+AppNames.PackagePart+".permission.CopyToClipboard", Label = "CopyToClipboard", ProtectionLevel=Protection.Signature)] [assembly: UsesPermission(Name = "keepass2android." + AppNames.PackagePart + ".permission.CopyToClipboard")] +[assembly: UsesPermission(Android.Manifest.Permission.ForegroundService)] diff --git a/src/keepass2android/QueryCredentialsActivity.cs b/src/keepass2android/QueryCredentialsActivity.cs index 04773192..1a80b816 100644 --- a/src/keepass2android/QueryCredentialsActivity.cs +++ b/src/keepass2android/QueryCredentialsActivity.cs @@ -16,6 +16,7 @@ namespace keepass2android { [Activity(Label = "@string/app_name", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden, + Exported = true, Theme = "@style/MyTheme_ActionBar")] [IntentFilter(new[] { Strings.ActionQueryCredentials}, Categories = new[] { Intent.CategoryDefault })] diff --git a/src/keepass2android/QuickUnlock.cs b/src/keepass2android/QuickUnlock.cs index c0a6f409..22b612ba 100644 --- a/src/keepass2android/QuickUnlock.cs +++ b/src/keepass2android/QuickUnlock.cs @@ -270,31 +270,7 @@ namespace keepass2android _biometryIdentifier = new BiometricDecryption(fpModule, App.Kp2a.GetDbForQuickUnlock().CurrentFingerprintPrefKey, this, App.Kp2a.GetDbForQuickUnlock().CurrentFingerprintPrefKey); - if ((_biometryIdentifier == null) && (!BiometricDecryption.IsSetUp(this, App.Kp2a.GetDbForQuickUnlock().CurrentFingerprintPrefKey))) - { - try - { - Kp2aLog.Log("trying Samsung Fingerprint API..."); - _biometryIdentifier = new BiometrySamsungIdentifier(this); - btn.Click += (sender, args) => - { - if (_biometryIdentifier.Init()) - { - if (numFailedAttempts < maxNumFailedAttempts) - { - _biometryIdentifier.StartListening(this); - } - - } - }; - Kp2aLog.Log("trying Samsung Fingerprint API...Seems to work!"); - } - catch (Exception) - { - Kp2aLog.Log("trying Samsung Fingerprint API...failed."); - _biometryIdentifier = null; - } - } + if (_biometryIdentifier == null) { FindViewById(Resource.Id.fingerprintbtn).Visibility = ViewStates.Gone; diff --git a/src/keepass2android/SelectCurrentDbActivity.cs b/src/keepass2android/SelectCurrentDbActivity.cs index 137eee20..f21af1b3 100644 --- a/src/keepass2android/SelectCurrentDbActivity.cs +++ b/src/keepass2android/SelectCurrentDbActivity.cs @@ -31,6 +31,7 @@ namespace keepass2android [Activity(Label = AppNames.AppName, MainLauncher = false, Theme = "@style/MyTheme_Blue", + Exported = true, LaunchMode = LaunchMode.SingleInstance)] //caution, see manifest file public class SelectCurrentDbActivity : LifecycleAwareActivity { diff --git a/src/keepass2android/ShareUrlResults.cs b/src/keepass2android/ShareUrlResults.cs index 1ccd1fba..5eee4b10 100644 --- a/src/keepass2android/ShareUrlResults.cs +++ b/src/keepass2android/ShareUrlResults.cs @@ -31,7 +31,7 @@ using KeePassLib.Utility; namespace keepass2android { - [Activity(Label = "@string/kp2a_findUrl", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden, Theme = "@style/MyTheme_ActionBar")] + [Activity(Label = "@string/kp2a_findUrl", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden, Theme = "@style/MyTheme_ActionBar", Exported = true)] #if NoNet [MetaData("android.app.searchable", Resource = "@xml/searchable_offline")] #else diff --git a/src/keepass2android/Utils/Util.cs b/src/keepass2android/Utils/Util.cs index 0fc0a7de..5ffb0156 100644 --- a/src/keepass2android/Utils/Util.cs +++ b/src/keepass2android/Utils/Util.cs @@ -394,7 +394,15 @@ namespace keepass2android get { return (int)Build.VERSION.SdkInt >= 19; } } - private static void ShowInternalLocalFileChooser(Activity act, int requestCodeBrowse, bool forSaving, string defaultPath) + + public static PendingIntentFlags AddMutabilityFlag(PendingIntentFlags flags, PendingIntentFlags mutability) + { + if ((int)Build.VERSION.SdkInt >= 31) + return flags | mutability; + else return flags; + } + + private static void ShowInternalLocalFileChooser(Activity act, int requestCodeBrowse, bool forSaving, string defaultPath) { #if !EXCLUDE_FILECHOOSER diff --git a/src/keepass2android/keepass2android-app.csproj b/src/keepass2android/keepass2android-app.csproj index f1ee2f68..4e0ec5a3 100644 --- a/src/keepass2android/keepass2android-app.csproj +++ b/src/keepass2android/keepass2android-app.csproj @@ -1,5 +1,10 @@  - + + + + + + Debug AnyCPU @@ -19,7 +24,7 @@ Resource Off false - v11.0 + v13.0 Properties\AndroidManifest_debug.xml Resources Assets @@ -99,6 +104,9 @@ 1.2.1.3 + + 0.11.4 + 3.1.0-beta2 @@ -186,7 +194,6 @@ - @@ -412,7 +419,7 @@ - + @@ -488,7 +495,7 @@ - + @@ -1953,10 +1960,6 @@ {3da3911e-36de-465e-8f15-f1991b6437e5} PluginSdkBinding - - {3a4b8e88-fa9b-4663-bcda-21c12e3af98a} - SamsungPass - {5cf675a5-9bee-4720-bed9-d5bf14a2ebf9} TwofishCipher @@ -1980,4 +1983,4 @@ --> - + \ No newline at end of file diff --git a/src/keepass2android/pluginhost/PluginDetailsActivity.cs b/src/keepass2android/pluginhost/PluginDetailsActivity.cs index c79a639e..4319c4f0 100644 --- a/src/keepass2android/pluginhost/PluginDetailsActivity.cs +++ b/src/keepass2android/pluginhost/PluginDetailsActivity.cs @@ -19,7 +19,7 @@ using keepass2android.views; namespace keepass2android { - [Activity(Label = AppNames.AppName, Theme = "@style/android:Theme.Material.Light")] + [Activity(Label = AppNames.AppName, Theme = "@style/android:Theme.Material.Light", Exported = true)] [IntentFilter(new[] { Strings.ActionEditPluginSettings }, Label = AppNames.AppName, Categories = new[] { Intent.CategoryDefault })] diff --git a/src/keepass2android/pluginhost/PluginHost.cs b/src/keepass2android/pluginhost/PluginHost.cs index ac22ff04..2b54567f 100644 --- a/src/keepass2android/pluginhost/PluginHost.cs +++ b/src/keepass2android/pluginhost/PluginHost.cs @@ -5,6 +5,7 @@ using Android.App; using Android.Content; using Android.Content.PM; using Android.Util; +using Group.Pals.Android.Lib.UI.Filechooser.Utils; using KeePassLib.Utility; using Keepass2android.Pluginsdk; using Org.Json; @@ -14,7 +15,7 @@ namespace keepass2android /// /// Class which manages plugins inside the app /// - [BroadcastReceiver] + [BroadcastReceiver(Exported = true)] [IntentFilter(new[] { Strings.ActionRequestAccess })] public class PluginHost : BroadcastReceiver { diff --git a/src/keepass2android/pluginhost/PluginListActivity.cs b/src/keepass2android/pluginhost/PluginListActivity.cs index 125f4266..a5e6f711 100644 --- a/src/keepass2android/pluginhost/PluginListActivity.cs +++ b/src/keepass2android/pluginhost/PluginListActivity.cs @@ -9,7 +9,7 @@ using Keepass2android.Pluginsdk; namespace keepass2android { - [Activity(Label = "@string/plugins", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden, Theme="@style/android:Theme.Material.Light")] + [Activity(Label = "@string/plugins", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.KeyboardHidden, Theme="@style/android:Theme.Material.Light", Exported = true)] [IntentFilter(new[] { "kp2a.action.PluginListActivity" }, Categories = new[] { Intent.CategoryDefault })] public class PluginListActivity : ListActivity { diff --git a/src/keepass2android/search/SearchResults.cs b/src/keepass2android/search/SearchResults.cs index f1d6acf9..baacadf6 100644 --- a/src/keepass2android/search/SearchResults.cs +++ b/src/keepass2android/search/SearchResults.cs @@ -31,7 +31,7 @@ namespace keepass2android.search /// /// Activity to show search results /// - [Activity(Label = "@string/app_name", Theme = "@style/MyTheme_ActionBar", LaunchMode = Android.Content.PM.LaunchMode.SingleTop, Permission="keepass2android."+AppNames.PackagePart+".permission.KP2aInternalSearch", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)] + [Activity(Label = "@string/app_name", Theme = "@style/MyTheme_ActionBar", LaunchMode = Android.Content.PM.LaunchMode.SingleTop, Permission="keepass2android."+AppNames.PackagePart+".permission.KP2aInternalSearch", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden, Exported = true)] #if NoNet [MetaData("android.app.searchable", Resource = "@xml/searchable_offline")] #else diff --git a/src/keepass2android/services/AutofillBase/AutofillHelper.cs b/src/keepass2android/services/AutofillBase/AutofillHelper.cs index e8ca57e8..70581811 100644 --- a/src/keepass2android/services/AutofillBase/AutofillHelper.cs +++ b/src/keepass2android/services/AutofillBase/AutofillHelper.cs @@ -30,7 +30,8 @@ namespace keepass2android.services.AutofillBase } //make sure we have a pendingIntent always not null pendingIntent ??= PendingIntent.GetService(context, 0, new Intent(), - PendingIntentFlags.OneShot | PendingIntentFlags.UpdateCurrent); + Util.AddMutabilityFlag(PendingIntentFlags.OneShot | PendingIntentFlags.UpdateCurrent, PendingIntentFlags.Mutable)); + var slice = CreateInlinePresentationSlice( inlinePresentationSpec, text, @@ -46,6 +47,7 @@ namespace keepass2android.services.AutofillBase return null; } + private static Android.App.Slices.Slice CreateInlinePresentationSlice( InlinePresentationSpec inlinePresentationSpec, string text, @@ -107,7 +109,7 @@ namespace keepass2android.services.AutofillBase datasetBuilder.SetId(datasetName); var setValueAtLeastOnce = filledAutofillFieldCollection.ApplyToFields(autofillFields, datasetBuilder); - AddInlinePresentation(context, inlinePresentationSpec, datasetName, datasetBuilder, intentBuilder.AppIconResource); + AddInlinePresentation(context, inlinePresentationSpec, datasetName, datasetBuilder, intentBuilder.AppIconResource, null); if (setValueAtLeastOnce) { @@ -121,12 +123,14 @@ namespace keepass2android.services.AutofillBase return null; } - public static void AddInlinePresentation(Context context, InlinePresentationSpec inlinePresentationSpec, string datasetName, Dataset.Builder datasetBuilder, int iconId) + public static void AddInlinePresentation(Context context, InlinePresentationSpec inlinePresentationSpec, + string datasetName, Dataset.Builder datasetBuilder, int iconId, PendingIntent pendingIntent) { if (inlinePresentationSpec != null) { - var inlinePresentation = BuildInlinePresentation(inlinePresentationSpec, datasetName, "", iconId, null, context); - datasetBuilder.SetInlinePresentation(inlinePresentation); + var inlinePresentation = BuildInlinePresentation(inlinePresentationSpec, datasetName, "", iconId, pendingIntent, context); + if (inlinePresentation != null) + datasetBuilder.SetInlinePresentation(inlinePresentation); } } diff --git a/src/keepass2android/services/AutofillBase/AutofillServiceBase.cs b/src/keepass2android/services/AutofillBase/AutofillServiceBase.cs index cd0af999..1df5c66c 100644 --- a/src/keepass2android/services/AutofillBase/AutofillServiceBase.cs +++ b/src/keepass2android/services/AutofillBase/AutofillServiceBase.cs @@ -25,12 +25,12 @@ namespace keepass2android.services.AutofillBase { public interface IAutofillIntentBuilder { - IntentSender GetAuthIntentSenderForResponse(Context context, string query, string queryDomain, string queryPackage, + PendingIntent GetAuthPendingIntentForResponse(Context context, string query, string queryDomain, string queryPackage, bool isManualRequest, bool autoReturnFromQuery, AutofillServiceBase.DisplayWarning warning); - IntentSender GetAuthIntentSenderForWarning(Context context, string query, string queryDomain, string queryPackage, AutofillServiceBase.DisplayWarning warning); + PendingIntent GetAuthPendingIntentForWarning(Context context, string query, string queryDomain, string queryPackage, AutofillServiceBase.DisplayWarning warning); - IntentSender GetDisableIntentSenderForResponse(Context context, string query, + PendingIntent GetDisablePendingIntentForResponse(Context context, string query, bool isManualRequest, bool isDisable); Intent GetRestartAppIntent(Context context); @@ -266,8 +266,8 @@ namespace keepass2android.services.AutofillBase else { //return an "auth" dataset (actually for just warning the user in case domain/package dont match) - IntentSender sender = - IntentBuilder.GetAuthIntentSenderForWarning(this, query, queryDomain, queryPackage, warning); + PendingIntent pendingIntent = + IntentBuilder.GetAuthPendingIntentForWarning(this, query, queryDomain, queryPackage, warning); var datasetName = filledAutofillFieldCollection.DatasetName; if (datasetName == null) { @@ -279,9 +279,9 @@ namespace keepass2android.services.AutofillBase AutofillHelper.NewRemoteViews(PackageName, datasetName, AppNames.LauncherIcon); var datasetBuilder = new Dataset.Builder(presentation); - datasetBuilder.SetAuthentication(sender); + datasetBuilder.SetAuthentication(pendingIntent?.IntentSender); - AutofillHelper.AddInlinePresentation(this, inlinePresentationSpec, datasetName, datasetBuilder, AppNames.LauncherIcon); + AutofillHelper.AddInlinePresentation(this, inlinePresentationSpec, datasetName, datasetBuilder, AppNames.LauncherIcon, null); //need to add placeholders so we can directly fill after ChooseActivity foreach (var autofillId in autofillIds) @@ -310,20 +310,20 @@ namespace keepass2android.services.AutofillBase private void AddQueryDataset(string query, string queryDomain, string queryPackage, bool isManual, AutofillId[] autofillIds, FillResponse.Builder responseBuilder, bool autoReturnFromQuery, DisplayWarning warning, InlinePresentationSpec inlinePresentationSpec) { - var sender = IntentBuilder.GetAuthIntentSenderForResponse(this, query, queryDomain, queryPackage, isManual, autoReturnFromQuery, warning); + PendingIntent pendingIntent = IntentBuilder.GetAuthPendingIntentForResponse(this, query, queryDomain, queryPackage, isManual, autoReturnFromQuery, warning); string text = GetString(Resource.String.autofill_sign_in_prompt); - RemoteViews presentation = AutofillHelper.NewRemoteViews(base.PackageName, + RemoteViews overlayPresentation = AutofillHelper.NewRemoteViews(base.PackageName, text, AppNames.LauncherIcon); - var datasetBuilder = new Dataset.Builder(presentation); - datasetBuilder.SetAuthentication(sender); + var datasetBuilder = new Dataset.Builder(overlayPresentation); + datasetBuilder.SetAuthentication(pendingIntent?.IntentSender); //need to add placeholders so we can directly fill after ChooseActivity foreach (var autofillId in autofillIds) { datasetBuilder.SetValue(autofillId, AutofillValue.ForText("PLACEHOLDER")); } - AutofillHelper.AddInlinePresentation(this, inlinePresentationSpec, text, datasetBuilder, AppNames.LauncherIcon); + AutofillHelper.AddInlinePresentation(this, inlinePresentationSpec, text, datasetBuilder, AppNames.LauncherIcon, pendingIntent); responseBuilder.AddDataset(datasetBuilder.Build()); @@ -364,16 +364,16 @@ namespace keepass2android.services.AutofillBase if (isQueryDisabled && !isManual) return; bool isForDisable = !isQueryDisabled; - var sender = IntentBuilder.GetDisableIntentSenderForResponse(this, query, isManual, isForDisable); + var pendingIntent = IntentBuilder.GetDisablePendingIntentForResponse(this, query, isManual, isForDisable); string text = GetString(isForDisable ? Resource.String.autofill_disable : Resource.String.autofill_enable_for, new Java.Lang.Object[] { GetDisplayNameForQuery(query, this) }); RemoteViews presentation = AutofillHelper.NewRemoteViews(base.PackageName, text, Resource.Drawable.ic_menu_close_grey); var datasetBuilder = new Dataset.Builder(presentation); - datasetBuilder.SetAuthentication(sender); + datasetBuilder.SetAuthentication(pendingIntent?.IntentSender); - AutofillHelper.AddInlinePresentation(this, inlinePresentationSpec, text, datasetBuilder, Resource.Drawable.ic_menu_close_grey); + AutofillHelper.AddInlinePresentation(this, inlinePresentationSpec, text, datasetBuilder, Resource.Drawable.ic_menu_close_grey, null); foreach (var autofillId in autofillIds) { diff --git a/src/keepass2android/services/CopyToClipboardService.cs b/src/keepass2android/services/CopyToClipboardService.cs index 4edcaa45..221c1106 100644 --- a/src/keepass2android/services/CopyToClipboardService.cs +++ b/src/keepass2android/services/CopyToClipboardService.cs @@ -201,7 +201,7 @@ namespace keepass2android extra.PutInt("requestCode", requestCode); intent.PutExtras(extra); - return PendingIntent.GetBroadcast(_ctx, requestCode, intent, PendingIntentFlags.CancelCurrent); + return PendingIntent.GetBroadcast(_ctx, requestCode, intent, Util.AddMutabilityFlag(PendingIntentFlags.CancelCurrent, PendingIntentFlags.Immutable)); } @@ -223,7 +223,7 @@ namespace keepass2android PendingIntent pending; if (intentText == null) { - pending = PendingIntent.GetActivity(_ctx.ApplicationContext, 0, new Intent(), 0); + pending = PendingIntent.GetActivity(_ctx.ApplicationContext, 0, new Intent(), Util.AddMutabilityFlag(0, PendingIntentFlags.Immutable)); } else { @@ -248,7 +248,8 @@ namespace keepass2android PendingIntent pending; Intent intent = new Intent(_ctx, typeof(CopyToClipboardBroadcastReceiver)); intent.SetAction(intentText); - pending = PendingIntent.GetBroadcast(_ctx, descResId, intent, PendingIntentFlags.CancelCurrent); + pending = PendingIntent.GetBroadcast(_ctx, descResId, intent, Util.AddMutabilityFlag(PendingIntentFlags.CancelCurrent, PendingIntentFlags.Immutable)); + return pending; } diff --git a/src/keepass2android/services/Kp2aAutofill/Kp2aAutofillService.cs b/src/keepass2android/services/Kp2aAutofill/Kp2aAutofillService.cs index c57bdcab..4098003a 100644 --- a/src/keepass2android/services/Kp2aAutofill/Kp2aAutofillService.cs +++ b/src/keepass2android/services/Kp2aAutofill/Kp2aAutofillService.cs @@ -17,7 +17,7 @@ using AutofillServiceBase = keepass2android.services.AutofillBase.AutofillServic namespace keepass2android.services { -[Service(Label = AppNames.AppName, Permission=Manifest.Permission.BindAutofillService)] +[Service(Label = AppNames.AppName, Permission=Manifest.Permission.BindAutofillService, Exported = true)] [IntentFilter(new [] {"android.service.autofill.AutofillService"})] [MetaData("android.autofill", Resource = "@xml/autofillservice")] [Register("keepass2android.services.Kp2aAutofillService")] diff --git a/src/keepass2android/services/Kp2aAutofillIntentBuilder.cs b/src/keepass2android/services/Kp2aAutofillIntentBuilder.cs index 750dd1a0..c6c1ffc9 100644 --- a/src/keepass2android/services/Kp2aAutofillIntentBuilder.cs +++ b/src/keepass2android/services/Kp2aAutofillIntentBuilder.cs @@ -14,8 +14,9 @@ namespace keepass2android.services { class Kp2aAutofillIntentBuilder: IAutofillIntentBuilder { + private static int _pendingIntentRequestCode = 0; - public IntentSender GetAuthIntentSenderForResponse(Context context, string query, string queryDomain, string queryPackage, + public PendingIntent GetAuthPendingIntentForResponse(Context context, string query, string queryDomain, string queryPackage, bool isManualRequest, bool autoReturnFromQuery, AutofillServiceBase.DisplayWarning warning) { Intent intent = new Intent(context, typeof(ChooseForAutofillActivity)); @@ -25,10 +26,10 @@ namespace keepass2android.services intent.PutExtra(ChooseForAutofillActivityBase.ExtraIsManualRequest, isManualRequest); intent.PutExtra(ChooseForAutofillActivityBase.ExtraAutoReturnFromQuery, autoReturnFromQuery); intent.PutExtra(ChooseForAutofillActivityBase.ExtraDisplayWarning, (int)warning); - return PendingIntent.GetActivity(context, 0, intent, PendingIntentFlags.CancelCurrent).IntentSender; + return PendingIntent.GetActivity(context, _pendingIntentRequestCode++, intent, Util.AddMutabilityFlag(PendingIntentFlags.CancelCurrent, PendingIntentFlags.Mutable)); } - public IntentSender GetAuthIntentSenderForWarning(Context context, string query, string queryDomain, string queryPackage, + public PendingIntent GetAuthPendingIntentForWarning(Context context, string query, string queryDomain, string queryPackage, AutofillServiceBase.DisplayWarning warning) { Intent intent = new Intent(context, typeof(ChooseForAutofillActivity)); @@ -37,10 +38,10 @@ namespace keepass2android.services intent.PutExtra(ChooseForAutofillActivityBase.ExtraQueryPackageString, queryPackage); intent.PutExtra(ChooseForAutofillActivityBase.ExtraDisplayWarning, (int)warning); intent.PutExtra(ChooseForAutofillActivityBase.ExtraUseLastOpenedEntry, true); - return PendingIntent.GetActivity(context, 0, intent, PendingIntentFlags.CancelCurrent).IntentSender; + return PendingIntent.GetActivity(context, _pendingIntentRequestCode++, intent, Util.AddMutabilityFlag(PendingIntentFlags.CancelCurrent, PendingIntentFlags.Immutable)); } - public IntentSender GetDisableIntentSenderForResponse(Context context, string query, + public PendingIntent GetDisablePendingIntentForResponse(Context context, string query, bool isManualRequest, bool isDisable) { Intent intent = new Intent(context, typeof(DisableAutofillForQueryActivity)); @@ -48,7 +49,7 @@ namespace keepass2android.services intent.PutExtra(ChooseForAutofillActivityBase.ExtraIsManualRequest, isManualRequest); intent.PutExtra(DisableAutofillForQueryActivity.ExtraIsDisable, isDisable); - return PendingIntent.GetActivity(context, 0, intent, PendingIntentFlags.CancelCurrent).IntentSender; + return PendingIntent.GetActivity(context, _pendingIntentRequestCode++, intent, Util.AddMutabilityFlag(PendingIntentFlags.CancelCurrent, PendingIntentFlags.Immutable)); } public Intent GetRestartAppIntent(Context context) diff --git a/src/keepass2android/services/OngoingNotificationsService.cs b/src/keepass2android/services/OngoingNotificationsService.cs index 6bd84345..02259077 100644 --- a/src/keepass2android/services/OngoingNotificationsService.cs +++ b/src/keepass2android/services/OngoingNotificationsService.cs @@ -173,7 +173,7 @@ namespace keepass2android builder.SetContentIntent(GetSwitchToAppPendingIntent()); // Additional action to allow locking the database builder.AddAction(Android.Resource.Drawable.IcLockLock, GetString(Resource.String.QuickUnlock_lockButton), - PendingIntent.GetBroadcast(this, 0, new Intent(this, typeof(ApplicationBroadcastReceiver)).SetAction(Intents.CloseDatabase), PendingIntentFlags.UpdateCurrent)); + PendingIntent.GetBroadcast(this, 0, new Intent(this, typeof(ApplicationBroadcastReceiver)).SetAction(Intents.CloseDatabase), Util.AddMutabilityFlag(PendingIntentFlags.UpdateCurrent, PendingIntentFlags.Immutable))); return builder.Build(); @@ -216,7 +216,7 @@ namespace keepass2android // Default action is to show Kp2A builder.SetContentIntent(GetSwitchToAppPendingIntent()); // Additional action to allow locking the database - builder.AddAction(Resource.Drawable.ic_action_lock, GetString(Resource.String.menu_lock), PendingIntent.GetBroadcast(this, 0, new Intent(this, typeof(ApplicationBroadcastReceiver)).SetAction(Intents.LockDatabase), PendingIntentFlags.UpdateCurrent)); + builder.AddAction(Resource.Drawable.ic_action_lock, GetString(Resource.String.menu_lock), PendingIntent.GetBroadcast(this, 0, new Intent(this, typeof(ApplicationBroadcastReceiver)).SetAction(Intents.LockDatabase), Util.AddMutabilityFlag(PendingIntentFlags.UpdateCurrent, PendingIntentFlags.Immutable))); return builder.Build(); } @@ -227,7 +227,7 @@ namespace keepass2android startKp2aIntent.SetAction(Intent.ActionMain); startKp2aIntent.AddCategory(Intent.CategoryLauncher); - return PendingIntent.GetActivity(this, 0, startKp2aIntent, PendingIntentFlags.UpdateCurrent); + return PendingIntent.GetActivity(this, 0, startKp2aIntent, Util.AddMutabilityFlag(PendingIntentFlags.UpdateCurrent, PendingIntentFlags.Immutable)); } private static string GetDatabaseName() diff --git a/src/keepass2android/timeout/TimeoutHelper.cs b/src/keepass2android/timeout/TimeoutHelper.cs index 41b6ae08..f3582321 100644 --- a/src/keepass2android/timeout/TimeoutHelper.cs +++ b/src/keepass2android/timeout/TimeoutHelper.cs @@ -35,7 +35,7 @@ namespace keepass2android private static PendingIntent BuildPendingBroadcastIntent(Context ctx) { - return PendingIntent.GetBroadcast(ctx, 0, BuildBroadcastIntent(ctx), PendingIntentFlags.UpdateCurrent); + return PendingIntent.GetBroadcast(ctx, 0, BuildBroadcastIntent(ctx), Util.AddMutabilityFlag(PendingIntentFlags.UpdateCurrent, PendingIntentFlags.Immutable)); } private static Intent BuildBroadcastIntent(Context ctx)