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

ios detection broken? #77

Closed
puckey opened this issue Aug 12, 2021 · 11 comments
Closed

ios detection broken? #77

puckey opened this issue Aug 12, 2021 · 11 comments
Assignees
Labels
bug Something isn't working investigation

Comments

@puckey
Copy link
Collaborator

puckey commented Aug 12, 2021

I was just testing with my iphone (xs / ios 14.6) and noticed it was returning the default tier..

Looking into things, I see the magic pixel number returned by deobfuscateAppleGPU is not 801621810 or 8016218135. Instead it is returning 80162181255.

It then defaults to the renderer that was passed in, causing it to find nothing since it is obfuscated. When deobfuscateAppleGPU fails to find a matching magic pixel, I think it should return all ipad / iphone chipsets.

i.e. something like

      const { oldChipsets, newChipsets } = deviceInfo?.isIpad
        ? {
            oldChipsets: ['apple a12x gpu'],
            newChipsets: ['apple a9x gpu', 'apple a10 gpu', 'apple a10x gpu']
          }
        : {
            oldChipsets: ['apple a9 gpu', 'apple a10 gpu'],
            newChipsets: [
              'apple a11 gpu',
              'apple a12 gpu',
              'apple a13 gpu',
              'apple a14 gpu'
            ]
          };
      renderers = (
        {
          // iPhone 11, 11 Pro, 11 Pro Max (Apple A13 GPU)
          // iPad Pro (Apple A12X GPU)
          // iPhone XS, XS Max, XR (Apple A12 GPU)
          // iPhone 8, 8 Plus (Apple A11 GPU)
          '80162181255': newChipsets,
          // iPhone SE, 6S, 6S Plus (Apple A9 GPU)
          // iPhone 7, 7 Plus (Apple A10 GPU)
          // iPad Pro (Apple A10X GPU)
          '8016218135': oldChipsets
          // eslint-disable-next-line @typescript-eslint/no-explicit-any
        } as any
      )[pixels.join('')] ?? [...newChipsets, ...oldChipsets];
@puckey
Copy link
Collaborator Author

puckey commented Aug 12, 2021

Just running through a few iOS devices to see what they return:

  • iPad Pro 12.9 2021 / iPadOS, v14.5: 80162181255
  • iPad Pro 12.9 2020 / iOS, v13.4: 801621810

(more coming soon)

@puckey
Copy link
Collaborator Author

puckey commented Aug 13, 2021

I made a spreadsheet of the results I found on the devices I can access with ios 14 & 13: https://docs.google.com/spreadsheets/d/e/2PACX-1vT3oRphnf0IzjKp-7npi6ig8PCgseGoUzMaAqaymPICY7OQrqPEZAt4wsqcMgpEKeKKLtiGAKZ7GQtJ/pubhtml

I also included the information from the screen api as suggested by @Gusted to see if we could do something with that.

@puckey
Copy link
Collaborator Author

puckey commented Aug 13, 2021

Added a pull request which:

  • includes missing chipsets that support ios >= 13
  • includes magic pixel value which points to newer chipsets
  • when magic pixel value is missing in our lookup, defaults to both newer and older models

I would still like to figure out if this new 80162181255 value is now not also being returned by older models in iso 14. 7 – in which case we might want to consider removing this magic pixel value hack altogether

@puckey
Copy link
Collaborator Author

puckey commented Aug 13, 2021

Tried my mom's old ipad air, which is running ios 12.3 - it returned 80162181161 for the magic value.. hadn't seen that one before.. it has an a7 gpu

also found that the iphone 5s returns the same magic value

@puckey
Copy link
Collaborator Author

puckey commented Aug 15, 2021

Checked an iPhone 7 on 14.7.1 and it also is returning 80162181255..

@puckey
Copy link
Collaborator Author

puckey commented Aug 15, 2021

Also updated a 7th generation iPad to 14.7.1 and it is now also returning 80162181255 - I think these results point to Apple normalizing this value between devices and we should remove this magic pixel value hack. @TimvanScherpenzeel, what do you think?

@puckey
Copy link
Collaborator Author

puckey commented Aug 16, 2021

Instead of removing the hack, we can still use it to detect ios 14.x and eliminate devices which do not support it.

Pushed some more commits:

  • with multiple results of the same resolution, pick the one with the lowest fps
  • when apple's fixing of deobfuscation is detected, eliminate all devices that do not support ios 14.x
  • export ipad benchmark data seperately allows client code simplifications
  • bump major version
  • throw when benchmark data is incompatible with library

@TimvanScherpenzeel
Copy link
Collaborator

Thanks @puckey , hopefully I will have some time later this week to review this. Would be great if @Gusted could have a look as well but don't worry if it doesn't fit your schedule 👍

@TimvanScherpenzeel TimvanScherpenzeel added bug Something isn't working investigation labels Aug 17, 2021
@Gusted
Copy link
Contributor

Gusted commented Aug 20, 2021

Would be great if @Gusted could have a look as well but don't worry if it doesn't fit your schedule +1

Just came back from a vacation, and school is starting in ~2 weeks again. So I can take some looks but I won't be able to do make a big PR or anything like that.

I had a quick look over the spreadsheet and must say that apple has done a fair job at obfuscating the relevant "detection property". Detecting the difference between iPad models will be a bit easier than between the iPhone models, the iPad models seems to have different screen size(and properly reported by the browser) which is a point that you can have them "separated" into smaller groups. Also the newest(?) iPad Pro seems to use a M1 chip which is a guarantee change in the float point precision which according to the spreadsheet seems to be true and the 2 using the M1 chip also report different screen sizes so those 2 can you already detect reliable.

A solution for the iPads will to be have the float point precision + screen sizes which will give you ~50%+ of the way there.

for the iPhones.... I always wondered why each iteration of the iPhone is such similair to the previous one, and this only just confirm it 😄. So this will need a tricky one, maybe something that can difference the behavior of apple's chips(as each iteration came with a more better etc etc apple chip) something closely related to some kind of precision, but good enough that it's notice-able between these iterations of models.

Regards,
Gusted

@puckey
Copy link
Collaborator Author

puckey commented Aug 24, 2021

@Gusted the pr is here: #78 (and we can't use the floating point precision because apple has now normalised the value across devices – but we can use that fact to eliminate all devices that do not support iOS 14.x)

@baptistebriel
Copy link

Hey there!
Just tested the example on an iMac M1, and it's returning tier: 1

{
  "gpu": "apple m1 (Apple M1)",
  "isMobile": false,
  "tier": 1,
  "type": "FALLBACK"
}

Shouldn't it be treated as a good performance device? I am also getting the same with iPhone 12 (apple gpu)
Thanks a lot for this lib anyway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working investigation
Projects
None yet
Development

No branches or pull requests

4 participants