I'm working with the IEA and I would like to welcome our speakers, the panel who is sitting here, but I also would like to welcome you, our audience and also our digital audience, because we are live streaming this event. This is an event about climate change, adaptation, an event about science, an event about how we can connect better climate science to climate action. We need good science if we want to do good adaptation, and this is what we would like to talk about here in this event. It's my honor to introduce to you the speakers of our event, Director General of the IEA, Mr. Rafael Mariano Grossi, welcome. We have the Secretary General of the WMO, Professor Peteri Talas, welcome. We have the DEG of the FAO, Ms. Maria Helena Semedo, welcome. We have the Vice President of the World Bank, Mr. Jürgen Fergele, welcome. We have from UNESCO, Mr. Anil Mishra, Section Chief, and we also have as a special guest joining us a little bit later, Mr. Peter Thompson, who is the Special Envoy for the Ocean of the Secretary General. Mr. Thompson is right now at another event and he will come and join us a little bit later. Also, for you to know some of our speakers, they have also other commitments and they have to leave earlier, and so I beg for your understanding of this situation. With this, I would like to invite our DEG, Mr. Rafael Mariano Grossi, for his opening remarks. Please, DEG. Okay, thank you very much, Wei, for that. And Martin, thank you very much. As you said just now, this is a very busy morning and it's a good thing because it means that we are interacting a lot, that we are from the perspectives of our respective institutions being present here and trying to explain the ways we do and how we try to collaborate in providing the answers and the solutions that are needed. We wanted from the IEA to be able to showcase these partnerships which have different configurations and forms depending on the institutions we are talking about. So first of all, like you, I would like to say thanks to all our friends here from the World Bank, from UNESCO, from WMO and of course from FAO, who are partners in different ways with the IEA. What we want is to give examples and show and explain how and in which ways we are using science for climate adaptation, which is important and what is the added value of having nuclear. They do many other things and the World Bank facilitates everything but from the scientific perspectives of FAO, WMO, UNESCO, we are bringing our distinct contributions in these areas. Since this is the nuclear pavilion, what we want to say is that with the use of nuclear techniques and applications, there are many things that are ongoing when it comes to the meteorological planning, prospecting, analysing and we are trying to support and benefitting from the support of WMO. FAO, apart from being our neighbour across the isle, is also a very close and historical partner for the IEA. Many ignore that from 1964, the IEA and the FAO or the FAO and the IEA have been working together. We have a joint centre, used to be a joint division, so where our scientists are working together underpinning projects that we have in Africa and Latin America, in Asia, which are very, very closely connected with adaptations through our plant breeding techniques, through our food security projects. And I think Maria Elena is going to be addressing those briefly. UNESCO as well, we are very active in the Sahel region, in many parts of the world, where we are trying to work with them. But I think they are going to be able to explain this in their own way. And this is why I am very happy, so happy, that we can have this opportunity here in Charm to also explain these things that go perhaps too often unnoticed by the bigger audiences. So I would like to start with Peteri. Peteri, we were having already interactions before during this COP, but on a wider perspective, your explanation of, of course, WMO is an indispensable instrument in general, when we talk about the problems of climate change and global warming. And our collaboration is but a factor in that wider equation, but your explanation about this I think would be greatly appreciated for those who are looking into the nexus between nuclear science and meteorological science. Thank you, Rafael, and thanks for the invitation to attend this important event. And we are also a scientific and technical organization as is an atomic energy agency of UN. And we were having a couple of days ago, one panel here where we talked about climate mitigation and from our side we see nuclear energy as an important part of mitigation solution. So without nuclear energy we may have difficulties in reaching the Paris targets. That's very clear. But here we are talking about adaptation as well. And from the outside we have just published reports on the status of climate and also water resources where we demonstrated that we have again broken records in main greenhouse gases, carbon dioxide, methane and nitrogen oxide. And so far this year we have already exceeded the emissions of 2019, which was before the pandemic. So far we are not moving the right direction and energy sector is of course very important sector in helping to improve the situation. We have seen always some improvement. We are no more heading towards 3 to 5 degrees warming, which was the message of IPCC report in 2014. 32 countries have already reduced their emissions quite a bit during the past 15 years and progress is made and we are having growing amount of technological means to be successful in climate mitigation. And adaptation is of course very important because the negative trend in weather patterns will continue until 2060s, meaning growing amount of heat waves, flooding, drought and tropical storm challenges. And the melting of glaciers and sea level rise will continue for the coming hundreds of years. That game we have already lost because of already high concentration of carbon dioxide. And it's important that we also use the energy resources in a wise manner and the meteorological and hydrological services, they are providing services which help to optimize energy fleets. And here on the wall you can see typical set of various sources of energy and at the moment 85% of the energy consumption is related to fossils and 15% only on nuclear hydro and renewables. And the amount of renewables and nuclear is supposed to grow and how to get the best out of such fleet. You need to have meteorological services to estimate what's going to happen to solar, wind, hydro availability and also the energy demand in general. And advanced meteorological services, they are having such services in place and they also can forecast the impacts of weather events on energy sector which is something that we would like to promote in all of our member countries. Only half of our members have proper services in place and our challenge is to improve the situation in less developed countries. And I was happy to hear that for example here in Africa 40% of the energy is already produced by using renewable energy and some countries also considering building more nuclear energy. And again here you would need modern services to optimize the use of such fleet. Then we know that climate change is also having impact on energy production, especially these heat waves and drought events that we have seen in China, Europe, parts of Africa and parts of USA. They have had an impact on availability of cooling power and cooling water. And in the future we will anyhow see growing amount of heat waves, drought and flooding and that means that it's going to affect also energy production, especially nuclear and fossil-based energy production. And that's something that has to be taken into account in planning of the new fleet and sustainable operation of those. So that's all from my side. Thank you. Thank you very much Peteri. And especially since you are putting some things into perspective when it comes to the assessments that WMO is coming to in terms of the evolution and the trends we are of course used to a very bleak outlook of things and of course the hour is very serious and great but WMO is allowing us to bring some perspective into things and how they are really evolving. So I want to thank you for that. Elena, FAO and IEA is a long story but the challenges are very different from those that our predecessors had back in the 60s when these collaborations started. Can we hear from you as to what is your take on what is happening? What are the biggest challenges now? How are we working together to get our heads and arms around those? Thank you so much Mr. Grossi. Thank you all for being here today and esteemed panelists. I am very happy to be here on behalf of the Food and Agriculture Organization. As it has been said, we have cooperation lasting for 56 years. You can see how long you have been working together but the world when we started 56 years ago is not the same where we are now and particularly when it refers to food and agriculture. What is the challenge we have now? We need to feed 10 billion people by 2050. Our natural resources are no longer sustainable the way we are producing, the way we are transforming, the way we are consuming. And if we keep doing business as usual, we cannot feed the population. And today we have more than 800 million people hungry and we have 3 billion not having a healthy diet. That's where science and innovation have a role to play. How we can find food systems that are more sustainable, that are more efficient and can provide healthy diets conserving the planet, the people and also bringing growth and economic perspective. And we, FAO and IEA, we work on these agri-food systems because I'm not talking about only food. It's the complexity of those agri-food systems where we work together to find solutions and also maybe to remind you that agriculture and food contribute to one-third of the greenhouse gas emissions. And this is where we need to find sound, techniques and innovation but based on the ground. It has to be problem solving if I may use this word. But at the same time, it's not only science. We need to have legislation. We need to have finance and I think this is why the word bank is here. We need to have social institution. But when we talk about innovation, we need to take into consideration the local and indigenous knowledge because they are also innovation. And how we integrate those knowledge in work we do is also important in a way that can be scaled up and then can be socially accepted because the social part of the acceptance of a technology is also an important part when we bring new technologies, new ideas in the ground. But just to come with some examples to you. We work with isotopes. We have an example in Nigeria where we use isotope techniques in Cancamba. We increase the yield by 1.5 and at the same time we save 70% of the water use. You can imagine we increase productivity, we increase efficiency and we increase the profits. And this is what we need to take to bring technology for something. It's very nice to invest in technology. But how the farmers can have more profit and how we can better use our resources. But just to give you an example, I mentioned it yesterday but I'm so excited with this example. The two of us, we send seeds to the international space. Why we send those seeds to the international space? Because we want to develop crops that are adapt to the climate in the earth and want them to breed in the space. Imagine the results of this breeding in the space. How many smallholder farmers can be bringing benefits, can be out of food security and can be adapting to the climate change. This is what we want. I cannot tell you the results but we hope that we'll be successful and we'll be able to scale up what we have done together. But also we need policies, we need investment and we need more cooperation. We have some laboratories. What we do is bringing, is coming from laboratories. We work on plant health, animal health, on food safety and we need all of you to join this cooperation in a way that we can be more grounded. And we work with the counties. We have 400 researchers from all around the world working with us in our station and our projects. And this is what we want to take forward this cooperation which has been successful. But we want other donors to join us and I'm looking to my friend from the World Bank how we can really strengthen the cooperation in financing our joint center. Thank you. Thank you very much, Marilena. Thank you for that testimony which is very important. We are very excited about our space project which is very well grounded I would say. And thank you for having spent time with us. I know that you have other obligations now and I would like to thank you for being here with us. Thank you very much. Well at the same time as we continue I note that the special envoy for the ocean Peter Thompson has just joined us. Welcome, Peter. I would like to say as you take your seat thank you for being here with us because you have been working with us on something which is also very important and has to do with the protection of the oceans the protection of the marine environment also through the use of isotope hydrology and other techniques that we are putting to good use. Many ignore that we have a set of laboratories in Monaco and in other places that are very actively working to combat ocean acidification and many of the problems that you are dealing with. More recently we have joined forces in one important project that the IAEA is working on the elimination of plastics and microplastics from the oceans by first the identification of the nature of the problem through isotopic tracers which can tell us exactly the amount and the type of plastic, microplastic and nanoplastic not only in the seas but also in fish and marine sediments so we know the dimension of the problem and later in the chain by using irradiation techniques to recycle plastic in an environmentally friendlier way than using chemical solvents. So I would like to thank you for that because you have been joining us on a number of roundtables that we had with every region of the world but this has always been mediated by screens and laptops and today we are personally meeting finally and I'm very happy for that. So your words, your testimony as to what you are doing in your efforts and together with us would be precious for us today. Thank you very much for being here with us. Thank you very much and thank you for the invitation to be here. I seem to be caught up in science today because I've just come from an IOC event and I have to, after saying my words here, move on to an ocean acidification event at the Canadian Pavilion. So it's science, science, science which is as it should be because what we are doing in our ocean action programs around the world is all based on good ocean science and in saying that we recognize that ocean science is probably only about 20% of the way there. That's the reason for the UN Decade of Ocean Science being inaugurated last year, running through to 2030. Best estimates, we know probably about 20% of the scientific properties of the ocean. So the challenge ahead in this decade is what does the other 80% can involve? And if you go out into the deep sea and you put a bucket down into the depths, you're most likely going to discover a new form of life when that bucket comes up, when you put it under a microscope. That's the extent of our ignorance about what's out there in the ocean. We know more about the moon than we do about the deep sea. So that all has to change and it has to be based on ocean science. Why science? Because we're going to have some very, very big decisions to make about our place on this planet when we get to about 2030. Geoengineering and all these things. And we cannot continue to do so on the basis of ignorance of only knowing 20%. And when you think about the ocean, the great majority of this planet is made up of the H2O in the ocean, the great majority of the living space. So that's a real deficiency on our part as the dominant species on this planet. And we've got to get that right. And we've got to get it right in a way that puts us back into balance with nature. Why are we doing what we're doing? We're doing what we're doing because science has told us that we're heading towards disaster. And that's not an exaggeration, Secretary General of the United Nations. You know, not a guy on a soapbox on the corner of Hyde Park, but arguably the leader of humanity. He has made it very clear that we are taking our children to an unlivable world. I repeat, an unlivable world. A world in which human beings cannot live. Agriculture has collapsed at three degrees. And that is where we're heading at the moment. And I describe it as a highway to hell that we're all on. We're very comfortably with, unfortunately, still this overweening sense of entitlement that Homo sapiens has, heading down this highway to hell, which is what three degrees actually is. Now the good news is, and again, this is where we rely on science, that at 1.5 degrees we can maintain our agricultural systems. We will still have functioning ocean ecosystems the way we need them to be. So the obvious, obvious thing ahead of us is taking the turn off to the 1.5 degrees. Now it's a rocky road. It's a narrow road. We have to make big transformations. We have to get out of our Cadillacs and get into something that is more appropriate. Maybe we need to just walk that rocky road. But we've got to do that because we love our children. We love our grandchildren. And we're not going to take them to this unlivable world of three degrees. So in all of this we have to depend on good scientific information.  So we have to be able to base everything on good science. And that's why I'm so proud of the work that IAEA is doing. I've been to the labs in Monaco many times to look at the work they're doing on things like toxicity in the ocean from heavy metals and so on. The work that they're doing on acidification and of course, for me, coming from the Pacific islands, the work that they're doing on global warming and on microplastics is really important for us all. Look, the news is not all bad. 2022 has been a pretty good year for the ocean. If you think back to Nairobi in February and the agreement to start negotiations, which we hope will conclude by next year for a binding international treaty to control plastic pollution, to get that plague of plastic pollution under control. So that was a big step forward. And then in Geneva in June, the decision after 20 years of negotiation of the WTO to ban harmful fisheries subsidies. That is major. There's 20 to 30 billion dollars of public funds that we have been spending for mainly the enjoyment of industrial fishing fleets to go out and deplete the ocean, to chase diminishing stocks of fish in the ocean. I mean, again, that's just homo sapiens madness. And then coming back to a climate change, we had this year the first of the ocean climate change dialogues held in Bonn, and that's leading on to better things as well. But in all of this, folks, I really want to online the place of science. We as the people at the front line battling for the ocean's health cannot fight our fight with integrity unless we have the good science behind us. So we thank those of you that are working in the field. Thank you. Thank you very much, Peter. And thank you for your efforts. We are part of that. We are trying to support you in that. We're there in Lisbon as well earlier in the year. An important ocean conference. But the effort continues. And as we can see from these conversations that we are having, this is about getting together and bringing together perspectives from different angles. And of course, the protection of the ocean is essential. And earlier we were hearing from Maria Elena about the work on food and agriculture. And we see all these efforts luckily and happily. I think we are talking to each other. We are working. But perhaps, Jürgen, the World Bank is the perspective that captures all the efforts. You and President Malpas with whom I have been interacting on these things are very dynamically trying to be present energizing these efforts in an articulated, hopefully articulated way. So your vantage point on this is, of course, indispensable at this very serious hour so that we avoid this highway to hell that Peter was describing to us so telling me. So we can hear from you. Well, thank you first of all for having the World Bank here at this event. And let me start by thanking you personally. For thanking you personally what you and your team are doing to preventing us from nuclear disaster. Just wanted to point this out. We wouldn't be here talking to each other if it wasn't for science. We wouldn't have a PCC. We wouldn't have a COP on climate. That is to be very clear because none of us observe the sea level rise. None of us watch a glacier melt. None of us know what's happening in the desert. This is what scientists tell us. We owe them everything to get us to this point. I think we need to be very, very clear about that. Without the science, there is no political compromise. There's no solutions coming along. So we need to continue to support the science. And with that, I'll come to the oceans in a minute and we need to get into policies in a much bigger way. From the FIO, we heard that agriculture is under threat. Let me be a little bit more dramatic than that. If we don't find ways to very rapidly breed varieties that can survive what's coming at us and what's coming at the farmers, particularly the poorer farmers in the drier areas of this planet, we will have 2 billion people that will be a threat. Let's be very clear about that. So we need to ramp up our investment in science much more than we have in the past. I happen to chair an organization that's called the CGIR. The Consultative Group on International Agriculture Research. It's the largest science group that does agriculture research. It's 12,000 scientists around the world. It has a billion dollar budget. They very rapidly need to have a 2 or 3 billion dollar budget. Because it has to happen much faster historically. Historically it takes 15 years for a new variety to make it to the farmer. 15 years. We don't have 15 years. We don't. We need to accelerate the research. We need to invest in new technology that gets us to accelerate these outcomes. So investing in science not only listening to the scientists but enabling them to do their work for us is absolutely critical. We are one of the co-founders behind. Then we have the farmers of this world. They are getting hit left, right and center as we speak. She gave it a number of 800 million people who are not getting a meal on the table every day. This is going to increase dramatically. And a lot of those folks are actually farmers themselves unfortunately. And the smallholder farmers of this world need to have investments that enable them to adapt. So we at the World Bank about a year ago financed dramatically which we have but not only that, we will always maintain 50% for mitigation and 50% for adaptation. Because overall the amount of funding for climate that goes into adaptation is miniscule even compared to the mitigation of finance. So last year alone we did 32 billion dollars of climate finance so about half of that 16 billion went into adaptation across the board. Food systems, what have you. Transport against floods, a lot of coastal projects protect against sea level rise, etc. So we are crystal clear about this and this is not an incremental ramp up that we are doing, it's actually a game changer. I was the director of agriculture 10 years ago at the World Bank and our agriculture portfolio was about one and a half billion dollars per year. In the next 15 months not years, in the next 15 months we will do 30 billion dollars of agriculture and food systems support for our poorest countries around the world. So this is a significant step change. We need to do more of it and we need to do it differently. And we can only do this in partnership so that's why I'm so grateful to you to invite the World Bank and everybody else here. This is too big for any of us. We need to collaborate, we need to find ways to scale up what we are all doing. Several of you have talked about pilots. There are lots of good pilots in the world. Everywhere in every sector, well it's the oceans we know what needs to be done. We don't need to invent what needs to be done but we need to scale it. We need to really put significant resources behind it. And that gives me back to what Peter was saying.  I was talking during Gosey about this just a couple of days ago and I think it's huge. If that can happen, that is a huge step forward. But it's only a piece of it. The total agricultural subsidies around the world per year are 670 billion dollars per year. That's three quarters of a trillion dollars that governments around the world today every year are giving to farmers to support them but they support them in a way that neither helps with adaptation nor does it help with mitigation. It doesn't support climate smart agriculture. It supports other things. Maybe 10% roughly is actually in the direction there it needs to go. So repurposing these subsidies and making them investments in adaptation and mitigation is key. And when people go around, my God, we have a debt crisis, we have high inflation, the economy is stalling, we have the Ukraine war, we have Covid and there is no money. I'm looking them in the eye and I'm asking what are you talking about? You're spending 670 billion dollars out of your scarce fiscal resources every year and you're saying there's no money. There is money. There is public resources. But they're not being used in the right way. So when it comes to policies that are something we do at the World Bank more and more aggressively is to point these things out and really say okay, let's sit at the table. We can support, we can put a few billion in, others can support, private sector will do its part. But you government also have to do your part. And you need to, everything you do in your budget has to be climate smart. You cannot spend a dollar without thinking about is this helping or is this a part of the problem? And this is only now beginning to penetrate into politicians' heads. But this will become a huge part of the discussion going forward. So partnerships finance the science but put policies in place that really make a difference. That is my message to you. People talk about it but they don't really act on it. You need to understand that 670 billion dollars per year is more than all overseas development aid combined worldwide. So I wanted to leave you with that message. Thanks a lot. Thank you very much. You are going to understand Peter. You also have another event to attend. So thank you very much for spending some time with us this morning. Thank you very much. I thank you again because for what you say and we know that the unique position of the bank allows you to have an overview of what's going on. It's about awareness. Awareness of the partnerships that are needed awareness of the consequences of what we do and the projects we carry out and this is the enlightened partnership that we need in this time. So I think this is an excellent segue to the scientific and cultural organization in the family in the UN family to hear more what you yourselves are doing in this global fight and also since we are in the nuclear pavilion the things that IAEA and UNESCO are doing in many parts of the world. So Mr. please close yours. Maybe you can use this microphone. Thank you very much. First of all, thank you Mr. on behalf of UNESCO's director general, I would like to thank IAEA for inviting UNESCO to this very important event, Global Accent for Climate Adaptation Science for the Future. I would like to congratulate actually IAEA this event is a contribution to International Year of Basic Science for Sustainable Development which is proclaimed by United Nations. So this is one of the mildest and when the International Year was launched, president of General Assembly said science for sustainability, solidarity and solution oriented. And I just want to refer the vice president just said we would not be here if there was no IPCC and in that context UNESCO is putting its effort to identify science based validation processes for water. You know next year United Nations is organizing after 46 years UN conference and we circulated a draft calling for a science based assessment kind of IPCC and IAEA is already looking at this we are hoping to have our joint effort so that science based assessment will be recognized and we can say that we have a science based assessment for the water. Program that we can talk about many other solutions I would like to remind also there was a program joint program between UNESCO and IAEA, isotope hydrology I happen to study isotope hydrology in my academic career so we really need to look at the future of isotope hydrology. I just want to refer a report recently UNESCO launched old glacial heritage only last week we launched which says by 2050 if we are not in a path of 1.5 degree those iconic glacial heritage those cultural heritage will be gone. We cannot monitor in many of the high mountain areas there are no monitoring system but isotope tracer can really identify the core of the ice so we really need to invest in science and I really support that idea the other thing this year UNESCO launched its ninth phase of intergovernmental hydrological program which called for science for a water secure world in a changing environment and we call upon UNESCO WMOFA of course World Bank to work for the better understanding of the science of hydrology, science of water sources water is the victim of climate change and water connects all 17 goals so we really need to put emphasis on science for hydrology but also in many other things. UNESCO scientific educational cultural organization so it promotes science for cultural protections for education so that's there are a number of areas that we can find partnership and as president of the General Assembly said we need to we need to put science for solidarity and solution oriented so I think there are lots of opportunities we can collaborate we have already circulated the idea of a science based assessment and I would like to call upon to receive your input so that we can submit to united nation so that at one day we will have a science based assessment report of periodical review not only scenarios but solution oriented maybe countries need to also report on their determined contributions so these are the areas I see as a potential partnership but also with the World Bank and many other partners thank you very much. Thank you for that the work of UNESCO of course is huge and widely recognized we have this great opportunity to join forces in this particular area and in a few others as well in the protection of cultural patrimony as well where we use nuclear techniques as well so this conversation was about exactly this how to put together different approaches in all these areas and how to do it in an efficient way in an efficient way and this is needed the World Bank here guiding us, helping us to put these efforts to scale for us at the IEA first cop at which we have a nuclear pavilion I think it's a reflection also of the way we are seeing ourselves of course in the area of mitigation and the pie chart there is important to indicate that in this global effort nuclear has a place at the table but also in this very crucial effort to put science at the service of the right solutions we need to take we hope that when we get together again in COP28 some of the things we discussed today will be the way to fruition and we have been discussing with the World Bank, with UNESCO of course with Peter, FAO Petri and many others how to do that so once again thanks for coming to the nuclear pavilion this morning, spending some of your precious time in this very hectic hours that we have together in Sharmer's sake, thank you very very much and thank you to the panelists I would like to draw your attention to two more things one is we have a new publication that describes what the IA is doing with nuclear technologies on climate adaptation in Africa in Africa because the African continent is particularly vulnerable to climatic changes and secondly we have also a video which we will play right now after this event a video that shows efforts in Kenya on climate smart agriculture and water resources and what can be done with nuclear science and nuclear technologies thank you again when we cook our food at home we never stop to think where this food in our hands has come from My name is Amel Konkirwa I am a farmer in Kenya for the last 10 years it is now 13 months ago during plant season we don't have another way but the rain comes at the wrong time when we are almost at the same time Climate change has brought great challenges in wheat production new diseases have appeared which we are not used to and also the water availability of the rain has become a challenge because it is less and it comes at the wrong time took up the challenge and decided to apply nuclear techniques to develop a new strain of wheat that is drought tolerant and that can withstand the new types of diseases although it took us about three and a half years we were able to identify that was resistant to the new races of stem rust and it was also tolerant to drought the demand for the seed is unsation we are not able to satisfy the demand for the seed by the farmers I foresee that in the medium term most of the land that is planted will be this far but the farmers do not just have good seed this good seed must grow on good soil and they must have sufficient water my job here is to find out the best planting technique that can be adopted by farmers in water-limited conditions we are using the nuclear technique to evaluate different planting technologies that can be adopted by different farmers we are able to know that the water is being lost more than in other planting techniques we are talking about water management that is where nuclear techniques like the neutral flow moisture sensors the neutral sensors coming to play it will tell the farmer when to apply water or irrigate and when not to and therefore helping them they must know that I am a farmer I am a farmer I am listening to the farmer I am listening to the farmer I am listening to the farmer I am listening to the farmer I am listening to the farmer our economy has gone down because we cannot now have a big land for irrigation because there is not enough water puberty levels are rising in the country we don't have enough land but not enough water to irrigate the land and now we don't have enough food to supply to our community the water resources in the country right now are very stressed and we are facing a drought the latest information is that we shall be facing our fifth failed rainy season which is only going to make the situation worse Kenya is a water scarce country 80% of the country where the sources of water is and also the recharge areas so that they are protected for future use and also for proper management of the water what has been built here as you can see behind me is a wall one is a wall but two we also have an intake system so we have two intake systems going different ways we have water to two different communities to avoid any conflict in the area so each community gets an equal share and as you can see there is still some water flowing so that means we have allowed the environmental flow which is important for people downstream as well as the wildlife that use depend on the water Kenya like many African countries is struggling to grow the crop it needs in the face of climate change there is no one perfect solution but nuclear techniques are helping to give Kenyan scientists and farmers the precise information and tools needed to squeeze every drop of water and every inch of growth out of this beautiful land IAEA and FAO are working with scientists in Kenya and all over the world to help farmers adapt to climate change nuclear science and technology help increase crop yield protect water resources and feed people climate is not getting any better if we want to survive we must learn to survive with even less water and more severe conditions things look bleak sometimes but science gives us hope


About time, on my talk, I am Sree Kumar, I like to be called Sree, and welcome to this post-lunch session. I know this is a very cosy auditorium. Okay, so, how many people are sleepy? With show of hands, okay. How many people don't want to see code? And a show of hands. Oh, thank you. That's fine. So, this talk will be about creating services in Android, mostly the bare phones. And since the audience is just picking in and giving you guys some additional background, yeah, one more minute and we'll be ready to go. Where did you get the theme from? Point is gentium, plus, free for cinematic users. I think I spend more time creating the template when I get on the talk. I hope that doesn't show up on the talk. Maybe not, because I've been studying about this for a while in office. Hopefully it will all work. I can send you a template whenever you wish. It's not much of a template. So, gentium, some accession like that line, only they are made by these. Of course, I chose a font too, so, not that I made it. Okay, time to start. Is this mic directional? Hello? That's all. This is all you're going to buy? In a font. You don't have a mic and it's a manual? I guess I'm more comfortable with this, because the mic is in the direction. So, without further ado, I'm Shree, and I work as a software architect in annoying software. We actually are currently working a lot on Android. So, I'm not an app developer. I guess a lot of talks here would be mostly about apps, because that's where the majority of the activity is. I develop systems mostly.  I'm mostly trying to illustrate the concepts that go towards creating services in Android. So, what's the motivation behind this talk? Does anybody else hear a feeble echo? Or is it just me? Nobody else? So, I proposed this talk out of sheer frustration, actually. So, I saw the talks that are up for submission, and I was struggling to make services on a new platform. Android, I started off three months back on this. My background is mostly C programmer, C++, Python, assembly language, even. I don't know Java. That doesn't mean that I consider Java as a blank language. I like Java, but people may not like my Java code here, but we keep those offline. So, the motivation behind this talk is that writing services is useful and fun. So, first, a service is a background activity which does a lot of work for you. And it's mostly a component that I should take in Android. And it's also painful. That's why I'm trying to give this talk here. This code is filled with a lot of code, and various UI, as I said earlier. So, just bear with me. If you're sleepy, that's okay too. I hope I don't break anybody's feet here. So, what's the deal with writing services in Android? So, you have a lot of documentation, but I don't think it's really enough. So, documentation for services, I firmly believe, shouldn't be like documentation for API, because once that happens, it becomes harder to write a service which actually does something. So, most of the documentation that I've found is scattered. A lot of places you see, Google searches for a lot of things. I've tried to collect all these things in one area. I'm not planning here to create something new. In fact, I haven't. I've brought together diverse pieces of documentation, combined it with my experimentation, and I'm going to present that to you. And documentation deals mostly with the mechanics. I don't know how much a fortified-minute session can make a difference in this area, but let's see. I'll give it a try. So, what's the objective of this talk? So, first, the classification of the term patterns that I've used. It's not designed patterns like the famous Shagali which he uses. So, don't expect that. This talk tries to give you a quick overview of AI again, which is Android interface definition language. So, we're mostly creating services based on the idea because they are the most hardest in my humble opinion. I've been working with them for a while now. So, I'll try to say what the features and the paints of working with these interface are. And I'll try to show you how you can write useful services as patterns. So, when you're trying to create a service, a background activity with which you want to interact in an application, you are mostly not too much concerned. So, as an application developer, you may be concerned with the exact thing the service does. But as a generic service writer, there are certain patterns that you can find useful that you'll find useful. And if you actually probe into the Android open source, you'll find a lot of these there. So, that's my attempt. I'll try to define services as some kind of patterns. I will only have one or maybe maximum two here because that's all the time we have. So, an introduction to Android services. So, the service concept if you pick one. So, how many people have written services here? Android services. Oh, very much people. I am going to be in trouble. Okay. AI game services, anybody? One, two, three. Okay. A few. Okay. Actually, part of this talk is to show you that it's maybe not that painful. Maybe not that painful. So, for those who are not aware, a service is an application component. So, pretty much everybody is aware of that. It's typically used for long running operations which are running in the background, but not necessarily. Like, I think everything gets in Android. The Android documentation is pretty clear about this. Unless the documentation says that they're creating a thread. They are not creating any. So, the same applies for concepts, the service concept. So, typically we associate service with threads, right? But if you create an Android service, and of course, I'll show you some more later on. So, just wait a minute. If you create an Android service, it will not automatically create either new classes or threads for it. And there are some classifications for Android services. Broadly, I classified it as either interaction based and based on application boundaries. So, this talk is about identifying the inter-process communication-based, AI-ideal-based services. Because I think that's the hardest part. It's also the one that we are least likely to use, but that's what this talk is all about. So, AI-ideal-based services. So, what's AI-ideal? Android interface definition language. It looks... An interface definition looks similar to an interface definition from Java. And there are tools in the Android toolkit which actually compile this into a separate code and create a service and create steps for you for marshalling and unmarshalling. So, when you're talking about service, in the generic sense, you have a client interacting with the server someday, not necessarily in the socket, right? And typically the two major concepts are marshalling and unmarshalling. So, you marshall something on the client side, you unmarshall it on the server side, then the server does something for you, it returns the result to you, right? So, AI-ideal is the way to easily do this on Android. And it's all about inter-process communication. I'm not going to deal with the simpler cases of the communication inside the process. But the samples that I'll show you will all be inside a single process. So, that's a kind of a dichotomy that I'll say later why I did it. So, if you read through the Android documentation, you'll see that there's something else with which you can create inter-process service, inter-process services. That mechanism is called messenger. So, messenger is based on manual multiplication of packets. So, you basically send a message from the process to another process, you have to manually take care of encoding and decoding the packet. So, I'll share it with you. Because I don't find it that rich and I have mostly done the idea because of its richness and its appropriateness to my work. So, why I'm going to obtain all the pain? So, if you read a little bit of AI-ideal, you'll see that it's not really recommended. There's this documentation around it. People say, don't try AI-ideal unless it's really necessary. So, I choose AI-ideal because it gives you natural interactions with the services. So, you basically connect your service and you write code which looks very much like code you use inside your program. And then you can interact with the service in a very natural program or like manner across processes where you can call the service and call you back. And you can pass complex objects as parameters. So, that's the reason to take on this pain. So, if you really don't have the need to take on this pain, maybe you shouldn't. Okay. So, first we looked at a hello service which I think is mandatory doing that more than half of the audience has done services. So, we'll jump right into the AI-ideal service so for those who actually already developed services you're probably already aware of on-bind and on-intense service and so on and so forth. So, okay, my image got chewed. All right, no problem. So, what does a hello service look like? So, a service typically, when you have a service implementation in Android, you need to implement a class which extends service and then you need to implement certain methods inside it. So, if you want a real service, you'll typically implement on-bind. And we'll of course come to the details of all this very quickly. And you expose a programmatic interface for your clients or for your consumers because by implementing methods, by implementing methods stops. So, you basically define an interface, you define a stop for the interface. So, the interface itself is processed by a tool and it generates additional code around it. And the interface communication happens using the binder drivers or more specifically the I-binder interface in Android. Of course, I will not go deeper into the I-binder interface because that's more complicated. So, services are exposed where Android manifest.x7. So, I hope everybody here has programmed with Android. Anybody who has not? Anybody who has not programmed in Android? Okay. So, mostly you have to export services where the manifest has the special nodes and all that. So, the client apps, you also write a service which explores on bind and exports its services where they manifest. Client types can bind via intents and they can use the services provided. And client apps can actually provide callbacks which the service can directly call you back. So, anybody who has done RPC, they're perhaps familiar with all these things. So, you call a service using a programmatic interface, the service calls you back with a programmatic interface. So, if the application wants to be called back by the service, it has to implement stops itself. So, typically the service implement stops. If you have client programs are doing the same, then the client also has to implement the stops. Okay. So, we quickly have a look at the service. Enough talk. So, this is a simple server which I have defined. It's called binding IPG server. So, to go through the documentation, you'll find that services can be binding or not binding here. Services can be binding or stopped here. So, binding IPG server which extends the service. Okay. And there's implementation of on-bind here, which you see. Okay. And it's basically returning an eye-binder. So, what's the eye-binder? I'm returning an API here. So, it's interesting to see what the API is. Oh. I'm very sorry for having you join. I should show you the eye-binder first. So, we are going to do a very simple service here. It was only one method which is start operation. Okay. And it can take a call back. So, basically, you're a client which will start a service and call something which will call you back. So, that's all. Because that mostly shows most of the things that we need for another service. So, it's very easy to see here. So, you just have an interface. It's a server API with a very simple definition. So, this will be noticed by the AI tool to generate more complicated code, which I won't show you, but I'll show you how to use it. Okay. So, we come back here. So, we take a server API, which is here. And we implement a stub for it. So, why is a stub? Because the ideal code generator generated code format. Now, that code itself will expect you to implement a stub so that you control the interface. You control what you do in your interface. So, our stub implements start operation, which takes the call back. Okay. And it does something inside it. Okay. The most important thing it does is it calls the client side itself. So, it takes the call back. It takes the call back. Okay. And it actually calls the call back a few times. So, what's the call back definition looking like? So, I showed you the server side interface. So, the call back definition of the prediction limits is that this is a single function which has a code. Okay. So, all by returns take a face, which the server exposes. Now, how does the client actually access all this interface? All right. So, it comes under manifest.xml, which actually exposes the service using the service tag. Okay. And it actually defines a intent free term, where it allows access to that, to the service. And the other thing is the most important one, is that we export the service. So, unwrite exported equal to true is what ensures that your manifest exports your service. Okay. So, that's mostly all to it. So, and on the client side. Right. So, we have a service column, which is an application, it's an activity. So, what it does is... Okay. So, here's its fun create of that activity. So, basically, the starting of the activity, you use an intent. So, I give the full name for the intent here, so that it doesn't clash with anything else. The whole name of the intent is here. And later on, you bind to the service, using bind service. And the interesting thing here is that there's service connection. So, what's the service connection all about? So, when you connect to a service, it's associated with the connection in which you can monitor the connectivity to the service. So, unwrite can kill processes when there's this memory and all that. So, you need to keep track of the connection to the service. Okay. So, what's inside the service connection? So, service connection itself has only two things inside. One is on-service connected, which is here. And the other one is on-service disconnected, which you see on the next thing. So, the on-service connected is called when your service is ready to service your request. And there, again, you have an eye-finder, like earlier. And that's costed to a server API. So, it's type cost to a server API, like here. Once you have that API, you have control over the service from the client end. And one thing about ITC services is that there's no way to predict which thread they'll run on when you are running across boundaries for Android AI services. There's always a thread pool. So, unlike other forms of Android development, where unless you create a thread explicitly, there's no thread which is started. Here is a pool of threads out of which one will be located. Something will come into your process randomly. So, you cannot, when you're interacting with a service, you cannot expect to be on the same thread as the UI. So, you have to typically use something like run on UI thread. If you have to update your UI as a result of interactions with the service. So, what we do is, on the UI thread we call it start operation. Actually, there's no great need for that, except that I want to update the UI. So, from here on, your interactions with the service will look like mixed with programming. So, you can see API dot start operation. So, looking at that, you cannot say whether it is, what do you say, local or remote, except that you have to catch remote exceptions. So, this kind of the gain of service program. So, you have to catch the remote exception because service can go in time. And, well, that's about all there is to a simple service. We are getting remote exception not caught. So, for that you have to use the... You have to catch remote exceptions. Not exception. That's the remote exception. Remote exception is that kind of the gain. Service dies on the other hand. You have to catch it. If you don't actually catch it, of course, you can't... You can't compile that. It's not that in the other hand. Okay, so, don't you have the slides? Do you think... Oh, no. I'll show you guys this in action. Actually, there's not much to it. So, we have a client app which is only here, and it starts the remote operation, and the remote operation exits immediately. But the server keeps calling you back on this slide. It calls it about 10 times here. The UI responds a little because the callback happens on different times in the UI thread. So, typically, your application does not respond for five seconds or something. It doesn't respond for three and a half seconds. Is that correct? I'm not dealing with much of the applications myself. So, that's all a simple demo of ours. Right? So, let's go back to... A little more about... Excuse me? Yeah? Can you go back to the server code where you're calling the callback which is faster? Can I go back to the server code where I'm calling the callback? Yeah. Can you tell me why you're creating another instance of the callback? Which one? The exact... This final server callback? Yeah. Oh, that's just so that I can access it from the inner class. You know, my Java is weak, so my colleague tells me that's the way to do it. So, that's what I do. Anyway, you're getting it from the parameter, right? Yeah, but I can't call it directly inside. I have to keep another method and just... I think some Java things are... And I don't need it in Java. I told you that. Yeah? What is the use of that thing inside the parameter? Which one? The area where it's fine. There's an in and a... Yeah. Right. So, that's getting passed back to the callback here. No, there is an in and a out. Yeah. Oh, okay. So, parameters can be in or in out or out, I think. So, most elementary parameters will be in by default, right? But you can have complex types which can be in and out and in out. So, if you have complex types, you have to define them. Those types have to implement passable. So, like this. That's all I can tell you now, sir. Because we have other stuff to cover. But does that answer the question? It's just... You can have any out or in out. So, they can also be in out. Yeah? Yeah? You talked about a thread pool. So, when the client made that call, API got something. Yeah. Does it return immediately or... The client returns immediately, yeah. Okay. That means that the UI is responsible. Yeah, that's what the UI is responsible. And if I call back the client in the same thread, without firing the thread, the callback will get invoked in the same context, which will be a UI thread context. Okay. So, it doesn't matter what... So, when you do API.start operation, what if the actual method was very long? Let's say it was a seek, a five-second seek. The client would still not... I mean, it's not actually a seek. The client... When I'm a little confused about the interaction over there, because it's a single install, is the role coming back to the client or...? The role is coming back to the client, yes. So, that's why a thread is doing the work part. If I had done the work in the same place, then the client would be waiting for the result. And there is a way. So, there's something called one-way. If you add a one-way parameter to the API, for interface, that won't happen. So, you get called and you'll be telling me everything. So, let's just write a deeper topic, please. Okay. So, I'll quickly go here because... So, what's so nice there? And so, there's also nice things you can call an application with easily. It looks like a program on the interface, except that you have to catch everything, et cetera. So, you don't have control over the binding. So, I didn't talk about it. Documentation doesn't talk about it. But on-wind, the return value is cashed. So, it's... Once the server is running, on-wind, it typically gets called only once. Okay. That came on a stop to me. I still haven't figured out why that is. But that's the way it is. So, that means you cannot change the interface. You have one interface, it takes too much for the lifetime of the service. So, that's... My opinion is not so nice. No control over that. So, you don't have any control over threading. So, there's another thread pool that I was talking about. Okay. The code is messier than it was in the interface. So, typically, if you call a function method, you don't really see a catch remote exception. I didn't talk about this here, but there's no support for exceptions across processes. So, you call a server method which raises an exception, then the service will die. And if the server calls a callback which raises an exception, the client will die. Exactly. Yeah. It's not even a matter. I guess I might have missed that. That's fine. But the summary is that exceptions are not passed back and forth across processes. And catching dead remote object exceptions results in a lot of messy code. And, of course, callbacks are involved in some thread pools so that complicates programming, which is already, I think, two questions around that area. So, because let's see if it's very complicated. And the last thing is there's no concept of versioning. So, once you explore the service, and that is used by multiple people outside your app, that's if you're dead. You have to keep track of that same function signatures for a while, unless you want to decide to break the compatibility. Okay? So, what are the common service patterns? Now, we'll come to... You know, typically, you have only sommetings that a service does. The internals and mechanics of what a service does. For example, you have a camera service. The camera service is a lot of work to do. But from an application interface point of view, it's calling you... There's a initialization. It keeps calling you back once every so many while when it has a frame, right? So, this kind of a pattern is what I call a lock pattern. Okay? There are services where simultaneous people would want access to shared resources. So, if you look up these kind of services you will find that the file failed, they fall under either serialized or a broadcast pattern. So, there will be some kind of serial access to some object underlying. And there will be some broadcasts. So, for example, you have sensors, right? So, you say... They just tell me as a listener. So, there might be multiple listeners to the sensor. In which case, this becomes a broadcast pattern. Okay? The less common thing, at least in the Android world, because of the limited footprint, is service versioning. So, as I say, you always have to maintain backward compatibility. That's also possible to provide. So, on-point returns an interface. Now, from that interface, you can control... You can provide control as another very interface. So, somebody who's familiar with... ...or... ...perhaps identify with this. So, you provide a very interface function, which itself provides you another interface. That will provide you some kind of service versioning. Of course, you can argue why such kind of things are required on mobile and Android devices. And if there's a need, it's possible to implement it. That's all I'm trying to say. Okay, so we look at the lock pattern for one-to-one time. Only, I guess. So, a bigger look at the lock pattern. So, lock... So, you have a lot of services where you can create and print a single object. And one process which needs to access the object. And that can be easily done by enforcing locking and unlocking behavior. So, a lot of people who don't know the modifier program are well aware of this. So, you lock the object. You use the object in some way, then you unlock it. And that looks very very simple. Except that, you know, there are questions like how do you handle multiple application access? What is the appropriate trading model for this kind of access? If... So, in Android, if an application locks something and doesn't go away, doesn't unlock the resource, then it would be very hard to make it... to make the same resource accessible by others unless the service is going to be a policy. Okay, leading to starvation. So, what we'll do is we'll look at a lot of service implementation, which is, again, some more simple code. It's nothing more complicated here. Actually, when I... When I gave the talk proposal, I had something very big in mind. Then I gave a similar talk to my colleagues in office and then I realized it was not possible to give a talk like this in 45 minutes or half an hour. So, I have to steal this down drastically. So, all the details that I'm not covered here, perhaps after my talk is over, for interested people, I can go outside. So, I understand this is a hard topic to cover. I can see a few sleeping faces and half you in it. Not too many. Okay, so, coming back. So, how does one implement a lock service? So, typically, what I do, I'm a systems guy. So, my idea of locks are somebody... So, client program wants to access the camera. So, the whole client process has access to the camera. So, that means I associate the locks with the calling process. Because there could be multiple threads set. Remember, there's a simple programming. There's a regular programming paradigm. If I gave you an object on which you can make calls, at the same time, I don't say that you cannot call it from different threads. So, I'm making ownership applicable to the process. That's what I typically do. There are reasons why I wouldn't want to do that. If you have a GUI, let's say, which is interacting with the same system in multiple viewports, for example, then there's no sense of ownership per app. It's more like ownership per thread. But this is a part of that I mostly developed here. And I use a worker thread for serialization. So, what do I mean by that? I was talking about a thread pool. So, now, remember, this anchor, right? And nobody says what is the size of the thread pool. Yeah. So, nobody says what is the size of the thread pool. So, in the emulator that I run, it's like three threads. Okay. And I haven't been checking my real devices. So, ideally, what you want to do is handle the threading yourself. And create any number of threads that you really want. So, typically, I find it very convenient to start threads on serialization. And I find that modeling IPC calls as producer-consumer problem. So, java.pro and java.preview.concorate, right? Which provides you easy ways to pass around data in a thread safe manner and with so many other patterns. So, I use that. And in the service implementation, I typically pass, in the service implementation, I typically do new work inside the function itself and pass around that data to the worker thread. So, that's something that you typically do in other kinds of services where it's equally applicable here too. Because you do not know what is the size of the thread pool. So, unless you want to take a chance, do more profiling of it and so on, I wouldn't advise that, okay? Do I have a solution for starvation which is applications calling the lock and not unlocking it? Actually, not. So, there's a way to... So, if an application dies without calling unlock, there's a way to evict those plans because you get dead object exceptions. But that's an implementation detail. So, it's hard to automate. It has to be applications of service decision policies. Okay? So, with that, let's have a look at... Quickly, I'll look at some code. I have a service here called X2 server which, again, has the same... a little different API.  There's a start operation which will result in calling of the power back and then unlock. It's as simple as this, okay? And the server power back remains the same like from the previous example. Oh, sorry. I think this is the wrong place. So, you again have a lock reserved which has an integer, right? As simple as that. So, how does our solution server change? Right? So, let's... So, we have a lock implementation here which is, again, a stop implementation. Okay? Server API.stop. So, what does the lock do? So, inside these procedures, you have... you get something called...get calling PID. You just tell you who the caller is. So, as I said before, I associate the PID with the lock. So... So, I ensure that if nobody has unlocked it or the owner is calling the lock again, then I allow access. Otherwise, I don't pass. Okay? So, that's the best thing that we can do, right? But it's very effective for the kind of things that you are doing in Android. I mean, this is not something which... which you are doing for some big enterprise applications and this is very simplistic. But it's very effective for this kind of environment. And unlocking also... actually, if the owner is calling the lock, then I clear over my... my own object, which actually pulls the lock. Okay? So, I have an operation called start operation, which is depending on... whether the caller is successful or not. Okay? Here, what I do is... I take the ownership with respect to the PID. Okay? If the ownership doesn't work, nothing for the caller return falls. Otherwise, I package everything inside another class, the operation, which is the integer that was sent from the client side. And I put it inside a word queue. So, I was talking about... java.com, I find it very useful. And array blocking queue. In this case, I have an array blocking queue with a single element. So, why is it a single element? So, this is where you control how many operations are handled by the thread. How many of them can be queued. So, that kind of thing. It can be anything you want. It can change the kind of paragraph you want to use here. So, I put it into a queue, which is a block array queue. And I have a thread, which is a worker thread, which is started on service startup. And it's only job. It's only for commands that are coming from the IPC. And then executing that. So, in this case, it slips one second and it calls the callback. So, as simple as that. It should be the synchronized instrument which is in just the right place so that takes care of any access issues and any multi-fitting issues happening there. And the service caller looks exactly the similar except the way it calls the API, right? So, it calls API.lock as a callback, which the implementation which I'll show later. And it starts an operation. And all this is happening in the UI thread trying to see run on UI thread. And let's see what the operation really does. So, the server ends up calling off-crisis and again on the UI thread we want something. So, basically, here we have a service which is implementing a lock. But I don't have multiple plans here. I'm not sure. So, that's a mistake I made. But I'll show you this in action. Again, as I said, there's hardly anything to show here because we'll just say, you know, what kind of something I got, right? So, that's the famous Android Inglater. Okay. So, that's it. I'll say it got called back. And you are the owner. And if you actually test this in multiple plans, you'll find that it actually works. So, I'll share all these words somewhere later. Yeah. I'll share all these words somewhere later. I don't have it here in the presentation. So, perhaps on my website later on. So, that covers the lock pattern that I was talking about. I don't think we have time for shared access service. So, I'll just put it up for any questions that you have. Any questions? Yeah. Thank you for calling our time late service. Okay. So, for example, we have a talk tomorrow. Okay. So, it's like a massive promotion. So, we've actually enabled a few devices on Android, right? So, if you look at the camera service, there's seven services. Typically, we find system services that have such great lengths to do things. Do things like IPC. So, that's one place where you're definitely deployed. Because one thing I didn't talk about here. What happens is, you expose these callbacks to the service as the clients invite. The question is, how does that client compile against your service? So, you need to have a job file somewhere. So, these things are messy for a critical application. It can be done, but it's messy. So, typically, you want to do it for simple applications. If you have some kind of great news that you want to do inside your application. Or if you want to create a system service, you'll do that. So, there are very specific needs. So, this doesn't take care of the remote procedure problem. This is all inside the same system. One never knows. When I release 7.0, you can have Android's communicating to other Android's using iBinder. No, not iBinder. Yeah, using iBinder. So, it's possible if you want it if you want to, but not with the supported tools. I think it's possible because once you have serialized it, the world is the end. So, you never know. Yeah, all that is very messy. Exceptions are tricky. One propagate across first boundaries. Any more questions? Yeah. Yeah, close enough. We can ask the client. You know, the system services stands at the boot up. If I want to add a new system service, can I do it as a third party of this network? No, not a system service. Of course, you can implement a broadcast receiver or something like that in standard service. See, it's not really dependent on that part of the infrastructure. So, if you have a system implementer, you have access to tools like init.rc. And you have access to the system server process. It actually starts a lot of process. If I'm part of that, if it is part of that, then it becomes like Android, you know, Android getting killed when there's no memory. If I don't want to have it. If an application is binding to you, you will be considered part of that application. So, you won't be killed. Most of that. I haven't seen the management that has happened. You understand, right? If a client has bound to the service, the service is considered part of the application. And it's not typically king or easy, or at all. The other thing is that Android says that when all the applications which have bound to a service, they can't find it. So, your service comes down, right?  Ask the question again. This service will only be in the time when all the applications which have bound to a service. Yeah. So, that's a matter of implementation. You can make it a start-up service. Can we override that? Yeah, you can. You can have something called a start-up service where you implement on-start and there's another way to do it. Now, how to, where should I mention that? Well, I think we're out of time here. Right? So, unless they can, they're dragging out ticking and streaming. So, you can make it right. Yeah. That's it. So, so I just thank all of you here for your presence. I hope it was useful. And I actually blog at my website, seek more of my answer and I'll put up the slides and report there for those interested. Of course, we can, we are obligated to take it offline. Let's just put it that way. All right. Thank you again everyone.


Hello. My name is Fernando. I'm from Pixel Animation Studios, and today I'm going to talk about the discretization of differential barriers on polygonal meshes. Our goal is to make geometry processing tools originally developed for triangle meshes available for polygonal meshes. And our motivation is quite straightforward. Many industries rely on polygons instead of triangles. This is true for instance at Pixel, where we use co-domain meshes to define subdivision surface. More broadly, polygonal meshes can be found in any area based on geometric design. Even in engineering applications, polygons are often preferred because they do a better job in conforming to complex geometries. But you might be wondering why not triangulating the polygons? Unfortunately, splitting the polygons into triangles introduces numerical artifacts. Which manifest themselves in different ways. For example, let's say we have this hexagonal tonic of atolls. We can rematch the polygons by making the triangles as learning as possible, or we can apply this recent technique that it uses at intermediate triangulation, splitting the polygons with virtual nodes. Either way, computing coverage on these meshes produces drastically different results. This is because the polygons are not planar, and the choice of triangulation changes the shape inside the polygons, thus the curvature. Now let's say we have a dense quad mesh generated through subdivision. Here the quads are quite uniform, so we would expect similar results for any triangulation. Instead, these are the results for a conformal parameterization, where the colors indicate the quads conform distortion. In this case, the issue is that we care about the distortion of off of the quads, not offering any little triangles. So using a triangulation is effectively over constraining the computations. Due to these artifacts, numerical methods on polygonal meshes have received attention from many disciplines, specifically from graphics that have been somewhat dedicated to polygonal applications. But they overlook all the other operators using jump crossing like radiance, chip operator for curvatures, and so on. The mechanics community has also proposed several techniques. The closest to our work is the virtual element map, which extends finite elements to polygons by defining basis functions implicitly, hence the name virtual element. However, these maps are focused mostly on 2D flat meshes instead of curved surface. So in this work, we introduce a systematic construction of differential operators that is varied on surface meshes made of arbitrary 3D polygons. In this process, we will improve existing applications by making them compatible with first order derivatives. And at the same time, we will reproduce existing discretizations in a special case of triangular meshes. In practice, what we get is a way to apply geometry processing to polygonal meshes without modifying the specifics of any algorithm. And the core of our approach is the discretization of the co-gradient operator. The co-gradient is simply the cross product between the surface normal and the gradient vector. An important property of a co-gradient is that it obeys the Stokes theorem. This allows us to use a boundary integral, making our construction agonistic during the shape of the poly. To discretize this boundary integral over a polynomial of phase f, we obtain an approximation of the co-gradient operator, which is exact for linear functions. Since the linear function has a constant gradient, we can also relate our boundary integral to the integral of the normal vector over the polygon, even though we have no knowledge about the surface feeding the interior of the polygon. This integrated normal is a norm quantity called the vector area, and it provides a well-defined notion of area and normal for any 3D polygon. By combining the co-gradient in a vector area, we define our discrete gradient as a matrix G and maps function values as verses to a vector per phase. More specifically, the discrete gradient applied to a function is evaluated as the average of the co-gradient of this function over the polygon, rotated by the polygon norm. Thus leading to this simple expression, where this terming highlight corresponds to the column of the matrix G associated with the vertex V. Note that by construction, our discrete gradient is exact on linear functions, and in fact, in the special case of triangles, our result is also equivalent to the gradient of linear basis functions, even though we may not use of basis functions in our derivation. There is, however, one important difference, our matrix has a null space, and this may affect any computation related to the gradient, because it may introduce its previous modes. In order to identify and quantify this null space, we will relate our discrete gradient with operators acting on one form. One form is our alternative way to encode tangent vector fields available in x-serial calculus. Instead of a straight vector, with two coordinates relative to a local frame, one form provides a coordinate free representation that measures the circulation of this vector over the edges. In the case of a gradient vector, the circulation is simply the difference of vertex values, and we use the matrix D to denote the mapping from vertex values to the difference of values per edge over the phase F. In the continuous setting, the mapping between vectors and one forms is defined by adding used cooperators, flats and sharps. These operations are inverse of each other, so no information is lost. However, the discretization of vectors at faces and one forms at edges breaks this bi-directional mapping, and to better understand this mismatch, as discretized in use cooperators, the discrete sharp is a matrix U that maps one forms to a tangent vector per face. By mimicking this smooth setting, we assemble the sharp matrix by simply rearranging the terms from our gradient matrix, leading to this expression where C is the centroid of the phase F. On the other hand, the discrete flat is another matrix V that maps a vector from a face to one form local to that face, and each row of this matrix V returns the circulation of the vector evaluated at each edge of the face. And we can compute this circulation by projecting the tangent part of the vector into the edge vector. Notice that in one direction, our discrete music operator don't lose any information. In fact, starting from a tangent vector, if we apply flat and then sharp, we get back the same input vector. So the mismatch shows up when we revert the order of these operations. And we quantify this difference by introducing the projection operator. The projection is a matrix P defined per face that maps a one form to another one form inside the face. This matrix indicates the information lost by a one form when we extract the part of the one form associated with a vector. So consequently, we can use P to quantify the part of a function that has a zero gradient. Or in other words, P provides a closed form expression for the no space of our gradient matrix G. Geometrically, the matrix P measures how much information is off the polygon's plane and how much is not linear at all. What it is together can finally construct our Laplacian matrix compatible with our gradient. On the definition of the Dirichlet energy, we use the square norm of the one form, which expands into two terms. The first one, computing the square norm of the gradient of the function, and the second one, penalizing the no space. Note that we are penalizing these two terms equally. We arrange these terms and we obtain our polygon Laplacian matrix, which contains in the middle an inner product matrix, which has this form defined by the shape operator U and the projection operator P. Importantly, this matrix verifies all the basic properties expected from Laplacian, and in the special case of triangles, it will be reduced to the coton Laplacian. Our result also shares some similarities with the polygon Laplacian proposed by Alexei Verdesky. Even though the individual matrices are different, we were able to show that their expression is equal to ours, plus an additional term related to the non-planarity of the poly. This age is already accounted for by our projection matrix P, so the matrix from Alexei Verdesky is penalizing this term twice. In practice, we noticed that our version of the Laplacian produced a slight improvement in accuracy when we solve Poisson equations. Another important difference is the fact that this previous inner product requires a singular value decomposition to assemble the matrix C, while our inner product is given in closed form. Our discretization also applies to operators on directional fields. In this case, we care about the direction of the vectors, but not about the norm of these vectors. For this reason, we need to account for the misalignment between tangent planes, and this can be done by discretizing the connection over a polygon. In our construction, we assign a tangent plane per vertex and per face of our polygon mesh, and then we encode the discrete connection as the smallest rotation mapping normals, from each vertex to each incident face. With a discrete connection, we can then collect the vectors u at the vertices of a face f and bring them to a common coordinate system defined at that face, and we indicate these rotated vectors by u superscript nabla. We can then discretize the covariant derivative over a polygon as an operator that applies the same gradient we saw before on each coordinate of these rotated vectors, thus returning a matrix per face. Similarly, we can also define a covariant projection operator that accounts for the no space introduced by the discrete covariant derivative, and with these terms combined, we obtain a Dirichlet energy for vector fields, which leads to our vector laplacian. To compute curvatures, we're going to look at the shape operator, which is defined as the gradient of surface normals. In this most setting, the shape operator has two important properties. First, it returns tangent vectors, as any gradient does. Secondly, it forms a self-adjoint operator, thus making the matrix symmetric. We enforce these properties in our discretization by defining the discrete shape operator as a matrix that maps normals at vertices to a matrix per face. And we assemble this matrix using this expression, where capital N indicates a matrix with all the normals of the vertices incidentally face f. Notice how in our construction, we are seeing the tries in the gradient of the normals, thus making the shape operator also symmetric. And in these outside terms, we are making sure that the shape operator is orthogonal to the face normal. We can then extract principal curvatures in directions from the shape operator by computing its eigenvalues and eigenvectors. Now, let's see some applications. We start with shape editing. Here we have a Rasmash with points x, and our goal is to blend this shape towards another pose. To do so, we set a Jacobian matrix J per face of the polygonal mesh. And this matrix indicates the amount of transformation that each face should receive. In this specific example, we compute J using our gradient, applied on the point of the target pose. But we're going to do that only for the faces marked in red. For all the other faces, we set J to identity, so this face should not deform. We then compute the deformity points, which are called y, by minimizing its lightly modified version of the Dirichlet energy that includes the matrix J on both terms. So in the first term, we are penalizing the tangential deformation inside each polygon versus the second term, where we are penalizing the deformation in the new space. So these are deformations off the plane of the polygon, or nonlinear deformations. And these will avoid mysterious nodes. With our discrete operators, we can also compute nonlinear parametrization for polygonal matches. This was not possible before with previous polygonal methods. Here we minimize any choice of a distortion function, the psi, and we combine it with our projection term. So here's a result using the as read as possible distortion module to parametrize a quad mesh. And here's another example using this symmetric Dirichlet energy to parametrize a hexagonal mesh. And we point out that if we were to triangulate the polygons for these parametrizations, the evaluation of a distortion function and its derivatives and its derivatives would become more costly because there are more triangles than polygons. Just for reference, in the case of the as read as possible parametrization, the triangulated version took more than a double for the time required by the quad mesh version. Since we know how to compute curvatures on polygons, we can also generate suggested contours. The idea here is to multiply the shape operator with the camera direction, which returns the so-called radial curvature. Then we can extract contours, analyzing the gradient of these values. So for this application, we are combining the shape operator with our gradient. Grooming is another great example where we combine other operators we introduced in this work. Here we are computing a smooth groom, interpolating both the height and the orientation of each segment, forming these handle curves indicating in blue. Therefore, we need a scalar and a vector location all combined. Here's another example showing the same interpolation to groom feathers is moving over a wing mesh. And here is easier to see how these handles in blue are made of several segments, which allow us to create these band shapes. We also consider other common geometric processing applications in our paper, including conformal mapping, line fields for texture synthesis, and the heat method. In particular for the heat method, let me say that a good rule of thumb is to set the diffusion time step using the largest polygon diameter, instead of the mean edge length.  So in conclusion, we showed how to make a geometric processing compatible with polygonal meshes by introducing polygon-based differential graders. This was possible because our formulation is based on a new gradient, which comes from a co-gradient making our construction agnostic to the shape of any polygon or even any triangulation of the polygon. This gradient also comes with a notion of projection operator that will quantify any new space and eliminate any spurious nodes. As future work, there are a couple of interesting directions to pursue. Since our discretization can be seen as an extension of the virtual element method to surface meshes for the case of linear functions, one possibility is to generalize this construction even further by considering high-order virtual elements. Another direction is the discretization of differential graders on polyhedral meshes. This allows geometry processing on volumetric domains with meshes made of hexes or even promos like cells. Basically any cell in 3D that may have non-flat sides. Thank you for your attention.