code
stringlengths
11
173k
docstring
stringlengths
2
593k
func_name
stringlengths
2
189
language
stringclasses
1 value
repo
stringclasses
844 values
path
stringlengths
11
294
url
stringlengths
60
339
license
stringclasses
4 values
public void close() throws IOException { mSocket.close(); }
BluetoothOutputStream. <p>Used to read from a Bluetooth socket. @hide @SuppressLint("AndroidFrameworkBluetoothPermission") /*package*/ final class BluetoothOutputStream extends OutputStream { private BluetoothSocket mSocket; /*package*/ BluetoothOutputStream(BluetoothSocket s) { mSocket = s; } /** Close this output stream and the socket associated with it.
BluetoothOutputStream::close
java
Reginer/aosp-android-jar
android-35/src/android/bluetooth/BluetoothOutputStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/bluetooth/BluetoothOutputStream.java
MIT
public void write(int oneByte) throws IOException { byte[] b = new byte[1]; b[0] = (byte) oneByte; mSocket.write(b, 0, 1); }
Writes a single byte to this stream. Only the least significant byte of the integer {@code oneByte} is written to the stream. @param oneByte the byte to be written. @throws IOException if an error occurs while writing to this stream. @since Android 1.0
BluetoothOutputStream::write
java
Reginer/aosp-android-jar
android-35/src/android/bluetooth/BluetoothOutputStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/bluetooth/BluetoothOutputStream.java
MIT
public void write(byte[] b, int offset, int count) throws IOException { if (b == null) { throw new NullPointerException("buffer is null"); } if ((offset | count) < 0 || count > b.length - offset) { throw new IndexOutOfBoundsException("invalid offset or length"); } mSocket.write(b, offset, count); }
Writes {@code count} bytes from the byte array {@code buffer} starting at position {@code offset} to this stream. @param b the buffer to be written. @param offset the start position in {@code buffer} from where to get bytes. @param count the number of bytes from {@code buffer} to write to this stream. @throws IOException if an error occurs while writing to this stream. @throws IndexOutOfBoundsException if {@code offset < 0} or {@code count < 0}, or if {@code offset + count} is bigger than the length of {@code buffer}. @since Android 1.0
BluetoothOutputStream::write
java
Reginer/aosp-android-jar
android-35/src/android/bluetooth/BluetoothOutputStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/bluetooth/BluetoothOutputStream.java
MIT
@Nullable TaskSnapshot getSnapshot(int taskId, int userId, boolean restoreFromDisk, boolean isLowResolution) { final TaskSnapshot snapshot = getSnapshot(taskId); if (snapshot != null) { return snapshot; } // Try to restore from disk if asked. if (!restoreFromDisk) { return null; } return tryRestoreFromDisk(taskId, userId, isLowResolution); }
If {@param restoreFromDisk} equals {@code true}, DO NOT HOLD THE WINDOW MANAGER LOCK!
TaskSnapshotCache::getSnapshot
java
Reginer/aosp-android-jar
android-35/src/com/android/server/wm/TaskSnapshotCache.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/TaskSnapshotCache.java
MIT
private TaskSnapshot tryRestoreFromDisk(int taskId, int userId, boolean isLowResolution) { return mLoader.loadTask(taskId, userId, isLowResolution); }
DO NOT HOLD THE WINDOW MANAGER LOCK WHEN CALLING THIS METHOD!
TaskSnapshotCache::tryRestoreFromDisk
java
Reginer/aosp-android-jar
android-35/src/com/android/server/wm/TaskSnapshotCache.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/TaskSnapshotCache.java
MIT
public SingleScanSettings() { }
SingleScanSettings for wificond @hide public class SingleScanSettings implements Parcelable { private static final String TAG = "SingleScanSettings"; public int scanType; public boolean enable6GhzRnr; public ArrayList<ChannelSettings> channelSettings; public ArrayList<HiddenNetwork> hiddenNetworks; public byte[] vendorIes; /** public constructor
SingleScanSettings::SingleScanSettings
java
Reginer/aosp-android-jar
android-34/src/android/net/wifi/nl80211/SingleScanSettings.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/net/wifi/nl80211/SingleScanSettings.java
MIT
public ExtensionVersionImpl() { }
@hide
ExtensionVersionImpl::ExtensionVersionImpl
java
Reginer/aosp-android-jar
android-34/src/androidx/camera/extensions/impl/ExtensionVersionImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/androidx/camera/extensions/impl/ExtensionVersionImpl.java
MIT
public String checkApiVersion(String version) { Log.d(TAG, "Extension device library version " + VERSION); return VERSION; }
@hide
ExtensionVersionImpl::checkApiVersion
java
Reginer/aosp-android-jar
android-34/src/androidx/camera/extensions/impl/ExtensionVersionImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/androidx/camera/extensions/impl/ExtensionVersionImpl.java
MIT
protected void setupActionBar() { // Nothing to do here. }
Returns a wrapper around different implementations of the Action Bar to provide a common API. @param decorContent the top level view returned by inflating ?attr/windowActionBarFullscreenDecorLayout @NonNull public static FrameworkActionBarWrapper getActionBarWrapper(@NonNull BridgeContext context, @NonNull ActionBarCallback callback, @NonNull View decorContent) { View view = decorContent.findViewById(R.id.action_bar); if (view instanceof Toolbar) { return new ToolbarWrapper(context, callback, (Toolbar) view); } else if (view instanceof ActionBarView) { return new WindowActionBarWrapper(context, callback, decorContent, (ActionBarView) view); } else { throw new IllegalStateException("Can't make an action bar out of " + view.getClass().getSimpleName()); } } FrameworkActionBarWrapper(@NonNull BridgeContext context, @NonNull ActionBarCallback callback, @NonNull ActionBar actionBar) { mActionBar = actionBar; mCallback = callback; mContext = context; } /** A call to setup any custom properties.
FrameworkActionBarWrapper::setupActionBar
java
Reginer/aosp-android-jar
android-31/src/com/android/layoutlib/bridge/bars/FrameworkActionBarWrapper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/layoutlib/bridge/bars/FrameworkActionBarWrapper.java
MIT
protected void inflateMenus() { MenuInflater inflater = new MenuInflater(getActionMenuContext()); MenuBuilder menuBuilder = getMenuBuilder(); for (ResourceReference menuId : mCallback.getMenuIds()) { int id = mContext.getResourceId(menuId, -1); if (id >= 0) { inflater.inflate(id, menuBuilder); } } }
Gets the menus to add to the action bar from the callback, resolves them, inflates them and adds them to the action bar.
FrameworkActionBarWrapper::inflateMenus
java
Reginer/aosp-android-jar
android-31/src/com/android/layoutlib/bridge/bars/FrameworkActionBarWrapper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/layoutlib/bridge/bars/FrameworkActionBarWrapper.java
MIT
public static int packData(byte[] message, int offset, int size, long timestamp, byte[] dest) { if (size > MAX_PACKET_DATA_SIZE) { size = MAX_PACKET_DATA_SIZE; } int length = 0; // packet type goes first dest[length++] = PACKET_TYPE_DATA; // data goes next System.arraycopy(message, offset, dest, length, size); length += size; // followed by timestamp for (int i = 0; i < TIMESTAMP_SIZE; i++) { dest[length++] = (byte)timestamp; timestamp >>= 8; } return length; }
Utility function for packing MIDI data to be passed between processes message byte array contains variable length MIDI message. messageSize is size of variable length MIDI message timestamp is message timestamp to pack dest is buffer to pack into returns size of packed message
MidiPortImpl::packData
java
Reginer/aosp-android-jar
android-31/src/android/media/midi/MidiPortImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/media/midi/MidiPortImpl.java
MIT
public static int packFlush(byte[] dest) { dest[0] = PACKET_TYPE_FLUSH; return 1; }
Utility function for packing a flush command to be passed between processes
MidiPortImpl::packFlush
java
Reginer/aosp-android-jar
android-31/src/android/media/midi/MidiPortImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/media/midi/MidiPortImpl.java
MIT
public static int getPacketType(byte[] buffer, int bufferLength) { return buffer[0]; }
Returns the packet type (PACKET_TYPE_DATA or PACKET_TYPE_FLUSH)
MidiPortImpl::getPacketType
java
Reginer/aosp-android-jar
android-31/src/android/media/midi/MidiPortImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/media/midi/MidiPortImpl.java
MIT
public static int getDataOffset(byte[] buffer, int bufferLength) { // data follows packet type byte return 1; }
Utility function for unpacking MIDI data received from other process returns the offset of the MIDI message in packed buffer
MidiPortImpl::getDataOffset
java
Reginer/aosp-android-jar
android-31/src/android/media/midi/MidiPortImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/media/midi/MidiPortImpl.java
MIT
public static int getDataSize(byte[] buffer, int bufferLength) { // message length is total buffer length minus size of the timestamp return bufferLength - DATA_PACKET_OVERHEAD; }
Utility function for unpacking MIDI data received from other process returns size of MIDI data in packed buffer
MidiPortImpl::getDataSize
java
Reginer/aosp-android-jar
android-31/src/android/media/midi/MidiPortImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/media/midi/MidiPortImpl.java
MIT
public static long getPacketTimestamp(byte[] buffer, int bufferLength) { // timestamp is at end of the packet int offset = bufferLength; long timestamp = 0; for (int i = 0; i < TIMESTAMP_SIZE; i++) { int b = (int)buffer[--offset] & 0xFF; timestamp = (timestamp << 8) | b; } return timestamp; }
Utility function for unpacking MIDI data received from other process unpacks timestamp from packed buffer
MidiPortImpl::getPacketTimestamp
java
Reginer/aosp-android-jar
android-31/src/android/media/midi/MidiPortImpl.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/media/midi/MidiPortImpl.java
MIT
public static boolean isCompatSignatureUpdateNeeded(Settings.VersionInfo ver) { return ver.databaseVersion < Settings.DatabaseVersion.SIGNATURE_END_ENTITY; }
If the database version for this type of package (internal storage or external storage) is less than the version where package signatures were updated, return true.
ReconcilePackageUtils::isCompatSignatureUpdateNeeded
java
Reginer/aosp-android-jar
android-34/src/com/android/server/pm/ReconcilePackageUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/pm/ReconcilePackageUtils.java
MIT
public PermissionManager(@NonNull Context context) throws ServiceManager.ServiceNotFoundException { mContext = context; mPackageManager = AppGlobals.getPackageManager(); mPermissionManager = IPermissionManager.Stub.asInterface(ServiceManager.getServiceOrThrow( "permissionmgr")); mLegacyPermissionManager = context.getSystemService(LegacyPermissionManager.class); //TODO ntmyren: there should be a way to only enable the watcher when requested mUsageHelper = new PermissionUsageHelper(context); }
Creates a new instance. @param context The current context in which to operate @hide
getName::PermissionManager
java
Reginer/aosp-android-jar
android-31/src/android/permission/PermissionManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/permission/PermissionManager.java
MIT
public @NonNull String getSplitPermission() { return mSplitPermissionInfoParcelable.getSplitPermission(); }
Get the permission that is split.
SplitPermissionInfo::getSplitPermission
java
Reginer/aosp-android-jar
android-31/src/android/permission/PermissionManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/permission/PermissionManager.java
MIT
public @NonNull List<String> getNewPermissions() { return mSplitPermissionInfoParcelable.getNewPermissions(); }
Get the permissions that are added.
SplitPermissionInfo::getNewPermissions
java
Reginer/aosp-android-jar
android-31/src/android/permission/PermissionManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/permission/PermissionManager.java
MIT
public int getTargetSdk() { return mSplitPermissionInfoParcelable.getTargetSdk(); }
Get the target API level when the permission was split.
SplitPermissionInfo::getTargetSdk
java
Reginer/aosp-android-jar
android-31/src/android/permission/PermissionManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/permission/PermissionManager.java
MIT
public SplitPermissionInfo(@NonNull String splitPerm, @NonNull List<String> newPerms, int targetSdk) { this(new SplitPermissionInfoParcelable(splitPerm, newPerms, targetSdk)); }
Constructs a split permission. @param splitPerm old permission that will be split @param newPerms list of new permissions that {@code rootPerm} will be split into @param targetSdk apps targetting SDK versions below this will have {@code rootPerm} split into {@code newPerms} @hide
SplitPermissionInfo::SplitPermissionInfo
java
Reginer/aosp-android-jar
android-31/src/android/permission/PermissionManager.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/permission/PermissionManager.java
MIT
public static File getEmbmsTempFileDir(Context context) { SharedPreferences prefs = context.getSharedPreferences(TEMP_FILE_ROOT_PREF_FILE_NAME, 0); String storedTempFileRoot = prefs.getString(TEMP_FILE_ROOT_PREF_NAME, null); try { if (storedTempFileRoot != null) { return new File(storedTempFileRoot).getCanonicalFile(); } else { return new File(context.getFilesDir(), MbmsDownloadSession.DEFAULT_TOP_LEVEL_TEMP_DIRECTORY).getCanonicalFile(); } } catch (IOException e) { throw new RuntimeException("Unable to canonicalize temp file root path " + e); } }
Returns a File for the directory used to store temp files for this app
MbmsTempFileProvider::getEmbmsTempFileDir
java
Reginer/aosp-android-jar
android-31/src/android/telephony/mbms/MbmsTempFileProvider.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/mbms/MbmsTempFileProvider.java
MIT
public boolean wouldLaunchResolverActivity(Intent intent, int currentUserId) { ActivityInfo targetActivityInfo = getTargetActivityInfo(intent, currentUserId, false /* onlyDirectBootAware */); return targetActivityInfo == null; }
Determines if sending the given intent would result in starting an Intent resolver activity, instead of resolving to a specific component. @param intent the intent @param currentUserId the id for the user to resolve as @return true if the intent would launch a resolver activity
ActivityIntentHelper::wouldLaunchResolverActivity
java
Reginer/aosp-android-jar
android-31/src/com/android/systemui/ActivityIntentHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/systemui/ActivityIntentHelper.java
MIT
public ActivityInfo getTargetActivityInfo(Intent intent, int currentUserId, boolean onlyDirectBootAware) { PackageManager packageManager = mContext.getPackageManager(); int flags = PackageManager.MATCH_DEFAULT_ONLY; if (!onlyDirectBootAware) { flags |= PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE; } final List<ResolveInfo> appList = packageManager.queryIntentActivitiesAsUser( intent, flags, currentUserId); if (appList.size() == 0) { return null; } ResolveInfo resolved = packageManager.resolveActivityAsUser(intent, flags | PackageManager.GET_META_DATA, currentUserId); if (resolved == null || wouldLaunchResolverActivity(resolved, appList)) { return null; } else { return resolved.activityInfo; } }
Returns info about the target Activity of a given intent, or null if the intent does not resolve to a specific component meeting the requirements. @param onlyDirectBootAware a boolean indicating whether the matched activity packages must be direct boot aware when in direct boot mode if false, all packages are considered a match even if they are not aware. @return the target activity info of the intent it resolves to a specific package or {@code null} if it resolved to the resolver activity
ActivityIntentHelper::getTargetActivityInfo
java
Reginer/aosp-android-jar
android-31/src/com/android/systemui/ActivityIntentHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/systemui/ActivityIntentHelper.java
MIT
public boolean wouldShowOverLockscreen(Intent intent, int currentUserId) { ActivityInfo targetActivityInfo = getTargetActivityInfo(intent, currentUserId, false /* onlyDirectBootAware */); return targetActivityInfo != null && (targetActivityInfo.flags & (ActivityInfo.FLAG_SHOW_WHEN_LOCKED | ActivityInfo.FLAG_SHOW_FOR_ALL_USERS)) > 0; }
Determines if the given intent resolves to an Activity which is allowed to appear above the lock screen. @param intent the intent to resolve @return true if the launched Activity would appear above the lock screen
ActivityIntentHelper::wouldShowOverLockscreen
java
Reginer/aosp-android-jar
android-31/src/com/android/systemui/ActivityIntentHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/systemui/ActivityIntentHelper.java
MIT
public boolean wouldLaunchResolverActivity(ResolveInfo resolved, List<ResolveInfo> appList) { // If the list contains the above resolved activity, then it can't be // ResolverActivity itself. for (int i = 0; i < appList.size(); i++) { ResolveInfo tmp = appList.get(i); if (tmp.activityInfo.name.equals(resolved.activityInfo.name) && tmp.activityInfo.packageName.equals(resolved.activityInfo.packageName)) { return false; } } return true; }
Determines if sending the given intent would result in starting an Intent resolver activity, instead of resolving to a specific component. @param resolved the resolveInfo for the intent as returned by resolveActivityAsUser @param appList a list of resolveInfo as returned by queryIntentActivitiesAsUser @return true if the intent would launch a resolver activity
ActivityIntentHelper::wouldLaunchResolverActivity
java
Reginer/aosp-android-jar
android-31/src/com/android/systemui/ActivityIntentHelper.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/systemui/ActivityIntentHelper.java
MIT
public attrremovechild1(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
attrremovechild1::attrremovechild1
java
Reginer/aosp-android-jar
android-31/src/org/w3c/domts/level1/core/attrremovechild1.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level1/core/attrremovechild1.java
MIT
public void runTest() throws Throwable { Document doc; EntityReference entRef; Element entElement; Node attrNode; Text textNode; Node removedNode; doc = (Document) load("staff", true); entRef = doc.createEntityReference("ent4"); assertNotNull("createdEntRefNotNull", entRef); entElement = (Element) entRef.getFirstChild(); assertNotNull("entElementNotNull", entElement); attrNode = entElement.getAttributeNode("domestic"); textNode = (Text) attrNode.getFirstChild(); assertNotNull("attrChildNotNull", textNode); { boolean success = false; try { removedNode = attrNode.removeChild(textNode); } catch (DOMException ex) { success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR); } assertTrue("setValue_throws_NO_MODIFICATION_ERR", success); } }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
attrremovechild1::runTest
java
Reginer/aosp-android-jar
android-31/src/org/w3c/domts/level1/core/attrremovechild1.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level1/core/attrremovechild1.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrremovechild1"; }
Gets URI that identifies the test. @return uri identifier of test
attrremovechild1::getTargetURI
java
Reginer/aosp-android-jar
android-31/src/org/w3c/domts/level1/core/attrremovechild1.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level1/core/attrremovechild1.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(attrremovechild1.class, args); }
Runs this test from the command line. @param args command line arguments
attrremovechild1::main
java
Reginer/aosp-android-jar
android-31/src/org/w3c/domts/level1/core/attrremovechild1.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/org/w3c/domts/level1/core/attrremovechild1.java
MIT
public textindexsizeerroffsetoutofbounds(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
textindexsizeerroffsetoutofbounds::textindexsizeerroffsetoutofbounds
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/textindexsizeerroffsetoutofbounds.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/textindexsizeerroffsetoutofbounds.java
MIT
public void runTest() throws Throwable { Document doc; NodeList elementList; Node nameNode; Text textNode; Text splitNode; doc = (Document) load("staff", true); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(2); textNode = (Text) nameNode.getFirstChild(); { boolean success = false; try { splitNode = textNode.splitText(300); } catch (DOMException ex) { success = (ex.code == DOMException.INDEX_SIZE_ERR); } assertTrue("throw_INDEX_SIZE_ERR", success); } }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
textindexsizeerroffsetoutofbounds::runTest
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/textindexsizeerroffsetoutofbounds.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/textindexsizeerroffsetoutofbounds.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/textindexsizeerroffsetoutofbounds"; }
Gets URI that identifies the test. @return uri identifier of test
textindexsizeerroffsetoutofbounds::getTargetURI
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/textindexsizeerroffsetoutofbounds.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/textindexsizeerroffsetoutofbounds.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(textindexsizeerroffsetoutofbounds.class, args); }
Runs this test from the command line. @param args command line arguments
textindexsizeerroffsetoutofbounds::main
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/textindexsizeerroffsetoutofbounds.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/textindexsizeerroffsetoutofbounds.java
MIT
public CastDrawable() { super(null); }
The status bar cast drawable draws ic_cast and ic_cast_connected_fill to indicate that the screen is being recorded. A simple layer-list drawable isn't used here because the record fill must not be tinted by the caller. public class CastDrawable extends DrawableWrapper { private Drawable mFillDrawable; private int mHorizontalPadding; /** No-arg constructor used by drawable inflation.
CastDrawable::CastDrawable
java
Reginer/aosp-android-jar
android-33/src/com/android/systemui/statusbar/CastDrawable.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/systemui/statusbar/CastDrawable.java
MIT
public static boolean checkCallingOrSelfReadPhoneState( Context context, int subId, String callingPackage, @Nullable String callingFeatureId, String message) { return checkReadPhoneState(context, subId, Binder.getCallingPid(), Binder.getCallingUid(), callingPackage, callingFeatureId, message); }
Check whether the caller (or self, if not processing an IPC) can read phone state. <p>This method behaves in one of the following ways: <ul> <li>return true: if the caller has the READ_PRIVILEGED_PHONE_STATE permission, the READ_PHONE_STATE runtime permission, or carrier privileges on the given subId. <li>throw SecurityException: if the caller didn't declare any of these permissions, or, for apps which support runtime permissions, if the caller does not currently have any of these permissions. <li>return false: if the caller lacks all of these permissions and doesn't support runtime permissions. This implies that the user revoked the ability to read phone state manually (via AppOps). In this case we can't throw as it would break app compatibility, so we return false to indicate that the calling function should return placeholder data. </ul> <p>Note: for simplicity, this method always returns false for callers using legacy permissions and who have had READ_PHONE_STATE revoked, even if they are carrier-privileged. Such apps should migrate to runtime permissions or stop requiring READ_PHONE_STATE on P+ devices. @param subId the subId of the relevant subscription; used to check carrier privileges. May be {@link SubscriptionManager#INVALID_SUBSCRIPTION_ID} to skip this check for cases where it isn't relevant (hidden APIs, or APIs which are otherwise okay to leave inaccesible to carrier-privileged apps).
TelephonyPermissions::checkCallingOrSelfReadPhoneState
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static boolean checkCallingOrSelfReadPhoneStateNoThrow( Context context, int subId, String callingPackage, @Nullable String callingFeatureId, String message) { try { return checkCallingOrSelfReadPhoneState(context, subId, callingPackage, callingFeatureId, message); } catch (SecurityException se) { return false; } }
Check whether the caller (or self, if not processing an IPC) can read phone state. <p>This method behaves in one of the following ways: <ul> <li>return true: if the caller has the READ_PRIVILEGED_PHONE_STATE permission, the READ_PHONE_STATE runtime permission, or carrier privileges on the given subId. <li>throw SecurityException: if the caller didn't declare any of these permissions, or, for apps which support runtime permissions, if the caller does not currently have any of these permissions. <li>return false: if the caller lacks all of these permissions and doesn't support runtime permissions. This implies that the user revoked the ability to read phone state manually (via AppOps). In this case we can't throw as it would break app compatibility, so we return false to indicate that the calling function should return placeholder data. </ul> <p>Note: for simplicity, this method always returns false for callers using legacy permissions and who have had READ_PHONE_STATE revoked, even if they are carrier-privileged. Such apps should migrate to runtime permissions or stop requiring READ_PHONE_STATE on P+ devices. @param subId the subId of the relevant subscription; used to check carrier privileges. May be {@link SubscriptionManager#INVALID_SUBSCRIPTION_ID} to skip this check for cases where it isn't relevant (hidden APIs, or APIs which are otherwise okay to leave inaccesible to carrier-privileged apps). public static boolean checkCallingOrSelfReadPhoneState( Context context, int subId, String callingPackage, @Nullable String callingFeatureId, String message) { return checkReadPhoneState(context, subId, Binder.getCallingPid(), Binder.getCallingUid(), callingPackage, callingFeatureId, message); } /** Identical to checkCallingOrSelfReadPhoneState but never throws SecurityException
TelephonyPermissions::checkCallingOrSelfReadPhoneStateNoThrow
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static boolean checkInternetPermissionNoThrow(Context context, String message) { try { context.enforcePermission(Manifest.permission.INTERNET, Binder.getCallingPid(), Binder.getCallingUid(), message); return true; } catch (SecurityException se) { return false; } }
Check whether the caller (or self, if not processing an IPC) has internet permission. @param context app context @param message detail message @return true if permission is granted, else false
TelephonyPermissions::checkInternetPermissionNoThrow
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static boolean checkCallingOrSelfReadNonDangerousPhoneStateNoThrow( Context context, String message) { try { context.enforcePermission( Manifest.permission.READ_BASIC_PHONE_STATE, Binder.getCallingPid(), Binder.getCallingUid(), message); return true; } catch (SecurityException se) { return false; } }
Check whether the caller (or self, if not processing an IPC) has non dangerous read phone state permission. @param context app context @param message detail message @return true if permission is granted, else false
TelephonyPermissions::checkCallingOrSelfReadNonDangerousPhoneStateNoThrow
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static boolean checkReadPhoneState( Context context, int subId, int pid, int uid, String callingPackage, @Nullable String callingFeatureId, String message) { try { context.enforcePermission( android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, pid, uid, message); // SKIP checking for run-time permission since caller has PRIVILEGED permission return true; } catch (SecurityException privilegedPhoneStateException) { try { context.enforcePermission( android.Manifest.permission.READ_PHONE_STATE, pid, uid, message); } catch (SecurityException phoneStateException) { // If we don't have the runtime permission, but do have carrier privileges, that // suffices for reading phone state. if (SubscriptionManager.isValidSubscriptionId(subId)) { enforceCarrierPrivilege(context, subId, uid, message); return true; } throw phoneStateException; } } // We have READ_PHONE_STATE permission, so return true as long as the AppOps bit hasn't been // revoked. AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE); return appOps.noteOpNoThrow(AppOpsManager.OPSTR_READ_PHONE_STATE, uid, callingPackage, callingFeatureId, null) == AppOpsManager.MODE_ALLOWED; }
Check whether the app with the given pid/uid can read phone state. <p>This method behaves in one of the following ways: <ul> <li>return true: if the caller has the READ_PRIVILEGED_PHONE_STATE permission, the READ_PHONE_STATE runtime permission, or carrier privileges on the given subId. <li>throw SecurityException: if the caller didn't declare any of these permissions, or, for apps which support runtime permissions, if the caller does not currently have any of these permissions. <li>return false: if the caller lacks all of these permissions and doesn't support runtime permissions. This implies that the user revoked the ability to read phone state manually (via AppOps). In this case we can't throw as it would break app compatibility, so we return false to indicate that the calling function should return placeholder data. </ul> <p>Note: for simplicity, this method always returns false for callers using legacy permissions and who have had READ_PHONE_STATE revoked, even if they are carrier-privileged. Such apps should migrate to runtime permissions or stop requiring READ_PHONE_STATE on P+ devices.
TelephonyPermissions::checkReadPhoneState
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static boolean checkCarrierPrivilegeForSubId(Context context, int subId) { if (SubscriptionManager.isValidSubscriptionId(subId) && getCarrierPrivilegeStatus(context, subId, Binder.getCallingUid()) == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) { return true; } return false; }
Check whether the calling packages has carrier privileges for the passing subscription. @return {@code true} if the caller has carrier privileges, {@false} otherwise.
TelephonyPermissions::checkCarrierPrivilegeForSubId
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static boolean checkReadPhoneStateOnAnyActiveSub(Context context, int pid, int uid, String callingPackage, @Nullable String callingFeatureId, String message) { try { context.enforcePermission( android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, pid, uid, message); // SKIP checking for run-time permission since caller has PRIVILEGED permission return true; } catch (SecurityException privilegedPhoneStateException) { try { context.enforcePermission( android.Manifest.permission.READ_PHONE_STATE, pid, uid, message); } catch (SecurityException phoneStateException) { // If we don't have the runtime permission, but do have carrier privileges, that // suffices for reading phone state. return checkCarrierPrivilegeForAnySubId(context, uid); } } // We have READ_PHONE_STATE permission, so return true as long as the AppOps bit hasn't been // revoked. AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE); return appOps.noteOpNoThrow(AppOpsManager.OPSTR_READ_PHONE_STATE, uid, callingPackage, callingFeatureId, null) == AppOpsManager.MODE_ALLOWED; }
Check whether the app with the given pid/uid can read phone state, or has carrier privileges on any active subscription. <p>If the app does not have carrier privilege, this method will return {@code false} instead of throwing a SecurityException. Therefore, the callers cannot tell the difference between M+ apps which declare the runtime permission but do not have it, and pre-M apps which declare the static permission but had access revoked via AppOps. Apps in the former category expect SecurityExceptions; apps in the latter don't. So this method is suitable for use only if the behavior in both scenarios is meant to be identical. @return {@code true} if the app can read phone state or has carrier privilege; {@code false} otherwise.
TelephonyPermissions::checkReadPhoneStateOnAnyActiveSub
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static boolean checkCallingOrSelfReadDeviceIdentifiers(Context context, String callingPackage, @Nullable String callingFeatureId, String message) { return checkCallingOrSelfReadDeviceIdentifiers(context, SubscriptionManager.INVALID_SUBSCRIPTION_ID, callingPackage, callingFeatureId, message); }
Check whether the caller (or self, if not processing an IPC) can read device identifiers. <p>This method behaves in one of the following ways: <ul> <li>return true: if the caller has the READ_PRIVILEGED_PHONE_STATE permission, the calling package passes a DevicePolicyManager Device Owner / Profile Owner device identifier access check, or the calling package has carrier privileges on any active subscription. <li>throw SecurityException: if the caller does not meet any of the requirements and is targeting Q or is targeting pre-Q and does not have the READ_PHONE_STATE permission or carrier privileges of any active subscription. <li>return false: if the caller is targeting pre-Q and does have the READ_PHONE_STATE permission. In this case the caller would expect to have access to the device identifiers so false is returned instead of throwing a SecurityException to indicate the calling function should return placeholder data. </ul>
TelephonyPermissions::checkCallingOrSelfReadDeviceIdentifiers
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static boolean checkCallingOrSelfReadDeviceIdentifiers(Context context, int subId, String callingPackage, @Nullable String callingFeatureId, String message) { if (checkCallingOrSelfUseIccAuthWithDeviceIdentifier(context, callingPackage, callingFeatureId, message)) { return true; } return checkPrivilegedReadPermissionOrCarrierPrivilegePermission( context, subId, callingPackage, callingFeatureId, message, true, true); }
Check whether the caller (or self, if not processing an IPC) can read device identifiers. <p>This method behaves in one of the following ways: <ul> <li>return true: if the caller has the READ_PRIVILEGED_PHONE_STATE permission, the calling package passes a DevicePolicyManager Device Owner / Profile Owner device identifier access check, or the calling package has carrier privileges on any active subscription, or the calling package has the {@link Manifest.permission#USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER} appop permission. <li>throw SecurityException: if the caller does not meet any of the requirements and is targeting Q or is targeting pre-Q and does not have the READ_PHONE_STATE permission or carrier privileges of any active subscription. <li>return false: if the caller is targeting pre-Q and does have the READ_PHONE_STATE permission or carrier privileges. In this case the caller would expect to have access to the device identifiers so false is returned instead of throwing a SecurityException to indicate the calling function should return placeholder data. </ul>
TelephonyPermissions::checkCallingOrSelfReadDeviceIdentifiers
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static boolean checkCallingOrSelfReadSubscriberIdentifiers(Context context, int subId, String callingPackage, @Nullable String callingFeatureId, String message) { return checkCallingOrSelfReadSubscriberIdentifiers(context, subId, callingPackage, callingFeatureId, message, true); }
Check whether the caller (or self, if not processing an IPC) can read subscriber identifiers. <p>This method behaves in one of the following ways: <ul> <li>return true: if the caller has the READ_PRIVILEGED_PHONE_STATE permission, the calling package passes a DevicePolicyManager Device Owner / Profile Owner device identifier access check, or the calling package has carrier privileges on specified subscription, or the calling package has the {@link Manifest.permission#USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER} appop permission. <li>throw SecurityException: if the caller does not meet any of the requirements and is targeting Q or is targeting pre-Q and does not have the READ_PHONE_STATE permission. <li>return false: if the caller is targeting pre-Q and does have the READ_PHONE_STATE permission. In this case the caller would expect to have access to the device identifiers so false is returned instead of throwing a SecurityException to indicate the calling function should return placeholder data. </ul>
TelephonyPermissions::checkCallingOrSelfReadSubscriberIdentifiers
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static boolean checkCallingOrSelfReadSubscriberIdentifiers(Context context, int subId, String callingPackage, @Nullable String callingFeatureId, String message, boolean reportFailure) { if (checkCallingOrSelfUseIccAuthWithDeviceIdentifier(context, callingPackage, callingFeatureId, message)) { return true; } return checkPrivilegedReadPermissionOrCarrierPrivilegePermission( context, subId, callingPackage, callingFeatureId, message, false, reportFailure); }
Same as {@link #checkCallingOrSelfReadSubscriberIdentifiers(Context, int, String, String, String)} except this allows an additional parameter reportFailure. Caller may not want to report a failure when this is an internal/intermediate check, for example, SubscriptionManagerService calls this with an INVALID_SUBID to check if caller has the required permissions to bypass carrier privilege checks. @param reportFailure Indicates if failure should be reported.
TelephonyPermissions::checkCallingOrSelfReadSubscriberIdentifiers
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
private static boolean checkPrivilegedReadPermissionOrCarrierPrivilegePermission( Context context, int subId, String callingPackage, @Nullable String callingFeatureId, String message, boolean allowCarrierPrivilegeOnAnySub, boolean reportFailure) { int uid = Binder.getCallingUid(); int pid = Binder.getCallingPid(); // If the calling package has carrier privileges for specified sub, then allow access. if (checkCarrierPrivilegeForSubId(context, subId)) return true; // If the calling package has carrier privileges for any subscription // and allowCarrierPrivilegeOnAnySub is set true, then allow access. if (allowCarrierPrivilegeOnAnySub && checkCarrierPrivilegeForAnySubId(context, uid)) { return true; } LegacyPermissionManager permissionManager = (LegacyPermissionManager) context.getSystemService(Context.LEGACY_PERMISSION_SERVICE); try { if (permissionManager.checkDeviceIdentifierAccess(callingPackage, message, callingFeatureId, pid, uid) == PackageManager.PERMISSION_GRANTED) { return true; } } catch (SecurityException se) { throwSecurityExceptionAsUidDoesNotHaveAccess(message, uid); } if (reportFailure) { return reportAccessDeniedToReadIdentifiers(context, subId, pid, uid, callingPackage, message); } else { return false; } }
Checks whether the app with the given pid/uid can read device identifiers. <p>This method behaves in one of the following ways: <ul> <li>return true: if the caller has the READ_PRIVILEGED_PHONE_STATE permission, the calling package passes a DevicePolicyManager Device Owner / Profile Owner device identifier access check; or the calling package has carrier privileges on the specified subscription; or allowCarrierPrivilegeOnAnySub is true and has carrier privilege on any active subscription. <li>throw SecurityException: if the caller does not meet any of the requirements and is targeting Q or is targeting pre-Q and does not have the READ_PHONE_STATE permission. <li>return false: if the caller is targeting pre-Q and does have the READ_PHONE_STATE permission. In this case the caller would expect to have access to the device identifiers so false is returned instead of throwing a SecurityException to indicate the calling function should return placeholder data. </ul>
TelephonyPermissions::checkPrivilegedReadPermissionOrCarrierPrivilegePermission
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
private static boolean reportAccessDeniedToReadIdentifiers(Context context, int subId, int pid, int uid, String callingPackage, String message) { ApplicationInfo callingPackageInfo = null; try { callingPackageInfo = context.getPackageManager().getApplicationInfoAsUser( callingPackage, 0, UserHandle.getUserHandleForUid(uid)); } catch (PackageManager.NameNotFoundException e) { // If the application info for the calling package could not be found then assume the // calling app is a non-preinstalled app to detect any issues with the check Log.e(LOG_TAG, "Exception caught obtaining package info for package " + callingPackage, e); } // The current package should only be reported in StatsLog if it has not previously been // reported for the currently invoked device identifier method. boolean packageReported = sReportedDeviceIDPackages.containsKey(callingPackage); if (!packageReported || !sReportedDeviceIDPackages.get(callingPackage).contains( message)) { Set invokedMethods; if (!packageReported) { invokedMethods = new HashSet<String>(); sReportedDeviceIDPackages.put(callingPackage, invokedMethods); } else { invokedMethods = sReportedDeviceIDPackages.get(callingPackage); } invokedMethods.add(message); TelephonyCommonStatsLog.write(TelephonyCommonStatsLog.DEVICE_IDENTIFIER_ACCESS_DENIED, callingPackage, message, /* isPreinstalled= */ false, false); } Log.w(LOG_TAG, "reportAccessDeniedToReadIdentifiers:" + callingPackage + ":" + message + ":" + subId); // if the target SDK is pre-Q then check if the calling package would have previously // had access to device identifiers. if (callingPackageInfo != null && ( callingPackageInfo.targetSdkVersion < Build.VERSION_CODES.Q)) { if (context.checkPermission( android.Manifest.permission.READ_PHONE_STATE, pid, uid) == PackageManager.PERMISSION_GRANTED) { return false; } if (checkCarrierPrivilegeForSubId(context, subId)) { return false; } } throwSecurityExceptionAsUidDoesNotHaveAccess(message, uid); return true; }
Reports a failure when the app with the given pid/uid cannot access the requested identifier. @returns false if the caller is targeting pre-Q and does have the READ_PHONE_STATE permission or carrier privileges. @throws SecurityException if the caller does not meet any of the requirements for the requested identifier and is targeting Q or is targeting pre-Q and does not have the READ_PHONE_STATE permission or carrier privileges.
TelephonyPermissions::reportAccessDeniedToReadIdentifiers
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static boolean checkCallingOrSelfUseIccAuthWithDeviceIdentifier(Context context, String callingPackage, String callingFeatureId, String message) { // The implementation follows PermissionChecker.checkAppOpPermission, but it cannot be // used directly: because it uses noteProxyOpNoThrow which requires the phone process // having the permission, which doesn't make sense since phone process is the ower of // data/action. // Cannot perform appop check if the calling package is null if (callingPackage == null) { return false; } int callingUid = Binder.getCallingUid(); AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE); int opMode = appOps.noteOpNoThrow(AppOpsManager.OPSTR_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER, callingUid, callingPackage, callingFeatureId, message); switch (opMode) { case AppOpsManager.MODE_ALLOWED: case AppOpsManager.MODE_FOREGROUND: return true; case AppOpsManager.MODE_DEFAULT: return context.checkCallingOrSelfPermission( Manifest.permission.USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER) == PERMISSION_GRANTED; default: return false; } }
Check whether the caller (or self, if not processing an IPC) has {@link Manifest.permission#USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER} AppOp permission. <p>With the permission, the caller can access device/subscriber identifiers and use ICC authentication like EAP-AKA.
TelephonyPermissions::checkCallingOrSelfUseIccAuthWithDeviceIdentifier
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static boolean checkReadCallLog( Context context, int subId, int pid, int uid, String callingPackage, @Nullable String callingPackageName) { if (context.checkPermission(Manifest.permission.READ_CALL_LOG, pid, uid) != PERMISSION_GRANTED) { // If we don't have the runtime permission, but do have carrier privileges, that // suffices for being able to see the call phone numbers. if (SubscriptionManager.isValidSubscriptionId(subId)) { enforceCarrierPrivilege(context, subId, uid, "readCallLog"); return true; } return false; } // We have READ_CALL_LOG permission, so return true as long as the AppOps bit hasn't been // revoked. AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE); return appOps.noteOpNoThrow(AppOpsManager.OPSTR_READ_CALL_LOG, uid, callingPackage, callingPackageName, null) == AppOpsManager.MODE_ALLOWED; }
Check whether the app with the given pid/uid can read the call log. @return {@code true} if the specified app has the read call log permission and AppOpp granted to it, {@code false} otherwise.
TelephonyPermissions::checkReadCallLog
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static boolean checkCallingOrSelfReadPhoneNumber( Context context, int subId, String callingPackage, @Nullable String callingFeatureId, String message) { return checkReadPhoneNumber( context, subId, Binder.getCallingPid(), Binder.getCallingUid(), callingPackage, callingFeatureId, message); }
Returns whether the caller can read phone numbers. <p>Besides apps with the ability to read phone state per {@link #checkReadPhoneState} (only prior to R), the default SMS app and apps with READ_SMS or READ_PHONE_NUMBERS can also read phone numbers.
TelephonyPermissions::checkCallingOrSelfReadPhoneNumber
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static void enforceCallingOrSelfModifyPermissionOrCarrierPrivilege( Context context, int subId, String message) { if (context.checkCallingOrSelfPermission(android.Manifest.permission.MODIFY_PHONE_STATE) == PERMISSION_GRANTED) { return; } if (DBG) Log.d(LOG_TAG, "No modify permission, check carrier privilege next."); enforceCallingOrSelfCarrierPrivilege(context, subId, message); }
Ensure the caller (or self, if not processing an IPC) has MODIFY_PHONE_STATE (and is thus a privileged app) or carrier privileges. @throws SecurityException if the caller does not have the required permission/privileges
TelephonyPermissions::enforceCallingOrSelfModifyPermissionOrCarrierPrivilege
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static void enforceCallingOrSelfReadPhoneStatePermissionOrCarrierPrivilege( Context context, int subId, String message) { if (context.checkCallingOrSelfPermission(android.Manifest.permission.READ_PHONE_STATE) == PERMISSION_GRANTED) { return; } if (DBG) { Log.d(LOG_TAG, "No READ_PHONE_STATE permission, check carrier privilege next."); } enforceCallingOrSelfCarrierPrivilege(context, subId, message); }
Ensure the caller (or self, if not processing an IPC) has {@link android.Manifest.permission#READ_PHONE_STATE} or carrier privileges. @throws SecurityException if the caller does not have the required permission/privileges
TelephonyPermissions::enforceCallingOrSelfReadPhoneStatePermissionOrCarrierPrivilege
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static void enforceCallingOrSelfReadPrivilegedPhoneStatePermissionOrCarrierPrivilege( Context context, int subId, String message) { if (context.checkCallingOrSelfPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) == PERMISSION_GRANTED) { return; } if (DBG) { Log.d(LOG_TAG, "No READ_PRIVILEGED_PHONE_STATE permission, " + "check carrier privilege next."); } enforceCallingOrSelfCarrierPrivilege(context, subId, message); }
Ensure the caller (or self, if not processing an IPC) has {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE} or carrier privileges. @throws SecurityException if the caller does not have the required permission/privileges
TelephonyPermissions::enforceCallingOrSelfReadPrivilegedPhoneStatePermissionOrCarrierPrivilege
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static void enforceCallingOrSelfReadPrecisePhoneStatePermissionOrCarrierPrivilege( Context context, int subId, String message) { if (context.checkCallingOrSelfPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE) == PERMISSION_GRANTED) { return; } if (context.checkCallingOrSelfPermission(Manifest.permission.READ_PRECISE_PHONE_STATE) == PERMISSION_GRANTED) { return; } if (DBG) { Log.d(LOG_TAG, "No READ_PRIVILEGED_PHONE_STATE nor READ_PRECISE_PHONE_STATE permission" + ", check carrier privilege next."); } enforceCallingOrSelfCarrierPrivilege(context, subId, message); }
Ensure the caller (or self, if not processing an IPC) has {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE} or {@link android.Manifest.permission#READ_PRECISE_PHONE_STATE} or carrier privileges. @throws SecurityException if the caller does not have the required permission/privileges
TelephonyPermissions::enforceCallingOrSelfReadPrecisePhoneStatePermissionOrCarrierPrivilege
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static void enforceCallingOrSelfCarrierPrivilege( Context context, int subId, String message) { // NOTE: It's critical that we explicitly pass the calling UID here rather than call // TelephonyManager#hasCarrierPrivileges directly, as the latter only works when called from // the phone process. When called from another process, it will check whether that process // has carrier privileges instead. enforceCarrierPrivilege(context, subId, Binder.getCallingUid(), message); }
Make sure the caller (or self, if not processing an IPC) has carrier privileges. @throws SecurityException if the caller does not have the required privileges
TelephonyPermissions::enforceCallingOrSelfCarrierPrivilege
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
private static boolean checkCarrierPrivilegeForAnySubId(Context context, int uid) { SubscriptionManager sm = (SubscriptionManager) context.getSystemService( Context.TELEPHONY_SUBSCRIPTION_SERVICE); int[] activeSubIds; final long identity = Binder.clearCallingIdentity(); try { activeSubIds = sm.getCompleteActiveSubscriptionIdList(); } finally { Binder.restoreCallingIdentity(identity); } for (int activeSubId : activeSubIds) { if (getCarrierPrivilegeStatus(context, activeSubId, uid) == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) { return true; } } return false; }
Make sure the caller (or self, if not processing an IPC) has carrier privileges. @throws SecurityException if the caller does not have the required privileges public static void enforceCallingOrSelfCarrierPrivilege( Context context, int subId, String message) { // NOTE: It's critical that we explicitly pass the calling UID here rather than call // TelephonyManager#hasCarrierPrivileges directly, as the latter only works when called from // the phone process. When called from another process, it will check whether that process // has carrier privileges instead. enforceCarrierPrivilege(context, subId, Binder.getCallingUid(), message); } private static void enforceCarrierPrivilege( Context context, int subId, int uid, String message) { if (getCarrierPrivilegeStatus(context, subId, uid) != TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) { if (DBG) Log.e(LOG_TAG, "No Carrier Privilege."); throw new SecurityException(message); } } /** Returns whether the provided uid has carrier privileges for any active subscription ID.
TelephonyPermissions::checkCarrierPrivilegeForAnySubId
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static void enforceAnyPermissionGranted(Context context, int uid, String message, String... permissions) { if (permissions.length == 0) return; boolean isGranted = false; for (String perm : permissions) { if (context.checkCallingOrSelfPermission(perm) == PERMISSION_GRANTED) { isGranted = true; break; } } if (isGranted) return; StringBuilder b = new StringBuilder(message); b.append(": Neither user "); b.append(uid); b.append(" nor current process has "); b.append(permissions[0]); for (int i = 1; i < permissions.length; i++) { b.append(" or "); b.append(permissions[i]); } throw new SecurityException(b.toString()); }
Given a list of permissions, check to see if the caller has at least one of them. If the caller has none of these permissions, throw a SecurityException.
TelephonyPermissions::enforceAnyPermissionGranted
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static void enforceAnyPermissionGrantedOrCarrierPrivileges(Context context, int subId, int uid, String message, String... permissions) { enforceAnyPermissionGrantedOrCarrierPrivileges( context, subId, uid, false, message, permissions); }
Given a list of permissions, check to see if the caller has at least one of them granted. If not, check to see if the caller has carrier privileges. If the caller does not have any of these permissions, throw a SecurityException.
TelephonyPermissions::enforceAnyPermissionGrantedOrCarrierPrivileges
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static void enforceAnyPermissionGrantedOrCarrierPrivileges(Context context, int subId, int uid, boolean allowCarrierPrivilegeOnAnySub, String message, String... permissions) { if (permissions.length == 0) return; boolean isGranted = false; for (String perm : permissions) { if (context.checkCallingOrSelfPermission(perm) == PERMISSION_GRANTED) { isGranted = true; break; } } if (isGranted) return; if (allowCarrierPrivilegeOnAnySub) { if (checkCarrierPrivilegeForAnySubId(context, uid)) return; } else { if (checkCarrierPrivilegeForSubId(context, subId)) return; } StringBuilder b = new StringBuilder(message); b.append(": Neither user "); b.append(uid); b.append(" nor current process has "); b.append(permissions[0]); for (int i = 1; i < permissions.length; i++) { b.append(" or "); b.append(permissions[i]); } b.append(" or carrier privileges. subId=" + subId + ", allowCarrierPrivilegeOnAnySub=" + allowCarrierPrivilegeOnAnySub); throw new SecurityException(b.toString()); }
Given a list of permissions, check to see if the caller has at least one of them granted. If not, check to see if the caller has carrier privileges on the specified subscription (or any subscription if {@code allowCarrierPrivilegeOnAnySub} is {@code true}. If the caller does not have any of these permissions, throw a {@link SecurityException}.
TelephonyPermissions::enforceAnyPermissionGrantedOrCarrierPrivileges
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static void enforceShellOnly(int callingUid, String message) { if (callingUid == Process.SHELL_UID || callingUid == Process.ROOT_UID) { return; // okay } throw new SecurityException(message + ": Only shell user can call it"); }
Throws if the caller is not of a shell (or root) UID. @param callingUid pass Binder.callingUid().
TelephonyPermissions::enforceShellOnly
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static int getTargetSdk(Context c, String packageName) { try { final ApplicationInfo ai = c.getPackageManager().getApplicationInfoAsUser( packageName, 0, UserHandle.getUserHandleForUid(Binder.getCallingUid())); if (ai != null) return ai.targetSdkVersion; } catch (PackageManager.NameNotFoundException unexpected) { Log.e(LOG_TAG, "Failed to get package info for pkg=" + packageName + ", uid=" + Binder.getCallingUid()); } return Integer.MAX_VALUE; }
Returns the target SDK version number for a given package name. This call MUST be invoked before clearing the calling UID. @return target SDK if the package is found or INT_MAX.
TelephonyPermissions::getTargetSdk
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static boolean checkSubscriptionAssociatedWithUser(@NonNull Context context, int subId, @NonNull UserHandle callerUserHandle, @NonNull String destAddr) { // Skip subscription-user association check for emergency numbers TelephonyManager tm = (TelephonyManager) context.getSystemService( Context.TELEPHONY_SERVICE); final long token = Binder.clearCallingIdentity(); try { if (tm != null && tm.isEmergencyNumber(destAddr)) { Log.d(LOG_TAG, "checkSubscriptionAssociatedWithUser:" + " destAddr is emergency number"); return true; } } catch(Exception e) { Log.e(LOG_TAG, "Cannot verify if destAddr is an emergency number: " + e); } finally { Binder.restoreCallingIdentity(token); } return checkSubscriptionAssociatedWithUser(context, subId, callerUserHandle); }
Check if calling user is associated with the given subscription. Subscription-user association check is skipped if destination address is an emergency number. @param context Context @param subId subscription ID @param callerUserHandle caller user handle @param destAddr destination address of the message @return true if destAddr is an emergency number and return false if user is not associated with the subscription.
TelephonyPermissions::checkSubscriptionAssociatedWithUser
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public static boolean checkSubscriptionAssociatedWithUser(@NonNull Context context, int subId, @NonNull UserHandle callerUserHandle) { SubscriptionManager subManager = (SubscriptionManager) context.getSystemService( Context.TELEPHONY_SUBSCRIPTION_SERVICE); final long token = Binder.clearCallingIdentity(); try { if ((subManager != null) && (!subManager.isSubscriptionAssociatedWithUser(subId, callerUserHandle))) { // If subId is not associated with calling user, return false. Log.e(LOG_TAG, "User[User ID:" + callerUserHandle.getIdentifier() + "] is not associated with Subscription ID:" + subId); return false; } } catch (IllegalArgumentException e) { // Found no record of this sub Id. Log.e(LOG_TAG, "Subscription[Subscription ID:" + subId + "] has no records on device"); return false; } finally { Binder.restoreCallingIdentity(token); } return true; }
Check if calling user is associated with the given subscription. @param context Context @param subId subscription ID @param callerUserHandle caller user handle @return false if user is not associated with the subscription, or no record found of this subscription.
TelephonyPermissions::checkSubscriptionAssociatedWithUser
java
Reginer/aosp-android-jar
android-35/src/com/android/internal/telephony/TelephonyPermissions.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/telephony/TelephonyPermissions.java
MIT
public SSLEngineResult(Status status, HandshakeStatus handshakeStatus, int bytesConsumed, int bytesProduced) { if ((status == null) || (handshakeStatus == null) || (bytesConsumed < 0) || (bytesProduced < 0)) { throw new IllegalArgumentException("Invalid Parameter(s)"); } this.status = status; this.handshakeStatus = handshakeStatus; this.bytesConsumed = bytesConsumed; this.bytesProduced = bytesProduced; }
Initializes a new instance of this class. @param status the return value of the operation. @param handshakeStatus the current handshaking status. @param bytesConsumed the number of bytes consumed from the source ByteBuffer @param bytesProduced the number of bytes placed into the destination ByteBuffer @throws IllegalArgumentException if the <code>status</code> or <code>handshakeStatus</code> arguments are null, or if <code>bytesConsumed</code> or <code>bytesProduced</code> is negative.
HandshakeStatus::SSLEngineResult
java
Reginer/aosp-android-jar
android-34/src/javax/net/ssl/SSLEngineResult.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/javax/net/ssl/SSLEngineResult.java
MIT
final public Status getStatus() { return status; }
Gets the return value of this <code>SSLEngine</code> operation. @return the return value
HandshakeStatus::getStatus
java
Reginer/aosp-android-jar
android-34/src/javax/net/ssl/SSLEngineResult.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/javax/net/ssl/SSLEngineResult.java
MIT
final public HandshakeStatus getHandshakeStatus() { return handshakeStatus; }
Gets the handshake status of this <code>SSLEngine</code> operation. @return the handshake status
HandshakeStatus::getHandshakeStatus
java
Reginer/aosp-android-jar
android-34/src/javax/net/ssl/SSLEngineResult.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/javax/net/ssl/SSLEngineResult.java
MIT
final public int bytesConsumed() { return bytesConsumed; }
Returns the number of bytes consumed from the input buffer. @return the number of bytes consumed.
HandshakeStatus::bytesConsumed
java
Reginer/aosp-android-jar
android-34/src/javax/net/ssl/SSLEngineResult.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/javax/net/ssl/SSLEngineResult.java
MIT
final public int bytesProduced() { return bytesProduced; }
Returns the number of bytes written to the output buffer. @return the number of bytes produced
HandshakeStatus::bytesProduced
java
Reginer/aosp-android-jar
android-34/src/javax/net/ssl/SSLEngineResult.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/javax/net/ssl/SSLEngineResult.java
MIT
public boolean waitFor(long timeout, TimeUnit unit) throws InterruptedException { long startTime = System.nanoTime(); long rem = unit.toNanos(timeout); do { try { exitValue(); return true; } catch(IllegalThreadStateException ex) { if (rem > 0) Thread.sleep( Math.min(TimeUnit.NANOSECONDS.toMillis(rem) + 1, 100)); } rem = unit.toNanos(timeout) - (System.nanoTime() - startTime); } while (rem > 0); return false; }
Causes the current thread to wait, if necessary, until the subprocess represented by this {@code Process} object has terminated, or the specified waiting time elapses. <p>If the subprocess has already terminated then this method returns immediately with the value {@code true}. If the process has not terminated and the timeout value is less than, or equal to, zero, then this method returns immediately with the value {@code false}. <p>The default implementation of this methods polls the {@code exitValue} to check if the process has terminated. Concrete implementations of this class are strongly encouraged to override this method with a more efficient implementation. @param timeout the maximum time to wait @param unit the time unit of the {@code timeout} argument @return {@code true} if the subprocess has exited and {@code false} if the waiting time elapsed before the subprocess has exited. @throws InterruptedException if the current thread is interrupted while waiting. @throws NullPointerException if unit is null @since 1.8
Process::waitFor
java
Reginer/aosp-android-jar
android-35/src/java/lang/Process.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/Process.java
MIT
public Process destroyForcibly() { destroy(); return this; }
Kills the subprocess. The subprocess represented by this {@code Process} object is forcibly terminated. <p>The default implementation of this method invokes {@link #destroy} and so may not forcibly terminate the process. Concrete implementations of this class are strongly encouraged to override this method with a compliant implementation. Invoking this method on {@code Process} objects returned by {@link ProcessBuilder#start} and {@link Runtime#exec} will forcibly terminate the process. <p>Note: The subprocess may not terminate immediately. i.e. {@code isAlive()} may return true for a brief period after {@code destroyForcibly()} is called. This method may be chained to {@code waitFor()} if needed. @return the {@code Process} object representing the subprocess to be forcibly destroyed. @since 1.8
Process::destroyForcibly
java
Reginer/aosp-android-jar
android-35/src/java/lang/Process.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/Process.java
MIT
public boolean isAlive() { try { exitValue(); return false; } catch(IllegalThreadStateException e) { return true; } }
Tests whether the subprocess represented by this {@code Process} is alive. @return {@code true} if the subprocess represented by this {@code Process} object has not yet terminated. @since 1.8
Process::isAlive
java
Reginer/aosp-android-jar
android-35/src/java/lang/Process.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/lang/Process.java
MIT
public boolean isShowing() { return getVisibility() == View.VISIBLE && !mAnimatingOut; }
Whether the panel is showing, or, if it's animating, whether it will be when the animation is done.
AssistOrbContainer::isShowing
java
Reginer/aosp-android-jar
android-31/src/com/android/systemui/assist/AssistOrbContainer.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/systemui/assist/AssistOrbContainer.java
MIT
MemoryMappedFileDataSource(FileDescriptor fd, long position, long size) { mFd = fd; mFilePosition = position; mSize = size; }
Constructs a new {@code MemoryMappedFileDataSource} for the specified region of the file. @param fd file descriptor to read from. @param position start position of the region in the file. @param size size (in bytes) of the region.
MemoryMappedFileDataSource::MemoryMappedFileDataSource
java
Reginer/aosp-android-jar
android-31/src/android/util/apk/MemoryMappedFileDataSource.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/util/apk/MemoryMappedFileDataSource.java
MIT
public Builder setClientPrefix(String clientPrefix) { if (clientPrefix == null) { throw new IllegalArgumentException("Client prefix cannot be null"); } mClientPrefix = clientPrefix; return this; }
Sets the client prefix for the visual voicemail SMS filter. The client prefix will appear at the start of a visual voicemail SMS message, followed by a colon(:).
Builder::setClientPrefix
java
Reginer/aosp-android-jar
android-31/src/android/telephony/VisualVoicemailSmsFilterSettings.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/VisualVoicemailSmsFilterSettings.java
MIT
public Builder setOriginatingNumbers(List<String> originatingNumbers) { if (originatingNumbers == null) { throw new IllegalArgumentException("Originating numbers cannot be null"); } mOriginatingNumbers = originatingNumbers; return this; }
Sets the originating number allow list for the visual voicemail SMS filter. If the list is not null only the SMS messages from a number in the list can be considered as a visual voicemail SMS. Otherwise, messages from any address will be considered.
Builder::setOriginatingNumbers
java
Reginer/aosp-android-jar
android-31/src/android/telephony/VisualVoicemailSmsFilterSettings.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/VisualVoicemailSmsFilterSettings.java
MIT
public Builder setDestinationPort(int destinationPort) { mDestinationPort = destinationPort; return this; }
Sets the destination port for the visual voicemail SMS filter. @param destinationPort The destination port, or {@link #DESTINATION_PORT_ANY}, or {@link #DESTINATION_PORT_DATA_SMS}
Builder::setDestinationPort
java
Reginer/aosp-android-jar
android-31/src/android/telephony/VisualVoicemailSmsFilterSettings.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/VisualVoicemailSmsFilterSettings.java
MIT
public Builder setPackageName(String packageName) { mPackageName = packageName; return this; }
The package that registered this filter. @hide
Builder::setPackageName
java
Reginer/aosp-android-jar
android-31/src/android/telephony/VisualVoicemailSmsFilterSettings.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/VisualVoicemailSmsFilterSettings.java
MIT
private VisualVoicemailSmsFilterSettings(Builder builder) { clientPrefix = builder.mClientPrefix; originatingNumbers = builder.mOriginatingNumbers; destinationPort = builder.mDestinationPort; packageName = builder.mPackageName; }
Use {@link Builder} to construct
Builder::VisualVoicemailSmsFilterSettings
java
Reginer/aosp-android-jar
android-31/src/android/telephony/VisualVoicemailSmsFilterSettings.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/android/telephony/VisualVoicemailSmsFilterSettings.java
MIT
public CertificateRevokedException(Date revocationDate, CRLReason reason, X500Principal authority, Map<String, Extension> extensions) { if (revocationDate == null || reason == null || authority == null || extensions == null) { throw new NullPointerException(); } this.revocationDate = new Date(revocationDate.getTime()); this.reason = reason; this.authority = authority; // make sure Map only contains correct types this.extensions = Collections.checkedMap(new HashMap<>(), String.class, Extension.class); this.extensions.putAll(extensions); }
Constructs a {@code CertificateRevokedException} with the specified revocation date, reason code, authority name, and map of extensions. @param revocationDate the date on which the certificate was revoked. The date is copied to protect against subsequent modification. @param reason the revocation reason @param extensions a map of X.509 Extensions. Each key is an OID String that maps to the corresponding Extension. The map is copied to prevent subsequent modification. @param authority the {@code X500Principal} that represents the name of the authority that signed the certificate's revocation status information @throws NullPointerException if {@code revocationDate}, {@code reason}, {@code authority}, or {@code extensions} is {@code null}
CertificateRevokedException::CertificateRevokedException
java
Reginer/aosp-android-jar
android-32/src/java/security/cert/CertificateRevokedException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/cert/CertificateRevokedException.java
MIT
public X500Principal getAuthorityName() { return authority; }
Returns the name of the authority that signed the certificate's revocation status information. @return the {@code X500Principal} that represents the name of the authority that signed the certificate's revocation status information
Extension::getAuthorityName
java
Reginer/aosp-android-jar
android-32/src/java/security/cert/CertificateRevokedException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/cert/CertificateRevokedException.java
MIT
public Date getInvalidityDate() { Extension ext = getExtensions().get("2.5.29.24"); if (ext == null) { return null; } else { try { Date invalidity = InvalidityDateExtension.toImpl(ext).get("DATE"); return new Date(invalidity.getTime()); } catch (IOException ioe) { return null; } } }
Returns the invalidity date, as specified in the Invalidity Date extension of this {@code CertificateRevokedException}. The invalidity date is the date on which it is known or suspected that the private key was compromised or that the certificate otherwise became invalid. This implementation calls {@code getExtensions()} and checks the returned map for an entry for the Invalidity Date extension OID ("2.5.29.24"). If found, it returns the invalidity date in the extension; otherwise null. A new Date object is returned each time the method is invoked to protect against subsequent modification. @return the invalidity date, or {@code null} if not specified
Extension::getInvalidityDate
java
Reginer/aosp-android-jar
android-32/src/java/security/cert/CertificateRevokedException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/cert/CertificateRevokedException.java
MIT
public Map<String, Extension> getExtensions() { return Collections.unmodifiableMap(extensions); }
Returns a map of X.509 extensions containing additional information about the revoked certificate, such as the Invalidity Date Extension. Each key is an OID String that maps to the corresponding Extension. @return an unmodifiable map of X.509 extensions, or an empty map if there are no extensions
Extension::getExtensions
java
Reginer/aosp-android-jar
android-32/src/java/security/cert/CertificateRevokedException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/cert/CertificateRevokedException.java
MIT
private void writeObject(ObjectOutputStream oos) throws IOException { // Write out the non-transient fields // (revocationDate, reason, authority) oos.defaultWriteObject(); // Write out the size (number of mappings) of the extensions map oos.writeInt(extensions.size()); // For each extension in the map, the following are emitted (in order): // the OID String (Object), the criticality flag (boolean), the length // of the encoded extension value byte array (int), and the encoded // extension value byte array. The extensions themselves are emitted // in no particular order. for (Map.Entry<String, Extension> entry : extensions.entrySet()) { Extension ext = entry.getValue(); oos.writeObject(ext.getId()); oos.writeBoolean(ext.isCritical()); byte[] extVal = ext.getValue(); oos.writeInt(extVal.length); oos.write(extVal); } }
Serialize this {@code CertificateRevokedException} instance. @serialData the size of the extensions map (int), followed by all of the extensions in the map, in no particular order. For each extension, the following data is emitted: the OID String (Object), the criticality flag (boolean), the length of the encoded extension value byte array (int), and the encoded extension value bytes.
Extension::writeObject
java
Reginer/aosp-android-jar
android-32/src/java/security/cert/CertificateRevokedException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/cert/CertificateRevokedException.java
MIT
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { // Read in the non-transient fields // (revocationDate, reason, authority) ois.defaultReadObject(); // Defensively copy the revocation date revocationDate = new Date(revocationDate.getTime()); // Read in the size (number of mappings) of the extensions map // and create the extensions map int size = ois.readInt(); if (size == 0) { extensions = Collections.emptyMap(); } else { extensions = new HashMap<String, Extension>(size); } // Read in the extensions and put the mappings in the extensions map for (int i = 0; i < size; i++) { String oid = (String) ois.readObject(); boolean critical = ois.readBoolean(); int length = ois.readInt(); byte[] extVal = new byte[length]; ois.readFully(extVal); Extension ext = sun.security.x509.Extension.newExtension (new ObjectIdentifier(oid), critical, extVal); extensions.put(oid, ext); } }
Deserialize the {@code CertificateRevokedException} instance.
Extension::readObject
java
Reginer/aosp-android-jar
android-32/src/java/security/cert/CertificateRevokedException.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/java/security/cert/CertificateRevokedException.java
MIT
public nodelistindexnotzero(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", false); }
Constructor. @param factory document factory, may not be null @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
nodelistindexnotzero::nodelistindexnotzero
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/nodelistindexnotzero.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/nodelistindexnotzero.java
MIT
public void runTest() throws Throwable { Document doc; NodeList elementList; Node employeeNode; NodeList employeeList; Node child; int length; String childName; doc = (Document) load("staff", false); elementList = doc.getElementsByTagName("employee"); employeeNode = elementList.item(2); employeeList = employeeNode.getChildNodes(); length = (int) employeeList.getLength(); if (equals(6, length)) { child = employeeList.item(1); } else { child = employeeList.item(3); } childName = child.getNodeName(); assertEquals("nodeName", "name", childName); }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
nodelistindexnotzero::runTest
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/nodelistindexnotzero.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/nodelistindexnotzero.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistindexnotzero"; }
Gets URI that identifies the test. @return uri identifier of test
nodelistindexnotzero::getTargetURI
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/nodelistindexnotzero.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/nodelistindexnotzero.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(nodelistindexnotzero.class, args); }
Runs this test from the command line. @param args command line arguments
nodelistindexnotzero::main
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level1/core/nodelistindexnotzero.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level1/core/nodelistindexnotzero.java
MIT
public static @Config int activityInfoConfigNativeToJava(@NativeConfig int input) { int output = 0; for (int i = 0; i < CONFIG_NATIVE_BITS.length; i++) { if ((input & CONFIG_NATIVE_BITS[i]) != 0) { output |= (1 << i); } } return output; }
Convert native change bits to Java. @hide
ActivityInfo::activityInfoConfigNativeToJava
java
Reginer/aosp-android-jar
android-33/src/android/content/pm/ActivityInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/content/pm/ActivityInfo.java
MIT
public int getRealConfigChanged() { return applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2 ? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE | ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE) : configChanges; }
@hide Unfortunately some developers (OpenFeint I am looking at you) have compared the configChanges bit field against absolute values, so if we introduce a new bit they break. To deal with that, we will make sure the public field will not have a value that breaks them, and let the framework call here to get the real value.
ActivityInfo::getRealConfigChanged
java
Reginer/aosp-android-jar
android-33/src/android/content/pm/ActivityInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/content/pm/ActivityInfo.java
MIT
public static final String lockTaskLaunchModeToString(int lockTaskLaunchMode) { switch (lockTaskLaunchMode) { case LOCK_TASK_LAUNCH_MODE_DEFAULT: return "LOCK_TASK_LAUNCH_MODE_DEFAULT"; case LOCK_TASK_LAUNCH_MODE_NEVER: return "LOCK_TASK_LAUNCH_MODE_NEVER"; case LOCK_TASK_LAUNCH_MODE_ALWAYS: return "LOCK_TASK_LAUNCH_MODE_ALWAYS"; case LOCK_TASK_LAUNCH_MODE_IF_ALLOWLISTED: return "LOCK_TASK_LAUNCH_MODE_IF_ALLOWLISTED"; default: return "unknown=" + lockTaskLaunchMode; } }
Screen rotation animation desired by the activity, with values as defined for {@link android.view.WindowManager.LayoutParams#rotationAnimation}. -1 means to use the system default. @hide public int rotationAnimation = -1; /** @hide public static final int LOCK_TASK_LAUNCH_MODE_DEFAULT = 0; /** @hide public static final int LOCK_TASK_LAUNCH_MODE_NEVER = 1; /** @hide public static final int LOCK_TASK_LAUNCH_MODE_ALWAYS = 2; /** @hide public static final int LOCK_TASK_LAUNCH_MODE_IF_ALLOWLISTED = 3; /** @hide
ActivityInfo::lockTaskLaunchModeToString
java
Reginer/aosp-android-jar
android-33/src/android/content/pm/ActivityInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/content/pm/ActivityInfo.java
MIT
public final int getThemeResource() { return theme != 0 ? theme : applicationInfo.theme; }
Return the theme resource identifier to use for this activity. If the activity defines a theme, that is used; else, the application theme is used. @return The theme associated with this activity.
ActivityInfo::getThemeResource
java
Reginer/aosp-android-jar
android-33/src/android/content/pm/ActivityInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/content/pm/ActivityInfo.java
MIT
public boolean hasFixedAspectRatio(@ScreenOrientation int orientation) { return getMaxAspectRatio() != 0 || getMinAspectRatio(orientation) != 0; }
Returns true if the activity has maximum or minimum aspect ratio. @hide
ActivityInfo::hasFixedAspectRatio
java
Reginer/aosp-android-jar
android-33/src/android/content/pm/ActivityInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/content/pm/ActivityInfo.java
MIT
public boolean isFixedOrientation() { return isFixedOrientationLandscape() || isFixedOrientationPortrait() || screenOrientation == SCREEN_ORIENTATION_LOCKED; }
Returns true if the activity's orientation is fixed. @hide
ActivityInfo::isFixedOrientation
java
Reginer/aosp-android-jar
android-33/src/android/content/pm/ActivityInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/content/pm/ActivityInfo.java
MIT
boolean isFixedOrientationLandscape() { return isFixedOrientationLandscape(screenOrientation); }
Returns true if the activity's orientation is fixed to landscape. @hide
ActivityInfo::isFixedOrientationLandscape
java
Reginer/aosp-android-jar
android-33/src/android/content/pm/ActivityInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/content/pm/ActivityInfo.java
MIT
public static boolean isFixedOrientationLandscape(@ScreenOrientation int orientation) { return orientation == SCREEN_ORIENTATION_LANDSCAPE || orientation == SCREEN_ORIENTATION_SENSOR_LANDSCAPE || orientation == SCREEN_ORIENTATION_REVERSE_LANDSCAPE || orientation == SCREEN_ORIENTATION_USER_LANDSCAPE; }
Returns true if the activity's orientation is fixed to landscape. @hide
ActivityInfo::isFixedOrientationLandscape
java
Reginer/aosp-android-jar
android-33/src/android/content/pm/ActivityInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/content/pm/ActivityInfo.java
MIT
boolean isFixedOrientationPortrait() { return isFixedOrientationPortrait(screenOrientation); }
Returns true if the activity's orientation is fixed to portrait. @hide
ActivityInfo::isFixedOrientationPortrait
java
Reginer/aosp-android-jar
android-33/src/android/content/pm/ActivityInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/content/pm/ActivityInfo.java
MIT
public static boolean isFixedOrientationPortrait(@ScreenOrientation int orientation) { return orientation == SCREEN_ORIENTATION_PORTRAIT || orientation == SCREEN_ORIENTATION_SENSOR_PORTRAIT || orientation == SCREEN_ORIENTATION_REVERSE_PORTRAIT || orientation == SCREEN_ORIENTATION_USER_PORTRAIT; }
Returns true if the activity's orientation is fixed to portrait. @hide
ActivityInfo::isFixedOrientationPortrait
java
Reginer/aosp-android-jar
android-33/src/android/content/pm/ActivityInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/content/pm/ActivityInfo.java
MIT