runnerup icon indicating copy to clipboard operation
runnerup copied to clipboard

Use explicit PendingIntents for notification actions

Open roberi opened this issue 1 year ago • 1 comments

Fixes #1189

Starting with Android 14, implicit intents are restricted for internal app components. This commit explicitly sets the package name for PendingIntents used as notification actions to ensure compatibility with the behavior changes outlined in: https://developer.android.com/about/versions/14/behavior-changes-14#security

roberi avatar Jul 05 '24 13:07 roberi

Approved, working fine

There are two occurrences each in app/src/main/org/runnerup/tracker/component/TrackerPebble.java:85 and app/src/main/org/runnerup/tracker/component/TrackerPebble.java:479 Even if Wear is dropped right now and there are likely a minimum of Pebble users, I suggest that is changed. I would have expected that app/src/main/org/runnerup/tracker/component/TrackerPebble.java:735 :759 would be affected too

I thought I had checked this already...

gerhardol avatar Jul 05 '24 20:07 gerhardol

There are two occurrences each in app/src/main/org/runnerup/tracker/component/TrackerPebble.java:85...

I agree, this we should change.

But I'm unsure why LocalBroadcastManager is used to broadcast RESUME_WORKOUT and PAUSE_WORKOUT and context.sendBroadcast() is used to broadcast START_WORKOUT.

I think we could either just change startBroadcastIntent.setPackage(null) to startBroadcastIntent.setPackage(context.getPackageName()) or to replace

Intent startBroadcastIntent = new Intent()
    .setAction(org.runnerup.common.util.Constants.Intents.START_WORKOUT);
startBroadcastIntent.setPackage(context.getPackageName());
context.sendBroadcast(startBroadcastIntent);

with sendLocalBroadcast(org.runnerup.common.util.Constants.Intents.START_WORKOUT)

Any thoughts about this?

roberi avatar Jul 06 '24 11:07 roberi

... and app/src/main/org/runnerup/tracker/component/TrackerPebble.java:479

I assume you mean app/src/wear/org/runnerup/tracker/component/TrackerWear.java:479?

I agree, but same question here. Do we use contextsendBroadcast() or LocalBroadcastManager?

roberi avatar Jul 06 '24 11:07 roberi

I would have expected that app/src/main/org/runnerup/tracker/component/TrackerPebble.java:735 :759 would be affected too

You must mean some other class than TrackerPebble (since it only has 179 lines)?

roberi avatar Jul 06 '24 11:07 roberi

Failed copy... app/src/main/org/runnerup/view/StartActivity.java:735 :759 app/src/wear/org/runnerup/tracker/component/TrackerWear.java:479

I think we could either just change startBroadcastIntent.setPackage(null) to startBroadcastIntent.setPackage(context.getPackageName()) or to replace with sendLocalBroadcast(org.runnerup.common.util.Constants.Intents.START_WORKOUT)

Any thoughts about this?

No opinion right now. Should try to connect to Pebble users. Maybe just open an issue about it for now and merge this as is.

gerhardol avatar Jul 07 '24 22:07 gerhardol