Update dabase manager to store the uid

Also update the AppInfo to store the uid

Bug: 74022362
Test: RunSettingsRoboTests
Change-Id: I373242a12e9dbf48be134f2e9be30831b09f91c9
This commit is contained in:
jackqdyulei
2018-02-28 16:49:25 -08:00
committed by Lei Yu
parent 106825383a
commit 36249c6254
5 changed files with 35 additions and 15 deletions

View File

@@ -33,11 +33,13 @@ public class AppInfo implements Comparable<AppInfo>, Parcelable {
*/
public final int anomalyType;
public final long screenOnTimeMs;
public final int uid;
private AppInfo(AppInfo.Builder builder) {
packageName = builder.mPackageName;
anomalyType = builder.mAnomalyType;
screenOnTimeMs = builder.mScreenOnTimeMs;
uid = builder.mUid;
}
@VisibleForTesting
@@ -45,6 +47,7 @@ public class AppInfo implements Comparable<AppInfo>, Parcelable {
packageName = in.readString();
anomalyType = in.readInt();
screenOnTimeMs = in.readLong();
uid = in.readInt();
}
@Override
@@ -62,6 +65,7 @@ public class AppInfo implements Comparable<AppInfo>, Parcelable {
dest.writeString(packageName);
dest.writeInt(anomalyType);
dest.writeLong(screenOnTimeMs);
dest.writeInt(uid);
}
public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
@@ -78,6 +82,7 @@ public class AppInfo implements Comparable<AppInfo>, Parcelable {
private int mAnomalyType;
private String mPackageName;
private long mScreenOnTimeMs;
private int mUid;
public Builder setAnomalyType(int type) {
mAnomalyType = type;
@@ -94,6 +99,11 @@ public class AppInfo implements Comparable<AppInfo>, Parcelable {
return this;
}
public Builder setUid(int uid) {
mUid = uid;
return this;
}
public AppInfo build() {
return new AppInfo(this);
}