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 |
---|---|---|---|---|---|---|---|
void dispatchPendingTransactions() {
if (!Flags.bundleClientTransactionFlag() || mPendingTransactions.isEmpty()) {
return;
}
Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "clientTransactionsDispatched");
final int size = mPendingTransactions.size();
for (int i = 0; i < size; i++) {
final ClientTransaction transaction = mPendingTransactions.valueAt(i);
try {
scheduleTransaction(transaction);
} catch (RemoteException e) {
Slog.e(TAG, "Failed to deliver pending transaction", e);
// TODO(b/323801078): apply cleanup for individual transaction item if needed.
}
}
mPendingTransactions.clear();
Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
} |
Schedules a single transaction item with a lifecycle request, delivery to client application.
@param shouldDispatchImmediately whether or not to dispatch the transaction immediately. This
should only be {@code true} when it is important to know the
result of dispatching immediately. For example, when cold
launches an app, the server needs to know if the transaction
is dispatched successfully, and may restart the process if
not.
@throws RemoteException
@see ClientTransactionItem
void scheduleTransactionAndLifecycleItems(@NonNull IApplicationThread client,
@NonNull ClientTransactionItem transactionItem,
@NonNull ActivityLifecycleItem lifecycleItem,
boolean shouldDispatchImmediately) throws RemoteException {
// The behavior is different depending on the flag.
// When flag is on, we wait until RootWindowContainer#performSurfacePlacementNoTrace to
// dispatch all pending transactions at once.
if (Flags.bundleClientTransactionFlag()) {
final ClientTransaction clientTransaction = getOrCreatePendingTransaction(client);
clientTransaction.addTransactionItem(transactionItem);
clientTransaction.addTransactionItem(lifecycleItem);
onClientTransactionItemScheduled(clientTransaction, shouldDispatchImmediately);
} else {
// TODO(b/260873529): cleanup after launch.
final ClientTransaction clientTransaction = ClientTransaction.obtain(client);
clientTransaction.addTransactionItem(transactionItem);
clientTransaction.addTransactionItem(lifecycleItem);
scheduleTransaction(clientTransaction);
}
}
/** Executes all the pending transactions. | ClientLifecycleManager::dispatchPendingTransactions | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/ClientLifecycleManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/ClientLifecycleManager.java | MIT |
void dispatchPendingTransaction(@NonNull IApplicationThread client) {
if (!Flags.bundleClientTransactionFlag()) {
return;
}
final ClientTransaction pendingTransaction = mPendingTransactions.remove(client.asBinder());
if (pendingTransaction != null) {
try {
scheduleTransaction(pendingTransaction);
} catch (RemoteException e) {
Slog.e(TAG, "Failed to deliver pending transaction", e);
// TODO(b/323801078): apply cleanup for individual transaction item if needed.
}
}
} |
Schedules a single transaction item with a lifecycle request, delivery to client application.
@param shouldDispatchImmediately whether or not to dispatch the transaction immediately. This
should only be {@code true} when it is important to know the
result of dispatching immediately. For example, when cold
launches an app, the server needs to know if the transaction
is dispatched successfully, and may restart the process if
not.
@throws RemoteException
@see ClientTransactionItem
void scheduleTransactionAndLifecycleItems(@NonNull IApplicationThread client,
@NonNull ClientTransactionItem transactionItem,
@NonNull ActivityLifecycleItem lifecycleItem,
boolean shouldDispatchImmediately) throws RemoteException {
// The behavior is different depending on the flag.
// When flag is on, we wait until RootWindowContainer#performSurfacePlacementNoTrace to
// dispatch all pending transactions at once.
if (Flags.bundleClientTransactionFlag()) {
final ClientTransaction clientTransaction = getOrCreatePendingTransaction(client);
clientTransaction.addTransactionItem(transactionItem);
clientTransaction.addTransactionItem(lifecycleItem);
onClientTransactionItemScheduled(clientTransaction, shouldDispatchImmediately);
} else {
// TODO(b/260873529): cleanup after launch.
final ClientTransaction clientTransaction = ClientTransaction.obtain(client);
clientTransaction.addTransactionItem(transactionItem);
clientTransaction.addTransactionItem(lifecycleItem);
scheduleTransaction(clientTransaction);
}
}
/** Executes all the pending transactions.
void dispatchPendingTransactions() {
if (!Flags.bundleClientTransactionFlag() || mPendingTransactions.isEmpty()) {
return;
}
Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "clientTransactionsDispatched");
final int size = mPendingTransactions.size();
for (int i = 0; i < size; i++) {
final ClientTransaction transaction = mPendingTransactions.valueAt(i);
try {
scheduleTransaction(transaction);
} catch (RemoteException e) {
Slog.e(TAG, "Failed to deliver pending transaction", e);
// TODO(b/323801078): apply cleanup for individual transaction item if needed.
}
}
mPendingTransactions.clear();
Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
}
/** Executes the pending transaction for the given client process. | ClientLifecycleManager::dispatchPendingTransaction | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/ClientLifecycleManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/ClientLifecycleManager.java | MIT |
void onLayoutContinued() {
if (shouldDispatchPendingTransactionsImmediately()) {
// Dispatch the pending transactions immediately if there is no ongoing/scheduled layout
dispatchPendingTransactions();
}
} |
Called to when {@link WindowSurfacePlacer#continueLayout}.
Dispatches all pending transactions unless there is an ongoing/scheduled layout, in which
case the pending transactions will be dispatched in
{@link RootWindowContainer#performSurfacePlacementNoTrace}.
| ClientLifecycleManager::onLayoutContinued | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/ClientLifecycleManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/ClientLifecycleManager.java | MIT |
private void onClientTransactionItemScheduled(
@NonNull ClientTransaction clientTransaction,
boolean shouldDispatchImmediately) throws RemoteException {
if (shouldDispatchImmediately || shouldDispatchPendingTransactionsImmediately()) {
// Dispatch the pending transaction immediately.
mPendingTransactions.remove(clientTransaction.getClient().asBinder());
scheduleTransaction(clientTransaction);
}
} |
Called to when {@link WindowSurfacePlacer#continueLayout}.
Dispatches all pending transactions unless there is an ongoing/scheduled layout, in which
case the pending transactions will be dispatched in
{@link RootWindowContainer#performSurfacePlacementNoTrace}.
void onLayoutContinued() {
if (shouldDispatchPendingTransactionsImmediately()) {
// Dispatch the pending transactions immediately if there is no ongoing/scheduled layout
dispatchPendingTransactions();
}
}
/** Must only be called with WM lock.
@NonNull
private ClientTransaction getOrCreatePendingTransaction(@NonNull IApplicationThread client) {
final IBinder clientBinder = client.asBinder();
final ClientTransaction pendingTransaction = mPendingTransactions.get(clientBinder);
if (pendingTransaction != null) {
return pendingTransaction;
}
// Create new transaction if there is no existing.
final ClientTransaction transaction = ClientTransaction.obtain(client);
mPendingTransactions.put(clientBinder, transaction);
return transaction;
}
/** Must only be called with WM lock. | ClientLifecycleManager::onClientTransactionItemScheduled | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/ClientLifecycleManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/ClientLifecycleManager.java | MIT |
private boolean shouldDispatchPendingTransactionsImmediately() {
if (mWms == null) {
return true;
}
// Do not dispatch when
// 1. Layout deferred.
// 2. Layout requested.
// 3. Layout in process.
// The pending transactions will be dispatched during layout in
// RootWindowContainer#performSurfacePlacementNoTrace.
return !mWms.mWindowPlacerLocked.isLayoutDeferred()
&& !mWms.mWindowPlacerLocked.isTraversalScheduled()
&& !mWms.mWindowPlacerLocked.isInLayout();
} |
Called to when {@link WindowSurfacePlacer#continueLayout}.
Dispatches all pending transactions unless there is an ongoing/scheduled layout, in which
case the pending transactions will be dispatched in
{@link RootWindowContainer#performSurfacePlacementNoTrace}.
void onLayoutContinued() {
if (shouldDispatchPendingTransactionsImmediately()) {
// Dispatch the pending transactions immediately if there is no ongoing/scheduled layout
dispatchPendingTransactions();
}
}
/** Must only be called with WM lock.
@NonNull
private ClientTransaction getOrCreatePendingTransaction(@NonNull IApplicationThread client) {
final IBinder clientBinder = client.asBinder();
final ClientTransaction pendingTransaction = mPendingTransactions.get(clientBinder);
if (pendingTransaction != null) {
return pendingTransaction;
}
// Create new transaction if there is no existing.
final ClientTransaction transaction = ClientTransaction.obtain(client);
mPendingTransactions.put(clientBinder, transaction);
return transaction;
}
/** Must only be called with WM lock.
private void onClientTransactionItemScheduled(
@NonNull ClientTransaction clientTransaction,
boolean shouldDispatchImmediately) throws RemoteException {
if (shouldDispatchImmediately || shouldDispatchPendingTransactionsImmediately()) {
// Dispatch the pending transaction immediately.
mPendingTransactions.remove(clientTransaction.getClient().asBinder());
scheduleTransaction(clientTransaction);
}
}
/** Must only be called with WM lock. | ClientLifecycleManager::shouldDispatchPendingTransactionsImmediately | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/ClientLifecycleManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/ClientLifecycleManager.java | MIT |
static boolean shouldDispatchLaunchActivityItemIndependently(
@NonNull String appPackageName, int appUid) {
return !CompatChanges.isChangeEnabled(ENABLE_BUNDLE_LAUNCH_ACTIVITY_ITEM,
appPackageName,
UserHandle.getUserHandleForUid(appUid));
} |
Called to when {@link WindowSurfacePlacer#continueLayout}.
Dispatches all pending transactions unless there is an ongoing/scheduled layout, in which
case the pending transactions will be dispatched in
{@link RootWindowContainer#performSurfacePlacementNoTrace}.
void onLayoutContinued() {
if (shouldDispatchPendingTransactionsImmediately()) {
// Dispatch the pending transactions immediately if there is no ongoing/scheduled layout
dispatchPendingTransactions();
}
}
/** Must only be called with WM lock.
@NonNull
private ClientTransaction getOrCreatePendingTransaction(@NonNull IApplicationThread client) {
final IBinder clientBinder = client.asBinder();
final ClientTransaction pendingTransaction = mPendingTransactions.get(clientBinder);
if (pendingTransaction != null) {
return pendingTransaction;
}
// Create new transaction if there is no existing.
final ClientTransaction transaction = ClientTransaction.obtain(client);
mPendingTransactions.put(clientBinder, transaction);
return transaction;
}
/** Must only be called with WM lock.
private void onClientTransactionItemScheduled(
@NonNull ClientTransaction clientTransaction,
boolean shouldDispatchImmediately) throws RemoteException {
if (shouldDispatchImmediately || shouldDispatchPendingTransactionsImmediately()) {
// Dispatch the pending transaction immediately.
mPendingTransactions.remove(clientTransaction.getClient().asBinder());
scheduleTransaction(clientTransaction);
}
}
/** Must only be called with WM lock.
private boolean shouldDispatchPendingTransactionsImmediately() {
if (mWms == null) {
return true;
}
// Do not dispatch when
// 1. Layout deferred.
// 2. Layout requested.
// 3. Layout in process.
// The pending transactions will be dispatched during layout in
// RootWindowContainer#performSurfacePlacementNoTrace.
return !mWms.mWindowPlacerLocked.isLayoutDeferred()
&& !mWms.mWindowPlacerLocked.isTraversalScheduled()
&& !mWms.mWindowPlacerLocked.isInLayout();
}
/** Guards bundling {@link LaunchActivityItem} with targetSDK. | ClientLifecycleManager::shouldDispatchLaunchActivityItemIndependently | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/ClientLifecycleManager.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/ClientLifecycleManager.java | MIT |
public AssertionError() {
} |
Constructs an AssertionError with no detail message.
| AssertionError::AssertionError | java | Reginer/aosp-android-jar | android-32/src/java/lang/AssertionError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/lang/AssertionError.java | MIT |
private AssertionError(String detailMessage) {
super(detailMessage);
} |
This internal constructor does no processing on its string argument,
even if it is a null reference. The public constructors will
never call this constructor with a null argument.
| AssertionError::AssertionError | java | Reginer/aosp-android-jar | android-32/src/java/lang/AssertionError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/lang/AssertionError.java | MIT |
public AssertionError(Object detailMessage) {
this(String.valueOf(detailMessage));
if (detailMessage instanceof Throwable)
initCause((Throwable) detailMessage);
} |
Constructs an AssertionError with its detail message derived
from the specified object, which is converted to a string as
defined in section 15.18.1.1 of
<cite>The Java™ Language Specification</cite>.
<p>
If the specified object is an instance of {@code Throwable}, it
becomes the <i>cause</i> of the newly constructed assertion error.
@param detailMessage value to be used in constructing detail message
@see Throwable#getCause()
| AssertionError::AssertionError | java | Reginer/aosp-android-jar | android-32/src/java/lang/AssertionError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/lang/AssertionError.java | MIT |
public AssertionError(boolean detailMessage) {
this(String.valueOf(detailMessage));
} |
Constructs an AssertionError with its detail message derived
from the specified <code>boolean</code>, which is converted to
a string as defined in section 15.18.1.1 of
<cite>The Java™ Language Specification</cite>.
@param detailMessage value to be used in constructing detail message
| AssertionError::AssertionError | java | Reginer/aosp-android-jar | android-32/src/java/lang/AssertionError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/lang/AssertionError.java | MIT |
public AssertionError(char detailMessage) {
this(String.valueOf(detailMessage));
} |
Constructs an AssertionError with its detail message derived
from the specified <code>char</code>, which is converted to a
string as defined in section 15.18.1.1 of
<cite>The Java™ Language Specification</cite>.
@param detailMessage value to be used in constructing detail message
| AssertionError::AssertionError | java | Reginer/aosp-android-jar | android-32/src/java/lang/AssertionError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/lang/AssertionError.java | MIT |
public AssertionError(int detailMessage) {
this(String.valueOf(detailMessage));
} |
Constructs an AssertionError with its detail message derived
from the specified <code>int</code>, which is converted to a
string as defined in section 15.18.1.1 of
<cite>The Java™ Language Specification</cite>.
@param detailMessage value to be used in constructing detail message
| AssertionError::AssertionError | java | Reginer/aosp-android-jar | android-32/src/java/lang/AssertionError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/lang/AssertionError.java | MIT |
public AssertionError(long detailMessage) {
this(String.valueOf(detailMessage));
} |
Constructs an AssertionError with its detail message derived
from the specified <code>long</code>, which is converted to a
string as defined in section 15.18.1.1 of
<cite>The Java™ Language Specification</cite>.
@param detailMessage value to be used in constructing detail message
| AssertionError::AssertionError | java | Reginer/aosp-android-jar | android-32/src/java/lang/AssertionError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/lang/AssertionError.java | MIT |
public AssertionError(float detailMessage) {
this(String.valueOf(detailMessage));
} |
Constructs an AssertionError with its detail message derived
from the specified <code>float</code>, which is converted to a
string as defined in section 15.18.1.1 of
<cite>The Java™ Language Specification</cite>.
@param detailMessage value to be used in constructing detail message
| AssertionError::AssertionError | java | Reginer/aosp-android-jar | android-32/src/java/lang/AssertionError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/lang/AssertionError.java | MIT |
public AssertionError(double detailMessage) {
this(String.valueOf(detailMessage));
} |
Constructs an AssertionError with its detail message derived
from the specified <code>double</code>, which is converted to a
string as defined in section 15.18.1.1 of
<cite>The Java™ Language Specification</cite>.
@param detailMessage value to be used in constructing detail message
| AssertionError::AssertionError | java | Reginer/aosp-android-jar | android-32/src/java/lang/AssertionError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/lang/AssertionError.java | MIT |
public AssertionError(String message, Throwable cause) {
super(message, cause);
} |
Constructs a new {@code AssertionError} with the specified
detail message and cause.
<p>Note that the detail message associated with
{@code cause} is <i>not</i> automatically incorporated in
this error's detail message.
@param message the detail message, may be {@code null}
@param cause the cause, may be {@code null}
@since 1.7
| AssertionError::AssertionError | java | Reginer/aosp-android-jar | android-32/src/java/lang/AssertionError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/lang/AssertionError.java | MIT |
public PointFEvaluator() {
} |
Construct a PointFEvaluator that returns a new PointF on every evaluate call.
To avoid creating an object for each evaluate call,
{@link PointFEvaluator#PointFEvaluator(android.graphics.PointF)} should be used
whenever possible.
| PointFEvaluator::PointFEvaluator | java | Reginer/aosp-android-jar | android-31/src/android/animation/PointFEvaluator.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/animation/PointFEvaluator.java | MIT |
public PointFEvaluator(PointF reuse) {
mPoint = reuse;
} |
Constructs a PointFEvaluator that modifies and returns <code>reuse</code>
in {@link #evaluate(float, android.graphics.PointF, android.graphics.PointF)} calls.
The value returned from
{@link #evaluate(float, android.graphics.PointF, android.graphics.PointF)} should
not be cached because it will change over time as the object is reused on each
call.
@param reuse A PointF to be modified and returned by evaluate.
| PointFEvaluator::PointFEvaluator | java | Reginer/aosp-android-jar | android-31/src/android/animation/PointFEvaluator.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/animation/PointFEvaluator.java | MIT |
public documentimportnode03(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException {
org.w3c.domts.DocumentBuilderSetting[] settings =
new org.w3c.domts.DocumentBuilderSetting[] {
org.w3c.domts.DocumentBuilderSetting.namespaceAware,
org.w3c.domts.DocumentBuilderSetting.validating
};
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
| documentimportnode03::documentimportnode03 | java | Reginer/aosp-android-jar | android-34/src/org/w3c/domts/level2/core/documentimportnode03.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level2/core/documentimportnode03.java | MIT |
public void runTest() throws Throwable {
Document doc;
Element element;
Attr attr;
NodeList childList;
Node importedAttr;
String nodeName;
int nodeType;
String nodeValue;
doc = (Document) load("staffNS", true);
childList = doc.getElementsByTagNameNS("http://www.nist.gov", "employee");
element = (Element) childList.item(1);
attr = element.getAttributeNode("defaultAttr");
importedAttr = doc.importNode(attr, false);
nodeName = importedAttr.getNodeName();
nodeValue = importedAttr.getNodeValue();
nodeType = (int) importedAttr.getNodeType();
assertEquals("documentimportnode03_nodeName", "defaultAttr", nodeName);
assertEquals("documentimportnode03_nodeType", 2, nodeType);
assertEquals("documentimportnode03_nodeValue", "defaultVal", nodeValue);
} |
Runs the test case.
@throws Throwable Any uncaught exception causes test to fail
| documentimportnode03::runTest | java | Reginer/aosp-android-jar | android-34/src/org/w3c/domts/level2/core/documentimportnode03.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level2/core/documentimportnode03.java | MIT |
public String getTargetURI() {
return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentimportnode03";
} |
Gets URI that identifies the test.
@return uri identifier of test
| documentimportnode03::getTargetURI | java | Reginer/aosp-android-jar | android-34/src/org/w3c/domts/level2/core/documentimportnode03.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level2/core/documentimportnode03.java | MIT |
public static void main(final String[] args) {
DOMTestCase.doMain(documentimportnode03.class, args);
} |
Runs this test from the command line.
@param args command line arguments
| documentimportnode03::main | java | Reginer/aosp-android-jar | android-34/src/org/w3c/domts/level2/core/documentimportnode03.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level2/core/documentimportnode03.java | MIT |
BiometricContextSessionInfo(@NonNull InstanceId id) {
mId = id;
} | /*
Copyright (C) 2022 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 com.android.server.biometrics.log;
import android.annotation.NonNull;
import com.android.internal.logging.InstanceId;
import java.util.concurrent.atomic.AtomicInteger;
/** State for an authentication session {@see com.android.internal.statusbar.ISessionListener}.
class BiometricContextSessionInfo {
private final InstanceId mId;
private final AtomicInteger mOrder = new AtomicInteger(0);
/** Wrap a session id with the initial state. | BiometricContextSessionInfo::BiometricContextSessionInfo | java | Reginer/aosp-android-jar | android-34/src/com/android/server/biometrics/log/BiometricContextSessionInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/biometrics/log/BiometricContextSessionInfo.java | MIT |
public int getId() {
return mId.getId();
} | /*
Copyright (C) 2022 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 com.android.server.biometrics.log;
import android.annotation.NonNull;
import com.android.internal.logging.InstanceId;
import java.util.concurrent.atomic.AtomicInteger;
/** State for an authentication session {@see com.android.internal.statusbar.ISessionListener}.
class BiometricContextSessionInfo {
private final InstanceId mId;
private final AtomicInteger mOrder = new AtomicInteger(0);
/** Wrap a session id with the initial state.
BiometricContextSessionInfo(@NonNull InstanceId id) {
mId = id;
}
/** Get the session id. | BiometricContextSessionInfo::getId | java | Reginer/aosp-android-jar | android-34/src/com/android/server/biometrics/log/BiometricContextSessionInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/biometrics/log/BiometricContextSessionInfo.java | MIT |
public int getOrder() {
return mOrder.get();
} | /*
Copyright (C) 2022 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 com.android.server.biometrics.log;
import android.annotation.NonNull;
import com.android.internal.logging.InstanceId;
import java.util.concurrent.atomic.AtomicInteger;
/** State for an authentication session {@see com.android.internal.statusbar.ISessionListener}.
class BiometricContextSessionInfo {
private final InstanceId mId;
private final AtomicInteger mOrder = new AtomicInteger(0);
/** Wrap a session id with the initial state.
BiometricContextSessionInfo(@NonNull InstanceId id) {
mId = id;
}
/** Get the session id.
public int getId() {
return mId.getId();
}
/** Gets the current order counter for the session. | BiometricContextSessionInfo::getOrder | java | Reginer/aosp-android-jar | android-34/src/com/android/server/biometrics/log/BiometricContextSessionInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/biometrics/log/BiometricContextSessionInfo.java | MIT |
public int getOrderAndIncrement() {
return mOrder.getAndIncrement();
} |
Gets the current order counter for the session and increment the counter.
This should be called by the framework after processing any logged events,
such as success / failure, to preserve the order each event was processed in.
| BiometricContextSessionInfo::getOrderAndIncrement | java | Reginer/aosp-android-jar | android-34/src/com/android/server/biometrics/log/BiometricContextSessionInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/biometrics/log/BiometricContextSessionInfo.java | MIT |
public CrossProcessCursorWrapper(Cursor cursor) {
super(cursor);
} |
Creates a cross process cursor wrapper.
@param cursor The underlying cursor to wrap.
| CrossProcessCursorWrapper::CrossProcessCursorWrapper | java | Reginer/aosp-android-jar | android-33/src/android/database/CrossProcessCursorWrapper.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/database/CrossProcessCursorWrapper.java | MIT |
public TimingsTraceAndSlog() {
this(SYSTEM_SERVER_TIMING_TAG);
} |
Default constructor using {@code system_server} tags.
| TimingsTraceAndSlog::TimingsTraceAndSlog | java | Reginer/aosp-android-jar | android-35/src/com/android/server/utils/TimingsTraceAndSlog.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/utils/TimingsTraceAndSlog.java | MIT |
public TimingsTraceAndSlog(@NonNull String tag) {
this(tag, Trace.TRACE_TAG_SYSTEM_SERVER);
} |
Custom constructor using {@code system_server} trace tag.
@param tag {@code logcat} tag
| TimingsTraceAndSlog::TimingsTraceAndSlog | java | Reginer/aosp-android-jar | android-35/src/com/android/server/utils/TimingsTraceAndSlog.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/utils/TimingsTraceAndSlog.java | MIT |
public TimingsTraceAndSlog(@NonNull String tag, long traceTag) {
super(tag, traceTag);
mTag = tag;
} |
Custom constructor.
@param tag {@code logcat} tag
@param traceTag {@code atrace} tag
| TimingsTraceAndSlog::TimingsTraceAndSlog | java | Reginer/aosp-android-jar | android-35/src/com/android/server/utils/TimingsTraceAndSlog.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/utils/TimingsTraceAndSlog.java | MIT |
public TimingsTraceAndSlog(@NonNull TimingsTraceAndSlog other) {
super(other);
this.mTag = other.mTag;
} |
@see TimingsTraceLog#TimingsTraceLog(TimingsTraceLog)
| TimingsTraceAndSlog::TimingsTraceAndSlog | java | Reginer/aosp-android-jar | android-35/src/com/android/server/utils/TimingsTraceAndSlog.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/utils/TimingsTraceAndSlog.java | MIT |
protected CellIdentity(@Nullable String tag, int type, @Nullable String mcc,
@Nullable String mnc, @Nullable String alphal, @Nullable String alphas) {
mTag = tag;
mType = type;
// Only allow INT_MAX if unknown string mcc/mnc
if (mcc == null || isMcc(mcc)) {
mMccStr = mcc;
} else if (mcc.isEmpty() || mcc.equals(String.valueOf(Integer.MAX_VALUE))) {
// If the mccStr is empty or unknown, set it as null.
mMccStr = null;
} else {
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MCC format
// after the bug got fixed.
mMccStr = null;
log("invalid MCC format: " + mcc);
}
if (mnc == null || isMnc(mnc)) {
mMncStr = mnc;
} else if (mnc.isEmpty() || mnc.equals(String.valueOf(Integer.MAX_VALUE))) {
// If the mncStr is empty or unknown, set it as null.
mMncStr = null;
} else {
// TODO: b/69384059 Should throw IllegalArgumentException for the invalid MNC format
// after the bug got fixed.
mMncStr = null;
log("invalid MNC format: " + mnc);
}
if ((mMccStr != null && mMncStr == null) || (mMccStr == null && mMncStr != null)) {
AnomalyReporter.reportAnomaly(
UUID.fromString("a3ab0b9d-f2aa-4baf-911d-7096c0d4645a"),
"CellIdentity Missing Half of PLMN ID");
}
mAlphaLong = alphal;
mAlphaShort = alphas;
} |
parameters for validation
@hide
public static final int MCC_LENGTH = 3;
/** @hide
public static final int MNC_MIN_LENGTH = 2;
/** @hide
public static final int MNC_MAX_LENGTH = 3;
// Log tag
/** @hide
protected final String mTag;
// Cell identity type
/** @hide
protected final int mType;
// 3-digit Mobile Country Code in string format. Null for CDMA cell identity.
/** @hide
protected final String mMccStr;
// 2 or 3-digit Mobile Network Code in string format. Null for CDMA cell identity.
/** @hide
protected final String mMncStr;
// long alpha Operator Name String or Enhanced Operator Name String
/** @hide
protected String mAlphaLong;
// short alpha Operator Name String or Enhanced Operator Name String
/** @hide
protected String mAlphaShort;
// Cell Global, 3GPP TS 23.003
/** @hide
protected String mGlobalCellId;
/** @hide | CellIdentity::CellIdentity | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
public @CellInfo.Type int getType() {
return mType;
} |
@hide
@return The type of the cell identity
| CellIdentity::getType | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
public String getMccString() {
return mMccStr;
} |
@return MCC or null for CDMA
@hide
| CellIdentity::getMccString | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
public String getMncString() {
return mMncStr;
} |
@return MNC or null for CDMA
@hide
| CellIdentity::getMncString | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
public int getChannelNumber() {
return INVALID_CHANNEL_NUMBER;
} |
Returns the channel number of the cell identity.
@hide
@return The channel number, or {@link #INVALID_CHANNEL_NUMBER} if not implemented
| CellIdentity::getChannelNumber | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
public void setOperatorAlphaLong(String alphaLong) {
mAlphaLong = alphaLong;
} |
@hide
| CellIdentity::setOperatorAlphaLong | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
public void setOperatorAlphaShort(String alphaShort) {
mAlphaShort = alphaShort;
} |
@hide
| CellIdentity::setOperatorAlphaShort | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
public boolean isSameCell(@Nullable CellIdentity ci) {
if (ci == null) return false;
if (this.getClass() != ci.getClass()) return false;
return TextUtils.equals(this.getGlobalCellId(), ci.getGlobalCellId());
} |
@param ci a CellIdentity to compare to the current CellIdentity.
@return true if ci has the same technology and Global Cell ID; false, otherwise.
@hide
| CellIdentity::isSameCell | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
public @Nullable String getPlmn() {
if (mMccStr == null || mMncStr == null) return null;
return mMccStr + mMncStr;
} |
@param ci a CellIdentity to compare to the current CellIdentity.
@return true if ci has the same technology and Global Cell ID; false, otherwise.
@hide
public boolean isSameCell(@Nullable CellIdentity ci) {
if (ci == null) return false;
if (this.getClass() != ci.getClass()) return false;
return TextUtils.equals(this.getGlobalCellId(), ci.getGlobalCellId());
}
/** @hide | CellIdentity::getPlmn | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
public static boolean isValidPlmn(@NonNull String plmn) {
if (plmn.length() < MCC_LENGTH + MNC_MIN_LENGTH
|| plmn.length() > MCC_LENGTH + MNC_MAX_LENGTH) {
return false;
}
return (isMcc(plmn.substring(0, MCC_LENGTH)) && isMnc(plmn.substring(MCC_LENGTH)));
} | Used by phone interface manager to verify if a given string is valid MccMnc
@hide
| CellIdentity::isValidPlmn | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
protected CellIdentity(String tag, int type, Parcel source) {
this(tag, type, source.readString(), source.readString(),
source.readString(), source.readString());
} |
Construct from Parcel
@hide
| CellIdentity::CellIdentity | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
protected void log(String s) {
Rlog.w(mTag, s);
} |
Construct from Parcel
@hide
protected CellIdentity(String tag, int type, Parcel source) {
this(tag, type, source.readString(), source.readString(),
source.readString(), source.readString());
}
/** Implement the Parcelable interface
public static final @android.annotation.NonNull Creator<CellIdentity> CREATOR =
new Creator<CellIdentity>() {
@Override
public CellIdentity createFromParcel(Parcel in) {
int type = in.readInt();
switch (type) {
case CellInfo.TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
case CellInfo.TYPE_WCDMA: return CellIdentityWcdma.createFromParcelBody(in);
case CellInfo.TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
case CellInfo.TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
case CellInfo.TYPE_TDSCDMA:
return CellIdentityTdscdma.createFromParcelBody(in);
case CellInfo.TYPE_NR: return CellIdentityNr.createFromParcelBody(in);
default: throw new IllegalArgumentException("Bad Cell identity Parcel");
}
}
@Override
public CellIdentity[] newArray(int size) {
return new CellIdentity[size];
}
};
/** @hide | CellIdentity::log | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
protected static final int inRangeOrUnavailable(int value, int rangeMin, int rangeMax) {
if (value < rangeMin || value > rangeMax) return CellInfo.UNAVAILABLE;
return value;
} |
Construct from Parcel
@hide
protected CellIdentity(String tag, int type, Parcel source) {
this(tag, type, source.readString(), source.readString(),
source.readString(), source.readString());
}
/** Implement the Parcelable interface
public static final @android.annotation.NonNull Creator<CellIdentity> CREATOR =
new Creator<CellIdentity>() {
@Override
public CellIdentity createFromParcel(Parcel in) {
int type = in.readInt();
switch (type) {
case CellInfo.TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
case CellInfo.TYPE_WCDMA: return CellIdentityWcdma.createFromParcelBody(in);
case CellInfo.TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
case CellInfo.TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
case CellInfo.TYPE_TDSCDMA:
return CellIdentityTdscdma.createFromParcelBody(in);
case CellInfo.TYPE_NR: return CellIdentityNr.createFromParcelBody(in);
default: throw new IllegalArgumentException("Bad Cell identity Parcel");
}
}
@Override
public CellIdentity[] newArray(int size) {
return new CellIdentity[size];
}
};
/** @hide
protected void log(String s) {
Rlog.w(mTag, s);
}
/** @hide | CellIdentity::inRangeOrUnavailable | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
protected static final long inRangeOrUnavailable(long value, long rangeMin, long rangeMax) {
if (value < rangeMin || value > rangeMax) return CellInfo.UNAVAILABLE_LONG;
return value;
} |
Construct from Parcel
@hide
protected CellIdentity(String tag, int type, Parcel source) {
this(tag, type, source.readString(), source.readString(),
source.readString(), source.readString());
}
/** Implement the Parcelable interface
public static final @android.annotation.NonNull Creator<CellIdentity> CREATOR =
new Creator<CellIdentity>() {
@Override
public CellIdentity createFromParcel(Parcel in) {
int type = in.readInt();
switch (type) {
case CellInfo.TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
case CellInfo.TYPE_WCDMA: return CellIdentityWcdma.createFromParcelBody(in);
case CellInfo.TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
case CellInfo.TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
case CellInfo.TYPE_TDSCDMA:
return CellIdentityTdscdma.createFromParcelBody(in);
case CellInfo.TYPE_NR: return CellIdentityNr.createFromParcelBody(in);
default: throw new IllegalArgumentException("Bad Cell identity Parcel");
}
}
@Override
public CellIdentity[] newArray(int size) {
return new CellIdentity[size];
}
};
/** @hide
protected void log(String s) {
Rlog.w(mTag, s);
}
/** @hide
protected static final int inRangeOrUnavailable(int value, int rangeMin, int rangeMax) {
if (value < rangeMin || value > rangeMax) return CellInfo.UNAVAILABLE;
return value;
}
/** @hide | CellIdentity::inRangeOrUnavailable | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
protected static final int inRangeOrUnavailable(
int value, int rangeMin, int rangeMax, int special) {
if ((value < rangeMin || value > rangeMax) && value != special) return CellInfo.UNAVAILABLE;
return value;
} |
Construct from Parcel
@hide
protected CellIdentity(String tag, int type, Parcel source) {
this(tag, type, source.readString(), source.readString(),
source.readString(), source.readString());
}
/** Implement the Parcelable interface
public static final @android.annotation.NonNull Creator<CellIdentity> CREATOR =
new Creator<CellIdentity>() {
@Override
public CellIdentity createFromParcel(Parcel in) {
int type = in.readInt();
switch (type) {
case CellInfo.TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
case CellInfo.TYPE_WCDMA: return CellIdentityWcdma.createFromParcelBody(in);
case CellInfo.TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
case CellInfo.TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
case CellInfo.TYPE_TDSCDMA:
return CellIdentityTdscdma.createFromParcelBody(in);
case CellInfo.TYPE_NR: return CellIdentityNr.createFromParcelBody(in);
default: throw new IllegalArgumentException("Bad Cell identity Parcel");
}
}
@Override
public CellIdentity[] newArray(int size) {
return new CellIdentity[size];
}
};
/** @hide
protected void log(String s) {
Rlog.w(mTag, s);
}
/** @hide
protected static final int inRangeOrUnavailable(int value, int rangeMin, int rangeMax) {
if (value < rangeMin || value > rangeMax) return CellInfo.UNAVAILABLE;
return value;
}
/** @hide
protected static final long inRangeOrUnavailable(long value, long rangeMin, long rangeMax) {
if (value < rangeMin || value > rangeMax) return CellInfo.UNAVAILABLE_LONG;
return value;
}
/** @hide | CellIdentity::inRangeOrUnavailable | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
private static boolean isMcc(@NonNull String mcc) {
// ensure no out of bounds indexing
if (mcc.length() != MCC_LENGTH) return false;
// Character.isDigit allows all unicode digits, not just [0-9]
for (int i = 0; i < MCC_LENGTH; i++) {
if (mcc.charAt(i) < '0' || mcc.charAt(i) > '9') return false;
}
return true;
} |
Construct from Parcel
@hide
protected CellIdentity(String tag, int type, Parcel source) {
this(tag, type, source.readString(), source.readString(),
source.readString(), source.readString());
}
/** Implement the Parcelable interface
public static final @android.annotation.NonNull Creator<CellIdentity> CREATOR =
new Creator<CellIdentity>() {
@Override
public CellIdentity createFromParcel(Parcel in) {
int type = in.readInt();
switch (type) {
case CellInfo.TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
case CellInfo.TYPE_WCDMA: return CellIdentityWcdma.createFromParcelBody(in);
case CellInfo.TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
case CellInfo.TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
case CellInfo.TYPE_TDSCDMA:
return CellIdentityTdscdma.createFromParcelBody(in);
case CellInfo.TYPE_NR: return CellIdentityNr.createFromParcelBody(in);
default: throw new IllegalArgumentException("Bad Cell identity Parcel");
}
}
@Override
public CellIdentity[] newArray(int size) {
return new CellIdentity[size];
}
};
/** @hide
protected void log(String s) {
Rlog.w(mTag, s);
}
/** @hide
protected static final int inRangeOrUnavailable(int value, int rangeMin, int rangeMax) {
if (value < rangeMin || value > rangeMax) return CellInfo.UNAVAILABLE;
return value;
}
/** @hide
protected static final long inRangeOrUnavailable(long value, long rangeMin, long rangeMax) {
if (value < rangeMin || value > rangeMax) return CellInfo.UNAVAILABLE_LONG;
return value;
}
/** @hide
protected static final int inRangeOrUnavailable(
int value, int rangeMin, int rangeMax, int special) {
if ((value < rangeMin || value > rangeMax) && value != special) return CellInfo.UNAVAILABLE;
return value;
}
/** @hide | CellIdentity::isMcc | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
private static boolean isMnc(@NonNull String mnc) {
// ensure no out of bounds indexing
if (mnc.length() < MNC_MIN_LENGTH || mnc.length() > MNC_MAX_LENGTH) return false;
// Character.isDigit allows all unicode digits, not just [0-9]
for (int i = 0; i < mnc.length(); i++) {
if (mnc.charAt(i) < '0' || mnc.charAt(i) > '9') return false;
}
return true;
} |
Construct from Parcel
@hide
protected CellIdentity(String tag, int type, Parcel source) {
this(tag, type, source.readString(), source.readString(),
source.readString(), source.readString());
}
/** Implement the Parcelable interface
public static final @android.annotation.NonNull Creator<CellIdentity> CREATOR =
new Creator<CellIdentity>() {
@Override
public CellIdentity createFromParcel(Parcel in) {
int type = in.readInt();
switch (type) {
case CellInfo.TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
case CellInfo.TYPE_WCDMA: return CellIdentityWcdma.createFromParcelBody(in);
case CellInfo.TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
case CellInfo.TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
case CellInfo.TYPE_TDSCDMA:
return CellIdentityTdscdma.createFromParcelBody(in);
case CellInfo.TYPE_NR: return CellIdentityNr.createFromParcelBody(in);
default: throw new IllegalArgumentException("Bad Cell identity Parcel");
}
}
@Override
public CellIdentity[] newArray(int size) {
return new CellIdentity[size];
}
};
/** @hide
protected void log(String s) {
Rlog.w(mTag, s);
}
/** @hide
protected static final int inRangeOrUnavailable(int value, int rangeMin, int rangeMax) {
if (value < rangeMin || value > rangeMax) return CellInfo.UNAVAILABLE;
return value;
}
/** @hide
protected static final long inRangeOrUnavailable(long value, long rangeMin, long rangeMax) {
if (value < rangeMin || value > rangeMax) return CellInfo.UNAVAILABLE_LONG;
return value;
}
/** @hide
protected static final int inRangeOrUnavailable(
int value, int rangeMin, int rangeMax, int special) {
if ((value < rangeMin || value > rangeMax) && value != special) return CellInfo.UNAVAILABLE;
return value;
}
/** @hide
private static boolean isMcc(@NonNull String mcc) {
// ensure no out of bounds indexing
if (mcc.length() != MCC_LENGTH) return false;
// Character.isDigit allows all unicode digits, not just [0-9]
for (int i = 0; i < MCC_LENGTH; i++) {
if (mcc.charAt(i) < '0' || mcc.charAt(i) > '9') return false;
}
return true;
}
/** @hide | CellIdentity::isMnc | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
public static CellIdentity create(android.hardware.radio.V1_0.CellIdentity cellIdentity) {
if (cellIdentity == null) return null;
switch(cellIdentity.cellInfoType) {
case CellInfoType.GSM: {
if (cellIdentity.cellIdentityGsm.size() == 1) {
return new CellIdentityGsm(cellIdentity.cellIdentityGsm.get(0));
}
break;
}
case CellInfoType.WCDMA: {
if (cellIdentity.cellIdentityWcdma.size() == 1) {
return new CellIdentityWcdma(cellIdentity.cellIdentityWcdma.get(0));
}
break;
}
case CellInfoType.TD_SCDMA: {
if (cellIdentity.cellIdentityTdscdma.size() == 1) {
return new CellIdentityTdscdma(cellIdentity.cellIdentityTdscdma.get(0));
}
break;
}
case CellInfoType.LTE: {
if (cellIdentity.cellIdentityLte.size() == 1) {
return new CellIdentityLte(cellIdentity.cellIdentityLte.get(0));
}
break;
}
case CellInfoType.CDMA: {
if (cellIdentity.cellIdentityCdma.size() == 1) {
return new CellIdentityCdma(cellIdentity.cellIdentityCdma.get(0));
}
break;
}
case CellInfoType.NONE: break;
default: break;
}
return null;
} |
Construct from Parcel
@hide
protected CellIdentity(String tag, int type, Parcel source) {
this(tag, type, source.readString(), source.readString(),
source.readString(), source.readString());
}
/** Implement the Parcelable interface
public static final @android.annotation.NonNull Creator<CellIdentity> CREATOR =
new Creator<CellIdentity>() {
@Override
public CellIdentity createFromParcel(Parcel in) {
int type = in.readInt();
switch (type) {
case CellInfo.TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
case CellInfo.TYPE_WCDMA: return CellIdentityWcdma.createFromParcelBody(in);
case CellInfo.TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
case CellInfo.TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
case CellInfo.TYPE_TDSCDMA:
return CellIdentityTdscdma.createFromParcelBody(in);
case CellInfo.TYPE_NR: return CellIdentityNr.createFromParcelBody(in);
default: throw new IllegalArgumentException("Bad Cell identity Parcel");
}
}
@Override
public CellIdentity[] newArray(int size) {
return new CellIdentity[size];
}
};
/** @hide
protected void log(String s) {
Rlog.w(mTag, s);
}
/** @hide
protected static final int inRangeOrUnavailable(int value, int rangeMin, int rangeMax) {
if (value < rangeMin || value > rangeMax) return CellInfo.UNAVAILABLE;
return value;
}
/** @hide
protected static final long inRangeOrUnavailable(long value, long rangeMin, long rangeMax) {
if (value < rangeMin || value > rangeMax) return CellInfo.UNAVAILABLE_LONG;
return value;
}
/** @hide
protected static final int inRangeOrUnavailable(
int value, int rangeMin, int rangeMax, int special) {
if ((value < rangeMin || value > rangeMax) && value != special) return CellInfo.UNAVAILABLE;
return value;
}
/** @hide
private static boolean isMcc(@NonNull String mcc) {
// ensure no out of bounds indexing
if (mcc.length() != MCC_LENGTH) return false;
// Character.isDigit allows all unicode digits, not just [0-9]
for (int i = 0; i < MCC_LENGTH; i++) {
if (mcc.charAt(i) < '0' || mcc.charAt(i) > '9') return false;
}
return true;
}
/** @hide
private static boolean isMnc(@NonNull String mnc) {
// ensure no out of bounds indexing
if (mnc.length() < MNC_MIN_LENGTH || mnc.length() > MNC_MAX_LENGTH) return false;
// Character.isDigit allows all unicode digits, not just [0-9]
for (int i = 0; i < mnc.length(); i++) {
if (mnc.charAt(i) < '0' || mnc.charAt(i) > '9') return false;
}
return true;
}
/** @hide | CellIdentity::create | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
public static CellIdentity create(android.hardware.radio.V1_2.CellIdentity cellIdentity) {
if (cellIdentity == null) return null;
switch(cellIdentity.cellInfoType) {
case CellInfoType.GSM: {
if (cellIdentity.cellIdentityGsm.size() == 1) {
return new CellIdentityGsm(cellIdentity.cellIdentityGsm.get(0));
}
break;
}
case CellInfoType.WCDMA: {
if (cellIdentity.cellIdentityWcdma.size() == 1) {
return new CellIdentityWcdma(cellIdentity.cellIdentityWcdma.get(0));
}
break;
}
case CellInfoType.TD_SCDMA: {
if (cellIdentity.cellIdentityTdscdma.size() == 1) {
return new CellIdentityTdscdma(cellIdentity.cellIdentityTdscdma.get(0));
}
break;
}
case CellInfoType.LTE: {
if (cellIdentity.cellIdentityLte.size() == 1) {
return new CellIdentityLte(cellIdentity.cellIdentityLte.get(0));
}
break;
}
case CellInfoType.CDMA: {
if (cellIdentity.cellIdentityCdma.size() == 1) {
return new CellIdentityCdma(cellIdentity.cellIdentityCdma.get(0));
}
break;
}
case CellInfoType.NONE: break;
default: break;
}
return null;
} |
Construct from Parcel
@hide
protected CellIdentity(String tag, int type, Parcel source) {
this(tag, type, source.readString(), source.readString(),
source.readString(), source.readString());
}
/** Implement the Parcelable interface
public static final @android.annotation.NonNull Creator<CellIdentity> CREATOR =
new Creator<CellIdentity>() {
@Override
public CellIdentity createFromParcel(Parcel in) {
int type = in.readInt();
switch (type) {
case CellInfo.TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
case CellInfo.TYPE_WCDMA: return CellIdentityWcdma.createFromParcelBody(in);
case CellInfo.TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
case CellInfo.TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
case CellInfo.TYPE_TDSCDMA:
return CellIdentityTdscdma.createFromParcelBody(in);
case CellInfo.TYPE_NR: return CellIdentityNr.createFromParcelBody(in);
default: throw new IllegalArgumentException("Bad Cell identity Parcel");
}
}
@Override
public CellIdentity[] newArray(int size) {
return new CellIdentity[size];
}
};
/** @hide
protected void log(String s) {
Rlog.w(mTag, s);
}
/** @hide
protected static final int inRangeOrUnavailable(int value, int rangeMin, int rangeMax) {
if (value < rangeMin || value > rangeMax) return CellInfo.UNAVAILABLE;
return value;
}
/** @hide
protected static final long inRangeOrUnavailable(long value, long rangeMin, long rangeMax) {
if (value < rangeMin || value > rangeMax) return CellInfo.UNAVAILABLE_LONG;
return value;
}
/** @hide
protected static final int inRangeOrUnavailable(
int value, int rangeMin, int rangeMax, int special) {
if ((value < rangeMin || value > rangeMax) && value != special) return CellInfo.UNAVAILABLE;
return value;
}
/** @hide
private static boolean isMcc(@NonNull String mcc) {
// ensure no out of bounds indexing
if (mcc.length() != MCC_LENGTH) return false;
// Character.isDigit allows all unicode digits, not just [0-9]
for (int i = 0; i < MCC_LENGTH; i++) {
if (mcc.charAt(i) < '0' || mcc.charAt(i) > '9') return false;
}
return true;
}
/** @hide
private static boolean isMnc(@NonNull String mnc) {
// ensure no out of bounds indexing
if (mnc.length() < MNC_MIN_LENGTH || mnc.length() > MNC_MAX_LENGTH) return false;
// Character.isDigit allows all unicode digits, not just [0-9]
for (int i = 0; i < mnc.length(); i++) {
if (mnc.charAt(i) < '0' || mnc.charAt(i) > '9') return false;
}
return true;
}
/** @hide
public static CellIdentity create(android.hardware.radio.V1_0.CellIdentity cellIdentity) {
if (cellIdentity == null) return null;
switch(cellIdentity.cellInfoType) {
case CellInfoType.GSM: {
if (cellIdentity.cellIdentityGsm.size() == 1) {
return new CellIdentityGsm(cellIdentity.cellIdentityGsm.get(0));
}
break;
}
case CellInfoType.WCDMA: {
if (cellIdentity.cellIdentityWcdma.size() == 1) {
return new CellIdentityWcdma(cellIdentity.cellIdentityWcdma.get(0));
}
break;
}
case CellInfoType.TD_SCDMA: {
if (cellIdentity.cellIdentityTdscdma.size() == 1) {
return new CellIdentityTdscdma(cellIdentity.cellIdentityTdscdma.get(0));
}
break;
}
case CellInfoType.LTE: {
if (cellIdentity.cellIdentityLte.size() == 1) {
return new CellIdentityLte(cellIdentity.cellIdentityLte.get(0));
}
break;
}
case CellInfoType.CDMA: {
if (cellIdentity.cellIdentityCdma.size() == 1) {
return new CellIdentityCdma(cellIdentity.cellIdentityCdma.get(0));
}
break;
}
case CellInfoType.NONE: break;
default: break;
}
return null;
}
/** @hide | CellIdentity::create | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
public static CellIdentity create(android.hardware.radio.V1_5.CellIdentity ci) {
if (ci == null) return null;
switch (ci.getDiscriminator()) {
case android.hardware.radio.V1_5.CellIdentity.hidl_discriminator.gsm:
return new CellIdentityGsm(ci.gsm());
case android.hardware.radio.V1_5.CellIdentity.hidl_discriminator.cdma:
return new CellIdentityCdma(ci.cdma());
case android.hardware.radio.V1_5.CellIdentity.hidl_discriminator.lte:
return new CellIdentityLte(ci.lte());
case android.hardware.radio.V1_5.CellIdentity.hidl_discriminator.wcdma:
return new CellIdentityWcdma(ci.wcdma());
case android.hardware.radio.V1_5.CellIdentity.hidl_discriminator.tdscdma:
return new CellIdentityTdscdma(ci.tdscdma());
case android.hardware.radio.V1_5.CellIdentity.hidl_discriminator.nr:
return new CellIdentityNr(ci.nr());
default: return null;
}
} |
Construct from Parcel
@hide
protected CellIdentity(String tag, int type, Parcel source) {
this(tag, type, source.readString(), source.readString(),
source.readString(), source.readString());
}
/** Implement the Parcelable interface
public static final @android.annotation.NonNull Creator<CellIdentity> CREATOR =
new Creator<CellIdentity>() {
@Override
public CellIdentity createFromParcel(Parcel in) {
int type = in.readInt();
switch (type) {
case CellInfo.TYPE_GSM: return CellIdentityGsm.createFromParcelBody(in);
case CellInfo.TYPE_WCDMA: return CellIdentityWcdma.createFromParcelBody(in);
case CellInfo.TYPE_CDMA: return CellIdentityCdma.createFromParcelBody(in);
case CellInfo.TYPE_LTE: return CellIdentityLte.createFromParcelBody(in);
case CellInfo.TYPE_TDSCDMA:
return CellIdentityTdscdma.createFromParcelBody(in);
case CellInfo.TYPE_NR: return CellIdentityNr.createFromParcelBody(in);
default: throw new IllegalArgumentException("Bad Cell identity Parcel");
}
}
@Override
public CellIdentity[] newArray(int size) {
return new CellIdentity[size];
}
};
/** @hide
protected void log(String s) {
Rlog.w(mTag, s);
}
/** @hide
protected static final int inRangeOrUnavailable(int value, int rangeMin, int rangeMax) {
if (value < rangeMin || value > rangeMax) return CellInfo.UNAVAILABLE;
return value;
}
/** @hide
protected static final long inRangeOrUnavailable(long value, long rangeMin, long rangeMax) {
if (value < rangeMin || value > rangeMax) return CellInfo.UNAVAILABLE_LONG;
return value;
}
/** @hide
protected static final int inRangeOrUnavailable(
int value, int rangeMin, int rangeMax, int special) {
if ((value < rangeMin || value > rangeMax) && value != special) return CellInfo.UNAVAILABLE;
return value;
}
/** @hide
private static boolean isMcc(@NonNull String mcc) {
// ensure no out of bounds indexing
if (mcc.length() != MCC_LENGTH) return false;
// Character.isDigit allows all unicode digits, not just [0-9]
for (int i = 0; i < MCC_LENGTH; i++) {
if (mcc.charAt(i) < '0' || mcc.charAt(i) > '9') return false;
}
return true;
}
/** @hide
private static boolean isMnc(@NonNull String mnc) {
// ensure no out of bounds indexing
if (mnc.length() < MNC_MIN_LENGTH || mnc.length() > MNC_MAX_LENGTH) return false;
// Character.isDigit allows all unicode digits, not just [0-9]
for (int i = 0; i < mnc.length(); i++) {
if (mnc.charAt(i) < '0' || mnc.charAt(i) > '9') return false;
}
return true;
}
/** @hide
public static CellIdentity create(android.hardware.radio.V1_0.CellIdentity cellIdentity) {
if (cellIdentity == null) return null;
switch(cellIdentity.cellInfoType) {
case CellInfoType.GSM: {
if (cellIdentity.cellIdentityGsm.size() == 1) {
return new CellIdentityGsm(cellIdentity.cellIdentityGsm.get(0));
}
break;
}
case CellInfoType.WCDMA: {
if (cellIdentity.cellIdentityWcdma.size() == 1) {
return new CellIdentityWcdma(cellIdentity.cellIdentityWcdma.get(0));
}
break;
}
case CellInfoType.TD_SCDMA: {
if (cellIdentity.cellIdentityTdscdma.size() == 1) {
return new CellIdentityTdscdma(cellIdentity.cellIdentityTdscdma.get(0));
}
break;
}
case CellInfoType.LTE: {
if (cellIdentity.cellIdentityLte.size() == 1) {
return new CellIdentityLte(cellIdentity.cellIdentityLte.get(0));
}
break;
}
case CellInfoType.CDMA: {
if (cellIdentity.cellIdentityCdma.size() == 1) {
return new CellIdentityCdma(cellIdentity.cellIdentityCdma.get(0));
}
break;
}
case CellInfoType.NONE: break;
default: break;
}
return null;
}
/** @hide
public static CellIdentity create(android.hardware.radio.V1_2.CellIdentity cellIdentity) {
if (cellIdentity == null) return null;
switch(cellIdentity.cellInfoType) {
case CellInfoType.GSM: {
if (cellIdentity.cellIdentityGsm.size() == 1) {
return new CellIdentityGsm(cellIdentity.cellIdentityGsm.get(0));
}
break;
}
case CellInfoType.WCDMA: {
if (cellIdentity.cellIdentityWcdma.size() == 1) {
return new CellIdentityWcdma(cellIdentity.cellIdentityWcdma.get(0));
}
break;
}
case CellInfoType.TD_SCDMA: {
if (cellIdentity.cellIdentityTdscdma.size() == 1) {
return new CellIdentityTdscdma(cellIdentity.cellIdentityTdscdma.get(0));
}
break;
}
case CellInfoType.LTE: {
if (cellIdentity.cellIdentityLte.size() == 1) {
return new CellIdentityLte(cellIdentity.cellIdentityLte.get(0));
}
break;
}
case CellInfoType.CDMA: {
if (cellIdentity.cellIdentityCdma.size() == 1) {
return new CellIdentityCdma(cellIdentity.cellIdentityCdma.get(0));
}
break;
}
case CellInfoType.NONE: break;
default: break;
}
return null;
}
/** @hide | CellIdentity::create | java | Reginer/aosp-android-jar | android-31/src/android/telephony/CellIdentity.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/CellIdentity.java | MIT |
public void fetchInitialState() {
if (mWifiManager == null) {
return;
}
updateWifiState();
final NetworkInfo networkInfo =
mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
connected = networkInfo != null && networkInfo.isConnected();
mWifiInfo = null;
ssid = null;
if (connected) {
mWifiInfo = mWifiManager.getConnectionInfo();
if (mWifiInfo != null) {
if (mWifiInfo.isPasspointAp() || mWifiInfo.isOsuAp()) {
ssid = mWifiInfo.getPasspointProviderFriendlyName();
} else {
ssid = getValidSsid(mWifiInfo);
}
isCarrierMerged = mWifiInfo.isCarrierMerged();
subId = mWifiInfo.getSubscriptionId();
updateRssi(mWifiInfo.getRssi());
maybeRequestNetworkScore();
}
}
updateStatusLabel();
} |
Fetches initial state as if a WifiManager.NETWORK_STATE_CHANGED_ACTION have been received.
This replaces the dependency on the initial sticky broadcast.
| WifiStatusTracker::fetchInitialState | java | Reginer/aosp-android-jar | android-32/src/com/android/settingslib/wifi/WifiStatusTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/settingslib/wifi/WifiStatusTracker.java | MIT |
public void refreshLocale() {
updateStatusLabel();
mCallback.run();
} |
Fetches initial state as if a WifiManager.NETWORK_STATE_CHANGED_ACTION have been received.
This replaces the dependency on the initial sticky broadcast.
public void fetchInitialState() {
if (mWifiManager == null) {
return;
}
updateWifiState();
final NetworkInfo networkInfo =
mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
connected = networkInfo != null && networkInfo.isConnected();
mWifiInfo = null;
ssid = null;
if (connected) {
mWifiInfo = mWifiManager.getConnectionInfo();
if (mWifiInfo != null) {
if (mWifiInfo.isPasspointAp() || mWifiInfo.isOsuAp()) {
ssid = mWifiInfo.getPasspointProviderFriendlyName();
} else {
ssid = getValidSsid(mWifiInfo);
}
isCarrierMerged = mWifiInfo.isCarrierMerged();
subId = mWifiInfo.getSubscriptionId();
updateRssi(mWifiInfo.getRssi());
maybeRequestNetworkScore();
}
}
updateStatusLabel();
}
public void handleBroadcast(Intent intent) {
if (mWifiManager == null) {
return;
}
String action = intent.getAction();
if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
updateWifiState();
}
}
private void updateWifiInfo(WifiInfo wifiInfo) {
updateWifiState();
connected = wifiInfo != null;
mWifiInfo = wifiInfo;
ssid = null;
if (mWifiInfo != null) {
if (mWifiInfo.isPasspointAp() || mWifiInfo.isOsuAp()) {
ssid = mWifiInfo.getPasspointProviderFriendlyName();
} else {
ssid = getValidSsid(mWifiInfo);
}
isCarrierMerged = mWifiInfo.isCarrierMerged();
subId = mWifiInfo.getSubscriptionId();
updateRssi(mWifiInfo.getRssi());
maybeRequestNetworkScore();
}
}
private void updateWifiState() {
state = mWifiManager.getWifiState();
enabled = state == WifiManager.WIFI_STATE_ENABLED;
}
private void updateRssi(int newRssi) {
rssi = newRssi;
level = mWifiManager.calculateSignalLevel(rssi);
}
private void maybeRequestNetworkScore() {
NetworkKey networkKey = NetworkKey.createFromWifiInfo(mWifiInfo);
if (mWifiNetworkScoreCache.getScoredNetwork(networkKey) == null) {
mNetworkScoreManager.requestScores(new NetworkKey[]{ networkKey });
}
}
private void updateStatusLabel() {
if (mWifiManager == null) {
return;
}
NetworkCapabilities networkCapabilities;
isDefaultNetwork = false;
if (mDefaultNetworkCapabilities != null) {
boolean isWifi = mDefaultNetworkCapabilities.hasTransport(
NetworkCapabilities.TRANSPORT_WIFI);
boolean isVcnOverWifi = mDefaultNetworkCapabilities.hasTransport(
NetworkCapabilities.TRANSPORT_CELLULAR)
&& (Utils.tryGetWifiInfoForVcn(mDefaultNetworkCapabilities) != null);
if (isWifi || isVcnOverWifi) {
isDefaultNetwork = true;
}
}
if (isDefaultNetwork) {
// Wifi is connected and the default network.
networkCapabilities = mDefaultNetworkCapabilities;
} else {
networkCapabilities = mConnectivityManager.getNetworkCapabilities(
mWifiManager.getCurrentNetwork());
}
isCaptivePortal = false;
if (networkCapabilities != null) {
if (networkCapabilities.hasCapability(NET_CAPABILITY_CAPTIVE_PORTAL)) {
statusLabel = mContext.getString(R.string.wifi_status_sign_in_required);
isCaptivePortal = true;
return;
} else if (networkCapabilities.hasCapability(NET_CAPABILITY_PARTIAL_CONNECTIVITY)) {
statusLabel = mContext.getString(R.string.wifi_limited_connection);
return;
} else if (!networkCapabilities.hasCapability(NET_CAPABILITY_VALIDATED)) {
final String mode = Settings.Global.getString(mContext.getContentResolver(),
Settings.Global.PRIVATE_DNS_MODE);
if (networkCapabilities.isPrivateDnsBroken()) {
statusLabel = mContext.getString(R.string.private_dns_broken);
} else {
statusLabel = mContext.getString(R.string.wifi_status_no_internet);
}
return;
} else if (!isDefaultNetwork && mDefaultNetworkCapabilities != null
&& mDefaultNetworkCapabilities.hasTransport(TRANSPORT_CELLULAR)) {
statusLabel = mContext.getString(R.string.wifi_connected_low_quality);
return;
}
}
ScoredNetwork scoredNetwork =
mWifiNetworkScoreCache.getScoredNetwork(NetworkKey.createFromWifiInfo(mWifiInfo));
statusLabel = scoredNetwork == null
? null : AccessPoint.getSpeedLabel(mContext, scoredNetwork, rssi);
}
/** Refresh the status label on Locale changed. | WifiStatusTracker::refreshLocale | java | Reginer/aosp-android-jar | android-32/src/com/android/settingslib/wifi/WifiStatusTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/settingslib/wifi/WifiStatusTracker.java | MIT |
public void dump(PrintWriter pw) {
pw.println(" - WiFi Network History ------");
int size = 0;
for (int i = 0; i < HISTORY_SIZE; i++) {
if (mHistory[i] != null) size++;
}
// Print out the previous states in ordered number.
for (int i = mHistoryIndex + HISTORY_SIZE - 1;
i >= mHistoryIndex + HISTORY_SIZE - size; i--) {
pw.println(" Previous WiFiNetwork("
+ (mHistoryIndex + HISTORY_SIZE - i) + "): "
+ mHistory[i & (HISTORY_SIZE - 1)]);
}
} |
Fetches initial state as if a WifiManager.NETWORK_STATE_CHANGED_ACTION have been received.
This replaces the dependency on the initial sticky broadcast.
public void fetchInitialState() {
if (mWifiManager == null) {
return;
}
updateWifiState();
final NetworkInfo networkInfo =
mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
connected = networkInfo != null && networkInfo.isConnected();
mWifiInfo = null;
ssid = null;
if (connected) {
mWifiInfo = mWifiManager.getConnectionInfo();
if (mWifiInfo != null) {
if (mWifiInfo.isPasspointAp() || mWifiInfo.isOsuAp()) {
ssid = mWifiInfo.getPasspointProviderFriendlyName();
} else {
ssid = getValidSsid(mWifiInfo);
}
isCarrierMerged = mWifiInfo.isCarrierMerged();
subId = mWifiInfo.getSubscriptionId();
updateRssi(mWifiInfo.getRssi());
maybeRequestNetworkScore();
}
}
updateStatusLabel();
}
public void handleBroadcast(Intent intent) {
if (mWifiManager == null) {
return;
}
String action = intent.getAction();
if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
updateWifiState();
}
}
private void updateWifiInfo(WifiInfo wifiInfo) {
updateWifiState();
connected = wifiInfo != null;
mWifiInfo = wifiInfo;
ssid = null;
if (mWifiInfo != null) {
if (mWifiInfo.isPasspointAp() || mWifiInfo.isOsuAp()) {
ssid = mWifiInfo.getPasspointProviderFriendlyName();
} else {
ssid = getValidSsid(mWifiInfo);
}
isCarrierMerged = mWifiInfo.isCarrierMerged();
subId = mWifiInfo.getSubscriptionId();
updateRssi(mWifiInfo.getRssi());
maybeRequestNetworkScore();
}
}
private void updateWifiState() {
state = mWifiManager.getWifiState();
enabled = state == WifiManager.WIFI_STATE_ENABLED;
}
private void updateRssi(int newRssi) {
rssi = newRssi;
level = mWifiManager.calculateSignalLevel(rssi);
}
private void maybeRequestNetworkScore() {
NetworkKey networkKey = NetworkKey.createFromWifiInfo(mWifiInfo);
if (mWifiNetworkScoreCache.getScoredNetwork(networkKey) == null) {
mNetworkScoreManager.requestScores(new NetworkKey[]{ networkKey });
}
}
private void updateStatusLabel() {
if (mWifiManager == null) {
return;
}
NetworkCapabilities networkCapabilities;
isDefaultNetwork = false;
if (mDefaultNetworkCapabilities != null) {
boolean isWifi = mDefaultNetworkCapabilities.hasTransport(
NetworkCapabilities.TRANSPORT_WIFI);
boolean isVcnOverWifi = mDefaultNetworkCapabilities.hasTransport(
NetworkCapabilities.TRANSPORT_CELLULAR)
&& (Utils.tryGetWifiInfoForVcn(mDefaultNetworkCapabilities) != null);
if (isWifi || isVcnOverWifi) {
isDefaultNetwork = true;
}
}
if (isDefaultNetwork) {
// Wifi is connected and the default network.
networkCapabilities = mDefaultNetworkCapabilities;
} else {
networkCapabilities = mConnectivityManager.getNetworkCapabilities(
mWifiManager.getCurrentNetwork());
}
isCaptivePortal = false;
if (networkCapabilities != null) {
if (networkCapabilities.hasCapability(NET_CAPABILITY_CAPTIVE_PORTAL)) {
statusLabel = mContext.getString(R.string.wifi_status_sign_in_required);
isCaptivePortal = true;
return;
} else if (networkCapabilities.hasCapability(NET_CAPABILITY_PARTIAL_CONNECTIVITY)) {
statusLabel = mContext.getString(R.string.wifi_limited_connection);
return;
} else if (!networkCapabilities.hasCapability(NET_CAPABILITY_VALIDATED)) {
final String mode = Settings.Global.getString(mContext.getContentResolver(),
Settings.Global.PRIVATE_DNS_MODE);
if (networkCapabilities.isPrivateDnsBroken()) {
statusLabel = mContext.getString(R.string.private_dns_broken);
} else {
statusLabel = mContext.getString(R.string.wifi_status_no_internet);
}
return;
} else if (!isDefaultNetwork && mDefaultNetworkCapabilities != null
&& mDefaultNetworkCapabilities.hasTransport(TRANSPORT_CELLULAR)) {
statusLabel = mContext.getString(R.string.wifi_connected_low_quality);
return;
}
}
ScoredNetwork scoredNetwork =
mWifiNetworkScoreCache.getScoredNetwork(NetworkKey.createFromWifiInfo(mWifiInfo));
statusLabel = scoredNetwork == null
? null : AccessPoint.getSpeedLabel(mContext, scoredNetwork, rssi);
}
/** Refresh the status label on Locale changed.
public void refreshLocale() {
updateStatusLabel();
mCallback.run();
}
private String getValidSsid(WifiInfo info) {
String ssid = info.getSSID();
if (ssid != null && !WifiManager.UNKNOWN_SSID.equals(ssid)) {
return ssid;
}
return null;
}
private void recordLastWifiNetwork(String log) {
mHistory[mHistoryIndex] = log;
mHistoryIndex = (mHistoryIndex + 1) % HISTORY_SIZE;
}
/** Dump function. | WifiStatusTracker::dump | java | Reginer/aosp-android-jar | android-32/src/com/android/settingslib/wifi/WifiStatusTracker.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/settingslib/wifi/WifiStatusTracker.java | MIT |
public ClassCircularityError() {
super();
} |
Constructs a {@code ClassCircularityError} with no detail message.
| ClassCircularityError::ClassCircularityError | java | Reginer/aosp-android-jar | android-32/src/java/lang/ClassCircularityError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/lang/ClassCircularityError.java | MIT |
public ClassCircularityError(String s) {
super(s);
} |
Constructs a {@code ClassCircularityError} with the specified detail
message.
@param s
The detail message
| ClassCircularityError::ClassCircularityError | java | Reginer/aosp-android-jar | android-32/src/java/lang/ClassCircularityError.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/lang/ClassCircularityError.java | MIT |
public static String dumpHexString(@Nullable byte[] array) {
if (array == null) return "(null)";
return dumpHexString(array, 0, array.length);
} |
Dump the hex string corresponding to the specified byte array.
@param array byte array to be dumped.
| HexDump::dumpHexString | java | Reginer/aosp-android-jar | android-31/src/com/android/net/module/util/HexDump.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/net/module/util/HexDump.java | MIT |
public static String dumpHexString(@Nullable byte[] array, int offset, int length) {
if (array == null) return "(null)";
StringBuilder result = new StringBuilder();
byte[] line = new byte[16];
int lineIndex = 0;
result.append("\n0x");
result.append(toHexString(offset));
for (int i = offset; i < offset + length; i++) {
if (lineIndex == 16) {
result.append(" ");
for (int j = 0; j < 16; j++) {
if (line[j] > ' ' && line[j] < '~') {
result.append(new String(line, j, 1));
} else {
result.append(".");
}
}
result.append("\n0x");
result.append(toHexString(i));
lineIndex = 0;
}
byte b = array[i];
result.append(" ");
result.append(HEX_DIGITS[(b >>> 4) & 0x0F]);
result.append(HEX_DIGITS[b & 0x0F]);
line[lineIndex++] = b;
}
if (lineIndex != 16) {
int count = (16 - lineIndex) * 3;
count++;
for (int i = 0; i < count; i++) {
result.append(" ");
}
for (int i = 0; i < lineIndex; i++) {
if (line[i] > ' ' && line[i] < '~') {
result.append(new String(line, i, 1));
} else {
result.append(".");
}
}
}
return result.toString();
} |
Dump the hex string corresponding to the specified byte array.
@param array byte array to be dumped.
@param offset the offset in array where dump should start.
@param length the length of bytes to be dumped.
| HexDump::dumpHexString | java | Reginer/aosp-android-jar | android-31/src/com/android/net/module/util/HexDump.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/net/module/util/HexDump.java | MIT |
public static String toHexString(byte b) {
return toHexString(toByteArray(b));
} |
Convert a byte to an uppercase hex string.
@param b the byte to be converted.
| HexDump::toHexString | java | Reginer/aosp-android-jar | android-31/src/com/android/net/module/util/HexDump.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/net/module/util/HexDump.java | MIT |
public static String toHexString(byte[] array) {
return toHexString(array, 0, array.length, true);
} |
Convert a byte array to an uppercase hex string.
@param array the byte array to be converted.
| HexDump::toHexString | java | Reginer/aosp-android-jar | android-31/src/com/android/net/module/util/HexDump.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/net/module/util/HexDump.java | MIT |
public static String toHexString(byte[] array, boolean upperCase) {
return toHexString(array, 0, array.length, upperCase);
} |
Convert a byte array to a hex string.
@param array the byte array to be converted.
@param upperCase whether the converted hex string should be uppercase or not.
| HexDump::toHexString | java | Reginer/aosp-android-jar | android-31/src/com/android/net/module/util/HexDump.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/net/module/util/HexDump.java | MIT |
public static String toHexString(byte[] array, int offset, int length) {
return toHexString(array, offset, length, true);
} |
Convert a byte array to hex string.
@param array the byte array to be converted.
@param offset the offset in array where conversion should start.
@param length the length of bytes to be converted.
| HexDump::toHexString | java | Reginer/aosp-android-jar | android-31/src/com/android/net/module/util/HexDump.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/net/module/util/HexDump.java | MIT |
public static String toHexString(byte[] array, int offset, int length, boolean upperCase) {
char[] digits = upperCase ? HEX_DIGITS : HEX_LOWER_CASE_DIGITS;
char[] buf = new char[length * 2];
int bufIndex = 0;
for (int i = offset; i < offset + length; i++) {
byte b = array[i];
buf[bufIndex++] = digits[(b >>> 4) & 0x0F];
buf[bufIndex++] = digits[b & 0x0F];
}
return new String(buf);
} |
Convert a byte array to hex string.
@param array the byte array to be converted.
@param offset the offset in array where conversion should start.
@param length the length of bytes to be converted.
@param upperCase whether the converted hex string should be uppercase or not.
| HexDump::toHexString | java | Reginer/aosp-android-jar | android-31/src/com/android/net/module/util/HexDump.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/net/module/util/HexDump.java | MIT |
public static String toHexString(int i) {
return toHexString(toByteArray(i));
} |
Convert an integer to hex string.
@param i the integer to be converted.
| HexDump::toHexString | java | Reginer/aosp-android-jar | android-31/src/com/android/net/module/util/HexDump.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/net/module/util/HexDump.java | MIT |
public static byte[] toByteArray(byte b) {
byte[] array = new byte[1];
array[0] = b;
return array;
} |
Convert a byte to byte array.
@param b the byte to be converted.
| HexDump::toByteArray | java | Reginer/aosp-android-jar | android-31/src/com/android/net/module/util/HexDump.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/net/module/util/HexDump.java | MIT |
public static byte[] toByteArray(int i) {
byte[] array = new byte[4];
array[3] = (byte) (i & 0xFF);
array[2] = (byte) ((i >> 8) & 0xFF);
array[1] = (byte) ((i >> 16) & 0xFF);
array[0] = (byte) ((i >> 24) & 0xFF);
return array;
} |
Convert an integer to byte array.
@param i the integer to be converted.
| HexDump::toByteArray | java | Reginer/aosp-android-jar | android-31/src/com/android/net/module/util/HexDump.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/net/module/util/HexDump.java | MIT |
public static byte[] hexStringToByteArray(String hexString) {
int length = hexString.length();
byte[] buffer = new byte[length / 2];
for (int i = 0; i < length; i += 2) {
buffer[i / 2] =
(byte) ((toByte(hexString.charAt(i)) << 4) | toByte(hexString.charAt(i + 1)));
}
return buffer;
} |
Convert a hex string to a byte array.
@param hexString the string to be converted.
| HexDump::hexStringToByteArray | java | Reginer/aosp-android-jar | android-31/src/com/android/net/module/util/HexDump.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/net/module/util/HexDump.java | MIT |
public static StringBuilder appendByteAsHex(StringBuilder sb, byte b, boolean upperCase) {
char[] digits = upperCase ? HEX_DIGITS : HEX_LOWER_CASE_DIGITS;
sb.append(digits[(b >> 4) & 0xf]);
sb.append(digits[b & 0xf]);
return sb;
} |
Convert a byte to hex string and append it to StringBuilder.
@param sb StringBuilder instance.
@param b the byte to be converted.
@param upperCase whether the converted hex string should be uppercase or not.
| HexDump::appendByteAsHex | java | Reginer/aosp-android-jar | android-31/src/com/android/net/module/util/HexDump.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/net/module/util/HexDump.java | MIT |
public nodeinsertbeforedocfragment(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
| nodeinsertbeforedocfragment::nodeinsertbeforedocfragment | java | Reginer/aosp-android-jar | android-31/src/org/w3c/domts/level1/core/nodeinsertbeforedocfragment.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level1/core/nodeinsertbeforedocfragment.java | MIT |
public void runTest() throws Throwable {
Document doc;
NodeList elementList;
Node employeeNode;
NodeList childList;
Node refChild;
DocumentFragment newdocFragment;
Node newChild1;
Node newChild2;
Node child;
String childName;
Node appendedChild;
Node insertedNode;
doc = (Document) load("staff", true);
elementList = doc.getElementsByTagName("employee");
employeeNode = elementList.item(1);
childList = employeeNode.getChildNodes();
refChild = childList.item(3);
newdocFragment = doc.createDocumentFragment();
newChild1 = doc.createElement("newChild1");
newChild2 = doc.createElement("newChild2");
appendedChild = newdocFragment.appendChild(newChild1);
appendedChild = newdocFragment.appendChild(newChild2);
insertedNode = employeeNode.insertBefore(newdocFragment, refChild);
child = childList.item(3);
childName = child.getNodeName();
assertEquals("childName3", "newChild1", childName);
child = childList.item(4);
childName = child.getNodeName();
assertEquals("childName4", "newChild2", childName);
} |
Runs the test case.
@throws Throwable Any uncaught exception causes test to fail
| nodeinsertbeforedocfragment::runTest | java | Reginer/aosp-android-jar | android-31/src/org/w3c/domts/level1/core/nodeinsertbeforedocfragment.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level1/core/nodeinsertbeforedocfragment.java | MIT |
public String getTargetURI() {
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforedocfragment";
} |
Gets URI that identifies the test.
@return uri identifier of test
| nodeinsertbeforedocfragment::getTargetURI | java | Reginer/aosp-android-jar | android-31/src/org/w3c/domts/level1/core/nodeinsertbeforedocfragment.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level1/core/nodeinsertbeforedocfragment.java | MIT |
public static void main(final String[] args) {
DOMTestCase.doMain(nodeinsertbeforedocfragment.class, args);
} |
Runs this test from the command line.
@param args command line arguments
| nodeinsertbeforedocfragment::main | java | Reginer/aosp-android-jar | android-31/src/org/w3c/domts/level1/core/nodeinsertbeforedocfragment.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level1/core/nodeinsertbeforedocfragment.java | MIT |
public LocalServerSocket(String name) throws IOException
{
impl = new LocalSocketImpl();
impl.create(LocalSocket.SOCKET_STREAM);
localAddress = new LocalSocketAddress(name);
impl.bind(localAddress);
impl.listen(LISTEN_BACKLOG);
} |
Creates a new server socket listening at specified name.
On the Android platform, the name is created in the Linux
abstract namespace (instead of on the filesystem).
@param name address for socket
@throws IOException
| LocalServerSocket::LocalServerSocket | java | Reginer/aosp-android-jar | android-33/src/android/net/LocalServerSocket.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalServerSocket.java | MIT |
public LocalServerSocket(FileDescriptor fd) throws IOException
{
impl = new LocalSocketImpl(fd);
impl.listen(LISTEN_BACKLOG);
localAddress = impl.getSockAddress();
} |
Create a LocalServerSocket from a file descriptor that's already
been created and bound. listen() will be called immediately on it.
Used for cases where file descriptors are passed in via environment
variables. The passed-in FileDescriptor is not managed by this class
and must be closed by the caller. Calling {@link #close()} on a socket
created by this method has no effect.
@param fd bound file descriptor
@throws IOException
| LocalServerSocket::LocalServerSocket | java | Reginer/aosp-android-jar | android-33/src/android/net/LocalServerSocket.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalServerSocket.java | MIT |
public LocalSocketAddress getLocalSocketAddress()
{
return localAddress;
} |
Obtains the socket's local address
@return local address
| LocalServerSocket::getLocalSocketAddress | java | Reginer/aosp-android-jar | android-33/src/android/net/LocalServerSocket.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalServerSocket.java | MIT |
public LocalSocket accept() throws IOException
{
LocalSocketImpl acceptedImpl = new LocalSocketImpl();
impl.accept(acceptedImpl);
return LocalSocket.createLocalSocketForAccept(acceptedImpl);
} |
Accepts a new connection to the socket. Blocks until a new
connection arrives.
@return a socket representing the new connection.
@throws IOException
| LocalServerSocket::accept | java | Reginer/aosp-android-jar | android-33/src/android/net/LocalServerSocket.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalServerSocket.java | MIT |
public FileDescriptor getFileDescriptor() {
return impl.getFileDescriptor();
} |
Returns file descriptor or null if not yet open/already closed
@return fd or null
| LocalServerSocket::getFileDescriptor | java | Reginer/aosp-android-jar | android-33/src/android/net/LocalServerSocket.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalServerSocket.java | MIT |
@Override public void close() throws IOException
{
impl.close();
} |
Closes server socket.
@throws IOException
| LocalServerSocket::close | java | Reginer/aosp-android-jar | android-33/src/android/net/LocalServerSocket.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/net/LocalServerSocket.java | MIT |
public ICUException() {
} |
Default constructor.
| ICUException::ICUException | java | Reginer/aosp-android-jar | android-34/src/android/icu/util/ICUException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/icu/util/ICUException.java | MIT |
public ICUException(String message) {
super(message);
} |
Constructor.
@param message exception message string
| ICUException::ICUException | java | Reginer/aosp-android-jar | android-34/src/android/icu/util/ICUException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/icu/util/ICUException.java | MIT |
public ICUException(Throwable cause) {
super(cause);
} |
Constructor.
@param cause original exception
| ICUException::ICUException | java | Reginer/aosp-android-jar | android-34/src/android/icu/util/ICUException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/icu/util/ICUException.java | MIT |
public ICUException(String message, Throwable cause) {
super(message, cause);
} |
Constructor.
@param message exception message string
@param cause original exception
| ICUException::ICUException | java | Reginer/aosp-android-jar | android-34/src/android/icu/util/ICUException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/icu/util/ICUException.java | MIT |
public AppWidgetHostView(Context context) {
this(context, android.R.anim.fade_in, android.R.anim.fade_out);
} |
Create a host view. Uses default fade animations.
| AppWidgetHostView::AppWidgetHostView | java | Reginer/aosp-android-jar | android-34/src/android/appwidget/AppWidgetHostView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/appwidget/AppWidgetHostView.java | MIT |
public AppWidgetHostView(Context context, InteractionHandler handler) {
this(context, android.R.anim.fade_in, android.R.anim.fade_out);
mInteractionHandler = getHandler(handler);
} |
@hide
| AppWidgetHostView::AppWidgetHostView | java | Reginer/aosp-android-jar | android-34/src/android/appwidget/AppWidgetHostView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/appwidget/AppWidgetHostView.java | MIT |
public void setInteractionHandler(InteractionHandler handler) {
mInteractionHandler = getHandler(handler);
} |
Pass the given handler to RemoteViews when updating this widget. Unless this
is done immediatly after construction, a call to {@link #updateAppWidget(RemoteViews)}
should be made.
@param handler
@hide
| AppWidgetHostView::setInteractionHandler | java | Reginer/aosp-android-jar | android-34/src/android/appwidget/AppWidgetHostView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/appwidget/AppWidgetHostView.java | MIT |
public void setAppWidget(int appWidgetId, AppWidgetProviderInfo info) {
mAppWidgetId = appWidgetId;
mInfo = info;
// We add padding to the AppWidgetHostView if necessary
Rect padding = getDefaultPadding();
setPadding(padding.left, padding.top, padding.right, padding.bottom);
// Sometimes the AppWidgetManager returns a null AppWidgetProviderInfo object for
// a widget, eg. for some widgets in safe mode.
if (info != null) {
String description = info.loadLabel(getContext().getPackageManager());
if ((info.providerInfo.applicationInfo.flags & ApplicationInfo.FLAG_SUSPENDED) != 0) {
description = Resources.getSystem().getString(
com.android.internal.R.string.suspended_widget_accessibility, description);
}
setContentDescription(description);
}
} |
Set the AppWidget that will be displayed by this view. This method also adds default padding
to widgets, as described in {@link #getDefaultPaddingForWidget(Context, ComponentName, Rect)}
and can be overridden in order to add custom padding.
| AppWidgetHostView::setAppWidget | java | Reginer/aosp-android-jar | android-34/src/android/appwidget/AppWidgetHostView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/appwidget/AppWidgetHostView.java | MIT |
public static Rect getDefaultPaddingForWidget(Context context, ComponentName component,
Rect padding) {
return getDefaultPaddingForWidget(context, padding);
} |
As of ICE_CREAM_SANDWICH we are automatically adding padding to widgets targeting
ICE_CREAM_SANDWICH and higher. The new widget design guidelines strongly recommend
that widget developers do not add extra padding to their widgets. This will help
achieve consistency among widgets.
Note: this method is only needed by developers of AppWidgetHosts. The method is provided in
order for the AppWidgetHost to account for the automatic padding when computing the number
of cells to allocate to a particular widget.
@param context the current context
@param component the component name of the widget
@param padding Rect in which to place the output, if null, a new Rect will be allocated and
returned
@return default padding for this widget, in pixels
| AppWidgetHostView::getDefaultPaddingForWidget | java | Reginer/aosp-android-jar | android-34/src/android/appwidget/AppWidgetHostView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/appwidget/AppWidgetHostView.java | MIT |
private void handleViewError() {
removeViewInLayout(mView);
View child = getErrorView();
prepareView(child);
addViewInLayout(child, 0, child.getLayoutParams());
measureChild(child, MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY));
child.layout(0, 0, child.getMeasuredWidth() + mPaddingLeft + mPaddingRight,
child.getMeasuredHeight() + mPaddingTop + mPaddingBottom);
mView = child;
mViewMode = VIEW_MODE_ERROR;
} |
Remove bad view and replace with error message view
| AppWidgetHostView::handleViewError | java | Reginer/aosp-android-jar | android-34/src/android/appwidget/AppWidgetHostView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/appwidget/AppWidgetHostView.java | MIT |
public void updateAppWidgetSize(@NonNull Bundle newOptions, @NonNull List<SizeF> sizes) {
AppWidgetManager widgetManager = AppWidgetManager.getInstance(mContext);
Rect padding = getDefaultPadding();
float density = getResources().getDisplayMetrics().density;
float xPaddingDips = (padding.left + padding.right) / density;
float yPaddingDips = (padding.top + padding.bottom) / density;
ArrayList<SizeF> paddedSizes = new ArrayList<>(sizes.size());
float minWidth = Float.MAX_VALUE;
float maxWidth = 0;
float minHeight = Float.MAX_VALUE;
float maxHeight = 0;
for (int i = 0; i < sizes.size(); i++) {
SizeF size = sizes.get(i);
SizeF paddedSize = new SizeF(Math.max(0.f, size.getWidth() - xPaddingDips),
Math.max(0.f, size.getHeight() - yPaddingDips));
paddedSizes.add(paddedSize);
minWidth = Math.min(minWidth, paddedSize.getWidth());
maxWidth = Math.max(maxWidth, paddedSize.getWidth());
minHeight = Math.min(minHeight, paddedSize.getHeight());
maxHeight = Math.max(maxHeight, paddedSize.getHeight());
}
if (paddedSizes.equals(
widgetManager.getAppWidgetOptions(mAppWidgetId).<SizeF>getParcelableArrayList(
AppWidgetManager.OPTION_APPWIDGET_SIZES))) {
return;
}
Bundle options = newOptions.deepCopy();
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH, (int) minWidth);
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, (int) minHeight);
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH, (int) maxWidth);
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT, (int) maxHeight);
options.putParcelableArrayList(AppWidgetManager.OPTION_APPWIDGET_SIZES, paddedSizes);
updateAppWidgetOptions(options);
} |
Provide guidance about the size of this widget to the AppWidgetManager. The sizes should
correspond to the full area the AppWidgetHostView is given. Padding added by the framework
will be accounted for automatically.
This method will update the option bundle with the list of sizes and the min/max bounds for
width and height.
@see AppWidgetProvider#onAppWidgetOptionsChanged(Context, AppWidgetManager, int, Bundle)
@param newOptions The bundle of options, in addition to the size information.
@param sizes Sizes, in dips, the widget may be displayed at without calling the provider
again. Typically, this will be size of the widget in landscape and portrait.
On some foldables, this might include the size on the outer and inner screens.
| AppWidgetHostView::updateAppWidgetSize | java | Reginer/aosp-android-jar | android-34/src/android/appwidget/AppWidgetHostView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/appwidget/AppWidgetHostView.java | MIT |
public void updateAppWidgetOptions(Bundle options) {
AppWidgetManager.getInstance(mContext).updateAppWidgetOptions(mAppWidgetId, options);
} |
Specify some extra information for the widget provider. Causes a callback to the
AppWidgetProvider.
@see AppWidgetProvider#onAppWidgetOptionsChanged(Context, AppWidgetManager, int, Bundle)
@param options The bundle of options information.
| AppWidgetHostView::updateAppWidgetOptions | java | Reginer/aosp-android-jar | android-34/src/android/appwidget/AppWidgetHostView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/appwidget/AppWidgetHostView.java | MIT |
public void setExecutor(Executor executor) {
if (mLastExecutionSignal != null) {
mLastExecutionSignal.cancel();
mLastExecutionSignal = null;
}
mAsyncExecutor = executor;
} |
Sets an executor which can be used for asynchronously inflating. CPU intensive tasks like
view inflation or loading images will be performed on the executor. The updates will still
be applied on the UI thread.
@param executor the executor to use or null.
| AppWidgetHostView::setExecutor | java | Reginer/aosp-android-jar | android-34/src/android/appwidget/AppWidgetHostView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/appwidget/AppWidgetHostView.java | MIT |
public void setOnLightBackground(boolean onLightBackground) {
mOnLightBackground = onLightBackground;
} |
Sets whether the widget is being displayed on a light/white background and use an
alternate UI if available.
@see RemoteViews#setLightBackgroundLayoutId(int)
| AppWidgetHostView::setOnLightBackground | java | Reginer/aosp-android-jar | android-34/src/android/appwidget/AppWidgetHostView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/appwidget/AppWidgetHostView.java | MIT |
private void reapplyLastRemoteViews() {
SparseArray<Parcelable> savedState = new SparseArray<>();
saveHierarchyState(savedState);
applyRemoteViews(mLastInflatedRemoteViews, true);
restoreHierarchyState(savedState);
} |
Reapply the last inflated remote views, or the default view is none was inflated.
| AppWidgetHostView::reapplyLastRemoteViews | java | Reginer/aosp-android-jar | android-34/src/android/appwidget/AppWidgetHostView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/appwidget/AppWidgetHostView.java | MIT |
protected void applyRemoteViews(@Nullable RemoteViews remoteViews, boolean useAsyncIfPossible) {
boolean recycled = false;
View content = null;
Exception exception = null;
// Block state restore until the end of the apply.
mLastInflatedRemoteViewsId = -1;
if (mLastExecutionSignal != null) {
mLastExecutionSignal.cancel();
mLastExecutionSignal = null;
}
if (remoteViews == null) {
if (mViewMode == VIEW_MODE_DEFAULT) {
// We've already done this -- nothing to do.
return;
}
content = getDefaultView();
mViewMode = VIEW_MODE_DEFAULT;
} else {
// Select the remote view we are actually going to apply.
RemoteViews rvToApply = remoteViews.getRemoteViewsToApply(mContext, mCurrentSize);
if (mOnLightBackground) {
rvToApply = rvToApply.getDarkTextViews();
}
if (mAsyncExecutor != null && useAsyncIfPossible) {
inflateAsync(rvToApply);
return;
}
// Prepare a local reference to the remote Context so we're ready to
// inflate any requested LayoutParams.
mRemoteContext = getRemoteContextEnsuringCorrectCachedApkPath();
if (!mColorMappingChanged && rvToApply.canRecycleView(mView)) {
try {
rvToApply.reapply(mContext, mView, mInteractionHandler, mCurrentSize,
mColorResources);
content = mView;
mLastInflatedRemoteViewsId = rvToApply.computeUniqueId(remoteViews);
recycled = true;
if (LOGD) Log.d(TAG, "was able to recycle existing layout");
} catch (RuntimeException e) {
exception = e;
}
}
// Try normal RemoteView inflation
if (content == null) {
try {
content = rvToApply.apply(mContext, this, mInteractionHandler,
mCurrentSize, mColorResources);
mLastInflatedRemoteViewsId = rvToApply.computeUniqueId(remoteViews);
if (LOGD) Log.d(TAG, "had to inflate new layout");
} catch (RuntimeException e) {
exception = e;
}
}
mViewMode = VIEW_MODE_CONTENT;
}
applyContent(content, recycled, exception);
} |
@hide
| AppWidgetHostView::applyRemoteViews | java | Reginer/aosp-android-jar | android-34/src/android/appwidget/AppWidgetHostView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/appwidget/AppWidgetHostView.java | MIT |
protected Context getRemoteContextEnsuringCorrectCachedApkPath() {
try {
ApplicationInfo expectedAppInfo = mInfo.providerInfo.applicationInfo;
LoadedApk.checkAndUpdateApkPaths(expectedAppInfo);
// Return if cloned successfully, otherwise default
Context newContext = mContext.createApplicationContext(
mInfo.providerInfo.applicationInfo,
Context.CONTEXT_RESTRICTED);
if (mColorResources != null) {
mColorResources.apply(newContext);
}
return newContext;
} catch (NameNotFoundException e) {
Log.e(TAG, "Package name " + mInfo.providerInfo.packageName + " not found");
return mContext;
} catch (NullPointerException e) {
Log.e(TAG, "Error trying to create the remote context.", e);
return mContext;
}
} |
Build a {@link Context} cloned into another package name, usually for the
purposes of reading remote resources.
@hide
| ViewApplyListener::getRemoteContextEnsuringCorrectCachedApkPath | java | Reginer/aosp-android-jar | android-34/src/android/appwidget/AppWidgetHostView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/appwidget/AppWidgetHostView.java | MIT |
protected void prepareView(View view) {
// Take requested dimensions from child, but apply default gravity.
FrameLayout.LayoutParams requested = (FrameLayout.LayoutParams)view.getLayoutParams();
if (requested == null) {
requested = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT);
}
requested.gravity = Gravity.CENTER;
view.setLayoutParams(requested);
} |
Prepare the given view to be shown. This might include adjusting
{@link FrameLayout.LayoutParams} before inserting.
| ViewApplyListener::prepareView | java | Reginer/aosp-android-jar | android-34/src/android/appwidget/AppWidgetHostView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/appwidget/AppWidgetHostView.java | MIT |
protected View getDefaultView() {
if (LOGD) {
Log.d(TAG, "getDefaultView");
}
View defaultView = null;
Exception exception = null;
try {
if (mInfo != null) {
Context theirContext = getRemoteContextEnsuringCorrectCachedApkPath();
mRemoteContext = theirContext;
LayoutInflater inflater = (LayoutInflater)
theirContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater = inflater.cloneInContext(theirContext);
inflater.setFilter(INFLATER_FILTER);
AppWidgetManager manager = AppWidgetManager.getInstance(mContext);
Bundle options = manager.getAppWidgetOptions(mAppWidgetId);
int layoutId = mInfo.initialLayout;
if (options.containsKey(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY)) {
int category = options.getInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY);
if (category == AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD) {
int kgLayoutId = mInfo.initialKeyguardLayout;
// If a default keyguard layout is not specified, use the standard
// default layout.
layoutId = kgLayoutId == 0 ? layoutId : kgLayoutId;
}
}
defaultView = inflater.inflate(layoutId, this, false);
if (!(defaultView instanceof AdapterView)) {
// AdapterView does not support onClickListener
defaultView.setOnClickListener(this::onDefaultViewClicked);
}
} else {
Log.w(TAG, "can't inflate defaultView because mInfo is missing");
}
} catch (RuntimeException e) {
exception = e;
}
if (exception != null) {
Log.w(TAG, "Error inflating AppWidget " + mInfo, exception);
}
if (defaultView == null) {
if (LOGD) Log.d(TAG, "getDefaultView couldn't find any view, so inflating error");
defaultView = getErrorView();
}
return defaultView;
} |
Inflate and return the default layout requested by AppWidget provider.
| ViewApplyListener::getDefaultView | java | Reginer/aosp-android-jar | android-34/src/android/appwidget/AppWidgetHostView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/appwidget/AppWidgetHostView.java | MIT |
public EapTtlsParsingException(String message) {
super(message);
} |
Construct an instance of EapTtlsParsingException with the specified detail message.
@param message the detail message.
| EapTtlsParsingException::EapTtlsParsingException | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/net/eap/exceptions/ttls/EapTtlsParsingException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/net/eap/exceptions/ttls/EapTtlsParsingException.java | MIT |
public EapTtlsParsingException(String message, Throwable cause) {
super(message, cause);
} |
Construct an instance of EapTtlsParsingException with the specified message and cause.
@param message the detail message.
@param cause the cause.
| EapTtlsParsingException::EapTtlsParsingException | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/net/eap/exceptions/ttls/EapTtlsParsingException.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/net/eap/exceptions/ttls/EapTtlsParsingException.java | MIT |
public hc_nodegetnextsibling(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException {
super(factory);
//
// check if loaded documents are supported for content type
//
String contentType = getContentType();
preload(contentType, "hc_staff", false);
} |
Constructor.
@param factory document factory, may not be null
@throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
| hc_nodegetnextsibling::hc_nodegetnextsibling | java | Reginer/aosp-android-jar | android-34/src/org/w3c/domts/level1/core/hc_nodegetnextsibling.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/hc_nodegetnextsibling.java | MIT |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.