-> But this is where we get into deep waters. If you want to make your own OS and apps, we won't be seeing you for decades. I suggest you take a bog standard Linux that was used in the linux on android before and step 1, learn to compile that version and step 2, alter it to do what you want.
So let's say you and I want to securely message each other. Let's make an app that uses a codebook. Since there are so many, we have to first agree on a codebook then our apps fetch those books and then... You get the idea.