hi Dianne i found that if i share the linux user-id of my main and test application (by declaring same "sharedUserId" string), i can put the "extra test purpose permissions" in my test project's androidmanifest.xml file.
it works, my test app have the permission now. the good part is, i don't need to change the src code. is it a strange work around in your opinion? On Wednesday, June 27, 2012 8:08:08 AM UTC+8, Dianne Hackborn wrote: > > Probably not, this is pretty core to the security model. > > On Mon, Jun 25, 2012 at 10:14 PM, tiger meng <[email protected]>wrote: > >> i see. thanks. it makes sense to me. >> >> hope android project can consider my case, and design some easier to use >> mechanism for test projects in the future :) >> >> >> On Tuesday, June 26, 2012 9:56:52 AM UTC+8, Dianne Hackborn wrote: >>> >>> I assume you mean you are using test code that runs in Instrumentation, >>> so your test code is in a separate .apk from your main app. If so, then >>> yes, a service in your test .apk that your test code can connect with and >>> call to have it to the protected operations. >>> >>> On Mon, Jun 25, 2012 at 6:11 PM, tiger meng <[email protected]>wrote: >>> >>>> thx. >>>> >>>> so that the test code runs in a separate service, not in my >>>> application's process. so that i can declare uses-permission in my test >>>> project. >>>> is it what you mean? >>>> >>>> On Tuesday, June 26, 2012 8:06:37 AM UTC+8, Dianne Hackborn wrote: >>>>> >>>>> Correct, Instrumentation runs in the process of the app being tested, >>>>> so can only run with its permissions. You can't extend the app's >>>>> permissions without changing its manifest to declare them. I suppose you >>>>> could put a service in your instrumentation .apk that your >>>>> instrumentation >>>>> code can connect with from the app to execute code that needs other >>>>> permissions. >>>>> >>>>> On Mon, Jun 25, 2012 at 2:25 AM, tiger meng <[email protected]>wrote: >>>>> >>>>>> hi all, >>>>>> >>>>>> i created an Android project and a test project. >>>>>> my test cases want to access network, e.g. upload test log to my log >>>>>> server. >>>>>> my app doesn't access network, however. >>>>>> >>>>>> <uses-permission android:name="android.**permissi**on.INTERNET" /> >>>>>> so where shall i declare above <uses-permission >? in application's >>>>>> manifest or in test project's manifest? >>>>>> >>>>>> according to my test, i works only when i put it in application >>>>>> manifest. >>>>>> when i put it in test project, i got permission denial security >>>>>> exception... >>>>>> >>>>>> what shall i do? >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Android Developers" group. >>>>>> To post to this group, send email to android-developers@**googlegroup >>>>>> **s.com <[email protected]> >>>>>> To unsubscribe from this group, send email to >>>>>> android-developers+**unsubscribe**@googlegroups.com<android-developers%[email protected]> >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/**group**/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en> >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Dianne Hackborn >>>>> Android framework engineer >>>>> [email protected] >>>>> >>>>> Note: please don't send private questions to me, as I don't have time >>>>> to provide private support, and so won't reply to such e-mails. All such >>>>> questions should be posted on public forums, where I and others can see >>>>> and >>>>> answer them. >>>>> >>>>> >>>> On Tuesday, June 26, 2012 8:06:37 AM UTC+8, Dianne Hackborn wrote: >>>>> >>>>> Correct, Instrumentation runs in the process of the app being tested, >>>>> so can only run with its permissions. You can't extend the app's >>>>> permissions without changing its manifest to declare them. I suppose you >>>>> could put a service in your instrumentation .apk that your >>>>> instrumentation >>>>> code can connect with from the app to execute code that needs other >>>>> permissions. >>>>> >>>>> On Mon, Jun 25, 2012 at 2:25 AM, tiger meng <[email protected]>wrote: >>>>> >>>>>> hi all, >>>>>> >>>>>> i created an Android project and a test project. >>>>>> my test cases want to access network, e.g. upload test log to my log >>>>>> server. >>>>>> my app doesn't access network, however. >>>>>> >>>>>> <uses-permission android:name="android.**permissi**on.INTERNET" /> >>>>>> so where shall i declare above <uses-permission >? in application's >>>>>> manifest or in test project's manifest? >>>>>> >>>>>> according to my test, i works only when i put it in application >>>>>> manifest. >>>>>> when i put it in test project, i got permission denial security >>>>>> exception... >>>>>> >>>>>> what shall i do? >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Android Developers" group. >>>>>> To post to this group, send email to android-developers@**googlegroup >>>>>> **s.com <[email protected]> >>>>>> To unsubscribe from this group, send email to >>>>>> android-developers+**unsubscribe**@googlegroups.com<android-developers%[email protected]> >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/**group**/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en> >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Dianne Hackborn >>>>> Android framework engineer >>>>> [email protected] >>>>> >>>>> Note: please don't send private questions to me, as I don't have time >>>>> to provide private support, and so won't reply to such e-mails. All such >>>>> questions should be posted on public forums, where I and others can see >>>>> and >>>>> answer them. >>>>> >>>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Android Developers" group. >>>> To post to this group, send email to android-developers@** >>>> googlegroups.com <[email protected]> >>>> To unsubscribe from this group, send email to >>>> android-developers+**[email protected]<android-developers%[email protected]> >>>> For more options, visit this group at >>>> http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en> >>>> >>> >>> >>> >>> -- >>> Dianne Hackborn >>> Android framework engineer >>> [email protected] >>> >>> Note: please don't send private questions to me, as I don't have time to >>> provide private support, and so won't reply to such e-mails. All such >>> questions should be posted on public forums, where I and others can see and >>> answer them. >>> >>> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> > > > > -- > Dianne Hackborn > Android framework engineer > [email protected] > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

