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

Commit 77c0640b authored by Etan Cohen's avatar Etan Cohen
Browse files

[CDM][WIFI] Provide a permission for Wi-Fi association approval for companion apps

Rename API to make it explicit to Wi-Fi.

Bug: 135211972
Test: atest android.os.cts.CompanionDeviceManagerTest
Change-Id: I75b6d13432407a4e2804b57dcf6956055c9cefb6
parent ad1c710e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ package android {
    field public static final String CHANGE_APP_IDLE_STATE = "android.permission.CHANGE_APP_IDLE_STATE";
    field public static final String CHANGE_DEVICE_IDLE_TEMP_WHITELIST = "android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST";
    field public static final String CLEAR_APP_USER_DATA = "android.permission.CLEAR_APP_USER_DATA";
    field public static final String COMPANION_APPROVE_WIFI_CONNECTIONS = "android.permission.COMPANION_APPROVE_WIFI_CONNECTIONS";
    field public static final String CONFIGURE_DISPLAY_BRIGHTNESS = "android.permission.CONFIGURE_DISPLAY_BRIGHTNESS";
    field public static final String CONFIGURE_WIFI_DISPLAY = "android.permission.CONFIGURE_WIFI_DISPLAY";
    field @Deprecated public static final String CONNECTIVITY_INTERNAL = "android.permission.CONNECTIVITY_INTERNAL";
@@ -1711,7 +1712,7 @@ package android.bluetooth.le {
package android.companion {
  public final class CompanionDeviceManager {
    method @RequiresPermission("android.permission.MANAGE_COMPANION_DEVICES") public boolean isDeviceAssociated(@NonNull String, @NonNull android.net.MacAddress, @NonNull android.os.UserHandle);
    method @RequiresPermission("android.permission.MANAGE_COMPANION_DEVICES") public boolean isDeviceAssociatedForWifiConnection(@NonNull String, @NonNull android.net.MacAddress, @NonNull android.os.UserHandle);
  }
}
+1 −1
Original line number Diff line number Diff line
@@ -704,7 +704,7 @@ package android.bluetooth {
package android.companion {

  public final class CompanionDeviceManager {
    method @RequiresPermission("android.permission.MANAGE_COMPANION_DEVICES") public boolean isDeviceAssociated(@NonNull String, @NonNull android.net.MacAddress, @NonNull android.os.UserHandle);
    method @RequiresPermission("android.permission.MANAGE_COMPANION_DEVICES") public boolean isDeviceAssociatedForWifiConnection(@NonNull String, @NonNull android.net.MacAddress, @NonNull android.os.UserHandle);
  }

}
+2 −2
Original line number Diff line number Diff line
@@ -269,7 +269,7 @@ public final class CompanionDeviceManager {
    @SystemApi
    @TestApi
    @RequiresPermission(android.Manifest.permission.MANAGE_COMPANION_DEVICES)
    public boolean isDeviceAssociated(
    public boolean isDeviceAssociatedForWifiConnection(
            @NonNull String packageName,
            @NonNull MacAddress macAddress,
            @NonNull UserHandle user) {
@@ -280,7 +280,7 @@ public final class CompanionDeviceManager {
        Objects.requireNonNull(macAddress, "mac address cannot be null");
        Objects.requireNonNull(user, "user cannot be null");
        try {
            return mService.isDeviceAssociated(
            return mService.isDeviceAssociatedForWifiConnection(
                    packageName, macAddress.toString(), user.getIdentifier());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
+2 −1
Original line number Diff line number Diff line
@@ -40,5 +40,6 @@ interface ICompanionDeviceManager {
    boolean hasNotificationAccess(in ComponentName component);
    PendingIntent requestNotificationAccess(in ComponentName component);

    boolean isDeviceAssociated(in String packageName, in String macAddress, int userId);
    boolean isDeviceAssociatedForWifiConnection(in String packageName, in String macAddress,
        int userId);
}
+8 −0
Original line number Diff line number Diff line
@@ -2531,6 +2531,14 @@
                android:description="@string/permdesc_useDataInBackground"
                android:protectionLevel="normal" />

    <!-- Allows a companion app to associate to Wi-Fi.
         <p>Only for use by a single pre-approved app.
         @hide
         @SystemApi
    -->
    <permission android:name="android.permission.COMPANION_APPROVE_WIFI_CONNECTIONS"
                android:protectionLevel="signature|privileged" />


    <!-- ================================== -->
    <!-- Permissions affecting the system wallpaper -->
Loading