Loading core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -9676,6 +9676,7 @@ package android.companion { method @Deprecated @NonNull public java.util.List<java.lang.String> getAssociations(); method @NonNull public java.util.List<android.companion.AssociationInfo> getMyAssociations(); method @Deprecated public boolean hasNotificationAccess(android.content.ComponentName); method @FlaggedApi("android.companion.perm_sync_user_consent") public boolean isPermissionTransferUserConsented(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; core/java/android/companion/CompanionDeviceManager.java +30 −0 Original line number Diff line number Diff line Loading @@ -1357,6 +1357,36 @@ public final class CompanionDeviceManager { } } /** * Return the current state of consent for permission transfer for the association. * True if the user has allowed permission transfer for the association, false otherwise. * * <p> * Note: The initial user consent is collected via * {@link #buildPermissionTransferUserConsentIntent(int) a permission transfer user consent dialog}. * After the user has made their initial selection, they can toggle the permission transfer * feature in the settings. * This method always returns the state of the toggle setting. * </p> * * @param associationId The unique {@link AssociationInfo#getId ID} assigned to the association * of the companion device recorded by CompanionDeviceManager * @return True if the user has consented to the permission transfer, or false otherwise. * @throws DeviceNotAssociatedException Exception if the companion device is not associated with * the user or the calling app. */ @UserHandleAware @FlaggedApi(Flags.FLAG_PERM_SYNC_USER_CONSENT) public boolean isPermissionTransferUserConsented(int associationId) { try { return mService.isPermissionTransferUserConsented(mContext.getOpPackageName(), mContext.getUserId(), associationId); } catch (RemoteException e) { ExceptionUtils.propagateIfInstanceOf(e.getCause(), DeviceNotAssociatedException.class); throw e.rethrowFromSystemServer(); } } /** * Start system data transfer which has been previously approved by the user. * Loading core/java/android/companion/ICompanionDeviceManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,8 @@ interface ICompanionDeviceManager { PendingIntent buildPermissionTransferUserConsentIntent(String callingPackage, int userId, int associationId); boolean isPermissionTransferUserConsented(String callingPackage, int userId, int associationId); void startSystemDataTransfer(String packageName, int userId, int associationId, in ISystemDataTransferCallback callback); Loading core/java/android/companion/flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -27,3 +27,10 @@ flag { description: "Enable device presence APIs" bug: "283000075" } flag { name: "perm_sync_user_consent" namespace: "companion" description: "Expose perm sync user consent API" bug: "309528663" } No newline at end of file services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java +7 −0 Original line number Diff line number Diff line Loading @@ -832,6 +832,13 @@ public class CompanionDeviceManagerService extends SystemService { packageName, userId, associationId); } @Override public boolean isPermissionTransferUserConsented(String packageName, int userId, int associationId) { return mSystemDataTransferProcessor.isPermissionTransferUserConsented(packageName, userId, associationId); } @Override public void startSystemDataTransfer(String packageName, int userId, int associationId, ISystemDataTransferCallback callback) { Loading Loading
core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -9676,6 +9676,7 @@ package android.companion { method @Deprecated @NonNull public java.util.List<java.lang.String> getAssociations(); method @NonNull public java.util.List<android.companion.AssociationInfo> getMyAssociations(); method @Deprecated public boolean hasNotificationAccess(android.content.ComponentName); method @FlaggedApi("android.companion.perm_sync_user_consent") public boolean isPermissionTransferUserConsented(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;
core/java/android/companion/CompanionDeviceManager.java +30 −0 Original line number Diff line number Diff line Loading @@ -1357,6 +1357,36 @@ public final class CompanionDeviceManager { } } /** * Return the current state of consent for permission transfer for the association. * True if the user has allowed permission transfer for the association, false otherwise. * * <p> * Note: The initial user consent is collected via * {@link #buildPermissionTransferUserConsentIntent(int) a permission transfer user consent dialog}. * After the user has made their initial selection, they can toggle the permission transfer * feature in the settings. * This method always returns the state of the toggle setting. * </p> * * @param associationId The unique {@link AssociationInfo#getId ID} assigned to the association * of the companion device recorded by CompanionDeviceManager * @return True if the user has consented to the permission transfer, or false otherwise. * @throws DeviceNotAssociatedException Exception if the companion device is not associated with * the user or the calling app. */ @UserHandleAware @FlaggedApi(Flags.FLAG_PERM_SYNC_USER_CONSENT) public boolean isPermissionTransferUserConsented(int associationId) { try { return mService.isPermissionTransferUserConsented(mContext.getOpPackageName(), mContext.getUserId(), associationId); } catch (RemoteException e) { ExceptionUtils.propagateIfInstanceOf(e.getCause(), DeviceNotAssociatedException.class); throw e.rethrowFromSystemServer(); } } /** * Start system data transfer which has been previously approved by the user. * Loading
core/java/android/companion/ICompanionDeviceManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,8 @@ interface ICompanionDeviceManager { PendingIntent buildPermissionTransferUserConsentIntent(String callingPackage, int userId, int associationId); boolean isPermissionTransferUserConsented(String callingPackage, int userId, int associationId); void startSystemDataTransfer(String packageName, int userId, int associationId, in ISystemDataTransferCallback callback); Loading
core/java/android/companion/flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -27,3 +27,10 @@ flag { description: "Enable device presence APIs" bug: "283000075" } flag { name: "perm_sync_user_consent" namespace: "companion" description: "Expose perm sync user consent API" bug: "309528663" } No newline at end of file
services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java +7 −0 Original line number Diff line number Diff line Loading @@ -832,6 +832,13 @@ public class CompanionDeviceManagerService extends SystemService { packageName, userId, associationId); } @Override public boolean isPermissionTransferUserConsented(String packageName, int userId, int associationId) { return mSystemDataTransferProcessor.isPermissionTransferUserConsented(packageName, userId, associationId); } @Override public void startSystemDataTransfer(String packageName, int userId, int associationId, ISystemDataTransferCallback callback) { Loading