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 setTouchscreenSensorsListening(boolean listening) { for (TriggerSensor sensor : mSensors) { if (sensor.mRequiresTouchscreen) { sensor.setListening(listening); } } }
Registers/unregisters sensors based on internal state. private void updateListening() { boolean anyListening = false; for (TriggerSensor s : mSensors) { boolean listen = mListening && (!s.mRequiresTouchscreen || mListeningTouchScreenSensors) && (!s.mRequiresProx || mListeningProxSensors); s.setListening(listen); if (listen) { anyListening = true; } } if (!anyListening) { mSecureSettings.unregisterContentObserver(mSettingsObserver); } else if (!mSettingRegistered) { for (TriggerSensor s : mSensors) { s.registerSettingsObserver(mSettingsObserver); } } mSettingRegistered = anyListening; } /** Set the listening state of only the sensors that require the touchscreen.
DozeSensorsUiEvent::setTouchscreenSensorsListening
java
Reginer/aosp-android-jar
android-31/src/com/android/systemui/doze/DozeSensors.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/systemui/doze/DozeSensors.java
MIT
public void ignoreTouchScreenSensorsSettingInterferingWithDocking(boolean ignore) { for (TriggerSensor sensor : mSensors) { if (sensor.mRequiresTouchscreen) { sensor.ignoreSetting(ignore); } } }
Registers/unregisters sensors based on internal state. private void updateListening() { boolean anyListening = false; for (TriggerSensor s : mSensors) { boolean listen = mListening && (!s.mRequiresTouchscreen || mListeningTouchScreenSensors) && (!s.mRequiresProx || mListeningProxSensors); s.setListening(listen); if (listen) { anyListening = true; } } if (!anyListening) { mSecureSettings.unregisterContentObserver(mSettingsObserver); } else if (!mSettingRegistered) { for (TriggerSensor s : mSensors) { s.registerSettingsObserver(mSettingsObserver); } } mSettingRegistered = anyListening; } /** Set the listening state of only the sensors that require the touchscreen. public void setTouchscreenSensorsListening(boolean listening) { for (TriggerSensor sensor : mSensors) { if (sensor.mRequiresTouchscreen) { sensor.setListening(listening); } } } public void onUserSwitched() { for (TriggerSensor s : mSensors) { s.updateListening(); } } void onScreenState(int state) { mProximitySensor.setSecondarySafe( state == Display.STATE_DOZE || state == Display.STATE_DOZE_SUSPEND || state == Display.STATE_OFF); } public void setProxListening(boolean listen) { if (mProximitySensor.isRegistered() && listen) { mProximitySensor.alertListeners(); } else { if (listen) { mProximitySensor.resume(); } else { mProximitySensor.pause(); } } } private final ContentObserver mSettingsObserver = new ContentObserver(mHandler) { @Override public void onChange(boolean selfChange, Collection<Uri> uris, int flags, int userId) { if (userId != ActivityManager.getCurrentUser()) { return; } for (TriggerSensor s : mSensors) { s.updateListening(); } } }; /** Ignore the setting value of only the sensors that require the touchscreen.
DozeSensorsUiEvent::ignoreTouchScreenSensorsSettingInterferingWithDocking
java
Reginer/aosp-android-jar
android-31/src/com/android/systemui/doze/DozeSensors.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/systemui/doze/DozeSensors.java
MIT
public void dump(PrintWriter pw) { pw.println("mListening=" + mListening); pw.println("mListeningTouchScreenSensors=" + mListeningTouchScreenSensors); pw.println("mSelectivelyRegisterProxSensors=" + mSelectivelyRegisterProxSensors); pw.println("mListeningProxSensors=" + mListeningProxSensors); pw.println("mScreenOffUdfpsEnabled=" + mScreenOffUdfpsEnabled); IndentingPrintWriter idpw = new IndentingPrintWriter(pw); idpw.increaseIndent(); for (TriggerSensor s : mSensors) { idpw.println("Sensor: " + s.toString()); } idpw.println("ProxSensor: " + mProximitySensor.toString()); }
Registers/unregisters sensors based on internal state. private void updateListening() { boolean anyListening = false; for (TriggerSensor s : mSensors) { boolean listen = mListening && (!s.mRequiresTouchscreen || mListeningTouchScreenSensors) && (!s.mRequiresProx || mListeningProxSensors); s.setListening(listen); if (listen) { anyListening = true; } } if (!anyListening) { mSecureSettings.unregisterContentObserver(mSettingsObserver); } else if (!mSettingRegistered) { for (TriggerSensor s : mSensors) { s.registerSettingsObserver(mSettingsObserver); } } mSettingRegistered = anyListening; } /** Set the listening state of only the sensors that require the touchscreen. public void setTouchscreenSensorsListening(boolean listening) { for (TriggerSensor sensor : mSensors) { if (sensor.mRequiresTouchscreen) { sensor.setListening(listening); } } } public void onUserSwitched() { for (TriggerSensor s : mSensors) { s.updateListening(); } } void onScreenState(int state) { mProximitySensor.setSecondarySafe( state == Display.STATE_DOZE || state == Display.STATE_DOZE_SUSPEND || state == Display.STATE_OFF); } public void setProxListening(boolean listen) { if (mProximitySensor.isRegistered() && listen) { mProximitySensor.alertListeners(); } else { if (listen) { mProximitySensor.resume(); } else { mProximitySensor.pause(); } } } private final ContentObserver mSettingsObserver = new ContentObserver(mHandler) { @Override public void onChange(boolean selfChange, Collection<Uri> uris, int flags, int userId) { if (userId != ActivityManager.getCurrentUser()) { return; } for (TriggerSensor s : mSensors) { s.updateListening(); } } }; /** Ignore the setting value of only the sensors that require the touchscreen. public void ignoreTouchScreenSensorsSettingInterferingWithDocking(boolean ignore) { for (TriggerSensor sensor : mSensors) { if (sensor.mRequiresTouchscreen) { sensor.ignoreSetting(ignore); } } } /** Dump current state
DozeSensorsUiEvent::dump
java
Reginer/aosp-android-jar
android-31/src/com/android/systemui/doze/DozeSensors.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/systemui/doze/DozeSensors.java
MIT
public Boolean isProximityCurrentlyNear() { return mProximitySensor.isNear(); }
@return true if prox is currently near, false if far or null if unknown.
DozeSensorsUiEvent::isProximityCurrentlyNear
java
Reginer/aosp-android-jar
android-31/src/com/android/systemui/doze/DozeSensors.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/systemui/doze/DozeSensors.java
MIT
public createAttributeNS02(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { super(factory); // // check if loaded documents are supported for content type // String contentType = getContentType(); preload(contentType, "staffNS", false); }
Constructor. @param factory document factory, may not be null @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
createAttributeNS02::createAttributeNS02
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level2/core/createAttributeNS02.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level2/core/createAttributeNS02.java
MIT
public void runTest() throws Throwable { String namespaceURI = null; String qualifiedName = "prefix:local"; Document doc; Attr newAttr; doc = (Document) load("staffNS", false); { boolean success = false; try { newAttr = doc.createAttributeNS(namespaceURI, qualifiedName); } catch (DOMException ex) { success = (ex.code == DOMException.NAMESPACE_ERR); } assertTrue("throw_NAMESPACE_ERR", success); } }
Runs the test case. @throws Throwable Any uncaught exception causes test to fail
createAttributeNS02::runTest
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level2/core/createAttributeNS02.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level2/core/createAttributeNS02.java
MIT
public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS02"; }
Gets URI that identifies the test. @return uri identifier of test
createAttributeNS02::getTargetURI
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level2/core/createAttributeNS02.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level2/core/createAttributeNS02.java
MIT
public static void main(final String[] args) { DOMTestCase.doMain(createAttributeNS02.class, args); }
Runs this test from the command line. @param args command line arguments
createAttributeNS02::main
java
Reginer/aosp-android-jar
android-34/src/org/w3c/domts/level2/core/createAttributeNS02.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/w3c/domts/level2/core/createAttributeNS02.java
MIT
public static UsbDescriptor allocDescriptor(UsbDescriptorParser parser, ByteStream stream, int length, byte type) { byte subtype = stream.getByte(); UsbInterfaceDescriptor interfaceDesc = parser.getCurInterface(); if (UsbDescriptorParser.DEBUG) { Log.d(TAG, " Video Class-specific Interface subtype: " + subtype); } switch (subtype) { // TODO - Create descriptor classes and parse these... case VCI_UNDEFINED: if (UsbDescriptorParser.DEBUG) { Log.d(TAG, " ---> VCI_UNDEFINED"); } break; case VCI_VEADER: { if (UsbDescriptorParser.DEBUG) { Log.d(TAG, " ---> VCI_VEADER"); } int vcInterfaceSpec = stream.unpackUsbShort(); parser.setVCInterfaceSpec(vcInterfaceSpec); if (UsbDescriptorParser.DEBUG) { Log.d(TAG, " vcInterfaceSpec:0x" + Integer.toHexString(vcInterfaceSpec)); } return new UsbVCHeader(length, type, subtype, vcInterfaceSpec); } case VCI_INPUT_TERMINAL: if (UsbDescriptorParser.DEBUG) { Log.d(TAG, " ---> VCI_INPUT_TERMINAL"); } return new UsbVCInputTerminal(length, type, subtype); case VCI_OUTPUT_TERMINAL: if (UsbDescriptorParser.DEBUG) { Log.d(TAG, " ---> VCI_OUTPUT_TERMINAL"); } return new UsbVCOutputTerminal(length, type, subtype); case VCI_SELECTOR_UNIT: if (UsbDescriptorParser.DEBUG) { Log.d(TAG, " ---> VCI_SELECTOR_UNIT"); } return new UsbVCSelectorUnit(length, type, subtype); case VCI_PROCESSING_UNIT: if (UsbDescriptorParser.DEBUG) { Log.d(TAG, " ---> VCI_PROCESSING_UNIT"); } return new UsbVCProcessingUnit(length, type, subtype); case VCI_EXTENSION_UNIT: if (UsbDescriptorParser.DEBUG) { Log.d(TAG, " ---> VCI_EXTENSION_UNIT"); } break; default: Log.w(TAG, "Unknown Video Class Interface subtype: 0x" + Integer.toHexString(subtype)); return null; } return null; }
Allocates an audio class interface subtype based on subtype and subclass.
UsbVCInterface::allocDescriptor
java
Reginer/aosp-android-jar
android-34/src/com/android/server/usb/descriptors/UsbVCInterface.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/usb/descriptors/UsbVCInterface.java
MIT
public UsbPort(@NonNull UsbManager usbManager, @NonNull String id, int supportedModes, int supportedContaminantProtectionModes, boolean supportsEnableContaminantPresenceProtection, boolean supportsEnableContaminantPresenceDetection) { Objects.requireNonNull(id); Preconditions.checkFlagsArgument(supportedModes, MODE_DFP | MODE_UFP | MODE_AUDIO_ACCESSORY | MODE_DEBUG_ACCESSORY); mUsbManager = usbManager; mId = id; mSupportedModes = supportedModes; mSupportedContaminantProtectionModes = supportedContaminantProtectionModes; mSupportsEnableContaminantPresenceProtection = supportsEnableContaminantPresenceProtection; mSupportsEnableContaminantPresenceDetection = supportsEnableContaminantPresenceDetection; }
Points to the first power role in the IUsb HAL. private static final int POWER_ROLE_OFFSET = Constants.PortPowerRole.NONE; /** @hide
UsbPort::UsbPort
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public String getId() { return mId; }
Gets the unique id of the port. @return The unique id of the port; not intended for display. @hide
UsbPort::getId
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public int getSupportedModes() { return mSupportedModes; }
Gets the supported modes of the port. <p> The actual mode of the port may vary depending on what is plugged into it. </p> @return The supported modes: one of {@link UsbPortStatus#MODE_DFP}, {@link UsbPortStatus#MODE_UFP}, or {@link UsbPortStatus#MODE_DUAL}. @hide
UsbPort::getSupportedModes
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public int getSupportedContaminantProtectionModes() { return mSupportedContaminantProtectionModes; }
Gets the supported port proctection modes when the port is contaminated. <p> The actual mode of the port is decided by the hardware </p> @hide
UsbPort::getSupportedContaminantProtectionModes
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public boolean supportsEnableContaminantPresenceProtection() { return mSupportsEnableContaminantPresenceProtection; }
Tells if UsbService can enable/disable contaminant presence protection. @hide
UsbPort::supportsEnableContaminantPresenceProtection
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public boolean supportsEnableContaminantPresenceDetection() { return mSupportsEnableContaminantPresenceDetection; }
Tells if UsbService can enable/disable contaminant presence detection. @hide
UsbPort::supportsEnableContaminantPresenceDetection
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public void enableContaminantDetection(boolean enable) { mUsbManager.enableContaminantDetection(this, enable); }
@hide
UsbPort::enableContaminantDetection
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public static int combineRolesAsBit(int powerRole, int dataRole) { checkRoles(powerRole, dataRole); final int index = ((powerRole - POWER_ROLE_OFFSET) * NUM_DATA_ROLES) + dataRole; return 1 << index; }
Combines one power and one data role together into a unique value with exactly one bit set. This can be used to efficiently determine whether a combination of roles is supported by testing whether that bit is present in a bit-field. @param powerRole The desired power role: {@link UsbPortStatus#POWER_ROLE_SOURCE} or {@link UsbPortStatus#POWER_ROLE_SINK}, or 0 if no power role. @param dataRole The desired data role: {@link UsbPortStatus#DATA_ROLE_HOST} or {@link UsbPortStatus#DATA_ROLE_DEVICE}, or 0 if no data role. @hide
UsbPort::combineRolesAsBit
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public static String modeToString(int mode) { StringBuilder modeString = new StringBuilder(); if (mode == MODE_NONE) { return "none"; } if ((mode & MODE_DUAL) == MODE_DUAL) { modeString.append("dual, "); } else { if ((mode & MODE_DFP) == MODE_DFP) { modeString.append("dfp, "); } else if ((mode & MODE_UFP) == MODE_UFP) { modeString.append("ufp, "); } } if ((mode & MODE_AUDIO_ACCESSORY) == MODE_AUDIO_ACCESSORY) { modeString.append("audio_acc, "); } if ((mode & MODE_DEBUG_ACCESSORY) == MODE_DEBUG_ACCESSORY) { modeString.append("debug_acc, "); } if (modeString.length() == 0) { return Integer.toString(mode); } return modeString.substring(0, modeString.length() - 2); }
Combines one power and one data role together into a unique value with exactly one bit set. This can be used to efficiently determine whether a combination of roles is supported by testing whether that bit is present in a bit-field. @param powerRole The desired power role: {@link UsbPortStatus#POWER_ROLE_SOURCE} or {@link UsbPortStatus#POWER_ROLE_SINK}, or 0 if no power role. @param dataRole The desired data role: {@link UsbPortStatus#DATA_ROLE_HOST} or {@link UsbPortStatus#DATA_ROLE_DEVICE}, or 0 if no data role. @hide public static int combineRolesAsBit(int powerRole, int dataRole) { checkRoles(powerRole, dataRole); final int index = ((powerRole - POWER_ROLE_OFFSET) * NUM_DATA_ROLES) + dataRole; return 1 << index; } /** @hide
UsbPort::modeToString
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public static String powerRoleToString(int role) { switch (role) { case POWER_ROLE_NONE: return "no-power"; case POWER_ROLE_SOURCE: return "source"; case POWER_ROLE_SINK: return "sink"; default: return Integer.toString(role); } }
Combines one power and one data role together into a unique value with exactly one bit set. This can be used to efficiently determine whether a combination of roles is supported by testing whether that bit is present in a bit-field. @param powerRole The desired power role: {@link UsbPortStatus#POWER_ROLE_SOURCE} or {@link UsbPortStatus#POWER_ROLE_SINK}, or 0 if no power role. @param dataRole The desired data role: {@link UsbPortStatus#DATA_ROLE_HOST} or {@link UsbPortStatus#DATA_ROLE_DEVICE}, or 0 if no data role. @hide public static int combineRolesAsBit(int powerRole, int dataRole) { checkRoles(powerRole, dataRole); final int index = ((powerRole - POWER_ROLE_OFFSET) * NUM_DATA_ROLES) + dataRole; return 1 << index; } /** @hide public static String modeToString(int mode) { StringBuilder modeString = new StringBuilder(); if (mode == MODE_NONE) { return "none"; } if ((mode & MODE_DUAL) == MODE_DUAL) { modeString.append("dual, "); } else { if ((mode & MODE_DFP) == MODE_DFP) { modeString.append("dfp, "); } else if ((mode & MODE_UFP) == MODE_UFP) { modeString.append("ufp, "); } } if ((mode & MODE_AUDIO_ACCESSORY) == MODE_AUDIO_ACCESSORY) { modeString.append("audio_acc, "); } if ((mode & MODE_DEBUG_ACCESSORY) == MODE_DEBUG_ACCESSORY) { modeString.append("debug_acc, "); } if (modeString.length() == 0) { return Integer.toString(mode); } return modeString.substring(0, modeString.length() - 2); } /** @hide
UsbPort::powerRoleToString
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public static String dataRoleToString(int role) { switch (role) { case DATA_ROLE_NONE: return "no-data"; case DATA_ROLE_HOST: return "host"; case DATA_ROLE_DEVICE: return "device"; default: return Integer.toString(role); } }
Combines one power and one data role together into a unique value with exactly one bit set. This can be used to efficiently determine whether a combination of roles is supported by testing whether that bit is present in a bit-field. @param powerRole The desired power role: {@link UsbPortStatus#POWER_ROLE_SOURCE} or {@link UsbPortStatus#POWER_ROLE_SINK}, or 0 if no power role. @param dataRole The desired data role: {@link UsbPortStatus#DATA_ROLE_HOST} or {@link UsbPortStatus#DATA_ROLE_DEVICE}, or 0 if no data role. @hide public static int combineRolesAsBit(int powerRole, int dataRole) { checkRoles(powerRole, dataRole); final int index = ((powerRole - POWER_ROLE_OFFSET) * NUM_DATA_ROLES) + dataRole; return 1 << index; } /** @hide public static String modeToString(int mode) { StringBuilder modeString = new StringBuilder(); if (mode == MODE_NONE) { return "none"; } if ((mode & MODE_DUAL) == MODE_DUAL) { modeString.append("dual, "); } else { if ((mode & MODE_DFP) == MODE_DFP) { modeString.append("dfp, "); } else if ((mode & MODE_UFP) == MODE_UFP) { modeString.append("ufp, "); } } if ((mode & MODE_AUDIO_ACCESSORY) == MODE_AUDIO_ACCESSORY) { modeString.append("audio_acc, "); } if ((mode & MODE_DEBUG_ACCESSORY) == MODE_DEBUG_ACCESSORY) { modeString.append("debug_acc, "); } if (modeString.length() == 0) { return Integer.toString(mode); } return modeString.substring(0, modeString.length() - 2); } /** @hide public static String powerRoleToString(int role) { switch (role) { case POWER_ROLE_NONE: return "no-power"; case POWER_ROLE_SOURCE: return "source"; case POWER_ROLE_SINK: return "sink"; default: return Integer.toString(role); } } /** @hide
UsbPort::dataRoleToString
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public static String contaminantPresenceStatusToString(int contaminantPresenceStatus) { switch (contaminantPresenceStatus) { case CONTAMINANT_DETECTION_NOT_SUPPORTED: return "not-supported"; case CONTAMINANT_DETECTION_DISABLED: return "disabled"; case CONTAMINANT_DETECTION_DETECTED: return "detected"; case CONTAMINANT_DETECTION_NOT_DETECTED: return "not detected"; default: return Integer.toString(contaminantPresenceStatus); } }
Combines one power and one data role together into a unique value with exactly one bit set. This can be used to efficiently determine whether a combination of roles is supported by testing whether that bit is present in a bit-field. @param powerRole The desired power role: {@link UsbPortStatus#POWER_ROLE_SOURCE} or {@link UsbPortStatus#POWER_ROLE_SINK}, or 0 if no power role. @param dataRole The desired data role: {@link UsbPortStatus#DATA_ROLE_HOST} or {@link UsbPortStatus#DATA_ROLE_DEVICE}, or 0 if no data role. @hide public static int combineRolesAsBit(int powerRole, int dataRole) { checkRoles(powerRole, dataRole); final int index = ((powerRole - POWER_ROLE_OFFSET) * NUM_DATA_ROLES) + dataRole; return 1 << index; } /** @hide public static String modeToString(int mode) { StringBuilder modeString = new StringBuilder(); if (mode == MODE_NONE) { return "none"; } if ((mode & MODE_DUAL) == MODE_DUAL) { modeString.append("dual, "); } else { if ((mode & MODE_DFP) == MODE_DFP) { modeString.append("dfp, "); } else if ((mode & MODE_UFP) == MODE_UFP) { modeString.append("ufp, "); } } if ((mode & MODE_AUDIO_ACCESSORY) == MODE_AUDIO_ACCESSORY) { modeString.append("audio_acc, "); } if ((mode & MODE_DEBUG_ACCESSORY) == MODE_DEBUG_ACCESSORY) { modeString.append("debug_acc, "); } if (modeString.length() == 0) { return Integer.toString(mode); } return modeString.substring(0, modeString.length() - 2); } /** @hide public static String powerRoleToString(int role) { switch (role) { case POWER_ROLE_NONE: return "no-power"; case POWER_ROLE_SOURCE: return "source"; case POWER_ROLE_SINK: return "sink"; default: return Integer.toString(role); } } /** @hide public static String dataRoleToString(int role) { switch (role) { case DATA_ROLE_NONE: return "no-data"; case DATA_ROLE_HOST: return "host"; case DATA_ROLE_DEVICE: return "device"; default: return Integer.toString(role); } } /** @hide
UsbPort::contaminantPresenceStatusToString
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public static void checkMode(int powerRole) { Preconditions.checkArgumentInRange(powerRole, Constants.PortMode.NONE, Constants.PortMode.NUM_MODES - 1, "portMode"); }
Combines one power and one data role together into a unique value with exactly one bit set. This can be used to efficiently determine whether a combination of roles is supported by testing whether that bit is present in a bit-field. @param powerRole The desired power role: {@link UsbPortStatus#POWER_ROLE_SOURCE} or {@link UsbPortStatus#POWER_ROLE_SINK}, or 0 if no power role. @param dataRole The desired data role: {@link UsbPortStatus#DATA_ROLE_HOST} or {@link UsbPortStatus#DATA_ROLE_DEVICE}, or 0 if no data role. @hide public static int combineRolesAsBit(int powerRole, int dataRole) { checkRoles(powerRole, dataRole); final int index = ((powerRole - POWER_ROLE_OFFSET) * NUM_DATA_ROLES) + dataRole; return 1 << index; } /** @hide public static String modeToString(int mode) { StringBuilder modeString = new StringBuilder(); if (mode == MODE_NONE) { return "none"; } if ((mode & MODE_DUAL) == MODE_DUAL) { modeString.append("dual, "); } else { if ((mode & MODE_DFP) == MODE_DFP) { modeString.append("dfp, "); } else if ((mode & MODE_UFP) == MODE_UFP) { modeString.append("ufp, "); } } if ((mode & MODE_AUDIO_ACCESSORY) == MODE_AUDIO_ACCESSORY) { modeString.append("audio_acc, "); } if ((mode & MODE_DEBUG_ACCESSORY) == MODE_DEBUG_ACCESSORY) { modeString.append("debug_acc, "); } if (modeString.length() == 0) { return Integer.toString(mode); } return modeString.substring(0, modeString.length() - 2); } /** @hide public static String powerRoleToString(int role) { switch (role) { case POWER_ROLE_NONE: return "no-power"; case POWER_ROLE_SOURCE: return "source"; case POWER_ROLE_SINK: return "sink"; default: return Integer.toString(role); } } /** @hide public static String dataRoleToString(int role) { switch (role) { case DATA_ROLE_NONE: return "no-data"; case DATA_ROLE_HOST: return "host"; case DATA_ROLE_DEVICE: return "device"; default: return Integer.toString(role); } } /** @hide public static String contaminantPresenceStatusToString(int contaminantPresenceStatus) { switch (contaminantPresenceStatus) { case CONTAMINANT_DETECTION_NOT_SUPPORTED: return "not-supported"; case CONTAMINANT_DETECTION_DISABLED: return "disabled"; case CONTAMINANT_DETECTION_DETECTED: return "detected"; case CONTAMINANT_DETECTION_NOT_DETECTED: return "not detected"; default: return Integer.toString(contaminantPresenceStatus); } } /** @hide public static String roleCombinationsToString(int combo) { StringBuilder result = new StringBuilder(); result.append("["); boolean first = true; while (combo != 0) { final int index = Integer.numberOfTrailingZeros(combo); combo &= ~(1 << index); final int powerRole = (index / NUM_DATA_ROLES + POWER_ROLE_OFFSET); final int dataRole = index % NUM_DATA_ROLES; if (first) { first = false; } else { result.append(", "); } result.append(powerRoleToString(powerRole)); result.append(':'); result.append(dataRoleToString(dataRole)); } result.append("]"); return result.toString(); } /** @hide
UsbPort::checkMode
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public static void checkPowerRole(int dataRole) { Preconditions.checkArgumentInRange(dataRole, Constants.PortPowerRole.NONE, Constants.PortPowerRole.NUM_POWER_ROLES - 1, "powerRole"); }
Combines one power and one data role together into a unique value with exactly one bit set. This can be used to efficiently determine whether a combination of roles is supported by testing whether that bit is present in a bit-field. @param powerRole The desired power role: {@link UsbPortStatus#POWER_ROLE_SOURCE} or {@link UsbPortStatus#POWER_ROLE_SINK}, or 0 if no power role. @param dataRole The desired data role: {@link UsbPortStatus#DATA_ROLE_HOST} or {@link UsbPortStatus#DATA_ROLE_DEVICE}, or 0 if no data role. @hide public static int combineRolesAsBit(int powerRole, int dataRole) { checkRoles(powerRole, dataRole); final int index = ((powerRole - POWER_ROLE_OFFSET) * NUM_DATA_ROLES) + dataRole; return 1 << index; } /** @hide public static String modeToString(int mode) { StringBuilder modeString = new StringBuilder(); if (mode == MODE_NONE) { return "none"; } if ((mode & MODE_DUAL) == MODE_DUAL) { modeString.append("dual, "); } else { if ((mode & MODE_DFP) == MODE_DFP) { modeString.append("dfp, "); } else if ((mode & MODE_UFP) == MODE_UFP) { modeString.append("ufp, "); } } if ((mode & MODE_AUDIO_ACCESSORY) == MODE_AUDIO_ACCESSORY) { modeString.append("audio_acc, "); } if ((mode & MODE_DEBUG_ACCESSORY) == MODE_DEBUG_ACCESSORY) { modeString.append("debug_acc, "); } if (modeString.length() == 0) { return Integer.toString(mode); } return modeString.substring(0, modeString.length() - 2); } /** @hide public static String powerRoleToString(int role) { switch (role) { case POWER_ROLE_NONE: return "no-power"; case POWER_ROLE_SOURCE: return "source"; case POWER_ROLE_SINK: return "sink"; default: return Integer.toString(role); } } /** @hide public static String dataRoleToString(int role) { switch (role) { case DATA_ROLE_NONE: return "no-data"; case DATA_ROLE_HOST: return "host"; case DATA_ROLE_DEVICE: return "device"; default: return Integer.toString(role); } } /** @hide public static String contaminantPresenceStatusToString(int contaminantPresenceStatus) { switch (contaminantPresenceStatus) { case CONTAMINANT_DETECTION_NOT_SUPPORTED: return "not-supported"; case CONTAMINANT_DETECTION_DISABLED: return "disabled"; case CONTAMINANT_DETECTION_DETECTED: return "detected"; case CONTAMINANT_DETECTION_NOT_DETECTED: return "not detected"; default: return Integer.toString(contaminantPresenceStatus); } } /** @hide public static String roleCombinationsToString(int combo) { StringBuilder result = new StringBuilder(); result.append("["); boolean first = true; while (combo != 0) { final int index = Integer.numberOfTrailingZeros(combo); combo &= ~(1 << index); final int powerRole = (index / NUM_DATA_ROLES + POWER_ROLE_OFFSET); final int dataRole = index % NUM_DATA_ROLES; if (first) { first = false; } else { result.append(", "); } result.append(powerRoleToString(powerRole)); result.append(':'); result.append(dataRoleToString(dataRole)); } result.append("]"); return result.toString(); } /** @hide public static void checkMode(int powerRole) { Preconditions.checkArgumentInRange(powerRole, Constants.PortMode.NONE, Constants.PortMode.NUM_MODES - 1, "portMode"); } /** @hide
UsbPort::checkPowerRole
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public static void checkDataRole(int mode) { Preconditions.checkArgumentInRange(mode, Constants.PortDataRole.NONE, Constants.PortDataRole.NUM_DATA_ROLES - 1, "powerRole"); }
Combines one power and one data role together into a unique value with exactly one bit set. This can be used to efficiently determine whether a combination of roles is supported by testing whether that bit is present in a bit-field. @param powerRole The desired power role: {@link UsbPortStatus#POWER_ROLE_SOURCE} or {@link UsbPortStatus#POWER_ROLE_SINK}, or 0 if no power role. @param dataRole The desired data role: {@link UsbPortStatus#DATA_ROLE_HOST} or {@link UsbPortStatus#DATA_ROLE_DEVICE}, or 0 if no data role. @hide public static int combineRolesAsBit(int powerRole, int dataRole) { checkRoles(powerRole, dataRole); final int index = ((powerRole - POWER_ROLE_OFFSET) * NUM_DATA_ROLES) + dataRole; return 1 << index; } /** @hide public static String modeToString(int mode) { StringBuilder modeString = new StringBuilder(); if (mode == MODE_NONE) { return "none"; } if ((mode & MODE_DUAL) == MODE_DUAL) { modeString.append("dual, "); } else { if ((mode & MODE_DFP) == MODE_DFP) { modeString.append("dfp, "); } else if ((mode & MODE_UFP) == MODE_UFP) { modeString.append("ufp, "); } } if ((mode & MODE_AUDIO_ACCESSORY) == MODE_AUDIO_ACCESSORY) { modeString.append("audio_acc, "); } if ((mode & MODE_DEBUG_ACCESSORY) == MODE_DEBUG_ACCESSORY) { modeString.append("debug_acc, "); } if (modeString.length() == 0) { return Integer.toString(mode); } return modeString.substring(0, modeString.length() - 2); } /** @hide public static String powerRoleToString(int role) { switch (role) { case POWER_ROLE_NONE: return "no-power"; case POWER_ROLE_SOURCE: return "source"; case POWER_ROLE_SINK: return "sink"; default: return Integer.toString(role); } } /** @hide public static String dataRoleToString(int role) { switch (role) { case DATA_ROLE_NONE: return "no-data"; case DATA_ROLE_HOST: return "host"; case DATA_ROLE_DEVICE: return "device"; default: return Integer.toString(role); } } /** @hide public static String contaminantPresenceStatusToString(int contaminantPresenceStatus) { switch (contaminantPresenceStatus) { case CONTAMINANT_DETECTION_NOT_SUPPORTED: return "not-supported"; case CONTAMINANT_DETECTION_DISABLED: return "disabled"; case CONTAMINANT_DETECTION_DETECTED: return "detected"; case CONTAMINANT_DETECTION_NOT_DETECTED: return "not detected"; default: return Integer.toString(contaminantPresenceStatus); } } /** @hide public static String roleCombinationsToString(int combo) { StringBuilder result = new StringBuilder(); result.append("["); boolean first = true; while (combo != 0) { final int index = Integer.numberOfTrailingZeros(combo); combo &= ~(1 << index); final int powerRole = (index / NUM_DATA_ROLES + POWER_ROLE_OFFSET); final int dataRole = index % NUM_DATA_ROLES; if (first) { first = false; } else { result.append(", "); } result.append(powerRoleToString(powerRole)); result.append(':'); result.append(dataRoleToString(dataRole)); } result.append("]"); return result.toString(); } /** @hide public static void checkMode(int powerRole) { Preconditions.checkArgumentInRange(powerRole, Constants.PortMode.NONE, Constants.PortMode.NUM_MODES - 1, "portMode"); } /** @hide public static void checkPowerRole(int dataRole) { Preconditions.checkArgumentInRange(dataRole, Constants.PortPowerRole.NONE, Constants.PortPowerRole.NUM_POWER_ROLES - 1, "powerRole"); } /** @hide
UsbPort::checkDataRole
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public static void checkRoles(int powerRole, int dataRole) { Preconditions.checkArgumentInRange(powerRole, POWER_ROLE_NONE, POWER_ROLE_SINK, "powerRole"); Preconditions.checkArgumentInRange(dataRole, DATA_ROLE_NONE, DATA_ROLE_DEVICE, "dataRole"); }
Combines one power and one data role together into a unique value with exactly one bit set. This can be used to efficiently determine whether a combination of roles is supported by testing whether that bit is present in a bit-field. @param powerRole The desired power role: {@link UsbPortStatus#POWER_ROLE_SOURCE} or {@link UsbPortStatus#POWER_ROLE_SINK}, or 0 if no power role. @param dataRole The desired data role: {@link UsbPortStatus#DATA_ROLE_HOST} or {@link UsbPortStatus#DATA_ROLE_DEVICE}, or 0 if no data role. @hide public static int combineRolesAsBit(int powerRole, int dataRole) { checkRoles(powerRole, dataRole); final int index = ((powerRole - POWER_ROLE_OFFSET) * NUM_DATA_ROLES) + dataRole; return 1 << index; } /** @hide public static String modeToString(int mode) { StringBuilder modeString = new StringBuilder(); if (mode == MODE_NONE) { return "none"; } if ((mode & MODE_DUAL) == MODE_DUAL) { modeString.append("dual, "); } else { if ((mode & MODE_DFP) == MODE_DFP) { modeString.append("dfp, "); } else if ((mode & MODE_UFP) == MODE_UFP) { modeString.append("ufp, "); } } if ((mode & MODE_AUDIO_ACCESSORY) == MODE_AUDIO_ACCESSORY) { modeString.append("audio_acc, "); } if ((mode & MODE_DEBUG_ACCESSORY) == MODE_DEBUG_ACCESSORY) { modeString.append("debug_acc, "); } if (modeString.length() == 0) { return Integer.toString(mode); } return modeString.substring(0, modeString.length() - 2); } /** @hide public static String powerRoleToString(int role) { switch (role) { case POWER_ROLE_NONE: return "no-power"; case POWER_ROLE_SOURCE: return "source"; case POWER_ROLE_SINK: return "sink"; default: return Integer.toString(role); } } /** @hide public static String dataRoleToString(int role) { switch (role) { case DATA_ROLE_NONE: return "no-data"; case DATA_ROLE_HOST: return "host"; case DATA_ROLE_DEVICE: return "device"; default: return Integer.toString(role); } } /** @hide public static String contaminantPresenceStatusToString(int contaminantPresenceStatus) { switch (contaminantPresenceStatus) { case CONTAMINANT_DETECTION_NOT_SUPPORTED: return "not-supported"; case CONTAMINANT_DETECTION_DISABLED: return "disabled"; case CONTAMINANT_DETECTION_DETECTED: return "detected"; case CONTAMINANT_DETECTION_NOT_DETECTED: return "not detected"; default: return Integer.toString(contaminantPresenceStatus); } } /** @hide public static String roleCombinationsToString(int combo) { StringBuilder result = new StringBuilder(); result.append("["); boolean first = true; while (combo != 0) { final int index = Integer.numberOfTrailingZeros(combo); combo &= ~(1 << index); final int powerRole = (index / NUM_DATA_ROLES + POWER_ROLE_OFFSET); final int dataRole = index % NUM_DATA_ROLES; if (first) { first = false; } else { result.append(", "); } result.append(powerRoleToString(powerRole)); result.append(':'); result.append(dataRoleToString(dataRole)); } result.append("]"); return result.toString(); } /** @hide public static void checkMode(int powerRole) { Preconditions.checkArgumentInRange(powerRole, Constants.PortMode.NONE, Constants.PortMode.NUM_MODES - 1, "portMode"); } /** @hide public static void checkPowerRole(int dataRole) { Preconditions.checkArgumentInRange(dataRole, Constants.PortPowerRole.NONE, Constants.PortPowerRole.NUM_POWER_ROLES - 1, "powerRole"); } /** @hide public static void checkDataRole(int mode) { Preconditions.checkArgumentInRange(mode, Constants.PortDataRole.NONE, Constants.PortDataRole.NUM_DATA_ROLES - 1, "powerRole"); } /** @hide
UsbPort::checkRoles
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
public boolean isModeSupported(int mode) { if ((mSupportedModes & mode) == mode) return true; return false; }
Combines one power and one data role together into a unique value with exactly one bit set. This can be used to efficiently determine whether a combination of roles is supported by testing whether that bit is present in a bit-field. @param powerRole The desired power role: {@link UsbPortStatus#POWER_ROLE_SOURCE} or {@link UsbPortStatus#POWER_ROLE_SINK}, or 0 if no power role. @param dataRole The desired data role: {@link UsbPortStatus#DATA_ROLE_HOST} or {@link UsbPortStatus#DATA_ROLE_DEVICE}, or 0 if no data role. @hide public static int combineRolesAsBit(int powerRole, int dataRole) { checkRoles(powerRole, dataRole); final int index = ((powerRole - POWER_ROLE_OFFSET) * NUM_DATA_ROLES) + dataRole; return 1 << index; } /** @hide public static String modeToString(int mode) { StringBuilder modeString = new StringBuilder(); if (mode == MODE_NONE) { return "none"; } if ((mode & MODE_DUAL) == MODE_DUAL) { modeString.append("dual, "); } else { if ((mode & MODE_DFP) == MODE_DFP) { modeString.append("dfp, "); } else if ((mode & MODE_UFP) == MODE_UFP) { modeString.append("ufp, "); } } if ((mode & MODE_AUDIO_ACCESSORY) == MODE_AUDIO_ACCESSORY) { modeString.append("audio_acc, "); } if ((mode & MODE_DEBUG_ACCESSORY) == MODE_DEBUG_ACCESSORY) { modeString.append("debug_acc, "); } if (modeString.length() == 0) { return Integer.toString(mode); } return modeString.substring(0, modeString.length() - 2); } /** @hide public static String powerRoleToString(int role) { switch (role) { case POWER_ROLE_NONE: return "no-power"; case POWER_ROLE_SOURCE: return "source"; case POWER_ROLE_SINK: return "sink"; default: return Integer.toString(role); } } /** @hide public static String dataRoleToString(int role) { switch (role) { case DATA_ROLE_NONE: return "no-data"; case DATA_ROLE_HOST: return "host"; case DATA_ROLE_DEVICE: return "device"; default: return Integer.toString(role); } } /** @hide public static String contaminantPresenceStatusToString(int contaminantPresenceStatus) { switch (contaminantPresenceStatus) { case CONTAMINANT_DETECTION_NOT_SUPPORTED: return "not-supported"; case CONTAMINANT_DETECTION_DISABLED: return "disabled"; case CONTAMINANT_DETECTION_DETECTED: return "detected"; case CONTAMINANT_DETECTION_NOT_DETECTED: return "not detected"; default: return Integer.toString(contaminantPresenceStatus); } } /** @hide public static String roleCombinationsToString(int combo) { StringBuilder result = new StringBuilder(); result.append("["); boolean first = true; while (combo != 0) { final int index = Integer.numberOfTrailingZeros(combo); combo &= ~(1 << index); final int powerRole = (index / NUM_DATA_ROLES + POWER_ROLE_OFFSET); final int dataRole = index % NUM_DATA_ROLES; if (first) { first = false; } else { result.append(", "); } result.append(powerRoleToString(powerRole)); result.append(':'); result.append(dataRoleToString(dataRole)); } result.append("]"); return result.toString(); } /** @hide public static void checkMode(int powerRole) { Preconditions.checkArgumentInRange(powerRole, Constants.PortMode.NONE, Constants.PortMode.NUM_MODES - 1, "portMode"); } /** @hide public static void checkPowerRole(int dataRole) { Preconditions.checkArgumentInRange(dataRole, Constants.PortPowerRole.NONE, Constants.PortPowerRole.NUM_POWER_ROLES - 1, "powerRole"); } /** @hide public static void checkDataRole(int mode) { Preconditions.checkArgumentInRange(mode, Constants.PortDataRole.NONE, Constants.PortDataRole.NUM_DATA_ROLES - 1, "powerRole"); } /** @hide public static void checkRoles(int powerRole, int dataRole) { Preconditions.checkArgumentInRange(powerRole, POWER_ROLE_NONE, POWER_ROLE_SINK, "powerRole"); Preconditions.checkArgumentInRange(dataRole, DATA_ROLE_NONE, DATA_ROLE_DEVICE, "dataRole"); } /** @hide
UsbPort::isModeSupported
java
Reginer/aosp-android-jar
android-32/src/android/hardware/usb/UsbPort.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/hardware/usb/UsbPort.java
MIT
private void update(boolean near, long timeStampNs) { if (mPrevNearTimeNs != 0 && timeStampNs > mPrevNearTimeNs && mNear) { mNearDurationNs += timeStampNs - mPrevNearTimeNs; logDebug("Updating duration: " + mNearDurationNs); } if (near) { logDebug("Set prevNearTimeNs: " + timeStampNs); mPrevNearTimeNs = timeStampNs; } mNear = near; }
@param near is the sensor showing the near state right now @param timeStampNs time of this event in nanoseconds
ProximityClassifier::update
java
Reginer/aosp-android-jar
android-34/src/com/android/systemui/classifier/ProximityClassifier.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/systemui/classifier/ProximityClassifier.java
MIT
public @SearchResultType int getResultType() { return mResultType; }
Retrieves the result type {@see SearchResultType}.
SearchTarget::getResultType
java
Reginer/aosp-android-jar
android-34/src/android/app/search/SearchTarget.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/search/SearchTarget.java
MIT
public float getScore() { return mScore; }
Retrieves the score of the target.
SearchTarget::getScore
java
Reginer/aosp-android-jar
android-34/src/android/app/search/SearchTarget.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/search/SearchTarget.java
MIT
public boolean isHidden() { return mHidden; }
Indicates whether this object should be hidden and shown only on demand.
SearchTarget::isHidden
java
Reginer/aosp-android-jar
android-34/src/android/app/search/SearchTarget.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/app/search/SearchTarget.java
MIT
public YuvImage(byte[] yuv, int format, int width, int height, int[] strides) { if (format != ImageFormat.NV21 && format != ImageFormat.YUY2) { throw new IllegalArgumentException( "only support ImageFormat.NV21 " + "and ImageFormat.YUY2 for now"); } if (width <= 0 || height <= 0) { throw new IllegalArgumentException( "width and height must large than 0"); } if (yuv == null) { throw new IllegalArgumentException("yuv cannot be null"); } if (strides == null) { mStrides = calculateStrides(width, format); } else { mStrides = strides; } mData = yuv; mFormat = format; mWidth = width; mHeight = height; }
Construct an YuvImage. @param yuv The YUV data. In the case of more than one image plane, all the planes must be concatenated into a single byte array. @param format The YUV data format as defined in {@link ImageFormat}. @param width The width of the YuvImage. @param height The height of the YuvImage. @param strides (Optional) Row bytes of each image plane. If yuv contains padding, the stride of each image must be provided. If strides is null, the method assumes no padding and derives the row bytes by format and width itself. @throws IllegalArgumentException if format is not support; width or height <= 0; or yuv is null.
YuvImage::YuvImage
java
Reginer/aosp-android-jar
android-32/src/android/graphics/YuvImage.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/YuvImage.java
MIT
public boolean compressToJpeg(Rect rectangle, int quality, OutputStream stream) { Rect wholeImage = new Rect(0, 0, mWidth, mHeight); if (!wholeImage.contains(rectangle)) { throw new IllegalArgumentException( "rectangle is not inside the image"); } if (quality < 0 || quality > 100) { throw new IllegalArgumentException("quality must be 0..100"); } if (stream == null) { throw new IllegalArgumentException("stream cannot be null"); } adjustRectangle(rectangle); int[] offsets = calculateOffsets(rectangle.left, rectangle.top); return nativeCompressToJpeg(mData, mFormat, rectangle.width(), rectangle.height(), offsets, mStrides, quality, stream, new byte[WORKING_COMPRESS_STORAGE]); }
Compress a rectangle region in the YuvImage to a jpeg. Only ImageFormat.NV21 and ImageFormat.YUY2 are supported for now. @param rectangle The rectangle region to be compressed. The medthod checks if rectangle is inside the image. Also, the method modifies rectangle if the chroma pixels in it are not matched with the luma pixels in it. @param quality Hint to the compressor, 0-100. 0 meaning compress for small size, 100 meaning compress for max quality. @param stream OutputStream to write the compressed data. @return True if the compression is successful. @throws IllegalArgumentException if rectangle is invalid; quality is not within [0, 100]; or stream is null.
YuvImage::compressToJpeg
java
Reginer/aosp-android-jar
android-32/src/android/graphics/YuvImage.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/YuvImage.java
MIT
public byte[] getYuvData() { return mData; }
@return the YUV data.
YuvImage::getYuvData
java
Reginer/aosp-android-jar
android-32/src/android/graphics/YuvImage.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/YuvImage.java
MIT
public int getYuvFormat() { return mFormat; }
@return the YUV format as defined in {@link ImageFormat}.
YuvImage::getYuvFormat
java
Reginer/aosp-android-jar
android-32/src/android/graphics/YuvImage.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/YuvImage.java
MIT
public int[] getStrides() { return mStrides; }
@return the number of row bytes in each image plane.
YuvImage::getStrides
java
Reginer/aosp-android-jar
android-32/src/android/graphics/YuvImage.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/YuvImage.java
MIT
public int getWidth() { return mWidth; }
@return the width of the image.
YuvImage::getWidth
java
Reginer/aosp-android-jar
android-32/src/android/graphics/YuvImage.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/YuvImage.java
MIT
public int getHeight() { return mHeight; }
@return the height of the image.
YuvImage::getHeight
java
Reginer/aosp-android-jar
android-32/src/android/graphics/YuvImage.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/graphics/YuvImage.java
MIT
public void onConfigurationChanged(Configuration newConfig) { final int rotation = newConfig.windowConfiguration.getRotation(); final Locale locale = mContext.getResources().getConfiguration().locale; final int ld = TextUtils.getLayoutDirectionFromLocale(locale); if (!locale.equals(mLocale) || ld != mLayoutDirection) { if (DEBUG) { Log.v(TAG, String.format( "config changed locale/LD: %s (%d) -> %s (%d)", mLocale, mLayoutDirection, locale, ld)); } mLocale = locale; mLayoutDirection = ld; refreshLayout(ld); } repositionNavigationBar(rotation); if (canShowSecondaryHandle()) { if (rotation != mCurrentRotation) { mCurrentRotation = rotation; orientSecondaryHomeHandle(); } } }
Called when a non-reloading configuration change happens and we need to update.
NavigationBar::onConfigurationChanged
java
Reginer/aosp-android-jar
android-33/src/com/android/systemui/navigationbar/NavigationBar.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/systemui/navigationbar/NavigationBar.java
MIT
public void restoreAppearanceAndTransientState() { final int transitionMode = transitionMode(mTransientShown, mAppearance); mTransitionMode = transitionMode; checkNavBarModes(); if (mAutoHideController != null) { mAutoHideController.touchAutoHide(); } if (mLightBarController != null) { mLightBarController.onNavigationBarAppearanceChanged(mAppearance, true /* nbModeChanged */, transitionMode, false /* navbarColorManagedByIme */); } }
Called when a non-reloading configuration change happens and we need to update. public void onConfigurationChanged(Configuration newConfig) { final int rotation = newConfig.windowConfiguration.getRotation(); final Locale locale = mContext.getResources().getConfiguration().locale; final int ld = TextUtils.getLayoutDirectionFromLocale(locale); if (!locale.equals(mLocale) || ld != mLayoutDirection) { if (DEBUG) { Log.v(TAG, String.format( "config changed locale/LD: %s (%d) -> %s (%d)", mLocale, mLayoutDirection, locale, ld)); } mLocale = locale; mLayoutDirection = ld; refreshLayout(ld); } repositionNavigationBar(rotation); if (canShowSecondaryHandle()) { if (rotation != mCurrentRotation) { mCurrentRotation = rotation; orientSecondaryHomeHandle(); } } } private void initSecondaryHomeHandleForRotation() { if (mNavBarMode != NAV_BAR_MODE_GESTURAL) { return; } mOrientationHandle = new QuickswitchOrientedNavHandle(mContext); mOrientationHandle.setId(R.id.secondary_home_handle); getBarTransitions().addDarkIntensityListener(mOrientationHandleIntensityListener); mOrientationParams = new WindowManager.LayoutParams(0, 0, WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_SLIPPERY, PixelFormat.TRANSLUCENT); mOrientationParams.setTitle("SecondaryHomeHandle" + mContext.getDisplayId()); mOrientationParams.privateFlags |= PRIVATE_FLAG_NO_MOVE_ANIMATION | WindowManager.LayoutParams.PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT; mWindowManager.addView(mOrientationHandle, mOrientationParams); mOrientationHandle.setVisibility(View.GONE); mOrientationParams.setFitInsetsTypes(0 /* types*/); mOrientationHandleGlobalLayoutListener = () -> { if (mStartingQuickSwitchRotation == -1) { return; } RectF boundsOnScreen = mOrientationHandle.computeHomeHandleBounds(); mOrientationHandle.mapRectFromViewToScreenCoords(boundsOnScreen, true); Rect boundsRounded = new Rect(); boundsOnScreen.roundOut(boundsRounded); setOrientedHandleSamplingRegion(boundsRounded); }; mOrientationHandle.getViewTreeObserver().addOnGlobalLayoutListener( mOrientationHandleGlobalLayoutListener); } private void orientSecondaryHomeHandle() { if (!canShowSecondaryHandle()) { return; } if (mStartingQuickSwitchRotation == -1) { resetSecondaryHandle(); } else { int deltaRotation = deltaRotation(mCurrentRotation, mStartingQuickSwitchRotation); if (mStartingQuickSwitchRotation == -1 || deltaRotation == -1) { // Curious if starting quickswitch can change between the if check and our delta Log.d(TAG, "secondary nav delta rotation: " + deltaRotation + " current: " + mCurrentRotation + " starting: " + mStartingQuickSwitchRotation); } int height = 0; int width = 0; Rect dispSize = mWindowManager.getCurrentWindowMetrics().getBounds(); mOrientationHandle.setDeltaRotation(deltaRotation); switch (deltaRotation) { case Surface.ROTATION_90: case Surface.ROTATION_270: height = dispSize.height(); width = mView.getHeight(); break; case Surface.ROTATION_180: case Surface.ROTATION_0: // TODO(b/152683657): Need to determine best UX for this if (!mShowOrientedHandleForImmersiveMode) { resetSecondaryHandle(); return; } width = dispSize.width(); height = mView.getHeight(); break; } mOrientationParams.gravity = deltaRotation == Surface.ROTATION_0 ? Gravity.BOTTOM : (deltaRotation == Surface.ROTATION_90 ? Gravity.LEFT : Gravity.RIGHT); mOrientationParams.height = height; mOrientationParams.width = width; mWindowManager.updateViewLayout(mOrientationHandle, mOrientationParams); mView.setVisibility(View.GONE); mOrientationHandle.setVisibility(View.VISIBLE); } } private void resetSecondaryHandle() { if (mOrientationHandle != null) { // Case where nav mode is changed w/o ever invoking a quickstep // mOrientedHandle is initialized lazily mOrientationHandle.setVisibility(View.GONE); } mView.setVisibility(View.VISIBLE); setOrientedHandleSamplingRegion(null); } private void reconfigureHomeLongClick() { if (mView.getHomeButton().getCurrentView() == null) { return; } if (mHomeButtonLongPressDurationMs.isPresent() || !mLongPressHomeEnabled) { mView.getHomeButton().getCurrentView().setLongClickable(false); mView.getHomeButton().getCurrentView().setHapticFeedbackEnabled(false); mView.getHomeButton().setOnLongClickListener(null); } else { mView.getHomeButton().getCurrentView().setLongClickable(true); mView.getHomeButton().getCurrentView().setHapticFeedbackEnabled(true); mView.getHomeButton().setOnLongClickListener(this::onHomeLongClick); } } private int deltaRotation(int oldRotation, int newRotation) { int delta = newRotation - oldRotation; if (delta < 0) delta += 4; return delta; } public void dump(PrintWriter pw) { pw.println("NavigationBar (displayId=" + mDisplayId + "):"); pw.println(" mStartingQuickSwitchRotation=" + mStartingQuickSwitchRotation); pw.println(" mCurrentRotation=" + mCurrentRotation); pw.println(" mHomeButtonLongPressDurationMs=" + mHomeButtonLongPressDurationMs); pw.println(" mLongPressHomeEnabled=" + mLongPressHomeEnabled); pw.println(" mNavigationBarWindowState=" + windowStateToString(mNavigationBarWindowState)); pw.println(" mTransitionMode=" + BarTransitions.modeToString(mTransitionMode)); pw.println(" mTransientShown=" + mTransientShown); pw.println(" mTransientShownFromGestureOnSystemBar=" + mTransientShownFromGestureOnSystemBar); dumpBarTransitions(pw, "mNavigationBarView", getBarTransitions()); pw.println(" mOrientedHandleSamplingRegion: " + mOrientedHandleSamplingRegion); mView.dump(pw); mRegionSamplingHelper.dump(pw); } // ----- CommandQueue Callbacks ----- @Override public void setImeWindowStatus(int displayId, IBinder token, int vis, int backDisposition, boolean showImeSwitcher) { if (displayId != mDisplayId) { return; } boolean imeShown = mNavBarHelper.isImeShown(vis); showImeSwitcher = imeShown && showImeSwitcher; int hints = Utilities.calculateBackDispositionHints(mNavigationIconHints, backDisposition, imeShown, showImeSwitcher); if (hints == mNavigationIconHints) return; setNavigationIconHints(hints); checkBarModes(); updateSystemUiStateFlags(); } @Override public void setWindowState( int displayId, @WindowType int window, @WindowVisibleState int state) { if (displayId == mDisplayId && window == StatusBarManager.WINDOW_NAVIGATION_BAR && mNavigationBarWindowState != state) { mNavigationBarWindowState = state; updateSystemUiStateFlags(); mShowOrientedHandleForImmersiveMode = state == WINDOW_STATE_HIDDEN; if (mOrientationHandle != null && mStartingQuickSwitchRotation != -1) { orientSecondaryHomeHandle(); } if (DEBUG_WINDOW_STATE) Log.d(TAG, "Navigation bar " + windowStateToString(state)); setWindowVisible(isNavBarWindowVisible()); } } @Override public void onRotationProposal(final int rotation, boolean isValid) { // The CommandQueue callbacks are added when the view is created to ensure we track other // states, but until the view is attached (at the next traversal), the view's display is // not valid. Just ignore the rotation in this case. if (!mView.isAttachedToWindow()) return; final boolean rotateSuggestionsDisabled = RotationButtonController .hasDisable2RotateSuggestionFlag(mDisabledFlags2); final RotationButtonController rotationButtonController = mView.getRotationButtonController(); final RotationButton rotationButton = rotationButtonController.getRotationButton(); if (RotationContextButton.DEBUG_ROTATION) { Log.v(TAG, "onRotationProposal proposedRotation=" + Surface.rotationToString(rotation) + ", isValid=" + isValid + ", mNavBarWindowState=" + StatusBarManager.windowStateToString(mNavigationBarWindowState) + ", rotateSuggestionsDisabled=" + rotateSuggestionsDisabled + ", isRotateButtonVisible=" + rotationButton.isVisible()); } // Respect the disabled flag, no need for action as flag change callback will handle hiding if (rotateSuggestionsDisabled) return; rotationButtonController.onRotationProposal(rotation, isValid); } @Override public void onRecentsAnimationStateChanged(boolean running) { mView.getRotationButtonController().setRecentsAnimationRunning(running); } /** Restores the appearance and the transient saved state to {@link NavigationBar}.
NavigationBar::restoreAppearanceAndTransientState
java
Reginer/aosp-android-jar
android-33/src/com/android/systemui/navigationbar/NavigationBar.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/systemui/navigationbar/NavigationBar.java
MIT
private boolean onLongPressNavigationButtons(View v, @IdRes int btnId1, @IdRes int btnId2) { try { boolean sendBackLongPress = false; IActivityTaskManager activityManager = ActivityTaskManager.getService(); boolean touchExplorationEnabled = mAccessibilityManager.isTouchExplorationEnabled(); boolean inLockTaskMode = activityManager.isInLockTaskMode(); boolean stopLockTaskMode = false; try { if (inLockTaskMode && !touchExplorationEnabled) { long time = System.currentTimeMillis(); // If we recently long-pressed the other button then they were // long-pressed 'together' if ((time - mLastLockToAppLongPress) < LOCK_TO_APP_GESTURE_TOLERENCE) { stopLockTaskMode = true; return true; } else if (v.getId() == btnId1) { ButtonDispatcher button = btnId2 == R.id.recent_apps ? mView.getRecentsButton() : mView.getHomeButton(); if (!button.getCurrentView().isPressed()) { // If we aren't pressing recents/home right now then they presses // won't be together, so send the standard long-press action. sendBackLongPress = true; } } mLastLockToAppLongPress = time; } else { // If this is back still need to handle sending the long-press event. if (v.getId() == btnId1) { sendBackLongPress = true; } else if (touchExplorationEnabled && inLockTaskMode) { // When in accessibility mode a long press that is recents/home (not back) // should stop lock task. stopLockTaskMode = true; return true; } else if (v.getId() == btnId2) { return btnId2 == R.id.recent_apps ? false : onHomeLongClick(mView.getHomeButton().getCurrentView()); } } } finally { if (stopLockTaskMode) { activityManager.stopSystemLockTaskMode(); // When exiting refresh disabled flags. mView.updateNavButtonIcons(); } } if (sendBackLongPress) { KeyButtonView keyButtonView = (KeyButtonView) v; keyButtonView.sendEvent(KeyEvent.ACTION_DOWN, KeyEvent.FLAG_LONG_PRESS); keyButtonView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); return true; } } catch (RemoteException e) { Log.d(TAG, "Unable to reach activity manager", e); } return false; }
This handles long-press of both back and recents/home. Back is the common button with combination of recents if it is visible or home if recents is invisible. They are handled together to capture them both being long-pressed at the same time to exit screen pinning (lock task). When accessibility mode is on, only a long-press from recents/home is required to exit. In all other circumstances we try to pass through long-press events for Back, so that apps can still use it. Which can be from two things. 1) Not currently in screen pinning (lock task). 2) Back is long-pressed without recents/home.
NavigationBar::onLongPressNavigationButtons
java
Reginer/aosp-android-jar
android-33/src/com/android/systemui/navigationbar/NavigationBar.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/systemui/navigationbar/NavigationBar.java
MIT
public static void restart(String name) { SystemProperties.set("ctl.restart", name); }
State of a known {@code init} service. public enum State { RUNNING("running"), STOPPING("stopping"), STOPPED("stopped"), RESTARTING("restarting"); State(String state) { sStates.put(state, this); } } private static Object sPropertyLock = new Object(); static { SystemProperties.addChangeCallback(new Runnable() { @Override public void run() { synchronized (sPropertyLock) { sPropertyLock.notifyAll(); } } }); } /** Request that the init daemon start a named service. @UnsupportedAppUsage public static void start(String name) { SystemProperties.set("ctl.start", name); } /** Request that the init daemon stop a named service. @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) public static void stop(String name) { SystemProperties.set("ctl.stop", name); } /** Request that the init daemon restart a named service.
SystemService::restart
java
Reginer/aosp-android-jar
android-33/src/android/os/SystemService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/os/SystemService.java
MIT
public static State getState(String service) { final String rawState = SystemProperties.get("init.svc." + service); final State state = sStates.get(rawState); if (state != null) { return state; } else { return State.STOPPED; } }
Return current state of given service.
SystemService::getState
java
Reginer/aosp-android-jar
android-33/src/android/os/SystemService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/os/SystemService.java
MIT
public static boolean isStopped(String service) { return State.STOPPED.equals(getState(service)); }
Check if given service is {@link State#STOPPED}.
SystemService::isStopped
java
Reginer/aosp-android-jar
android-33/src/android/os/SystemService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/os/SystemService.java
MIT
public static boolean isRunning(String service) { return State.RUNNING.equals(getState(service)); }
Check if given service is {@link State#RUNNING}.
SystemService::isRunning
java
Reginer/aosp-android-jar
android-33/src/android/os/SystemService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/os/SystemService.java
MIT
public static void waitForState(String service, State state, long timeoutMillis) throws TimeoutException { final long endMillis = SystemClock.elapsedRealtime() + timeoutMillis; while (true) { synchronized (sPropertyLock) { final State currentState = getState(service); if (state.equals(currentState)) { return; } if (SystemClock.elapsedRealtime() >= endMillis) { throw new TimeoutException("Service " + service + " currently " + currentState + "; waited " + timeoutMillis + "ms for " + state); } try { sPropertyLock.wait(timeoutMillis); } catch (InterruptedException e) { } } } }
Wait until given service has entered specific state.
SystemService::waitForState
java
Reginer/aosp-android-jar
android-33/src/android/os/SystemService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/os/SystemService.java
MIT
public static void waitForAnyStopped(String... services) { while (true) { synchronized (sPropertyLock) { for (String service : services) { if (State.STOPPED.equals(getState(service))) { return; } } try { sPropertyLock.wait(); } catch (InterruptedException e) { } } } }
Wait until any of given services enters {@link State#STOPPED}.
SystemService::waitForAnyStopped
java
Reginer/aosp-android-jar
android-33/src/android/os/SystemService.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/os/SystemService.java
MIT
public DropDownListView(@NonNull Context context, boolean hijackFocus) { this(context, hijackFocus, com.android.internal.R.attr.dropDownListViewStyle); }
Creates a new list view wrapper. @param context this view's context
DropDownListView::DropDownListView
java
Reginer/aosp-android-jar
android-32/src/android/widget/DropDownListView.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/widget/DropDownListView.java
MIT
public DropDownListView(@NonNull Context context, boolean hijackFocus, int defStyleAttr) { super(context, null, defStyleAttr); mHijackFocus = hijackFocus; // TODO: Add an API to control this setCacheColorHint(0); // Transparent, since the background drawable could be anything. }
Creates a new list view wrapper. @param context this view's context
DropDownListView::DropDownListView
java
Reginer/aosp-android-jar
android-32/src/android/widget/DropDownListView.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/widget/DropDownListView.java
MIT
public boolean onForwardedEvent(@NonNull MotionEvent event, int activePointerId) { boolean handledEvent = true; boolean clearPressedItem = false; final int actionMasked = event.getActionMasked(); switch (actionMasked) { case MotionEvent.ACTION_CANCEL: handledEvent = false; break; case MotionEvent.ACTION_UP: handledEvent = false; // $FALL-THROUGH$ case MotionEvent.ACTION_MOVE: final int activeIndex = event.findPointerIndex(activePointerId); if (activeIndex < 0) { handledEvent = false; break; } final int x = (int) event.getX(activeIndex); final int y = (int) event.getY(activeIndex); final int position = pointToPosition(x, y); if (position == INVALID_POSITION) { clearPressedItem = true; break; } final View child = getChildAt(position - getFirstVisiblePosition()); setPressedItem(child, position, x, y); handledEvent = true; if (actionMasked == MotionEvent.ACTION_UP) { final long id = getItemIdAtPosition(position); performItemClick(child, position, id); } break; } // Failure to handle the event cancels forwarding. if (!handledEvent || clearPressedItem) { clearPressedItem(); } // Manage automatic scrolling. if (handledEvent) { if (mScrollHelper == null) { mScrollHelper = new AbsListViewAutoScroller(this); } mScrollHelper.setEnabled(true); mScrollHelper.onTouch(this, event); } else if (mScrollHelper != null) { mScrollHelper.setEnabled(false); } return handledEvent; }
Handles forwarded events. @param activePointerId id of the pointer that activated forwarding @return whether the event was handled
DropDownListView::onForwardedEvent
java
Reginer/aosp-android-jar
android-32/src/android/widget/DropDownListView.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/widget/DropDownListView.java
MIT
public void setListSelectionHidden(boolean hideListSelection) { mListSelectionHidden = hideListSelection; }
Sets whether the list selection is hidden, as part of a workaround for a touch mode issue (see the declaration for mListSelectionHidden). @param hideListSelection {@code true} to hide list selection, {@code false} to show
DropDownListView::setListSelectionHidden
java
Reginer/aosp-android-jar
android-32/src/android/widget/DropDownListView.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/widget/DropDownListView.java
MIT
public static Map<Integer, Map<String, List<Rule>>> splitRulesIntoIndexBuckets( List<Rule> rules) { if (rules == null) { throw new IllegalArgumentException( "Index buckets cannot be created for null rule list."); } Map<Integer, Map<String, List<Rule>>> typeOrganizedRuleMap = new HashMap(); typeOrganizedRuleMap.put(NOT_INDEXED, new HashMap()); typeOrganizedRuleMap.put(PACKAGE_NAME_INDEXED, new HashMap<>()); typeOrganizedRuleMap.put(APP_CERTIFICATE_INDEXED, new HashMap<>()); // Split the rules into the appropriate indexed pattern. The Tree Maps help us to keep the // entries sorted by their index key. for (Rule rule : rules) { RuleIndexingDetails indexingDetails; try { indexingDetails = getIndexingDetails(rule.getFormula()); } catch (Exception e) { throw new IllegalArgumentException( String.format("Malformed rule identified. [%s]", rule.toString())); } int ruleIndexType = indexingDetails.getIndexType(); String ruleKey = indexingDetails.getRuleKey(); if (!typeOrganizedRuleMap.get(ruleIndexType).containsKey(ruleKey)) { typeOrganizedRuleMap.get(ruleIndexType).put(ruleKey, new ArrayList()); } typeOrganizedRuleMap.get(ruleIndexType).get(ruleKey).add(rule); } return typeOrganizedRuleMap; }
Splits a given rule list into three indexing categories. Each rule category is returned as a TreeMap that is sorted by their indexing keys -- where keys correspond to package name for PACKAGE_NAME_INDEXED rules, app certificate for APP_CERTIFICATE_INDEXED rules and N/A for NOT_INDEXED rules.
RuleIndexingDetailsIdentifier::splitRulesIntoIndexBuckets
java
Reginer/aosp-android-jar
android-31/src/com/android/server/integrity/serializer/RuleIndexingDetailsIdentifier.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/integrity/serializer/RuleIndexingDetailsIdentifier.java
MIT
static Pair<ByteBuffer, Long> findZipEndOfCentralDirectoryRecord(RandomAccessFile zip) throws IOException { // ZIP End of Central Directory (EOCD) record is located at the very end of the ZIP archive. // The record can be identified by its 4-byte signature/magic which is located at the very // beginning of the record. A complication is that the record is variable-length because of // the comment field. // The algorithm for locating the ZIP EOCD record is as follows. We search backwards from // end of the buffer for the EOCD record signature. Whenever we find a signature, we check // the candidate record's comment length is such that the remainder of the record takes up // exactly the remaining bytes in the buffer. The search is bounded because the maximum // size of the comment field is 65535 bytes because the field is an unsigned 16-bit number. // TODO(b/193592496) RandomAccessFile#length long fileSize = zip.getChannel().size(); if (fileSize < ZIP_EOCD_REC_MIN_SIZE) { return null; } // Optimization: 99.99% of APKs have a zero-length comment field in the EoCD record and thus // the EoCD record offset is known in advance. Try that offset first to avoid unnecessarily // reading more data. Pair<ByteBuffer, Long> result = findZipEndOfCentralDirectoryRecord(zip, 0); if (result != null) { return result; } // EoCD does not start where we expected it to. Perhaps it contains a non-empty comment // field. Expand the search. The maximum size of the comment field in EoCD is 65535 because // the comment length field is an unsigned 16-bit number. return findZipEndOfCentralDirectoryRecord(zip, UINT16_MAX_VALUE); }
Returns the ZIP End of Central Directory record of the provided ZIP file. @return contents of the ZIP End of Central Directory record and the record's offset in the file or {@code null} if the file does not contain the record. @throws IOException if an I/O error occurs while reading the file.
ZipUtils::findZipEndOfCentralDirectoryRecord
java
Reginer/aosp-android-jar
android-34/src/android/util/apk/ZipUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/util/apk/ZipUtils.java
MIT
private static Pair<ByteBuffer, Long> findZipEndOfCentralDirectoryRecord( RandomAccessFile zip, int maxCommentSize) throws IOException { // ZIP End of Central Directory (EOCD) record is located at the very end of the ZIP archive. // The record can be identified by its 4-byte signature/magic which is located at the very // beginning of the record. A complication is that the record is variable-length because of // the comment field. // The algorithm for locating the ZIP EOCD record is as follows. We search backwards from // end of the buffer for the EOCD record signature. Whenever we find a signature, we check // the candidate record's comment length is such that the remainder of the record takes up // exactly the remaining bytes in the buffer. The search is bounded because the maximum // size of the comment field is 65535 bytes because the field is an unsigned 16-bit number. if ((maxCommentSize < 0) || (maxCommentSize > UINT16_MAX_VALUE)) { throw new IllegalArgumentException("maxCommentSize: " + maxCommentSize); } // TODO(b/193592496) RandomAccessFile#length long fileSize = zip.getChannel().size(); if (fileSize < ZIP_EOCD_REC_MIN_SIZE) { // No space for EoCD record in the file. return null; } // Lower maxCommentSize if the file is too small. maxCommentSize = (int) Math.min(maxCommentSize, fileSize - ZIP_EOCD_REC_MIN_SIZE); ByteBuffer buf = ByteBuffer.allocate(ZIP_EOCD_REC_MIN_SIZE + maxCommentSize); buf.order(ByteOrder.LITTLE_ENDIAN); long bufOffsetInFile = fileSize - buf.capacity(); zip.seek(bufOffsetInFile); zip.readFully(buf.array(), buf.arrayOffset(), buf.capacity()); int eocdOffsetInBuf = findZipEndOfCentralDirectoryRecord(buf); if (eocdOffsetInBuf == -1) { // No EoCD record found in the buffer return null; } // EoCD found buf.position(eocdOffsetInBuf); ByteBuffer eocd = buf.slice(); eocd.order(ByteOrder.LITTLE_ENDIAN); return Pair.create(eocd, bufOffsetInFile + eocdOffsetInBuf); }
Returns the ZIP End of Central Directory record of the provided ZIP file. @param maxCommentSize maximum accepted size (in bytes) of EoCD comment field. The permitted value is from 0 to 65535 inclusive. The smaller the value, the faster this method locates the record, provided its comment field is no longer than this value. @return contents of the ZIP End of Central Directory record and the record's offset in the file or {@code null} if the file does not contain the record. @throws IOException if an I/O error occurs while reading the file.
ZipUtils::findZipEndOfCentralDirectoryRecord
java
Reginer/aosp-android-jar
android-34/src/android/util/apk/ZipUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/util/apk/ZipUtils.java
MIT
private static int findZipEndOfCentralDirectoryRecord(ByteBuffer zipContents) { assertByteOrderLittleEndian(zipContents); // ZIP End of Central Directory (EOCD) record is located at the very end of the ZIP archive. // The record can be identified by its 4-byte signature/magic which is located at the very // beginning of the record. A complication is that the record is variable-length because of // the comment field. // The algorithm for locating the ZIP EOCD record is as follows. We search backwards from // end of the buffer for the EOCD record signature. Whenever we find a signature, we check // the candidate record's comment length is such that the remainder of the record takes up // exactly the remaining bytes in the buffer. The search is bounded because the maximum // size of the comment field is 65535 bytes because the field is an unsigned 16-bit number. int archiveSize = zipContents.capacity(); if (archiveSize < ZIP_EOCD_REC_MIN_SIZE) { return -1; } int maxCommentLength = Math.min(archiveSize - ZIP_EOCD_REC_MIN_SIZE, UINT16_MAX_VALUE); int eocdWithEmptyCommentStartPosition = archiveSize - ZIP_EOCD_REC_MIN_SIZE; for (int expectedCommentLength = 0; expectedCommentLength <= maxCommentLength; expectedCommentLength++) { int eocdStartPos = eocdWithEmptyCommentStartPosition - expectedCommentLength; if (zipContents.getInt(eocdStartPos) == ZIP_EOCD_REC_SIG) { int actualCommentLength = getUnsignedInt16( zipContents, eocdStartPos + ZIP_EOCD_COMMENT_LENGTH_FIELD_OFFSET); if (actualCommentLength == expectedCommentLength) { return eocdStartPos; } } } return -1; }
Returns the position at which ZIP End of Central Directory record starts in the provided buffer or {@code -1} if the record is not present. <p>NOTE: Byte order of {@code zipContents} must be little-endian.
ZipUtils::findZipEndOfCentralDirectoryRecord
java
Reginer/aosp-android-jar
android-34/src/android/util/apk/ZipUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/util/apk/ZipUtils.java
MIT
public static final boolean isZip64EndOfCentralDirectoryLocatorPresent( RandomAccessFile zip, long zipEndOfCentralDirectoryPosition) throws IOException { // ZIP64 End of Central Directory Locator immediately precedes the ZIP End of Central // Directory Record. long locatorPosition = zipEndOfCentralDirectoryPosition - ZIP64_EOCD_LOCATOR_SIZE; if (locatorPosition < 0) { return false; } zip.seek(locatorPosition); // RandomAccessFile.readInt assumes big-endian byte order, but ZIP format uses // little-endian. return zip.readInt() == ZIP64_EOCD_LOCATOR_SIG_REVERSE_BYTE_ORDER; }
Returns {@code true} if the provided file contains a ZIP64 End of Central Directory Locator. @param zipEndOfCentralDirectoryPosition offset of the ZIP End of Central Directory record in the file. @throws IOException if an I/O error occurs while reading the file.
ZipUtils::isZip64EndOfCentralDirectoryLocatorPresent
java
Reginer/aosp-android-jar
android-34/src/android/util/apk/ZipUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/util/apk/ZipUtils.java
MIT
public static long getZipEocdCentralDirectoryOffset(ByteBuffer zipEndOfCentralDirectory) { assertByteOrderLittleEndian(zipEndOfCentralDirectory); return getUnsignedInt32( zipEndOfCentralDirectory, zipEndOfCentralDirectory.position() + ZIP_EOCD_CENTRAL_DIR_OFFSET_FIELD_OFFSET); }
Returns the offset of the start of the ZIP Central Directory in the archive. <p>NOTE: Byte order of {@code zipEndOfCentralDirectory} must be little-endian.
ZipUtils::getZipEocdCentralDirectoryOffset
java
Reginer/aosp-android-jar
android-34/src/android/util/apk/ZipUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/util/apk/ZipUtils.java
MIT
public static void setZipEocdCentralDirectoryOffset( ByteBuffer zipEndOfCentralDirectory, long offset) { assertByteOrderLittleEndian(zipEndOfCentralDirectory); setUnsignedInt32( zipEndOfCentralDirectory, zipEndOfCentralDirectory.position() + ZIP_EOCD_CENTRAL_DIR_OFFSET_FIELD_OFFSET, offset); }
Sets the offset of the start of the ZIP Central Directory in the archive. <p>NOTE: Byte order of {@code zipEndOfCentralDirectory} must be little-endian.
ZipUtils::setZipEocdCentralDirectoryOffset
java
Reginer/aosp-android-jar
android-34/src/android/util/apk/ZipUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/util/apk/ZipUtils.java
MIT
public static long getZipEocdCentralDirectorySizeBytes(ByteBuffer zipEndOfCentralDirectory) { assertByteOrderLittleEndian(zipEndOfCentralDirectory); return getUnsignedInt32( zipEndOfCentralDirectory, zipEndOfCentralDirectory.position() + ZIP_EOCD_CENTRAL_DIR_SIZE_FIELD_OFFSET); }
Returns the size (in bytes) of the ZIP Central Directory. <p>NOTE: Byte order of {@code zipEndOfCentralDirectory} must be little-endian.
ZipUtils::getZipEocdCentralDirectorySizeBytes
java
Reginer/aosp-android-jar
android-34/src/android/util/apk/ZipUtils.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/util/apk/ZipUtils.java
MIT
public Builder toBuilder() { return new Builder(this); }
Converts an instance to a builder. @hide
HdmiDeviceInfo::toBuilder
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public static Builder cecDeviceBuilder() { return new Builder(HDMI_DEVICE_TYPE_CEC); }
Creates a Builder for an {@link HdmiDeviceInfo} representing a CEC device. @hide
HdmiDeviceInfo::cecDeviceBuilder
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public static HdmiDeviceInfo mhlDevice( int physicalAddress, int portId, int adopterId, int deviceId) { return new Builder(HDMI_DEVICE_TYPE_MHL) .setPhysicalAddress(physicalAddress) .setPortId(portId) .setVendorId(0) .setDisplayName("Mobile") .setDeviceId(adopterId) .setAdopterId(deviceId) .build(); }
Creates an {@link HdmiDeviceInfo} representing an MHL device. @param physicalAddress physical address of HDMI device @param portId portId HDMI port ID (1 for HDMI1) @param adopterId adopter id of MHL @param deviceId device id of MHL @hide
HdmiDeviceInfo::mhlDevice
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public static HdmiDeviceInfo hardwarePort(int physicalAddress, int portId) { return new Builder(HDMI_DEVICE_TYPE_HARDWARE) .setPhysicalAddress(physicalAddress) .setPortId(portId) .setVendorId(0) .setDisplayName("HDMI" + portId) .build(); }
Creates an {@link HdmiDeviceInfo} representing a hardware port. @param physicalAddress physical address of the port @param portId HDMI port ID (1 for HDMI1) @hide
HdmiDeviceInfo::hardwarePort
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public int getId() { return mId; }
Returns the id of the device.
HdmiDeviceInfo::getId
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public DeviceFeatures getDeviceFeatures() { return mDeviceFeatures; }
Returns the CEC features that this device supports. @hide
HdmiDeviceInfo::getDeviceFeatures
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public static int idForCecDevice(int address) { // The id is generated based on the logical address. return ID_OFFSET_CEC + address; }
Returns the id to be used for CEC device. @param address logical address of CEC device @return id for CEC device
HdmiDeviceInfo::idForCecDevice
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public static int idForMhlDevice(int portId) { // The id is generated based on the port id since there can be only one MHL device per port. return ID_OFFSET_MHL + portId; }
Returns the id to be used for MHL device. @param portId port which the MHL device is connected to @return id for MHL device
HdmiDeviceInfo::idForMhlDevice
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public static int idForHardware(int portId) { return ID_OFFSET_HARDWARE + portId; }
Returns the id to be used for hardware port. @param portId port id @return id for hardware port
HdmiDeviceInfo::idForHardware
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public int getLogicalAddress() { return mLogicalAddress; }
Returns the CEC logical address of the device.
HdmiDeviceInfo::getLogicalAddress
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public int getPhysicalAddress() { return mPhysicalAddress; }
Returns the physical address of the device.
HdmiDeviceInfo::getPhysicalAddress
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public int getPortId() { return mPortId; }
Returns the port ID.
HdmiDeviceInfo::getPortId
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public int getDeviceType() { return mDeviceType; }
Returns CEC type of the device. For more details, refer constants between {@link #DEVICE_TV} and {@link #DEVICE_INACTIVE}.
HdmiDeviceInfo::getDeviceType
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public int getDevicePowerStatus() { return mDevicePowerStatus; }
Returns device's power status. It should be one of the following values. <ul> <li>{@link HdmiControlManager#POWER_STATUS_ON} <li>{@link HdmiControlManager#POWER_STATUS_STANDBY} <li>{@link HdmiControlManager#POWER_STATUS_TRANSIENT_TO_ON} <li>{@link HdmiControlManager#POWER_STATUS_TRANSIENT_TO_STANDBY} <li>{@link HdmiControlManager#POWER_STATUS_UNKNOWN} </ul>
HdmiDeviceInfo::getDevicePowerStatus
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public int getDeviceId() { return mDeviceId; }
Returns MHL device id. Return -1 for non-MHL device.
HdmiDeviceInfo::getDeviceId
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public int getAdopterId() { return mAdopterId; }
Returns MHL adopter id. Return -1 for non-MHL device.
HdmiDeviceInfo::getAdopterId
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public boolean isSourceType() { if (isCecDevice()) { return mDeviceType == DEVICE_PLAYBACK || mDeviceType == DEVICE_RECORDER || mDeviceType == DEVICE_TUNER; } else if (isMhlDevice()) { return true; } else { return false; } }
Returns {@code true} if the device is of a type that can be an input source.
HdmiDeviceInfo::isSourceType
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public boolean isCecDevice() { return mHdmiDeviceType == HDMI_DEVICE_TYPE_CEC; }
Returns {@code true} if the device represents an HDMI-CEC device. {@code false} if the device is either MHL or other device.
HdmiDeviceInfo::isCecDevice
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public boolean isMhlDevice() { return mHdmiDeviceType == HDMI_DEVICE_TYPE_MHL; }
Returns {@code true} if the device represents an MHL device. {@code false} if the device is either CEC or other device.
HdmiDeviceInfo::isMhlDevice
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public boolean isInactivated() { return mHdmiDeviceType == HDMI_DEVICE_TYPE_INACTIVE; }
Return {@code true} if the device represents an inactivated device that relinquishes its status as active source by &lt;Active Source&gt; (HDMI-CEC) or Content-off (MHL).
HdmiDeviceInfo::isInactivated
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public String getDisplayName() { return mDisplayName; }
Returns display (OSD) name of the device.
HdmiDeviceInfo::getDisplayName
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public int getVendorId() { return mVendorId; }
Returns vendor id of the device. Vendor id is used to distinguish devices built by other manufactures. This is required for vendor-specific command on CEC standard.
HdmiDeviceInfo::getVendorId
java
Reginer/aosp-android-jar
android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/hardware/hdmi/HdmiDeviceInfo.java
MIT
public ObjectStack() { super(); }
Default constructor. Note that the default block size is very small, for small lists.
ObjectStack::ObjectStack
java
Reginer/aosp-android-jar
android-34/src/org/apache/xml/utils/ObjectStack.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/utils/ObjectStack.java
MIT
public ObjectStack(int blocksize) { super(blocksize); }
Construct a ObjectVector, using the given block size. @param blocksize Size of block to allocate
ObjectStack::ObjectStack
java
Reginer/aosp-android-jar
android-34/src/org/apache/xml/utils/ObjectStack.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/utils/ObjectStack.java
MIT
public ObjectStack (ObjectStack v) { super(v); }
Copy constructor for ObjectStack @param v ObjectStack to copy
ObjectStack::ObjectStack
java
Reginer/aosp-android-jar
android-34/src/org/apache/xml/utils/ObjectStack.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/utils/ObjectStack.java
MIT
public Object push(Object i) { if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; Object newMap[] = new Object[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; } m_map[m_firstFree] = i; m_firstFree++; return i; }
Pushes an item onto the top of this stack. @param i the int to be pushed onto this stack. @return the <code>item</code> argument.
ObjectStack::push
java
Reginer/aosp-android-jar
android-34/src/org/apache/xml/utils/ObjectStack.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/utils/ObjectStack.java
MIT
public Object pop() { Object val = m_map[--m_firstFree]; m_map[m_firstFree] = null; return val; }
Removes the object at the top of this stack and returns that object as the value of this function. @return The object at the top of this stack.
ObjectStack::pop
java
Reginer/aosp-android-jar
android-34/src/org/apache/xml/utils/ObjectStack.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/utils/ObjectStack.java
MIT
public Object peek() { try { return m_map[m_firstFree - 1]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Looks at the object at the top of this stack without removing it from the stack. @return the object at the top of this stack. @throws EmptyStackException if this stack is empty.
ObjectStack::peek
java
Reginer/aosp-android-jar
android-34/src/org/apache/xml/utils/ObjectStack.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/utils/ObjectStack.java
MIT
public Object peek(int n) { try { return m_map[m_firstFree-(1+n)]; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Looks at the object at the position the stack counting down n items. @param n The number of items down, indexed from zero. @return the object at n items down. @throws EmptyStackException if this stack is empty.
ObjectStack::peek
java
Reginer/aosp-android-jar
android-34/src/org/apache/xml/utils/ObjectStack.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/utils/ObjectStack.java
MIT
public void setTop(Object val) { try { m_map[m_firstFree - 1] = val; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } }
Sets an object at a the top of the statck @param val object to set at the top @throws EmptyStackException if this stack is empty.
ObjectStack::setTop
java
Reginer/aosp-android-jar
android-34/src/org/apache/xml/utils/ObjectStack.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/utils/ObjectStack.java
MIT
public boolean empty() { return m_firstFree == 0; }
Tests if this stack is empty. @return <code>true</code> if this stack is empty; <code>false</code> otherwise. @since JDK1.0
ObjectStack::empty
java
Reginer/aosp-android-jar
android-34/src/org/apache/xml/utils/ObjectStack.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/utils/ObjectStack.java
MIT
public int search(Object o) { int i = lastIndexOf(o); if (i >= 0) { return size() - i; } return -1; }
Returns where an object is on this stack. @param o the desired object. @return the distance from the top of the stack where the object is] located; the return value <code>-1</code> indicates that the object is not on the stack. @since JDK1.0
ObjectStack::search
java
Reginer/aosp-android-jar
android-34/src/org/apache/xml/utils/ObjectStack.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/utils/ObjectStack.java
MIT
public Object clone() throws CloneNotSupportedException { return (ObjectStack) super.clone(); }
Returns clone of current ObjectStack @return clone of current ObjectStack
ObjectStack::clone
java
Reginer/aosp-android-jar
android-34/src/org/apache/xml/utils/ObjectStack.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/org/apache/xml/utils/ObjectStack.java
MIT
public static Path of(String first, String... more) { return FileSystems.getDefault().getPath(first, more); }
Returns a {@code Path} by converting a path string, or a sequence of strings that when joined form a path string. If {@code more} does not specify any elements then the value of the {@code first} parameter is the path string to convert. If {@code more} specifies one or more elements then each non-empty string, including {@code first}, is considered to be a sequence of name elements and is joined to form a path string. The details as to how the Strings are joined is provider specific but typically they will be joined using the {@link FileSystem#getSeparator name-separator} as the separator. For example, if the name separator is "{@code /}" and {@code getPath("/foo","bar","gus")} is invoked, then the path string {@code "/foo/bar/gus"} is converted to a {@code Path}. A {@code Path} representing an empty path is returned if {@code first} is the empty string and {@code more} does not contain any non-empty strings. <p> The {@code Path} is obtained by invoking the {@link FileSystem#getPath getPath} method of the {@link FileSystems#getDefault default} {@link FileSystem}. <p> Note that while this method is very convenient, using it will imply an assumed reference to the default {@code FileSystem} and limit the utility of the calling code. Hence it should not be used in library code intended for flexible reuse. A more flexible alternative is to use an existing {@code Path} instance as an anchor, such as: <pre>{@code Path dir = ... Path path = dir.resolve("file"); }</pre> @param first the path string or initial part of the path string @param more additional strings to be joined to form the path string @return the resulting {@code Path} @throws InvalidPathException if the path string cannot be converted to a {@code Path} @see FileSystem#getPath @since 11
of
java
Reginer/aosp-android-jar
android-35/src/java/nio/file/Path.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/nio/file/Path.java
MIT
public static Path of(URI uri) { String scheme = uri.getScheme(); if (scheme == null) throw new IllegalArgumentException("Missing scheme"); // check for default provider to avoid loading of installed providers if (scheme.equalsIgnoreCase("file")) return FileSystems.getDefault().provider().getPath(uri); // try to find provider for (FileSystemProvider provider: FileSystemProvider.installedProviders()) { if (provider.getScheme().equalsIgnoreCase(scheme)) { return provider.getPath(uri); } } throw new FileSystemNotFoundException("Provider \"" + scheme + "\" not installed"); }
Returns a {@code Path} by converting a URI. <p> This method iterates over the {@link FileSystemProvider#installedProviders() installed} providers to locate the provider that is identified by the URI {@link URI#getScheme scheme} of the given URI. URI schemes are compared without regard to case. If the provider is found then its {@link FileSystemProvider#getPath getPath} method is invoked to convert the URI. <p> In the case of the default provider, identified by the URI scheme "file", the given URI has a non-empty path component, and undefined query and fragment components. Whether the authority component may be present is platform specific. The returned {@code Path} is associated with the {@link FileSystems#getDefault default} file system. <p> The default provider provides a similar <em>round-trip</em> guarantee to the {@link java.io.File} class. For a given {@code Path} <i>p</i> it is guaranteed that <blockquote>{@code Path.of(}<i>p</i>{@code .}{@link Path#toUri() toUri}{@code ()).equals(} <i>p</i>{@code .}{@link Path#toAbsolutePath() toAbsolutePath}{@code ())} </blockquote> so long as the original {@code Path}, the {@code URI}, and the new {@code Path} are all created in (possibly different invocations of) the same Java virtual machine. Whether other providers make any guarantees is provider specific and therefore unspecified. @param uri the URI to convert @return the resulting {@code Path} @throws IllegalArgumentException if preconditions on the {@code uri} parameter do not hold. The format of the URI is provider specific. @throws FileSystemNotFoundException The file system, identified by the URI, does not exist and cannot be created automatically, or the provider identified by the URI's scheme component is not installed @throws SecurityException if a security manager is installed and it denies an unspecified permission to access the file system @since 11
of
java
Reginer/aosp-android-jar
android-35/src/java/nio/file/Path.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/java/nio/file/Path.java
MIT
public static AffixPatternMatcher fromAffixPattern( String affixPattern, AffixTokenMatcherFactory factory, int parseFlags) { if (affixPattern.isEmpty()) { return null; } AffixPatternMatcher series = new AffixPatternMatcher(affixPattern); series.factory = factory; series.ignorables = (0 != (parseFlags & ParsingUtils.PARSE_FLAG_EXACT_AFFIX)) ? null : factory.ignorables(); series.lastTypeOrCp = 0; AffixUtils.iterateWithConsumer(affixPattern, series); // De-reference the memory series.factory = null; series.ignorables = null; series.lastTypeOrCp = 0; series.freeze(); return series; }
Creates an AffixPatternMatcher (based on SeriesMatcher) from the given affix pattern. Returns null if the affix pattern is empty.
AffixPatternMatcher::fromAffixPattern
java
Reginer/aosp-android-jar
android-35/src/android/icu/impl/number/parse/AffixPatternMatcher.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/impl/number/parse/AffixPatternMatcher.java
MIT
private void possExpand(int bits) { if ((mPos + bits) < mEnd) return; byte[] newBuf = new byte[(mPos + bits) >>> 2]; System.arraycopy(mBuf, 0, newBuf, 0, mEnd >>> 3); mBuf = newBuf; mEnd = newBuf.length << 3; }
Allocate a new internal buffer, if needed. @param bits additional bits to be accommodated
AccessException::possExpand
java
Reginer/aosp-android-jar
android-33/src/com/android/internal/util/BitwiseOutputStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/BitwiseOutputStream.java
MIT
public void skip(int bits) { possExpand(bits); mPos += bits; }
Increment the current position, implicitly writing zeros. @param bits the amount by which to increment the position
AccessException::skip
java
Reginer/aosp-android-jar
android-33/src/com/android/internal/util/BitwiseOutputStream.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/internal/util/BitwiseOutputStream.java
MIT
void preloadRecentsActivity() { ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS, "Preload recents with %s", mTargetIntent); Task targetRootTask = mDefaultTaskDisplayArea.getRootTask(WINDOWING_MODE_UNDEFINED, mTargetActivityType); ActivityRecord targetActivity = getTargetActivity(targetRootTask); if (targetActivity != null) { if (targetActivity.mVisibleRequested || targetActivity.isTopRunningActivity()) { // The activity is ready. return; } if (targetActivity.attachedToProcess()) { // The activity may be relaunched if it cannot handle the current configuration // changes. The activity will be paused state if it is relaunched, otherwise it // keeps the original stopped state. targetActivity.ensureActivityConfiguration(0 /* globalChanges */, false /* preserveWindow */, true /* ignoreVisibility */); ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS, "Updated config=%s", targetActivity.getConfiguration()); } } else if (mDefaultTaskDisplayArea.getActivity( ActivityRecord::occludesParent, false /* traverseTopToBottom */) == null) { // Skip because none of above activities can occlude the target activity. The preload // should be done silently in background without being visible. return; } else { // Create the activity record. Because the activity is invisible, this doesn't really // start the client. startRecentsActivityInBackground("preloadRecents"); targetRootTask = mDefaultTaskDisplayArea.getRootTask(WINDOWING_MODE_UNDEFINED, mTargetActivityType); targetActivity = getTargetActivity(targetRootTask); if (targetActivity == null) { Slog.w(TAG, "Cannot start " + mTargetIntent); return; } } if (!targetActivity.attachedToProcess()) { ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS, "Real start recents"); mTaskSupervisor.startSpecificActivity(targetActivity, false /* andResume */, false /* checkConfig */); // Make sure the activity won't be involved in transition. if (targetActivity.getDisplayContent() != null) { targetActivity.getDisplayContent().mUnknownAppVisibilityController .appRemovedOrHidden(targetActivity); } } // Invisible activity should be stopped. If the recents activity is alive and its doesn't // need to relaunch by current configuration, then it may be already in stopped state. if (!targetActivity.isState(STOPPING, STOPPED)) { // Add to stopping instead of stop immediately. So the client has the chance to perform // traversal in non-stopped state (ViewRootImpl.mStopped) that would initialize more // things (e.g. the measure can be done earlier). The actual stop will be performed when // it reports idle. targetActivity.addToStopping(true /* scheduleIdle */, true /* idleDelayed */, "preloadRecents"); } }
Starts the recents activity in background without animation if the record doesn't exist or the client isn't launched. If the recents activity is already alive, ensure its configuration is updated to the current one.
getSimpleName::preloadRecentsActivity
java
Reginer/aosp-android-jar
android-33/src/com/android/server/wm/RecentsAnimation.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/RecentsAnimation.java
MIT
static void notifyAnimationCancelBeforeStart(IRecentsAnimationRunner recentsAnimationRunner) { try { recentsAnimationRunner.onAnimationCanceled(null /* taskIds */, null /* taskSnapshots */); } catch (RemoteException e) { Slog.e(TAG, "Failed to cancel recents animation before start", e); } }
Called only when the animation should be canceled prior to starting.
getSimpleName::notifyAnimationCancelBeforeStart
java
Reginer/aosp-android-jar
android-33/src/com/android/server/wm/RecentsAnimation.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/RecentsAnimation.java
MIT
private Task getTopNonAlwaysOnTopRootTask() { return mDefaultTaskDisplayArea.getRootTask(task -> !task.getWindowConfiguration().isAlwaysOnTop()); }
@return The top root task that is not always-on-top.
getSimpleName::getTopNonAlwaysOnTopRootTask
java
Reginer/aosp-android-jar
android-33/src/com/android/server/wm/RecentsAnimation.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/RecentsAnimation.java
MIT
private ActivityRecord getTargetActivity(Task targetRootTask) { if (targetRootTask == null) { return null; } final PooledPredicate p = PooledLambda.obtainPredicate(RecentsAnimation::matchesTarget, this, PooledLambda.__(Task.class)); final Task task = targetRootTask.getTask(p); p.recycle(); return task != null ? task.getTopNonFinishingActivity() : null; }
@return the top activity in the {@param targetRootTask} matching the {@param component}, or just the top activity of the top task if no task matches the component.
getSimpleName::getTargetActivity
java
Reginer/aosp-android-jar
android-33/src/com/android/server/wm/RecentsAnimation.java
https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/com/android/server/wm/RecentsAnimation.java
MIT