Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b8273e4 authored by Etan Cohen's avatar Etan Cohen Committed by Android (Google) Code Review
Browse files

Merge "[RTT2] Add API for testing whether feature exists on platform"

parents dcc0ee2d 692e68e7
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -2328,6 +2328,16 @@ public abstract class PackageManager {
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_WIFI_PASSPOINT = "android.hardware.wifi.passpoint";

    /**
     * Feature for {@link #getSystemAvailableFeatures} and
     * {@link #hasSystemFeature}: The device supports Wi-Fi RTT (IEEE 802.11mc).
     *
     * @hide RTT_API
     */
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_WIFI_RTT = "android.hardware.wifi.rtt";


    /**
     * Feature for {@link #getSystemAvailableFeatures} and
     * {@link #hasSystemFeature}: The device supports LoWPAN networking.
+8 −3
Original line number Diff line number Diff line
@@ -1092,8 +1092,15 @@ public final class SystemServer {
                if (!disableRtt) {
                    traceBeginAndSlog("StartWifiRtt");
                    mSystemServiceManager.startService("com.android.server.wifi.RttService");
                    mSystemServiceManager.startService("com.android.server.wifi.rtt.RttService");
                    traceEnd();

                    if (context.getPackageManager().hasSystemFeature(
                            PackageManager.FEATURE_WIFI_RTT)) {
                        traceBeginAndSlog("StartRttService");
                        mSystemServiceManager.startService(
                                "com.android.server.wifi.rtt.RttService");
                        traceEnd();
                    }
                }

                if (context.getPackageManager().hasSystemFeature(
@@ -1101,8 +1108,6 @@ public final class SystemServer {
                    traceBeginAndSlog("StartWifiAware");
                    mSystemServiceManager.startService(WIFI_AWARE_SERVICE_CLASS);
                    traceEnd();
                } else {
                    Slog.i(TAG, "No Wi-Fi Aware Service (Aware support Not Present)");
                }

                if (context.getPackageManager().hasSystemFeature(
+39 −0
Original line number Diff line number Diff line
<HTML>
<BODY>
<p>Provides classes which allow applications to use Wi-Fi RTT (IEEE 802.11mc) to measure distance
    to supporting Access Points and peer devices.</p>
<p>The primary entry point to Wi-Fi RTT capabilities is the
    {@link android.net.wifi.rtt.WifiRttManager} class, which is acquired by calling
    {@link android.content.Context#getSystemService(String)
    Context.getSystemService(Context.WIFI_RTT_SERVICE)}</p>

<p>Some APIs may require the following user permissions:</p>
<ul>
    <li>{@link android.Manifest.permission#ACCESS_WIFI_STATE}</li>
    <li>{@link android.Manifest.permission#CHANGE_WIFI_STATE}</li>
    <li>{@link android.Manifest.permission#ACCESS_COARSE_LOCATION}</li>
</ul>

<p class="note"><strong>Note:</strong> Not all Android-powered devices support Wi-Fi RTT
    functionality.
    If your application only works with Wi-Fi RTT (i.e. it should only be installed on devices which
    support Wi-Fi RTT), declare so with a <a
            href="{@docRoot}guide/topics/manifest/uses-feature-element.html">
        {@code <uses-feature>}</a>
    element in the manifest file:</p>
<pre>
&lt;manifest ...>
    &lt;uses-feature android:name="android.hardware.wifi.rtt" />
    ...
&lt;/manifest>
</pre>
<p>Alternatively, if your application does not require Wi-Fi RTT but can take advantage of it if
    available, you can perform
    the check at run-time in your code using {@link
    android.content.pm.PackageManager#hasSystemFeature(String)} with {@link
    android.content.pm.PackageManager#FEATURE_WIFI_RTT}:</p>
<pre>
    getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI_RTT)
</pre>
</BODY>
</HTML>