don't use implicit intents for notification actions. Should fix #149.
This commit is contained in:
@@ -8,7 +8,6 @@ using Android.Preferences;
|
||||
namespace keepass2android
|
||||
{
|
||||
[BroadcastReceiver]
|
||||
[IntentFilter(new[] { Intents.LockDatabase, Intents.CloseDatabase })]
|
||||
public class ApplicationBroadcastReceiver : BroadcastReceiver
|
||||
{
|
||||
public override void OnReceive(Context context, Intent intent)
|
||||
|
||||
@@ -212,8 +212,8 @@ namespace keepass2android
|
||||
private PendingIntent GetPendingIntent(string intentText, int descResId)
|
||||
{
|
||||
PendingIntent pending;
|
||||
Intent intent = new Intent(intentText);
|
||||
intent.SetPackage(_ctx.PackageName);
|
||||
Intent intent = new Intent(_ctx, typeof(CopyToClipboardBroadcastReceiver));
|
||||
intent.SetAction(intentText);
|
||||
pending = PendingIntent.GetBroadcast(_ctx, descResId, intent, PendingIntentFlags.CancelCurrent);
|
||||
return pending;
|
||||
}
|
||||
@@ -454,12 +454,7 @@ namespace keepass2android
|
||||
StopSelf();
|
||||
return;
|
||||
}
|
||||
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.AddAction(Intents.CopyUsername);
|
||||
filter.AddAction(Intents.CopyPassword);
|
||||
filter.AddAction(Intents.CheckKeyboard);
|
||||
|
||||
|
||||
//register receiver to get notified when notifications are discarded in which case we can shutdown the service
|
||||
_notificationDeletedBroadcastReceiver = new NotificationDeletedBroadcastReceiver(this);
|
||||
IntentFilter deletefilter = new IntentFilter();
|
||||
@@ -757,7 +752,6 @@ namespace keepass2android
|
||||
}
|
||||
|
||||
[BroadcastReceiver(Permission = "keepass2android." + AppNames.PackagePart + ".permission.CopyToClipboard")]
|
||||
[IntentFilter(new[] { Intents.CopyUsername, Intents.CopyPassword, Intents.CheckKeyboard })]
|
||||
class CopyToClipboardBroadcastReceiver : BroadcastReceiver
|
||||
{
|
||||
public CopyToClipboardBroadcastReceiver(IntPtr javaReference, JniHandleOwnership transfer)
|
||||
|
||||
@@ -163,7 +163,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(Intents.CloseDatabase), PendingIntentFlags.UpdateCurrent));
|
||||
PendingIntent.GetBroadcast(this, 0, new Intent(this, typeof(ApplicationBroadcastReceiver)).SetAction(Intents.CloseDatabase), PendingIntentFlags.UpdateCurrent));
|
||||
|
||||
|
||||
return builder.Build();
|
||||
@@ -208,7 +208,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(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), PendingIntentFlags.UpdateCurrent));
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace keepass2android
|
||||
|
||||
private static PendingIntent BuildIntent(Context ctx)
|
||||
{
|
||||
return PendingIntent.GetBroadcast(ctx, 0, new Intent(Intents.LockDatabase), PendingIntentFlags.UpdateCurrent);
|
||||
return PendingIntent.GetBroadcast(ctx, 0, new Intent(ctx, typeof(ApplicationBroadcastReceiver)).SetAction(Intents.LockDatabase), PendingIntentFlags.UpdateCurrent);
|
||||
}
|
||||
|
||||
public static void Start(Context ctx)
|
||||
|
||||
Reference in New Issue
Block a user