Merge "Make ContextHubClient.getId() return a 16-bit value"
This commit is contained in:
committed by
Android (Google) Code Review
commit
9ee529d8e0
@@ -4154,7 +4154,7 @@ package android.hardware.location {
|
||||
public class ContextHubClient implements java.io.Closeable {
|
||||
method public void close();
|
||||
method @NonNull public android.hardware.location.ContextHubInfo getAttachedHub();
|
||||
method public int getId();
|
||||
method @IntRange(from=0, to=65535) public int getId();
|
||||
method @RequiresPermission(android.Manifest.permission.ACCESS_CONTEXT_HUB) public int sendMessageToNanoApp(@NonNull android.hardware.location.NanoAppMessage);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package android.hardware.location;
|
||||
|
||||
import android.annotation.IntRange;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.RequiresPermission;
|
||||
import android.annotation.SystemApi;
|
||||
@@ -118,13 +119,14 @@ public class ContextHubClient implements Closeable {
|
||||
* is newly generated (e.g. any regeneration of a callback client, or generation
|
||||
* of a non-equal PendingIntent client), the ID will not be the same.
|
||||
*
|
||||
* @return The ID of this ContextHubClient.
|
||||
* @return The ID of this ContextHubClient, in the range [0, 65535].
|
||||
*/
|
||||
@IntRange(from = 0, to = 65535)
|
||||
public int getId() {
|
||||
if (mId == null) {
|
||||
throw new IllegalStateException("ID was not set");
|
||||
}
|
||||
return mId;
|
||||
return (0x0000FFFF & mId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user