diff options
| author | 2017-12-29 12:54:34 +0000 | |
|---|---|---|
| committer | 2017-12-29 12:54:34 +0000 | |
| commit | e9353d38bdf1e3525cf152c53ca962f2bdd57e37 (patch) | |
| tree | fea45a7a03d4220ce371edefc7ac55701dbb28a3 | |
| parent | 303f84faa40ab22a5016633ca33a940a1b02d982 (diff) | |
| parent | cbe06778dd5ee32a108278d5ac710105e8ae1358 (diff) | |
Merge "WorkSource: Fix getAttributionUid."
| -rw-r--r-- | core/java/android/os/WorkSource.java | 6 | ||||
| -rw-r--r-- | core/tests/coretests/src/android/os/WorkSourceTest.java | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/core/java/android/os/WorkSource.java b/core/java/android/os/WorkSource.java index e9d4fe82cec2..21bd6a873e32 100644 --- a/core/java/android/os/WorkSource.java +++ b/core/java/android/os/WorkSource.java @@ -853,11 +853,11 @@ public class WorkSource implements Parcelable { } /** - * Return the UID to which this WorkChain should be attributed to, i.e, the UID performing - * the actual work. + * Return the UID to which this WorkChain should be attributed to, i.e, the UID that + * initiated the work and not the UID performing it. */ public int getAttributionUid() { - return mUids[mSize - 1]; + return mUids[0]; } // TODO: The following three trivial getters are purely for testing and will be removed diff --git a/core/tests/coretests/src/android/os/WorkSourceTest.java b/core/tests/coretests/src/android/os/WorkSourceTest.java index e2f800fb7db3..90b457561180 100644 --- a/core/tests/coretests/src/android/os/WorkSourceTest.java +++ b/core/tests/coretests/src/android/os/WorkSourceTest.java @@ -322,4 +322,13 @@ public class WorkSourceTest extends TestCase { assertEquals(new WorkChain().addNode(0, "tag0"), diffs[1].get(0)); assertEquals(new WorkChain().addNode(2, "tag2"), diffs[1].get(1)); } + + public void testGetAttributionId() { + WorkSource ws1 = new WorkSource(); + WorkChain wc = ws1.createWorkChain(); + wc.addNode(100, "tag"); + assertEquals(100, wc.getAttributionUid()); + wc.addNode(200, "tag2"); + assertEquals(100, wc.getAttributionUid()); + } } |