Java Code Examples for android.util.proto.ProtoOutputStream#end()
The following examples show how to use
android.util.proto.ProtoOutputStream#end() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IdleController.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
@Override public void dumpControllerStateLocked(ProtoOutputStream proto, long fieldId, Predicate<JobStatus> predicate) { final long token = proto.start(fieldId); final long mToken = proto.start(StateControllerProto.IDLE); proto.write(StateControllerProto.IdleController.IS_IDLE, mIdleTracker.isIdle()); for (int i = 0; i < mTrackedTasks.size(); i++) { final JobStatus js = mTrackedTasks.valueAt(i); if (!predicate.test(js)) { continue; } final long jsToken = proto.start(StateControllerProto.IdleController.TRACKED_JOBS); js.writeToShortProto(proto, StateControllerProto.IdleController.TrackedJob.INFO); proto.write(StateControllerProto.IdleController.TrackedJob.SOURCE_UID, js.getSourceUid()); proto.end(jsToken); } proto.end(mToken); proto.end(token); }
Example 2
Source File: Configuration.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * Write full {@link android.content.ResourcesConfigurationProto} to protocol buffer output * stream. * * @param protoOutputStream Stream to write the Configuration object to. * @param fieldId Field Id of the Configuration as defined in the parent message * @param metrics Current display information * @hide */ public void writeResConfigToProto(ProtoOutputStream protoOutputStream, long fieldId, DisplayMetrics metrics) { final int width, height; if (metrics.widthPixels >= metrics.heightPixels) { width = metrics.widthPixels; height = metrics.heightPixels; } else { //noinspection SuspiciousNameCombination width = metrics.heightPixels; //noinspection SuspiciousNameCombination height = metrics.widthPixels; } final long token = protoOutputStream.start(fieldId); writeToProto(protoOutputStream, CONFIGURATION); protoOutputStream.write(SDK_VERSION, Build.VERSION.RESOURCES_SDK_INT); protoOutputStream.write(SCREEN_WIDTH_PX, width); protoOutputStream.write(SCREEN_HEIGHT_PX, height); protoOutputStream.end(token); }
Example 3
Source File: AlarmManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
public void writeToProto(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); proto.write(InFlightProto.UID, mUid); proto.write(InFlightProto.TAG, mTag); proto.write(InFlightProto.WHEN_ELAPSED_MS, mWhenElapsed); proto.write(InFlightProto.ALARM_TYPE, mAlarmType); if (mPendingIntent != null) { mPendingIntent.writeToProto(proto, InFlightProto.PENDING_INTENT); } if (mBroadcastStats != null) { mBroadcastStats.writeToProto(proto, InFlightProto.BROADCAST_STATS); } if (mFilterStats != null) { mFilterStats.writeToProto(proto, InFlightProto.FILTER_STATS); } if (mWorkSource != null) { mWorkSource.writeToProto(proto, InFlightProto.WORK_SOURCE); } proto.end(token); }
Example 4
Source File: Task.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
@CallSuper @Override public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) { final long token = proto.start(fieldId); super.writeToProto(proto, WINDOW_CONTAINER, trim); proto.write(ID, mTaskId); for (int i = mChildren.size() - 1; i >= 0; i--) { final AppWindowToken appWindowToken = mChildren.get(i); appWindowToken.writeToProto(proto, APP_WINDOW_TOKENS, trim); } proto.write(FILLS_PARENT, matchParentBounds()); getBounds().writeToProto(proto, BOUNDS); mTempInsetBounds.writeToProto(proto, TEMP_INSET_BOUNDS); proto.write(DEFER_REMOVAL, mDeferRemoval); proto.end(token); }
Example 5
Source File: Bundle.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** @hide */ public void writeToProto(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); if (mParcelledData != null) { if (isEmptyParcel()) { proto.write(BundleProto.PARCELLED_DATA_SIZE, 0); } else { proto.write(BundleProto.PARCELLED_DATA_SIZE, mParcelledData.dataSize()); } } else { proto.write(BundleProto.MAP_DATA, mMap.toString()); } proto.end(token); }
Example 6
Source File: ConnectivityController.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@GuardedBy("mLock") @Override public void dumpControllerStateLocked(ProtoOutputStream proto, long fieldId, Predicate<JobStatus> predicate) { final long token = proto.start(fieldId); final long mToken = proto.start(StateControllerProto.CONNECTIVITY); for (int i = 0; i < mTrackedJobs.size(); i++) { final JobStatus js = mTrackedJobs.valueAt(i); if (!predicate.test(js)) { continue; } final long jsToken = proto.start(StateControllerProto.ConnectivityController.TRACKED_JOBS); js.writeToShortProto(proto, StateControllerProto.ConnectivityController.TrackedJob.INFO); proto.write(StateControllerProto.ConnectivityController.TrackedJob.SOURCE_UID, js.getSourceUid()); NetworkRequest rn = js.getJob().getRequiredNetwork(); if (rn != null) { rn.writeToProto(proto, StateControllerProto.ConnectivityController.TrackedJob.REQUIRED_NETWORK); } proto.end(jsToken); } proto.end(mToken); proto.end(token); }
Example 7
Source File: ActivityRecord.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public void writeToProto(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); super.writeToProto(proto, CONFIGURATION_CONTAINER, false /* trim */); writeIdentifierToProto(proto, IDENTIFIER); proto.write(STATE, mState.toString()); proto.write(VISIBLE, visible); proto.write(FRONT_OF_TASK, frontOfTask); if (app != null) { proto.write(PROC_ID, app.pid); } proto.write(TRANSLUCENT, !fullscreen); proto.end(token); }
Example 8
Source File: NetworkRequest.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** @hide */ public void writeToProto(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); proto.write(NetworkRequestProto.TYPE, typeToProtoEnum(type)); proto.write(NetworkRequestProto.REQUEST_ID, requestId); proto.write(NetworkRequestProto.LEGACY_TYPE, legacyType); networkCapabilities.writeToProto(proto, NetworkRequestProto.NETWORK_CAPABILITIES); proto.end(token); }
Example 9
Source File: PackageSetting.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public void writeToProto(ProtoOutputStream proto, long fieldId, List<UserInfo> users) { final long packageToken = proto.start(fieldId); proto.write(PackageProto.NAME, (realName != null ? realName : name)); proto.write(PackageProto.UID, appId); proto.write(PackageProto.VERSION_CODE, versionCode); proto.write(PackageProto.VERSION_STRING, pkg.mVersionName); proto.write(PackageProto.INSTALL_TIME_MS, firstInstallTime); proto.write(PackageProto.UPDATE_TIME_MS, lastUpdateTime); proto.write(PackageProto.INSTALLER_NAME, installerPackageName); if (pkg != null) { long splitToken = proto.start(PackageProto.SPLITS); proto.write(PackageProto.SplitProto.NAME, "base"); proto.write(PackageProto.SplitProto.REVISION_CODE, pkg.baseRevisionCode); proto.end(splitToken); if (pkg.splitNames != null) { for (int i = 0; i < pkg.splitNames.length; i++) { splitToken = proto.start(PackageProto.SPLITS); proto.write(PackageProto.SplitProto.NAME, pkg.splitNames[i]); proto.write(PackageProto.SplitProto.REVISION_CODE, pkg.splitRevisionCodes[i]); proto.end(splitToken); } } } writeUsersInfoToProto(proto, PackageProto.USERS); proto.end(packageToken); }
Example 10
Source File: NetworkIdentitySet.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public void writeToProto(ProtoOutputStream proto, long tag) { final long start = proto.start(tag); for (NetworkIdentity ident : this) { ident.writeToProto(proto, NetworkIdentitySetProto.IDENTITIES); } proto.end(start); }
Example 11
Source File: ComponentName.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** Put this here so that individual services don't have to reimplement this. @hide */ public void writeToProto(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); proto.write(ComponentNameProto.PACKAGE_NAME, mPackage); proto.write(ComponentNameProto.CLASS_NAME, mClass); proto.end(token); }
Example 12
Source File: AlarmManager.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** @hide */ public void writeToProto(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); proto.write(AlarmClockInfoProto.TRIGGER_TIME_MS, mTriggerTime); mShowIntent.writeToProto(proto, AlarmClockInfoProto.SHOW_INTENT); proto.end(token); }
Example 13
Source File: WindowStateAnimator.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
void writeToProto(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); mLastClipRect.writeToProto(proto, LAST_CLIP_RECT); if (mSurfaceController != null) { mSurfaceController.writeToProto(proto, SURFACE); } proto.write(DRAW_STATE, mDrawState); mSystemDecorRect.writeToProto(proto, SYSTEM_DECOR_RECT); proto.end(token); }
Example 14
Source File: AppWindowToken.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@CallSuper @Override public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) { final long token = proto.start(fieldId); writeNameToProto(proto, NAME); super.writeToProto(proto, WINDOW_TOKEN, trim); proto.write(LAST_SURFACE_SHOWING, mLastSurfaceShowing); proto.write(IS_WAITING_FOR_TRANSITION_START, isWaitingForTransitionStart()); proto.write(IS_REALLY_ANIMATING, isReallyAnimating()); if (mThumbnail != null){ mThumbnail.writeToProto(proto, THUMBNAIL); } proto.write(FILLS_PARENT, mFillsParent); proto.write(APP_STOPPED, mAppStopped); proto.write(HIDDEN_REQUESTED, hiddenRequested); proto.write(CLIENT_HIDDEN, mClientHidden); proto.write(DEFER_HIDING_CLIENT, mDeferHidingClient); proto.write(REPORTED_DRAWN, reportedDrawn); proto.write(REPORTED_VISIBLE, reportedVisible); proto.write(NUM_INTERESTING_WINDOWS, mNumInterestingWindows); proto.write(NUM_DRAWN_WINDOWS, mNumDrawnWindows); proto.write(ALL_DRAWN, allDrawn); proto.write(LAST_ALL_DRAWN, mLastAllDrawn); proto.write(REMOVED, removed); if (startingWindow != null){ startingWindow.writeIdentifierToProto(proto, STARTING_WINDOW); } proto.write(STARTING_DISPLAYED, startingDisplayed); proto.write(STARTING_MOVED, startingMoved); proto.write(HIDDEN_SET_FROM_TRANSFERRED_STARTING_WINDOW, mHiddenSetFromTransferredStartingWindow); for (Rect bounds : mFrozenBounds) { bounds.writeToProto(proto, FROZEN_BOUNDS); } proto.end(token); }
Example 15
Source File: JobPackageTracker.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public void dumpHistory(ProtoOutputStream proto, long fieldId, int filterUid) { final int size = mEventIndices.size(); if (size == 0) { return; } final long token = proto.start(fieldId); final long now = sElapsedRealtimeClock.millis(); for (int i = 0; i < size; i++) { final int index = mEventIndices.indexOf(i); final int uid = mEventUids[index]; if (filterUid != -1 && filterUid != UserHandle.getAppId(uid)) { continue; } final int cmd = mEventCmds[index] & EVENT_CMD_MASK; if (cmd == EVENT_NULL) { continue; } final long heToken = proto.start(JobPackageHistoryProto.HISTORY_EVENT); proto.write(JobPackageHistoryProto.HistoryEvent.EVENT, cmd); proto.write(JobPackageHistoryProto.HistoryEvent.TIME_SINCE_EVENT_MS, now - mEventTimes[index]); proto.write(JobPackageHistoryProto.HistoryEvent.UID, uid); proto.write(JobPackageHistoryProto.HistoryEvent.JOB_ID, mEventJobIds[index]); proto.write(JobPackageHistoryProto.HistoryEvent.TAG, mEventTags[index]); if (cmd == EVENT_STOP_JOB || cmd == EVENT_STOP_PERIODIC_JOB) { proto.write(JobPackageHistoryProto.HistoryEvent.STOP_REASON, (mEventCmds[index] & EVENT_STOP_REASON_MASK) >> EVENT_STOP_REASON_SHIFT); } proto.end(heToken); } proto.end(token); }
Example 16
Source File: LocaleList.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Helper to write LocaleList to a protocol buffer output stream. Assumes the parent * protobuf has declared the locale as repeated. * * @param protoOutputStream Stream to write the locale to. * @param fieldId Field Id of the Locale as defined in the parent message. * @hide */ public void writeToProto(ProtoOutputStream protoOutputStream, long fieldId) { for (int i = 0; i < mList.length; i++) { final Locale locale = mList[i]; final long token = protoOutputStream.start(fieldId); protoOutputStream.write(LocaleProto.LANGUAGE, locale.getLanguage()); protoOutputStream.write(LocaleProto.COUNTRY, locale.getCountry()); protoOutputStream.write(LocaleProto.VARIANT, locale.getVariant()); protoOutputStream.end(token); } }
Example 17
Source File: RemoteAnimationController.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public void writeToProto(ProtoOutputStream proto) { final long token = proto.start(REMOTE); if (mTarget != null) { mTarget.writeToProto(proto, TARGET); } proto.end(token); }
Example 18
Source File: AnimationAdapter.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
default void writeToProto(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); writeToProto(proto); proto.end(token); }
Example 19
Source File: UserState.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
void writeToProto(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); proto.write(UserStateProto.STATE, stateToProtoEnum(state)); proto.write(UserStateProto.SWITCHING, switching); proto.end(token); }
Example 20
Source File: BarController.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
public void writeToProto(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); proto.write(STATE, mState); proto.write(TRANSIENT_STATE, mTransientBarState); proto.end(token); }