code
stringlengths 11
173k
| docstring
stringlengths 2
593k
| func_name
stringlengths 2
189
| language
stringclasses 1
value | repo
stringclasses 844
values | path
stringlengths 11
294
| url
stringlengths 60
339
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
public boolean cancel(@Reasons int reason) {
synchronized (mLock) {
final boolean cancelFromEnd =
reason == REASON_CANCEL_NOT_BEGUN || reason == REASON_CANCEL_SAME_VSYNC;
if (mCancelled || (mEndVsyncId != INVALID_ID && !cancelFromEnd)) return false;
mCancelled = true;
markEvent("FT#cancel#" + reason);
// We don't need to end the trace section if it never begun.
if (mTracingStarted) {
Trace.endAsyncSection(mSession.getName(), (int) mBeginVsyncId);
}
// Always remove the observers in cancel call to avoid leakage.
removeObservers();
if (DEBUG) {
Log.d(TAG, "cancel: " + mSession.getName() + ", begin=" + mBeginVsyncId
+ ", end=" + mEndVsyncId + ", reason=" + reason);
}
mSession.setReason(reason);
// Notify the listener the session has been cancelled.
// We don't notify the listeners if the session never begun.
notifyCujEvent(ACTION_SESSION_CANCEL);
return true;
}
} |
Cancel the trace session of the CUJ.
| JankInfo::cancel | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/jank/FrameTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/jank/FrameTracker.java | MIT |
public void triggerPerfetto() {
InteractionJankMonitor.getInstance().trigger(mSession);
} |
Trigger the prefetto daemon.
| JankInfo::triggerPerfetto | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/jank/FrameTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/jank/FrameTracker.java | MIT |
public long[] getTiming() {
return mFrameMetrics.mTimingData;
} |
Wrapper method.
@return timing data of the metrics
| FrameMetricsWrapper::getTiming | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/jank/FrameTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/jank/FrameTracker.java | MIT |
public long getMetric(int index) {
return mFrameMetrics.getMetric(index);
} |
Wrapper method.
@param index specific index of the timing data
@return the timing data of the specified index
| FrameMetricsWrapper::getMetric | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/jank/FrameTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/jank/FrameTracker.java | MIT |
public void addObserver(HardwareRendererObserver observer) {
mRenderer.addObserver(observer);
} |
Wrapper method.
@param observer observer
| ThreadedRendererWrapper::addObserver | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/jank/FrameTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/jank/FrameTracker.java | MIT |
public void removeObserver(HardwareRendererObserver observer) {
mRenderer.removeObserver(observer);
} |
Wrapper method.
@param observer observer
| ThreadedRendererWrapper::removeObserver | java | Reginer/aosp-android-jar | android-33/src/com/android/internal/jank/FrameTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/jank/FrameTracker.java | MIT |
public @DnsOptionState int getUseHttpStackDnsResolver() {
return mUseHttpStackDnsResolver;
} |
See {@link Builder#setUseHttpStackDnsResolver(int)}
| DnsOptions::getUseHttpStackDnsResolver | java | Reginer/aosp-android-jar | android-35/src/android/net/http/DnsOptions.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/net/http/DnsOptions.java | MIT |
public @DnsOptionState int getPersistHostCache() {
return mPersistHostCache;
} |
See {@link Builder#setPersistHostCache(int)}
| DnsOptions::getPersistHostCache | java | Reginer/aosp-android-jar | android-35/src/android/net/http/DnsOptions.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/net/http/DnsOptions.java | MIT |
public @DnsOptionState int getStaleDns() {
return mEnableStaleDns;
} |
See {@link Builder#setStaleDns(int)}
| DnsOptions::getStaleDns | java | Reginer/aosp-android-jar | android-35/src/android/net/http/DnsOptions.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/net/http/DnsOptions.java | MIT |
public @DnsOptionState int getPreestablishConnectionsToStaleDnsResults() {
return mPreestablishConnectionsToStaleDnsResults;
} |
See {@link Builder#setPreestablishConnectionsToStaleDnsResults(int)}
| DnsOptions::getPreestablishConnectionsToStaleDnsResults | java | Reginer/aosp-android-jar | android-35/src/android/net/http/DnsOptions.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/net/http/DnsOptions.java | MIT |
public EapTtlsHandshakeException(String message) {
super(message);
} |
Construct an instance of EapTtlsHandshakeException with the specified detail message.
@param message the detail message.
| EapTtlsHandshakeException::EapTtlsHandshakeException | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/net/eap/exceptions/ttls/EapTtlsHandshakeException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/net/eap/exceptions/ttls/EapTtlsHandshakeException.java | MIT |
public EapTtlsHandshakeException(String message, Throwable cause) {
super(message, cause);
} |
Construct an instance of EapTtlsHandshakeException with the specified message and cause.
@param message the detail message.
@param cause the cause.
| EapTtlsHandshakeException::EapTtlsHandshakeException | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/net/eap/exceptions/ttls/EapTtlsHandshakeException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/net/eap/exceptions/ttls/EapTtlsHandshakeException.java | MIT |
public elementchangeattributevalue(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException {
super(factory);
//
// check if loaded documents are supported for content type
//
String contentType = getContentType();
preload(contentType, "staff", true);
} |
Constructor.
@param factory document factory, may not be null
@throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
| elementchangeattributevalue::elementchangeattributevalue | java | Reginer/aosp-android-jar | android-34/src/org/w3c/domts/level1/core/elementchangeattributevalue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/elementchangeattributevalue.java | MIT |
public void runTest() throws Throwable {
Document doc;
NodeList elementList;
Element testEmployee;
String attrValue;
doc = (Document) load("staff", true);
elementList = doc.getElementsByTagName("address");
testEmployee = (Element) elementList.item(3);
testEmployee.setAttribute("street", "Neither");
attrValue = testEmployee.getAttribute("street");
assertEquals("elementChangeAttributeValueAssert", "Neither", attrValue);
} |
Runs the test case.
@throws Throwable Any uncaught exception causes test to fail
| elementchangeattributevalue::runTest | java | Reginer/aosp-android-jar | android-34/src/org/w3c/domts/level1/core/elementchangeattributevalue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/elementchangeattributevalue.java | MIT |
public String getTargetURI() {
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementchangeattributevalue";
} |
Gets URI that identifies the test.
@return uri identifier of test
| elementchangeattributevalue::getTargetURI | java | Reginer/aosp-android-jar | android-34/src/org/w3c/domts/level1/core/elementchangeattributevalue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/elementchangeattributevalue.java | MIT |
public static void main(final String[] args) {
DOMTestCase.doMain(elementchangeattributevalue.class, args);
} |
Runs this test from the command line.
@param args command line arguments
| elementchangeattributevalue::main | java | Reginer/aosp-android-jar | android-34/src/org/w3c/domts/level1/core/elementchangeattributevalue.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/elementchangeattributevalue.java | MIT |
public static ASN1ApplicationSpecific getInstance(Object obj)
{
if (obj == null || obj instanceof ASN1ApplicationSpecific)
{
return (ASN1ApplicationSpecific)obj;
}
else if (obj instanceof byte[])
{
try
{
return ASN1ApplicationSpecific.getInstance(ASN1Primitive.fromByteArray((byte[])obj));
}
catch (IOException e)
{
throw new IllegalArgumentException("Failed to construct object from byte[]: " + e.getMessage());
}
}
throw new IllegalArgumentException("unknown object in getInstance: " + obj.getClass().getName());
} |
Return an ASN1ApplicationSpecific from the passed in object, which may be a byte array, or null.
@param obj the object to be converted.
@return obj's representation as an ASN1ApplicationSpecific object.
| ASN1ApplicationSpecific::getInstance | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/org/bouncycastle/asn1/ASN1ApplicationSpecific.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/org/bouncycastle/asn1/ASN1ApplicationSpecific.java | MIT |
public boolean isConstructed()
{
return isConstructed;
} |
Return true if the object is marked as constructed, false otherwise.
@return true if constructed, otherwise false.
| ASN1ApplicationSpecific::isConstructed | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/org/bouncycastle/asn1/ASN1ApplicationSpecific.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/org/bouncycastle/asn1/ASN1ApplicationSpecific.java | MIT |
public byte[] getContents()
{
return Arrays.clone(octets);
} |
Return the contents of this object as a byte[]
@return the encoded contents of the object.
| ASN1ApplicationSpecific::getContents | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/org/bouncycastle/asn1/ASN1ApplicationSpecific.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/org/bouncycastle/asn1/ASN1ApplicationSpecific.java | MIT |
public int getApplicationTag()
{
return tag;
} |
Return the tag number associated with this object,
@return the application tag number.
| ASN1ApplicationSpecific::getApplicationTag | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/org/bouncycastle/asn1/ASN1ApplicationSpecific.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/org/bouncycastle/asn1/ASN1ApplicationSpecific.java | MIT |
public ASN1Primitive getObject()
throws IOException
{
return ASN1Primitive.fromByteArray(getContents());
} |
Return the enclosed object assuming explicit tagging.
@return the resulting object
@throws IOException if reconstruction fails.
| ASN1ApplicationSpecific::getObject | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/org/bouncycastle/asn1/ASN1ApplicationSpecific.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/org/bouncycastle/asn1/ASN1ApplicationSpecific.java | MIT |
public ASN1Primitive getObject(int derTagNo)
throws IOException
{
if (derTagNo >= 0x1f)
{
throw new IOException("unsupported tag number");
}
byte[] orig = this.getEncoded();
byte[] tmp = replaceTagNumber(derTagNo, orig);
if ((orig[0] & BERTags.CONSTRUCTED) != 0)
{
tmp[0] |= BERTags.CONSTRUCTED;
}
return ASN1Primitive.fromByteArray(tmp);
} |
Return the enclosed object assuming implicit tagging.
@param derTagNo the type tag that should be applied to the object's contents.
@return the resulting object
@throws IOException if reconstruction fails.
| ASN1ApplicationSpecific::getObject | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/org/bouncycastle/asn1/ASN1ApplicationSpecific.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/org/bouncycastle/asn1/ASN1ApplicationSpecific.java | MIT |
void encode(ASN1OutputStream out, boolean withTag) throws IOException
{
int flags = BERTags.APPLICATION;
if (isConstructed)
{
flags |= BERTags.CONSTRUCTED;
}
out.writeEncoded(withTag, flags, tag, octets);
} |
Return the enclosed object assuming implicit tagging.
@param derTagNo the type tag that should be applied to the object's contents.
@return the resulting object
@throws IOException if reconstruction fails.
public ASN1Primitive getObject(int derTagNo)
throws IOException
{
if (derTagNo >= 0x1f)
{
throw new IOException("unsupported tag number");
}
byte[] orig = this.getEncoded();
byte[] tmp = replaceTagNumber(derTagNo, orig);
if ((orig[0] & BERTags.CONSTRUCTED) != 0)
{
tmp[0] |= BERTags.CONSTRUCTED;
}
return ASN1Primitive.fromByteArray(tmp);
}
int encodedLength()
throws IOException
{
return StreamUtil.calculateTagLength(tag) + StreamUtil.calculateBodyLength(octets.length) + octets.length;
}
/* (non-Javadoc)
@see org.bouncycastle.asn1.ASN1Primitive#encode(org.bouncycastle.asn1.DEROutputStream)
| ASN1ApplicationSpecific::encode | java | Reginer/aosp-android-jar | android-34/src/com/android/internal/org/bouncycastle/asn1/ASN1ApplicationSpecific.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/internal/org/bouncycastle/asn1/ASN1ApplicationSpecific.java | MIT |
private void recognizeGesture(MotionEvent event, MotionEvent rawEvent, int policyFlags) {
// Check the path of each finger against the specified direction.
// Note that we sample every 2.5 MMm, and the direction matching is extremely tolerant (each
// direction has a 90-degree arch of tolerance) meaning that minor perpendicular movements
// should not create false negatives.
for (int i = 0; i < mTargetFingerCount; ++i) {
if (DEBUG) {
Slog.d(getGestureName(), "Recognizing finger: " + i);
}
if (mStrokeBuffers[i].size() < 2) {
Slog.d(getGestureName(), "Too few points.");
cancelGesture(event, rawEvent, policyFlags);
return;
}
ArrayList<PointF> path = mStrokeBuffers[i];
if (DEBUG) {
Slog.d(getGestureName(), "path=" + path.toString());
}
// Classify line segments, and call Listener callbacks.
if (!recognizeGesturePath(event, rawEvent, policyFlags, path)) {
cancelGesture(event, rawEvent, policyFlags);
return;
}
}
// If we reach this point then all paths match.
completeGesture(event, rawEvent, policyFlags);
} |
Looks at the sequence of motions in mStrokeBuffer, classifies the gesture, then transitions
to the complete or cancel state depending on the result.
| MultiFingerSwipe::recognizeGesture | java | Reginer/aosp-android-jar | android-32/src/com/android/server/accessibility/gestures/MultiFingerSwipe.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/accessibility/gestures/MultiFingerSwipe.java | MIT |
private boolean recognizeGesturePath(
MotionEvent event, MotionEvent rawEvent, int policyFlags, ArrayList<PointF> path) {
final int displayId = event.getDisplayId();
for (int i = 0; i < path.size() - 1; ++i) {
PointF start = path.get(i);
PointF end = path.get(i + 1);
float dX = end.x - start.x;
float dY = end.y - start.y;
int direction = toDirection(dX, dY);
if (direction != mDirection) {
if (DEBUG) {
Slog.d(
getGestureName(),
"Found direction "
+ directionToString(direction)
+ " when expecting "
+ directionToString(mDirection));
}
return false;
}
}
if (DEBUG) {
Slog.d(getGestureName(), "Completed.");
}
return true;
} |
Tests the path of a given finger against the direction specified in this matcher.
@return True if the path matches the specified direction for this matcher, otherwise false.
| MultiFingerSwipe::recognizeGesturePath | java | Reginer/aosp-android-jar | android-32/src/com/android/server/accessibility/gestures/MultiFingerSwipe.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/accessibility/gestures/MultiFingerSwipe.java | MIT |
public BugreportManager(@NonNull Context context, IDumpstate binder) {
mContext = context;
mBinder = binder;
} |
Class that provides a privileged API to capture and consume bugreports.
<p>This class may only be used by apps that currently have carrier privileges (see {@link
android.telephony.TelephonyManager#hasCarrierPrivileges}) on an active SIM or priv-apps
explicitly allowed by the device manufacturer.
<p>Only one bugreport can be generated by the system at a time.
@SystemService(Context.BUGREPORT_SERVICE)
public final class BugreportManager {
private static final String TAG = "BugreportManager";
private final Context mContext;
private final IDumpstate mBinder;
/** @hide | BugreportManager::BugreportManager | java | Reginer/aosp-android-jar | android-33/src/android/os/BugreportManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/os/BugreportManager.java | MIT |
public void onProgress(@FloatRange(from = 0f, to = 100f) float progress) {} |
Called when there is a progress update.
@param progress the progress in [0.0, 100.0]
| BugreportManager::onProgress | java | Reginer/aosp-android-jar | android-33/src/android/os/BugreportManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/os/BugreportManager.java | MIT |
public void onError(@BugreportErrorCode int errorCode) {} |
Called when taking bugreport resulted in an error.
<p>If {@code BUGREPORT_ERROR_USER_DENIED_CONSENT} is passed, then the user did not
consent to sharing the bugreport with the calling app.
<p>If {@code BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT} is passed, then the consent timed
out, but the bugreport could be available in the internal directory of dumpstate for
manual retrieval.
<p>If {@code BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS} is passed, then the caller
should try later, as only one bugreport can be in progress at a time.
| BugreportManager::onError | java | Reginer/aosp-android-jar | android-33/src/android/os/BugreportManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/os/BugreportManager.java | MIT |
public void onFinished() {} |
Called when taking bugreport resulted in an error.
<p>If {@code BUGREPORT_ERROR_USER_DENIED_CONSENT} is passed, then the user did not
consent to sharing the bugreport with the calling app.
<p>If {@code BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT} is passed, then the consent timed
out, but the bugreport could be available in the internal directory of dumpstate for
manual retrieval.
<p>If {@code BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS} is passed, then the caller
should try later, as only one bugreport can be in progress at a time.
public void onError(@BugreportErrorCode int errorCode) {}
/** Called when taking bugreport finishes successfully. | BugreportManager::onFinished | java | Reginer/aosp-android-jar | android-33/src/android/os/BugreportManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/os/BugreportManager.java | MIT |
public void onEarlyReportFinished() {} |
Called when it is ready for calling app to show UI, showing any extra UI before this
callback can interfere with bugreport generation.
| BugreportManager::onEarlyReportFinished | java | Reginer/aosp-android-jar | android-33/src/android/os/BugreportManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/os/BugreportManager.java | MIT |
public static void notify(
Object thisReference, int uniqueId, int infoType, String message) {
DrmManagerClient instance = (DrmManagerClient)((WeakReference)thisReference).get();
if (null != instance && null != instance.mInfoHandler) {
Message m = instance.mInfoHandler.obtainMessage(
InfoHandler.INFO_EVENT_TYPE, uniqueId, infoType, message);
instance.mInfoHandler.sendMessage(m);
}
} |
{@hide}
| EventHandler::notify | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public DrmManagerClient(Context context) {
mContext = context;
createEventThreads();
// save the unique id
mUniqueId = _initialize();
mCloseGuard.open("release");
} |
Creates a <code>DrmManagerClient</code>.
@param context Context of the caller.
| InfoHandler::DrmManagerClient | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public synchronized void setOnInfoListener(OnInfoListener infoListener) {
mOnInfoListener = infoListener;
if (null != infoListener) {
createListeners();
}
} |
Registers an {@link DrmManagerClient.OnInfoListener} callback, which is invoked when the
DRM framework sends status or warning information during registration or rights acquisition.
@param infoListener Interface definition for the callback.
| InfoHandler::setOnInfoListener | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public synchronized void setOnEventListener(OnEventListener eventListener) {
mOnEventListener = eventListener;
if (null != eventListener) {
createListeners();
}
} |
Registers an {@link DrmManagerClient.OnEventListener} callback, which is invoked when the
DRM framework sends information about DRM processing.
@param eventListener Interface definition for the callback.
| InfoHandler::setOnEventListener | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public synchronized void setOnErrorListener(OnErrorListener errorListener) {
mOnErrorListener = errorListener;
if (null != errorListener) {
createListeners();
}
} |
Registers an {@link DrmManagerClient.OnErrorListener} callback, which is invoked when
the DRM framework sends error information.
@param errorListener Interface definition for the callback.
| InfoHandler::setOnErrorListener | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public String[] getAvailableDrmEngines() {
DrmSupportInfo[] supportInfos = _getAllSupportInfo(mUniqueId);
ArrayList<String> descriptions = new ArrayList<String>();
for (int i = 0; i < supportInfos.length; i++) {
descriptions.add(supportInfos[i].getDescriprition());
}
String[] drmEngines = new String[descriptions.size()];
return descriptions.toArray(drmEngines);
} |
Retrieves information about all the DRM plug-ins (agents) that are registered with
the DRM framework.
@return A <code>String</code> array of DRM plug-in descriptions.
| InfoHandler::getAvailableDrmEngines | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public @NonNull Collection<DrmSupportInfo> getAvailableDrmSupportInfo() {
return Arrays.asList(_getAllSupportInfo(mUniqueId));
} |
Retrieves information about all the DRM plug-ins (agents) that are
registered with the DRM framework.
@return List of all the DRM plug-ins (agents) that are registered with
the DRM framework.
| InfoHandler::getAvailableDrmSupportInfo | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public ContentValues getConstraints(String path, int action) {
if (null == path || path.equals("") || !DrmStore.Action.isValid(action)) {
throw new IllegalArgumentException("Given usage or path is invalid/null");
}
return _getConstraints(mUniqueId, path, action);
} |
Retrieves constraint information for rights-protected content.
@param path Path to the content from which you are retrieving DRM constraints.
@param action Action defined in {@link DrmStore.Action}.
@return A {@link android.content.ContentValues} instance that contains
key-value pairs representing the constraints. Null in case of failure.
The keys are defined in {@link DrmStore.ConstraintsColumns}.
| InfoHandler::getConstraints | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public ContentValues getMetadata(String path) {
if (null == path || path.equals("")) {
throw new IllegalArgumentException("Given path is invalid/null");
}
return _getMetadata(mUniqueId, path);
} |
Retrieves metadata information for rights-protected content.
@param path Path to the content from which you are retrieving metadata information.
@return A {@link android.content.ContentValues} instance that contains
key-value pairs representing the metadata. Null in case of failure.
| InfoHandler::getMetadata | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public ContentValues getConstraints(Uri uri, int action) {
if (null == uri || Uri.EMPTY == uri) {
throw new IllegalArgumentException("Uri should be non null");
}
return getConstraints(convertUriToPath(uri), action);
} |
Retrieves constraint information for rights-protected content.
@param uri URI for the content from which you are retrieving DRM constraints.
@param action Action defined in {@link DrmStore.Action}.
@return A {@link android.content.ContentValues} instance that contains
key-value pairs representing the constraints. Null in case of failure.
| InfoHandler::getConstraints | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public ContentValues getMetadata(Uri uri) {
if (null == uri || Uri.EMPTY == uri) {
throw new IllegalArgumentException("Uri should be non null");
}
return getMetadata(convertUriToPath(uri));
} |
Retrieves metadata information for rights-protected content.
@param uri URI for the content from which you are retrieving metadata information.
@return A {@link android.content.ContentValues} instance that contains
key-value pairs representing the constraints. Null in case of failure.
| InfoHandler::getMetadata | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public int saveRights(
DrmRights drmRights, String rightsPath, String contentPath) throws IOException {
if (null == drmRights || !drmRights.isValid()) {
throw new IllegalArgumentException("Given drmRights or contentPath is not valid");
}
if (null != rightsPath && !rightsPath.equals("")) {
DrmUtils.writeToFile(rightsPath, drmRights.getData());
}
return _saveRights(mUniqueId, drmRights, rightsPath, contentPath);
} |
Saves rights to a specified path and associates that path with the content path.
<p class="note"><strong>Note:</strong> For OMA or WM-DRM, <code>rightsPath</code> and
<code>contentPath</code> can be null.</p>
@param drmRights The {@link DrmRights} to be saved.
@param rightsPath File path where rights will be saved.
@param contentPath File path where content is saved.
@return ERROR_NONE for success; ERROR_UNKNOWN for failure.
@throws IOException If the call failed to save rights information at the given
<code>rightsPath</code>.
| InfoHandler::saveRights | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public void installDrmEngine(String engineFilePath) {
if (null == engineFilePath || engineFilePath.equals("")) {
throw new IllegalArgumentException(
"Given engineFilePath: "+ engineFilePath + "is not valid");
}
_installDrmEngine(mUniqueId, engineFilePath);
} |
Installs a new DRM plug-in (agent) at runtime.
@param engineFilePath File path to the plug-in file to be installed.
{@hide}
| InfoHandler::installDrmEngine | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public boolean canHandle(String path, String mimeType) {
if ((null == path || path.equals("")) && (null == mimeType || mimeType.equals(""))) {
throw new IllegalArgumentException("Path or the mimetype should be non null");
}
return _canHandle(mUniqueId, path, mimeType);
} |
Checks whether the given MIME type or path can be handled.
@param path Path of the content to be handled.
@param mimeType MIME type of the object to be handled.
@return True if the given MIME type or path can be handled; false if they cannot be handled.
| InfoHandler::canHandle | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public boolean canHandle(Uri uri, String mimeType) {
if ((null == uri || Uri.EMPTY == uri) && (null == mimeType || mimeType.equals(""))) {
throw new IllegalArgumentException("Uri or the mimetype should be non null");
}
return canHandle(convertUriToPath(uri), mimeType);
} |
Checks whether the given MIME type or URI can be handled.
@param uri URI for the content to be handled.
@param mimeType MIME type of the object to be handled
@return True if the given MIME type or URI can be handled; false if they cannot be handled.
| InfoHandler::canHandle | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public int processDrmInfo(DrmInfo drmInfo) {
if (null == drmInfo || !drmInfo.isValid()) {
throw new IllegalArgumentException("Given drmInfo is invalid/null");
}
int result = ERROR_UNKNOWN;
if (null != mEventHandler) {
Message msg = mEventHandler.obtainMessage(ACTION_PROCESS_DRM_INFO, drmInfo);
result = (mEventHandler.sendMessage(msg)) ? ERROR_NONE : result;
}
return result;
} |
Processes the given DRM information based on the information type.
@param drmInfo The {@link DrmInfo} to be processed.
@return ERROR_NONE for success; ERROR_UNKNOWN for failure.
| InfoHandler::processDrmInfo | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public DrmInfo acquireDrmInfo(DrmInfoRequest drmInfoRequest) {
if (null == drmInfoRequest || !drmInfoRequest.isValid()) {
throw new IllegalArgumentException("Given drmInfoRequest is invalid/null");
}
return _acquireDrmInfo(mUniqueId, drmInfoRequest);
} |
Retrieves information for registering, unregistering, or acquiring rights.
@param drmInfoRequest The {@link DrmInfoRequest} that specifies the type of DRM
information being retrieved.
@return A {@link DrmInfo} instance.
| InfoHandler::acquireDrmInfo | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public int acquireRights(DrmInfoRequest drmInfoRequest) {
DrmInfo drmInfo = acquireDrmInfo(drmInfoRequest);
if (null == drmInfo) {
return ERROR_UNKNOWN;
}
return processDrmInfo(drmInfo);
} |
Processes a given {@link DrmInfoRequest} and returns the rights information asynchronously.
<p>
This is a utility method that consists of an
{@link #acquireDrmInfo(DrmInfoRequest) acquireDrmInfo()} and a
{@link #processDrmInfo(DrmInfo) processDrmInfo()} method call. This utility method can be
used only if the selected DRM plug-in (agent) supports this sequence of calls. Some DRM
agents, such as OMA, do not support this utility method, in which case an application must
invoke {@link #acquireDrmInfo(DrmInfoRequest) acquireDrmInfo()} and
{@link #processDrmInfo(DrmInfo) processDrmInfo()} separately.
@param drmInfoRequest The {@link DrmInfoRequest} used to acquire the rights.
@return ERROR_NONE for success; ERROR_UNKNOWN for failure.
| InfoHandler::acquireRights | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public int getDrmObjectType(String path, String mimeType) {
if ((null == path || path.equals("")) && (null == mimeType || mimeType.equals(""))) {
throw new IllegalArgumentException("Path or the mimetype should be non null");
}
return _getDrmObjectType(mUniqueId, path, mimeType);
} |
Retrieves the type of rights-protected object (for example, content object, rights
object, and so on) using the specified path or MIME type. At least one parameter must
be specified to retrieve the DRM object type.
@param path Path to the content or null.
@param mimeType MIME type of the content or null.
@return An <code>int</code> that corresponds to a {@link DrmStore.DrmObjectType}.
| InfoHandler::getDrmObjectType | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public int getDrmObjectType(Uri uri, String mimeType) {
if ((null == uri || Uri.EMPTY == uri) && (null == mimeType || mimeType.equals(""))) {
throw new IllegalArgumentException("Uri or the mimetype should be non null");
}
String path = "";
try {
path = convertUriToPath(uri);
} catch (Exception e) {
// Even uri is invalid the mimetype shall be valid, so allow to proceed further.
Log.w(TAG, "Given Uri could not be found in media store");
}
return getDrmObjectType(path, mimeType);
} |
Retrieves the type of rights-protected object (for example, content object, rights
object, and so on) using the specified URI or MIME type. At least one parameter must
be specified to retrieve the DRM object type.
@param uri URI for the content or null.
@param mimeType MIME type of the content or null.
@return An <code>int</code> that corresponds to a {@link DrmStore.DrmObjectType}.
| InfoHandler::getDrmObjectType | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public String getOriginalMimeType(String path) {
if (null == path || path.equals("")) {
throw new IllegalArgumentException("Given path should be non null");
}
String mime = null;
FileInputStream is = null;
try {
FileDescriptor fd = null;
File file = new File(path);
if (file.exists()) {
is = new FileInputStream(file);
fd = is.getFD();
}
mime = _getOriginalMimeType(mUniqueId, path, fd);
} catch (IOException ioe) {
} finally {
if (is != null) {
try {
is.close();
} catch(IOException e) {}
}
}
return mime;
} |
Retrieves the MIME type embedded in the original content.
@param path Path to the rights-protected content.
@return The MIME type of the original content, such as <code>video/mpeg</code>.
| InfoHandler::getOriginalMimeType | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public String getOriginalMimeType(Uri uri) {
if (null == uri || Uri.EMPTY == uri) {
throw new IllegalArgumentException("Given uri is not valid");
}
return getOriginalMimeType(convertUriToPath(uri));
} |
Retrieves the MIME type embedded in the original content.
@param uri URI of the rights-protected content.
@return MIME type of the original content, such as <code>video/mpeg</code>.
| InfoHandler::getOriginalMimeType | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public int checkRightsStatus(String path) {
return checkRightsStatus(path, DrmStore.Action.DEFAULT);
} |
Checks whether the given content has valid rights.
@param path Path to the rights-protected content.
@return An <code>int</code> representing the {@link DrmStore.RightsStatus} of the content.
| InfoHandler::checkRightsStatus | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public int checkRightsStatus(Uri uri) {
if (null == uri || Uri.EMPTY == uri) {
throw new IllegalArgumentException("Given uri is not valid");
}
return checkRightsStatus(convertUriToPath(uri));
} |
Check whether the given content has valid rights.
@param uri URI of the rights-protected content.
@return An <code>int</code> representing the {@link DrmStore.RightsStatus} of the content.
| InfoHandler::checkRightsStatus | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public int checkRightsStatus(String path, int action) {
if (null == path || path.equals("") || !DrmStore.Action.isValid(action)) {
throw new IllegalArgumentException("Given path or action is not valid");
}
return _checkRightsStatus(mUniqueId, path, action);
} |
Checks whether the given rights-protected content has valid rights for the specified
{@link DrmStore.Action}.
@param path Path to the rights-protected content.
@param action The {@link DrmStore.Action} to perform.
@return An <code>int</code> representing the {@link DrmStore.RightsStatus} of the content.
| InfoHandler::checkRightsStatus | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public int checkRightsStatus(Uri uri, int action) {
if (null == uri || Uri.EMPTY == uri) {
throw new IllegalArgumentException("Given uri is not valid");
}
return checkRightsStatus(convertUriToPath(uri), action);
} |
Checks whether the given rights-protected content has valid rights for the specified
{@link DrmStore.Action}.
@param uri URI for the rights-protected content.
@param action The {@link DrmStore.Action} to perform.
@return An <code>int</code> representing the {@link DrmStore.RightsStatus} of the content.
| InfoHandler::checkRightsStatus | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public int removeRights(String path) {
if (null == path || path.equals("")) {
throw new IllegalArgumentException("Given path should be non null");
}
return _removeRights(mUniqueId, path);
} |
Removes the rights associated with the given rights-protected content.
@param path Path to the rights-protected content.
@return ERROR_NONE for success; ERROR_UNKNOWN for failure.
| InfoHandler::removeRights | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public int removeRights(Uri uri) {
if (null == uri || Uri.EMPTY == uri) {
throw new IllegalArgumentException("Given uri is not valid");
}
return removeRights(convertUriToPath(uri));
} |
Removes the rights associated with the given rights-protected content.
@param uri URI for the rights-protected content.
@return ERROR_NONE for success; ERROR_UNKNOWN for failure.
| InfoHandler::removeRights | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public int removeAllRights() {
int result = ERROR_UNKNOWN;
if (null != mEventHandler) {
Message msg = mEventHandler.obtainMessage(ACTION_REMOVE_ALL_RIGHTS);
result = (mEventHandler.sendMessage(msg)) ? ERROR_NONE : result;
}
return result;
} |
Removes all the rights information of every DRM plug-in (agent) associated with
the DRM framework.
@return ERROR_NONE for success; ERROR_UNKNOWN for failure.
| InfoHandler::removeAllRights | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public int openConvertSession(String mimeType) {
if (null == mimeType || mimeType.equals("")) {
throw new IllegalArgumentException("Path or the mimeType should be non null");
}
return _openConvertSession(mUniqueId, mimeType);
} |
Initiates a new conversion session. An application must initiate a conversion session
with this method each time it downloads a rights-protected file that needs to be converted.
<p>
This method applies only to forward-locking (copy protection) DRM schemes.
@param mimeType MIME type of the input data packet.
@return A convert ID that is used used to maintain the conversion session.
| InfoHandler::openConvertSession | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public DrmConvertedStatus convertData(int convertId, byte[] inputData) {
if (null == inputData || 0 >= inputData.length) {
throw new IllegalArgumentException("Given inputData should be non null");
}
return _convertData(mUniqueId, convertId, inputData);
} |
Converts the input data (content) that is part of a rights-protected file. The converted
data and status is returned in a {@link DrmConvertedStatus} object. This method should be
called each time there is a new block of data received by the application.
@param convertId Handle for the conversion session.
@param inputData Input data that needs to be converted.
@return A {@link DrmConvertedStatus} object that contains the status of the data conversion,
the converted data, and offset for the header and body signature. An application can
ignore the offset because it is only relevant to the
{@link #closeConvertSession closeConvertSession()} method.
| InfoHandler::convertData | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public DrmConvertedStatus closeConvertSession(int convertId) {
return _closeConvertSession(mUniqueId, convertId);
} |
Informs the DRM plug-in (agent) that there is no more data to convert or that an error
has occurred. Upon successful conversion of the data, the DRM agent will provide an offset
value indicating where the header and body signature should be added. Appending the
signature is necessary to protect the integrity of the converted file.
@param convertId Handle for the conversion session.
@return A {@link DrmConvertedStatus} object that contains the status of the data conversion,
the converted data, and the offset for the header and body signature.
| InfoHandler::closeConvertSession | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
private String convertUriToPath(Uri uri) {
String path = null;
if (null != uri) {
String scheme = uri.getScheme();
if (null == scheme || scheme.equals("") ||
scheme.equals(ContentResolver.SCHEME_FILE)) {
path = uri.getPath();
} else if (scheme.equals("http") || scheme.equals("https")) {
path = uri.toString();
} else if (scheme.equals(ContentResolver.SCHEME_CONTENT)) {
String[] projection = new String[] {MediaStore.MediaColumns.DATA};
Cursor cursor = null;
try {
cursor = mContext.getContentResolver().query(uri, projection, null,
null, null);
if (null == cursor || 0 == cursor.getCount() || !cursor.moveToFirst()) {
throw new IllegalArgumentException("Given Uri could not be found" +
" in media store");
}
int pathIndex = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA);
path = cursor.getString(pathIndex);
} catch (SQLiteException e) {
throw new IllegalArgumentException("Given Uri is not formatted in a way " +
"so that it can be found in media store.");
} finally {
if (null != cursor) {
cursor.close();
}
}
} else {
throw new IllegalArgumentException("Given Uri scheme is not supported");
}
}
return path;
} |
This method expects uri in the following format
content://media/<table_name>/<row_index> (or)
file://sdcard/test.mp4
http://test.com/test.mp4
https://test.com/test.mp4
Here <table_name> shall be "video" or "audio" or "images"
<row_index> the index of the content in given table
| InfoHandler::convertUriToPath | java | Reginer/aosp-android-jar | android-32/src/android/drm/DrmManagerClient.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/drm/DrmManagerClient.java | MIT |
public synchronized static TelephonyMetrics getInstance() {
if (sInstance == null) {
sInstance = new TelephonyMetrics();
}
return sInstance;
} |
Get the singleton instance of telephony metrics.
@return The instance
| getSimpleName::getInstance | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public void setContext(Context context) {
mContext = context;
} |
Set the context for telephony metrics.
@param context Context
@hide
| getSimpleName::setContext | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (args != null && args.length > 0) {
boolean reset = true;
if (args.length > 1 && "--keep".equals(args[1])) {
reset = false;
}
switch (args[0]) {
case "--metrics":
printAllMetrics(pw);
break;
case "--metricsproto":
pw.println(convertProtoToBase64String(buildProto()));
pw.println(RcsStats.getInstance().buildLog());
if (reset) {
reset();
}
break;
case "--metricsprototext":
pw.println(buildProto().toString());
pw.println(RcsStats.getInstance().buildProto().toString());
break;
}
}
} |
Dump the state of various objects, add calls to other objects as desired.
@param fd File descriptor
@param pw Print writer
@param args Arguments
| getSimpleName::dump | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private static String telephonyEventToString(int event) {
switch (event) {
case TelephonyEvent.Type.UNKNOWN:
return "UNKNOWN";
case TelephonyEvent.Type.SETTINGS_CHANGED:
return "SETTINGS_CHANGED";
case TelephonyEvent.Type.RIL_SERVICE_STATE_CHANGED:
return "RIL_SERVICE_STATE_CHANGED";
case TelephonyEvent.Type.IMS_CONNECTION_STATE_CHANGED:
return "IMS_CONNECTION_STATE_CHANGED";
case TelephonyEvent.Type.IMS_CAPABILITIES_CHANGED:
return "IMS_CAPABILITIES_CHANGED";
case TelephonyEvent.Type.DATA_CALL_SETUP:
return "DATA_CALL_SETUP";
case TelephonyEvent.Type.DATA_CALL_SETUP_RESPONSE:
return "DATA_CALL_SETUP_RESPONSE";
case TelephonyEvent.Type.DATA_CALL_LIST_CHANGED:
return "DATA_CALL_LIST_CHANGED";
case TelephonyEvent.Type.DATA_CALL_DEACTIVATE:
return "DATA_CALL_DEACTIVATE";
case TelephonyEvent.Type.DATA_CALL_DEACTIVATE_RESPONSE:
return "DATA_CALL_DEACTIVATE_RESPONSE";
case TelephonyEvent.Type.DATA_STALL_ACTION:
return "DATA_STALL_ACTION";
case TelephonyEvent.Type.MODEM_RESTART:
return "MODEM_RESTART";
case TelephonyEvent.Type.CARRIER_ID_MATCHING:
return "CARRIER_ID_MATCHING";
case TelephonyEvent.Type.NITZ_TIME:
return "NITZ_TIME";
case TelephonyEvent.Type.EMERGENCY_NUMBER_REPORT:
return "EMERGENCY_NUMBER_REPORT";
case TelephonyEvent.Type.NETWORK_CAPABILITIES_CHANGED:
return "NETWORK_CAPABILITIES_CHANGED";
default:
return Integer.toString(event);
}
} |
Convert the telephony event to string
@param event The event in integer
@return The event in string
| getSimpleName::telephonyEventToString | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private static String callSessionEventToString(int event) {
switch (event) {
case TelephonyCallSession.Event.Type.EVENT_UNKNOWN:
return "EVENT_UNKNOWN";
case TelephonyCallSession.Event.Type.SETTINGS_CHANGED:
return "SETTINGS_CHANGED";
case TelephonyCallSession.Event.Type.RIL_SERVICE_STATE_CHANGED:
return "RIL_SERVICE_STATE_CHANGED";
case TelephonyCallSession.Event.Type.IMS_CONNECTION_STATE_CHANGED:
return "IMS_CONNECTION_STATE_CHANGED";
case TelephonyCallSession.Event.Type.IMS_CAPABILITIES_CHANGED:
return "IMS_CAPABILITIES_CHANGED";
case TelephonyCallSession.Event.Type.DATA_CALL_LIST_CHANGED:
return "DATA_CALL_LIST_CHANGED";
case TelephonyCallSession.Event.Type.RIL_REQUEST:
return "RIL_REQUEST";
case TelephonyCallSession.Event.Type.RIL_RESPONSE:
return "RIL_RESPONSE";
case TelephonyCallSession.Event.Type.RIL_CALL_RING:
return "RIL_CALL_RING";
case TelephonyCallSession.Event.Type.RIL_CALL_SRVCC:
return "RIL_CALL_SRVCC";
case TelephonyCallSession.Event.Type.RIL_CALL_LIST_CHANGED:
return "RIL_CALL_LIST_CHANGED";
case TelephonyCallSession.Event.Type.IMS_COMMAND:
return "IMS_COMMAND";
case TelephonyCallSession.Event.Type.IMS_COMMAND_RECEIVED:
return "IMS_COMMAND_RECEIVED";
case TelephonyCallSession.Event.Type.IMS_COMMAND_FAILED:
return "IMS_COMMAND_FAILED";
case TelephonyCallSession.Event.Type.IMS_COMMAND_COMPLETE:
return "IMS_COMMAND_COMPLETE";
case TelephonyCallSession.Event.Type.IMS_CALL_RECEIVE:
return "IMS_CALL_RECEIVE";
case TelephonyCallSession.Event.Type.IMS_CALL_STATE_CHANGED:
return "IMS_CALL_STATE_CHANGED";
case TelephonyCallSession.Event.Type.IMS_CALL_TERMINATED:
return "IMS_CALL_TERMINATED";
case TelephonyCallSession.Event.Type.IMS_CALL_HANDOVER:
return "IMS_CALL_HANDOVER";
case TelephonyCallSession.Event.Type.IMS_CALL_HANDOVER_FAILED:
return "IMS_CALL_HANDOVER_FAILED";
case TelephonyCallSession.Event.Type.PHONE_STATE_CHANGED:
return "PHONE_STATE_CHANGED";
case TelephonyCallSession.Event.Type.NITZ_TIME:
return "NITZ_TIME";
case TelephonyCallSession.Event.Type.AUDIO_CODEC:
return "AUDIO_CODEC";
default:
return Integer.toString(event);
}
} |
Convert the call session event into string
@param event The event in integer
@return The event in String
| getSimpleName::callSessionEventToString | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private static String smsSessionEventToString(int event) {
switch (event) {
case SmsSession.Event.Type.EVENT_UNKNOWN:
return "EVENT_UNKNOWN";
case SmsSession.Event.Type.SETTINGS_CHANGED:
return "SETTINGS_CHANGED";
case SmsSession.Event.Type.RIL_SERVICE_STATE_CHANGED:
return "RIL_SERVICE_STATE_CHANGED";
case SmsSession.Event.Type.IMS_CONNECTION_STATE_CHANGED:
return "IMS_CONNECTION_STATE_CHANGED";
case SmsSession.Event.Type.IMS_CAPABILITIES_CHANGED:
return "IMS_CAPABILITIES_CHANGED";
case SmsSession.Event.Type.DATA_CALL_LIST_CHANGED:
return "DATA_CALL_LIST_CHANGED";
case SmsSession.Event.Type.SMS_SEND:
return "SMS_SEND";
case SmsSession.Event.Type.SMS_SEND_RESULT:
return "SMS_SEND_RESULT";
case SmsSession.Event.Type.SMS_RECEIVED:
return "SMS_RECEIVED";
case SmsSession.Event.Type.INCOMPLETE_SMS_RECEIVED:
return "INCOMPLETE_SMS_RECEIVED";
default:
return Integer.toString(event);
}
} |
Convert the SMS session event into string
@param event The event in integer
@return The event in String
| getSimpleName::smsSessionEventToString | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private synchronized void printAllMetrics(PrintWriter rawWriter) {
final IndentingPrintWriter pw = new IndentingPrintWriter(rawWriter, " ");
pw.println("Telephony metrics proto:");
pw.println("------------------------------------------");
pw.println("Telephony events:");
pw.increaseIndent();
for (TelephonyEvent event : mTelephonyEvents) {
pw.print(event.timestampMillis);
pw.print(" [");
pw.print(event.phoneId);
pw.print("] ");
pw.print("T=");
if (event.type == TelephonyEvent.Type.RIL_SERVICE_STATE_CHANGED) {
pw.print(telephonyEventToString(event.type)
+ "(" + "Data RAT " + event.serviceState.dataRat
+ " Voice RAT " + event.serviceState.voiceRat
+ " Channel Number " + event.serviceState.channelNumber
+ " NR Frequency Range " + event.serviceState.nrFrequencyRange
+ " NR State " + event.serviceState.nrState
+ ")");
for (int i = 0; i < event.serviceState.networkRegistrationInfo.length; i++) {
pw.print("reg info: domain="
+ event.serviceState.networkRegistrationInfo[i].domain
+ ", rat=" + event.serviceState.networkRegistrationInfo[i].rat);
}
} else {
pw.print(telephonyEventToString(event.type));
}
pw.println("");
}
pw.decreaseIndent();
pw.println("Call sessions:");
pw.increaseIndent();
for (TelephonyCallSession callSession : mCompletedCallSessions) {
pw.print("Start time in minutes: " + callSession.startTimeMinutes);
pw.print(", phone: " + callSession.phoneId);
if (callSession.eventsDropped) {
pw.println(", events dropped: " + callSession.eventsDropped);
} else {
pw.println("");
}
pw.println("Events: ");
pw.increaseIndent();
for (TelephonyCallSession.Event event : callSession.events) {
pw.print(event.delay);
pw.print(" T=");
if (event.type == TelephonyCallSession.Event.Type.RIL_SERVICE_STATE_CHANGED) {
pw.println(callSessionEventToString(event.type)
+ "(" + "Data RAT " + event.serviceState.dataRat
+ " Voice RAT " + event.serviceState.voiceRat
+ " Channel Number " + event.serviceState.channelNumber
+ " NR Frequency Range " + event.serviceState.nrFrequencyRange
+ " NR State " + event.serviceState.nrState
+ ")");
} else if (event.type == TelephonyCallSession.Event.Type.RIL_CALL_LIST_CHANGED) {
pw.println(callSessionEventToString(event.type));
pw.increaseIndent();
for (RilCall call : event.calls) {
pw.println(call.index + ". Type = " + call.type + " State = "
+ call.state + " End Reason " + call.callEndReason
+ " Precise Disconnect Cause " + call.preciseDisconnectCause
+ " isMultiparty = " + call.isMultiparty);
}
pw.decreaseIndent();
} else if (event.type == TelephonyCallSession.Event.Type.AUDIO_CODEC) {
pw.println(callSessionEventToString(event.type)
+ "(" + event.audioCodec + ")");
} else {
pw.println(callSessionEventToString(event.type));
}
}
pw.decreaseIndent();
}
pw.decreaseIndent();
pw.println("Sms sessions:");
pw.increaseIndent();
int count = 0;
for (SmsSession smsSession : mCompletedSmsSessions) {
count++;
pw.print("[" + count + "] Start time in minutes: "
+ smsSession.startTimeMinutes);
pw.print(", phone: " + smsSession.phoneId);
if (smsSession.eventsDropped) {
pw.println(", events dropped: " + smsSession.eventsDropped);
} else {
pw.println("");
}
pw.println("Events: ");
pw.increaseIndent();
for (SmsSession.Event event : smsSession.events) {
pw.print(event.delay);
pw.print(" T=");
if (event.type == SmsSession.Event.Type.RIL_SERVICE_STATE_CHANGED) {
pw.println(smsSessionEventToString(event.type)
+ "(" + "Data RAT " + event.serviceState.dataRat
+ " Voice RAT " + event.serviceState.voiceRat
+ " Channel Number " + event.serviceState.channelNumber
+ " NR Frequency Range " + event.serviceState.nrFrequencyRange
+ " NR State " + event.serviceState.nrState
+ ")");
} else if (event.type == SmsSession.Event.Type.SMS_RECEIVED) {
pw.println(smsSessionEventToString(event.type));
pw.increaseIndent();
switch (event.smsType) {
case SmsSession.Event.SmsType.SMS_TYPE_SMS_PP:
pw.println("Type: SMS-PP");
break;
case SmsSession.Event.SmsType.SMS_TYPE_VOICEMAIL_INDICATION:
pw.println("Type: Voicemail indication");
break;
case SmsSession.Event.SmsType.SMS_TYPE_ZERO:
pw.println("Type: zero");
break;
case SmsSession.Event.SmsType.SMS_TYPE_WAP_PUSH:
pw.println("Type: WAP PUSH");
break;
default:
break;
}
if (event.errorCode != SmsManager.RESULT_ERROR_NONE) {
pw.println("E=" + event.errorCode);
}
pw.decreaseIndent();
} else if (event.type == SmsSession.Event.Type.SMS_SEND
|| event.type == SmsSession.Event.Type.SMS_SEND_RESULT) {
pw.println(smsSessionEventToString(event.type));
pw.increaseIndent();
pw.println("ReqId=" + event.rilRequestId);
pw.println("E=" + event.errorCode);
pw.println("RilE=" + event.error);
pw.println("ImsE=" + event.imsError);
pw.decreaseIndent();
} else if (event.type == SmsSession.Event.Type.INCOMPLETE_SMS_RECEIVED) {
pw.println(smsSessionEventToString(event.type));
pw.increaseIndent();
pw.println("Received: " + event.incompleteSms.receivedParts + "/"
+ event.incompleteSms.totalParts);
pw.decreaseIndent();
}
}
pw.decreaseIndent();
}
pw.decreaseIndent();
pw.println("Modem power stats:");
pw.increaseIndent();
BatteryStatsManager batteryStatsManager = mContext == null ? null :
(BatteryStatsManager) mContext.getSystemService(Context.BATTERY_STATS_SERVICE);
ModemPowerStats s = new ModemPowerMetrics(batteryStatsManager).buildProto();
pw.println("Power log duration (battery time) (ms): " + s.loggingDurationMs);
pw.println("Energy consumed by modem (mAh): " + s.energyConsumedMah);
pw.println("Number of packets sent (tx): " + s.numPacketsTx);
pw.println("Number of bytes sent (tx): " + s.numBytesTx);
pw.println("Number of packets received (rx): " + s.numPacketsRx);
pw.println("Number of bytes received (rx): " + s.numBytesRx);
pw.println("Amount of time kernel is active because of cellular data (ms): "
+ s.cellularKernelActiveTimeMs);
pw.println("Amount of time spent in very poor rx signal level (ms): "
+ s.timeInVeryPoorRxSignalLevelMs);
pw.println("Amount of time modem is in sleep (ms): " + s.sleepTimeMs);
pw.println("Amount of time modem is in idle (ms): " + s.idleTimeMs);
pw.println("Amount of time modem is in rx (ms): " + s.rxTimeMs);
pw.println("Amount of time modem is in tx (ms): " + Arrays.toString(s.txTimeMs));
pw.println("Amount of time phone spent in various Radio Access Technologies (ms): "
+ Arrays.toString(s.timeInRatMs));
pw.println("Amount of time phone spent in various cellular "
+ "rx signal strength levels (ms): "
+ Arrays.toString(s.timeInRxSignalStrengthLevelMs));
pw.println("Energy consumed across measured modem rails (mAh): "
+ new DecimalFormat("#.##").format(s.monitoredRailEnergyConsumedMah));
pw.decreaseIndent();
pw.println("Hardware Version: " + SystemProperties.get("ro.boot.revision", ""));
pw.decreaseIndent();
pw.println("LinkBandwidthEstimator stats:");
pw.increaseIndent();
pw.println("Tx");
for (BwEstimationStats stats : mBwEstStatsMapList.get(0).values()) {
pw.println(stats.toString());
}
pw.println("Rx");
for (BwEstimationStats stats : mBwEstStatsMapList.get(1).values()) {
pw.println(stats.toString());
}
RcsStats.getInstance().printAllMetrics(rawWriter);
} |
Print all metrics data for debugging purposes
@param rawWriter Print writer
| getSimpleName::printAllMetrics | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private static String convertProtoToBase64String(TelephonyLog proto) {
return Base64.encodeToString(
TelephonyProto.TelephonyLog.toByteArray(proto), Base64.DEFAULT);
} |
Convert the telephony proto into Base-64 encoded string
@param proto Telephony proto
@return Encoded string
| getSimpleName::convertProtoToBase64String | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private synchronized void reset() {
mTelephonyEvents.clear();
mCompletedCallSessions.clear();
mCompletedSmsSessions.clear();
mBwEstStatsMapList.get(0).clear();
mBwEstStatsMapList.get(1).clear();
mTelephonyEventsDropped = false;
mStartSystemTimeMs = System.currentTimeMillis();
mStartElapsedTimeMs = SystemClock.elapsedRealtime();
// Insert the last known sim state, enabled modem bitmap, active subscription info,
// service state, ims capabilities, ims connection states, carrier id and Data call
// events as the base.
// Sim state, modem bitmap and active subscription info events are logged before
// other events.
addTelephonyEvent(new TelephonyEventBuilder(mStartElapsedTimeMs, -1 /* phoneId */)
.setSimStateChange(mLastSimState).build());
addTelephonyEvent(new TelephonyEventBuilder(mStartElapsedTimeMs, -1 /* phoneId */)
.setEnabledModemBitmap(mLastEnabledModemBitmap).build());
for (int i = 0; i < mLastActiveSubscriptionInfos.size(); i++) {
final int key = mLastActiveSubscriptionInfos.keyAt(i);
TelephonyEvent event = new TelephonyEventBuilder(mStartElapsedTimeMs, key)
.setActiveSubscriptionInfoChange(mLastActiveSubscriptionInfos.get(key)).build();
addTelephonyEvent(event);
}
for (int i = 0; i < mLastServiceState.size(); i++) {
final int key = mLastServiceState.keyAt(i);
TelephonyEvent event = new TelephonyEventBuilder(mStartElapsedTimeMs, key)
.setServiceState(mLastServiceState.get(key)).build();
addTelephonyEvent(event);
}
for (int i = 0; i < mLastImsCapabilities.size(); i++) {
final int key = mLastImsCapabilities.keyAt(i);
TelephonyEvent event = new TelephonyEventBuilder(mStartElapsedTimeMs, key)
.setImsCapabilities(mLastImsCapabilities.get(key)).build();
addTelephonyEvent(event);
}
for (int i = 0; i < mLastImsConnectionState.size(); i++) {
final int key = mLastImsConnectionState.keyAt(i);
TelephonyEvent event = new TelephonyEventBuilder(mStartElapsedTimeMs, key)
.setImsConnectionState(mLastImsConnectionState.get(key)).build();
addTelephonyEvent(event);
}
for (int i = 0; i < mLastCarrierId.size(); i++) {
final int key = mLastCarrierId.keyAt(i);
TelephonyEvent event = new TelephonyEventBuilder(mStartElapsedTimeMs, key)
.setCarrierIdMatching(mLastCarrierId.get(key)).build();
addTelephonyEvent(event);
}
for (int i = 0; i < mLastNetworkCapabilitiesInfos.size(); i++) {
final int key = mLastNetworkCapabilitiesInfos.keyAt(i);
TelephonyEvent event = new TelephonyEventBuilder(mStartElapsedTimeMs, key)
.setNetworkCapabilities(mLastNetworkCapabilitiesInfos.get(key)).build();
addTelephonyEvent(event);
}
for (int i = 0; i < mLastRilDataCallEvents.size(); i++) {
final int key = mLastRilDataCallEvents.keyAt(i);
for (int j = 0; j < mLastRilDataCallEvents.get(key).size(); j++) {
final int cidKey = mLastRilDataCallEvents.get(key).keyAt(j);
RilDataCall[] dataCalls = new RilDataCall[1];
dataCalls[0] = mLastRilDataCallEvents.get(key).get(cidKey);
addTelephonyEvent(new TelephonyEventBuilder(mStartElapsedTimeMs, key)
.setDataCalls(dataCalls).build());
}
}
for (int i = 0; i < mLastRadioState.size(); i++) {
final int key = mLastRadioState.keyAt(i);
TelephonyEvent event = new TelephonyEventBuilder(mStartElapsedTimeMs, key)
.setRadioState(mLastRadioState.get(key)).build();
addTelephonyEvent(event);
}
RcsStats.getInstance().reset();
} |
Reset all events and sessions
| getSimpleName::reset | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private synchronized TelephonyLog buildProto() {
TelephonyLog log = new TelephonyLog();
// Build telephony events
log.events = new TelephonyEvent[mTelephonyEvents.size()];
mTelephonyEvents.toArray(log.events);
log.eventsDropped = mTelephonyEventsDropped;
// Build call sessions
log.callSessions = new TelephonyCallSession[mCompletedCallSessions.size()];
mCompletedCallSessions.toArray(log.callSessions);
// Build SMS sessions
log.smsSessions = new SmsSession[mCompletedSmsSessions.size()];
mCompletedSmsSessions.toArray(log.smsSessions);
// Build histogram. Currently we only support RIL histograms.
List<TelephonyHistogram> rilHistograms = RIL.getTelephonyRILTimingHistograms();
log.histograms = new TelephonyProto.TelephonyHistogram[rilHistograms.size()];
for (int i = 0; i < rilHistograms.size(); i++) {
log.histograms[i] = new TelephonyProto.TelephonyHistogram();
TelephonyHistogram rilHistogram = rilHistograms.get(i);
TelephonyProto.TelephonyHistogram histogramProto = log.histograms[i];
histogramProto.category = rilHistogram.getCategory();
histogramProto.id = rilHistogram.getId();
histogramProto.minTimeMillis = rilHistogram.getMinTime();
histogramProto.maxTimeMillis = rilHistogram.getMaxTime();
histogramProto.avgTimeMillis = rilHistogram.getAverageTime();
histogramProto.count = rilHistogram.getSampleCount();
histogramProto.bucketCount = rilHistogram.getBucketCount();
histogramProto.bucketEndPoints = rilHistogram.getBucketEndPoints();
histogramProto.bucketCounters = rilHistogram.getBucketCounters();
}
// Build modem power metrics
BatteryStatsManager batteryStatsManager = mContext == null ? null :
(BatteryStatsManager) mContext.getSystemService(Context.BATTERY_STATS_SERVICE);
log.modemPowerStats = new ModemPowerMetrics(batteryStatsManager).buildProto();
// Log the hardware revision
log.hardwareRevision = SystemProperties.get("ro.boot.revision", "");
// Log the starting system time
log.startTime = new TelephonyProto.Time();
log.startTime.systemTimestampMillis = mStartSystemTimeMs;
log.startTime.elapsedTimestampMillis = mStartElapsedTimeMs;
log.endTime = new TelephonyProto.Time();
log.endTime.systemTimestampMillis = System.currentTimeMillis();
log.endTime.elapsedTimestampMillis = SystemClock.elapsedRealtime();
// Log the last active subscription information.
int phoneCount = TelephonyManager.getDefault().getPhoneCount();
ActiveSubscriptionInfo[] activeSubscriptionInfo =
new ActiveSubscriptionInfo[phoneCount];
for (int i = 0; i < mLastActiveSubscriptionInfos.size(); i++) {
int key = mLastActiveSubscriptionInfos.keyAt(i);
activeSubscriptionInfo[key] = mLastActiveSubscriptionInfos.get(key);
}
for (int i = 0; i < phoneCount; i++) {
if (activeSubscriptionInfo[i] == null) {
activeSubscriptionInfo[i] = makeInvalidSubscriptionInfo(i);
}
}
log.lastActiveSubscriptionInfo = activeSubscriptionInfo;
log.bandwidthEstimatorStats = buildBandwidthEstimatorStats();
return log;
} |
Build the telephony proto
@return Telephony proto
| getSimpleName::buildProto | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public void updateSimState(int phoneId, int simState) {
int state = mapSimStateToProto(simState);
Integer lastSimState = mLastSimState.get(phoneId);
if (lastSimState == null || !lastSimState.equals(state)) {
mLastSimState.put(phoneId, state);
addTelephonyEvent(
new TelephonyEventBuilder(phoneId).setSimStateChange(mLastSimState).build());
}
} |
Build the telephony proto
@return Telephony proto
private synchronized TelephonyLog buildProto() {
TelephonyLog log = new TelephonyLog();
// Build telephony events
log.events = new TelephonyEvent[mTelephonyEvents.size()];
mTelephonyEvents.toArray(log.events);
log.eventsDropped = mTelephonyEventsDropped;
// Build call sessions
log.callSessions = new TelephonyCallSession[mCompletedCallSessions.size()];
mCompletedCallSessions.toArray(log.callSessions);
// Build SMS sessions
log.smsSessions = new SmsSession[mCompletedSmsSessions.size()];
mCompletedSmsSessions.toArray(log.smsSessions);
// Build histogram. Currently we only support RIL histograms.
List<TelephonyHistogram> rilHistograms = RIL.getTelephonyRILTimingHistograms();
log.histograms = new TelephonyProto.TelephonyHistogram[rilHistograms.size()];
for (int i = 0; i < rilHistograms.size(); i++) {
log.histograms[i] = new TelephonyProto.TelephonyHistogram();
TelephonyHistogram rilHistogram = rilHistograms.get(i);
TelephonyProto.TelephonyHistogram histogramProto = log.histograms[i];
histogramProto.category = rilHistogram.getCategory();
histogramProto.id = rilHistogram.getId();
histogramProto.minTimeMillis = rilHistogram.getMinTime();
histogramProto.maxTimeMillis = rilHistogram.getMaxTime();
histogramProto.avgTimeMillis = rilHistogram.getAverageTime();
histogramProto.count = rilHistogram.getSampleCount();
histogramProto.bucketCount = rilHistogram.getBucketCount();
histogramProto.bucketEndPoints = rilHistogram.getBucketEndPoints();
histogramProto.bucketCounters = rilHistogram.getBucketCounters();
}
// Build modem power metrics
BatteryStatsManager batteryStatsManager = mContext == null ? null :
(BatteryStatsManager) mContext.getSystemService(Context.BATTERY_STATS_SERVICE);
log.modemPowerStats = new ModemPowerMetrics(batteryStatsManager).buildProto();
// Log the hardware revision
log.hardwareRevision = SystemProperties.get("ro.boot.revision", "");
// Log the starting system time
log.startTime = new TelephonyProto.Time();
log.startTime.systemTimestampMillis = mStartSystemTimeMs;
log.startTime.elapsedTimestampMillis = mStartElapsedTimeMs;
log.endTime = new TelephonyProto.Time();
log.endTime.systemTimestampMillis = System.currentTimeMillis();
log.endTime.elapsedTimestampMillis = SystemClock.elapsedRealtime();
// Log the last active subscription information.
int phoneCount = TelephonyManager.getDefault().getPhoneCount();
ActiveSubscriptionInfo[] activeSubscriptionInfo =
new ActiveSubscriptionInfo[phoneCount];
for (int i = 0; i < mLastActiveSubscriptionInfos.size(); i++) {
int key = mLastActiveSubscriptionInfos.keyAt(i);
activeSubscriptionInfo[key] = mLastActiveSubscriptionInfos.get(key);
}
for (int i = 0; i < phoneCount; i++) {
if (activeSubscriptionInfo[i] == null) {
activeSubscriptionInfo[i] = makeInvalidSubscriptionInfo(i);
}
}
log.lastActiveSubscriptionInfo = activeSubscriptionInfo;
log.bandwidthEstimatorStats = buildBandwidthEstimatorStats();
return log;
}
/** Update the sim state. | getSimpleName::updateSimState | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public synchronized void updateActiveSubscriptionInfoList(List<SubscriptionInfo> subInfos) {
List<Integer> inActivePhoneList = new ArrayList<>();
for (int i = 0; i < mLastActiveSubscriptionInfos.size(); i++) {
inActivePhoneList.add(mLastActiveSubscriptionInfos.keyAt(i));
}
for (SubscriptionInfo info : subInfos) {
int phoneId = info.getSimSlotIndex();
inActivePhoneList.removeIf(value -> value.equals(phoneId));
ActiveSubscriptionInfo activeSubscriptionInfo = new ActiveSubscriptionInfo();
activeSubscriptionInfo.slotIndex = phoneId;
activeSubscriptionInfo.isOpportunistic = info.isOpportunistic() ? 1 : 0;
activeSubscriptionInfo.carrierId = info.getCarrierId();
if (info.getMccString() != null && info.getMncString() != null) {
activeSubscriptionInfo.simMccmnc = info.getMccString() + info.getMncString();
}
if (!MessageNano.messageNanoEquals(
mLastActiveSubscriptionInfos.get(phoneId), activeSubscriptionInfo)) {
addTelephonyEvent(new TelephonyEventBuilder(phoneId)
.setActiveSubscriptionInfoChange(activeSubscriptionInfo).build());
mLastActiveSubscriptionInfos.put(phoneId, activeSubscriptionInfo);
}
}
for (int phoneId : inActivePhoneList) {
mLastActiveSubscriptionInfos.remove(phoneId);
addTelephonyEvent(new TelephonyEventBuilder(phoneId)
.setActiveSubscriptionInfoChange(makeInvalidSubscriptionInfo(phoneId)).build());
}
} |
Build the telephony proto
@return Telephony proto
private synchronized TelephonyLog buildProto() {
TelephonyLog log = new TelephonyLog();
// Build telephony events
log.events = new TelephonyEvent[mTelephonyEvents.size()];
mTelephonyEvents.toArray(log.events);
log.eventsDropped = mTelephonyEventsDropped;
// Build call sessions
log.callSessions = new TelephonyCallSession[mCompletedCallSessions.size()];
mCompletedCallSessions.toArray(log.callSessions);
// Build SMS sessions
log.smsSessions = new SmsSession[mCompletedSmsSessions.size()];
mCompletedSmsSessions.toArray(log.smsSessions);
// Build histogram. Currently we only support RIL histograms.
List<TelephonyHistogram> rilHistograms = RIL.getTelephonyRILTimingHistograms();
log.histograms = new TelephonyProto.TelephonyHistogram[rilHistograms.size()];
for (int i = 0; i < rilHistograms.size(); i++) {
log.histograms[i] = new TelephonyProto.TelephonyHistogram();
TelephonyHistogram rilHistogram = rilHistograms.get(i);
TelephonyProto.TelephonyHistogram histogramProto = log.histograms[i];
histogramProto.category = rilHistogram.getCategory();
histogramProto.id = rilHistogram.getId();
histogramProto.minTimeMillis = rilHistogram.getMinTime();
histogramProto.maxTimeMillis = rilHistogram.getMaxTime();
histogramProto.avgTimeMillis = rilHistogram.getAverageTime();
histogramProto.count = rilHistogram.getSampleCount();
histogramProto.bucketCount = rilHistogram.getBucketCount();
histogramProto.bucketEndPoints = rilHistogram.getBucketEndPoints();
histogramProto.bucketCounters = rilHistogram.getBucketCounters();
}
// Build modem power metrics
BatteryStatsManager batteryStatsManager = mContext == null ? null :
(BatteryStatsManager) mContext.getSystemService(Context.BATTERY_STATS_SERVICE);
log.modemPowerStats = new ModemPowerMetrics(batteryStatsManager).buildProto();
// Log the hardware revision
log.hardwareRevision = SystemProperties.get("ro.boot.revision", "");
// Log the starting system time
log.startTime = new TelephonyProto.Time();
log.startTime.systemTimestampMillis = mStartSystemTimeMs;
log.startTime.elapsedTimestampMillis = mStartElapsedTimeMs;
log.endTime = new TelephonyProto.Time();
log.endTime.systemTimestampMillis = System.currentTimeMillis();
log.endTime.elapsedTimestampMillis = SystemClock.elapsedRealtime();
// Log the last active subscription information.
int phoneCount = TelephonyManager.getDefault().getPhoneCount();
ActiveSubscriptionInfo[] activeSubscriptionInfo =
new ActiveSubscriptionInfo[phoneCount];
for (int i = 0; i < mLastActiveSubscriptionInfos.size(); i++) {
int key = mLastActiveSubscriptionInfos.keyAt(i);
activeSubscriptionInfo[key] = mLastActiveSubscriptionInfos.get(key);
}
for (int i = 0; i < phoneCount; i++) {
if (activeSubscriptionInfo[i] == null) {
activeSubscriptionInfo[i] = makeInvalidSubscriptionInfo(i);
}
}
log.lastActiveSubscriptionInfo = activeSubscriptionInfo;
log.bandwidthEstimatorStats = buildBandwidthEstimatorStats();
return log;
}
/** Update the sim state.
public void updateSimState(int phoneId, int simState) {
int state = mapSimStateToProto(simState);
Integer lastSimState = mLastSimState.get(phoneId);
if (lastSimState == null || !lastSimState.equals(state)) {
mLastSimState.put(phoneId, state);
addTelephonyEvent(
new TelephonyEventBuilder(phoneId).setSimStateChange(mLastSimState).build());
}
}
/** Update active subscription info list. | getSimpleName::updateActiveSubscriptionInfoList | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public void updateEnabledModemBitmap(int enabledModemBitmap) {
if (mLastEnabledModemBitmap == enabledModemBitmap) return;
mLastEnabledModemBitmap = enabledModemBitmap;
addTelephonyEvent(new TelephonyEventBuilder()
.setEnabledModemBitmap(mLastEnabledModemBitmap).build());
} |
Build the telephony proto
@return Telephony proto
private synchronized TelephonyLog buildProto() {
TelephonyLog log = new TelephonyLog();
// Build telephony events
log.events = new TelephonyEvent[mTelephonyEvents.size()];
mTelephonyEvents.toArray(log.events);
log.eventsDropped = mTelephonyEventsDropped;
// Build call sessions
log.callSessions = new TelephonyCallSession[mCompletedCallSessions.size()];
mCompletedCallSessions.toArray(log.callSessions);
// Build SMS sessions
log.smsSessions = new SmsSession[mCompletedSmsSessions.size()];
mCompletedSmsSessions.toArray(log.smsSessions);
// Build histogram. Currently we only support RIL histograms.
List<TelephonyHistogram> rilHistograms = RIL.getTelephonyRILTimingHistograms();
log.histograms = new TelephonyProto.TelephonyHistogram[rilHistograms.size()];
for (int i = 0; i < rilHistograms.size(); i++) {
log.histograms[i] = new TelephonyProto.TelephonyHistogram();
TelephonyHistogram rilHistogram = rilHistograms.get(i);
TelephonyProto.TelephonyHistogram histogramProto = log.histograms[i];
histogramProto.category = rilHistogram.getCategory();
histogramProto.id = rilHistogram.getId();
histogramProto.minTimeMillis = rilHistogram.getMinTime();
histogramProto.maxTimeMillis = rilHistogram.getMaxTime();
histogramProto.avgTimeMillis = rilHistogram.getAverageTime();
histogramProto.count = rilHistogram.getSampleCount();
histogramProto.bucketCount = rilHistogram.getBucketCount();
histogramProto.bucketEndPoints = rilHistogram.getBucketEndPoints();
histogramProto.bucketCounters = rilHistogram.getBucketCounters();
}
// Build modem power metrics
BatteryStatsManager batteryStatsManager = mContext == null ? null :
(BatteryStatsManager) mContext.getSystemService(Context.BATTERY_STATS_SERVICE);
log.modemPowerStats = new ModemPowerMetrics(batteryStatsManager).buildProto();
// Log the hardware revision
log.hardwareRevision = SystemProperties.get("ro.boot.revision", "");
// Log the starting system time
log.startTime = new TelephonyProto.Time();
log.startTime.systemTimestampMillis = mStartSystemTimeMs;
log.startTime.elapsedTimestampMillis = mStartElapsedTimeMs;
log.endTime = new TelephonyProto.Time();
log.endTime.systemTimestampMillis = System.currentTimeMillis();
log.endTime.elapsedTimestampMillis = SystemClock.elapsedRealtime();
// Log the last active subscription information.
int phoneCount = TelephonyManager.getDefault().getPhoneCount();
ActiveSubscriptionInfo[] activeSubscriptionInfo =
new ActiveSubscriptionInfo[phoneCount];
for (int i = 0; i < mLastActiveSubscriptionInfos.size(); i++) {
int key = mLastActiveSubscriptionInfos.keyAt(i);
activeSubscriptionInfo[key] = mLastActiveSubscriptionInfos.get(key);
}
for (int i = 0; i < phoneCount; i++) {
if (activeSubscriptionInfo[i] == null) {
activeSubscriptionInfo[i] = makeInvalidSubscriptionInfo(i);
}
}
log.lastActiveSubscriptionInfo = activeSubscriptionInfo;
log.bandwidthEstimatorStats = buildBandwidthEstimatorStats();
return log;
}
/** Update the sim state.
public void updateSimState(int phoneId, int simState) {
int state = mapSimStateToProto(simState);
Integer lastSimState = mLastSimState.get(phoneId);
if (lastSimState == null || !lastSimState.equals(state)) {
mLastSimState.put(phoneId, state);
addTelephonyEvent(
new TelephonyEventBuilder(phoneId).setSimStateChange(mLastSimState).build());
}
}
/** Update active subscription info list.
public synchronized void updateActiveSubscriptionInfoList(List<SubscriptionInfo> subInfos) {
List<Integer> inActivePhoneList = new ArrayList<>();
for (int i = 0; i < mLastActiveSubscriptionInfos.size(); i++) {
inActivePhoneList.add(mLastActiveSubscriptionInfos.keyAt(i));
}
for (SubscriptionInfo info : subInfos) {
int phoneId = info.getSimSlotIndex();
inActivePhoneList.removeIf(value -> value.equals(phoneId));
ActiveSubscriptionInfo activeSubscriptionInfo = new ActiveSubscriptionInfo();
activeSubscriptionInfo.slotIndex = phoneId;
activeSubscriptionInfo.isOpportunistic = info.isOpportunistic() ? 1 : 0;
activeSubscriptionInfo.carrierId = info.getCarrierId();
if (info.getMccString() != null && info.getMncString() != null) {
activeSubscriptionInfo.simMccmnc = info.getMccString() + info.getMncString();
}
if (!MessageNano.messageNanoEquals(
mLastActiveSubscriptionInfos.get(phoneId), activeSubscriptionInfo)) {
addTelephonyEvent(new TelephonyEventBuilder(phoneId)
.setActiveSubscriptionInfoChange(activeSubscriptionInfo).build());
mLastActiveSubscriptionInfos.put(phoneId, activeSubscriptionInfo);
}
}
for (int phoneId : inActivePhoneList) {
mLastActiveSubscriptionInfos.remove(phoneId);
addTelephonyEvent(new TelephonyEventBuilder(phoneId)
.setActiveSubscriptionInfoChange(makeInvalidSubscriptionInfo(phoneId)).build());
}
}
/** Update the enabled modem bitmap. | getSimpleName::updateEnabledModemBitmap | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
static int roundSessionStart(long timestamp) {
return (int) ((timestamp) / (MINUTE_IN_MILLIS * SESSION_START_PRECISION_MINUTES)
* (SESSION_START_PRECISION_MINUTES));
} |
Reduce precision to meet privacy requirements.
@param timestamp timestamp in milliseconds
@return Precision reduced timestamp in minutes
| getSimpleName::roundSessionStart | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public void writeCarrierKeyEvent(int phoneId, int keyType, boolean isDownloadSuccessful) {
final CarrierKeyChange carrierKeyChange = new CarrierKeyChange();
carrierKeyChange.keyType = keyType;
carrierKeyChange.isDownloadSuccessful = isDownloadSuccessful;
TelephonyEvent event = new TelephonyEventBuilder(phoneId).setCarrierKeyChange(
carrierKeyChange).build();
addTelephonyEvent(event);
} |
Write the Carrier Key change event
@param phoneId Phone id
@param keyType type of key
@param isDownloadSuccessful true if the key was successfully downloaded
| getSimpleName::writeCarrierKeyEvent | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
static int toPrivacyFuzzedTimeInterval(long previousTimestamp, long currentTimestamp) {
long diff = currentTimestamp - previousTimestamp;
if (diff < 0) {
return TimeInterval.TI_UNKNOWN;
} else if (diff <= 10) {
return TimeInterval.TI_10_MILLIS;
} else if (diff <= 20) {
return TimeInterval.TI_20_MILLIS;
} else if (diff <= 50) {
return TimeInterval.TI_50_MILLIS;
} else if (diff <= 100) {
return TimeInterval.TI_100_MILLIS;
} else if (diff <= 200) {
return TimeInterval.TI_200_MILLIS;
} else if (diff <= 500) {
return TimeInterval.TI_500_MILLIS;
} else if (diff <= 1000) {
return TimeInterval.TI_1_SEC;
} else if (diff <= 2000) {
return TimeInterval.TI_2_SEC;
} else if (diff <= 5000) {
return TimeInterval.TI_5_SEC;
} else if (diff <= 10000) {
return TimeInterval.TI_10_SEC;
} else if (diff <= 30000) {
return TimeInterval.TI_30_SEC;
} else if (diff <= 60000) {
return TimeInterval.TI_1_MINUTE;
} else if (diff <= 180000) {
return TimeInterval.TI_3_MINUTES;
} else if (diff <= 600000) {
return TimeInterval.TI_10_MINUTES;
} else if (diff <= 1800000) {
return TimeInterval.TI_30_MINUTES;
} else if (diff <= 3600000) {
return TimeInterval.TI_1_HOUR;
} else if (diff <= 7200000) {
return TimeInterval.TI_2_HOURS;
} else if (diff <= 14400000) {
return TimeInterval.TI_4_HOURS;
} else {
return TimeInterval.TI_MANY_HOURS;
}
} |
Get the time interval with reduced prevision
@param previousTimestamp Previous timestamp in milliseconds
@param currentTimestamp Current timestamp in milliseconds
@return The time interval
| getSimpleName::toPrivacyFuzzedTimeInterval | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private TelephonyServiceState toServiceStateProto(ServiceState serviceState) {
TelephonyServiceState ssProto = new TelephonyServiceState();
ssProto.voiceRoamingType = serviceState.getVoiceRoamingType();
ssProto.dataRoamingType = serviceState.getDataRoamingType();
ssProto.voiceOperator = new TelephonyServiceState.TelephonyOperator();
ssProto.dataOperator = new TelephonyServiceState.TelephonyOperator();
if (serviceState.getOperatorAlphaLong() != null) {
ssProto.voiceOperator.alphaLong = serviceState.getOperatorAlphaLong();
ssProto.dataOperator.alphaLong = serviceState.getOperatorAlphaLong();
}
if (serviceState.getOperatorAlphaShort() != null) {
ssProto.voiceOperator.alphaShort = serviceState.getOperatorAlphaShort();
ssProto.dataOperator.alphaShort = serviceState.getOperatorAlphaShort();
}
if (serviceState.getOperatorNumeric() != null) {
ssProto.voiceOperator.numeric = serviceState.getOperatorNumeric();
ssProto.dataOperator.numeric = serviceState.getOperatorNumeric();
}
// Log PS WWAN only because CS WWAN would be exactly the same as voiceRat, and PS WLAN
// would be always IWLAN in the rat field.
// Note that we intentionally do not log reg state because it changes too frequently that
// will grow the proto size too much.
List<TelephonyServiceState.NetworkRegistrationInfo> nriList = new ArrayList<>();
NetworkRegistrationInfo nri = serviceState.getNetworkRegistrationInfo(
NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
if (nri != null) {
TelephonyServiceState.NetworkRegistrationInfo nriProto =
new TelephonyServiceState.NetworkRegistrationInfo();
nriProto.domain = TelephonyServiceState.Domain.DOMAIN_PS;
nriProto.transport = TelephonyServiceState.Transport.TRANSPORT_WWAN;
nriProto.rat = ServiceState.networkTypeToRilRadioTechnology(
nri.getAccessNetworkTechnology());
nriList.add(nriProto);
ssProto.networkRegistrationInfo =
new TelephonyServiceState.NetworkRegistrationInfo[nriList.size()];
nriList.toArray(ssProto.networkRegistrationInfo);
}
ssProto.voiceRat = serviceState.getRilVoiceRadioTechnology();
ssProto.dataRat = serviceState.getRilDataRadioTechnology();
ssProto.channelNumber = serviceState.getChannelNumber();
ssProto.nrFrequencyRange = serviceState.getNrFrequencyRange();
ssProto.nrState = serviceState.getNrState();
return ssProto;
} |
Convert the service state into service state proto
@param serviceState Service state
@return Service state proto
| getSimpleName::toServiceStateProto | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private synchronized void annotateInProgressCallSession(long timestamp, int phoneId,
CallSessionEventBuilder eventBuilder) {
InProgressCallSession callSession = mInProgressCallSessions.get(phoneId);
if (callSession != null) {
callSession.addEvent(timestamp, eventBuilder);
}
} |
Annotate the call session with events
@param timestamp Event timestamp
@param phoneId Phone id
@param eventBuilder Call session event builder
| getSimpleName::annotateInProgressCallSession | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private synchronized void annotateInProgressSmsSession(long timestamp, int phoneId,
SmsSessionEventBuilder eventBuilder) {
InProgressSmsSession smsSession = mInProgressSmsSessions.get(phoneId);
if (smsSession != null) {
smsSession.addEvent(timestamp, eventBuilder);
}
} |
Annotate the SMS session with events
@param timestamp Event timestamp
@param phoneId Phone id
@param eventBuilder SMS session event builder
| getSimpleName::annotateInProgressSmsSession | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private synchronized InProgressCallSession startNewCallSessionIfNeeded(int phoneId) {
InProgressCallSession callSession = mInProgressCallSessions.get(phoneId);
if (callSession == null) {
logv("Starting a new call session on phone " + phoneId);
callSession = new InProgressCallSession(phoneId);
mInProgressCallSessions.append(phoneId, callSession);
// Insert the latest service state, ims capabilities, and ims connection states as the
// base.
TelephonyServiceState serviceState = mLastServiceState.get(phoneId);
if (serviceState != null) {
callSession.addEvent(callSession.startElapsedTimeMs, new CallSessionEventBuilder(
TelephonyCallSession.Event.Type.RIL_SERVICE_STATE_CHANGED)
.setServiceState(serviceState));
}
ImsCapabilities imsCapabilities = mLastImsCapabilities.get(phoneId);
if (imsCapabilities != null) {
callSession.addEvent(callSession.startElapsedTimeMs, new CallSessionEventBuilder(
TelephonyCallSession.Event.Type.IMS_CAPABILITIES_CHANGED)
.setImsCapabilities(imsCapabilities));
}
ImsConnectionState imsConnectionState = mLastImsConnectionState.get(phoneId);
if (imsConnectionState != null) {
callSession.addEvent(callSession.startElapsedTimeMs, new CallSessionEventBuilder(
TelephonyCallSession.Event.Type.IMS_CONNECTION_STATE_CHANGED)
.setImsConnectionState(imsConnectionState));
}
}
return callSession;
} |
Create the call session if there isn't any existing one
@param phoneId Phone id
@return The call session
| getSimpleName::startNewCallSessionIfNeeded | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private synchronized InProgressSmsSession startNewSmsSessionIfNeeded(int phoneId) {
InProgressSmsSession smsSession = mInProgressSmsSessions.get(phoneId);
if (smsSession == null) {
logv("Starting a new sms session on phone " + phoneId);
smsSession = startNewSmsSession(phoneId);
mInProgressSmsSessions.append(phoneId, smsSession);
}
return smsSession;
} |
Create the SMS session if there isn't any existing one
@param phoneId Phone id
@return The SMS session
| getSimpleName::startNewSmsSessionIfNeeded | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private InProgressSmsSession startNewSmsSession(int phoneId) {
InProgressSmsSession smsSession = new InProgressSmsSession(phoneId);
// Insert the latest service state, ims capabilities, and ims connection state as the
// base.
TelephonyServiceState serviceState = mLastServiceState.get(phoneId);
if (serviceState != null) {
smsSession.addEvent(smsSession.startElapsedTimeMs, new SmsSessionEventBuilder(
SmsSession.Event.Type.RIL_SERVICE_STATE_CHANGED)
.setServiceState(serviceState));
}
ImsCapabilities imsCapabilities = mLastImsCapabilities.get(phoneId);
if (imsCapabilities != null) {
smsSession.addEvent(smsSession.startElapsedTimeMs, new SmsSessionEventBuilder(
SmsSession.Event.Type.IMS_CAPABILITIES_CHANGED)
.setImsCapabilities(imsCapabilities));
}
ImsConnectionState imsConnectionState = mLastImsConnectionState.get(phoneId);
if (imsConnectionState != null) {
smsSession.addEvent(smsSession.startElapsedTimeMs, new SmsSessionEventBuilder(
SmsSession.Event.Type.IMS_CONNECTION_STATE_CHANGED)
.setImsConnectionState(imsConnectionState));
}
return smsSession;
} |
Create a new SMS session
@param phoneId Phone id
@return The SMS session
| getSimpleName::startNewSmsSession | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private synchronized void finishCallSession(InProgressCallSession inProgressCallSession) {
TelephonyCallSession callSession = new TelephonyCallSession();
callSession.events = new TelephonyCallSession.Event[inProgressCallSession.events.size()];
inProgressCallSession.events.toArray(callSession.events);
callSession.startTimeMinutes = inProgressCallSession.startSystemTimeMin;
callSession.phoneId = inProgressCallSession.phoneId;
callSession.eventsDropped = inProgressCallSession.isEventsDropped();
if (mCompletedCallSessions.size() >= MAX_COMPLETED_CALL_SESSIONS) {
mCompletedCallSessions.removeFirst();
}
mCompletedCallSessions.add(callSession);
mInProgressCallSessions.remove(inProgressCallSession.phoneId);
logv("Call session finished");
} |
Finish the call session and move it into the completed session
@param inProgressCallSession The in progress call session
| getSimpleName::finishCallSession | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private synchronized void finishSmsSessionIfNeeded(InProgressSmsSession inProgressSmsSession) {
if (inProgressSmsSession.getNumExpectedResponses() == 0) {
SmsSession smsSession = finishSmsSession(inProgressSmsSession);
mInProgressSmsSessions.remove(inProgressSmsSession.phoneId);
logv("SMS session finished");
}
} |
Finish the SMS session and move it into the completed session
@param inProgressSmsSession The in progress SMS session
| getSimpleName::finishSmsSessionIfNeeded | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private synchronized void addTelephonyEvent(TelephonyEvent event) {
if (mTelephonyEvents.size() >= MAX_TELEPHONY_EVENTS) {
mTelephonyEvents.removeFirst();
mTelephonyEventsDropped = true;
}
mTelephonyEvents.add(event);
} |
Add telephony event into the queue
@param event Telephony event
| getSimpleName::addTelephonyEvent | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public synchronized void writeServiceStateChanged(int phoneId, ServiceState serviceState) {
TelephonyEvent event = new TelephonyEventBuilder(phoneId)
.setServiceState(toServiceStateProto(serviceState)).build();
// If service state doesn't change, we don't log the event.
if (mLastServiceState.get(phoneId) != null &&
Arrays.equals(TelephonyServiceState.toByteArray(mLastServiceState.get(phoneId)),
TelephonyServiceState.toByteArray(event.serviceState))) {
return;
}
mLastServiceState.put(phoneId, event.serviceState);
addTelephonyEvent(event);
annotateInProgressCallSession(event.timestampMillis, phoneId,
new CallSessionEventBuilder(
TelephonyCallSession.Event.Type.RIL_SERVICE_STATE_CHANGED)
.setServiceState(event.serviceState));
annotateInProgressSmsSession(event.timestampMillis, phoneId,
new SmsSessionEventBuilder(
SmsSession.Event.Type.RIL_SERVICE_STATE_CHANGED)
.setServiceState(event.serviceState));
} |
Write service changed event
@param phoneId Phone id
@param serviceState Service state
| getSimpleName::writeServiceStateChanged | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public void writeDataStallEvent(int phoneId, int recoveryAction) {
addTelephonyEvent(new TelephonyEventBuilder(phoneId)
.setDataStallRecoveryAction(recoveryAction).build());
} |
Write data stall event
@param phoneId Phone id
@param recoveryAction Data stall recovery action
| getSimpleName::writeDataStallEvent | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public void writeSignalStrengthEvent(int phoneId, int signalStrength) {
addTelephonyEvent(new TelephonyEventBuilder(phoneId)
.setSignalStrength(signalStrength).build());
} |
Write SignalStrength event
@param phoneId Phone id
@param signalStrength Signal strength at the time of data stall recovery
| getSimpleName::writeSignalStrengthEvent | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public synchronized void writeImsSetFeatureValue(int phoneId, int feature, int network,
int value) {
TelephonySettings s = cloneCurrentTelephonySettings(phoneId);
if (network == ImsRegistrationImplBase.REGISTRATION_TECH_LTE) {
switch (feature) {
case MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE:
s.isEnhanced4GLteModeEnabled = (value != 0);
break;
case MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VIDEO:
s.isVtOverLteEnabled = (value != 0);
break;
}
} else if (network == ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN) {
switch (feature) {
case MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE:
s.isWifiCallingEnabled = (value != 0);
break;
case MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VIDEO:
s.isVtOverWifiEnabled = (value != 0);
break;
}
}
// If the settings don't change, we don't log the event.
if (mLastSettings.get(phoneId) != null &&
Arrays.equals(TelephonySettings.toByteArray(mLastSettings.get(phoneId)),
TelephonySettings.toByteArray(s))) {
return;
}
mLastSettings.put(phoneId, s);
TelephonyEvent event = new TelephonyEventBuilder(phoneId).setSettings(s).build();
addTelephonyEvent(event);
annotateInProgressCallSession(event.timestampMillis, phoneId,
new CallSessionEventBuilder(TelephonyCallSession.Event.Type.SETTINGS_CHANGED)
.setSettings(s));
annotateInProgressSmsSession(event.timestampMillis, phoneId,
new SmsSessionEventBuilder(SmsSession.Event.Type.SETTINGS_CHANGED)
.setSettings(s));
} |
Write IMS feature settings changed event
@param phoneId Phone id
@param feature IMS feature
@param network The IMS network type
@param value The settings. 0 indicates disabled, otherwise enabled.
| getSimpleName::writeImsSetFeatureValue | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public synchronized void writeSetPreferredNetworkType(int phoneId,
@PrefNetworkMode int networkType) {
TelephonySettings s = cloneCurrentTelephonySettings(phoneId);
s.preferredNetworkMode = networkType + 1;
// If the settings don't change, we don't log the event.
if (mLastSettings.get(phoneId) != null &&
Arrays.equals(TelephonySettings.toByteArray(mLastSettings.get(phoneId)),
TelephonySettings.toByteArray(s))) {
return;
}
mLastSettings.put(phoneId, s);
addTelephonyEvent(new TelephonyEventBuilder(phoneId).setSettings(s).build());
} |
Write the preferred network settings changed event
@param phoneId Phone id
@param networkType The preferred network
| getSimpleName::writeSetPreferredNetworkType | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public synchronized void writeOnImsConnectionState(int phoneId, int state,
ImsReasonInfo reasonInfo) {
ImsConnectionState imsState = new ImsConnectionState();
imsState.state = state;
if (reasonInfo != null) {
TelephonyProto.ImsReasonInfo ri = new TelephonyProto.ImsReasonInfo();
ri.reasonCode = reasonInfo.getCode();
ri.extraCode = reasonInfo.getExtraCode();
String extraMessage = reasonInfo.getExtraMessage();
if (extraMessage != null) {
ri.extraMessage = extraMessage;
}
imsState.reasonInfo = ri;
}
// If the connection state does not change, do not log it.
if (mLastImsConnectionState.get(phoneId) != null &&
Arrays.equals(ImsConnectionState.toByteArray(mLastImsConnectionState.get(phoneId)),
ImsConnectionState.toByteArray(imsState))) {
return;
}
mLastImsConnectionState.put(phoneId, imsState);
TelephonyEvent event = new TelephonyEventBuilder(phoneId)
.setImsConnectionState(imsState).build();
addTelephonyEvent(event);
annotateInProgressCallSession(event.timestampMillis, phoneId,
new CallSessionEventBuilder(
TelephonyCallSession.Event.Type.IMS_CONNECTION_STATE_CHANGED)
.setImsConnectionState(event.imsConnectionState));
annotateInProgressSmsSession(event.timestampMillis, phoneId,
new SmsSessionEventBuilder(
SmsSession.Event.Type.IMS_CONNECTION_STATE_CHANGED)
.setImsConnectionState(event.imsConnectionState));
} |
Write the IMS connection state changed event
@param phoneId Phone id
@param state IMS connection state
@param reasonInfo The reason info. Only used for disconnected state.
| getSimpleName::writeOnImsConnectionState | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public synchronized void writeOnImsCapabilities(int phoneId,
@ImsRegistrationImplBase.ImsRegistrationTech int radioTech,
MmTelFeature.MmTelCapabilities capabilities) {
ImsCapabilities cap = new ImsCapabilities();
if (radioTech == ImsRegistrationImplBase.REGISTRATION_TECH_LTE) {
cap.voiceOverLte = capabilities.isCapable(
MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE);
cap.videoOverLte = capabilities.isCapable(
MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VIDEO);
cap.utOverLte = capabilities.isCapable(
MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_UT);
} else if (radioTech == ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN) {
cap.voiceOverWifi = capabilities.isCapable(
MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VOICE);
cap.videoOverWifi = capabilities.isCapable(
MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_VIDEO);
cap.utOverWifi = capabilities.isCapable(
MmTelFeature.MmTelCapabilities.CAPABILITY_TYPE_UT);
}
TelephonyEvent event = new TelephonyEventBuilder(phoneId).setImsCapabilities(cap).build();
// If the capabilities don't change, we don't log the event.
if (mLastImsCapabilities.get(phoneId) != null &&
Arrays.equals(ImsCapabilities.toByteArray(mLastImsCapabilities.get(phoneId)),
ImsCapabilities.toByteArray(cap))) {
return;
}
mLastImsCapabilities.put(phoneId, cap);
addTelephonyEvent(event);
annotateInProgressCallSession(event.timestampMillis, phoneId,
new CallSessionEventBuilder(
TelephonyCallSession.Event.Type.IMS_CAPABILITIES_CHANGED)
.setImsCapabilities(event.imsCapabilities));
annotateInProgressSmsSession(event.timestampMillis, phoneId,
new SmsSessionEventBuilder(
SmsSession.Event.Type.IMS_CAPABILITIES_CHANGED)
.setImsCapabilities(event.imsCapabilities));
} |
Write the IMS capabilities changed event
@param phoneId Phone id
@param capabilities IMS capabilities array
| getSimpleName::writeOnImsCapabilities | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
private int toPdpType(String type) {
switch (type) {
case "IP":
return PDP_TYPE_IP;
case "IPV6":
return PDP_TYPE_IPV6;
case "IPV4V6":
return PDP_TYPE_IPV4V6;
case "PPP":
return PDP_TYPE_PPP;
case "NON-IP":
return PDP_TYPE_NON_IP;
case "UNSTRUCTURED":
return PDP_TYPE_UNSTRUCTURED;
}
Rlog.e(TAG, "Unknown type: " + type);
return PDP_UNKNOWN;
} |
Convert PDP type into the enumeration
@param type PDP type
@return The proto defined enumeration
| getSimpleName::toPdpType | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public void writeSetupDataCall(int phoneId, int radioTechnology, int profileId, String apn,
int protocol) {
RilSetupDataCall setupDataCall = new RilSetupDataCall();
setupDataCall.rat = radioTechnology;
setupDataCall.dataProfile = profileId + 1; // off by 1 between proto and RIL constants.
if (apn != null) {
setupDataCall.apn = apn;
}
setupDataCall.type = protocol + 1;
addTelephonyEvent(new TelephonyEventBuilder(phoneId).setSetupDataCall(
setupDataCall).build());
} |
Write setup data call event
@param phoneId Phone id
@param radioTechnology The data call RAT
@param profileId Data profile id
@param apn APN in string
@param protocol Data connection protocol
| getSimpleName::writeSetupDataCall | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public void writeRilDeactivateDataCall(int phoneId, int rilSerial, int cid, int reason) {
RilDeactivateDataCall deactivateDataCall = new RilDeactivateDataCall();
deactivateDataCall.cid = cid;
switch (reason) {
case DataService.REQUEST_REASON_NORMAL:
deactivateDataCall.reason = DeactivateReason.DEACTIVATE_REASON_NONE;
break;
case DataService.REQUEST_REASON_SHUTDOWN:
deactivateDataCall.reason = DeactivateReason.DEACTIVATE_REASON_RADIO_OFF;
break;
case DataService.REQUEST_REASON_HANDOVER:
deactivateDataCall.reason = DeactivateReason.DEACTIVATE_REASON_HANDOVER;
break;
default:
deactivateDataCall.reason = DeactivateReason.DEACTIVATE_REASON_UNKNOWN;
}
addTelephonyEvent(new TelephonyEventBuilder(phoneId).setDeactivateDataCall(
deactivateDataCall).build());
} |
Write data call deactivate event
@param phoneId Phone id
@param rilSerial RIL request serial number
@param cid call id
@param reason Deactivate reason
| getSimpleName::writeRilDeactivateDataCall | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public void writeRilDataCallEvent(int phoneId, int cid,
int apnTypeBitmask, int state) {
RilDataCall[] dataCalls = new RilDataCall[1];
dataCalls[0] = new RilDataCall();
dataCalls[0].cid = cid;
dataCalls[0].apnTypeBitmask = apnTypeBitmask;
dataCalls[0].state = state;
SparseArray<RilDataCall> dataCallList;
if (mLastRilDataCallEvents.get(phoneId) != null) {
// If the Data call event does not change, do not log it.
if (mLastRilDataCallEvents.get(phoneId).get(cid) != null
&& Arrays.equals(
RilDataCall.toByteArray(mLastRilDataCallEvents.get(phoneId).get(cid)),
RilDataCall.toByteArray(dataCalls[0]))) {
return;
}
dataCallList = mLastRilDataCallEvents.get(phoneId);
} else {
dataCallList = new SparseArray<>();
}
dataCallList.put(cid, dataCalls[0]);
mLastRilDataCallEvents.put(phoneId, dataCallList);
addTelephonyEvent(new TelephonyEventBuilder(phoneId).setDataCalls(dataCalls).build());
} |
Write data call list event when connected
@param phoneId Phone id
@param cid Context Id, uniquely identifies the call
@param apnTypeBitmask Bitmask of supported APN types
@param state State of the data call event
| getSimpleName::writeRilDataCallEvent | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
public void writeRilCallList(int phoneId, ArrayList<GsmCdmaConnection> connections,
String countryIso) {
logv("Logging CallList Changed Connections Size = " + connections.size());
InProgressCallSession callSession = startNewCallSessionIfNeeded(phoneId);
if (callSession == null) {
Rlog.e(TAG, "writeRilCallList: Call session is missing");
} else {
RilCall[] calls = convertConnectionsToRilCalls(connections, countryIso);
callSession.addEvent(
new CallSessionEventBuilder(
TelephonyCallSession.Event.Type.RIL_CALL_LIST_CHANGED)
.setRilCalls(calls)
);
logv("Logged Call list changed");
if (callSession.isPhoneIdle() && disconnectReasonsKnown(calls)) {
finishCallSession(callSession);
}
}
} |
Write CS call list event
@param phoneId Phone id
@param connections Array of GsmCdmaConnection objects
| getSimpleName::writeRilCallList | java | Reginer/aosp-android-jar | android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/telephony/metrics/TelephonyMetrics.java | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.