Home,Lock,Volume buttons

Discussion in 'iOS Programming' started by DennisBlah, Apr 22, 2014.

  1. DennisBlah macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #1
    Hi all,
    as most of you guys know I am working on an inhouse application for functional testing the iPhones iPods and iPads.

    For iPhones, I would like to disable these buttons, so I can trigger an counter on the button press. (I want to press the buttons 5 times, and then make an boolean that the button is correct)

    Is it possible to disable these buttons on a certain View, so that when I come to the point of button test, that the app does not go into background, and screen gets locked??

    I know it's possible, I have seen this before, but I have no idea how.

    For now I'm checking the applicationDidEnterBackground in appDelegate and comparing the brightness for determining if the home button or lock button is pressed.

    Is this possible with some private headers and does anyone knows how ?
     
  2. Tander macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
    #2
    Without jailbreaking the device overriding hardware buttons is just not possible. Also detecting that Home button was pressed is also not really possible. You could still use the app delegate to detect when its in a background state. But, there are more ways than just the home button to get an app into that state.
     
  3. DennisBlah thread starter macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #3
    Yes it is possible. There is an app made in UK for the same kind of testing.
    This app actually disables all hardware buttons at the 'button test view'.

    Once you finished the test, the buttons will be back working like they should.
     
  4. dantastic macrumors 6502

    dantastic

    Joined:
    Jan 21, 2011
    #4
    Post a link to the app so
     
  5. DennisBlah thread starter macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #5
    That app is also an inhouse distributed app so unfortunally I don't have an link.
    I could share the .ipa file with you if that would be of any help
     
  6. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #6
    Chances are they're using private frameworks which Apple wouldn't permit the usage of in an app distributed through the App Store. Most people here develop apps which are distributed through the App Store here, so we're not very familiar with those private frameworks. Your best bet would be asking on a forum dedicated to making software for jail broken iOS development (I've gotten good answers to these kinds of questions on Stack Overflow before).
     
  7. DennisBlah thread starter macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #7
    Thanks ArtOfWarfare I'm gonna take a look if I could get some more help over there about this part.
     
  8. Tander macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
    #8
    This is also true. I didn't think of the private APIs. You're also correct that if we were to use such methods, the app would definitely not make it into the store. I can see why it would work just fine for in-house distribution, where if I am not mistaken, Apple don't check the quality / apis etc that it uses.
     
  9. DennisBlah thread starter macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #9
    exactly, and like I said it's for inhouse development to do an functional test of the devices.

    I still haven't figured any private framework for this stuff. I'm hoping someone can help around because I'm really stuck with this.

    If this we can get this to work, the app will manage to lower the time to produce each device by maybe 20 seconds times ~ 500 devices times ~ 300 users a day :)
     
  10. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #10
    Have you tried contacting the developer of that other app that you know can do it?
     
  11. DennisBlah thread starter macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #11
    It's from Apple so I doubt they will share some coding info about it :eek:

    Basicly I'm working on this for a while, and also Apple was ehm amused about what we are trying to do over here in the NL.

    A new project with a new production line is having a same kind of app which Im working on, and this one does disable the buttons so you can test them.

    But, it does not meets the requirements I'm working on. I am saving test results with any fail codes into the app. So with iFuse I can read out the test results and insert it into my OSX app to automize the escalation of the problems. I will try and contact the developer tho. I hope he's willing to help out, I'll credit him :)
     
  12. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #12
    That's an important detail that you shouldn't have left out until now. Apple has access to all sorts of private APIs that are undocumented and undiscovered. And I doubt they will be forthcoming for the ones that you might need. I suspect without being very lucky to be able to discover those private API calls, you'll make no progress in this area.
     
  13. DennisBlah thread starter macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #13
    Well our costumor is Apple and I got apple u.s. software director in my contactlist and some managers. I hope they gonna help me out. If so I willing to share about the framework with you guys.

    Lets hope for the best
     
  14. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #14
    So, you're writing an app to do functional testing for Apple and you know it's possible because Apple in the UK already wrote a similar app? I'm confused.

    :confused:
     
  15. DennisBlah thread starter macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #15
    I'll explain a little. I work in the Apple Repair and DC in Netherlands.
    The workflow is as followed: Phone's come in. Going through 'intake' and will be booked into SAP systems. This part we already automized through filemaker and applescript. After that they go to download and restore. They will be manually tested on costumers known issue's and general functionality.
    Each problem has its own failure code. Which gets escalated into an apple system (web based). Most of the part I already automized in an osx app. But, we would like to get test results out of the phone automaticly.

    Therefor I'm making an functional testing app. Due loads of work I didn't had much time for it. Apple been over here for demo's and such.

    Meanwhile we started an new project in a new building with Pegatron (manufacture of iPhone 5C and some other). An developer of them in UK is also building same kind of app. Which does almost exactly same as what we need in this building. However it's missing tests and does not store any error codes. (Error codes which we need to fill in into webbased environment).

    In my app, when a test fails the user has to choose one of the problems, which has its own failure code.

    The other app, does not store these failure codes and this one does overrides the hardware button functions. Which I would like to do aswell (for a long time already) because it just saves a lot of time since for now I'm only been able to make a workaround with checking screen brightness when the app goes to background and back to foreground.

    I hope I could make you less confused about it at the moment. I just wrote an mail to Apple Developer manager U.S. for some info about this.

    I'll keep you guys updated when I get to know something about this.

    Cheers!
     
  16. DennisBlah thread starter macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #16
    Unfortunately Apple won't support us with any kind of the private api's.
    These api's are strictly only for the Apple Diagnostics Team...

    Too bad, I hope someone can find it out!
     
  17. Dranix macrumors 6502a

    Dranix

    Joined:
    Feb 26, 2011
    Location:
    Gelnhausen, Germany
    #17
    You shouldn'T fight the policies of your own employer - seldom wise to do so.
     
  18. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #18
    Well, I believe with lots of determination and a little luck it might be possible for you yourself to "reverse engineer" and perhaps discover the private APIs that you are looking for. I'm not at all familiar with the tools and techniques but I do remember having come across a few sites / forum posts that discuss the topic, For example, I found this SO thread in a quick search for "ios sdk how to discover private apis": http://stackoverflow.com/questions/2838656/how-to-use-iphone-sdk-private-apis
     
  19. DennisBlah thread starter macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #19
    Hey all,

    after searching and asking at apple I got 1 tip and that's all they wanted to tell me.

    It has to do with hooking the GSEvents and look for eventtype 1000, 1001, 1006, 1007, 1010, 1011, 1012, 1013
    that should be home volume up, volume down, lock and mute buttons

    Is there anyone having experience with GSEvents and how to hook them up and replace the original called function?
     
  20. Dranix macrumors 6502a

    Dranix

    Joined:
    Feb 26, 2011
    Location:
    Gelnhausen, Germany
    #20
    I don't get it. Why are you trying so hard to do it after getting told by your employer that it is not wanted?
     
  21. DennisBlah thread starter macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #21
    Ehm yes I think you don't get it.
    Im working for Apple DC in Netherlands. I'm here to automize as much as possible. And the functional testing app is already aproved by apple.

    However the new project we are working on, there is someone that also made similar kind of app but for specific things, not just the whole functional screening of an iphone.

    Apple don't say they don't want me to do it. But they say they don't want to share the knowledge of the private api's because they are for 'apple diagnostics'. It's like... they want to keep their job safe.
    They will not support any of the private api's neither with me, while I'm trying to make their production more faster preciser and stuff.

    I'm not an inside apple developer. Thats the reason why they don't share it with me. But they gave me the hints. But won't tell me more.
     
  22. Dranix macrumors 6502a

    Dranix

    Joined:
    Feb 26, 2011
    Location:
    Gelnhausen, Germany
    #22
    Well for me that spells pretty clearly: don't do this.

    But ok, was just curious...
     
  23. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #23
    Can you tell us more about this "Apple DC"? What is it and what do they do there? Does it have a website? Since it doesn't seem to be a subdivision of Apple, Inc., I'm curious as to how it fits in this picture.

    You're trying to make Apple's production faster and more precise? That sounds rather ambitious.
     
  24. DennisBlah thread starter macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #24
    It's always nice to get some interests for the work location where I'm working at the moment.

    In this DC we receive almpost all iPhone's and iPads meant for NL and a lot for the reset of europe. New ones to be shipped, but also damaged or devices that seems to have problems.

    I'm talking about the process about the devices with problems. They come in, the first line unpacks and stores them into our DB, storing imei, serial, and mlb serial with a program I made since the program we got from Apple slows the machine down on longer term. And is not able to send devices to recovery mode to be able to read out at least the serial number (Apple is amused and want me to make it so they can use it for UK and Japan mainly), it's also been used in the next step so people don't hurt their fingers anymore ;) Basically the devices been received and checked visually. Then it gets restored all clean and up to date. Then a functional test to reproduce customers reported error. And repaired.
    For this part I'm making this functional test application. And is why I need to disable these buttons so can test them without any delay by sending app to background and locking device. For now I worked around it but if you read further you'll see that it is possible.

    Our new project is at the other side of the road there will be special repairs where I may not speak about. It's in corporation with an other company. This company has an functional screening app which includes a lot of my app, but not all. This app is able to disable the home and lock button when it comes to the button test.

    Intrigued by this I been doing a background check and everywhere I look and search I find:
    No it's not possible.
    You should not do it.
    Appstore will block it.
    It will only work on jailbroken devices.
    Why would you want this!?

    However it is possible without jailbreaking the device because we don't jailbraik them ;)
    But it's made by Apple Diagnostics team and they are not willing to share with me. (Which I understand ofcourse, but it's for their own process)

    So again, I'm looking for someone that has experience with this gsevent hooking the buttons and override the original function.

    I been making a opengl hook a few years ago for cheating in a FPS. I think it should be almost same like that. Load up the library and functions, call your own functions and (normally in the opengl hooks and stuff) call the original function after, which I don't want.
     
  25. xArtx macrumors 6502a

    Joined:
    Mar 30, 2012
    #25
    Most of the jailbreak programmers would still be using the same XCode.
    I think they only have to modify something to get it to fake sign the compiled App.

    If you can find a reference to function you mentioned, it would be interesting.
    I thought it would be some part of UIkit but I guess not.

    I don't think you could see the memory from the sandbox at run time.
    App Store App doesn't really have to know anything other than the volume changed, App was suspended, etc.
     

Share This Page