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

Commit 692dfeb4 authored by Evan Chen's avatar Evan Chen Committed by Android (Google) Code Review
Browse files

Merge "Add deprecate keyword for legacy device presence APIs" into main

parents 2a0fee81 e214b24f
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -10090,10 +10090,10 @@ package android.companion {
    method @FlaggedApi("android.companion.unpair_associated_device") @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean removeBond(int);
    method public void requestNotificationAccess(android.content.ComponentName);
    method @FlaggedApi("android.companion.association_tag") public void setAssociationTag(int, @NonNull String);
    method @RequiresPermission(android.Manifest.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE) public void startObservingDevicePresence(@NonNull String) throws android.companion.DeviceNotAssociatedException;
    method @Deprecated @FlaggedApi("android.companion.device_presence") @RequiresPermission(android.Manifest.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE) public void startObservingDevicePresence(@NonNull String) throws android.companion.DeviceNotAssociatedException;
    method @FlaggedApi("android.companion.device_presence") @RequiresPermission(android.Manifest.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE) public void startObservingDevicePresence(@NonNull android.companion.ObservingDevicePresenceRequest);
    method public void startSystemDataTransfer(int, @NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<java.lang.Void,android.companion.CompanionException>) throws android.companion.DeviceNotAssociatedException;
    method @RequiresPermission(android.Manifest.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE) public void stopObservingDevicePresence(@NonNull String) throws android.companion.DeviceNotAssociatedException;
    method @Deprecated @FlaggedApi("android.companion.device_presence") @RequiresPermission(android.Manifest.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE) public void stopObservingDevicePresence(@NonNull String) throws android.companion.DeviceNotAssociatedException;
    method @FlaggedApi("android.companion.device_presence") @RequiresPermission(android.Manifest.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE) public void stopObservingDevicePresence(@NonNull android.companion.ObservingDevicePresenceRequest);
    field public static final String EXTRA_ASSOCIATION = "android.companion.extra.ASSOCIATION";
    field @Deprecated public static final String EXTRA_DEVICE = "android.companion.extra.DEVICE";
@@ -10121,9 +10121,9 @@ package android.companion {
    method @RequiresPermission(android.Manifest.permission.DELIVER_COMPANION_MESSAGES) public final void detachSystemDataTransport(int) throws android.companion.DeviceNotAssociatedException;
    method @Nullable public final android.os.IBinder onBind(@NonNull android.content.Intent);
    method @Deprecated @MainThread public void onDeviceAppeared(@NonNull String);
    method @MainThread public void onDeviceAppeared(@NonNull android.companion.AssociationInfo);
    method @Deprecated @FlaggedApi("android.companion.device_presence") @MainThread public void onDeviceAppeared(@NonNull android.companion.AssociationInfo);
    method @Deprecated @MainThread public void onDeviceDisappeared(@NonNull String);
    method @MainThread public void onDeviceDisappeared(@NonNull android.companion.AssociationInfo);
    method @Deprecated @FlaggedApi("android.companion.device_presence") @MainThread public void onDeviceDisappeared(@NonNull android.companion.AssociationInfo);
    method @FlaggedApi("android.companion.device_presence") @MainThread public void onDevicePresenceEvent(@NonNull android.companion.DevicePresenceEvent);
    field public static final String SERVICE_INTERFACE = "android.companion.CompanionDeviceService";
  }
+11 −2
Original line number Diff line number Diff line
@@ -1229,7 +1229,6 @@ public final class CompanionDeviceManager {
        }
    }

    // TODO(b/315163162) Add @Deprecated keyword after 24Q2 cut.
    /**
     * Register to receive callbacks whenever the associated device comes in and out of range.
     *
@@ -1261,7 +1260,12 @@ public final class CompanionDeviceManager {
     *
     * @throws DeviceNotAssociatedException if the given device was not previously associated
     * with this app.
     *
     * @deprecated use {@link #startObservingDevicePresence(ObservingDevicePresenceRequest)}
     * instead.
     */
    @FlaggedApi(Flags.FLAG_DEVICE_PRESENCE)
    @Deprecated
    @RequiresPermission(android.Manifest.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE)
    public void startObservingDevicePresence(@NonNull String deviceAddress)
            throws DeviceNotAssociatedException {
@@ -1288,7 +1292,7 @@ public final class CompanionDeviceManager {
                            callingUid, callingPid);
        }
    }
    // TODO(b/315163162) Add @Deprecated keyword after 24Q2 cut.

    /**
     * Unregister for receiving callbacks whenever the associated device comes in and out of range.
     *
@@ -1305,7 +1309,12 @@ public final class CompanionDeviceManager {
     *
     * @throws DeviceNotAssociatedException if the given device was not previously associated
     * with this app.
     *
     * @deprecated use {@link #stopObservingDevicePresence(ObservingDevicePresenceRequest)}
     * instead.
     */
    @FlaggedApi(Flags.FLAG_DEVICE_PRESENCE)
    @Deprecated
    @RequiresPermission(android.Manifest.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE)
    public void stopObservingDevicePresence(@NonNull String deviceAddress)
            throws DeviceNotAssociatedException {
+6 −2
Original line number Diff line number Diff line
@@ -247,12 +247,14 @@ public abstract class CompanionDeviceService extends Service {
                .detachSystemDataTransport(associationId);
    }

    // TODO(b/315163162) Add @Deprecated keyword after 24Q2 cut.
    /**
     * Called by the system when an associated device is nearby or connected.
     *
     * @param associationInfo A record for the companion device.
     * @deprecated use {@link #onDevicePresenceEvent(DevicePresenceEvent)}} instead.
     */
    @FlaggedApi(Flags.FLAG_DEVICE_PRESENCE)
    @Deprecated
    @MainThread
    public void onDeviceAppeared(@NonNull AssociationInfo associationInfo) {
        if (!associationInfo.isSelfManaged()) {
@@ -260,12 +262,14 @@ public abstract class CompanionDeviceService extends Service {
        }
    }

    // TODO(b/315163162) Add @Deprecated keyword after 24Q2 cut.
    /**
     * Called by the system when an associated device is out of range or disconnected.
     *
     * @param associationInfo A record for the companion device.
     * @deprecated use {@link #onDevicePresenceEvent(DevicePresenceEvent)}} instead.
     */
    @FlaggedApi(Flags.FLAG_DEVICE_PRESENCE)
    @Deprecated
    @MainThread
    public void onDeviceDisappeared(@NonNull AssociationInfo associationInfo) {
        if (!associationInfo.isSelfManaged()) {