Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -8224,6 +8224,8 @@ package android.companion { public final class CompanionDeviceManager { method public void associate(android.companion.AssociationRequest<?>, android.companion.CompanionDeviceManager.Callback, android.os.Handler); method public void disassociate(java.lang.String); method public java.util.List<java.lang.String> getAssociations(); field public static final java.lang.String EXTRA_DEVICE = "android.companion.extra.DEVICE"; } api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -8724,6 +8724,8 @@ package android.companion { public final class CompanionDeviceManager { method public void associate(android.companion.AssociationRequest<?>, android.companion.CompanionDeviceManager.Callback, android.os.Handler); method public void disassociate(java.lang.String); method public java.util.List<java.lang.String> getAssociations(); field public static final java.lang.String EXTRA_DEVICE = "android.companion.extra.DEVICE"; } api/test-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -8251,6 +8251,8 @@ package android.companion { public final class CompanionDeviceManager { method public void associate(android.companion.AssociationRequest<?>, android.companion.CompanionDeviceManager.Callback, android.os.Handler); method public void disassociate(java.lang.String); method public java.util.List<java.lang.String> getAssociations(); field public static final java.lang.String EXTRA_DEVICE = "android.companion.extra.DEVICE"; } core/java/android/companion/CompanionDeviceManager.java +41 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import android.os.Handler; import android.os.Looper; import android.os.RemoteException; import java.util.List; /** * System level service for managing companion devices * Loading Loading @@ -102,6 +104,11 @@ public final class CompanionDeviceManager { * special capabilities have a negative effect on the device's battery and user's data * usage, therefore you should requested them when absolutely necessary.</p> * * <p>You can call {@link #getAssociations} to get the list of currently associated * devices, and {@link #disassociate} to remove an association. Consider doing so when the * association is no longer relevant to avoid unnecessary battery and/or data drain resulting * from special privileges that the association provides</p> * * @param request specific details about this request * @param callback will be called once there's at least one device found for user to choose from * @param handler A handler to control which thread the callback will be delivered on, or null, Loading @@ -119,6 +126,8 @@ public final class CompanionDeviceManager { try { mService.associate( request, //TODO implicit pointer to outer class -> =null onDestroy //TODO onStop if isFinishing -> stopScan new IFindDeviceCallback.Stub() { @Override public void onSuccess(PendingIntent launcher) { Loading @@ -138,6 +147,38 @@ public final class CompanionDeviceManager { } } /** * @return a list of MAC addresses of devices that have been previously associated with the * current app. You can use these with {@link #disassociate} */ @NonNull public List<String> getAssociations() { try { return mService.getAssociations(mContext.getPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Remove the association between this app and the device with the given mac address. * * <p>Any privileges provided via being associated with a given device will be revoked</p> * * <p>Consider doing so when the * association is no longer relevant to avoid unnecessary battery and/or data drain resulting * from special privileges that the association provides</p> * * @param deviceMacAddress the MAC address of device to disassociate from this app */ public void disassociate(@NonNull String deviceMacAddress) { try { mService.disassociate(deviceMacAddress, mContext.getPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** @hide */ public void requestNotificationAccess() { //TODO implement Loading core/java/android/companion/ICompanionDeviceDiscoveryService.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.companion.AssociationRequest; import android.companion.ICompanionDeviceDiscoveryServiceCallback; import android.companion.IFindDeviceCallback; /** @hide */ interface ICompanionDeviceDiscoveryService { void startDiscovery( Loading Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -8224,6 +8224,8 @@ package android.companion { public final class CompanionDeviceManager { method public void associate(android.companion.AssociationRequest<?>, android.companion.CompanionDeviceManager.Callback, android.os.Handler); method public void disassociate(java.lang.String); method public java.util.List<java.lang.String> getAssociations(); field public static final java.lang.String EXTRA_DEVICE = "android.companion.extra.DEVICE"; }
api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -8724,6 +8724,8 @@ package android.companion { public final class CompanionDeviceManager { method public void associate(android.companion.AssociationRequest<?>, android.companion.CompanionDeviceManager.Callback, android.os.Handler); method public void disassociate(java.lang.String); method public java.util.List<java.lang.String> getAssociations(); field public static final java.lang.String EXTRA_DEVICE = "android.companion.extra.DEVICE"; }
api/test-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -8251,6 +8251,8 @@ package android.companion { public final class CompanionDeviceManager { method public void associate(android.companion.AssociationRequest<?>, android.companion.CompanionDeviceManager.Callback, android.os.Handler); method public void disassociate(java.lang.String); method public java.util.List<java.lang.String> getAssociations(); field public static final java.lang.String EXTRA_DEVICE = "android.companion.extra.DEVICE"; }
core/java/android/companion/CompanionDeviceManager.java +41 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import android.os.Handler; import android.os.Looper; import android.os.RemoteException; import java.util.List; /** * System level service for managing companion devices * Loading Loading @@ -102,6 +104,11 @@ public final class CompanionDeviceManager { * special capabilities have a negative effect on the device's battery and user's data * usage, therefore you should requested them when absolutely necessary.</p> * * <p>You can call {@link #getAssociations} to get the list of currently associated * devices, and {@link #disassociate} to remove an association. Consider doing so when the * association is no longer relevant to avoid unnecessary battery and/or data drain resulting * from special privileges that the association provides</p> * * @param request specific details about this request * @param callback will be called once there's at least one device found for user to choose from * @param handler A handler to control which thread the callback will be delivered on, or null, Loading @@ -119,6 +126,8 @@ public final class CompanionDeviceManager { try { mService.associate( request, //TODO implicit pointer to outer class -> =null onDestroy //TODO onStop if isFinishing -> stopScan new IFindDeviceCallback.Stub() { @Override public void onSuccess(PendingIntent launcher) { Loading @@ -138,6 +147,38 @@ public final class CompanionDeviceManager { } } /** * @return a list of MAC addresses of devices that have been previously associated with the * current app. You can use these with {@link #disassociate} */ @NonNull public List<String> getAssociations() { try { return mService.getAssociations(mContext.getPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Remove the association between this app and the device with the given mac address. * * <p>Any privileges provided via being associated with a given device will be revoked</p> * * <p>Consider doing so when the * association is no longer relevant to avoid unnecessary battery and/or data drain resulting * from special privileges that the association provides</p> * * @param deviceMacAddress the MAC address of device to disassociate from this app */ public void disassociate(@NonNull String deviceMacAddress) { try { mService.disassociate(deviceMacAddress, mContext.getPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** @hide */ public void requestNotificationAccess() { //TODO implement Loading
core/java/android/companion/ICompanionDeviceDiscoveryService.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.companion.AssociationRequest; import android.companion.ICompanionDeviceDiscoveryServiceCallback; import android.companion.IFindDeviceCallback; /** @hide */ interface ICompanionDeviceDiscoveryService { void startDiscovery( Loading