android.util.proto.ProtoOutputStream Java Examples

The following examples show how to use android.util.proto.ProtoOutputStream. 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 Project: android_9.0.0_r45   Author: lulululbj   File: ClipData.java    License: Apache License 2.0 6 votes vote down vote up
/** @hide */
public void writeToProto(ProtoOutputStream proto, long fieldId) {
    final long token = proto.start(fieldId);

    if (mClipDescription != null) {
        mClipDescription.writeToProto(proto, ClipDataProto.DESCRIPTION);
    }
    if (mIcon != null) {
        final long iToken = proto.start(ClipDataProto.ICON);
        proto.write(ClipDataProto.Icon.WIDTH, mIcon.getWidth());
        proto.write(ClipDataProto.Icon.HEIGHT, mIcon.getHeight());
        proto.end(iToken);
    }
    for (int i = 0; i < mItems.size(); i++) {
        mItems.get(i).writeToProto(proto, ClipDataProto.ITEMS);
    }

    proto.end(token);
}
 
Example #2
Source Project: android_9.0.0_r45   Author: lulululbj   File: ZenModeHelper.java    License: Apache License 2.0 6 votes vote down vote up
void dump(ProtoOutputStream proto) {
    proto.write(ZenModeProto.ZEN_MODE, mZenMode);
    synchronized (mConfig) {
        if (mConfig.manualRule != null) {
            mConfig.manualRule.writeToProto(proto, ZenModeProto.ENABLED_ACTIVE_CONDITIONS);
        }
        for (ZenRule rule : mConfig.automaticRules.values()) {
            if (rule.enabled && rule.condition.state == Condition.STATE_TRUE
                    && !rule.snoozing) {
                rule.writeToProto(proto, ZenModeProto.ENABLED_ACTIVE_CONDITIONS);
            }
        }
        mConfig.toNotificationPolicy().writeToProto(proto, ZenModeProto.POLICY);
        proto.write(ZenModeProto.SUPPRESSED_EFFECTS, mSuppressedEffects);
    }
}
 
Example #3
Source Project: android_9.0.0_r45   Author: lulululbj   File: Configuration.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 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 #4
Source Project: android_9.0.0_r45   Author: lulululbj   File: ProcessStatsService.java    License: Apache License 2.0 6 votes vote down vote up
private void dumpProto(FileDescriptor fd) {
    final ProtoOutputStream proto = new ProtoOutputStream(fd);

    // dump current procstats
    long now;
    synchronized (mAm) {
        now = SystemClock.uptimeMillis();
        mProcessStats.writeToProto(proto,ProcessStatsServiceDumpProto.PROCSTATS_NOW, now);
    }

    // aggregated over last 3 hours procstats
    dumpAggregatedStats(proto, ProcessStatsServiceDumpProto.PROCSTATS_OVER_3HRS, 3, now);

    // aggregated over last 24 hours procstats
    dumpAggregatedStats(proto, ProcessStatsServiceDumpProto.PROCSTATS_OVER_24HRS, 24, now);

    proto.flush();
}
 
Example #5
Source Project: android_9.0.0_r45   Author: lulululbj   File: RootWindowContainer.java    License: Apache License 2.0 6 votes vote down vote up
@CallSuper
@Override
public void writeToProto(ProtoOutputStream proto, long fieldId, boolean trim) {
    final long token = proto.start(fieldId);
    super.writeToProto(proto, WINDOW_CONTAINER, trim);
    if (mService.mDisplayReady) {
        final int count = mChildren.size();
        for (int i = 0; i < count; ++i) {
            final DisplayContent displayContent = mChildren.get(i);
            displayContent.writeToProto(proto, DISPLAYS, trim);
        }
    }
    if (!trim) {
        forAllWindows((w) -> {
            w.writeIdentifierToProto(proto, WINDOWS);
        }, true);
    }
    proto.end(token);
}
 
Example #6
Source Project: android_9.0.0_r45   Author: lulululbj   File: Configuration.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Write to a protocol buffer output stream.
 * Protocol buffer message definition at {@link android.content.ConfigurationProto}
 *
 * @param protoOutputStream Stream to write the Configuration object to.
 * @param fieldId           Field Id of the Configuration as defined in the parent message
 * @hide
 */
public void writeToProto(ProtoOutputStream protoOutputStream, long fieldId) {
    final long token = protoOutputStream.start(fieldId);
    protoOutputStream.write(FONT_SCALE, fontScale);
    protoOutputStream.write(MCC, mcc);
    protoOutputStream.write(MNC, mnc);
    mLocaleList.writeToProto(protoOutputStream, LOCALES);
    protoOutputStream.write(SCREEN_LAYOUT, screenLayout);
    protoOutputStream.write(COLOR_MODE, colorMode);
    protoOutputStream.write(TOUCHSCREEN, touchscreen);
    protoOutputStream.write(KEYBOARD, keyboard);
    protoOutputStream.write(KEYBOARD_HIDDEN, keyboardHidden);
    protoOutputStream.write(HARD_KEYBOARD_HIDDEN, hardKeyboardHidden);
    protoOutputStream.write(NAVIGATION, navigation);
    protoOutputStream.write(NAVIGATION_HIDDEN, navigationHidden);
    protoOutputStream.write(ORIENTATION, orientation);
    protoOutputStream.write(UI_MODE, uiMode);
    protoOutputStream.write(SCREEN_WIDTH_DP, screenWidthDp);
    protoOutputStream.write(SCREEN_HEIGHT_DP, screenHeightDp);
    protoOutputStream.write(SMALLEST_SCREEN_WIDTH_DP, smallestScreenWidthDp);
    protoOutputStream.write(DENSITY_DPI, densityDpi);
    windowConfiguration.writeToProto(protoOutputStream, WINDOW_CONFIGURATION);
    protoOutputStream.end(token);
}
 
Example #7
Source Project: android_9.0.0_r45   Author: lulululbj   File: UidRecord.java    License: Apache License 2.0 6 votes vote down vote up
void writeToProto(ProtoOutputStream proto, long fieldId) {
    long token = proto.start(fieldId);
    proto.write(UidRecordProto.UID, uid);
    proto.write(UidRecordProto.CURRENT, ProcessList.makeProcStateProtoEnum(curProcState));
    proto.write(UidRecordProto.EPHEMERAL, ephemeral);
    proto.write(UidRecordProto.FG_SERVICES, foregroundServices);
    proto.write(UidRecordProto.WHILELIST, curWhitelist);
    ProtoUtils.toDuration(proto, UidRecordProto.LAST_BACKGROUND_TIME,
            lastBackgroundTime, SystemClock.elapsedRealtime());
    proto.write(UidRecordProto.IDLE, idle);
    if (lastReportedChange != 0) {
        ProtoUtils.writeBitWiseFlagsToProtoEnum(proto, UidRecordProto.LAST_REPORTED_CHANGES,
                lastReportedChange, ORIG_ENUMS, PROTO_ENUMS);
    }
    proto.write(UidRecordProto.NUM_PROCS, numProcs);

    long seqToken = proto.start(UidRecordProto.NETWORK_STATE_UPDATE);
    proto.write(UidRecordProto.ProcStateSequence.CURURENT, curProcStateSeq);
    proto.write(UidRecordProto.ProcStateSequence.LAST_NETWORK_UPDATED,
            lastNetworkUpdatedProcStateSeq);
    proto.write(UidRecordProto.ProcStateSequence.LAST_DISPATCHED, lastDispatchedProcStateSeq);
    proto.end(seqToken);

    proto.end(token);
}
 
Example #8
Source Project: android_9.0.0_r45   Author: lulululbj   File: ClipData.java    License: Apache License 2.0 6 votes vote down vote up
/** @hide */
public void writeToProto(ProtoOutputStream proto, long fieldId) {
    final long token = proto.start(fieldId);

    if (mHtmlText != null) {
        proto.write(ClipDataProto.Item.HTML_TEXT, mHtmlText);
    } else if (mText != null) {
        proto.write(ClipDataProto.Item.TEXT, mText.toString());
    } else if (mUri != null) {
        proto.write(ClipDataProto.Item.URI, mUri.toString());
    } else if (mIntent != null) {
        mIntent.writeToProto(proto, ClipDataProto.Item.INTENT, true, true, true, true);
    } else {
        proto.write(ClipDataProto.Item.NOTHING, true);
    }

    proto.end(token);
}
 
Example #9
Source Project: android_9.0.0_r45   Author: lulululbj   File: AlarmManagerService.java    License: Apache License 2.0 6 votes vote down vote up
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 #10
Source Project: android_9.0.0_r45   Author: lulululbj   File: ActiveInstrumentation.java    License: Apache License 2.0 6 votes vote down vote up
void writeToProto(ProtoOutputStream proto, long fieldId) {
    long token = proto.start(fieldId);
    mClass.writeToProto(proto, ActiveInstrumentationProto.CLASS);
    proto.write(ActiveInstrumentationProto.FINISHED, mFinished);
    for (int i=0; i<mRunningProcesses.size(); i++) {
        mRunningProcesses.get(i).writeToProto(proto,
                ActiveInstrumentationProto.RUNNING_PROCESSES);
    }
    for (String p : mTargetProcesses) {
        proto.write(ActiveInstrumentationProto.TARGET_PROCESSES, p);
    }
    if (mTargetInfo != null) {
        mTargetInfo.writeToProto(proto, ActiveInstrumentationProto.TARGET_INFO);
    }
    proto.write(ActiveInstrumentationProto.PROFILE_FILE, mProfileFile);
    proto.write(ActiveInstrumentationProto.WATCHER, mWatcher.toString());
    proto.write(ActiveInstrumentationProto.UI_AUTOMATION_CONNECTION,
            mUiAutomationConnection.toString());
    proto.write(ActiveInstrumentationProto.ARGUMENTS, mArguments.toString());
    proto.end(token);
}
 
Example #11
Source Project: android_9.0.0_r45   Author: lulululbj   File: IdleController.java    License: Apache License 2.0 6 votes vote down vote up
@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 #12
Source Project: android_9.0.0_r45   Author: lulululbj   File: ClipDescription.java    License: Apache License 2.0 6 votes vote down vote up
/** @hide */
public void writeToProto(ProtoOutputStream proto, long fieldId) {
    final long token = proto.start(fieldId);

    final int size = mMimeTypes.size();
    for (int i = 0; i < size; i++) {
        proto.write(ClipDescriptionProto.MIME_TYPES, mMimeTypes.get(i));
    }

    if (mLabel != null) {
        proto.write(ClipDescriptionProto.LABEL, mLabel.toString());
    }
    if (mExtras != null) {
        mExtras.writeToProto(proto, ClipDescriptionProto.EXTRAS);
    }
    if (mTimeStamp > 0) {
        proto.write(ClipDescriptionProto.TIMESTAMP_MS, mTimeStamp);
    }

    proto.end(token);
}
 
Example #13
Source Project: android_9.0.0_r45   Author: lulululbj   File: StorageController.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void dumpControllerStateLocked(ProtoOutputStream proto, long fieldId,
        Predicate<JobStatus> predicate) {
    final long token = proto.start(fieldId);
    final long mToken = proto.start(StateControllerProto.STORAGE);

    proto.write(StateControllerProto.StorageController.IS_STORAGE_NOT_LOW,
            mStorageTracker.isStorageNotLow());
    proto.write(StateControllerProto.StorageController.LAST_BROADCAST_SEQUENCE_NUMBER,
            mStorageTracker.getSeq());

    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.StorageController.TRACKED_JOBS);
        js.writeToShortProto(proto, StateControllerProto.StorageController.TrackedJob.INFO);
        proto.write(StateControllerProto.StorageController.TrackedJob.SOURCE_UID,
                js.getSourceUid());
        proto.end(jsToken);
    }

    proto.end(mToken);
    proto.end(token);
}
 
Example #14
Source Project: android_9.0.0_r45   Author: lulululbj   File: GrantedUriPermissions.java    License: Apache License 2.0 6 votes vote down vote up
public void dump(ProtoOutputStream proto, long fieldId) {
    final long token = proto.start(fieldId);

    proto.write(GrantedUriPermissionsDumpProto.FLAGS, mGrantFlags);
    proto.write(GrantedUriPermissionsDumpProto.SOURCE_USER_ID, mSourceUserId);
    proto.write(GrantedUriPermissionsDumpProto.TAG, mTag);
    proto.write(GrantedUriPermissionsDumpProto.PERMISSION_OWNER, mPermissionOwner.toString());
    for (int i = 0; i < mUris.size(); i++) {
        Uri u = mUris.get(i);
        if (u != null) {
            proto.write(GrantedUriPermissionsDumpProto.URIS, u.toString());
        }
    }

    proto.end(token);
}
 
Example #15
Source Project: android_9.0.0_r45   Author: lulululbj   File: PowerManagerService.java    License: Apache License 2.0 6 votes vote down vote up
public void writeToProto(ProtoOutputStream proto, long fieldId) {
    final long wakeLockToken = proto.start(fieldId);
    proto.write(WakeLockProto.LOCK_LEVEL, (mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK));
    proto.write(WakeLockProto.TAG, mTag);

    final long wakeLockFlagsToken = proto.start(WakeLockProto.FLAGS);
    proto.write(WakeLockProto.WakeLockFlagsProto.IS_ACQUIRE_CAUSES_WAKEUP,
            (mFlags & PowerManager.ACQUIRE_CAUSES_WAKEUP)!=0);
    proto.write(WakeLockProto.WakeLockFlagsProto.IS_ON_AFTER_RELEASE,
            (mFlags & PowerManager.ON_AFTER_RELEASE)!=0);
    proto.end(wakeLockFlagsToken);

    proto.write(WakeLockProto.IS_DISABLED, mDisabled);
    if (mNotifiedAcquired) {
        proto.write(WakeLockProto.ACQ_MS, mAcquireTime);
    }
    proto.write(WakeLockProto.IS_NOTIFIED_LONG, mNotifiedLong);
    proto.write(WakeLockProto.UID, mOwnerUid);
    proto.write(WakeLockProto.PID, mOwnerPid);

    if (mWorkSource != null) {
        mWorkSource.writeToProto(proto, WakeLockProto.WORK_SOURCE);
    }
    proto.end(wakeLockToken);
}
 
Example #16
Source Project: android_9.0.0_r45   Author: lulululbj   File: NetworkCapabilities.java    License: Apache License 2.0 6 votes vote down vote up
/** @hide */
public void writeToProto(ProtoOutputStream proto, long fieldId) {
    final long token = proto.start(fieldId);

    for (int transport : getTransportTypes()) {
        proto.write(NetworkCapabilitiesProto.TRANSPORTS, transport);
    }

    for (int capability : getCapabilities()) {
        proto.write(NetworkCapabilitiesProto.CAPABILITIES, capability);
    }

    proto.write(NetworkCapabilitiesProto.LINK_UP_BANDWIDTH_KBPS, mLinkUpBandwidthKbps);
    proto.write(NetworkCapabilitiesProto.LINK_DOWN_BANDWIDTH_KBPS, mLinkDownBandwidthKbps);

    if (mNetworkSpecifier != null) {
        proto.write(NetworkCapabilitiesProto.NETWORK_SPECIFIER, mNetworkSpecifier.toString());
    }

    proto.write(NetworkCapabilitiesProto.CAN_REPORT_SIGNAL_STRENGTH, hasSignalStrength());
    proto.write(NetworkCapabilitiesProto.SIGNAL_STRENGTH, mSignalStrength);

    proto.end(token);
}
 
Example #17
Source Project: Study_Android_Demo   Author: RealMoMo   File: SettingsProtoDumpUtil.java    License: Apache License 2.0 6 votes vote down vote up
static void dumpProtoLocked(SettingsProvider.SettingsRegistry settingsRegistry,
        ProtoOutputStream proto) {
    // Global settings
    SettingsState globalSettings = settingsRegistry.getSettingsLocked(
            SettingsProvider.SETTINGS_TYPE_GLOBAL, UserHandle.USER_SYSTEM);
    long globalSettingsToken = proto.start(SettingsServiceDumpProto.GLOBAL_SETTINGS);
    dumpProtoGlobalSettingsLocked(globalSettings, proto);
    proto.end(globalSettingsToken);

    // Per-user settings
    SparseBooleanArray users = settingsRegistry.getKnownUsersLocked();
    final int userCount = users.size();
    for (int i = 0; i < userCount; i++) {
        long userSettingsToken = proto.start(SettingsServiceDumpProto.USER_SETTINGS);
        dumpProtoUserSettingsLocked(
                settingsRegistry, UserHandle.of(users.keyAt(i)), proto);
        proto.end(userSettingsToken);
    }
}
 
Example #18
Source Project: android_9.0.0_r45   Author: lulululbj   File: NetworkStatsCollection.java    License: Apache License 2.0 6 votes vote down vote up
public void writeToProto(ProtoOutputStream proto, long tag) {
    final long start = proto.start(tag);

    for (Key key : getSortedKeys()) {
        final long startStats = proto.start(NetworkStatsCollectionProto.STATS);

        // Key
        final long startKey = proto.start(NetworkStatsCollectionStatsProto.KEY);
        key.ident.writeToProto(proto, NetworkStatsCollectionKeyProto.IDENTITY);
        proto.write(NetworkStatsCollectionKeyProto.UID, key.uid);
        proto.write(NetworkStatsCollectionKeyProto.SET, key.set);
        proto.write(NetworkStatsCollectionKeyProto.TAG, key.tag);
        proto.end(startKey);

        // Value
        final NetworkStatsHistory history = mStats.get(key);
        history.writeToProto(proto, NetworkStatsCollectionStatsProto.HISTORY);
        proto.end(startStats);
    }

    proto.end(start);
}
 
Example #19
Source Project: android_9.0.0_r45   Author: lulululbj   File: ConnectionRecord.java    License: Apache License 2.0 6 votes vote down vote up
public void writeToProto(ProtoOutputStream proto, long fieldId) {
    if (binding == null) return; // if binding is null, don't write data, something is wrong.
    long token = proto.start(fieldId);
    proto.write(ConnectionRecordProto.HEX_HASH,
            Integer.toHexString(System.identityHashCode(this)));
    if (binding.client != null) {
        proto.write(ConnectionRecordProto.USER_ID, binding.client.userId);
    }
    ProtoUtils.writeBitWiseFlagsToProtoEnum(proto, ConnectionRecordProto.FLAGS,
            flags, BIND_ORIG_ENUMS, BIND_PROTO_ENUMS);
    if (serviceDead) {
        proto.write(ConnectionRecordProto.FLAGS, ConnectionRecordProto.DEAD);
    }
    if (binding.service != null) {
        proto.write(ConnectionRecordProto.SERVICE_NAME, binding.service.shortName);
    }
    proto.end(token);
}
 
Example #20
Source Project: android_9.0.0_r45   Author: lulululbj   File: NotificationRecord.java    License: Apache License 2.0 6 votes vote down vote up
void dump(ProtoOutputStream proto, long fieldId, boolean redact, int state) {
    final long token = proto.start(fieldId);

    proto.write(NotificationRecordProto.KEY, sbn.getKey());
    proto.write(NotificationRecordProto.STATE, state);
    if (getChannel() != null) {
        proto.write(NotificationRecordProto.CHANNEL_ID, getChannel().getId());
    }
    proto.write(NotificationRecordProto.CAN_SHOW_LIGHT, getLight() != null);
    proto.write(NotificationRecordProto.CAN_VIBRATE, getVibration() != null);
    proto.write(NotificationRecordProto.FLAGS, sbn.getNotification().flags);
    proto.write(NotificationRecordProto.GROUP_KEY, getGroupKey());
    proto.write(NotificationRecordProto.IMPORTANCE, getImportance());
    if (getSound() != null) {
        proto.write(NotificationRecordProto.SOUND, getSound().toString());
    }
    if (getAudioAttributes() != null) {
        getAudioAttributes().writeToProto(proto, NotificationRecordProto.AUDIO_ATTRIBUTES);
    }

    proto.end(token);
}
 
Example #21
Source Project: android_9.0.0_r45   Author: lulululbj   File: Message.java    License: Apache License 2.0 5 votes vote down vote up
void writeToProto(ProtoOutputStream proto, long fieldId) {
    final long messageToken = proto.start(fieldId);
    proto.write(MessageProto.WHEN, when);

    if (target != null) {
        if (callback != null) {
            proto.write(MessageProto.CALLBACK, callback.getClass().getName());
        } else {
            proto.write(MessageProto.WHAT, what);
        }

        if (arg1 != 0) {
            proto.write(MessageProto.ARG1, arg1);
        }

        if (arg2 != 0) {
            proto.write(MessageProto.ARG2, arg2);
        }

        if (obj != null) {
            proto.write(MessageProto.OBJ, obj.toString());
        }

        proto.write(MessageProto.TARGET, target.getClass().getName());
    } else {
        proto.write(MessageProto.BARRIER, arg1);
    }

    proto.end(messageToken);
}
 
Example #22
Source Project: android_9.0.0_r45   Author: lulululbj   File: NotificationManager.java    License: Apache License 2.0 5 votes vote down vote up
/** @hide */
public void writeToProto(ProtoOutputStream proto, long fieldId) {
    final long pToken = proto.start(fieldId);

    bitwiseToProtoEnum(proto, PolicyProto.PRIORITY_CATEGORIES, priorityCategories);
    proto.write(PolicyProto.PRIORITY_CALL_SENDER, priorityCallSenders);
    proto.write(PolicyProto.PRIORITY_MESSAGE_SENDER, priorityMessageSenders);
    bitwiseToProtoEnum(
            proto, PolicyProto.SUPPRESSED_VISUAL_EFFECTS, suppressedVisualEffects);

    proto.end(pToken);
}
 
Example #23
Source Project: android_9.0.0_r45   Author: lulululbj   File: PendingIntent.java    License: Apache License 2.0 5 votes vote down vote up
/** @hide */
public void writeToProto(ProtoOutputStream proto, long fieldId) {
    final long token = proto.start(fieldId);
    if (mTarget != null) {
        proto.write(PendingIntentProto.TARGET, mTarget.asBinder().toString());
    }
    proto.end(token);
}
 
Example #24
Source Project: android_9.0.0_r45   Author: lulululbj   File: BroadcastFilter.java    License: Apache License 2.0 5 votes vote down vote up
public void writeToProto(ProtoOutputStream proto, long fieldId) {
    long token = proto.start(fieldId);
    super.writeToProto(proto, BroadcastFilterProto.INTENT_FILTER);
    if (requiredPermission != null) {
        proto.write(BroadcastFilterProto.REQUIRED_PERMISSION, requiredPermission);
    }
    proto.write(BroadcastFilterProto.HEX_HASH, Integer.toHexString(System.identityHashCode(this)));
    proto.write(BroadcastFilterProto.OWNING_USER_ID, owningUserId);
    proto.end(token);
}
 
Example #25
Source Project: android_9.0.0_r45   Author: lulululbj   File: FeatureInfo.java    License: Apache License 2.0 5 votes vote down vote up
/** @hide */
public void writeToProto(ProtoOutputStream proto, long fieldId) {
    long token = proto.start(fieldId);
    if (name != null) {
        proto.write(FeatureInfoProto.NAME, name);
    }
    proto.write(FeatureInfoProto.VERSION, version);
    proto.write(FeatureInfoProto.GLES_VERSION, getGlEsVersion());
    proto.write(FeatureInfoProto.FLAGS, flags);
    proto.end(token);
}
 
Example #26
Source Project: Study_Android_Demo   Author: RealMoMo   File: SettingsState.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Dump historical operations as a proto buf.
 *
 * @param proto The proto buf stream to dump to
 */
void dumpProtoHistoricalOperations(@NonNull ProtoOutputStream proto) {
    synchronized (mLock) {
        if (mHistoricalOperations == null) {
            return;
        }

        final int operationCount = mHistoricalOperations.size();
        for (int i = 0; i < operationCount; i++) {
            int index = mNextHistoricalOpIdx - 1 - i;
            if (index < 0) {
                index = operationCount + index;
            }
            HistoricalOperation operation = mHistoricalOperations.get(index);
            long settingsOperationToken = proto.start(GlobalSettingsProto.HISTORICAL_OP);
            proto.write(SettingsOperationProto.TIMESTAMP, operation.mTimestamp);
            proto.write(SettingsOperationProto.OPERATION, operation.mOperation);
            if (operation.mSetting != null) {
                // Only add the name of the setting, since we don't know the historical package
                // and values for it so they would be misleading to add here (all we could
                // add is what the current data is).
                proto.write(SettingsOperationProto.SETTING, operation.mSetting.getName());
            }
            proto.end(settingsOperationToken);
        }
    }
}
 
Example #27
Source Project: android_9.0.0_r45   Author: lulululbj   File: Dimmer.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeToProtoInner(ProtoOutputStream proto) {
    final long token = proto.start(ALPHA);
    proto.write(FROM, mFromAlpha);
    proto.write(TO, mToAlpha);
    proto.write(DURATION_MS, mDuration);
    proto.end(token);
}
 
Example #28
Source Project: android_9.0.0_r45   Author: lulululbj   File: AppWindowToken.java    License: Apache License 2.0 5 votes vote down vote up
void writeNameToProto(ProtoOutputStream proto, long fieldId) {
    if (appToken == null) {
        return;
    }
    try {
        proto.write(fieldId, appToken.getName());
    } catch (RemoteException e) {
        // This shouldn't happen, but in this case fall back to outputting nothing
        Slog.e(TAG, e.toString());
    }
}
 
Example #29
Source Project: android_9.0.0_r45   Author: lulululbj   File: WindowTracing.java    License: Apache License 2.0 5 votes vote down vote up
void appendTraceEntry(ProtoOutputStream proto) {
    if (!mEnabledLockFree) {
        return;
    }

    if (!mWriteQueue.offer(proto)) {
        Log.e(TAG, "Dropping window trace entry, queue full");
    }
}
 
Example #30
Source Project: Study_Android_Demo   Author: RealMoMo   File: SettingsProvider.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Dump all settings as a proto buf.
 *
 * @param fd The file to dump to
 */
void dumpProto(@NonNull FileDescriptor fd) {
    ProtoOutputStream proto = new ProtoOutputStream(fd);

    synchronized (mLock) {
        SettingsProtoDumpUtil.dumpProtoLocked(mSettingsRegistry, proto);

    }

    proto.flush();
}