remove GPS support from build?

1,940 views
Skip to first unread message

Android Newbie

unread,
Sep 29, 2013, 4:23:28 PM9/29/13
to android...@googlegroups.com
starting from the freescale i.MX6 saber BSP. I want to remove GPS support since my device doesn't have one,


Android still seems to thin kit has a GPS, at th every least it shows a GPS checkbox in the location access sub-menu, looking at the code it seems that this is built dynamically only when android believes it has a GPS source, but I jsut can't figure out how to kae it understand it doesn't have a GPS at all. What am I missing?

(next after GPS I'll want to remove the camera support, hopefully getting the GPS out will help me understand how to do the same to the camera)


I added the following (bolded) lines to imx6.mk
# gps related lib   
ifeq ($(BOARD_HAVE_HARDWARE_GPS),true)
PRODUCT_PACKAGES += \
    gps.SABRESD                \
    gps.ARM2                \
    gps.SABREAUTO                \
    Orion.ini                 \
    AR1520A-Auto.img             \
    ingsvcd                 \
    libOrionCtl.so                 \
    OrionSys.so
endif


I removed the following from udeventd.freescale.rc
/dev/ttymxc1 0775 system gps
/dev/ttya0 0775 system gps
/dev/ptya0 0775 system gps
/dev/ttya1 0775 system gps
/dev/ptya1 0775 system gps

I added the following to my <myproduct>BoardConfigComm.mk
BOARD_HAVE_HARDWARE_GPS := false
USE_ATHR_GPS_HARDWARE:= false

Android Newbie

unread,
Oct 6, 2013, 9:51:20 PM10/6/13
to android...@googlegroups.com
So doing the above does remove GPS support as far as I can tell (the low level drivers and the Orion service are not longer running), but I've been going round and round in the location_provider logic in the settings providers.

I removed gos from the list of default location providers (removed gps in the string below)

    <!-- Comma-separated list of location providers.
         Network location is off by default because it requires
         user opt-in via Setup Wizard or Settings.
    -->
    <string name="def_location_providers_allowed" translatable="false">gps</string>

from monitoring logcats of the SettingsProvider tag, it appears that something repopulates it though.

The location menu also shows the GPS, and from the XML below, unconditionnally, so I guess I need to remove the middle block?


        <PreferenceCategory
            android:key="location_sources"
            android:title="@string/location_sources_heading" />

        <CheckBoxPreference
            android:key="location_gps"
            android:title="@string/location_gps"
            android:summary="@string/location_street_level"
            android:dependency="location_toggle"
            android:persistent="false" />

        <com.android.settings.WrappingCheckBoxPreference
            android:key="location_network"
            android:title="@string/location_network_based"
            android:summary="@string/location_neighborhood_level"
            android:dependency="location_toggle"
            android:persistent="false" />

There is code that seems to unconditionally enable GPS when the switch to enable location is turned on:

(in packages/apps/Settings/.../LocationSettings.java)

    /** Enable or disable all providers when the master toggle is changed. */
    private void onToggleLocationAccess(boolean checked) {
        final ContentResolver cr = getContentResolver();
        Settings.Secure.setLocationProviderEnabled(cr,
                LocationManager.GPS_PROVIDER, checked);
        Settings.Secure.setLocationProviderEnabled(cr,
                LocationManager.NETWORK_PROVIDER, checked);
        updateLocationToggles();
    }

so I can keep turning things off in the code: turn off the menu, turn off the automatic settings when the master switch is enabled, and continue chasing down other places that enable the GPS, but is it the right way to do this? every other piece of hardware I turned off (camera, GSM...) I was able to do mostly at the makefile level and Android dynamically stopped presenting irrelevant menus.
Can't the same thing be done for GPS?

Vishveshwar

unread,
Oct 7, 2013, 1:45:55 AM10/7/13
to android...@googlegroups.com

Do you have the following file in your image?
system/etc/permissions/android.hardware.location.gps.xml

What happens when you delete this file?

-Vishveshwar
 

Richard Schilling

unread,
Oct 7, 2013, 3:25:18 AM10/7/13
to android...@googlegroups.com
I haven't tried that one before.  You may be grep-coding ad nausium until you get all the relevant GPS settings to disappear.

Your shortest path may be (not sure) to just disable the hardware and leave the other menus alone.  LocationManager should just eliminate the GPS from the list of available location providers.   That way, you don't interrupt the functioning of LocationManager.

Just going on instinct here ...

shridutt kothari

unread,
Oct 10, 2013, 5:26:53 AM10/10/13
to android...@googlegroups.com
Hi Android Newbie,

To remove any hardware feature from Android you can remove that hardware related permission from the android.hardware.*.xml file in /frameworks/native/data/etcdirectory.

So in your case you can remove GPS support with removing: 
<feature name="android.hardware.location.gps" />
from file: /frameworks/native/data/etc/android.hardware.location.gps.xml 

Hope that helps!

Thanks,
Shridutt Kothari
Impetus Infotech Limited

Mauricio Cirelli

unread,
Oct 11, 2013, 10:21:29 AM10/11/13
to android...@googlegroups.com
Hi Shridutt,

Is it possible to do that using overlays?

Vishveshwar

unread,
Oct 15, 2013, 8:39:18 AM10/15/13
to android...@googlegroups.com
Check the device.mk file for your device. There is probably a line like the following:

PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml \

Remove this line to make sure that the GPS permission file is not copied into the filesystem. For an existing filesystem, delete this file from the /system/etc/permissions directory and reboot.

Similar lines are to be removed to disable Bluetooth, Wi-Fi/Wi-Fi Direct etc.

-Vishveshwar
Reply all
Reply to author
Forward
0 new messages