As for the retarded upgrading on device #2, what I can say is that the code just send an intent to the OS, which in turn asks the user to allow the installation of the new apk and (on positive) response broadcasts the "android.intent.action.PACKAGE_REPLACED" intent whose action is to wake up any app on the device which has it in the Manifest. Reading the content of the data in this latter intent, service newinst2 (in the library) knows that it's its turn to execute (we're now on the new apk) and launches Main.
Why all that doesn't happen a few seconds after pressing the "1" button but only closing the running app and starting it again, I don't know. Maybe you can try to give the OS more time after pressing the "1" button and see if it completes the loop described above.