Merge "Add ICompanionDeviceManager.getAssociation overload with explicit userId" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0ac8fd7adb
@@ -167,7 +167,7 @@ public final class CompanionDeviceManager {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
try {
|
||||
return mService.getAssociations(mContext.getPackageName());
|
||||
return mService.getAssociations(mContext.getPackageName(), mContext.getUserId());
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ interface ICompanionDeviceManager {
|
||||
in IFindDeviceCallback callback,
|
||||
in String callingPackage);
|
||||
|
||||
List<String> getAssociations(String callingPackage);
|
||||
List<String> getAssociations(String callingPackage, int userId);
|
||||
void disassociate(String deviceMacAddress, String callingPackage);
|
||||
|
||||
//TODO add these
|
||||
|
||||
@@ -113,6 +113,26 @@ public class Preconditions {
|
||||
return reference;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that an object reference passed as a parameter to the calling
|
||||
* method is not null.
|
||||
*
|
||||
* @param reference an object reference
|
||||
* @param messageTemplate a printf-style message template to use if the check fails; will
|
||||
* be converted to a string using {@link String#format(String, Object...)}
|
||||
* @param messageArgs arguments for {@code messageTemplate}
|
||||
* @return the non-null reference that was validated
|
||||
* @throws NullPointerException if {@code reference} is null
|
||||
*/
|
||||
public static @NonNull <T> T checkNotNull(final T reference,
|
||||
final String messageTemplate,
|
||||
final Object... messageArgs) {
|
||||
if (reference == null) {
|
||||
throw new NullPointerException(String.format(messageTemplate, messageArgs));
|
||||
}
|
||||
return reference;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures the truth of an expression involving the state of the calling
|
||||
* instance, but not involving any parameters to the calling method.
|
||||
|
||||
Reference in New Issue
Block a user