Account info on job wakelocks

Adds account information to wakelock
names for JobScheduler jobs.

Bug: 28321515
Change-Id: Ifaf289c2a9a11843769a3b40eea57d93dbd7d075
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java
index 8af0af0..071f510 100644
--- a/services/core/java/com/android/server/content/SyncManager.java
+++ b/services/core/java/com/android/server/content/SyncManager.java
@@ -1300,7 +1300,7 @@
         }
 
         getJobScheduler().scheduleAsPackage(b.build(), syncOperation.owningPackage,
-                syncOperation.target.userId, "sync");
+                syncOperation.target.userId, syncOperation.wakeLockName());
     }
 
     /**
diff --git a/services/core/java/com/android/server/job/controllers/JobStatus.java b/services/core/java/com/android/server/job/controllers/JobStatus.java
index 39905d8..2d09524 100644
--- a/services/core/java/com/android/server/job/controllers/JobStatus.java
+++ b/services/core/java/com/android/server/job/controllers/JobStatus.java
@@ -138,19 +138,9 @@
             this.sourceTag = tag;
         }
 
-        if (this.sourceTag != null) {
-            StringBuilder sb = new StringBuilder();
-            sb.append(job.getService().getPackageName());
-            sb.append('/');
-            sb.append(this.sourceTag);
-            if (sourcePackageName != null) {
-                sb.append('/');
-                sb.append(this.sourcePackageName);
-            }
-            this.batteryName = sb.toString();
-        } else {
-            this.batteryName = job.getService().flattenToShortString();
-        }
+        this.batteryName = this.sourceTag != null
+                ? this.sourceTag + ":" + job.getService().getPackageName()
+                : job.getService().flattenToShortString();
         this.tag = "*job*/" + this.batteryName;
 
         this.earliestRunTimeElapsedMillis = earliestRunTimeElapsedMillis;