Reputation: 1931
I am building a AOSP ROM for my tv box. I have a system app developed and put it in AOSP as a priv-app.
I want to track hardware itself so I will be able to uniquely identify the box at server side. BUT I don't want this ID, leak to other apps any user can install on it. (so an adversary can not find out key via installing his app on many devices)
So far I was able to burn a key and reading it via this code:
String serial = null;
try {
Class<?> c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class);
serial = (String) get.invoke(c, "ro.boot.mycustomserialnumber");
} catch (Exception ignored) {
}
But this code can be run by any app without any permission. Can I prevent regular apps to access to this value?
Upvotes: 0
Views: 262
Reputation: 2815
Add custom name/value pair in SettingsProvider or You can make own Provider. Guard a name/value pair with custom permission, and give that permission to your app only.
Upvotes: 2