Merge "Fix privacy tags based on PWG review meeting." into pi-dev

This commit is contained in:
Yi Jin
2018-03-16 18:18:11 +00:00
committed by Android (Google) Code Review
14 changed files with 93 additions and 103 deletions

View File

@@ -331,7 +331,6 @@ public final class Looper {
final long looperToken = proto.start(fieldId);
proto.write(LooperProto.THREAD_NAME, mThread.getName());
proto.write(LooperProto.THREAD_ID, mThread.getId());
proto.write(LooperProto.IDENTITY_HASH_CODE, System.identityHashCode(this));
mQueue.writeToProto(proto, LooperProto.QUEUE);
proto.end(looperToken);
}

View File

@@ -1643,12 +1643,12 @@ public final class PowerManager {
public void writeToProto(ProtoOutputStream proto, long fieldId) {
synchronized (mToken) {
final long token = proto.start(fieldId);
proto.write(PowerManagerProto.WakeLockProto.HEX_STRING,
Integer.toHexString(System.identityHashCode(this)));
proto.write(PowerManagerProto.WakeLockProto.HELD, mHeld);
proto.write(PowerManagerProto.WakeLockProto.INTERNAL_COUNT, mInternalCount);
proto.write(PowerManagerProto.WakeLock.TAG, mTag);
proto.write(PowerManagerProto.WakeLock.PACKAGE_NAME, mPackageName);
proto.write(PowerManagerProto.WakeLock.HELD, mHeld);
proto.write(PowerManagerProto.WakeLock.INTERNAL_COUNT, mInternalCount);
if (mWorkSource != null) {
mWorkSource.writeToProto(proto, PowerManagerProto.WakeLockProto.WORK_SOURCE);
mWorkSource.writeToProto(proto, PowerManagerProto.WakeLock.WORK_SOURCE);
}
proto.end(token);
}

View File

@@ -32,7 +32,7 @@ message ConfigurationProto {
optional float font_scale = 1;
optional uint32 mcc = 2;
optional uint32 mnc = 3;
optional uint32 mnc = 3 [ (.android.privacy).dest = DEST_EXPLICIT ];
repeated LocaleProto locales = 4;
optional uint32 screen_layout = 5;
optional uint32 color_mode = 6;

View File

@@ -59,7 +59,7 @@ message IntentProto {
optional ComponentNameProto component = 7;
optional string source_bounds = 8;
optional string clip_data = 9 [ (.android.privacy).dest = DEST_EXPLICIT ];
optional string extras = 10 [ (.android.privacy).dest = DEST_EXPLICIT ];
optional string extras = 10 [ (.android.privacy).dest = DEST_LOCAL ];
optional int32 content_user_hint = 11;
optional string selector = 12;
}

View File

@@ -25,8 +25,8 @@ import "frameworks/base/libs/incident/proto/android/privacy.proto";
message LooperProto {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
optional string thread_name = 1 [ (.android.privacy).dest = DEST_EXPLICIT ];
// the thread name, usually set by developers.
optional string thread_name = 1;
optional int64 thread_id = 2;
optional int32 identity_hash_code = 3;
optional android.os.MessageQueueProto queue = 4;
optional android.os.MessageQueueProto queue = 3;
}

View File

@@ -36,13 +36,14 @@ message PowerManagerProto {
}
// WakeLock class in android.os.PowerManager, it is the one used by sdk
message WakeLockProto {
message WakeLock {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
optional string hex_string = 1;
optional bool held = 2;
optional int32 internal_count = 3;
optional WorkSourceProto work_source = 4;
optional string tag = 1;
optional string package_name = 2;
optional bool held = 3;
optional int32 internal_count = 4;
optional WorkSourceProto work_source = 5;
}
}

View File

@@ -157,7 +157,7 @@ message ReceiverListProto {
optional BroadcastRecordProto current = 5;
optional bool linked_to_death = 6;
repeated BroadcastFilterProto filters = 7;
optional string hex_hash = 8; // this hash is used to find the object in IntentResolver
optional string hex_hash = 8; // used to find this ReceiverList object in IntentResolver
}
message ProcessRecordProto {
@@ -184,7 +184,7 @@ message BroadcastFilterProto {
optional .android.content.IntentFilterProto intent_filter = 1;
optional string required_permission = 2;
optional string hex_hash = 3; // used to find the object in IntentResolver
optional string hex_hash = 3; // used to find the BroadcastFilter object in IntentResolver
optional int32 owning_user_id = 4;
}
@@ -458,13 +458,12 @@ message ServiceRecordProto {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
optional string short_name = 1;
optional string hex_hash = 2;
optional bool is_running = 3; // false if the application service is null
optional int32 pid = 4;
optional .android.content.IntentProto intent = 5;
optional string package_name = 6;
optional string process_name = 7;
optional string permission = 8;
optional bool is_running = 2; // false if the application service is null
optional int32 pid = 3;
optional .android.content.IntentProto intent = 4;
optional string package_name = 5;
optional string process_name = 6;
optional string permission = 7;
message AppInfo {
option (.android.msg_privacy).dest = DEST_EXPLICIT;
@@ -473,11 +472,11 @@ message ServiceRecordProto {
optional string res_dir = 2;
optional string data_dir = 3;
}
optional AppInfo appinfo = 9;
optional ProcessRecordProto app = 10;
optional ProcessRecordProto isolated_proc = 11;
optional bool whitelist_manager = 12;
optional bool delayed = 13;
optional AppInfo appinfo = 8;
optional ProcessRecordProto app = 9;
optional ProcessRecordProto isolated_proc = 10;
optional bool whitelist_manager = 11;
optional bool delayed = 12;
message Foreground {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
@@ -485,13 +484,13 @@ message ServiceRecordProto {
optional int32 id = 1;
optional .android.app.NotificationProto notification = 2;
}
optional Foreground foreground = 14;
optional Foreground foreground = 13;
optional .android.util.Duration create_real_time = 15;
optional .android.util.Duration starting_bg_timeout = 16;
optional .android.util.Duration last_activity_time = 17;
optional .android.util.Duration restart_time = 18;
optional bool created_from_fg = 19;
optional .android.util.Duration create_real_time = 14;
optional .android.util.Duration starting_bg_timeout = 15;
optional .android.util.Duration last_activity_time = 16;
optional .android.util.Duration restart_time = 17;
optional bool created_from_fg = 18;
// variables used to track states related to service start
message Start {
@@ -503,7 +502,7 @@ message ServiceRecordProto {
optional bool call_start = 4;
optional int32 last_start_id = 5;
}
optional Start start = 20;
optional Start start = 19;
message ExecuteNesting {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
@@ -512,9 +511,9 @@ message ServiceRecordProto {
optional bool execute_fg = 2;
optional .android.util.Duration executing_start = 3;
}
optional ExecuteNesting execute = 21;
optional ExecuteNesting execute = 20;
optional .android.util.Duration destory_time = 22;
optional .android.util.Duration destory_time = 21;
message Crash {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
@@ -524,9 +523,9 @@ message ServiceRecordProto {
optional .android.util.Duration next_restart_time = 3;
optional int32 crash_count = 4;
}
optional Crash crash = 23;
optional Crash crash = 22;
message StartItemProto {
message StartItem {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
optional int32 id = 1;
@@ -537,17 +536,20 @@ message ServiceRecordProto {
optional NeededUriGrantsProto needed_grants = 6;
optional UriPermissionOwnerProto uri_permissions = 7;
}
repeated StartItemProto delivered_starts = 24;
repeated StartItemProto pending_starts = 25;
repeated StartItem delivered_starts = 23;
repeated StartItem pending_starts = 24;
repeated IntentBindRecordProto bindings = 26;
repeated ConnectionRecordProto connections = 27;
repeated IntentBindRecordProto bindings = 25;
repeated ConnectionRecordProto connections = 26;
// Next Tag: 27
}
message ConnectionRecordProto {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
optional string hex_hash = 1;
// used to find same record, e.g. AppBindRecord has the hex_hash
optional string hex_hash = 1; // cross reference the object and avoid double logging.
optional int32 user_id = 2;
enum Flag {
@@ -570,30 +572,28 @@ message ConnectionRecordProto {
}
repeated Flag flags = 3;
optional string service_name = 4;
optional string conn_hex_hash = 5;
}
message AppBindRecordProto {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
optional string hex_hash = 1;
optional ProcessRecordProto client = 2;
repeated ConnectionRecordProto connections = 3;
optional string service_name = 1;
optional string client_proc_name = 2;
repeated string connections = 3; // hex_hash of ConnectionRecordProto
}
message IntentBindRecordProto {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
optional string hex_hash = 1;
optional bool is_create = 2;
optional .android.content.IntentProto intent = 3;
optional string binder = 4;
optional bool requested = 5;
optional bool received = 6;
optional bool has_bound = 7;
optional bool do_rebind = 8;
optional .android.content.IntentProto intent = 1;
optional string binder = 2;
optional bool auto_create = 3; // value of BIND_AUTO_CREATE flag.
optional bool requested = 4;
optional bool received = 5;
optional bool has_bound = 6;
optional bool do_rebind = 7;
repeated AppBindRecordProto apps = 9;
repeated AppBindRecordProto apps = 8;
}
// TODO: "dumpsys activity --proto processes"
@@ -688,10 +688,10 @@ message ActivityManagerServiceDumpProcessesProto {
optional SleepStatus sleep_status = 27;
message VoiceProto {
option (.android.msg_privacy).dest = DEST_EXPLICIT;
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
optional string session = 1;
optional .android.os.PowerManagerProto.WakeLockProto wakelock = 2;
optional .android.os.PowerManagerProto.WakeLock wakelock = 2;
}
optional VoiceProto running_voice = 28;
@@ -780,8 +780,8 @@ message ActivityManagerServiceDumpProcessesProto {
optional bool call_finish_booting = 44;
optional bool boot_animation_complete = 45;
optional int64 last_power_check_uptime_ms = 46;
optional .android.os.PowerManagerProto.WakeLockProto going_to_sleep = 47;
optional .android.os.PowerManagerProto.WakeLockProto launching_activity = 48;
optional .android.os.PowerManagerProto.WakeLock going_to_sleep = 47;
optional .android.os.PowerManagerProto.WakeLock launching_activity = 48;
optional int32 adj_seq = 49;
optional int32 lru_seq = 50;
optional int32 num_non_cached_procs = 51;
@@ -813,14 +813,13 @@ message ActiveInstrumentationProto {
message UidRecordProto {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
optional string hex_hash = 1;
optional int32 uid = 2;
optional .android.app.ProcessStateEnum current = 3;
optional bool ephemeral = 4;
optional bool fg_services = 5;
optional bool whilelist = 6;
optional .android.util.Duration last_background_time = 7;
optional bool idle = 8;
optional int32 uid = 1;
optional .android.app.ProcessStateEnum current = 2;
optional bool ephemeral = 3;
optional bool fg_services = 4;
optional bool whilelist = 5;
optional .android.util.Duration last_background_time = 6;
optional bool idle = 7;
enum Change {
CHANGE_GONE = 0;
@@ -829,8 +828,8 @@ message UidRecordProto {
CHANGE_CACHED = 3;
CHANGE_UNCACHED = 4;
}
repeated Change last_reported_changes = 9;
optional int32 num_procs = 10;
repeated Change last_reported_changes = 8;
optional int32 num_procs = 9;
message ProcStateSequence {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
@@ -839,7 +838,9 @@ message UidRecordProto {
optional int64 last_network_updated = 2;
optional int64 last_dispatched = 3;
}
optional ProcStateSequence network_state_update = 11;
optional ProcStateSequence network_state_update = 10;
// Next Tag: 11
}
// proto of class ImportanceToken in ActivityManagerService

View File

@@ -24,9 +24,9 @@ import "frameworks/base/libs/incident/proto/android/privacy.proto";
message IntentResolverProto {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
// A mapping bewteen some key string to IntentFilter's toString().
message ArrayMapEntry {
option (.android.msg_privacy).dest = DEST_EXPLICIT;
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
optional string key = 1;
repeated string values = 2;

View File

@@ -37,8 +37,8 @@ message DiskStatsServiceDumpProto {
}
// Whether the latency test resulted in an error
optional bool has_test_error = 1;
// If the test errored, error message is contained here
optional string error_message = 2 [ (android.privacy).dest = DEST_EXPLICIT ];
// If the test errored, error message is contained here, it is just IOException.
optional string error_message = 2;
// 512B write latency in milliseconds, if the test was successful
optional int32 write_512b_latency_millis = 3;
// Free Space in the major partitions

View File

@@ -66,14 +66,13 @@ final class AppBindRecord {
void writeToProto(ProtoOutputStream proto, long fieldId) {
long token = proto.start(fieldId);
proto.write(AppBindRecordProto.HEX_HASH,
Integer.toHexString(System.identityHashCode(this)));
if (client != null) {
client.writeToProto(proto, AppBindRecordProto.CLIENT);
}
proto.write(AppBindRecordProto.SERVICE_NAME, service.shortName);
proto.write(AppBindRecordProto.CLIENT_PROC_NAME, client.processName);
final int N = connections.size();
for (int i=0; i<N; i++) {
connections.valueAt(i).writeToProto(proto, AppBindRecordProto.CONNECTIONS);
ConnectionRecord conn = connections.valueAt(i);
proto.write(AppBindRecordProto.CONNECTIONS,
Integer.toHexString(System.identityHashCode(conn)));
}
proto.end(token);
}

View File

@@ -176,10 +176,6 @@ final class ConnectionRecord {
if (binding.service != null) {
proto.write(ConnectionRecordProto.SERVICE_NAME, binding.service.shortName);
}
if (conn != null) {
proto.write(ConnectionRecordProto.CONN_HEX_HASH,
Integer.toHexString(System.identityHashCode(conn.asBinder())));
}
proto.end(token);
}
}

View File

@@ -113,10 +113,6 @@ final class IntentBindRecord {
public void writeToProto(ProtoOutputStream proto, long fieldId) {
long token = proto.start(fieldId);
proto.write(IntentBindRecordProto.HEX_HASH,
Integer.toHexString(System.identityHashCode(this)));
proto.write(IntentBindRecordProto.IS_CREATE,
(collectFlags()&Context.BIND_AUTO_CREATE) != 0);
if (intent != null) {
intent.getIntent().writeToProto(proto,
IntentBindRecordProto.INTENT, false, true, false, false);
@@ -124,6 +120,8 @@ final class IntentBindRecord {
if (binder != null) {
proto.write(IntentBindRecordProto.BINDER, binder.toString());
}
proto.write(IntentBindRecordProto.AUTO_CREATE,
(collectFlags()&Context.BIND_AUTO_CREATE) != 0);
proto.write(IntentBindRecordProto.REQUESTED, requested);
proto.write(IntentBindRecordProto.RECEIVED, received);
proto.write(IntentBindRecordProto.HAS_BOUND, hasBound);

View File

@@ -164,21 +164,20 @@ final class ServiceRecord extends Binder {
public void writeToProto(ProtoOutputStream proto, long fieldId, long now) {
long token = proto.start(fieldId);
proto.write(ServiceRecordProto.StartItemProto.ID, id);
proto.write(ServiceRecordProto.StartItem.ID, id);
ProtoUtils.toDuration(proto,
ServiceRecordProto.StartItemProto.DURATION, deliveredTime, now);
proto.write(ServiceRecordProto.StartItemProto.DELIVERY_COUNT, deliveryCount);
proto.write(ServiceRecordProto.StartItemProto.DONE_EXECUTING_COUNT, doneExecutingCount);
ServiceRecordProto.StartItem.DURATION, deliveredTime, now);
proto.write(ServiceRecordProto.StartItem.DELIVERY_COUNT, deliveryCount);
proto.write(ServiceRecordProto.StartItem.DONE_EXECUTING_COUNT, doneExecutingCount);
if (intent != null) {
intent.writeToProto(proto, ServiceRecordProto.StartItemProto.INTENT, true, true,
intent.writeToProto(proto, ServiceRecordProto.StartItem.INTENT, true, true,
true, false);
}
if (neededGrants != null) {
neededGrants.writeToProto(proto, ServiceRecordProto.StartItemProto.NEEDED_GRANTS);
neededGrants.writeToProto(proto, ServiceRecordProto.StartItem.NEEDED_GRANTS);
}
if (uriPermissions != null) {
uriPermissions.writeToProto(proto,
ServiceRecordProto.StartItemProto.URI_PERMISSIONS);
uriPermissions.writeToProto(proto, ServiceRecordProto.StartItem.URI_PERMISSIONS);
}
proto.end(token);
}
@@ -236,8 +235,6 @@ final class ServiceRecord extends Binder {
void writeToProto(ProtoOutputStream proto, long fieldId) {
long token = proto.start(fieldId);
proto.write(ServiceRecordProto.SHORT_NAME, this.shortName);
proto.write(ServiceRecordProto.HEX_HASH,
Integer.toHexString(System.identityHashCode(this)));
proto.write(ServiceRecordProto.IS_RUNNING, app != null);
if (app != null) {
proto.write(ServiceRecordProto.PID, app.pid);

View File

@@ -148,7 +148,6 @@ public final class UidRecord {
void writeToProto(ProtoOutputStream proto, long fieldId) {
long token = proto.start(fieldId);
proto.write(UidRecordProto.HEX_HASH, Integer.toHexString(System.identityHashCode(this)));
proto.write(UidRecordProto.UID, uid);
proto.write(UidRecordProto.CURRENT, ProcessList.makeProcStateProtoEnum(curProcState));
proto.write(UidRecordProto.EPHEMERAL, ephemeral);