How to disable location or telephony on android box : use the system properties

If you have the sources of your box and you want to disable permanently some services you can use system properties.

first look at there, you’ll see how services are started :

frameworks/base/services/java/com/android/server/SystemServer.java

then you’ll see that most of the services have a boolean related to a system property, for instance location :

 boolean disableLocation = SystemProperties.getBoolean("config.disable_location", false);

and deeper in the file, you’ll see that this boolean is used to disable the service :

 if (!disableLocation) {
               try {
                   Slog.i(TAG, "Location Manager");
                   location = new LocationManagerService(context);
                   ServiceManager.addService(Context.LOCATION_SERVICE, location);

so basically you just have to find your system property file in your device tree, and force the value to true. Use a « find » to get it.

On rockchip device it is easy : the file name is system.prop. This file is used to generate the build.prop in the out folder.

Another way to force system properties is to use the Android.mk and force value with this specific token:

 
 PRODUCT_PROPERTY_OVERRIDES += \
    config.disable_location = true

Enjoy!

Auteur/autrice : Chrystophe Vergnaud

Prendre du recul pour identifier les réels besoins et faire un choix technologique en fonction de ces besoins.

Laisser un commentaire