khpylon / MachEWidget

Android Widget for Ford Mustang Mach-E
GNU General Public License v3.0
35 stars 10 forks source link

Bug - Widget not updating #6

Closed mporet closed 2 years ago

mporet commented 2 years ago

My widget has stopped updating, even when I click refresh manually Here's the logcat output from when I click refresh: 2022-02-09 17:12:01.629 1204-13293/? D/SamsungAlarmManager: Cancel Alarm calling from uid:10594 pid :20044 / OP:PendingIntent{498b493: PendingIntentRecord{b1647fe com.example.khughes.machewidget broadcastIntent}} 2022-02-09 17:12:01.630 1204-13293/? D/SamsungAlarmManager: setInexact (T:0/F:0/AC:false) 20220209T171206 now=1177728372 - CU:10594/CP:20044/OP:PendingIntent{8bbdcd0: PendingIntentRecord{b1647fe com.example.khughes.machewidget broadcastIntent}} 2022-02-09 17:12:01.632 1204-13287/? D/SamsungAlarmManager: setInexact (T:0/F:0/AC:false) 20220209T171206 now=1177728374 - CU:10594/CP:20044/OP:PendingIntent{e2494c9: PendingIntentRecord{b1647fe com.example.khughes.machewidget broadcastIntent}} 2022-02-09 17:12:01.635 20044-20044/? V/Toast: show: caller = com.example.khughes.machewidget.MainActivity.onOptionsItemSelected:140 2022-02-09 17:12:01.645 1204-13287/? V/WindowManager: Changing focus from Window{fe03fed u0 PopupWindow:219fc11} to Window{1ab1f8d u0 com.example.khughes.machewidget/com.example.khughes.machewidget.MainActivity} displayId=0 Callers=com.android.server.wm.RootWindowContainer.updateFocusedWindowLocked:582 com.android.server.wm.WindowManagerService.updateFocusedWindowLocked:6419 com.android.server.wm.WindowManagerService.relayoutWindow:2740 com.android.server.wm.Session.relayout:242 2022-02-09 17:12:01.675 1088-1088/? I/SurfaceFlinger: [1ab1f8d com.example.khughes.machewidget/com.example.khughes.machewidget.MainActivity#0] FrameRatePriority: 1 2022-02-09 17:12:01.678 1204-13293/? D/InputDispatcher: Focus entered window (0): 1ab1f8d com.example.khughes.machewidget/com.example.khughes.machewidget.MainActivity 2022-02-09 17:12:01.749 1088-1088/? D/SurfaceFlinger: Display 4630947232161729153 HWC layers: DEVICE | 0xb400007ac8d03440 | 0100 | RGBA_8888 | 0.0 0.0 1080.0 2400.0 | 0 0 1080 2400 | com.example.khughes.machewidget/com.[...]es.machewidget.MainActivity$_20044#0 DEVICE | 0xb400007ac8cf7230 | 0100 | RGBA_8888 | 0.0 0.0 648.0 864.0 | 432 38 1080 902 | PopupWindow:219fc11$_20044#0 DEVICE | 0xb400007ac8cd1580 | 0100 | RGBA_8888 | 0.0 0.0 1080.0 73.0 | 0 0 1080 73 | StatusBar$_5625#0 DEVICE | 0xb400007ac8ce8e60 | 0100 | RGBA_8888 | 0.0 0.0 67.0 457.0 | 1013 356 1080 813 | com.samsung.android.app.cocktailbars[...]rservice.CocktailBarService$_12373#0 DEVICE | 0xb400007ac8cbdd50 | 0100 | RGBA_8888 | 0.0 0.0 906.0 132.0 | 87 2076 993 2208 | Toast$_5625#0 DEVICE | 0xb400007ac8d077c0 | 0100 | RGBA_8888 | 0.0 0.0 1080.0 144.0 | 0 2256 1080 2400 | NavigationBar0$_5625#0 2022-02-09 17:12:02.002 1088-1088/? D/SurfaceFlinger: Display 4630947232161729153 HWC layers: DEVICE | 0xb400007ac8d03440 | 0100 | RGBA_8888 | 0.0 0.0 1080.0 2400.0 | 0 0 1080 2400 | com.example.khughes.machewidget/com.[...]es.machewidget.MainActivity$_20044#0 DEVICE | 0xb400007ac8cd1580 | 0100 | RGBA_8888 | 0.0 0.0 1080.0 73.0 | 0 0 1080 73 | StatusBar$_5625#0 DEVICE | 0xb400007ac8ce8e60 | 0100 | RGBA_8888 | 0.0 0.0 67.0 457.0 | 1013 356 1080 813 | com.samsung.android.app.cocktailbars[...]rservice.CocktailBarService$_12373#0 DEVICE | 0xb400007ac8cbdd50 | 0100 | RGBA_8888 | 0.0 0.0 906.0 132.0 | 87 2076 993 2208 | Toast$_5625#0 DEVICE | 0xb400007ac8d077c0 | 0100 | RGBA_8888 | 0.0 0.0 1080.0 144.0 | 0 2256 1080 2400 | NavigationBar0$_5625#0 2022-02-09 17:12:02.150 1204-1524/? D/SGM:GameManager: identifyForegroundApp. com.example.khughes.machewidget, mCurrentUserId: 0, callerUserId: 0 2022-02-09 17:12:02.150 1204-1524/? D/SGM:PkgDataHelper: getGamePkgData(). com.example.khughes.machewidget 2022-02-09 17:12:03.997 1204-5788/? W/NotificationService: Toast already killed. pkg=com.example.khughes.machewidget token=android.os.BinderProxy@f582ba9 2022-02-09 17:12:04.527 1088-1088/? D/SurfaceFlinger: Display 4630947232161729153 HWC layers: DEVICE | 0xb400007ac8d03440 | 0100 | RGBA_8888 | 0.0 0.0 1080.0 2400.0 | 0 0 1080 2400 | com.example.khughes.machewidget/com.[...]es.machewidget.MainActivity$_20044#0 DEVICE | 0xb400007ac8cd1580 | 0100 | RGBA_8888 | 0.0 0.0 1080.0 73.0 | 0 0 1080 73 | StatusBar$_5625#0 DEVICE | 0xb400007ac8ce8e60 | 0100 | RGBA_8888 | 0.0 0.0 67.0 457.0 | 1013 356 1080 813 | com.samsung.android.app.cocktailbars[...]rservice.CocktailBarService$_12373#0 DEVICE | 0xb400007ac8d077c0 | 0100 | RGBA_8888 | 0.0 0.0 1080.0 144.0 | 0 2256 1080 2400 | NavigationBar0$_5625#0 2022-02-09 17:12:10.381 1204-2111/? V/SamsungAlarmManager: Sending to uid : 10594 action=null alarm=Alarm{a4742b6 type 0 origWhen 1644451926629 whenElapsed 1177733372 com.example.khughes.machewidget} 2022-02-09 17:12:10.384 1204-2111/? D/ActivityManager: Received BROADCAST intent 0xb1647fe Key{broadcastIntent pkg=com.example.khughes.machewidget intent=cmp=com.example.khughes.machewidget/.StatusReceiver flags=0x4000000 u=0} requestCode=0 sent=0 from uid 1000 2022-02-09 17:12:10.401 1204-13293/? D/SamsungAlarmManager: setInexact (T:0/F:0/AC:false) 20220209T171710 now=1177737142 - CU:10594/CP:20044/OP:PendingIntent{c63ef24: PendingIntentRecord{b1647fe com.example.khughes.machewidget broadcastIntent}} 2022-02-09 17:12:10.403 1204-13293/? D/SamsungAlarmManager: setInexact (T:0/F:0/AC:false) 20220209T171710 now=1177737145 - CU:10594/CP:20044/OP:PendingIntent{341fa8d: PendingIntentRecord{b1647fe com.example.khughes.machewidget broadcastIntent}}

benk016 commented 2 years ago

Mine also has stopped updating. If I re-enter my credentials, it will update once and never again.

khpylon commented 2 years ago

I was thinking about pushing out a new version anyway. Let's see if that fixes the problem.

Secret: to see the last time the status updated successfully, triple-tap on the "Last refresh:" text. I've been using this to see when it really updates vs it updated and nothing changed.

benk016 commented 2 years ago

Triple tap shows an update 2 hours ago. Which is when I re-entered credentials.

khpylon commented 2 years ago

I just pushed the new version. See if that makes any difference.

What update frequency are you using (not that it should make a big difference)?

mporet commented 2 years ago

Still no refresh for me.. triple tap says yesterday, my interval is set to 5 minutes

khpylon commented 2 years ago

Still no refresh for me.. triple tap says yesterday, my interval is set to 5 minutes

Just to be sure, you logged back into your account? And is this on the 2022.02.09 version?

mporet commented 2 years ago

Oh, I was unaware I had to sign back in again. Glad to know you're not storing credentials unnecessarily ;). After signing in again it appears to be working

benk016 commented 2 years ago

Updated and seems to be updating as expected again! Thank you!

khpylon commented 2 years ago

I've been able to update before without logging in again, as long as none of the stored data changed. But it doesn't work always.

On Feb 9, 2022, 17:25, at 17:25, mporet @.***> wrote:

Oh, I was unaware I had to sign back in again. Glad to know you're not storing credentials unnecessarily ;). After signing in again it appears to be working

-- Reply to this email directly or view it on GitHub: https://github.com/khpylon/MachEWidget/issues/6#issuecomment-1034387811 You are receiving this because you commented.

Message ID: @.***>

benk016 commented 2 years ago

It appears mine has already stopped updating. I think it only updated once on its own and back to stuck.

khpylon commented 2 years ago

This is with the latest version? And if so, you logged back into FordPass after installing the update, just to be sure?

benk016 commented 2 years ago

Yea, latest version, and signed in and it updated the one time after that and not again since.

mporet commented 2 years ago

Same here. Stopped refreshing again

khpylon commented 2 years ago

Ok, think I figured out what I messed up. I'll be sending each of you a DM on macheforums.com shortly to get a link to a test version to try out.

khpylon commented 2 years ago

I came across a different but possibly related situation this morning when the updates stopped again after running fine for 12+ hours. Somehow the refreshToken information completely disappeared from the saved data. I only have a hunch what might have caused this so I've made some more changes to see if I'm right.

benk016 commented 2 years ago

Mine wasn't updating on its own earlier, but opened the app and did a manual refresh and it updated at least. Before that wouldn't even work. After doing that one manual refresh, its back to updating on its own again.

mporet commented 2 years ago

Still no refresh here after the fix you DMd us

khpylon commented 2 years ago

I've uploaded the latest version to my Google Drive; I've been using since 2pm yesterday and hasn't missed an update.

Try downloading from the link in the DM; if the link doesn't work let me know there.

skiingj commented 2 years ago

Hi. I don't mind testing. Mine is not updating as well. I'm on 2.09. S21Ultra 12. Thanks

CHeil402 commented 2 years ago

Was this addressed? I have the 2.11 version installed but am experiencing the same issue. It used to update. It will update when I log in but never again after that, even with a manual refresh. I don't know if it's supposed to change, but after logging in the option in the menu still shows "Ford log-in". An older version had a log out option. Also, it seems something sticks around even after uninstalling and reinstalling as the login will still have my VIN on a new install after uninstalling.

khpylon commented 2 years ago

The "Log-out" option was remove when profiles were added, largely because I didn't see why anyone would use it. I added the "Never" refresh option in in its place so someone could just choose to manually refresh to get updates. The "Log-in" option is always visible, even when you are (supposedly) still logged in.

If you uninstall the app, Android (I believe) will wipe the /data/data folder for the app, which is where all the profile and settings information that I store reside. At least that's what I see here when I have to uninstall.

khpylon commented 2 years ago

I just push the latest version. As described on the forums, you now have the option to let the app store your FP login credentials so that, should it need to log into Ford's servers again to get a new access token, it can do so. skiingj has been running a version of this which provides more logging output, so if this version doesn't fix the problem DM me and I can send out that version to others who want to gather more data for me.

CHeil402 commented 2 years ago

This has been working without issue since storing the credentials. Only feedback would be to have the option to save them in the same screen as entering them, otherwise you kind of have to do it twice. I logged in, then checked that option, then had to re-log in to get the credentials to actually save (which makes sense) but isn't the most intuitive.

khpylon commented 2 years ago

Only feedback would be to have the option to save them in the same screen as entering them, otherwise you kind of have to do it twice. I logged in, then checked that option, then had to re-log in to get the credentials to actually save (which makes sense) but isn't the most intuitive.

Ok, that's a good point. Putting all the setting in one place is easy, but I'll look into also adding that setting to the login screen.

khpylon commented 2 years ago

So for everyone who is still having issues with the update; I noticed in the past few days (via logcat output) that two times the AlarmManager wasn't waking up the app to update. I went into the app settings and set Battery Optimization for the app to "Not optimized", meaning Android lets me bypass when the app can run. I did this yesterday afternoon and haven't noticed the problem since (yet). So as a suggestion, find on your phone how your manufacturer controls battery optimizations and turn off optimization. I think a number of you are using Samsung phones, so I'm wondering if something they do is exacerbating this problem.

skiingj commented 2 years ago

I changed mine from Optimized to Unrestricted. S21 Ultra 12

skiingj commented 2 years ago

Widget has been updating just fine now. Thanks!

khpylon commented 2 years ago

It's been a while since anyone reported any new issues, so closing this for now.