Skip to content
Snippets Groups Projects
Commit e9353d38 authored by Narayan Kamath's avatar Narayan Kamath Committed by Android (Google) Code Review
Browse files

Merge "WorkSource: Fix getAttributionUid."

parents 303f84fa cbe06778
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment