StatsMapKey.java - uid U32 -> S32
The kernel is actually not consistent in whether uids & gids
are signed or unsigned, and neither is our Java code, which
also commonly uses just 'int' for uid. In practice values
greater or equal to 2**31 often don't quite work right.
For example icmp sockets are enabled via a sysctl that
takes a minimum and maximum gid - and these are signed int32s.
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I891c209c3b5a800b5d31c4f5ae83879fec980d02
diff --git a/service-t/src/com/android/server/net/StatsMapKey.java b/service-t/src/com/android/server/net/StatsMapKey.java
index a26fa5b..44269b3 100644
--- a/service-t/src/com/android/server/net/StatsMapKey.java
+++ b/service-t/src/com/android/server/net/StatsMapKey.java
@@ -24,8 +24,8 @@
* Key for both stats maps.
*/
public class StatsMapKey extends Struct {
- @Field(order = 0, type = Type.U32)
- public final long uid;
+ @Field(order = 0, type = Type.S32)
+ public final int uid;
@Field(order = 1, type = Type.U32)
public final long tag;
@@ -36,7 +36,7 @@
@Field(order = 3, type = Type.S32)
public final int ifaceIndex;
- public StatsMapKey(final long uid, final long tag, final long counterSet,
+ public StatsMapKey(final int uid, final long tag, final long counterSet,
final int ifaceIndex) {
this.uid = uid;
this.tag = tag;