khpylon / MachEWidget

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

Bug: Widget confused by unactivated vehicle, I think? #19

Closed mikebaz closed 2 years ago

mikebaz commented 2 years ago

I've added a second vehicle to my FordPass account, an F-150 that has not been activated yet, and it seems the widget is confused by this.

05/31 12:07:46 I 934TXS: updateAppWidget(): last vehicle update was 27164 minutes ago.
05/31 12:07:46 I 934TXS: updateAppWidget(): last vehicle update was 27164 minutes ago.
05/31 12:07:50 I 934TXS: updateAppWidget(): last vehicle update was 27165 minutes ago.
05/31 12:07:50 I 934TXS: updateAppWidget(): last vehicle update was 27165 minutes ago.
05/31 12:07:56 I 934TXS: StatusReceiver: next status alarm at 05/31 12:08:01
05/31 12:07:58 I 934TXS: updateAppWidget(): last vehicle update was 27165 minutes ago.
05/31 12:07:58 I 934TXS: updateAppWidget(): last vehicle update was 27165 minutes ago.
05/31 12:07:59 I 934TXS: updateAppWidget(): last vehicle update was 27165 minutes ago.
05/31 12:07:59 I 934TXS: updateAppWidget(): last vehicle update was 27165 minutes ago.
05/31 12:08:01 I 934TXS: StatusReceiver: next status alarm at 05/31 13:08:01
05/31 12:08:01 D 934TXS: StatusReceiver: time(-1,627,447), state(HAVE_TOKEN), battery optimization(false)
05/31 12:08:01 D 934TXS: need to get vehicle info
05/31 12:08:01 D 934TXS: StatusReceiver status history: Logged out(0) Log out(0) Log in(0) Updated(1,331) Vehicle Info(413) Unknown(0)
05/31 12:08:01 D OkHttp3: --> POST https://api.mps.ford.com/api/expdashboard/v1/details
05/31 12:08:01 D OkHttp3: Content-Type: application/json; charset=utf-8
05/31 12:08:01 D OkHttp3: Content-Length: 130
05/31 12:08:01 D OkHttp3: locale: en-US
05/31 12:08:01 D OkHttp3: user-agent: FordPass/5 CFNetwork/1327.0.4 Chrome/96.0.4664.110
05/31 12:08:01 D OkHttp3: auth-token: [deleted]
05/31 12:08:01 D OkHttp3: application-id: 71A3AD0A-CF46-4CCF-B473-FC7FE5BC4592
05/31 12:08:01 D OkHttp3: countrycode: USA
05/31 12:08:01 D OkHttp3: 
05/31 12:08:01 D OkHttp3: {"entityRefresh":{"userVehicles":{"If-Modified-Since":"Thu, 12 May 2022 19:33:54 GMT"}},"dashboardRefreshRequest":"EntityRefresh"}
05/31 12:08:01 D OkHttp3: --> END POST (130-byte body)
05/31 12:08:02 D OkHttp3: <-- 401 https://api.mps.ford.com/api/expdashboard/v1/details (528ms)
05/31 12:08:02 D OkHttp3: cache-control: no-cache, no-store, max-age=0, must-revalidate
05/31 12:08:02 D OkHttp3: pragma: no-cache
05/31 12:08:02 D OkHttp3: content-type: application/json
05/31 12:08:02 D OkHttp3: expires: 0
05/31 12:08:02 D OkHttp3: strict-transport-security: max-age=31536000 ; includeSubDomains
05/31 12:08:02 D OkHttp3: x-application-context: dashboard-service:cloud,prod:22
05/31 12:08:02 D OkHttp3: x-b3-spanid: 5752b0817afdaad1
05/31 12:08:02 D OkHttp3: x-b3-traceid: 1f17868cce5507fb5752b0817afdaad1
05/31 12:08:02 D OkHttp3: x-build-version: dashboard-service 0.0.1-480-g0dfd6aa
05/31 12:08:02 D OkHttp3: x-content-type-options: nosniff
05/31 12:08:02 D OkHttp3: x-frame-options: DENY
05/31 12:08:02 D OkHttp3: x-vcap-request-id: 9f44ea73-3c09-417c-75dd-03c61c12e31c
05/31 12:08:02 D OkHttp3: x-xss-protection: 1; mode=block
05/31 12:08:02 D OkHttp3: date: Tue, 31 May 2022 16:08:00 GMT
05/31 12:08:02 D OkHttp3: via: 1.1 google
05/31 12:08:02 D OkHttp3: x-from: apim
05/31 12:08:02 D OkHttp3: x-glb-version: 1.35
05/31 12:08:02 D OkHttp3: alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
05/31 12:08:02 D OkHttp3: 
05/31 12:08:02 D OkHttp3: {"requestStatus":"UNAVAILABLE","error":{"statusContext":"FIG","statusCode":200,"message":"Auth token validation failed"},"lastRequested":"Tue, 31 May 2022 16:08:01 GMT","status":200}
05/31 12:08:02 D OkHttp3: <-- END HTTP (182-byte body)
05/31 12:08:02 I 934TXS: getVehicles UNSUCCESSFUL.05/31 12:08:14 I 934TXS: updateAppWidget(): last vehicle update was 27165 minutes ago.
05/31 12:08:14 I 934TXS: updateAppWidget(): last vehicle update was 27165 minutes ago.

I'm seeing a 401 in the log, so I tried logging in again, and no change.

I realize this is a very specific edge case.

khpylon commented 2 years ago

The app does not currently automatically check for new vehicles, so you need to log in again on the app for it to request an update. It sort of looks like it did request it, though.

If you have logged in already, try wiping your data and then log in fresh.

mikebaz commented 2 years ago

ok, I did a full data and cache wipe and logged in fresh and it seems it's not confused any longer. I'll keep an eye on it and see if it continues to refresh or not - I'd like to keep the issue open for now since I don't know if it was fixed one time or not. The widget knew both vehicles were in there (I could tap in the upper left to get it to switch between them), so the underlying issue might be that it doesn't like the vehicle list changing out from underneath? Not sure.

khpylon commented 2 years ago

I'll leave it open for now. When you tap on the vehicle image, it reads all the VINs from the vehicle database and picks the "next one" after the current vehicle, so it should be OK with the change happening. From the log file you posted, it was getting the 401 because after you logged in it tried to get the list of vehicles and it failed, so was retrying. A 401 failure sounds like it didn't have the correct auth token.

mikebaz commented 2 years ago

I just realized I had deleted the truck from my account. I will re-add it tonight and see if that breaks the widget again.

mikebaz commented 2 years ago

ok, I put the truck back, things are still working. Really have no idea what was going on now, but that's okay, it's working now, I can't repro the issue so I can't tell you what to do about it either, so I'm just going to close with this comment and let you get back to doing real work. 😉