I believe the problem is that you need to use `Privileged` instead of
`privileged`. (In Go, uppercase leading characters in field names are
exported and can be used by others, while lowercase ones are considered
private)
if ctx.AConfig().IsEnvTrue("PAX_PRI"){
>
Unless this is for temporary debugging, you probably want to use the
VendorConfig functions instead, so that it can be configured by the product
that you're building.
- Dan
On Mon, May 18, 2020 at 10:35 AM fanx lin <[email protected]> wrote:
> hi, I am buildding android Q , I want to build a app . and I want to use
> build env to control which the app installed in , I wrote a android.bp to
> build it. the key code as below:
>
> //omit
> //... ...
>
> func getPrivileged(ctx android.LoadHookContext)(bool){
> if ctx.AConfig().IsEnvTrue("PAX_PRI"){
> fmt.Println("PAX_PRI ============= true")
> return true
> }else{
> fmt.Println("PAX_PRI ============= false")
> return false
> }
> }
>
> func testDefault(ctx android.LoadHookContext){
> type props struct {
> privileged bool
> }
> p := &props{}
> p.privileged = getPrivileged(ctx)
> ctx.AppendProperties(p)
> }
>
>
> //omit
> //... ...
>
> the code above is not work,the println is ok, I can see the print, but the
> privileged
> prop is not work, then I try to change the code as below, but is still not
> work:
>
> func testDefault(ctx android.LoadHookContext){
> type props struct {
> privileged *bool
> }
> var privileged bool
> p := &props{}
> privileged = getPrivileged(ctx)
> p.privileged = &privileged
> ctx.AppendProperties(p)
> }
>
> maybe there is some error , can someone give me a hand ? thanks a lot!!
>
> --
> --
> You received this message because you are subscribed to the "Android
> Building" mailing list.
> 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-building?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Building" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-building/cc666c99-50dd-4afd-a6ba-b3d3c10ec36a%40googlegroups.com
> <https://groups.google.com/d/msgid/android-building/cc666c99-50dd-4afd-a6ba-b3d3c10ec36a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
--
You received this message because you are subscribed to the "Android Building"
mailing list.
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-building?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-building/CALQgHd%3DJuRwPPsaZut71ivSGQHZABSbD5ycAH6%3DnELD0Qcae8w%40mail.gmail.com.