code
stringlengths 11
173k
| docstring
stringlengths 2
593k
| func_name
stringlengths 2
189
| language
stringclasses 1
value | repo
stringclasses 833
values | path
stringlengths 11
294
| url
stringlengths 60
339
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
public @NonNull MtpEvent readEvent(@Nullable CancellationSignal signal) throws IOException {
final int handle = native_submit_event_request();
Preconditions.checkState(handle >= 0, "Other thread is reading an event.");
if (signal != null) {
signal.setOnCancelListener(new CancellationSignal.OnCancelListener() {
@Override
public void onCancel() {
native_discard_event_request(handle);
}
});
}
try {
return native_reap_event_request(handle);
} finally {
if (signal != null) {
signal.setOnCancelListener(null);
}
}
} |
Reads an event from the device. It blocks the current thread until it gets an event.
It throws OperationCanceledException if it is cancelled by signal.
@param signal signal for cancellation
@return obtained event
@throws IOException
| MtpDevice::readEvent | java | Reginer/aosp-android-jar | android-31/src/android/mtp/MtpDevice.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java | MIT |
public long getObjectSizeLong(int handle, int format) throws IOException {
return native_get_object_size_long(handle, format);
} |
Returns object size in 64-bit integer.
Though MtpObjectInfo#getCompressedSize returns the object size in 32-bit unsigned integer,
this method returns the object size in 64-bit integer from the object property. Thus it can
fetch 4GB+ object size correctly. If the device does not support objectSize property, it
throws IOException.
@hide
| MtpDevice::getObjectSizeLong | java | Reginer/aosp-android-jar | android-31/src/android/mtp/MtpDevice.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/mtp/MtpDevice.java | MIT |
public static final MatchFilter sUrlMatchFilter = new MatchFilter() {
public final boolean acceptMatch(CharSequence s, int start, int end) {
if (start == 0) {
return true;
}
if (s.charAt(start - 1) == '@') {
return false;
}
return true;
}
}; |
Filters out web URL matches that occur after an at-sign (@). This is
to prevent turning the domain name in an email address into a web link.
| Linkify::MatchFilter | java | Reginer/aosp-android-jar | android-35/src/android/text/util/Linkify.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/text/util/Linkify.java | MIT |
public static final MatchFilter sPhoneNumberMatchFilter = new MatchFilter() {
public final boolean acceptMatch(CharSequence s, int start, int end) {
int digitCount = 0;
for (int i = start; i < end; i++) {
if (Character.isDigit(s.charAt(i))) {
digitCount++;
if (digitCount >= PHONE_NUMBER_MINIMUM_DIGITS) {
return true;
}
}
}
return false;
}
}; |
Filters out URL matches that don't have enough digits to be a
phone number.
| Linkify::MatchFilter | java | Reginer/aosp-android-jar | android-35/src/android/text/util/Linkify.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/text/util/Linkify.java | MIT |
public static final TransformFilter sPhoneNumberTransformFilter = new TransformFilter() {
public final String transformUrl(final Matcher match, String url) {
return Patterns.digitsAndPlusOnly(match);
}
}; |
Transforms matched phone number text into something suitable
to be used in a tel: URL. It does this by removing everything
but the digits and plus signs. For instance:
'+1 (919) 555-1212'
becomes '+19195551212'
| Linkify::TransformFilter | java | Reginer/aosp-android-jar | android-35/src/android/text/util/Linkify.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/text/util/Linkify.java | MIT |
public static final boolean addLinks(@NonNull Spannable text, @LinkifyMask int mask) {
return addLinks(text, mask, null, null);
} |
Scans the text of the provided Spannable and turns all occurrences
of the link types indicated in the mask into clickable links.
If the mask is nonzero, it also removes any existing URLSpans
attached to the Spannable, to avoid problems if you call it
repeatedly on the same text.
@param text Spannable whose text is to be marked-up with links
@param mask Mask to define which kinds of links will be searched.
@return True if at least one link is found and applied.
@see #addLinks(Spannable, int, Function)
| Linkify::addLinks | java | Reginer/aosp-android-jar | android-35/src/android/text/util/Linkify.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/text/util/Linkify.java | MIT |
public static final boolean addLinks(@NonNull Spannable text, @LinkifyMask int mask,
@Nullable Function<String, URLSpan> urlSpanFactory) {
return addLinks(text, mask, null, urlSpanFactory);
} |
Scans the text of the provided Spannable and turns all occurrences
of the link types indicated in the mask into clickable links.
If the mask is nonzero, it also removes any existing URLSpans
attached to the Spannable, to avoid problems if you call it
repeatedly on the same text.
@param text Spannable whose text is to be marked-up with links
@param mask mask to define which kinds of links will be searched
@param urlSpanFactory function used to create {@link URLSpan}s
@return True if at least one link is found and applied.
| Linkify::addLinks | java | Reginer/aosp-android-jar | android-35/src/android/text/util/Linkify.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/text/util/Linkify.java | MIT |
public boolean isEnabled() {
return mIsEnabled;
} |
Is the preferential network enabled.
@return true if enabled else false
| PreferentialNetworkServiceConfig::isEnabled | java | Reginer/aosp-android-jar | android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java | MIT |
public boolean isFallbackToDefaultConnectionAllowed() {
return mAllowFallbackToDefaultConnection;
} |
Whether fallback to the device-wide default network is allowed.
This boolean configures whether the default connection (e.g. general cell network or wifi)
should be used if no preferential network service connection is available. If true, the
default connection will be used when no preferential service is available. If false, the
UIDs subject to this configuration will have no default network.
Note that while this boolean determines whether the UIDs subject to this configuration have
a default network in the absence of a preferential service, apps can still explicitly decide
to use another network than their default network by requesting them from the system. This
boolean does not determine whether the UIDs are blocked from using such other networks.
See {@link #shouldBlockNonMatchingNetworks()} for that configuration.
@return true if fallback is allowed, else false.
| PreferentialNetworkServiceConfig::isFallbackToDefaultConnectionAllowed | java | Reginer/aosp-android-jar | android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java | MIT |
public boolean shouldBlockNonMatchingNetworks() {
return mShouldBlockNonMatchingNetworks;
} |
Whether to block UIDs from using other networks than the preferential service.
Apps can inspect the list of available networks on the device and choose to use multiple
of them concurrently for performance, privacy or other reasons.
This boolean configures whether the concerned UIDs should be blocked from using
networks that do not match the configured preferential network service even if these
networks are otherwise open to all apps.
@return true if UIDs should be blocked from using the other networks, else false.
| PreferentialNetworkServiceConfig::shouldBlockNonMatchingNetworks | java | Reginer/aosp-android-jar | android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java | MIT |
public @NonNull int[] getIncludedUids() {
return mIncludedUids;
} |
Get the array of uids that are applicable for the profile preference.
{@see #getExcludedUids()}
Included UIDs and Excluded UIDs can't both be non-empty.
if both are empty, it means this request applies to all uids in the user profile.
if included is not empty, then only included UIDs are applied.
if excluded is not empty, then it is all uids in the user profile except these UIDs.
@return Array of uids applicable for the profile preference.
Empty array would mean that this request applies to all uids in the profile.
| PreferentialNetworkServiceConfig::getIncludedUids | java | Reginer/aosp-android-jar | android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java | MIT |
public @NonNull int[] getExcludedUids() {
return mExcludedUids;
} |
Get the array of uids that are excluded for the profile preference.
{@see #getIncludedUids()}
Included UIDs and Excluded UIDs can't both be non-empty.
if both are empty, it means this request applies to all uids in the user profile.
if included is not empty, then only included UIDs are applied.
if excluded is not empty, then it is all uids in the user profile except these UIDs.
@return Array of uids that are excluded for the profile preference.
Empty array would mean that this request applies to all uids in the profile.
| PreferentialNetworkServiceConfig::getExcludedUids | java | Reginer/aosp-android-jar | android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java | MIT |
public @PreferentialNetworkPreferenceId int getNetworkId() {
return mNetworkId;
} |
@return preference enterprise identifier.
preference identifier is applicable only if preference network service is enabled
| PreferentialNetworkServiceConfig::getNetworkId | java | Reginer/aosp-android-jar | android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java | MIT |
public Builder() {} |
Constructs an empty Builder with preferential network disabled by default.
| Builder::Builder | java | Reginer/aosp-android-jar | android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/admin/PreferentialNetworkServiceConfig.java | MIT |
public static void setLoggingLevel() {
final int defaultLevel = getDefaultLoggingLevel();
final int level = DeviceConfig.getInt(DeviceConfig.NAMESPACE_CONTENT_CAPTURE,
DEVICE_CONFIG_PROPERTY_LOGGING_LEVEL, defaultLevel);
setLoggingLevel(level);
} |
Sets the value of the static logging level constants based on device config.
| getSimpleName::setLoggingLevel | java | Reginer/aosp-android-jar | android-32/src/android/view/contentcapture/ContentCaptureHelper.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/view/contentcapture/ContentCaptureHelper.java | MIT |
public static void setLoggingLevel(@LoggingLevel int level) {
Log.i(TAG, "Setting logging level to " + getLoggingLevelAsString(level));
sVerbose = sDebug = false;
switch (level) {
case LOGGING_LEVEL_VERBOSE:
sVerbose = true;
// fall through
case LOGGING_LEVEL_DEBUG:
sDebug = true;
return;
case LOGGING_LEVEL_OFF:
// You log nothing, Jon Snow!
return;
default:
Log.w(TAG, "setLoggingLevel(): invalud level: " + level);
}
} |
Sets the value of the static logging level constants based the given level.
| getSimpleName::setLoggingLevel | java | Reginer/aosp-android-jar | android-32/src/android/view/contentcapture/ContentCaptureHelper.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/view/contentcapture/ContentCaptureHelper.java | MIT |
public static String getLoggingLevelAsString(@LoggingLevel int level) {
switch (level) {
case LOGGING_LEVEL_OFF:
return "OFF";
case LOGGING_LEVEL_DEBUG:
return "DEBUG";
case LOGGING_LEVEL_VERBOSE:
return "VERBOSE";
default:
return "UNKNOWN-" + level;
}
} |
Gets a user-friendly value for a content capture logging level.
| getSimpleName::getLoggingLevelAsString | java | Reginer/aosp-android-jar | android-32/src/android/view/contentcapture/ContentCaptureHelper.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/view/contentcapture/ContentCaptureHelper.java | MIT |
public DataThrottlingEntry(@NonNull DataProfile dataProfile,
@Nullable NetworkRequestList networkRequestList,
@Nullable DataNetwork dataNetwork, @TransportType int transport,
@RetryType int retryType, @ElapsedRealtimeLong long expirationTimeMillis) {
this.dataProfile = dataProfile;
this.networkRequestList = networkRequestList;
this.dataNetwork = dataNetwork;
this.transport = transport;
this.retryType = retryType;
this.expirationTimeMillis = expirationTimeMillis;
} |
Constructor.
@param dataProfile The data profile that is being throttled for setup/handover retry.
@param networkRequestList The associated network request list when throttling happened.
Should be {@code null} when retry type is {@link ThrottleStatus#RETRY_TYPE_HANDOVER}.
@param dataNetwork The data network that is being throttled for handover retry.
Should be {@code null} when retryType is
{@link ThrottleStatus#RETRY_TYPE_NEW_CONNECTION}.
@param transport The transport that the data profile has been throttled on.
@param retryType The retry type when throttling expires.
@param expirationTimeMillis The expiration elapsed time of data throttling.
| DataThrottlingEntry::DataThrottlingEntry | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public @NonNull List<Long> getRetryIntervalsMillis() {
return mRetryIntervalsMillis;
} |
@return The data network setup retry intervals in milliseconds. If this is empty, then
{@link #getMaxRetries()} must return 0.
| DataRetryRule::getRetryIntervalsMillis | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public int getMaxRetries() {
return mMaxRetries;
} |
@return The maximum retry times. After reaching the retry times, data retry will not be
scheduled with timer. Only environment changes (e.g. Airplane mode, SIM state, RAT,
registration state changes, etc..) can trigger the retry. Note that if max retries
is 0, then {@link #getRetryIntervalsMillis()} must be {@code null}.
| DataRetryRule::getMaxRetries | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public DataSetupRetryRule(@NonNull String ruleString) {
super(ruleString);
ruleString = ruleString.trim().toLowerCase(Locale.ROOT);
String[] expressions = ruleString.split("\\s*,\\s*");
for (String expression : expressions) {
String[] tokens = expression.trim().split("\\s*=\\s*");
if (tokens.length != 2) {
throw new IllegalArgumentException("illegal rule " + ruleString);
}
String key = tokens[0].trim();
String value = tokens[1].trim();
try {
switch (key) {
case RULE_TAG_PERMANENT_FAIL_CAUSES:
mFailCauses = Arrays.stream(value.split("\\s*\\|\\s*"))
.map(String::trim)
.map(Integer::valueOf)
.collect(Collectors.toSet());
mIsPermanentFailCauseRule = true;
break;
case RULE_TAG_CAPABILITIES:
mNetworkCapabilities = DataUtils
.getNetworkCapabilitiesFromString(value);
break;
}
} catch (Exception e) {
e.printStackTrace();
throw new IllegalArgumentException("illegal rule " + ruleString + ", e=" + e);
}
}
if (mFailCauses.isEmpty() && (mNetworkCapabilities.isEmpty()
|| mNetworkCapabilities.contains(-1))) {
throw new IllegalArgumentException("illegal rule " + ruleString
+ ". Should have either valid network capabilities or fail causes.");
}
} |
Constructor
@param ruleString The retry rule in string format.
@throws IllegalArgumentException if the string can't be parsed to a retry rule.
| DataSetupRetryRule::DataSetupRetryRule | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public boolean isPermanentFailCauseRule() {
return mIsPermanentFailCauseRule;
} |
@return {@code true} if this rule is for permanent fail causes.
| DataSetupRetryRule::isPermanentFailCauseRule | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public boolean canBeMatched(@NonNull @NetCapability int networkCapability,
@DataFailureCause int cause) {
if (!mFailCauses.isEmpty() && !mFailCauses.contains(cause)) {
return false;
}
return mNetworkCapabilities.isEmpty()
|| mNetworkCapabilities.contains(networkCapability);
} |
Check if this rule can be matched.
@param networkCapability The network capability for matching.
@param cause Fail cause from previous setup data request.
@return {@code true} if the retry rule can be matched.
| DataSetupRetryRule::canBeMatched | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public DataRetryEntry(@Nullable DataRetryRule appliedDataRetryRule, long retryDelayMillis) {
this.appliedDataRetryRule = appliedDataRetryRule;
this.retryDelayMillis = retryDelayMillis;
mRetryStateTimestamp = SystemClock.elapsedRealtime();
retryElapsedTime = mRetryStateTimestamp + retryDelayMillis;
} |
Constructor
@param appliedDataRetryRule The applied data retry rule.
@param retryDelayMillis The retry delay in milliseconds.
| DataRetryEntry::DataRetryEntry | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public void setState(@DataRetryState int state) {
mRetryState = state;
mRetryStateTimestamp = SystemClock.elapsedRealtime();
} |
Set the state of a data retry.
@param state The retry state.
| DataRetryEntry::setState | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public @DataRetryState int getState() {
return mRetryState;
} |
@return Get the retry state.
| DataRetryEntry::getState | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public static String retryStateToString(@DataRetryState int retryState) {
switch (retryState) {
case RETRY_STATE_NOT_RETRIED: return "NOT_RETRIED";
case RETRY_STATE_FAILED: return "FAILED";
case RETRY_STATE_SUCCEEDED: return "SUCCEEDED";
case RETRY_STATE_CANCELLED: return "CANCELLED";
default: return "Unknown(" + retryState + ")";
}
} |
Convert retry state to string.
@param retryState Retry state.
@return Retry state in string format.
| DataRetryEntry::retryStateToString | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public @NonNull T setRetryDelay(long retryDelayMillis) {
mRetryDelayMillis = retryDelayMillis;
return (T) this;
} |
Set the data retry delay.
@param retryDelayMillis The retry delay in milliseconds.
@return This builder.
| Builder::setRetryDelay | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public @NonNull T setAppliedRetryRule(@NonNull DataRetryRule dataRetryRule) {
mAppliedDataRetryRule = dataRetryRule;
return (T) this;
} |
Set the applied retry rule.
@param dataRetryRule The rule that used for this data retry.
@return This builder.
| Builder::setAppliedRetryRule | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
private DataSetupRetryEntry(@SetupRetryType int setupRetryType,
@Nullable NetworkRequestList networkRequestList, @NonNull DataProfile dataProfile,
@TransportType int transport,
@Nullable DataSetupRetryRule appliedDataSetupRetryRule, long retryDelayMillis) {
super(appliedDataSetupRetryRule, retryDelayMillis);
this.setupRetryType = setupRetryType;
this.networkRequestList = networkRequestList;
this.dataProfile = dataProfile;
this.transport = transport;
} |
Constructor
@param setupRetryType Data retry type. Could be retry by same data profile or same
capabilities.
@param networkRequestList The network requests to satisfy when retry happens.
@param dataProfile The data profile that will be used for retry.
@param transport The transport to retry data setup.
@param appliedDataSetupRetryRule The applied data setup retry rule.
@param retryDelayMillis The retry delay in milliseconds.
| DataSetupRetryEntry::DataSetupRetryEntry | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
private static String retryTypeToString(@SetupRetryType int setupRetryType) {
switch (setupRetryType) {
case RETRY_TYPE_DATA_PROFILE: return "BY_PROFILE";
case RETRY_TYPE_NETWORK_REQUESTS: return "BY_NETWORK_REQUESTS";
default: return "Unknown(" + setupRetryType + ")";
}
} |
Convert retry type to string.
@param setupRetryType Data setup retry type.
@return Retry type in string format.
| DataSetupRetryEntry::retryTypeToString | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public @NonNull Builder<T> setSetupRetryType(@SetupRetryType int setupRetryType) {
mSetupRetryType = setupRetryType;
return this;
} |
Set the data retry type.
@param setupRetryType Data retry type. Could be retry by same data profile or same
capabilities.
@return This builder.
| Builder::setSetupRetryType | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public @NonNull Builder<T> setNetworkRequestList(
@NonNull NetworkRequestList networkRequestList) {
mNetworkRequestList = networkRequestList;
return this;
} |
Set the network capability to satisfy when retry happens.
@param networkRequestList The network requests to satisfy when retry happens.
@return This builder.
| Builder::setNetworkRequestList | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public @NonNull Builder<T> setDataProfile(@NonNull DataProfile dataProfile) {
mDataProfile = dataProfile;
return this;
} |
Set the data profile that will be used for retry.
@param dataProfile The data profile that will be used for retry.
@return This builder.
| Builder::setDataProfile | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public @NonNull Builder<T> setTransport(@TransportType int transport) {
mTransport = transport;
return this;
} |
Set the transport of the data setup retry.
@param transport The transport to retry data setup.
@return This builder.
| Builder::setTransport | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public @NonNull DataSetupRetryEntry build() {
if (mNetworkRequestList == null) {
throw new IllegalArgumentException("network request list is not specified.");
}
if (mTransport != AccessNetworkConstants.TRANSPORT_TYPE_WWAN
&& mTransport != AccessNetworkConstants.TRANSPORT_TYPE_WLAN) {
throw new IllegalArgumentException("Invalid transport type " + mTransport);
}
if (mSetupRetryType != RETRY_TYPE_DATA_PROFILE
&& mSetupRetryType != RETRY_TYPE_NETWORK_REQUESTS) {
throw new IllegalArgumentException("Invalid setup retry type "
+ mSetupRetryType);
}
return new DataSetupRetryEntry(mSetupRetryType, mNetworkRequestList, mDataProfile,
mTransport, (DataSetupRetryRule) mAppliedDataRetryRule, mRetryDelayMillis);
} |
Build the instance of {@link DataSetupRetryEntry}.
@return The instance of {@link DataSetupRetryEntry}.
| Builder::build | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public DataHandoverRetryEntry(@NonNull DataNetwork dataNetwork,
@Nullable DataHandoverRetryRule appliedDataHandoverRetryRule,
long retryDelayMillis) {
super(appliedDataHandoverRetryRule, retryDelayMillis);
this.dataNetwork = dataNetwork;
} |
Constructor.
@param dataNetwork The data network to be retried for handover.
@param appliedDataHandoverRetryRule The applied data retry rule.
@param retryDelayMillis The retry delay in milliseconds.
| DataHandoverRetryEntry::DataHandoverRetryEntry | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public @NonNull Builder<T> setDataNetwork(@NonNull DataNetwork dataNetwork) {
mDataNetwork = dataNetwork;
return this;
} |
Set the data retry type.
@param dataNetwork The data network to be retried for handover.
@return This builder.
| Builder::setDataNetwork | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public @NonNull DataHandoverRetryEntry build() {
return new DataHandoverRetryEntry(mDataNetwork,
(DataHandoverRetryRule) mAppliedDataRetryRule, mRetryDelayMillis);
} |
Build the instance of {@link DataHandoverRetryEntry}.
@return The instance of {@link DataHandoverRetryEntry}.
| Builder::build | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public DataRetryManagerCallback(@NonNull @CallbackExecutor Executor executor) {
super(executor);
} |
Constructor
@param executor The executor of the callback.
| DataRetryManagerCallback::DataRetryManagerCallback | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public void onDataNetworkSetupRetry(@NonNull DataSetupRetryEntry dataSetupRetryEntry) {} |
Called when data setup retry occurs.
@param dataSetupRetryEntry The data setup retry entry.
| DataRetryManagerCallback::onDataNetworkSetupRetry | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public void onDataNetworkHandoverRetry(
@NonNull DataHandoverRetryEntry dataHandoverRetryEntry) {} |
Called when data handover retry occurs.
@param dataHandoverRetryEntry The data handover retry entry.
| DataRetryManagerCallback::onDataNetworkHandoverRetry | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public void onDataNetworkHandoverRetryStopped(@NonNull DataNetwork dataNetwork) {} |
Called when retry manager determines that the retry will no longer be performed on
this data network.
@param dataNetwork The data network that will never be retried handover.
| DataRetryManagerCallback::onDataNetworkHandoverRetryStopped | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public void onThrottleStatusChanged(@NonNull List<ThrottleStatus> throttleStatusList) {} |
Called when throttle status changed reported from network.
@param throttleStatusList List of throttle status.
| DataRetryManagerCallback::onThrottleStatusChanged | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public DataRetryManager(@NonNull Phone phone,
@NonNull DataNetworkController dataNetworkController,
@NonNull SparseArray<DataServiceManager> dataServiceManagers,
@NonNull Looper looper, @NonNull DataRetryManagerCallback dataRetryManagerCallback) {
super(looper);
mPhone = phone;
mRil = phone.mCi;
mLogTag = "DRM-" + mPhone.getPhoneId();
mDataRetryManagerCallbacks.add(dataRetryManagerCallback);
mDataServiceManagers = dataServiceManagers;
mDataConfigManager = dataNetworkController.getDataConfigManager();
mDataProfileManager = dataNetworkController.getDataProfileManager();
mAlarmManager = mPhone.getContext().getSystemService(AlarmManager.class);
mDataConfigManager.registerCallback(new DataConfigManagerCallback(this::post) {
@Override
public void onCarrierConfigChanged() {
DataRetryManager.this.onCarrierConfigUpdated();
}
});
for (int transport : mPhone.getAccessNetworksManager().getAvailableTransports()) {
mDataServiceManagers.get(transport)
.registerForApnUnthrottled(this, EVENT_DATA_PROFILE_UNTHROTTLED);
}
mDataProfileManager.registerCallback(new DataProfileManagerCallback(this::post) {
@Override
public void onDataProfilesChanged() {
onReset(RESET_REASON_DATA_PROFILES_CHANGED);
}
});
dataNetworkController.registerDataNetworkControllerCallback(
new DataNetworkControllerCallback(this::post) {
/**
* Called when data service is bound.
*
* @param transport The transport of the data service.
*/
@Override
public void onDataServiceBound(@TransportType int transport) {
onReset(RESET_REASON_DATA_SERVICE_BOUND);
}
/**
* Called when data network is connected.
*
* @param transport Transport for the connected network.
* @param dataProfile The data profile of the connected data network.
*/
@Override
public void onDataNetworkConnected(@TransportType int transport,
@NonNull DataProfile dataProfile) {
DataRetryManager.this.onDataNetworkConnected(transport, dataProfile);
}
});
mRil.registerForOn(this, EVENT_RADIO_ON, null);
mRil.registerForModemReset(this, EVENT_MODEM_RESET, null);
// Register intent of alarm manager for long retry timer
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(ACTION_RETRY);
mPhone.getContext().registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (ACTION_RETRY.equals(intent.getAction())) {
DataRetryManager.this.onAlarmIntentRetry(
intent.getIntExtra(ACTION_RETRY_EXTRA_HASHCODE, -1 /*Bad hashcode*/));
}
}
}, intentFilter);
if (mDataConfigManager.shouldResetDataThrottlingWhenTacChanges()) {
mPhone.getServiceStateTracker().registerForAreaCodeChanged(this, EVENT_TAC_CHANGED,
null);
}
} |
Constructor
@param phone The phone instance.
@param dataNetworkController Data network controller.
@param looper The looper to be used by the handler. Currently the handler thread is the
phone process's main thread.
@param dataRetryManagerCallback Data retry callback.
| DataRetryManagerCallback::DataRetryManager | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
private boolean isRetryCancelled(@Nullable DataRetryEntry retryEntry) {
if (retryEntry != null && retryEntry.getState() == DataRetryEntry.RETRY_STATE_NOT_RETRIED) {
return false;
}
log("Retry was removed earlier. " + retryEntry);
return true;
} |
@param retryEntry The retry entry to check.
@return {@code true} if the retry is null or not in RETRY_STATE_NOT_RETRIED state.
| DataRetryManagerCallback::isRetryCancelled | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
private void onCarrierConfigUpdated() {
onReset(RESET_REASON_DATA_CONFIG_CHANGED);
mDataSetupRetryRuleList = mDataConfigManager.getDataSetupRetryRules();
mDataHandoverRetryRuleList = mDataConfigManager.getDataHandoverRetryRules();
log("onDataConfigUpdated: mDataSetupRetryRuleList=" + mDataSetupRetryRuleList
+ ", mDataHandoverRetryRuleList=" + mDataHandoverRetryRuleList);
} |
Called when carrier config is updated.
| DataRetryManagerCallback::onCarrierConfigUpdated | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public void onDataNetworkConnected(@TransportType int transport,
@NonNull DataProfile dataProfile) {
if (dataProfile.getApnSetting() != null) {
dataProfile.getApnSetting().setPermanentFailed(false);
}
onDataProfileUnthrottled(dataProfile, null, transport, true, false);
} |
Called when data network is connected.
@param transport Transport for the connected network.
@param dataProfile The data profile of the connected data network.
| DataRetryManagerCallback::onDataNetworkConnected | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public void evaluateDataSetupRetry(@NonNull DataProfile dataProfile,
@TransportType int transport, @NonNull NetworkRequestList requestList,
@DataFailureCause int cause, long retryDelayMillis) {
post(() -> onEvaluateDataSetupRetry(dataProfile, transport, requestList, cause,
retryDelayMillis));
} |
Evaluate if data setup retry is needed or not. If needed, retry will be scheduled
automatically after evaluation.
@param dataProfile The data profile that has been used in the previous data network setup.
@param transport The transport to retry data setup.
@param requestList The network requests attached to the previous data network setup.
@param cause The fail cause of previous data network setup.
@param retryDelayMillis The retry delay in milliseconds suggested by the network/data
service. {@link android.telephony.data.DataCallResponse#RETRY_DURATION_UNDEFINED}
indicates network/data service did not suggest retry or not. Telephony frameworks would use
its logic to perform data retry.
| DataRetryManagerCallback::evaluateDataSetupRetry | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public void evaluateDataHandoverRetry(@NonNull DataNetwork dataNetwork,
@DataFailureCause int cause, long retryDelayMillis) {
post(() -> onEvaluateDataHandoverRetry(dataNetwork, cause, retryDelayMillis));
} |
Evaluate if data handover retry is needed or not. If needed, retry will be scheduled
automatically after evaluation.
@param dataNetwork The data network to be retried for handover.
@param cause The fail cause of previous data network handover.
@param retryDelayMillis The retry delay in milliseconds suggested by the network/data
service. {@link android.telephony.data.DataCallResponse#RETRY_DURATION_UNDEFINED}
indicates network/data service did not suggest retry or not. Telephony frameworks would use
its logic to perform handover retry.
| DataRetryManagerCallback::evaluateDataHandoverRetry | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public boolean isDataNetworkHandoverRetryStopped(@NonNull DataNetwork dataNetwork) {
// Matching the rule in configured order.
for (DataHandoverRetryRule retryRule : mDataHandoverRetryRuleList) {
int failedCount = getRetryFailedCount(dataNetwork, retryRule);
if (failedCount == retryRule.getMaxRetries()) {
log("Data handover retry failed for " + failedCount + " times. Stopped "
+ "handover retry.");
return true;
}
}
return false;
} |
@param dataNetwork The data network to check.
@return {@code true} if the data network had failed the maximum number of attempts for
handover according to any retry rules.
| DataRetryManagerCallback::isDataNetworkHandoverRetryStopped | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
private void onReset(@RetryResetReason int reason) {
logl("Remove all retry and throttling entries, reason=" + resetReasonToString(reason));
removeMessages(EVENT_DATA_SETUP_RETRY);
removeMessages(EVENT_DATA_HANDOVER_RETRY);
mDataRetryEntries.stream()
.filter(entry -> entry.getState() == DataRetryEntry.RETRY_STATE_NOT_RETRIED)
.forEach(entry -> entry.setState(DataRetryEntry.RETRY_STATE_CANCELLED));
for (DataThrottlingEntry dataThrottlingEntry : mDataThrottlingEntries) {
DataProfile dataProfile = dataThrottlingEntry.dataProfile;
String apn = dataProfile.getApnSetting() != null
? dataProfile.getApnSetting().getApnName() : null;
onDataProfileUnthrottled(dataProfile, apn, dataThrottlingEntry.transport, false, true);
}
mDataThrottlingEntries.clear();
} |
@param dataNetwork The data network to check.
@return {@code true} if the data network had failed the maximum number of attempts for
handover according to any retry rules.
public boolean isDataNetworkHandoverRetryStopped(@NonNull DataNetwork dataNetwork) {
// Matching the rule in configured order.
for (DataHandoverRetryRule retryRule : mDataHandoverRetryRuleList) {
int failedCount = getRetryFailedCount(dataNetwork, retryRule);
if (failedCount == retryRule.getMaxRetries()) {
log("Data handover retry failed for " + failedCount + " times. Stopped "
+ "handover retry.");
return true;
}
}
return false;
}
/** Cancel all retries and throttling entries. | DataRetryManagerCallback::onReset | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
private int getRetryFailedCount(@NonNull DataNetwork dataNetwork,
@NonNull DataHandoverRetryRule dataRetryRule) {
int count = 0;
for (int i = mDataRetryEntries.size() - 1; i >= 0; i--) {
if (mDataRetryEntries.get(i) instanceof DataHandoverRetryEntry) {
DataHandoverRetryEntry entry = (DataHandoverRetryEntry) mDataRetryEntries.get(i);
if (entry.dataNetwork == dataNetwork
&& dataRetryRule.equals(entry.appliedDataRetryRule)) {
if (entry.getState() == DataRetryEntry.RETRY_STATE_SUCCEEDED
|| entry.getState() == DataRetryEntry.RETRY_STATE_CANCELLED) {
break;
}
count++;
}
}
}
return count;
} |
Count how many times the same setup retry rule has been used for this data network but
failed.
@param dataNetwork The data network to check.
@param dataRetryRule The data retry rule.
@return The failed count since last successful data setup.
| DataRetryManagerCallback::getRetryFailedCount | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
private int getRetryFailedCount(@NetCapability int networkCapability,
@NonNull DataSetupRetryRule dataRetryRule, @TransportType int transport) {
int count = 0;
for (int i = mDataRetryEntries.size() - 1; i >= 0; i--) {
if (mDataRetryEntries.get(i) instanceof DataSetupRetryEntry) {
DataSetupRetryEntry entry = (DataSetupRetryEntry) mDataRetryEntries.get(i);
// count towards the last succeeded data setup.
if (entry.setupRetryType == DataSetupRetryEntry.RETRY_TYPE_NETWORK_REQUESTS
&& entry.transport == transport) {
if (entry.networkRequestList.isEmpty()) {
String msg = "Invalid data retry entry detected";
logl(msg);
loge("mDataRetryEntries=" + mDataRetryEntries);
AnomalyReporter.reportAnomaly(
UUID.fromString("afeab78c-c0b0-49fc-a51f-f766814d7aa6"),
msg,
mPhone.getCarrierId());
continue;
}
if (entry.networkRequestList.get(0).getApnTypeNetworkCapability()
== networkCapability
&& entry.appliedDataRetryRule.equals(dataRetryRule)) {
if (entry.getState() == DataRetryEntry.RETRY_STATE_SUCCEEDED
|| entry.getState() == DataRetryEntry.RETRY_STATE_CANCELLED) {
break;
}
count++;
}
}
}
}
return count;
} |
Count how many times the same setup retry rule has been used for the capability since
last success data setup.
@param networkCapability The network capability to check.
@param dataRetryRule The data retry rule.
@param transport The transport on which setup failure has occurred.
@return The failed count since last successful data setup.
| DataRetryManagerCallback::getRetryFailedCount | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
private void schedule(@NonNull DataRetryEntry dataRetryEntry) {
logl("Scheduled data retry " + dataRetryEntry
+ " hashcode=" + dataRetryEntry.hashCode());
mDataRetryEntries.add(dataRetryEntry);
if (mDataRetryEntries.size() >= MAXIMUM_HISTORICAL_ENTRIES) {
// Discard the oldest retry entry.
mDataRetryEntries.remove(0);
}
// When the device is in doze mode, the handler message might be extremely delayed because
// handler uses relative system time(not counting sleep) which is inaccurate even when we
// enter the maintenance window.
// Therefore, we use alarm manager when we need to schedule long timers.
if (dataRetryEntry.retryDelayMillis <= RETRY_LONG_DELAY_TIMER_THRESHOLD_MILLIS) {
sendMessageDelayed(obtainMessage(dataRetryEntry instanceof DataSetupRetryEntry
? EVENT_DATA_SETUP_RETRY : EVENT_DATA_HANDOVER_RETRY, dataRetryEntry),
dataRetryEntry.retryDelayMillis);
} else {
Intent intent = new Intent(ACTION_RETRY);
intent.putExtra(ACTION_RETRY_EXTRA_HASHCODE, dataRetryEntry.hashCode());
// No need to wake up the device at the exact time, the retry can wait util next time
// the device wake up to save power.
mAlarmManager.setAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME,
dataRetryEntry.retryElapsedTime,
PendingIntent.getBroadcast(mPhone.getContext(),
dataRetryEntry.hashCode() /*Unique identifier of this retry attempt*/,
intent,
PendingIntent.FLAG_IMMUTABLE));
}
} |
Schedule the data retry.
@param dataRetryEntry The data retry entry.
| DataRetryManagerCallback::schedule | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
private void onAlarmIntentRetry(int retryHashcode) {
DataRetryEntry dataRetryEntry = mDataRetryEntries.stream()
.filter(entry -> entry.hashCode() == retryHashcode)
.findAny()
.orElse(null);
logl("onAlarmIntentRetry: found " + dataRetryEntry + " with hashcode " + retryHashcode);
if (dataRetryEntry != null) {
sendMessage(obtainMessage(dataRetryEntry instanceof DataSetupRetryEntry
? EVENT_DATA_SETUP_RETRY : EVENT_DATA_HANDOVER_RETRY, dataRetryEntry));
}
} |
Called when it's time to retry scheduled by Alarm Manager.
@param retryHashcode The hashcode is the unique identifier of which retry entry to retry.
| DataRetryManagerCallback::onAlarmIntentRetry | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
private void updateThrottleStatus(@NonNull DataProfile dataProfile,
@Nullable NetworkRequestList networkRequestList,
@Nullable DataNetwork dataNetwork, @RetryType int retryType,
@TransportType int transport, @ElapsedRealtimeLong long expirationTime) {
DataThrottlingEntry entry = new DataThrottlingEntry(dataProfile, networkRequestList,
dataNetwork, transport, retryType, expirationTime);
// Remove previous entry that contains the same data profile. Therefore it should always
// contain at maximum all the distinct data profiles of the current subscription.
mDataThrottlingEntries.removeIf(
throttlingEntry -> dataProfile.equals(throttlingEntry.dataProfile));
if (mDataThrottlingEntries.size() >= MAXIMUM_HISTORICAL_ENTRIES) {
// If we don't see the anomaly report after U release, we should remove this check for
// the commented reason above.
AnomalyReporter.reportAnomaly(
UUID.fromString("24fd4d46-1d0f-4b13-b7d6-7bad70b8289b"),
"DataRetryManager throttling more than 100 data profiles",
mPhone.getCarrierId());
mDataThrottlingEntries.remove(0);
}
logl("Add throttling entry " + entry);
mDataThrottlingEntries.add(entry);
// For backwards compatibility, we use RETRY_TYPE_NONE if network suggests never retry.
final int dataRetryType = expirationTime == Long.MAX_VALUE
? ThrottleStatus.RETRY_TYPE_NONE : retryType;
// Report to the clients.
final List<ThrottleStatus> throttleStatusList = new ArrayList<>();
if (dataProfile.getApnSetting() != null) {
throttleStatusList.addAll(dataProfile.getApnSetting().getApnTypes().stream()
.map(apnType -> new ThrottleStatus.Builder()
.setApnType(apnType)
.setRetryType(dataRetryType)
.setSlotIndex(mPhone.getPhoneId())
.setThrottleExpiryTimeMillis(expirationTime)
.setTransportType(transport)
.build())
.collect(Collectors.toList()));
}
mDataRetryManagerCallbacks.forEach(callback -> callback.invokeFromExecutor(
() -> callback.onThrottleStatusChanged(throttleStatusList)));
} |
Add the latest throttling request and report it to the clients.
@param dataProfile The data profile that is being throttled for setup/handover retry.
@param networkRequestList The associated network request list when throttling happened.
Can be {@code null} when retry type is {@link ThrottleStatus#RETRY_TYPE_HANDOVER}.
@param dataNetwork The data network that is being throttled for handover retry.
Must be {@code null} when retryType is
{@link ThrottleStatus#RETRY_TYPE_NEW_CONNECTION}.
@param retryType The retry type when throttling expires.
@param transport The transport that the data profile has been throttled on.
@param expirationTime The expiration time of data throttling. This is the time retrieved from
{@link SystemClock#elapsedRealtime()}.
| DataRetryManagerCallback::updateThrottleStatus | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
private void onDataProfileUnthrottled(@Nullable DataProfile dataProfile, @Nullable String apn,
@TransportType int transport, boolean remove, boolean retry) {
log("onDataProfileUnthrottled: dataProfile=" + dataProfile + ", apn=" + apn
+ ", transport=" + AccessNetworkConstants.transportTypeToString(transport)
+ ", remove=" + remove);
long now = SystemClock.elapsedRealtime();
List<DataThrottlingEntry> dataUnthrottlingEntries = new ArrayList<>();
if (dataProfile != null) {
// For AIDL-based HAL. There should be only one entry containing this data profile.
// Note that the data profile reconstructed from DataProfileInfo.aidl will not be
// equal to the data profiles kept in data profile manager (due to some fields missing
// in DataProfileInfo.aidl), so we need to get the equivalent data profile from data
// profile manager.
Stream<DataThrottlingEntry> stream = mDataThrottlingEntries.stream();
stream = stream.filter(entry -> entry.expirationTimeMillis > now);
if (dataProfile.getApnSetting() != null) {
stream = stream
.filter(entry -> entry.dataProfile.getApnSetting() != null)
.filter(entry -> entry.dataProfile.getApnSetting().getApnName()
.equals(dataProfile.getApnSetting().getApnName()));
}
stream = stream.filter(entry -> Objects.equals(entry.dataProfile.getTrafficDescriptor(),
dataProfile.getTrafficDescriptor()));
dataUnthrottlingEntries = stream.collect(Collectors.toList());
} else if (apn != null) {
// For HIDL 1.6 or below
dataUnthrottlingEntries = mDataThrottlingEntries.stream()
.filter(entry -> entry.expirationTimeMillis > now
&& entry.dataProfile.getApnSetting() != null
&& apn.equals(entry.dataProfile.getApnSetting().getApnName())
&& entry.transport == transport)
.collect(Collectors.toList());
}
if (dataUnthrottlingEntries.isEmpty()) {
log("onDataProfileUnthrottled: Nothing to unthrottle.");
return;
}
// Report to the clients.
final List<ThrottleStatus> throttleStatusList = new ArrayList<>();
DataProfile unthrottledProfile = null;
int retryType = ThrottleStatus.RETRY_TYPE_NONE;
if (dataUnthrottlingEntries.get(0).retryType == ThrottleStatus.RETRY_TYPE_NEW_CONNECTION) {
unthrottledProfile = dataUnthrottlingEntries.get(0).dataProfile;
retryType = ThrottleStatus.RETRY_TYPE_NEW_CONNECTION;
} else if (dataUnthrottlingEntries.get(0).retryType == ThrottleStatus.RETRY_TYPE_HANDOVER) {
unthrottledProfile = dataUnthrottlingEntries.get(0).dataNetwork.getDataProfile();
retryType = ThrottleStatus.RETRY_TYPE_HANDOVER;
}
// Make it final so it can be used in the lambda function below.
final int dataRetryType = retryType;
if (unthrottledProfile != null && unthrottledProfile.getApnSetting() != null) {
unthrottledProfile.getApnSetting().setPermanentFailed(false);
throttleStatusList.addAll(unthrottledProfile.getApnSetting().getApnTypes().stream()
.map(apnType -> new ThrottleStatus.Builder()
.setApnType(apnType)
.setSlotIndex(mPhone.getPhoneId())
.setNoThrottle()
.setRetryType(dataRetryType)
.setTransportType(transport)
.build())
.collect(Collectors.toList()));
}
mDataRetryManagerCallbacks.forEach(callback -> callback.invokeFromExecutor(
() -> callback.onThrottleStatusChanged(throttleStatusList)));
if (unthrottledProfile != null) {
// cancel pending retries since we will soon schedule an immediate retry
cancelRetriesForDataProfile(unthrottledProfile, transport);
}
logl("onDataProfileUnthrottled: Removing the following throttling entries. "
+ dataUnthrottlingEntries);
if (retry) {
for (DataThrottlingEntry entry : dataUnthrottlingEntries) {
// Immediately retry after unthrottling.
if (entry.retryType == ThrottleStatus.RETRY_TYPE_NEW_CONNECTION) {
schedule(new DataSetupRetryEntry.Builder<>()
.setDataProfile(entry.dataProfile)
.setTransport(entry.transport)
.setSetupRetryType(DataSetupRetryEntry.RETRY_TYPE_DATA_PROFILE)
.setNetworkRequestList(entry.networkRequestList)
.setRetryDelay(0)
.build());
} else if (entry.retryType == ThrottleStatus.RETRY_TYPE_HANDOVER) {
schedule(new DataHandoverRetryEntry.Builder<>()
.setDataNetwork(entry.dataNetwork)
.setRetryDelay(0)
.build());
}
}
}
if (remove) {
mDataThrottlingEntries.removeAll(dataUnthrottlingEntries);
}
} |
Called when network/modem informed to cancelling the previous throttling request.
@param dataProfile The data profile to be unthrottled. Note this is only supported on HAL
with AIDL interface. When this is set, {@code apn} must be {@code null}.
@param apn The apn to be unthrottled. Note this should be only used for HIDL 1.6 or below.
When this is set, {@code dataProfile} must be {@code null}.
@param transport The transport that this unthrottling request is on.
@param remove Whether to remove unthrottled entries from the list of entries.
@param retry Whether schedule retry after unthrottling.
| DataRetryManagerCallback::onDataProfileUnthrottled | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
private void cancelRetriesForDataProfile(@NonNull DataProfile dataProfile,
@TransportType int transport) {
logl("cancelRetriesForDataProfile: Canceling pending retries for " + dataProfile);
mDataRetryEntries.stream()
.filter(entry -> {
if (entry.getState() == DataRetryEntry.RETRY_STATE_NOT_RETRIED) {
if (entry instanceof DataSetupRetryEntry) {
DataSetupRetryEntry retryEntry = (DataSetupRetryEntry) entry;
return dataProfile.equals(retryEntry.dataProfile)
&& transport == retryEntry.transport;
} else if (entry instanceof DataHandoverRetryEntry) {
DataHandoverRetryEntry retryEntry = (DataHandoverRetryEntry) entry;
return dataProfile.equals(retryEntry.dataNetwork.getDataProfile());
}
}
return false;
})
.forEach(entry -> entry.setState(DataRetryEntry.RETRY_STATE_CANCELLED));
} |
Cancel pending retries that uses the specified data profile, with specified target transport.
@param dataProfile The data profile to cancel.
@param transport The target {@link TransportType} on which the retry to cancel.
| DataRetryManagerCallback::cancelRetriesForDataProfile | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public boolean isSimilarNetworkRequestRetryScheduled(
@NonNull TelephonyNetworkRequest networkRequest, @TransportType int transport) {
long now = SystemClock.elapsedRealtime();
for (int i = mDataRetryEntries.size() - 1; i >= 0; i--) {
if (mDataRetryEntries.get(i) instanceof DataSetupRetryEntry) {
DataSetupRetryEntry entry = (DataSetupRetryEntry) mDataRetryEntries.get(i);
if (entry.getState() == DataRetryEntry.RETRY_STATE_NOT_RETRIED
&& entry.setupRetryType
== DataSetupRetryEntry.RETRY_TYPE_NETWORK_REQUESTS
&& entry.retryElapsedTime > now) {
if (entry.networkRequestList.isEmpty()) {
String msg = "Invalid data retry entry detected";
logl(msg);
loge("mDataRetryEntries=" + mDataRetryEntries);
AnomalyReporter.reportAnomaly(
UUID.fromString("781af571-f55d-476d-b510-7a5381f633dc"),
msg,
mPhone.getCarrierId());
continue;
}
if (entry.networkRequestList.get(0).getApnTypeNetworkCapability()
== networkRequest.getApnTypeNetworkCapability()
&& entry.transport == transport) {
return true;
}
}
}
}
return false;
} |
Check if there is any similar network request scheduled to retry. The definition of similar
is that network requests have same APN capability and on the same transport.
@param networkRequest The network request to check.
@param transport The transport that this request is on.
@return {@code true} if similar network request scheduled to retry.
| DataRetryManagerCallback::isSimilarNetworkRequestRetryScheduled | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public boolean isDataProfileThrottled(@NonNull DataProfile dataProfile,
@TransportType int transport) {
long now = SystemClock.elapsedRealtime();
return mDataThrottlingEntries.stream().anyMatch(
entry -> entry.dataProfile.equals(dataProfile) && entry.expirationTimeMillis > now
&& entry.transport == transport);
} |
Check if a specific data profile is explicitly throttled by the network.
@param dataProfile The data profile to check.
@param transport The transport that the request is on.
@return {@code true} if the data profile is currently throttled.
| DataRetryManagerCallback::isDataProfileThrottled | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public void cancelPendingHandoverRetry(@NonNull DataNetwork dataNetwork) {
sendMessage(obtainMessage(EVENT_CANCEL_PENDING_HANDOVER_RETRY, dataNetwork));
} |
Cancel pending scheduled handover retry entries.
@param dataNetwork The data network that was originally scheduled for handover retry.
| DataRetryManagerCallback::cancelPendingHandoverRetry | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
private void onCancelPendingHandoverRetry(@NonNull DataNetwork dataNetwork) {
mDataRetryEntries.stream()
.filter(entry -> entry instanceof DataHandoverRetryEntry
&& ((DataHandoverRetryEntry) entry).dataNetwork == dataNetwork
&& entry.getState() == DataRetryEntry.RETRY_STATE_NOT_RETRIED)
.forEach(entry -> entry.setState(DataRetryEntry.RETRY_STATE_CANCELLED));
} |
Called when cancelling pending scheduled handover retry entries.
@param dataNetwork The data network that was originally scheduled for handover retry.
| DataRetryManagerCallback::onCancelPendingHandoverRetry | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public boolean isAnyHandoverRetryScheduled(@NonNull DataNetwork dataNetwork) {
return mDataRetryEntries.stream()
.filter(DataHandoverRetryEntry.class::isInstance)
.map(DataHandoverRetryEntry.class::cast)
.anyMatch(entry -> entry.getState() == DataRetryEntry.RETRY_STATE_NOT_RETRIED
&& entry.dataNetwork == dataNetwork);
} |
Check if there is any data handover retry scheduled.
@param dataNetwork The network network to retry handover.
@return {@code true} if there is retry scheduled for this network capability.
| DataRetryManagerCallback::isAnyHandoverRetryScheduled | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/telephony/data/DataRetryManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/telephony/data/DataRetryManager.java | MIT |
public EuiccCardErrorException(@OperationCode int operationCode, int errorCode) {
mOperationCode = operationCode;
mErrorCode = errorCode;
mErrorDetails = null;
} |
Creates an exception with an error code in the response of an APDU command.
@param errorCode The meaning of the code depends on each APDU command. It should always be
non-negative.
| EuiccCardErrorException::EuiccCardErrorException | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/telephony/uicc/euicc/EuiccCardErrorException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/uicc/euicc/EuiccCardErrorException.java | MIT |
public EuiccCardErrorException(@OperationCode int operationCode, int errorCode,
@Nullable Asn1Node errorDetails) {
mOperationCode = operationCode;
mErrorCode = errorCode;
mErrorDetails = errorDetails;
} |
Creates an exception with an error code and the error details in the response of an APDU
command.
@param errorCode The meaning of the code depends on each APDU command. It should always be
non-negative.
@param errorDetails The content of the details depends on each APDU command.
| EuiccCardErrorException::EuiccCardErrorException | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/telephony/uicc/euicc/EuiccCardErrorException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/uicc/euicc/EuiccCardErrorException.java | MIT |
public int getErrorCode() {
return mErrorCode;
} |
Creates an exception with an error code and the error details in the response of an APDU
command.
@param errorCode The meaning of the code depends on each APDU command. It should always be
non-negative.
@param errorDetails The content of the details depends on each APDU command.
public EuiccCardErrorException(@OperationCode int operationCode, int errorCode,
@Nullable Asn1Node errorDetails) {
mOperationCode = operationCode;
mErrorCode = errorCode;
mErrorDetails = errorDetails;
}
/** @return The error code. The meaning of the code depends on each APDU command. | EuiccCardErrorException::getErrorCode | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/telephony/uicc/euicc/EuiccCardErrorException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/uicc/euicc/EuiccCardErrorException.java | MIT |
public int getOperationCode() {
return mOperationCode;
} |
Creates an exception with an error code and the error details in the response of an APDU
command.
@param errorCode The meaning of the code depends on each APDU command. It should always be
non-negative.
@param errorDetails The content of the details depends on each APDU command.
public EuiccCardErrorException(@OperationCode int operationCode, int errorCode,
@Nullable Asn1Node errorDetails) {
mOperationCode = operationCode;
mErrorCode = errorCode;
mErrorDetails = errorDetails;
}
/** @return The error code. The meaning of the code depends on each APDU command.
public int getErrorCode() {
return mErrorCode;
}
/** @return The operation code. | EuiccCardErrorException::getOperationCode | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/telephony/uicc/euicc/EuiccCardErrorException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/uicc/euicc/EuiccCardErrorException.java | MIT |
protected Marshaler(
MarshalQueryable<T> query, TypeReference<T> typeReference, int nativeType) {
mTypeReference = checkNotNull(typeReference, "typeReference must not be null");
mNativeType = checkNativeType(nativeType);
if (!query.isTypeMappingSupported(typeReference, nativeType)) {
throw new UnsupportedOperationException(
"Unsupported type marshaling for managed type "
+ typeReference + " and native type "
+ MarshalHelpers.toStringNativeType(nativeType));
}
} |
Instantiate a marshaler between a single managed/native type combination.
<p>This particular managed/native type combination must be supported by
{@link #isTypeMappingSupported}.</p>
@param query an instance of {@link MarshalQueryable}
@param typeReference the managed type reference
Must be one for which {@link #isTypeMappingSupported} returns {@code true}
@param nativeType the native type, e.g.
{@link android.hardware.camera2.impl.CameraMetadataNative#TYPE_BYTE TYPE_BYTE}.
Must be one for which {@link #isTypeMappingSupported} returns {@code true}.
@throws NullPointerException if any args were {@code null}
@throws UnsupportedOperationException if the type mapping was not supported
| Marshaler::Marshaler | java | Reginer/aosp-android-jar | android-33/src/android/hardware/camera2/marshal/Marshaler.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/hardware/camera2/marshal/Marshaler.java | MIT |
public int calculateMarshalSize(T value) {
int nativeSize = getNativeSize();
if (nativeSize == NATIVE_SIZE_DYNAMIC) {
throw new AssertionError("Override this function for dynamically-sized objects");
}
return nativeSize;
} |
Get the size in bytes for how much space would be required to write this {@code value}
into a byte buffer using the given {@code nativeType}.
<p>If the size of this {@code T} instance when serialized into a buffer is always constant,
then this method will always return the same value (and particularly, it will return
an equivalent value to {@link #getNativeSize()}.</p>
<p>Overriding this method is a must when the size is {@link NATIVE_SIZE_DYNAMIC dynamic}.</p>
@param value the value of type T that we wish to write into the byte buffer
@return the size that would need to be written to the byte buffer
| Marshaler::calculateMarshalSize | java | Reginer/aosp-android-jar | android-33/src/android/hardware/camera2/marshal/Marshaler.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/hardware/camera2/marshal/Marshaler.java | MIT |
public TypeReference<T> getTypeReference() {
return mTypeReference;
} |
The type reference for {@code T} for the managed type side of this marshaler.
| Marshaler::getTypeReference | java | Reginer/aosp-android-jar | android-33/src/android/hardware/camera2/marshal/Marshaler.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/hardware/camera2/marshal/Marshaler.java | MIT |
public int getNativeType() {
return mNativeType;
} |
The type reference for {@code T} for the managed type side of this marshaler.
public TypeReference<T> getTypeReference() {
return mTypeReference;
}
/** The native type corresponding to this marshaler for the native side of this marshaler. | Marshaler::getNativeType | java | Reginer/aosp-android-jar | android-33/src/android/hardware/camera2/marshal/Marshaler.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/hardware/camera2/marshal/Marshaler.java | MIT |
public int getResult() {
return result;
} |
Gets the result of the operation.
<p>May be one of the predefined {@code RESULT_} constants in EuiccService or any
implementation-specific code starting with {@link EuiccService#RESULT_FIRST_USER}.
| GetDownloadableSubscriptionMetadataResult::getResult | java | Reginer/aosp-android-jar | android-32/src/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java | MIT |
public GetDownloadableSubscriptionMetadataResult(int result,
@Nullable DownloadableSubscription subscription) {
this.result = result;
if (this.result == EuiccService.RESULT_OK) {
this.mSubscription = subscription;
} else {
if (subscription != null) {
throw new IllegalArgumentException(
"Error result with non-null subscription: " + result);
}
this.mSubscription = null;
}
} |
Construct a new {@link GetDownloadableSubscriptionMetadataResult}.
@param result Result of the operation. May be one of the predefined {@code RESULT_} constants
in EuiccService or any implementation-specific code starting with
{@link EuiccService#RESULT_FIRST_USER}.
@param subscription The subscription with filled-in metadata. Should only be provided if the
result is {@link EuiccService#RESULT_OK}.
| GetDownloadableSubscriptionMetadataResult::GetDownloadableSubscriptionMetadataResult | java | Reginer/aosp-android-jar | android-32/src/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/service/euicc/GetDownloadableSubscriptionMetadataResult.java | MIT |
public static final Callback DEFAULT = new Callback() {}; |
Default implementation of the {@link Callback} interface which accepts all paths.
@hide
| ZipPathValidator::Callback | java | Reginer/aosp-android-jar | android-35/src/dalvik/system/ZipPathValidator.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/dalvik/system/ZipPathValidator.java | MIT |
public static void clearCallback() {
sInstance = DEFAULT;
} |
Clears the current validation mechanism by setting the current callback instance to a default
validation.
| ZipPathValidator::clearCallback | java | Reginer/aosp-android-jar | android-35/src/dalvik/system/ZipPathValidator.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/dalvik/system/ZipPathValidator.java | MIT |
public static void setCallback(@NonNull Callback callback) {
sInstance = Objects.requireNonNull(callback);
} |
Sets the current callback implementation for zip paths.
<p>
The provided callback should not perform IO or any blocking operations, but only perform path
validation. A typical implementation will validate String entries in a single pass and throw
a {@link ZipException} if the path contains potentially hazardous components such as "..".
@param callback An instance of {@link Callback}'s implementation.
| ZipPathValidator::setCallback | java | Reginer/aosp-android-jar | android-35/src/dalvik/system/ZipPathValidator.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/dalvik/system/ZipPathValidator.java | MIT |
public static @NonNull Callback getInstance() {
return sInstance;
} |
Retrieves the current validator set by {@link #setCallback(Callback)}.
@return Current callback.
@hide
| ZipPathValidator::getInstance | java | Reginer/aosp-android-jar | android-35/src/dalvik/system/ZipPathValidator.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/dalvik/system/ZipPathValidator.java | MIT |
public static boolean isClear() {
return sInstance.equals(DEFAULT);
} |
Returns true if the current validator is the default implementation {@link DEFAULT},
otherwise false.
@hide
| ZipPathValidator::isClear | java | Reginer/aosp-android-jar | android-35/src/dalvik/system/ZipPathValidator.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/dalvik/system/ZipPathValidator.java | MIT |
default void onZipEntryAccess(@NonNull String path) throws ZipException {} |
Called to check the validity of the path of a zip entry. The default implementation
accepts all paths without raising any exceptions.
<p>
This method will be called by {@link java.util.zip.ZipInputStream#getNextEntry} or
{@link java.util.zip.ZipFile#ZipFile(String)}.
@param path The name of the zip entry.
@throws ZipException If the zip entry is invalid depending on the implementation.
| ZipPathValidator::onZipEntryAccess | java | Reginer/aosp-android-jar | android-35/src/dalvik/system/ZipPathValidator.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/dalvik/system/ZipPathValidator.java | MIT |
protected CertPath(String type) {
this.type = type;
} |
Creates a {@code CertPath} of the specified type.
<p>
This constructor is protected because most users should use a
{@code CertificateFactory} to create {@code CertPath}s.
@param type the standard name of the type of
{@code Certificate}s in this path
| CertPath::CertPath | java | Reginer/aosp-android-jar | android-35/src/java/security/cert/CertPath.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPath.java | MIT |
public String getType() {
return type;
} |
Returns the type of {@code Certificate}s in this certification
path. This is the same string that would be returned by
{@link java.security.cert.Certificate#getType() cert.getType()}
for all {@code Certificate}s in the certification path.
@return the type of {@code Certificate}s in this certification
path (never null)
| CertPath::getType | java | Reginer/aosp-android-jar | android-35/src/java/security/cert/CertPath.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPath.java | MIT |
public boolean equals(Object other) {
if (this == other)
return true;
if (! (other instanceof CertPath))
return false;
CertPath otherCP = (CertPath) other;
if (! otherCP.getType().equals(type))
return false;
List<? extends Certificate> thisCertList = this.getCertificates();
List<? extends Certificate> otherCertList = otherCP.getCertificates();
return(thisCertList.equals(otherCertList));
} |
Compares this certification path for equality with the specified
object. Two {@code CertPath}s are equal if and only if their
types are equal and their certificate {@code List}s (and by
implication the {@code Certificate}s in those {@code List}s)
are equal. A {@code CertPath} is never equal to an object that is
not a {@code CertPath}.
<p>
This algorithm is implemented by this method. If it is overridden,
the behavior specified here must be maintained.
@param other the object to test for equality with this certification path
@return true if the specified object is equal to this certification path,
false otherwise
| CertPath::equals | java | Reginer/aosp-android-jar | android-35/src/java/security/cert/CertPath.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPath.java | MIT |
public int hashCode() {
int hashCode = type.hashCode();
hashCode = 31*hashCode + getCertificates().hashCode();
return hashCode;
} |
Returns the hashcode for this certification path. The hash code of
a certification path is defined to be the result of the following
calculation:
<pre>{@code
hashCode = path.getType().hashCode();
hashCode = 31*hashCode + path.getCertificates().hashCode();
}</pre>
This ensures that {@code path1.equals(path2)} implies that
{@code path1.hashCode()==path2.hashCode()} for any two certification
paths, {@code path1} and {@code path2}, as required by the
general contract of {@code Object.hashCode}.
@return the hashcode value for this certification path
| CertPath::hashCode | java | Reginer/aosp-android-jar | android-35/src/java/security/cert/CertPath.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPath.java | MIT |
public String toString() {
StringBuilder sb = new StringBuilder();
Iterator<? extends Certificate> stringIterator =
getCertificates().iterator();
sb.append("\n" + type + " Cert Path: length = "
+ getCertificates().size() + ".\n");
sb.append("[\n");
int i = 1;
while (stringIterator.hasNext()) {
sb.append("=========================================="
+ "===============Certificate " + i + " start.\n");
Certificate stringCert = stringIterator.next();
sb.append(stringCert.toString());
sb.append("\n========================================"
+ "=================Certificate " + i + " end.\n\n\n");
i++;
}
sb.append("\n]");
return sb.toString();
} |
Returns a string representation of this certification path.
This calls the {@code toString} method on each of the
{@code Certificate}s in the path.
@return a string representation of this certification path
| CertPath::toString | java | Reginer/aosp-android-jar | android-35/src/java/security/cert/CertPath.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPath.java | MIT |
protected Object writeReplace() throws ObjectStreamException {
try {
return new CertPathRep(type, getEncoded());
} catch (CertificateException ce) {
NotSerializableException nse =
new NotSerializableException
("java.security.cert.CertPath: " + type);
nse.initCause(ce);
throw nse;
}
} |
Replaces the {@code CertPath} to be serialized with a
{@code CertPathRep} object.
@return the {@code CertPathRep} to be serialized
@throws ObjectStreamException if a {@code CertPathRep} object
representing this certification path could not be created
| CertPath::writeReplace | java | Reginer/aosp-android-jar | android-35/src/java/security/cert/CertPath.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPath.java | MIT |
protected CertPathRep(String type, byte[] data) {
this.type = type;
this.data = data;
} |
Creates a {@code CertPathRep} with the specified
type and encoded form of a certification path.
@param type the standard name of a {@code CertPath} type
@param data the encoded form of the certification path
| CertPathRep::CertPathRep | java | Reginer/aosp-android-jar | android-35/src/java/security/cert/CertPath.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPath.java | MIT |
protected Object readResolve() throws ObjectStreamException {
try {
CertificateFactory cf = CertificateFactory.getInstance(type);
return cf.generateCertPath(new ByteArrayInputStream(data));
} catch (CertificateException ce) {
NotSerializableException nse =
new NotSerializableException
("java.security.cert.CertPath: " + type);
nse.initCause(ce);
throw nse;
}
} |
Returns a {@code CertPath} constructed from the type and data.
@return the resolved {@code CertPath} object
@throws ObjectStreamException if a {@code CertPath} could not
be constructed
| CertPathRep::readResolve | java | Reginer/aosp-android-jar | android-35/src/java/security/cert/CertPath.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/security/cert/CertPath.java | MIT |
public EventListenerProxy(T listener) {
this.listener = listener;
} |
Creates a proxy for the specified listener.
@param listener the listener object
| EventListenerProxy::EventListenerProxy | java | Reginer/aosp-android-jar | android-35/src/java/util/EventListenerProxy.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/EventListenerProxy.java | MIT |
public T getListener() {
return this.listener;
} |
Returns the listener associated with the proxy.
@return the listener associated with the proxy
| EventListenerProxy::getListener | java | Reginer/aosp-android-jar | android-35/src/java/util/EventListenerProxy.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/util/EventListenerProxy.java | MIT |
public int getRenameBytesFrom() {
return mRenameBytesFrom;
} |
A filter for Bluetooth LE devices
@see ScanFilter
public final class BluetoothLeDeviceFilter implements DeviceFilter<ScanResult> {
private static final boolean DEBUG = false;
private static final String LOG_TAG = "BluetoothLeDeviceFilter";
private static final int RENAME_PREFIX_LENGTH_LIMIT = 10;
private final Pattern mNamePattern;
private final ScanFilter mScanFilter;
private final byte[] mRawDataFilter;
private final byte[] mRawDataFilterMask;
private final String mRenamePrefix;
private final String mRenameSuffix;
private final int mRenameBytesFrom;
private final int mRenameBytesLength;
private final int mRenameNameFrom;
private final int mRenameNameLength;
private final boolean mRenameBytesReverseOrder;
private BluetoothLeDeviceFilter(Pattern namePattern, ScanFilter scanFilter,
byte[] rawDataFilter, byte[] rawDataFilterMask, String renamePrefix,
String renameSuffix, int renameBytesFrom, int renameBytesLength,
int renameNameFrom, int renameNameLength, boolean renameBytesReverseOrder) {
mNamePattern = namePattern;
mScanFilter = ObjectUtils.firstNotNull(scanFilter, ScanFilter.EMPTY);
mRawDataFilter = rawDataFilter;
mRawDataFilterMask = rawDataFilterMask;
mRenamePrefix = renamePrefix;
mRenameSuffix = renameSuffix;
mRenameBytesFrom = renameBytesFrom;
mRenameBytesLength = renameBytesLength;
mRenameNameFrom = renameNameFrom;
mRenameNameLength = renameNameLength;
mRenameBytesReverseOrder = renameBytesReverseOrder;
}
/** @hide
@Nullable
public Pattern getNamePattern() {
return mNamePattern;
}
/** @hide
@NonNull
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public ScanFilter getScanFilter() {
return mScanFilter;
}
/** @hide
@Nullable
public byte[] getRawDataFilter() {
return mRawDataFilter;
}
/** @hide
@Nullable
public byte[] getRawDataFilterMask() {
return mRawDataFilterMask;
}
/** @hide
@Nullable
public String getRenamePrefix() {
return mRenamePrefix;
}
/** @hide
@Nullable
public String getRenameSuffix() {
return mRenameSuffix;
}
/** @hide | BluetoothLeDeviceFilter::getRenameBytesFrom | java | Reginer/aosp-android-jar | android-32/src/android/companion/BluetoothLeDeviceFilter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/companion/BluetoothLeDeviceFilter.java | MIT |
public int getRenameBytesLength() {
return mRenameBytesLength;
} |
A filter for Bluetooth LE devices
@see ScanFilter
public final class BluetoothLeDeviceFilter implements DeviceFilter<ScanResult> {
private static final boolean DEBUG = false;
private static final String LOG_TAG = "BluetoothLeDeviceFilter";
private static final int RENAME_PREFIX_LENGTH_LIMIT = 10;
private final Pattern mNamePattern;
private final ScanFilter mScanFilter;
private final byte[] mRawDataFilter;
private final byte[] mRawDataFilterMask;
private final String mRenamePrefix;
private final String mRenameSuffix;
private final int mRenameBytesFrom;
private final int mRenameBytesLength;
private final int mRenameNameFrom;
private final int mRenameNameLength;
private final boolean mRenameBytesReverseOrder;
private BluetoothLeDeviceFilter(Pattern namePattern, ScanFilter scanFilter,
byte[] rawDataFilter, byte[] rawDataFilterMask, String renamePrefix,
String renameSuffix, int renameBytesFrom, int renameBytesLength,
int renameNameFrom, int renameNameLength, boolean renameBytesReverseOrder) {
mNamePattern = namePattern;
mScanFilter = ObjectUtils.firstNotNull(scanFilter, ScanFilter.EMPTY);
mRawDataFilter = rawDataFilter;
mRawDataFilterMask = rawDataFilterMask;
mRenamePrefix = renamePrefix;
mRenameSuffix = renameSuffix;
mRenameBytesFrom = renameBytesFrom;
mRenameBytesLength = renameBytesLength;
mRenameNameFrom = renameNameFrom;
mRenameNameLength = renameNameLength;
mRenameBytesReverseOrder = renameBytesReverseOrder;
}
/** @hide
@Nullable
public Pattern getNamePattern() {
return mNamePattern;
}
/** @hide
@NonNull
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public ScanFilter getScanFilter() {
return mScanFilter;
}
/** @hide
@Nullable
public byte[] getRawDataFilter() {
return mRawDataFilter;
}
/** @hide
@Nullable
public byte[] getRawDataFilterMask() {
return mRawDataFilterMask;
}
/** @hide
@Nullable
public String getRenamePrefix() {
return mRenamePrefix;
}
/** @hide
@Nullable
public String getRenameSuffix() {
return mRenameSuffix;
}
/** @hide
public int getRenameBytesFrom() {
return mRenameBytesFrom;
}
/** @hide | BluetoothLeDeviceFilter::getRenameBytesLength | java | Reginer/aosp-android-jar | android-32/src/android/companion/BluetoothLeDeviceFilter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/companion/BluetoothLeDeviceFilter.java | MIT |
public boolean isRenameBytesReverseOrder() {
return mRenameBytesReverseOrder;
} |
A filter for Bluetooth LE devices
@see ScanFilter
public final class BluetoothLeDeviceFilter implements DeviceFilter<ScanResult> {
private static final boolean DEBUG = false;
private static final String LOG_TAG = "BluetoothLeDeviceFilter";
private static final int RENAME_PREFIX_LENGTH_LIMIT = 10;
private final Pattern mNamePattern;
private final ScanFilter mScanFilter;
private final byte[] mRawDataFilter;
private final byte[] mRawDataFilterMask;
private final String mRenamePrefix;
private final String mRenameSuffix;
private final int mRenameBytesFrom;
private final int mRenameBytesLength;
private final int mRenameNameFrom;
private final int mRenameNameLength;
private final boolean mRenameBytesReverseOrder;
private BluetoothLeDeviceFilter(Pattern namePattern, ScanFilter scanFilter,
byte[] rawDataFilter, byte[] rawDataFilterMask, String renamePrefix,
String renameSuffix, int renameBytesFrom, int renameBytesLength,
int renameNameFrom, int renameNameLength, boolean renameBytesReverseOrder) {
mNamePattern = namePattern;
mScanFilter = ObjectUtils.firstNotNull(scanFilter, ScanFilter.EMPTY);
mRawDataFilter = rawDataFilter;
mRawDataFilterMask = rawDataFilterMask;
mRenamePrefix = renamePrefix;
mRenameSuffix = renameSuffix;
mRenameBytesFrom = renameBytesFrom;
mRenameBytesLength = renameBytesLength;
mRenameNameFrom = renameNameFrom;
mRenameNameLength = renameNameLength;
mRenameBytesReverseOrder = renameBytesReverseOrder;
}
/** @hide
@Nullable
public Pattern getNamePattern() {
return mNamePattern;
}
/** @hide
@NonNull
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public ScanFilter getScanFilter() {
return mScanFilter;
}
/** @hide
@Nullable
public byte[] getRawDataFilter() {
return mRawDataFilter;
}
/** @hide
@Nullable
public byte[] getRawDataFilterMask() {
return mRawDataFilterMask;
}
/** @hide
@Nullable
public String getRenamePrefix() {
return mRenamePrefix;
}
/** @hide
@Nullable
public String getRenameSuffix() {
return mRenameSuffix;
}
/** @hide
public int getRenameBytesFrom() {
return mRenameBytesFrom;
}
/** @hide
public int getRenameBytesLength() {
return mRenameBytesLength;
}
/** @hide | BluetoothLeDeviceFilter::isRenameBytesReverseOrder | java | Reginer/aosp-android-jar | android-32/src/android/companion/BluetoothLeDeviceFilter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/companion/BluetoothLeDeviceFilter.java | MIT |
public Builder setNamePattern(@Nullable Pattern regex) {
checkNotUsed();
mNamePattern = regex;
return this;
} |
@param regex if set, only devices with {@link BluetoothDevice#getName name} matching the
given regular expression will be shown
@return self for chaining
| Builder::setNamePattern | java | Reginer/aosp-android-jar | android-32/src/android/companion/BluetoothLeDeviceFilter.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/companion/BluetoothLeDeviceFilter.java | MIT |
default void onBackStarted(@NonNull BackEvent backEvent) {} |
Called when a back gesture has been started, or back button has been pressed down.
@param backEvent The {@link BackEvent} containing information about the touch or
button press.
@see BackEvent
| onBackStarted | java | Reginer/aosp-android-jar | android-34/src/android/window/OnBackAnimationCallback.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/window/OnBackAnimationCallback.java | MIT |
default void onBackProgressed(@NonNull BackEvent backEvent) { } |
Called when a back gesture progresses.
@param backEvent An {@link BackEvent} object describing the progress event.
@see BackEvent
| onBackProgressed | java | Reginer/aosp-android-jar | android-34/src/android/window/OnBackAnimationCallback.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/window/OnBackAnimationCallback.java | MIT |
default void onBackCancelled() { } |
Called when a back gesture or back button press has been cancelled.
| onBackCancelled | java | Reginer/aosp-android-jar | android-34/src/android/window/OnBackAnimationCallback.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/window/OnBackAnimationCallback.java | MIT |
public RFC3394WrapEngine(BlockCipher engine)
{
this(engine, false);
} |
Create a RFC 3394 WrapEngine specifying the encrypt for wrapping, decrypt for unwrapping.
@param engine the block cipher to be used for wrapping.
| RFC3394WrapEngine::RFC3394WrapEngine | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/org/bouncycastle/crypto/engines/RFC3394WrapEngine.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/org/bouncycastle/crypto/engines/RFC3394WrapEngine.java | MIT |
public RFC3394WrapEngine(BlockCipher engine, boolean useReverseDirection)
{
this.engine = engine;
this.wrapCipherMode = (useReverseDirection) ? false : true;
} |
Create a RFC 3394 WrapEngine specifying the direction for wrapping and unwrapping..
@param engine the block cipher to be used for wrapping.
@param useReverseDirection true if engine should be used in decryption mode for wrapping, false otherwise.
| RFC3394WrapEngine::RFC3394WrapEngine | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/org/bouncycastle/crypto/engines/RFC3394WrapEngine.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/org/bouncycastle/crypto/engines/RFC3394WrapEngine.java | MIT |
protected byte[] engineGetEncoded()
{
DSAParameter dsaP = new DSAParameter(currentSpec.getP(), currentSpec.getQ(), currentSpec.getG());
try
{
return dsaP.getEncoded(ASN1Encoding.DER);
}
catch (IOException e)
{
throw new RuntimeException("Error encoding DSAParameters");
}
} |
Return the X.509 ASN.1 structure DSAParameter.
<pre>
DSAParameter ::= SEQUENCE {
prime INTEGER, -- p
subprime INTEGER, -- q
base INTEGER, -- g}
</pre>
| AlgorithmParametersSpi::engineGetEncoded | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/org/bouncycastle/jcajce/provider/asymmetric/dsa/AlgorithmParametersSpi.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/org/bouncycastle/jcajce/provider/asymmetric/dsa/AlgorithmParametersSpi.java | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.