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 void setExpression(Expression exp) { exp.exprSetParent(FilterExprIterator.this); m_expr = exp; }
@see ExpressionOwner#setExpression(Expression)
filterExprOwner::setExpression
java
Reginer/aosp-android-jar
android-35/src/org/apache/xpath/axes/FilterExprIterator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xpath/axes/FilterExprIterator.java
MIT
public void callPredicateVisitors(XPathVisitor visitor) { m_expr.callVisitors(new filterExprOwner(), visitor); super.callPredicateVisitors(visitor); }
This will traverse the heararchy, calling the visitor for each member. If the called visitor method returns false, the subtree should not be called. @param visitor The visitor whose appropriate method will be called.
filterExprOwner::callPredicateVisitors
java
Reginer/aosp-android-jar
android-35/src/org/apache/xpath/axes/FilterExprIterator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xpath/axes/FilterExprIterator.java
MIT
public boolean deepEquals(Expression expr) { if (!super.deepEquals(expr)) return false; FilterExprIterator fet = (FilterExprIterator) expr; if (!m_expr.deepEquals(fet.m_expr)) return false; return true; }
@see Expression#deepEquals(Expression)
filterExprOwner::deepEquals
java
Reginer/aosp-android-jar
android-35/src/org/apache/xpath/axes/FilterExprIterator.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/org/apache/xpath/axes/FilterExprIterator.java
MIT
public FrameMetrics(FrameMetrics other) { mTimingData = new long[Index.FRAME_STATS_COUNT]; System.arraycopy(other.mTimingData, 0, mTimingData, 0, mTimingData.length); }
Constructs a FrameMetrics object as a copy. <p> Use this method to copy out metrics reported by {@link Window.OnFrameMetricsAvailableListener#onFrameMetricsAvailable( Window, FrameMetrics, int)} </p> @param other the FrameMetrics object to copy.
FrameMetrics::FrameMetrics
java
Reginer/aosp-android-jar
android-32/src/android/view/FrameMetrics.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/view/FrameMetrics.java
MIT
public FrameMetrics() { mTimingData = new long[Index.FRAME_STATS_COUNT]; }
@hide
FrameMetrics::FrameMetrics
java
Reginer/aosp-android-jar
android-32/src/android/view/FrameMetrics.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/view/FrameMetrics.java
MIT
public long getMetric(@Metric int id) { if (id < UNKNOWN_DELAY_DURATION || id > DEADLINE) { return -1; } if (mTimingData == null) { return -1; } if (id == FIRST_DRAW_FRAME) { return (mTimingData[Index.FLAGS] & FLAG_WINDOW_VISIBILITY_CHANGED) != 0 ? 1 : 0; } else if (id == INTENDED_VSYNC_TIMESTAMP) { return mTimingData[Index.INTENDED_VSYNC]; } else if (id == VSYNC_TIMESTAMP) { return mTimingData[Index.VSYNC]; } int durationsIdx = 2 * id; return mTimingData[DURATIONS[durationsIdx + 1]] - mTimingData[DURATIONS[durationsIdx]]; }
Retrieves the value associated with Metric identifier {@code id} for this frame. <p> Boolean metrics are represented in [0,1], with 0 corresponding to false, and 1 corresponding to true. </p> @param id the metric to retrieve @return the value of the metric or -1 if it is not available.
FrameMetrics::getMetric
java
Reginer/aosp-android-jar
android-32/src/android/view/FrameMetrics.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/view/FrameMetrics.java
MIT
public void onQueryServiceStatus(int[] eventTypes, String callingPackage, RemoteCallback statusCallback) { Slog.d(TAG, "Query event status of " + Arrays.toString(eventTypes) + " for " + callingPackage); synchronized (mLock) { if (!setUpServiceIfNeeded()) { Slog.w(TAG, "Detection service is not available at this moment."); sendStatusCallback(statusCallback, AmbientContextManager.STATUS_SERVICE_UNAVAILABLE); return; } ensureRemoteServiceInitiated(); getRemoteService().queryServiceStatus( eventTypes, callingPackage, getServerStatusCallback( statusCode -> sendStatusCallback(statusCallback, statusCode))); } }
Called when there's an application with the callingPackage name is requesting for the AmbientContextDetection's service status. @param eventTypes the event types to query for @param callingPackage the package query for information @param statusCallback the callback to deliver the status on
getSimpleName::onQueryServiceStatus
java
Reginer/aosp-android-jar
android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
MIT
public void onUnregisterObserver(String callingPackage) { synchronized (mLock) { stopDetection(callingPackage); mMaster.clientRemoved(mUserId, callingPackage); } }
Unregisters the client from all previously registered events by removing from the mExistingRequests map, and unregister events from the service if those events are not requested by other apps.
getSimpleName::onUnregisterObserver
java
Reginer/aosp-android-jar
android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
MIT
public void onStartConsentActivity(int[] eventTypes, String callingPackage) { Slog.d(TAG, "Opening consent activity of " + Arrays.toString(eventTypes) + " for " + callingPackage); // Look up the recent task from the callingPackage ActivityManager.RecentTaskInfo task; ParceledListSlice<ActivityManager.RecentTaskInfo> recentTasks; int userId = getUserId(); try { recentTasks = ActivityTaskManager.getService().getRecentTasks(/*maxNum*/1, /*flags*/ 0, userId); } catch (RemoteException e) { Slog.e(TAG, "Failed to query recent tasks!"); return; } if ((recentTasks == null) || recentTasks.getList().isEmpty()) { Slog.e(TAG, "Recent task list is empty!"); return; } task = recentTasks.getList().get(0); if (!callingPackage.equals(task.topActivityInfo.packageName)) { Slog.e(TAG, "Recent task package name: " + task.topActivityInfo.packageName + " doesn't match with client package name: " + callingPackage); return; } // Start activity as the same task from the callingPackage ComponentName consentComponent = getConsentComponent(); if (consentComponent == null) { Slog.e(TAG, "Consent component not found!"); return; } Slog.d(TAG, "Starting consent activity for " + callingPackage); Intent intent = new Intent(); final long identity = Binder.clearCallingIdentity(); try { Context context = getContext(); String packageNameExtraKey = context.getResources().getString( getAmbientContextPackageNameExtraKeyConfig()); String eventArrayExtraKey = context.getResources().getString( getAmbientContextEventArrayExtraKeyConfig()); // Create consent activity intent with the calling package name and requested events intent.setComponent(consentComponent); if (packageNameExtraKey != null) { intent.putExtra(packageNameExtraKey, callingPackage); } else { Slog.d(TAG, "Missing packageNameExtraKey for consent activity"); } if (eventArrayExtraKey != null) { intent.putExtra(eventArrayExtraKey, eventTypes); } else { Slog.d(TAG, "Missing eventArrayExtraKey for consent activity"); } // Set parent to the calling app's task ActivityOptions options = ActivityOptions.makeBasic(); options.setLaunchTaskId(task.taskId); context.startActivityAsUser(intent, options.toBundle(), context.getUser()); } catch (ActivityNotFoundException e) { Slog.e(TAG, "unable to start consent activity"); } finally { Binder.restoreCallingIdentity(identity); } }
Starts the consent activity for the calling package and event types.
getSimpleName::onStartConsentActivity
java
Reginer/aosp-android-jar
android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
MIT
public void onRegisterObserver(AmbientContextEventRequest request, String packageName, IAmbientContextObserver observer) { synchronized (mLock) { if (!setUpServiceIfNeeded()) { Slog.w(TAG, "Detection service is not available at this moment."); completeRegistration(observer, AmbientContextManager.STATUS_SERVICE_UNAVAILABLE); return; } // Register package and add to existing ClientRequests cache startDetection(request, packageName, observer); mMaster.newClientAdded(mUserId, request, packageName, observer); } }
Handles client registering as an observer. Only one registration is supported per app package. A new registration from the same package will overwrite the previous registration.
getSimpleName::onRegisterObserver
java
Reginer/aosp-android-jar
android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
MIT
protected void dumpLocked(@NonNull String prefix, @NonNull PrintWriter pw) { synchronized (super.mLock) { super.dumpLocked(prefix, pw); } RemoteAmbientDetectionService remoteService = getRemoteService(); if (remoteService != null) { remoteService.dump("", new IndentingPrintWriter(pw, " ")); } }
Dumps the remote service.
getSimpleName::dumpLocked
java
Reginer/aosp-android-jar
android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
MIT
protected void destroyLocked() { Slog.d(TAG, "Trying to cancel the remote request. Reason: Service destroyed."); RemoteAmbientDetectionService remoteService = getRemoteService(); if (remoteService != null) { synchronized (mLock) { remoteService.unbind(); clearRemoteService(); } } }
Destroys this service and unbinds from the remote service.
getSimpleName::destroyLocked
java
Reginer/aosp-android-jar
android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
MIT
protected void startDetection(AmbientContextEventRequest request, String callingPackage, IAmbientContextObserver observer) { Slog.d(TAG, "Requested detection of " + request.getEventTypes()); synchronized (mLock) { if (setUpServiceIfNeeded()) { ensureRemoteServiceInitiated(); RemoteAmbientDetectionService remoteService = getRemoteService(); remoteService.startDetection(request, callingPackage, createDetectionResultRemoteCallback(), getServerStatusCallback( statusCode -> completeRegistration(observer, statusCode))); } else { Slog.w(TAG, "No valid component found for AmbientContextDetectionService"); completeRegistration(observer, AmbientContextManager.STATUS_NOT_SUPPORTED); } } }
Send request to the remote AmbientContextDetectionService impl to start detecting the specified events. Intended for use by shell command for testing. Requires ACCESS_AMBIENT_CONTEXT_EVENT permission.
getSimpleName::startDetection
java
Reginer/aosp-android-jar
android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
MIT
protected void completeRegistration(IAmbientContextObserver observer, int statusCode) { try { observer.onRegistrationComplete(statusCode); } catch (RemoteException e) { Slog.w(TAG, "Failed to call IAmbientContextObserver.onRegistrationComplete: " + e.getMessage()); } }
Notifies the observer the status of the registration. @param observer the observer to notify @param statusCode the status to notify
getSimpleName::completeRegistration
java
Reginer/aosp-android-jar
android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
MIT
protected void sendStatusCallback(RemoteCallback statusCallback, @AmbientContextManager.StatusCode int statusCode) { Bundle bundle = new Bundle(); bundle.putInt( AmbientContextManager.STATUS_RESPONSE_BUNDLE_KEY, statusCode); statusCallback.sendResult(bundle); }
Sends the status on the {@link RemoteCallback}. @param statusCallback the callback to send the status on @param statusCode the status to send
getSimpleName::sendStatusCallback
java
Reginer/aosp-android-jar
android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
MIT
protected void sendDetectionResultIntent(PendingIntent pendingIntent, List<AmbientContextEvent> events) { Intent intent = new Intent(); intent.putExtra(AmbientContextManager.EXTRA_AMBIENT_CONTEXT_EVENTS, new ArrayList(events)); // Explicitly disallow the receiver from starting activities, to prevent apps from utilizing // the PendingIntent as a backdoor to do this. BroadcastOptions options = BroadcastOptions.makeBasic(); options.setPendingIntentBackgroundActivityLaunchAllowed(false); try { pendingIntent.send(getContext(), 0, intent, null, null, null, options.toBundle()); Slog.i(TAG, "Sending PendingIntent to " + pendingIntent.getCreatorPackage() + ": " + events); } catch (PendingIntent.CanceledException e) { Slog.w(TAG, "Couldn't deliver pendingIntent:" + pendingIntent); } }
Sends out the Intent to the client after the event is detected. @param pendingIntent Client's PendingIntent for callback @param events detected events from the detection service
getSimpleName::sendDetectionResultIntent
java
Reginer/aosp-android-jar
android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
MIT
private RemoteCallback getServerStatusCallback(Consumer<Integer> statusConsumer) { return new RemoteCallback(result -> { AmbientContextDetectionServiceStatus serviceStatus = (AmbientContextDetectionServiceStatus) result.get( AmbientContextDetectionServiceStatus.STATUS_RESPONSE_BUNDLE_KEY); final long token = Binder.clearCallingIdentity(); try { int statusCode = serviceStatus.getStatusCode(); statusConsumer.accept(statusCode); Slog.i(TAG, "Got detection status of " + statusCode + " for " + serviceStatus.getPackageName()); } finally { Binder.restoreCallingIdentity(token); } }); }
Returns a RemoteCallback that handles the status from the detection service, and sends results to the client callback.
getSimpleName::getServerStatusCallback
java
Reginer/aosp-android-jar
android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
MIT
private ComponentName getConsentComponent() { Context context = getContext(); String consentComponent = context.getResources().getString(getConsentComponentConfig()); if (TextUtils.isEmpty(consentComponent)) { return null; } Slog.i(TAG, "Consent component name: " + consentComponent); return ComponentName.unflattenFromString(consentComponent); }
Returns the consent activity component from config lookup.
getSimpleName::getConsentComponent
java
Reginer/aosp-android-jar
android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/ambientcontext/AmbientContextManagerPerUserService.java
MIT
public FileReader(String fileName) throws FileNotFoundException { super(new FileInputStream(fileName)); }
Creates a new {@code FileReader}, given the name of the file to read, using the platform's {@linkplain java.nio.charset.Charset#defaultCharset() default charset}. @param fileName the name of the file to read @exception FileNotFoundException if the named file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.
FileReader::FileReader
java
Reginer/aosp-android-jar
android-33/src/java/io/FileReader.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/io/FileReader.java
MIT
public FileReader(File file) throws FileNotFoundException { super(new FileInputStream(file)); }
Creates a new {@code FileReader}, given the {@code File} to read, using the platform's {@linkplain java.nio.charset.Charset#defaultCharset() default charset}. @param file the {@code File} to read @exception FileNotFoundException if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.
FileReader::FileReader
java
Reginer/aosp-android-jar
android-33/src/java/io/FileReader.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/io/FileReader.java
MIT
public FileReader(FileDescriptor fd) { super(new FileInputStream(fd)); }
Creates a new {@code FileReader}, given the {@code FileDescriptor} to read, using the platform's {@linkplain java.nio.charset.Charset#defaultCharset() default charset}. @param fd the {@code FileDescriptor} to read
FileReader::FileReader
java
Reginer/aosp-android-jar
android-33/src/java/io/FileReader.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/io/FileReader.java
MIT
public FileReader(String fileName, Charset charset) throws IOException { super(new FileInputStream(fileName), charset); }
Creates a new {@code FileReader}, given the name of the file to read and the {@linkplain java.nio.charset.Charset charset}. @param fileName the name of the file to read @param charset the {@linkplain java.nio.charset.Charset charset} @exception IOException if the named file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading. @since 11
FileReader::FileReader
java
Reginer/aosp-android-jar
android-33/src/java/io/FileReader.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/io/FileReader.java
MIT
public FileReader(File file, Charset charset) throws IOException { super(new FileInputStream(file), charset); }
Creates a new {@code FileReader}, given the {@code File} to read and the {@linkplain java.nio.charset.Charset charset}. @param file the {@code File} to read @param charset the {@linkplain java.nio.charset.Charset charset} @exception IOException if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading. @since 11
FileReader::FileReader
java
Reginer/aosp-android-jar
android-33/src/java/io/FileReader.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/io/FileReader.java
MIT
public int getPointerId() { return mPointerId; }
Returns the pointer id associated with this event.
VirtualTouchEvent::getPointerId
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public @ToolType int getToolType() { return mToolType; }
Returns the tool type associated with this event.
VirtualTouchEvent::getToolType
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public @Action int getAction() { return mAction; }
Returns the action associated with this event.
VirtualTouchEvent::getAction
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public float getX() { return mX; }
Returns the x-axis location associated with this event.
VirtualTouchEvent::getX
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public float getY() { return mY; }
Returns the y-axis location associated with this event.
VirtualTouchEvent::getY
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public float getPressure() { return mPressure; }
Returns the pressure associated with this event. Returns {@link Float#NaN} if omitted.
VirtualTouchEvent::getPressure
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public float getMajorAxisSize() { return mMajorAxisSize; }
Returns the major axis size associated with this event. Returns {@link Float#NaN} if omitted.
VirtualTouchEvent::getMajorAxisSize
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public long getEventTimeNanos() { return mEventTimeNanos; }
Returns the time this event occurred, in the {@link SystemClock#uptimeMillis()} time base but with nanosecond (instead of millisecond) precision. @see InputEvent#getEventTime()
VirtualTouchEvent::getEventTimeNanos
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public @NonNull VirtualTouchEvent build() { if (mToolType == TOOL_TYPE_UNKNOWN || mPointerId == MotionEvent.INVALID_POINTER_ID || mAction == ACTION_UNKNOWN || Float.isNaN(mX) || Float.isNaN(mY)) { throw new IllegalArgumentException( "Cannot build virtual touch event with unset required fields"); } if ((mToolType == TOOL_TYPE_PALM && mAction != ACTION_CANCEL) || (mAction == ACTION_CANCEL && mToolType != TOOL_TYPE_PALM)) { throw new IllegalArgumentException( "ACTION_CANCEL and TOOL_TYPE_PALM must always appear together"); } return new VirtualTouchEvent(mPointerId, mToolType, mAction, mX, mY, mPressure, mMajorAxisSize, mEventTimeNanos); }
Creates a {@link VirtualTouchEvent} object with the current builder configuration. @throws IllegalArgumentException if one of the required arguments is missing or if ACTION_CANCEL is not set in combination with TOOL_TYPE_PALM. See {@link VirtualTouchEvent} for a detailed explanation.
Builder::build
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public @NonNull Builder setPointerId( @IntRange(from = 0, to = MAX_POINTERS - 1) int pointerId) { if (pointerId < 0 || pointerId > 15) { throw new IllegalArgumentException( "The pointer id must be in the range 0 - " + (MAX_POINTERS - 1) + "inclusive, but was: " + pointerId); } mPointerId = pointerId; return this; }
Sets the pointer id of the event. <p>A Valid pointer id need to be in the range of 0 to 15. @return this builder, to allow for chaining of calls
Builder::setPointerId
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public @NonNull Builder setToolType(@ToolType int toolType) { if (toolType != TOOL_TYPE_FINGER && toolType != TOOL_TYPE_PALM) { throw new IllegalArgumentException("Unsupported touch event tool type"); } mToolType = toolType; return this; }
Sets the tool type of the event. @return this builder, to allow for chaining of calls
Builder::setToolType
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public @NonNull Builder setAction(@Action int action) { if (action != ACTION_DOWN && action != ACTION_UP && action != ACTION_MOVE && action != ACTION_CANCEL) { throw new IllegalArgumentException("Unsupported touch event action type"); } mAction = action; return this; }
Sets the action of the event. @return this builder, to allow for chaining of calls
Builder::setAction
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public @NonNull Builder setX(float absX) { mX = absX; return this; }
Sets the x-axis location of the event. @return this builder, to allow for chaining of calls
Builder::setX
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public @NonNull Builder setY(float absY) { mY = absY; return this; }
Sets the y-axis location of the event. @return this builder, to allow for chaining of calls
Builder::setY
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public @NonNull Builder setPressure(@FloatRange(from = 0f) float pressure) { if (pressure < 0f) { throw new IllegalArgumentException("Touch event pressure cannot be negative"); } mPressure = pressure; return this; }
Sets the pressure of the event. This field is optional and can be omitted. @param pressure The pressure of the touch. Note: The VirtualTouchscreen, consuming VirtualTouchEvents, is configured with a pressure axis range from 0.0 to 255.0. Only the lower end of the range is enforced. You can pass values larger than 255.0. With physical input devices this could happen if the calibration is off. Values larger than 255.0 will not be trimmed and passed on as is. @throws IllegalArgumentException if the pressure is smaller than 0. @return this builder, to allow for chaining of calls
Builder::setPressure
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public @NonNull Builder setMajorAxisSize(@FloatRange(from = 0f) float majorAxisSize) { if (majorAxisSize < 0f) { throw new IllegalArgumentException( "Touch event major axis size cannot be negative"); } mMajorAxisSize = majorAxisSize; return this; }
Sets the major axis size of the event. This field is optional and can be omitted. @return this builder, to allow for chaining of calls
Builder::setMajorAxisSize
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public @NonNull Builder setEventTimeNanos(long eventTimeNanos) { if (eventTimeNanos < 0L) { throw new IllegalArgumentException("Event time cannot be negative"); } mEventTimeNanos = eventTimeNanos; return this; }
Sets the time (in nanoseconds) when this specific event was generated. This may be obtained from {@link SystemClock#uptimeMillis()} (with nanosecond precision instead of millisecond), but can be different depending on the use case. This field is optional and can be omitted. @return this builder, to allow for chaining of calls @see InputEvent#getEventTime()
Builder::setEventTimeNanos
java
Reginer/aosp-android-jar
android-34/src/android/hardware/input/VirtualTouchEvent.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/hardware/input/VirtualTouchEvent.java
MIT
public ApplicationErrorReport() { }
Create an uninitialized instance of {@link ApplicationErrorReport}.
ApplicationErrorReport::ApplicationErrorReport
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
ApplicationErrorReport(Parcel in) { readFromParcel(in); }
Create an instance of {@link ApplicationErrorReport} initialized from a parcel.
ApplicationErrorReport::ApplicationErrorReport
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
static ComponentName getErrorReportReceiver(PackageManager pm, String errorPackage, String receiverPackage) { if (receiverPackage == null || receiverPackage.length() == 0) { return null; } // break the loop if it's the error report receiver package that crashed if (receiverPackage.equals(errorPackage)) { return null; } Intent intent = new Intent(Intent.ACTION_APP_ERROR); intent.setPackage(receiverPackage); ResolveInfo info = pm.resolveActivity(intent, 0); if (info == null || info.activityInfo == null) { return null; } return new ComponentName(receiverPackage, info.activityInfo.name); }
Return activity in receiverPackage that handles ACTION_APP_ERROR. @param pm PackageManager instance @param errorPackage package which caused the error @param receiverPackage candidate package to receive the error @return activity component within receiverPackage which handles ACTION_APP_ERROR, or null if not found
ApplicationErrorReport::getErrorReportReceiver
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public CrashInfo() { }
Create an uninitialized instance of CrashInfo.
CrashInfo::CrashInfo
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public CrashInfo(Throwable tr) { StringWriter sw = new StringWriter(); PrintWriter pw = new FastPrintWriter(sw, false, 256); tr.printStackTrace(pw); pw.flush(); stackTrace = sanitizeString(sw.toString()); exceptionMessage = tr.getMessage(); // Populate fields with the "root cause" exception Throwable rootTr = tr; while (tr.getCause() != null) { tr = tr.getCause(); if (tr.getStackTrace() != null && tr.getStackTrace().length > 0) { rootTr = tr; } String msg = tr.getMessage(); if (msg != null && msg.length() > 0) { exceptionMessage = msg; } } // Populate the currently installed exception handler. Thread.UncaughtExceptionHandler handler = Thread.getDefaultUncaughtExceptionHandler(); if (handler != null) { exceptionHandlerClassName = handler.getClass().getName(); } else { exceptionHandlerClassName = "unknown"; } exceptionClassName = rootTr.getClass().getName(); if (rootTr.getStackTrace().length > 0) { StackTraceElement trace = rootTr.getStackTrace()[0]; throwFileName = trace.getFileName(); throwClassName = trace.getClassName(); throwMethodName = trace.getMethodName(); throwLineNumber = trace.getLineNumber(); } else { throwFileName = "unknown"; throwClassName = "unknown"; throwMethodName = "unknown"; throwLineNumber = 0; } exceptionMessage = sanitizeString(exceptionMessage); }
Create an instance of CrashInfo initialized from an exception.
CrashInfo::CrashInfo
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public void appendStackTrace(String tr) { stackTrace = sanitizeString(stackTrace + tr); }
Create an instance of CrashInfo initialized from an exception. public CrashInfo(Throwable tr) { StringWriter sw = new StringWriter(); PrintWriter pw = new FastPrintWriter(sw, false, 256); tr.printStackTrace(pw); pw.flush(); stackTrace = sanitizeString(sw.toString()); exceptionMessage = tr.getMessage(); // Populate fields with the "root cause" exception Throwable rootTr = tr; while (tr.getCause() != null) { tr = tr.getCause(); if (tr.getStackTrace() != null && tr.getStackTrace().length > 0) { rootTr = tr; } String msg = tr.getMessage(); if (msg != null && msg.length() > 0) { exceptionMessage = msg; } } // Populate the currently installed exception handler. Thread.UncaughtExceptionHandler handler = Thread.getDefaultUncaughtExceptionHandler(); if (handler != null) { exceptionHandlerClassName = handler.getClass().getName(); } else { exceptionHandlerClassName = "unknown"; } exceptionClassName = rootTr.getClass().getName(); if (rootTr.getStackTrace().length > 0) { StackTraceElement trace = rootTr.getStackTrace()[0]; throwFileName = trace.getFileName(); throwClassName = trace.getClassName(); throwMethodName = trace.getMethodName(); throwLineNumber = trace.getLineNumber(); } else { throwFileName = "unknown"; throwClassName = "unknown"; throwMethodName = "unknown"; throwLineNumber = 0; } exceptionMessage = sanitizeString(exceptionMessage); } /** {@hide}
CrashInfo::appendStackTrace
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
private String sanitizeString(String s) { int prefixLength = 10 * 1024; int suffixLength = 10 * 1024; int acceptableLength = prefixLength + suffixLength; if (s != null && s.length() > acceptableLength) { String replacement = "\n[TRUNCATED " + (s.length() - acceptableLength) + " CHARS]\n"; StringBuilder sb = new StringBuilder(acceptableLength + replacement.length()); sb.append(s.substring(0, prefixLength)); sb.append(replacement); sb.append(s.substring(s.length() - suffixLength)); return sb.toString(); } return s; }
Ensure that the string is of reasonable size, truncating from the middle if needed.
CrashInfo::sanitizeString
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public CrashInfo(Parcel in) { exceptionHandlerClassName = in.readString(); exceptionClassName = in.readString(); exceptionMessage = in.readString(); throwFileName = in.readString(); throwClassName = in.readString(); throwMethodName = in.readString(); throwLineNumber = in.readInt(); stackTrace = in.readString(); crashTag = in.readString(); }
Create an instance of CrashInfo initialized from a Parcel.
CrashInfo::CrashInfo
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public void writeToParcel(Parcel dest, int flags) { int start = dest.dataPosition(); dest.writeString(exceptionHandlerClassName); dest.writeString(exceptionClassName); dest.writeString(exceptionMessage); dest.writeString(throwFileName); dest.writeString(throwClassName); dest.writeString(throwMethodName); dest.writeInt(throwLineNumber); dest.writeString(stackTrace); dest.writeString(crashTag); int total = dest.dataPosition()-start; if (Binder.CHECK_PARCEL_SIZE && total > 20*1024) { Slog.d("Error", "ERR: exHandler=" + exceptionHandlerClassName); Slog.d("Error", "ERR: exClass=" + exceptionClassName); Slog.d("Error", "ERR: exMsg=" + exceptionMessage); Slog.d("Error", "ERR: file=" + throwFileName); Slog.d("Error", "ERR: class=" + throwClassName); Slog.d("Error", "ERR: method=" + throwMethodName + " line=" + throwLineNumber); Slog.d("Error", "ERR: stack=" + stackTrace); Slog.d("Error", "ERR: TOTAL BYTES WRITTEN: " + (dest.dataPosition()-start)); } }
Save a CrashInfo instance to a parcel.
CrashInfo::writeToParcel
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public void dump(Printer pw, String prefix) { pw.println(prefix + "exceptionHandlerClassName: " + exceptionHandlerClassName); pw.println(prefix + "exceptionClassName: " + exceptionClassName); pw.println(prefix + "exceptionMessage: " + exceptionMessage); pw.println(prefix + "throwFileName: " + throwFileName); pw.println(prefix + "throwClassName: " + throwClassName); pw.println(prefix + "throwMethodName: " + throwMethodName); pw.println(prefix + "throwLineNumber: " + throwLineNumber); pw.println(prefix + "stackTrace: " + stackTrace); }
Dump a CrashInfo instance to a Printer.
CrashInfo::dump
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public ParcelableCrashInfo() { }
Create an uninitialized instance of CrashInfo.
ParcelableCrashInfo::ParcelableCrashInfo
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public ParcelableCrashInfo(Throwable tr) { super(tr); }
Create an instance of CrashInfo initialized from an exception.
ParcelableCrashInfo::ParcelableCrashInfo
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public AnrInfo() { }
Create an uninitialized instance of AnrInfo.
AnrInfo::AnrInfo
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public AnrInfo(Parcel in) { activity = in.readString(); cause = in.readString(); info = in.readString(); }
Create an instance of AnrInfo initialized from a Parcel.
AnrInfo::AnrInfo
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public void writeToParcel(Parcel dest, int flags) { dest.writeString(activity); dest.writeString(cause); dest.writeString(info); }
Save an AnrInfo instance to a parcel.
AnrInfo::writeToParcel
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public void dump(Printer pw, String prefix) { pw.println(prefix + "activity: " + activity); pw.println(prefix + "cause: " + cause); pw.println(prefix + "info: " + info); }
Dump an AnrInfo instance to a Printer.
AnrInfo::dump
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public BatteryInfo() { }
Create an uninitialized instance of BatteryInfo.
BatteryInfo::BatteryInfo
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public BatteryInfo(Parcel in) { usagePercent = in.readInt(); durationMicros = in.readLong(); usageDetails = in.readString(); checkinDetails = in.readString(); }
Create an instance of BatteryInfo initialized from a Parcel.
BatteryInfo::BatteryInfo
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public void writeToParcel(Parcel dest, int flags) { dest.writeInt(usagePercent); dest.writeLong(durationMicros); dest.writeString(usageDetails); dest.writeString(checkinDetails); }
Save a BatteryInfo instance to a parcel.
BatteryInfo::writeToParcel
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public void dump(Printer pw, String prefix) { pw.println(prefix + "usagePercent: " + usagePercent); pw.println(prefix + "durationMicros: " + durationMicros); pw.println(prefix + "usageDetails: " + usageDetails); pw.println(prefix + "checkinDetails: " + checkinDetails); }
Dump a BatteryInfo instance to a Printer.
BatteryInfo::dump
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public RunningServiceInfo() { }
Create an uninitialized instance of RunningServiceInfo.
RunningServiceInfo::RunningServiceInfo
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public RunningServiceInfo(Parcel in) { durationMillis = in.readLong(); serviceDetails = in.readString(); }
Create an instance of RunningServiceInfo initialized from a Parcel.
RunningServiceInfo::RunningServiceInfo
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public void writeToParcel(Parcel dest, int flags) { dest.writeLong(durationMillis); dest.writeString(serviceDetails); }
Save a RunningServiceInfo instance to a parcel.
RunningServiceInfo::writeToParcel
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public void dump(Printer pw, String prefix) { pw.println(prefix + "durationMillis: " + durationMillis); pw.println(prefix + "serviceDetails: " + serviceDetails); }
Dump a BatteryInfo instance to a Printer.
RunningServiceInfo::dump
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
public void dump(Printer pw, String prefix) { pw.println(prefix + "type: " + type); pw.println(prefix + "packageName: " + packageName); pw.println(prefix + "installerPackageName: " + installerPackageName); pw.println(prefix + "processName: " + processName); pw.println(prefix + "time: " + time); pw.println(prefix + "systemApp: " + systemApp); switch (type) { case TYPE_CRASH: crashInfo.dump(pw, prefix); break; case TYPE_ANR: anrInfo.dump(pw, prefix); break; case TYPE_BATTERY: batteryInfo.dump(pw, prefix); break; case TYPE_RUNNING_SERVICE: runningServiceInfo.dump(pw, prefix); break; } }
Dump the report to a Printer.
RunningServiceInfo::dump
java
Reginer/aosp-android-jar
android-34/src/android/app/ApplicationErrorReport.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/ApplicationErrorReport.java
MIT
static long setmntent(byte[] filename, byte[] type) throws UnixException { NativeBuffer pathBuffer = NativeBuffers.asNativeBuffer(filename); NativeBuffer typeBuffer = NativeBuffers.asNativeBuffer(type); try { return setmntent0(pathBuffer.address(), typeBuffer.address()); } finally { typeBuffer.release(); pathBuffer.release(); } }
FILE *setmntent(const char *filename, const char *type);
LinuxNativeDispatcher::setmntent
java
Reginer/aosp-android-jar
android-35/src/sun/nio/fs/LinuxNativeDispatcher.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/sun/nio/fs/LinuxNativeDispatcher.java
MIT
static int fgetxattr(int filedes, byte[] name, long valueAddress, int valueLen) throws UnixException { NativeBuffer buffer = NativeBuffers.asNativeBuffer(name); try { return fgetxattr0(filedes, buffer.address(), valueAddress, valueLen); } finally { buffer.release(); } }
ssize_t fgetxattr(int filedes, const char *name, void *value, size_t size);
LinuxNativeDispatcher::fgetxattr
java
Reginer/aosp-android-jar
android-35/src/sun/nio/fs/LinuxNativeDispatcher.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/sun/nio/fs/LinuxNativeDispatcher.java
MIT
static void fsetxattr(int filedes, byte[] name, long valueAddress, int valueLen) throws UnixException { NativeBuffer buffer = NativeBuffers.asNativeBuffer(name); try { fsetxattr0(filedes, buffer.address(), valueAddress, valueLen); } finally { buffer.release(); } }
fsetxattr(int filedes, const char *name, const void *value, size_t size, int flags);
LinuxNativeDispatcher::fsetxattr
java
Reginer/aosp-android-jar
android-35/src/sun/nio/fs/LinuxNativeDispatcher.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/sun/nio/fs/LinuxNativeDispatcher.java
MIT
static void fremovexattr(int filedes, byte[] name) throws UnixException { NativeBuffer buffer = NativeBuffers.asNativeBuffer(name); try { fremovexattr0(filedes, buffer.address()); } finally { buffer.release(); } }
fremovexattr(int filedes, const char *name);
LinuxNativeDispatcher::fremovexattr
java
Reginer/aosp-android-jar
android-35/src/sun/nio/fs/LinuxNativeDispatcher.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/sun/nio/fs/LinuxNativeDispatcher.java
MIT
public int getNumDisplays() { return mNumDisplays; }
Returns the number built in displays on the device as defined in the power_profile.xml.
CpuClusterKey::getNumDisplays
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/os/PowerProfile.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/os/PowerProfile.java
MIT
public int getNumElements(String key) { if (sPowerItemMap.containsKey(key)) { return 1; } else if (sPowerArrayMap.containsKey(key)) { return sPowerArrayMap.get(key).length; } return 0; }
Returns the number of memory bandwidth buckets defined in power_profile.xml, or a default value if the subsystem has no recorded value. @return the number of memory bandwidth buckets.
CpuClusterKey::getNumElements
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/os/PowerProfile.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/os/PowerProfile.java
MIT
public double getAveragePowerOrDefault(String type, double defaultValue) { if (sPowerItemMap.containsKey(type)) { return sPowerItemMap.get(type); } else if (sPowerArrayMap.containsKey(type)) { return sPowerArrayMap.get(type)[0]; } else { return defaultValue; } }
Returns the average current in mA consumed by the subsystem, or the given default value if the subsystem has no recorded value. @param type the subsystem type @param defaultValue the value to return if the subsystem has no recorded value. @return the average current in milliAmps.
CpuClusterKey::getAveragePowerOrDefault
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/os/PowerProfile.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/os/PowerProfile.java
MIT
public double getAveragePowerForOrdinal(@PowerGroup String group, int ordinal, double defaultValue) { final String type = getOrdinalPowerType(group, ordinal); return getAveragePowerOrDefault(type, defaultValue); }
Returns the average current in mA consumed by an ordinaled subsystem, or the given default value if the subsystem has no recorded value. @param group the subsystem {@link PowerGroup}. @param ordinal which entity in the {@link PowerGroup}. @param defaultValue the value to return if the subsystem has no recorded value. @return the average current in milliAmps.
CpuClusterKey::getAveragePowerForOrdinal
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/os/PowerProfile.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/os/PowerProfile.java
MIT
public double getAveragePowerForOrdinal(@PowerGroup String group, int ordinal) { return getAveragePowerForOrdinal(group, ordinal, 0); }
Returns the average current in mA consumed by an ordinaled subsystem. @param group the subsystem {@link PowerGroup}. @param ordinal which entity in the {@link PowerGroup}. @return the average current in milliAmps.
CpuClusterKey::getAveragePowerForOrdinal
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/os/PowerProfile.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/os/PowerProfile.java
MIT
public void dumpDebug(ProtoOutputStream proto) { // cpu.suspend writePowerConstantToProto(proto, POWER_CPU_SUSPEND, PowerProfileProto.CPU_SUSPEND); // cpu.idle writePowerConstantToProto(proto, POWER_CPU_IDLE, PowerProfileProto.CPU_IDLE); // cpu.active writePowerConstantToProto(proto, POWER_CPU_ACTIVE, PowerProfileProto.CPU_ACTIVE); // cpu.clusters.cores // cpu.cluster_power.cluster // cpu.core_speeds.cluster // cpu.core_power.cluster for (int cluster = 0; cluster < mCpuClusters.length; cluster++) { final long token = proto.start(PowerProfileProto.CPU_CLUSTER); proto.write(PowerProfileProto.CpuCluster.ID, cluster); proto.write(PowerProfileProto.CpuCluster.CLUSTER_POWER, sPowerItemMap.get(mCpuClusters[cluster].clusterPowerKey)); proto.write(PowerProfileProto.CpuCluster.CORES, mCpuClusters[cluster].numCpus); for (Double speed : sPowerArrayMap.get(mCpuClusters[cluster].freqKey)) { proto.write(PowerProfileProto.CpuCluster.SPEED, speed); } for (Double corePower : sPowerArrayMap.get(mCpuClusters[cluster].corePowerKey)) { proto.write(PowerProfileProto.CpuCluster.CORE_POWER, corePower); } proto.end(token); } // wifi.scan writePowerConstantToProto(proto, POWER_WIFI_SCAN, PowerProfileProto.WIFI_SCAN); // wifi.on writePowerConstantToProto(proto, POWER_WIFI_ON, PowerProfileProto.WIFI_ON); // wifi.active writePowerConstantToProto(proto, POWER_WIFI_ACTIVE, PowerProfileProto.WIFI_ACTIVE); // wifi.controller.idle writePowerConstantToProto(proto, POWER_WIFI_CONTROLLER_IDLE, PowerProfileProto.WIFI_CONTROLLER_IDLE); // wifi.controller.rx writePowerConstantToProto(proto, POWER_WIFI_CONTROLLER_RX, PowerProfileProto.WIFI_CONTROLLER_RX); // wifi.controller.tx writePowerConstantToProto(proto, POWER_WIFI_CONTROLLER_TX, PowerProfileProto.WIFI_CONTROLLER_TX); // wifi.controller.tx_levels writePowerConstantArrayToProto(proto, POWER_WIFI_CONTROLLER_TX_LEVELS, PowerProfileProto.WIFI_CONTROLLER_TX_LEVELS); // wifi.controller.voltage writePowerConstantToProto(proto, POWER_WIFI_CONTROLLER_OPERATING_VOLTAGE, PowerProfileProto.WIFI_CONTROLLER_OPERATING_VOLTAGE); // bluetooth.controller.idle writePowerConstantToProto(proto, POWER_BLUETOOTH_CONTROLLER_IDLE, PowerProfileProto.BLUETOOTH_CONTROLLER_IDLE); // bluetooth.controller.rx writePowerConstantToProto(proto, POWER_BLUETOOTH_CONTROLLER_RX, PowerProfileProto.BLUETOOTH_CONTROLLER_RX); // bluetooth.controller.tx writePowerConstantToProto(proto, POWER_BLUETOOTH_CONTROLLER_TX, PowerProfileProto.BLUETOOTH_CONTROLLER_TX); // bluetooth.controller.voltage writePowerConstantToProto(proto, POWER_BLUETOOTH_CONTROLLER_OPERATING_VOLTAGE, PowerProfileProto.BLUETOOTH_CONTROLLER_OPERATING_VOLTAGE); // modem.controller.sleep writePowerConstantToProto(proto, POWER_MODEM_CONTROLLER_SLEEP, PowerProfileProto.MODEM_CONTROLLER_SLEEP); // modem.controller.idle writePowerConstantToProto(proto, POWER_MODEM_CONTROLLER_IDLE, PowerProfileProto.MODEM_CONTROLLER_IDLE); // modem.controller.rx writePowerConstantToProto(proto, POWER_MODEM_CONTROLLER_RX, PowerProfileProto.MODEM_CONTROLLER_RX); // modem.controller.tx writePowerConstantArrayToProto(proto, POWER_MODEM_CONTROLLER_TX, PowerProfileProto.MODEM_CONTROLLER_TX); // modem.controller.voltage writePowerConstantToProto(proto, POWER_MODEM_CONTROLLER_OPERATING_VOLTAGE, PowerProfileProto.MODEM_CONTROLLER_OPERATING_VOLTAGE); // gps.on writePowerConstantToProto(proto, POWER_GPS_ON, PowerProfileProto.GPS_ON); // gps.signalqualitybased writePowerConstantArrayToProto(proto, POWER_GPS_SIGNAL_QUALITY_BASED, PowerProfileProto.GPS_SIGNAL_QUALITY_BASED); // gps.voltage writePowerConstantToProto(proto, POWER_GPS_OPERATING_VOLTAGE, PowerProfileProto.GPS_OPERATING_VOLTAGE); // bluetooth.on writePowerConstantToProto(proto, POWER_BLUETOOTH_ON, PowerProfileProto.BLUETOOTH_ON); // bluetooth.active writePowerConstantToProto(proto, POWER_BLUETOOTH_ACTIVE, PowerProfileProto.BLUETOOTH_ACTIVE); // bluetooth.at writePowerConstantToProto(proto, POWER_BLUETOOTH_AT_CMD, PowerProfileProto.BLUETOOTH_AT_CMD); // ambient.on writePowerConstantToProto(proto, POWER_AMBIENT_DISPLAY, PowerProfileProto.AMBIENT_DISPLAY); // screen.on writePowerConstantToProto(proto, POWER_SCREEN_ON, PowerProfileProto.SCREEN_ON); // radio.on writePowerConstantToProto(proto, POWER_RADIO_ON, PowerProfileProto.RADIO_ON); // radio.scanning writePowerConstantToProto(proto, POWER_RADIO_SCANNING, PowerProfileProto.RADIO_SCANNING); // radio.active writePowerConstantToProto(proto, POWER_RADIO_ACTIVE, PowerProfileProto.RADIO_ACTIVE); // screen.full writePowerConstantToProto(proto, POWER_SCREEN_FULL, PowerProfileProto.SCREEN_FULL); // audio writePowerConstantToProto(proto, POWER_AUDIO, PowerProfileProto.AUDIO); // video writePowerConstantToProto(proto, POWER_VIDEO, PowerProfileProto.VIDEO); // camera.flashlight writePowerConstantToProto(proto, POWER_FLASHLIGHT, PowerProfileProto.FLASHLIGHT); // memory.bandwidths writePowerConstantToProto(proto, POWER_MEMORY, PowerProfileProto.MEMORY); // camera.avg writePowerConstantToProto(proto, POWER_CAMERA, PowerProfileProto.CAMERA); // wifi.batchedscan writePowerConstantToProto(proto, POWER_WIFI_BATCHED_SCAN, PowerProfileProto.WIFI_BATCHED_SCAN); // battery.capacity writePowerConstantToProto(proto, POWER_BATTERY_CAPACITY, PowerProfileProto.BATTERY_CAPACITY); }
Dump power constants into PowerProfileProto
CpuClusterKey::dumpDebug
java
Reginer/aosp-android-jar
android-32/src/com/android/internal/os/PowerProfile.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/internal/os/PowerProfile.java
MIT
public static void beforeTcpBind(FileDescriptor fdObj, InetAddress address, int port) throws IOException { // Android-removed: Android doesn't support Session Description Protocol (SDP). // provider.implBeforeTcpBind(fdObj, address, port); }
Invoke prior to binding a TCP socket.
NetHooks::beforeTcpBind
java
Reginer/aosp-android-jar
android-35/src/sun/net/NetHooks.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/sun/net/NetHooks.java
MIT
public static void beforeTcpConnect(FileDescriptor fdObj, InetAddress address, int port) throws IOException { // Android-removed: No SDP support // provider.implBeforeTcpConnect(fdObj, address, port); }
Invoke prior to connecting an unbound TCP socket.
NetHooks::beforeTcpConnect
java
Reginer/aosp-android-jar
android-35/src/sun/net/NetHooks.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/sun/net/NetHooks.java
MIT
public CarSetupWizardLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); mPartnerConfigHelper = PartnerConfigHelper.get(context); TypedArray attrArray = context.getTheme().obtainStyledAttributes( attrs, R.styleable.CarSetupWizardLayout, 0, 0); init(attrArray); }
On initialization, the layout gets all of the custom attributes and initializes the custom views that can be set by the user (e.g. back button, continue button).
getSimpleName::CarSetupWizardLayout
java
Reginer/aosp-android-jar
android-32/src/com/android/car/setupwizardlib/CarSetupWizardLayout.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/car/setupwizardlib/CarSetupWizardLayout.java
MIT
private void init(TypedArray attrArray) { boolean showBackButton; boolean showToolbarTitle; String toolbarTitleText; boolean showPrimaryToolbarButton; String primaryToolbarButtonText; boolean primaryToolbarButtonEnabled; boolean showSecondaryToolbarButton; String secondaryToolbarButtonText; boolean secondaryToolbarButtonEnabled; boolean showProgressBar; boolean indeterminateProgressBar; try { showBackButton = attrArray.getBoolean( R.styleable.CarSetupWizardLayout_showBackButton, true); showToolbarTitle = attrArray.getBoolean( R.styleable.CarSetupWizardLayout_showToolbarTitle, false); toolbarTitleText = attrArray.getString( R.styleable.CarSetupWizardLayout_toolbarTitleText); showPrimaryToolbarButton = attrArray.getBoolean( R.styleable.CarSetupWizardLayout_showPrimaryToolbarButton, true); primaryToolbarButtonText = attrArray.getString( R.styleable.CarSetupWizardLayout_primaryToolbarButtonText); primaryToolbarButtonEnabled = attrArray.getBoolean( R.styleable.CarSetupWizardLayout_primaryToolbarButtonEnabled, true); mPrimaryToolbarButtonFlat = attrArray.getBoolean( R.styleable.CarSetupWizardLayout_primaryToolbarButtonFlat, false); showSecondaryToolbarButton = attrArray.getBoolean( R.styleable.CarSetupWizardLayout_showSecondaryToolbarButton, false); secondaryToolbarButtonText = attrArray.getString( R.styleable.CarSetupWizardLayout_secondaryToolbarButtonText); secondaryToolbarButtonEnabled = attrArray.getBoolean( R.styleable.CarSetupWizardLayout_secondaryToolbarButtonEnabled, true); showProgressBar = attrArray.getBoolean( R.styleable.CarSetupWizardLayout_showProgressBar, false); indeterminateProgressBar = attrArray.getBoolean( R.styleable.CarSetupWizardLayout_indeterminateProgressBar, true); } finally { attrArray.recycle(); } LayoutInflater inflater = LayoutInflater.from(getContext()); inflater.inflate(R.layout.car_setup_wizard_layout, this); // Set the back button visibility based on the custom attribute. setBackButton(findViewById(R.id.back_button)); Drawable drawable = mPartnerConfigHelper.getDrawable( getContext(), PartnerConfig.CONFIG_TOOLBAR_BUTTON_ICON_BACK); if (drawable != null) { ((ImageView) mBackButton).setImageDrawable(drawable); } setBackButtonVisible(showBackButton); // Se the title bar. setTitleBar(findViewById(R.id.application_bar)); int toolbarBgColor = mPartnerConfigHelper.getColor(getContext(), PartnerConfig.CONFIG_TOOLBAR_BG_COLOR); if (toolbarBgColor != 0) { mTitleBar.setBackgroundColor(toolbarBgColor); } // Set the toolbar title visibility and text based on the custom attributes. setToolbarTitle(findViewById(R.id.toolbar_title)); if (showToolbarTitle) { setToolbarTitleText(toolbarTitleText); } else { setToolbarTitleVisible(false); } // Set the primary continue button visibility and text based on the custom attributes. ViewStub primaryToolbarButtonStub = (ViewStub) findViewById(R.id.primary_toolbar_button_stub); // Set the button layout to flat if that attribute was set. if (mPrimaryToolbarButtonFlat) { primaryToolbarButtonStub.setLayoutResource(R.layout.flat_button); } primaryToolbarButtonStub.inflate(); setPrimaryToolbarButton(findViewById(R.id.primary_toolbar_button)); if (showPrimaryToolbarButton) { setPrimaryToolbarButtonText(primaryToolbarButtonText); setPrimaryToolbarButtonEnabled(primaryToolbarButtonEnabled); setBackground( mPrimaryToolbarButton, PartnerConfig.CONFIG_TOOLBAR_PRIMARY_BUTTON_BG, PartnerConfig.CONFIG_TOOLBAR_PRIMARY_BUTTON_BG_COLOR); setButtonPadding(mPrimaryToolbarButton); setButtonTypeFace(mPrimaryToolbarButton); setButtonTextSize(mPrimaryToolbarButton); setButtonTextColor( mPrimaryToolbarButton, PartnerConfig.CONFIG_TOOLBAR_PRIMARY_BUTTON_TEXT_COLOR); } else { setPrimaryToolbarButtonVisible(false); } // Set the secondary continue button visibility and text based on the custom attributes. ViewStub secondaryToolbarButtonStub = (ViewStub) findViewById(R.id.secondary_toolbar_button_stub); if (showSecondaryToolbarButton || !TextUtils.isEmpty(secondaryToolbarButtonText)) { secondaryToolbarButtonStub.inflate(); mSecondaryToolbarButton = findViewById(R.id.secondary_toolbar_button); setSecondaryToolbarButtonText(secondaryToolbarButtonText); setSecondaryToolbarButtonEnabled(secondaryToolbarButtonEnabled); setSecondaryToolbarButtonVisible(showSecondaryToolbarButton); } mProgressBar = findViewById(R.id.progress_bar); setProgressBarVisible(showProgressBar); setProgressBarIndeterminate(indeterminateProgressBar); // Set orientation programmatically since the inflated layout uses <merge> setOrientation(LinearLayout.VERTICAL); }
Inflates the layout and sets the custom views (e.g. back button, continue button).
getSimpleName::init
java
Reginer/aosp-android-jar
android-32/src/com/android/car/setupwizardlib/CarSetupWizardLayout.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/car/setupwizardlib/CarSetupWizardLayout.java
MIT
static Animation createNoopAnimation(@NonNull RemoteAnimationTarget target) { // Noop but just keep the target showing/hiding. final float alpha = target.mode == MODE_CLOSING ? 0f : 1f; return new AlphaAnimation(alpha, alpha); }
/* Copyright (C) 2021 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. package androidx.window.extensions.embedding; import static android.view.RemoteAnimationTarget.MODE_CLOSING; import android.app.ActivityThread; import android.content.ContentResolver; import android.content.Context; import android.database.ContentObserver; import android.graphics.Rect; import android.os.Handler; import android.provider.Settings; import android.view.RemoteAnimationTarget; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.view.animation.ClipRectAnimation; import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; import android.view.animation.ScaleAnimation; import android.view.animation.TranslateAnimation; import androidx.annotation.NonNull; import com.android.internal.R; import com.android.internal.policy.AttributeCache; import com.android.internal.policy.TransitionAnimation; /** Animation spec for TaskFragment transition. // TODO(b/206557124): provide an easier way to customize animation class TaskFragmentAnimationSpec { private static final String TAG = "TaskFragAnimationSpec"; private static final int CHANGE_ANIMATION_DURATION = 517; private static final int CHANGE_ANIMATION_FADE_DURATION = 80; private static final int CHANGE_ANIMATION_FADE_OFFSET = 30; private final Context mContext; private final TransitionAnimation mTransitionAnimation; private final Interpolator mFastOutExtraSlowInInterpolator; private final LinearInterpolator mLinearInterpolator; private float mTransitionAnimationScaleSetting; TaskFragmentAnimationSpec(@NonNull Handler handler) { mContext = ActivityThread.currentActivityThread().getApplication(); mTransitionAnimation = new TransitionAnimation(mContext, false /* debug */, TAG); // Initialize the AttributeCache for the TransitionAnimation. AttributeCache.init(mContext); mFastOutExtraSlowInInterpolator = AnimationUtils.loadInterpolator( mContext, android.R.interpolator.fast_out_extra_slow_in); mLinearInterpolator = new LinearInterpolator(); // The transition animation should be adjusted based on the developer option. final ContentResolver resolver = mContext.getContentResolver(); mTransitionAnimationScaleSetting = Settings.Global.getFloat(resolver, Settings.Global.TRANSITION_ANIMATION_SCALE, mContext.getResources().getFloat( R.dimen.config_appTransitionAnimationDurationScaleDefault)); resolver.registerContentObserver( Settings.Global.getUriFor(Settings.Global.TRANSITION_ANIMATION_SCALE), false, new SettingsObserver(handler)); } /** For target that doesn't need to be animated.
TaskFragmentAnimationSpec::createNoopAnimation
java
Reginer/aosp-android-jar
android-32/src/androidx/window/extensions/embedding/TaskFragmentAnimationSpec.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/androidx/window/extensions/embedding/TaskFragmentAnimationSpec.java
MIT
Animation createChangeBoundsOpenAnimation(@NonNull RemoteAnimationTarget target) { final Rect bounds = target.localBounds; // The target will be animated in from left or right depends on its position. final int startLeft = bounds.left == 0 ? -bounds.width() : bounds.width(); // The position should be 0-based as we will post translate in // TaskFragmentAnimationAdapter#onAnimationUpdate final Animation animation = new TranslateAnimation(startLeft, 0, 0, 0); animation.setInterpolator(mFastOutExtraSlowInInterpolator); animation.setDuration(CHANGE_ANIMATION_DURATION); animation.initialize(bounds.width(), bounds.height(), bounds.width(), bounds.height()); animation.scaleCurrentDuration(mTransitionAnimationScaleSetting); return animation; }
/* Copyright (C) 2021 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. package androidx.window.extensions.embedding; import static android.view.RemoteAnimationTarget.MODE_CLOSING; import android.app.ActivityThread; import android.content.ContentResolver; import android.content.Context; import android.database.ContentObserver; import android.graphics.Rect; import android.os.Handler; import android.provider.Settings; import android.view.RemoteAnimationTarget; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.view.animation.ClipRectAnimation; import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; import android.view.animation.ScaleAnimation; import android.view.animation.TranslateAnimation; import androidx.annotation.NonNull; import com.android.internal.R; import com.android.internal.policy.AttributeCache; import com.android.internal.policy.TransitionAnimation; /** Animation spec for TaskFragment transition. // TODO(b/206557124): provide an easier way to customize animation class TaskFragmentAnimationSpec { private static final String TAG = "TaskFragAnimationSpec"; private static final int CHANGE_ANIMATION_DURATION = 517; private static final int CHANGE_ANIMATION_FADE_DURATION = 80; private static final int CHANGE_ANIMATION_FADE_OFFSET = 30; private final Context mContext; private final TransitionAnimation mTransitionAnimation; private final Interpolator mFastOutExtraSlowInInterpolator; private final LinearInterpolator mLinearInterpolator; private float mTransitionAnimationScaleSetting; TaskFragmentAnimationSpec(@NonNull Handler handler) { mContext = ActivityThread.currentActivityThread().getApplication(); mTransitionAnimation = new TransitionAnimation(mContext, false /* debug */, TAG); // Initialize the AttributeCache for the TransitionAnimation. AttributeCache.init(mContext); mFastOutExtraSlowInInterpolator = AnimationUtils.loadInterpolator( mContext, android.R.interpolator.fast_out_extra_slow_in); mLinearInterpolator = new LinearInterpolator(); // The transition animation should be adjusted based on the developer option. final ContentResolver resolver = mContext.getContentResolver(); mTransitionAnimationScaleSetting = Settings.Global.getFloat(resolver, Settings.Global.TRANSITION_ANIMATION_SCALE, mContext.getResources().getFloat( R.dimen.config_appTransitionAnimationDurationScaleDefault)); resolver.registerContentObserver( Settings.Global.getUriFor(Settings.Global.TRANSITION_ANIMATION_SCALE), false, new SettingsObserver(handler)); } /** For target that doesn't need to be animated. static Animation createNoopAnimation(@NonNull RemoteAnimationTarget target) { // Noop but just keep the target showing/hiding. final float alpha = target.mode == MODE_CLOSING ? 0f : 1f; return new AlphaAnimation(alpha, alpha); } /** Animation for target that is opening in a change transition.
TaskFragmentAnimationSpec::createChangeBoundsOpenAnimation
java
Reginer/aosp-android-jar
android-32/src/androidx/window/extensions/embedding/TaskFragmentAnimationSpec.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/androidx/window/extensions/embedding/TaskFragmentAnimationSpec.java
MIT
Animation createChangeBoundsCloseAnimation(@NonNull RemoteAnimationTarget target) { final Rect bounds = target.localBounds; // The target will be animated out to left or right depends on its position. final int endLeft = bounds.left == 0 ? -bounds.width() : bounds.width(); // The position should be 0-based as we will post translate in // TaskFragmentAnimationAdapter#onAnimationUpdate final Animation animation = new TranslateAnimation(0, endLeft, 0, 0); animation.setInterpolator(mFastOutExtraSlowInInterpolator); animation.setDuration(CHANGE_ANIMATION_DURATION); animation.initialize(bounds.width(), bounds.height(), bounds.width(), bounds.height()); animation.scaleCurrentDuration(mTransitionAnimationScaleSetting); return animation; }
/* Copyright (C) 2021 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. package androidx.window.extensions.embedding; import static android.view.RemoteAnimationTarget.MODE_CLOSING; import android.app.ActivityThread; import android.content.ContentResolver; import android.content.Context; import android.database.ContentObserver; import android.graphics.Rect; import android.os.Handler; import android.provider.Settings; import android.view.RemoteAnimationTarget; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.view.animation.ClipRectAnimation; import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; import android.view.animation.ScaleAnimation; import android.view.animation.TranslateAnimation; import androidx.annotation.NonNull; import com.android.internal.R; import com.android.internal.policy.AttributeCache; import com.android.internal.policy.TransitionAnimation; /** Animation spec for TaskFragment transition. // TODO(b/206557124): provide an easier way to customize animation class TaskFragmentAnimationSpec { private static final String TAG = "TaskFragAnimationSpec"; private static final int CHANGE_ANIMATION_DURATION = 517; private static final int CHANGE_ANIMATION_FADE_DURATION = 80; private static final int CHANGE_ANIMATION_FADE_OFFSET = 30; private final Context mContext; private final TransitionAnimation mTransitionAnimation; private final Interpolator mFastOutExtraSlowInInterpolator; private final LinearInterpolator mLinearInterpolator; private float mTransitionAnimationScaleSetting; TaskFragmentAnimationSpec(@NonNull Handler handler) { mContext = ActivityThread.currentActivityThread().getApplication(); mTransitionAnimation = new TransitionAnimation(mContext, false /* debug */, TAG); // Initialize the AttributeCache for the TransitionAnimation. AttributeCache.init(mContext); mFastOutExtraSlowInInterpolator = AnimationUtils.loadInterpolator( mContext, android.R.interpolator.fast_out_extra_slow_in); mLinearInterpolator = new LinearInterpolator(); // The transition animation should be adjusted based on the developer option. final ContentResolver resolver = mContext.getContentResolver(); mTransitionAnimationScaleSetting = Settings.Global.getFloat(resolver, Settings.Global.TRANSITION_ANIMATION_SCALE, mContext.getResources().getFloat( R.dimen.config_appTransitionAnimationDurationScaleDefault)); resolver.registerContentObserver( Settings.Global.getUriFor(Settings.Global.TRANSITION_ANIMATION_SCALE), false, new SettingsObserver(handler)); } /** For target that doesn't need to be animated. static Animation createNoopAnimation(@NonNull RemoteAnimationTarget target) { // Noop but just keep the target showing/hiding. final float alpha = target.mode == MODE_CLOSING ? 0f : 1f; return new AlphaAnimation(alpha, alpha); } /** Animation for target that is opening in a change transition. Animation createChangeBoundsOpenAnimation(@NonNull RemoteAnimationTarget target) { final Rect bounds = target.localBounds; // The target will be animated in from left or right depends on its position. final int startLeft = bounds.left == 0 ? -bounds.width() : bounds.width(); // The position should be 0-based as we will post translate in // TaskFragmentAnimationAdapter#onAnimationUpdate final Animation animation = new TranslateAnimation(startLeft, 0, 0, 0); animation.setInterpolator(mFastOutExtraSlowInInterpolator); animation.setDuration(CHANGE_ANIMATION_DURATION); animation.initialize(bounds.width(), bounds.height(), bounds.width(), bounds.height()); animation.scaleCurrentDuration(mTransitionAnimationScaleSetting); return animation; } /** Animation for target that is closing in a change transition.
TaskFragmentAnimationSpec::createChangeBoundsCloseAnimation
java
Reginer/aosp-android-jar
android-32/src/androidx/window/extensions/embedding/TaskFragmentAnimationSpec.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/androidx/window/extensions/embedding/TaskFragmentAnimationSpec.java
MIT
Animation[] createChangeBoundsChangeAnimations(@NonNull RemoteAnimationTarget target) { // Both start bounds and end bounds are in screen coordinates. We will post translate // to the local coordinates in TaskFragmentAnimationAdapter#onAnimationUpdate final Rect startBounds = target.startBounds; final Rect parentBounds = target.taskInfo.configuration.windowConfiguration.getBounds(); final Rect endBounds = target.screenSpaceBounds; float scaleX = ((float) startBounds.width()) / endBounds.width(); float scaleY = ((float) startBounds.height()) / endBounds.height(); // Start leash is a child of the end leash. Reverse the scale so that the start leash won't // be scaled up with its parent. float startScaleX = 1.f / scaleX; float startScaleY = 1.f / scaleY; // The start leash will be fade out. final AnimationSet startSet = new AnimationSet(false /* shareInterpolator */); final Animation startAlpha = new AlphaAnimation(1f, 0f); startAlpha.setInterpolator(mLinearInterpolator); startAlpha.setDuration(CHANGE_ANIMATION_FADE_DURATION); startAlpha.setStartOffset(CHANGE_ANIMATION_FADE_OFFSET); startSet.addAnimation(startAlpha); final Animation startScale = new ScaleAnimation(startScaleX, startScaleX, startScaleY, startScaleY); startScale.setInterpolator(mFastOutExtraSlowInInterpolator); startScale.setDuration(CHANGE_ANIMATION_DURATION); startSet.addAnimation(startScale); startSet.initialize(startBounds.width(), startBounds.height(), endBounds.width(), endBounds.height()); startSet.scaleCurrentDuration(mTransitionAnimationScaleSetting); // The end leash will be moved into the end position while scaling. final AnimationSet endSet = new AnimationSet(true /* shareInterpolator */); endSet.setInterpolator(mFastOutExtraSlowInInterpolator); final Animation endScale = new ScaleAnimation(scaleX, 1, scaleY, 1); endScale.setDuration(CHANGE_ANIMATION_DURATION); endSet.addAnimation(endScale); // The position should be 0-based as we will post translate in // TaskFragmentAnimationAdapter#onAnimationUpdate final Animation endTranslate = new TranslateAnimation(startBounds.left - endBounds.left, 0, 0, 0); endTranslate.setDuration(CHANGE_ANIMATION_DURATION); endSet.addAnimation(endTranslate); // The end leash is resizing, we should update the window crop based on the clip rect. final Rect startClip = new Rect(startBounds); final Rect endClip = new Rect(endBounds); startClip.offsetTo(0, 0); endClip.offsetTo(0, 0); final Animation clipAnim = new ClipRectAnimation(startClip, endClip); clipAnim.setDuration(CHANGE_ANIMATION_DURATION); endSet.addAnimation(clipAnim); endSet.initialize(startBounds.width(), startBounds.height(), parentBounds.width(), parentBounds.height()); endSet.scaleCurrentDuration(mTransitionAnimationScaleSetting); return new Animation[]{startSet, endSet}; }
Animation for target that is changing (bounds change) in a change transition. @return the return array always has two elements. The first one is for the start leash, and the second one is for the end leash.
TaskFragmentAnimationSpec::createChangeBoundsChangeAnimations
java
Reginer/aosp-android-jar
android-32/src/androidx/window/extensions/embedding/TaskFragmentAnimationSpec.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/androidx/window/extensions/embedding/TaskFragmentAnimationSpec.java
MIT
public void setMessageId(byte[] value) { mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID); }
Set Message-ID value. @param value the value @throws NullPointerException if the value is null.
SendConf::setMessageId
java
Reginer/aosp-android-jar
android-34/src/com/google/android/mms/pdu/SendConf.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/google/android/mms/pdu/SendConf.java
MIT
public void setResponseStatus(int value) throws InvalidHeaderValueException { mPduHeaders.setOctet(value, PduHeaders.RESPONSE_STATUS); }
Set X-Mms-Response-Status. @param value the values @throws InvalidHeaderValueException if the value is invalid.
SendConf::setResponseStatus
java
Reginer/aosp-android-jar
android-34/src/com/google/android/mms/pdu/SendConf.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/google/android/mms/pdu/SendConf.java
MIT
public void setTransactionId(byte[] value) { mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID); }
Set X-Mms-Transaction-Id field value. @param value the value @throws NullPointerException if the value is null.
SendConf::setTransactionId
java
Reginer/aosp-android-jar
android-34/src/com/google/android/mms/pdu/SendConf.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/google/android/mms/pdu/SendConf.java
MIT
public AccessControlException(String s) { super(s); }
Constructs an {@code AccessControlException} with the specified, detailed message. @param s the detail message.
AccessControlException::AccessControlException
java
Reginer/aosp-android-jar
android-34/src/java/security/AccessControlException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/security/AccessControlException.java
MIT
public AccessControlException(String s, Permission p) { super(s); perm = p; }
Constructs an {@code AccessControlException} with the specified, detailed message, and the requested permission that caused the exception. @param s the detail message. @param p the permission that caused the exception.
AccessControlException::AccessControlException
java
Reginer/aosp-android-jar
android-34/src/java/security/AccessControlException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/security/AccessControlException.java
MIT
public Permission getPermission() { return perm; }
Gets the Permission object associated with this exception, or null if there was no corresponding Permission object. @return the Permission object.
AccessControlException::getPermission
java
Reginer/aosp-android-jar
android-34/src/java/security/AccessControlException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/java/security/AccessControlException.java
MIT
private ThaiBuddhistChronology() { }
Restricted constructor.
ThaiBuddhistChronology::ThaiBuddhistChronology
java
Reginer/aosp-android-jar
android-33/src/java/time/chrono/ThaiBuddhistChronology.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/time/chrono/ThaiBuddhistChronology.java
MIT
private void readObject(ObjectInputStream s) throws InvalidObjectException { throw new InvalidObjectException("Deserialization via serialization delegate"); }
Defend against malicious streams. @param s the stream to read @throws InvalidObjectException always
ThaiBuddhistChronology::readObject
java
Reginer/aosp-android-jar
android-33/src/java/time/chrono/ThaiBuddhistChronology.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/time/chrono/ThaiBuddhistChronology.java
MIT
public void updateFromPackageInfo(@NonNull PackageInfo pi) { if (pi != null) { mVersionCode = pi.getLongVersionCode(); mLastUpdateTime = pi.lastUpdateTime; mBackupAllowed = ShortcutService.shouldBackupApp(pi); mBackupAllowedInitialized = true; } }
Set {@link #mVersionCode}, {@link #mLastUpdateTime} and {@link #mBackupAllowed} from a {@link PackageInfo}.
ShortcutPackageInfo::updateFromPackageInfo
java
Reginer/aosp-android-jar
android-33/src/com/android/server/pm/ShortcutPackageInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/pm/ShortcutPackageInfo.java
MIT
public int getRequestId() { return mRequestId; }
Return the request ID for the submitted capture request/burst. This is used to track the completion status of the requested captures, and to cancel repeating requests.
SubmitInfo::getRequestId
java
Reginer/aosp-android-jar
android-31/src/android/hardware/camera2/utils/SubmitInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/camera2/utils/SubmitInfo.java
MIT
public long getLastFrameNumber() { return mLastFrameNumber; }
Return the last frame number for the submitted capture request/burst. For a repeating request, this is the last frame number of the _prior_ repeating request, to indicate when to fire the sequence completion callback for the prior repeating request. For a single-shot capture, this is the last frame number of _this_ burst, to indicate when to fire the sequence completion callback for the request itself. For a repeating request, may be NO_IN_FLIGHT_REPEATING_FRAMES, if no instances of a prior repeating request were actually issued to the camera device.
SubmitInfo::getLastFrameNumber
java
Reginer/aosp-android-jar
android-31/src/android/hardware/camera2/utils/SubmitInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/hardware/camera2/utils/SubmitInfo.java
MIT
public prefix09(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { org.w3c.domts.DocumentBuilderSetting[] settings = new org.w3c.domts.DocumentBuilderSetting[] { org.w3c.domts.DocumentBuilderSetting.namespaceAware }; DOMTestDocumentBuilderFactory testFactory = factory.newInstance(settings); setFactory(testFactory); // // check if loaded documents are supported for content type // String contentType = getContentType(); preload(contentType, "staffNS", true); }
Constructor. @param factory document factory, may not be null @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
prefix09::prefix09
java
Reginer/aosp-android-jar
android-31/src/org/w3c/domts/level2/core/prefix09.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level2/core/prefix09.java
MIT
public void runTest() throws Throwable { Document doc; NodeList elementList; Element addrNode; Attr addrAttr; doc = (Document) load("staffNS", true); elementList = doc.getElementsByTagName("address"); addrNode = (Element) elementList.item(3); addrAttr = addrNode.getAttributeNode("xmlns"); { boolean success = false; try { addrAttr.setPrefix("xxx"); } catch (DOMException ex) { success = (ex.code == DOMException.NAMESPACE_ERR); } assertTrue("throw_NAMESPACE_ERR", success); } }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
prefix09::runTest
java
Reginer/aosp-android-jar
android-31/src/org/w3c/domts/level2/core/prefix09.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level2/core/prefix09.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix09"; }
Gets URI that identifies the test. @return uri identifier of test
prefix09::getTargetURI
java
Reginer/aosp-android-jar
android-31/src/org/w3c/domts/level2/core/prefix09.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level2/core/prefix09.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(prefix09.class, args); }
Runs this test from the command line. @param args command line arguments
prefix09::main
java
Reginer/aosp-android-jar
android-31/src/org/w3c/domts/level2/core/prefix09.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level2/core/prefix09.java
MIT
public void begin() { synchronized (mLock) { final long currentVsync = mChoreographer.getVsyncId(); // In normal case, we should begin at the next frame, // the id of the next frame is not simply increased by 1, // but we can exclude the current frame at least. mBeginVsyncId = mDeferMonitoring ? currentVsync + 1 : currentVsync; if (DEBUG) { Log.d(TAG, "begin: " + mSession.getName() + ", begin=" + mBeginVsyncId + ", defer=" + mDeferMonitoring); } if (mSurfaceControl != null) { if (mDeferMonitoring) { markEvent("FT#deferMonitoring"); // Normal case, we begin the instrument from the very beginning, // will exclude the first frame. postTraceStartMarker(); } else { // If we don't begin the instrument from the very beginning, // there is no need to skip the frame where the begin invocation happens. beginInternal(); } mSurfaceControlWrapper.addJankStatsListener(this, mSurfaceControl); } if (!mSurfaceOnly) { mRendererWrapper.addObserver(mObserver); } } }
Begin a trace session of the CUJ.
JankInfo::begin
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 boolean end(@Reasons int reason) { synchronized (mLock) { if (mCancelled || mEndVsyncId != INVALID_ID) return false; mEndVsyncId = mChoreographer.getVsyncId(); // Cancel the session if: // 1. The session begins and ends at the same vsync id. // 2. The session never begun. if (mBeginVsyncId == INVALID_ID) { return cancel(REASON_CANCEL_NOT_BEGUN); } else if (mEndVsyncId <= mBeginVsyncId) { return cancel(REASON_CANCEL_SAME_VSYNC); } else { if (DEBUG) { Log.d(TAG, "end: " + mSession.getName() + ", end=" + mEndVsyncId + ", reason=" + reason); } markEvent("FT#end#" + reason); Trace.endAsyncSection(mSession.getName(), (int) mBeginVsyncId); mSession.setReason(reason); // We don't remove observer here, // will remove it when all the frame metrics in this duration are called back. // See onFrameMetricsAvailable for the logic of removing the observer. // Waiting at most 10 seconds for all callbacks to finish. mWaitForFinishTimedOut = () -> { Log.e(TAG, "force finish cuj because of time out:" + mSession.getName()); finish(); }; mHandler.postDelayed(mWaitForFinishTimedOut, TimeUnit.SECONDS.toMillis(10)); notifyCujEvent(ACTION_SESSION_END); return true; } } }
End the trace session of the CUJ.
JankInfo::end
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