Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quick actions with input do not emit events on Android 14 #1002

Closed
yulolimum opened this issue Mar 2, 2024 · 4 comments
Closed

quick actions with input do not emit events on Android 14 #1002

yulolimum opened this issue Mar 2, 2024 · 4 comments

Comments

@yulolimum
Copy link

yulolimum commented Mar 2, 2024

Hello!

Summary

Experiencing an issue on Android 14 with Quick Actions feature when the input is set (freeform or choices) when the application is in "background" as described in the bullet points in this section.. None of the event listeners receive the user's ACTION_PRESS.

No issues on Android 13 or iOS 17.2.

Details

Environment & versions:

java zulu-17.46.19
nodejs 20.11.1
ruby 3.3.0
yarn 1.22.19
android 14
notifee 7.8.2
react-native 0.73.5
power-saver off
battery-optimization off
• Code example (click to reveal)
// index.js
//...
setupNotifications();

notifee.onBackgroundEvent(async ({type}) => {
  console.log('Background Event:', EventType[type]);
});

AppRegistry.registerComponent(appName, () => App);
// App.tsx
//...
export enum NotificationType {
  GameReview,
}

export enum NotificationCategory {
  GameReview = 'game-review',
}

export enum NotificationChannel {
  Default = 'default',
}

export enum NotificationPressAction {
  Default = 'default',
  SubmitReview = 'submit-review',
}

const androidChannels: AndroidChannel[] = [
  {
    id: NotificationChannel.Default,
    name: 'Default',
    description: 'General app notifications.',
    importance: AndroidImportance.HIGH,
    badge: false,
  },
];

const iosCategories: IOSNotificationCategory[] = [
  {
    id: NotificationCategory.GameReview,
    actions: [
      {
        id: NotificationPressAction.SubmitReview,
        title: 'Review Game',
        input: {
          placeholderText: 'Type your review...',
          buttonText: 'Submit',
        },
      },
    ],
  },
];

export async function setupNotifications() {
  const permission = await notifee.requestPermission();

  if (permission.authorizationStatus === AuthorizationStatus.AUTHORIZED) {
    await notifee.setNotificationCategories(iosCategories);
    await notifee.createChannels(androidChannels);

    const settings = await notifee.getNotificationSettings();

    if (settings.android.alarm !== AndroidNotificationSetting.ENABLED) {
      await notifee.openAlarmPermissionSettings();
    }
  }
}

//...

function App(): React.JSX.Element {
  useEffect(() => {
    return notifee.onForegroundEvent(async ({type}) => {
      console.log('Foreground Event', EventType[type]);
    });
  }, []);

  useEffect(() => {
    notifee.getInitialNotification().then(_n => {
      console.log('Initial Notification Event');
    });
  }, []);
  
  //...
  
  function notify() {
    notifee.createTriggerNotification(
      {
        title: 'Please Review: Mario',
        body: 'Looks like you enjoyed this game! Please leave a review!',
        data: {
          notificationType: NotificationType.GameReview,
          gameId: 1234,
          gameName: 'Mario',
        },
        ios: {
          categoryId: NotificationCategory.GameReview,
        },
        android: {
          channelId: NotificationChannel.Default,
          actions: [
            {
              title: 'Review Game',
              input: true,
              pressAction: {
                id: NotificationPressAction.SubmitReview,
              },
            },
          ],
        },
      },
      {
        type: TriggerType.TIMESTAMP,
        timestamp: Date.now() + 5000,
      },
    );
  }
  
  //...
  
}
--TRIGGER CREATED
03-01 17:38:27.536  1140  1140 D CarrierSvcBindHelper: onPackageModified: com.tmpnotifee
03-01 17:38:27.548  1140  1411 D ImsResolver: maybeAddedImsService, packageName: com.tmpnotifee
03-01 17:38:27.579  1709  1709 I AiAiEcho: AppFetcherImpl onPackageChanged com.tmpnotifee.
03-01 17:38:27.579  1709  9394 I AiAiEcho: AppIndexer Package:[com.tmpnotifee] UserProfile:[0] Enabled:[true].
03-01 17:38:27.579  1709  9394 I AiAiEcho: AppFetcherImplV2 updateApps package:[com.tmpnotifee], userId:[0], reason:[package is updated.].
03-01 17:38:28.367   542   559 V WindowManager:     info={id=55 t=OPEN f=0x0 trk=0 r=[0@Point(0, 0)] c=[{WCT{RemoteToken{71f9135 Task{ecbba35 #1 type=home}}} m=TO_FRONT f=SHOW_WALLPAPER|MOVE_TO_TOP leash=Surface(name=Task=1)/@0x78197fa sb=Rect(0, 0 - 1080, 2340) eb=Rect(0, 0 - 1080, 2340) d=0},{WCT{RemoteToken{20b85f2 Task{662f4f4 #11 type=standard A=10183:com.tmpnotifee}}} m=TO_BACK f=NONE leash=Surface(name=Task=11)/@0x703fd54 sb=Rect(0, 0 - 1080, 2340) eb=Rect(0, 0 - 1080, 2340) d=0},{null m=TO_FRONT f=IS_WALLPAPER leash=Surface(name=WallpaperWindowToken{2ad6574 token=android.os.Binder@fd62947})/@0x1b14b57 sb=Rect(0, 0 - 1080, 2340) eb=Rect(0, 0 - 1080, 2340) d=0}]}
03-01 17:38:30.553  6539  6561 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=e361a52d-eb02-416e-ba8a-9a619c52e7f2, tags={ app.notifee.core.Worker, app.notifee.core.NotificationManager.TRIGGER, trigger:vjBE1vX3SbZAvNSzi7I5 } ]
-- NOTIFICATION RECEIVED
03-01 17:38:31.561  1140  1140 D CarrierSvcBindHelper: onPackageModified: com.tmpnotifee
03-01 17:38:31.567  1709  1709 I AiAiEcho: AppFetcherImpl onPackageChanged com.tmpnotifee.
03-01 17:38:31.568  1709  9420 I AiAiEcho: AppIndexer Package:[com.tmpnotifee] UserProfile:[0] Enabled:[true].
03-01 17:38:31.568  1709  9420 I AiAiEcho: AppFetcherImplV2 updateApps package:[com.tmpnotifee], userId:[0], reason:[package is updated.].
03-01 17:38:31.574  1140  1411 D ImsResolver: maybeAddedImsService, packageName: com.tmpnotifee
-- QUICK ACTION PRESSED
03-01 17:38:34.776   542   612 E ActivityTaskManager: Without BAL hardening this activity start would be allowed! [callingPackage: com.tmpnotifee; callingUid: 10183; appSwitchState: 1; callingUidHasAnyVisibleWindow: false; callingUidProcState: LAST_ACTIVITY; isCallingUidPersistentSystemProcess: false; balAllowedByPiSender: BackgroundStartPrivileges[allowsBackgroundActivityStarts=false, allowsBackgroundForegroundServiceStarts=true, originatingToken=null]; realCallingPackage: com.android.systemui; realCallingUid: 10159; realCallingUidHasAnyVisibleWindow: true; realCallingUidProcState: PERSISTENT_UI; isRealCallingUidPersistentSystemProcess: true; originatingPendingIntent: PendingIntentRecord{d8cd2 com.tmpnotifee startActivity (allowlist: 84070f:+30s0ms/0/NOTIFICATION_SERVICE/NotificationManagerService)}; backgroundStartPrivileges: BackgroundStartPrivileges[allowsBackgroundActivityStarts=true, allowsBackgroundForegroundServiceStarts=true, originatingToken=android.os.Binder@84070f]; intent: Intent { flg=0x18080000 cmp=com.tmpnotifee/app.notifee.core.NotificationReceiverActivity clip={text/vnd.android.intent hasLabel(27) {I:(has extras)}} (has extras) }; callerApp: null; inVisibleTask: false]
03-01 17:38:34.776   542   612 W ActivityTaskManager: Background activity launch blocked [callingPackage: com.tmpnotifee; callingUid: 10183; appSwitchState: 1; callingUidHasAnyVisibleWindow: false; callingUidProcState: LAST_ACTIVITY; isCallingUidPersistentSystemProcess: false; balAllowedByPiSender: BackgroundStartPrivileges[allowsBackgroundActivityStarts=false, allowsBackgroundForegroundServiceStarts=true, originatingToken=null]; realCallingPackage: com.android.systemui; realCallingUid: 10159; realCallingUidHasAnyVisibleWindow: true; realCallingUidProcState: PERSISTENT_UI; isRealCallingUidPersistentSystemProcess: true; originatingPendingIntent: PendingIntentRecord{d8cd2 com.tmpnotifee startActivity (allowlist: 84070f:+30s0ms/0/NOTIFICATION_SERVICE/NotificationManagerService)}; backgroundStartPrivileges: BackgroundStartPrivileges[allowsBackgroundActivityStarts=true, allowsBackgroundForegroundServiceStarts=true, originatingToken=android.os.Binder@84070f]; intent: Intent { flg=0x18080000 cmp=com.tmpnotifee/app.notifee.core.NotificationReceiverActivity clip={text/vnd.android.intent hasLabel(27) {I:(has extras)}} (has extras) }; callerApp: null; inVisibleTask: false]
03-01 17:38:34.777   542   612 I ActivityTaskManager: START u0 {flg=0x18080000 cmp=com.tmpnotifee/app.notifee.core.NotificationReceiverActivity clip={text/vnd.android.intent hasLabel(27) {I:(has extras)}} (has extras)} with LAUNCH_MULTIPLE from uid 10183 (realCallingUid=10159) (BAL_BLOCK) result code=102
  • for comparison, adb logcat | grep "notifee" output when submitting input in foreground:
--TRIGGER CREATED
03-01 17:36:38.641  1140  1140 D CarrierSvcBindHelper: onPackageModified: com.tmpnotifee
03-01 17:36:38.656  1709  1709 I AiAiEcho: AppFetcherImpl onPackageChanged com.tmpnotifee.
03-01 17:36:38.659  1709  9393 I AiAiEcho: AppIndexer Package:[com.tmpnotifee] UserProfile:[0] Enabled:[true].
03-01 17:36:38.659  1709  9393 I AiAiEcho: AppFetcherImplV2 updateApps package:[com.tmpnotifee], userId:[0], reason:[package is updated.].
-- NOTIFICATION RECEIVED
03-01 17:36:38.661  1140  1411 D ImsResolver: maybeAddedImsService, packageName: com.tmpnotifee
03-01 17:36:41.652  6539  6562 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=dc909ca0-6669-44ce-b079-7ea1622b512b, tags={ app.notifee.core.Worker, app.notifee.core.NotificationManager.TRIGGER, trigger:ptv1s5jvCf6do3hWJDQa } ]
03-01 17:36:42.682  1140  1140 D CarrierSvcBindHelper: onPackageModified: com.tmpnotifee
03-01 17:36:42.692  1709  1709 I AiAiEcho: AppFetcherImpl onPackageChanged com.tmpnotifee.
03-01 17:36:42.693  1709  9394 I AiAiEcho: AppIndexer Package:[com.tmpnotifee] UserProfile:[0] Enabled:[true].
03-01 17:36:42.693  1709  9394 I AiAiEcho: AppFetcherImplV2 updateApps package:[com.tmpnotifee], userId:[0], reason:[package is updated.].
03-01 17:36:42.694  1140  1411 D ImsResolver: maybeAddedImsService, packageName: com.tmpnotifee
-- QUICK ACTION PRESSED
03-01 17:36:47.896   542  2351 V SplashScreenExceptionList: SplashScreen checking exception for package com.tmpnotifee (target sdk:34) -> false
03-01 17:36:47.897   917   988 V WindowManagerShell: Transition requested: android.os.BinderProxy@e24a62b TransitionRequestInfo { type = OPEN, triggerTask = TaskInfo{userId=0 taskId=13 displayId=0 isRunning=true baseIntent=Intent { flg=0x18880000 cmp=com.tmpnotifee/app.notifee.core.NotificationReceiverActivity } baseActivity=ComponentInfo{com.tmpnotifee/app.notifee.core.NotificationReceiverActivity} topActivity=ComponentInfo{com.tmpnotifee/app.notifee.core.NotificationReceiverActivity} origActivity=null realActivity=ComponentInfo{com.tmpnotifee/app.notifee.core.NotificationReceiverActivity} numActivities=1 lastActiveTime=2377223 supportsMultiWindow=true resizeMode=1 isResizeable=true minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{android.window.IWindowContainerToken$Stub$Proxy@7e0a88} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=-1 lastParentTaskIdBeforePip=-1 displayCutoutSafeInsets=null topActivityInfo=ActivityInfo{a101c21 app.notifee.core.NotificationReceiverActivity} launchCookies=[] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=false isVisibleRequested=false isSleeping=false topActivityInSizeCompat=false topActivityEligibleForLetterboxEducation= false topActivityLetterboxed= false isFromDoubleTap= false topActivityLetterboxVerticalPosition= -1 topActivityLetterboxHorizontalPosition= -1 topActivityLetterboxWidth=-1 topActivityLetterboxHeight=-1 locusId=null displayAreaFeatureId=1 cameraCompatControlState=hidden}, remoteTransition = null, displayChange = null }
03-01 17:36:47.897   542  2351 I ActivityTaskManager: START u0 {flg=0x18080000 cmp=com.tmpnotifee/app.notifee.core.NotificationReceiverActivity clip={text/vnd.android.intent hasLabel(27) {I:(has extras)}} (has extras)} with LAUNCH_MULTIPLE from uid 10183 (realCallingUid=10159) (BAL_ALLOW_VISIBLE_WINDOW) result code=0
03-01 17:36:47.915   542   559 V WindowManager: Sent Transition #53 createdAt=03-01 17:36:47.894 via request=TransitionRequestInfo { type = OPEN, triggerTask = TaskInfo{userId=0 taskId=13 displayId=0 isRunning=true baseIntent=Intent { flg=0x18880000 cmp=com.tmpnotifee/app.notifee.core.NotificationReceiverActivity } baseActivity=ComponentInfo{com.tmpnotifee/app.notifee.core.NotificationReceiverActivity} topActivity=ComponentInfo{com.tmpnotifee/app.notifee.core.NotificationReceiverActivity} origActivity=null realActivity=ComponentInfo{com.tmpnotifee/app.notifee.core.NotificationReceiverActivity} numActivities=1 lastActiveTime=2377223 supportsMultiWindow=true resizeMode=1 isResizeable=true minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{RemoteToken{16e7003 Task{50f467 #13 type=standard I=com.tmpnotifee/app.notifee.core.NotificationReceiverActivity}}} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=-1 lastParentTaskIdBeforePip=-1 displayCutoutSafeInsets=null topActivityInfo=ActivityInfo{778cb80 app.notifee.core.NotificationReceiverActivity} launchCookies=[] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=false isVisibleRequested=false isSleeping=false topActivityInSizeCompat=false topActivityEligibleForLetterboxEducation= false topActivityLetterboxed= false isFromDoubleTap= false topActivityLetterboxVerticalPosition= -1 topActivityLetterboxHorizontalPosition= -1 topActivityLetterboxWidth=-1 topActivityLetterboxHeight=-1 locusId=null displayAreaFeatureId=1 cameraCompatControlState=hidden}, remoteTransition = null, displayChange = null }
03-01 17:36:47.915   542   559 V WindowManager:     info={id=53 t=OPEN f=0x0 trk=0 r=[0@Point(0, 0)] c=[{WCT{RemoteToken{20b85f2 Task{662f4f4 #11 type=standard A=10183:com.tmpnotifee}}} m=CHANGE f=MOVE_TO_TOP leash=Surface(name=Task=11)/@0x703fd54 sb=Rect(0, 0 - 1080, 2340) eb=Rect(0, 0 - 1080, 2340) d=0}]}
03-01 17:36:48.248   542  2739 I ImeTracker: com.tmpnotifee:37e1fd52: onRequestHide at ORIGIN_SERVER_HIDE_INPUT reason HIDE_UNSPECIFIED_WINDOW
03-01 17:36:48.248   542  2739 I ImeTracker: com.tmpnotifee:37e1fd52: onCancelled at PHASE_SERVER_SHOULD_HIDE
03-01 17:36:48.250  1625  1625 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1877 onStartInput(EditorInfo{inputType=0x0(NULL) imeOptions=0x0 privateImeOptions=null actionName=UNSPECIFIED actionLabel=null actionId=0 initialSelStart=-1 initialSelEnd=-1 initialCapsMode=0x0 hintText=null label=null packageName=com.tmpnotifee fieldId=0 fieldName=null extras=null}, false)

Reproduction

  1. Clone repo:
    git clone git@github.com:yulolimum/tmp-notifee-input-repro.git
  2. Setup the env and deps and create an Android 14 (API 34):
    yarn setup
    This should install all node, ruby, pod deps.
  3. Start metro.
    yarn start
  4. Launch Android 14 emulator.
    yarn android
  5. On first launch, accept all permission and change the alarm settings.
  6. Relaunch app.
  7. Click on "Schedule Notification w/ Input". This will give you 5 seconds to background the app.
  8. Background or kill the app.
  9. Observe incoming notification.
  10. Type in the freeform input field and Submit.
  11. Observe no PRESS_ACTION in the console logs.

Proofs

Android 14 Foreground ✅ ❌ Android 14 Background ❌
yulolimum-capture-2024-03-01--16-37-22.mp4
yulolimum-capture-2024-03-01--16-46-31.mp4
Android 13 Foreground ✅ Android 13 Background ✅
yulolimum-capture-2024-03-01--17-06-07.mp4
yulolimum-capture-2024-03-01--17-04-22.mp4
iOS Foreground ✅ iOS Background ✅
yulolimum-capture-2024-03-01--16-43-50.mp4
yulolimum-capture-2024-03-01--16-47-41.mp4
@AftabUfaq
Copy link

this is possibliiy solution

Copy link

github-actions bot commented Apr 3, 2024

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 18, 2024
@medreres
Copy link

medreres commented Jul 9, 2024

Have identical problem on android emulator.
image

 "@notifee/react-native": "^7.8.2",
     "react-native": "^0.74.3",

@medreres
Copy link

medreres commented Jul 9, 2024

this is possibliiy solution

Does not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants