Is there any way I can block the user from installing apps from an unknown source in custom android OS?
I am trying to create a custom variant of the Android OS using AOSP source, In which I want to allow users to install only apps from trusted sources that I specify during the build.
Block enabling developer option and USB debugging. The solution should block the user from installing an app from all the possible sources like sideload or by connecting with the system.
You can use the Play Store's parental controls to restrict or block app installation on the Android device. Using your child's device, open the Play Store app and tap the menu in the top left corner. Choose Settings and then Parental controls, and turn on the controls.
I have meet the same requirements, and implement it in Android 8. It use the device policy controller to disable app install. It should be still work in new Android version.
https://cs.android.com/android/platform/superproject/+/master:frameworks/base/services/core/java/com/android/server/pm/UserManagerService.java;l=559
Add the following function applyInstallAppsRestritions, and call it in line 559.
private void applyInstallAppsRestritions() {
synchronized (mRestrictionsLock) {
Bundle bundle = new Bundle();
bundle.putBoolean(UserManager.DISALLOW_INSTALL_APPS, true);
Slog.i(LOG_TAG, "disallow install app by default.");
mBaseUserRestrictions.append(UserHandle.USER_SYSTEM, bundle);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With