Loading core/java/android/hardware/location/ContextHubInfo.java +25 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.SystemApi; import android.hardware.contexthub.V1_0.ContextHub; import android.os.Parcel; import android.os.Parcelable; import android.util.proto.ProtoOutputStream; import java.util.Arrays; Loading Loading @@ -270,6 +271,30 @@ public class ContextHubInfo implements Parcelable { return retVal; } /** * Dump the internal state as a ContextHubInfoProto to the given ProtoOutputStream. * * If the output belongs to a sub message, the caller is responsible for wrapping this function * between {@link ProtoOutputStream#start(long)} and {@link ProtoOutputStream#end(long)}. * * @hide */ public void dump(ProtoOutputStream proto) { proto.write(ContextHubInfoProto.ID, mId); proto.write(ContextHubInfoProto.NAME, mName); proto.write(ContextHubInfoProto.VENDOR, mVendor); proto.write(ContextHubInfoProto.TOOLCHAIN, mToolchain); proto.write(ContextHubInfoProto.PLATFORM_VERSION, mPlatformVersion); proto.write(ContextHubInfoProto.STATIC_SW_VERSION, getStaticSwVersion()); proto.write(ContextHubInfoProto.TOOLCHAIN_VERSION, mToolchainVersion); proto.write(ContextHubInfoProto.CHRE_PLATFORM_ID, mChrePlatformId); proto.write(ContextHubInfoProto.PEAK_MIPS, mPeakMips); proto.write(ContextHubInfoProto.STOPPED_POWER_DRAW_MW, mStoppedPowerDrawMw); proto.write(ContextHubInfoProto.SLEEP_POWER_DRAW_MW, mSleepPowerDrawMw); proto.write(ContextHubInfoProto.PEAK_POWER_DRAW_MW, mPeakPowerDrawMw); proto.write(ContextHubInfoProto.MAX_PACKET_LENGTH_BYTES, mMaxPacketLengthBytes); } @Override public boolean equals(@Nullable Object object) { if (object == this) { Loading core/proto/android/hardware/location/context_hub_info.proto 0 → 100644 +49 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ syntax = "proto2"; package android.hardware.location; import "frameworks/base/core/proto/android/privacy.proto"; option java_multiple_files = true; message ContextHubInfoProto { option (android.msg_privacy).dest = DEST_AUTOMATIC; // Context hub unique identifier optional int32 id = 1; // A name for the hub optional string name = 2; // A name for the vendor optional string vendor = 3; // Description of the tool chain optional string toolchain = 4; optional int32 platform_version = 5; optional int32 static_sw_version = 6; optional int32 toolchain_version = 7; // The CHRE platform ID as defined in chre/version.h optional int64 chre_platform_id = 8; // Peak MIPS that this hub can deliver optional float peak_mips = 9; // Power draw in stopped state in milli watts optional float stopped_power_draw_mw = 10; // Power draw in sleep state in milli watts optional float sleep_power_draw_mw = 11; // Peak power draw in milli watts optional float peak_power_draw_mw = 12; // The maximum number of bytes that can be sent per message to the hub optional int32 max_packet_length_bytes = 13; } core/proto/android/os/incident.proto +6 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import "frameworks/base/core/proto/android/server/activitymanagerservice.proto"; import "frameworks/base/core/proto/android/server/alarmmanagerservice.proto"; import "frameworks/base/core/proto/android/server/fingerprint.proto"; import "frameworks/base/core/proto/android/server/jobscheduler.proto"; import "frameworks/base/core/proto/android/server/location/context_hub.proto"; import "frameworks/base/core/proto/android/server/powermanagerservice.proto"; import "frameworks/base/core/proto/android/server/rolemanagerservice.proto"; import "frameworks/base/core/proto/android/server/windowmanagerservice.proto"; Loading Loading @@ -486,6 +487,11 @@ message IncidentProto { (section).args = "connmetrics --proto" ]; optional com.android.server.location.ContextHubServiceProto context_hub = 3051 [ (section).type = SECTION_DUMPSYS, (section).args = "contexthub --proto" ]; // Reserved for OEMs. extensions 50000 to 100000; } core/proto/android/server/location/context_hub.proto 0 → 100644 +60 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ syntax = "proto2"; package com.android.server.location; import "frameworks/base/core/proto/android/hardware/location/context_hub_info.proto"; import "frameworks/base/core/proto/android/privacy.proto"; option java_multiple_files = true; message ContextHubServiceProto { option (.android.msg_privacy).dest = DEST_AUTOMATIC; repeated .android.hardware.location.ContextHubInfoProto context_hub_info = 1; optional ClientManagerProto client_manager = 2; } message ClientManagerProto { option (.android.msg_privacy).dest = DEST_AUTOMATIC; message RegistrationRecord { option (.android.msg_privacy).dest = DEST_AUTOMATIC; optional int64 timestamp_ms = 1; optional int32 action = 2; // ClientBroker endpoint id, contexthub id and package name optional string broker = 3; } repeated ClientBrokerProto client_brokers = 1; repeated RegistrationRecord registration_records = 2; } message ClientBrokerProto { option (.android.msg_privacy).dest = DEST_AUTOMATIC; optional int32 endpoint_id = 1; optional int32 attached_context_hub_id = 2; optional string package = 3; optional int64 nano_app_id = 4; optional bool pending_intent_request_valid = 5; optional bool has_pending_intent = 6; optional bool pending_intent_cancelled = 7; optional bool registered = 8; } services/core/java/com/android/server/location/ContextHubClientBroker.java +23 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.os.Binder; import android.os.IBinder; import android.os.RemoteException; import android.util.Log; import android.util.proto.ProtoOutputStream; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Supplier; Loading Loading @@ -449,6 +450,28 @@ public class ContextHubClientBroker extends IContextHubClient.Stub } } /** * Dump debugging info as ClientBrokerProto * * If the output belongs to a sub message, the caller is responsible for wrapping this function * between {@link ProtoOutputStream#start(long)} and {@link ProtoOutputStream#end(long)}. * * @param proto the ProtoOutputStream to write to */ void dump(ProtoOutputStream proto) { proto.write(ClientBrokerProto.ENDPOINT_ID, getHostEndPointId()); proto.write(ClientBrokerProto.ATTACHED_CONTEXT_HUB_ID, getAttachedContextHubId()); proto.write(ClientBrokerProto.PACKAGE, mPackage); if (mPendingIntentRequest.isValid()) { proto.write(ClientBrokerProto.PENDING_INTENT_REQUEST_VALID, true); proto.write(ClientBrokerProto.NANO_APP_ID, mPendingIntentRequest.getNanoAppId()); } proto.write(ClientBrokerProto.HAS_PENDING_INTENT, mPendingIntentRequest.hasPendingIntent()); proto.write(ClientBrokerProto.PENDING_INTENT_CANCELLED, isPendingIntentCancelled()); proto.write(ClientBrokerProto.REGISTERED, mRegistered); } @Override public String toString() { String out = "[ContextHubClient "; Loading Loading
core/java/android/hardware/location/ContextHubInfo.java +25 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.SystemApi; import android.hardware.contexthub.V1_0.ContextHub; import android.os.Parcel; import android.os.Parcelable; import android.util.proto.ProtoOutputStream; import java.util.Arrays; Loading Loading @@ -270,6 +271,30 @@ public class ContextHubInfo implements Parcelable { return retVal; } /** * Dump the internal state as a ContextHubInfoProto to the given ProtoOutputStream. * * If the output belongs to a sub message, the caller is responsible for wrapping this function * between {@link ProtoOutputStream#start(long)} and {@link ProtoOutputStream#end(long)}. * * @hide */ public void dump(ProtoOutputStream proto) { proto.write(ContextHubInfoProto.ID, mId); proto.write(ContextHubInfoProto.NAME, mName); proto.write(ContextHubInfoProto.VENDOR, mVendor); proto.write(ContextHubInfoProto.TOOLCHAIN, mToolchain); proto.write(ContextHubInfoProto.PLATFORM_VERSION, mPlatformVersion); proto.write(ContextHubInfoProto.STATIC_SW_VERSION, getStaticSwVersion()); proto.write(ContextHubInfoProto.TOOLCHAIN_VERSION, mToolchainVersion); proto.write(ContextHubInfoProto.CHRE_PLATFORM_ID, mChrePlatformId); proto.write(ContextHubInfoProto.PEAK_MIPS, mPeakMips); proto.write(ContextHubInfoProto.STOPPED_POWER_DRAW_MW, mStoppedPowerDrawMw); proto.write(ContextHubInfoProto.SLEEP_POWER_DRAW_MW, mSleepPowerDrawMw); proto.write(ContextHubInfoProto.PEAK_POWER_DRAW_MW, mPeakPowerDrawMw); proto.write(ContextHubInfoProto.MAX_PACKET_LENGTH_BYTES, mMaxPacketLengthBytes); } @Override public boolean equals(@Nullable Object object) { if (object == this) { Loading
core/proto/android/hardware/location/context_hub_info.proto 0 → 100644 +49 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ syntax = "proto2"; package android.hardware.location; import "frameworks/base/core/proto/android/privacy.proto"; option java_multiple_files = true; message ContextHubInfoProto { option (android.msg_privacy).dest = DEST_AUTOMATIC; // Context hub unique identifier optional int32 id = 1; // A name for the hub optional string name = 2; // A name for the vendor optional string vendor = 3; // Description of the tool chain optional string toolchain = 4; optional int32 platform_version = 5; optional int32 static_sw_version = 6; optional int32 toolchain_version = 7; // The CHRE platform ID as defined in chre/version.h optional int64 chre_platform_id = 8; // Peak MIPS that this hub can deliver optional float peak_mips = 9; // Power draw in stopped state in milli watts optional float stopped_power_draw_mw = 10; // Power draw in sleep state in milli watts optional float sleep_power_draw_mw = 11; // Peak power draw in milli watts optional float peak_power_draw_mw = 12; // The maximum number of bytes that can be sent per message to the hub optional int32 max_packet_length_bytes = 13; }
core/proto/android/os/incident.proto +6 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import "frameworks/base/core/proto/android/server/activitymanagerservice.proto"; import "frameworks/base/core/proto/android/server/alarmmanagerservice.proto"; import "frameworks/base/core/proto/android/server/fingerprint.proto"; import "frameworks/base/core/proto/android/server/jobscheduler.proto"; import "frameworks/base/core/proto/android/server/location/context_hub.proto"; import "frameworks/base/core/proto/android/server/powermanagerservice.proto"; import "frameworks/base/core/proto/android/server/rolemanagerservice.proto"; import "frameworks/base/core/proto/android/server/windowmanagerservice.proto"; Loading Loading @@ -486,6 +487,11 @@ message IncidentProto { (section).args = "connmetrics --proto" ]; optional com.android.server.location.ContextHubServiceProto context_hub = 3051 [ (section).type = SECTION_DUMPSYS, (section).args = "contexthub --proto" ]; // Reserved for OEMs. extensions 50000 to 100000; }
core/proto/android/server/location/context_hub.proto 0 → 100644 +60 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ syntax = "proto2"; package com.android.server.location; import "frameworks/base/core/proto/android/hardware/location/context_hub_info.proto"; import "frameworks/base/core/proto/android/privacy.proto"; option java_multiple_files = true; message ContextHubServiceProto { option (.android.msg_privacy).dest = DEST_AUTOMATIC; repeated .android.hardware.location.ContextHubInfoProto context_hub_info = 1; optional ClientManagerProto client_manager = 2; } message ClientManagerProto { option (.android.msg_privacy).dest = DEST_AUTOMATIC; message RegistrationRecord { option (.android.msg_privacy).dest = DEST_AUTOMATIC; optional int64 timestamp_ms = 1; optional int32 action = 2; // ClientBroker endpoint id, contexthub id and package name optional string broker = 3; } repeated ClientBrokerProto client_brokers = 1; repeated RegistrationRecord registration_records = 2; } message ClientBrokerProto { option (.android.msg_privacy).dest = DEST_AUTOMATIC; optional int32 endpoint_id = 1; optional int32 attached_context_hub_id = 2; optional string package = 3; optional int64 nano_app_id = 4; optional bool pending_intent_request_valid = 5; optional bool has_pending_intent = 6; optional bool pending_intent_cancelled = 7; optional bool registered = 8; }
services/core/java/com/android/server/location/ContextHubClientBroker.java +23 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.os.Binder; import android.os.IBinder; import android.os.RemoteException; import android.util.Log; import android.util.proto.ProtoOutputStream; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Supplier; Loading Loading @@ -449,6 +450,28 @@ public class ContextHubClientBroker extends IContextHubClient.Stub } } /** * Dump debugging info as ClientBrokerProto * * If the output belongs to a sub message, the caller is responsible for wrapping this function * between {@link ProtoOutputStream#start(long)} and {@link ProtoOutputStream#end(long)}. * * @param proto the ProtoOutputStream to write to */ void dump(ProtoOutputStream proto) { proto.write(ClientBrokerProto.ENDPOINT_ID, getHostEndPointId()); proto.write(ClientBrokerProto.ATTACHED_CONTEXT_HUB_ID, getAttachedContextHubId()); proto.write(ClientBrokerProto.PACKAGE, mPackage); if (mPendingIntentRequest.isValid()) { proto.write(ClientBrokerProto.PENDING_INTENT_REQUEST_VALID, true); proto.write(ClientBrokerProto.NANO_APP_ID, mPendingIntentRequest.getNanoAppId()); } proto.write(ClientBrokerProto.HAS_PENDING_INTENT, mPendingIntentRequest.hasPendingIntent()); proto.write(ClientBrokerProto.PENDING_INTENT_CANCELLED, isPendingIntentCancelled()); proto.write(ClientBrokerProto.REGISTERED, mRegistered); } @Override public String toString() { String out = "[ContextHubClient "; Loading