code
stringlengths 11
173k
| docstring
stringlengths 2
593k
| func_name
stringlengths 2
189
| language
stringclasses 1
value | repo
stringclasses 833
values | path
stringlengths 11
294
| url
stringlengths 60
339
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
public Builder() {
this.mData = new PersonalizationData();
} |
Creates a new builder for a given namespace.
| Builder::Builder | java | Reginer/aosp-android-jar | android-35/src/android/security/identity/PersonalizationData.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/security/identity/PersonalizationData.java | MIT |
public @NonNull Builder putEntry(@NonNull String namespace, @NonNull String name,
@NonNull Collection<AccessControlProfileId> accessControlProfileIds,
@NonNull byte[] value) {
NamespaceData namespaceData = mData.mNamespaces.get(namespace);
if (namespaceData == null) {
namespaceData = new NamespaceData(namespace);
mData.mNamespaces.put(namespace, namespaceData);
}
// TODO: validate/verify that value is proper CBOR.
namespaceData.mEntries.put(name, new EntryData(value, accessControlProfileIds));
return this;
} |
Adds a new entry to the builder.
@param namespace The namespace to use, e.g. {@code org.iso.18013-5.2019}.
@param name The name of the entry, e.g. {@code height}.
@param accessControlProfileIds A set of access control profiles to use.
@param value The value to add, in CBOR encoding.
@return The builder.
| Builder::putEntry | java | Reginer/aosp-android-jar | android-35/src/android/security/identity/PersonalizationData.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/security/identity/PersonalizationData.java | MIT |
public @NonNull Builder addAccessControlProfile(@NonNull AccessControlProfile profile) {
mData.mProfiles.add(profile);
return this;
} |
Adds a new access control profile to the builder.
@param profile The access control profile.
@return The builder.
| Builder::addAccessControlProfile | java | Reginer/aosp-android-jar | android-35/src/android/security/identity/PersonalizationData.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/security/identity/PersonalizationData.java | MIT |
public @NonNull PersonalizationData build() {
return mData;
} |
Creates a new {@link PersonalizationData} with all the entries added to the builder.
@return A new {@link PersonalizationData} instance.
| Builder::build | java | Reginer/aosp-android-jar | android-35/src/android/security/identity/PersonalizationData.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/security/identity/PersonalizationData.java | MIT |
public static InterfaceConfigurationParcel getInterfaceConfigParcel(@NonNull INetd netd,
@NonNull String iface) {
try {
return netd.interfaceGetCfg(iface);
} catch (RemoteException | ServiceSpecificException e) {
throw new IllegalStateException(e);
}
} |
Get InterfaceConfigurationParcel from netd.
| getSimpleName::getInterfaceConfigParcel | java | Reginer/aosp-android-jar | android-34/src/com/android/net/module/util/NetdUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/NetdUtils.java | MIT |
public static boolean hasFlag(@NonNull final InterfaceConfigurationParcel config,
@NonNull final String flag) {
validateFlag(flag);
final Set<String> flagList = new HashSet<String>(Arrays.asList(config.flags));
return flagList.contains(flag);
} |
Check whether the InterfaceConfigurationParcel contains the target flag or not.
@param config The InterfaceConfigurationParcel instance.
@param flag Target flag string to be checked.
| getSimpleName::hasFlag | java | Reginer/aosp-android-jar | android-34/src/com/android/net/module/util/NetdUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/NetdUtils.java | MIT |
public static void setInterfaceConfig(INetd netd, InterfaceConfigurationParcel configParcel) {
try {
netd.interfaceSetCfg(configParcel);
} catch (RemoteException | ServiceSpecificException e) {
throw new IllegalStateException(e);
}
} |
Set interface configuration to netd by passing InterfaceConfigurationParcel.
| getSimpleName::setInterfaceConfig | java | Reginer/aosp-android-jar | android-34/src/com/android/net/module/util/NetdUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/NetdUtils.java | MIT |
public static void setInterfaceUp(INetd netd, String iface) {
final InterfaceConfigurationParcel configParcel = getInterfaceConfigParcel(netd, iface);
configParcel.flags = removeAndAddFlags(configParcel.flags, IF_STATE_DOWN /* remove */,
IF_STATE_UP /* add */);
setInterfaceConfig(netd, configParcel);
} |
Set the given interface up.
| getSimpleName::setInterfaceUp | java | Reginer/aosp-android-jar | android-34/src/com/android/net/module/util/NetdUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/NetdUtils.java | MIT |
public static void setInterfaceDown(INetd netd, String iface) {
final InterfaceConfigurationParcel configParcel = getInterfaceConfigParcel(netd, iface);
configParcel.flags = removeAndAddFlags(configParcel.flags, IF_STATE_UP /* remove */,
IF_STATE_DOWN /* add */);
setInterfaceConfig(netd, configParcel);
} |
Set the given interface down.
| getSimpleName::setInterfaceDown | java | Reginer/aosp-android-jar | android-34/src/com/android/net/module/util/NetdUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/NetdUtils.java | MIT |
public static void tetherStart(final INetd netd, final boolean usingLegacyDnsProxy,
final String[] dhcpRange) throws RemoteException, ServiceSpecificException {
final TetherConfigParcel config = new TetherConfigParcel();
config.usingLegacyDnsProxy = usingLegacyDnsProxy;
config.dhcpRanges = dhcpRange;
netd.tetherStartWithConfiguration(config);
} |
Set the given interface down.
public static void setInterfaceDown(INetd netd, String iface) {
final InterfaceConfigurationParcel configParcel = getInterfaceConfigParcel(netd, iface);
configParcel.flags = removeAndAddFlags(configParcel.flags, IF_STATE_UP /* remove */,
IF_STATE_DOWN /* add */);
setInterfaceConfig(netd, configParcel);
}
/** Start tethering. | getSimpleName::tetherStart | java | Reginer/aosp-android-jar | android-34/src/com/android/net/module/util/NetdUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/NetdUtils.java | MIT |
public static void tetherInterface(final INetd netd, final String iface, final IpPrefix dest)
throws RemoteException, ServiceSpecificException {
tetherInterface(netd, iface, dest, 20 /* maxAttempts */, 50 /* pollingIntervalMs */);
} |
Set the given interface down.
public static void setInterfaceDown(INetd netd, String iface) {
final InterfaceConfigurationParcel configParcel = getInterfaceConfigParcel(netd, iface);
configParcel.flags = removeAndAddFlags(configParcel.flags, IF_STATE_UP /* remove */,
IF_STATE_DOWN /* add */);
setInterfaceConfig(netd, configParcel);
}
/** Start tethering.
public static void tetherStart(final INetd netd, final boolean usingLegacyDnsProxy,
final String[] dhcpRange) throws RemoteException, ServiceSpecificException {
final TetherConfigParcel config = new TetherConfigParcel();
config.usingLegacyDnsProxy = usingLegacyDnsProxy;
config.dhcpRanges = dhcpRange;
netd.tetherStartWithConfiguration(config);
}
/** Setup interface for tethering. | getSimpleName::tetherInterface | java | Reginer/aosp-android-jar | android-34/src/com/android/net/module/util/NetdUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/NetdUtils.java | MIT |
public static void tetherInterface(final INetd netd, final String iface, final IpPrefix dest,
int maxAttempts, int pollingIntervalMs)
throws RemoteException, ServiceSpecificException {
netd.tetherInterfaceAdd(iface);
networkAddInterface(netd, iface, maxAttempts, pollingIntervalMs);
List<RouteInfo> routes = new ArrayList<>();
routes.add(new RouteInfo(dest, null, iface, RTN_UNICAST));
addRoutesToLocalNetwork(netd, iface, routes);
} |
Set the given interface down.
public static void setInterfaceDown(INetd netd, String iface) {
final InterfaceConfigurationParcel configParcel = getInterfaceConfigParcel(netd, iface);
configParcel.flags = removeAndAddFlags(configParcel.flags, IF_STATE_UP /* remove */,
IF_STATE_DOWN /* add */);
setInterfaceConfig(netd, configParcel);
}
/** Start tethering.
public static void tetherStart(final INetd netd, final boolean usingLegacyDnsProxy,
final String[] dhcpRange) throws RemoteException, ServiceSpecificException {
final TetherConfigParcel config = new TetherConfigParcel();
config.usingLegacyDnsProxy = usingLegacyDnsProxy;
config.dhcpRanges = dhcpRange;
netd.tetherStartWithConfiguration(config);
}
/** Setup interface for tethering.
public static void tetherInterface(final INetd netd, final String iface, final IpPrefix dest)
throws RemoteException, ServiceSpecificException {
tetherInterface(netd, iface, dest, 20 /* maxAttempts */, 50 /* pollingIntervalMs */);
}
/** Setup interface with configurable retries for tethering. | getSimpleName::tetherInterface | java | Reginer/aosp-android-jar | android-34/src/com/android/net/module/util/NetdUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/NetdUtils.java | MIT |
private static void networkAddInterface(final INetd netd, final String iface,
int maxAttempts, int pollingIntervalMs)
throws ServiceSpecificException, RemoteException {
for (int i = 1; i <= maxAttempts; i++) {
try {
netd.networkAddInterface(INetd.LOCAL_NET_ID, iface);
return;
} catch (ServiceSpecificException e) {
if (e.errorCode == EBUSY && i < maxAttempts) {
SystemClock.sleep(pollingIntervalMs);
continue;
}
Log.e(TAG, "Retry Netd#networkAddInterface failure: " + e);
throw e;
}
}
} |
Retry Netd#networkAddInterface for EBUSY error code.
If the same interface (e.g., wlan0) is in client mode and then switches to tethered mode.
There can be a race where puts the interface into the local network but interface is still
in use in netd because the ConnectivityService thread hasn't processed the disconnect yet.
See b/158269544 for detail.
| getSimpleName::networkAddInterface | java | Reginer/aosp-android-jar | android-34/src/com/android/net/module/util/NetdUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/NetdUtils.java | MIT |
public static void untetherInterface(final INetd netd, String iface)
throws RemoteException, ServiceSpecificException {
try {
netd.tetherInterfaceRemove(iface);
} finally {
netd.networkRemoveInterface(INetd.LOCAL_NET_ID, iface);
}
} |
Retry Netd#networkAddInterface for EBUSY error code.
If the same interface (e.g., wlan0) is in client mode and then switches to tethered mode.
There can be a race where puts the interface into the local network but interface is still
in use in netd because the ConnectivityService thread hasn't processed the disconnect yet.
See b/158269544 for detail.
private static void networkAddInterface(final INetd netd, final String iface,
int maxAttempts, int pollingIntervalMs)
throws ServiceSpecificException, RemoteException {
for (int i = 1; i <= maxAttempts; i++) {
try {
netd.networkAddInterface(INetd.LOCAL_NET_ID, iface);
return;
} catch (ServiceSpecificException e) {
if (e.errorCode == EBUSY && i < maxAttempts) {
SystemClock.sleep(pollingIntervalMs);
continue;
}
Log.e(TAG, "Retry Netd#networkAddInterface failure: " + e);
throw e;
}
}
}
/** Reset interface for tethering. | getSimpleName::untetherInterface | java | Reginer/aosp-android-jar | android-34/src/com/android/net/module/util/NetdUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/NetdUtils.java | MIT |
public static void addRoutesToLocalNetwork(final INetd netd, final String iface,
final List<RouteInfo> routes) {
for (RouteInfo route : routes) {
if (!route.isDefaultRoute()) {
modifyRoute(netd, ModifyOperation.ADD, INetd.LOCAL_NET_ID, route);
}
}
// IPv6 link local should be activated always.
modifyRoute(netd, ModifyOperation.ADD, INetd.LOCAL_NET_ID,
new RouteInfo(new IpPrefix("fe80::/64"), null, iface, RTN_UNICAST));
} |
Retry Netd#networkAddInterface for EBUSY error code.
If the same interface (e.g., wlan0) is in client mode and then switches to tethered mode.
There can be a race where puts the interface into the local network but interface is still
in use in netd because the ConnectivityService thread hasn't processed the disconnect yet.
See b/158269544 for detail.
private static void networkAddInterface(final INetd netd, final String iface,
int maxAttempts, int pollingIntervalMs)
throws ServiceSpecificException, RemoteException {
for (int i = 1; i <= maxAttempts; i++) {
try {
netd.networkAddInterface(INetd.LOCAL_NET_ID, iface);
return;
} catch (ServiceSpecificException e) {
if (e.errorCode == EBUSY && i < maxAttempts) {
SystemClock.sleep(pollingIntervalMs);
continue;
}
Log.e(TAG, "Retry Netd#networkAddInterface failure: " + e);
throw e;
}
}
}
/** Reset interface for tethering.
public static void untetherInterface(final INetd netd, String iface)
throws RemoteException, ServiceSpecificException {
try {
netd.tetherInterfaceRemove(iface);
} finally {
netd.networkRemoveInterface(INetd.LOCAL_NET_ID, iface);
}
}
/** Add |routes| to local network. | getSimpleName::addRoutesToLocalNetwork | java | Reginer/aosp-android-jar | android-34/src/com/android/net/module/util/NetdUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/NetdUtils.java | MIT |
public static int removeRoutesFromLocalNetwork(final INetd netd, final List<RouteInfo> routes) {
int failures = 0;
for (RouteInfo route : routes) {
try {
modifyRoute(netd, ModifyOperation.REMOVE, INetd.LOCAL_NET_ID, route);
} catch (IllegalStateException e) {
failures++;
}
}
return failures;
} |
Retry Netd#networkAddInterface for EBUSY error code.
If the same interface (e.g., wlan0) is in client mode and then switches to tethered mode.
There can be a race where puts the interface into the local network but interface is still
in use in netd because the ConnectivityService thread hasn't processed the disconnect yet.
See b/158269544 for detail.
private static void networkAddInterface(final INetd netd, final String iface,
int maxAttempts, int pollingIntervalMs)
throws ServiceSpecificException, RemoteException {
for (int i = 1; i <= maxAttempts; i++) {
try {
netd.networkAddInterface(INetd.LOCAL_NET_ID, iface);
return;
} catch (ServiceSpecificException e) {
if (e.errorCode == EBUSY && i < maxAttempts) {
SystemClock.sleep(pollingIntervalMs);
continue;
}
Log.e(TAG, "Retry Netd#networkAddInterface failure: " + e);
throw e;
}
}
}
/** Reset interface for tethering.
public static void untetherInterface(final INetd netd, String iface)
throws RemoteException, ServiceSpecificException {
try {
netd.tetherInterfaceRemove(iface);
} finally {
netd.networkRemoveInterface(INetd.LOCAL_NET_ID, iface);
}
}
/** Add |routes| to local network.
public static void addRoutesToLocalNetwork(final INetd netd, final String iface,
final List<RouteInfo> routes) {
for (RouteInfo route : routes) {
if (!route.isDefaultRoute()) {
modifyRoute(netd, ModifyOperation.ADD, INetd.LOCAL_NET_ID, route);
}
}
// IPv6 link local should be activated always.
modifyRoute(netd, ModifyOperation.ADD, INetd.LOCAL_NET_ID,
new RouteInfo(new IpPrefix("fe80::/64"), null, iface, RTN_UNICAST));
}
/** Remove routes from local network. | getSimpleName::removeRoutesFromLocalNetwork | java | Reginer/aosp-android-jar | android-34/src/com/android/net/module/util/NetdUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/NetdUtils.java | MIT |
public static void modifyRoute(final INetd netd, final ModifyOperation op, final int netId,
final RouteInfo route) {
final String ifName = route.getInterface();
final String dst = route.getDestination().toString();
final String nextHop = findNextHop(route);
try {
switch(op) {
case ADD:
netd.networkAddRoute(netId, ifName, dst, nextHop);
break;
case REMOVE:
netd.networkRemoveRoute(netId, ifName, dst, nextHop);
break;
default:
throw new IllegalStateException("Unsupported modify operation:" + op);
}
} catch (RemoteException | ServiceSpecificException e) {
throw new IllegalStateException(e);
}
} |
Retry Netd#networkAddInterface for EBUSY error code.
If the same interface (e.g., wlan0) is in client mode and then switches to tethered mode.
There can be a race where puts the interface into the local network but interface is still
in use in netd because the ConnectivityService thread hasn't processed the disconnect yet.
See b/158269544 for detail.
private static void networkAddInterface(final INetd netd, final String iface,
int maxAttempts, int pollingIntervalMs)
throws ServiceSpecificException, RemoteException {
for (int i = 1; i <= maxAttempts; i++) {
try {
netd.networkAddInterface(INetd.LOCAL_NET_ID, iface);
return;
} catch (ServiceSpecificException e) {
if (e.errorCode == EBUSY && i < maxAttempts) {
SystemClock.sleep(pollingIntervalMs);
continue;
}
Log.e(TAG, "Retry Netd#networkAddInterface failure: " + e);
throw e;
}
}
}
/** Reset interface for tethering.
public static void untetherInterface(final INetd netd, String iface)
throws RemoteException, ServiceSpecificException {
try {
netd.tetherInterfaceRemove(iface);
} finally {
netd.networkRemoveInterface(INetd.LOCAL_NET_ID, iface);
}
}
/** Add |routes| to local network.
public static void addRoutesToLocalNetwork(final INetd netd, final String iface,
final List<RouteInfo> routes) {
for (RouteInfo route : routes) {
if (!route.isDefaultRoute()) {
modifyRoute(netd, ModifyOperation.ADD, INetd.LOCAL_NET_ID, route);
}
}
// IPv6 link local should be activated always.
modifyRoute(netd, ModifyOperation.ADD, INetd.LOCAL_NET_ID,
new RouteInfo(new IpPrefix("fe80::/64"), null, iface, RTN_UNICAST));
}
/** Remove routes from local network.
public static int removeRoutesFromLocalNetwork(final INetd netd, final List<RouteInfo> routes) {
int failures = 0;
for (RouteInfo route : routes) {
try {
modifyRoute(netd, ModifyOperation.REMOVE, INetd.LOCAL_NET_ID, route);
} catch (IllegalStateException e) {
failures++;
}
}
return failures;
}
@SuppressLint("NewApi")
private static String findNextHop(final RouteInfo route) {
final String nextHop;
switch (route.getType()) {
case RTN_UNICAST:
if (route.hasGateway()) {
nextHop = route.getGateway().getHostAddress();
} else {
nextHop = INetd.NEXTHOP_NONE;
}
break;
case RTN_UNREACHABLE:
nextHop = INetd.NEXTHOP_UNREACHABLE;
break;
case RTN_THROW:
nextHop = INetd.NEXTHOP_THROW;
break;
default:
nextHop = INetd.NEXTHOP_NONE;
break;
}
return nextHop;
}
/** Add or remove |route|. | getSimpleName::modifyRoute | java | Reginer/aosp-android-jar | android-34/src/com/android/net/module/util/NetdUtils.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/net/module/util/NetdUtils.java | MIT |
public long getLong(String key, long defaultValue) {
return mSharedPreferences.getLong(key, defaultValue);
} |
Manages shared preference, i.e. the storage used for metrics reporting.
public static class PreferencesManager {
private static final String METRICS_DIR = "recovery_system";
private static final String METRICS_PREFS_FILE = "RecoverySystemMetricsPrefs.xml";
protected final SharedPreferences mSharedPreferences;
private final File mMetricsPrefsFile;
PreferencesManager(Context context) {
File prefsDir = new File(Environment.getDataSystemCeDirectory(USER_SYSTEM),
METRICS_DIR);
mMetricsPrefsFile = new File(prefsDir, METRICS_PREFS_FILE);
mSharedPreferences = context.getSharedPreferences(mMetricsPrefsFile, 0);
}
/** Reads the value of a given key with type long. | PreferencesManager::getLong | java | Reginer/aosp-android-jar | android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | MIT |
public int getInt(String key, int defaultValue) {
return mSharedPreferences.getInt(key, defaultValue);
} |
Manages shared preference, i.e. the storage used for metrics reporting.
public static class PreferencesManager {
private static final String METRICS_DIR = "recovery_system";
private static final String METRICS_PREFS_FILE = "RecoverySystemMetricsPrefs.xml";
protected final SharedPreferences mSharedPreferences;
private final File mMetricsPrefsFile;
PreferencesManager(Context context) {
File prefsDir = new File(Environment.getDataSystemCeDirectory(USER_SYSTEM),
METRICS_DIR);
mMetricsPrefsFile = new File(prefsDir, METRICS_PREFS_FILE);
mSharedPreferences = context.getSharedPreferences(mMetricsPrefsFile, 0);
}
/** Reads the value of a given key with type long.
public long getLong(String key, long defaultValue) {
return mSharedPreferences.getLong(key, defaultValue);
}
/** Reads the value of a given key with type int. | PreferencesManager::getInt | java | Reginer/aosp-android-jar | android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | MIT |
public void putLong(String key, long value) {
mSharedPreferences.edit().putLong(key, value).commit();
} |
Manages shared preference, i.e. the storage used for metrics reporting.
public static class PreferencesManager {
private static final String METRICS_DIR = "recovery_system";
private static final String METRICS_PREFS_FILE = "RecoverySystemMetricsPrefs.xml";
protected final SharedPreferences mSharedPreferences;
private final File mMetricsPrefsFile;
PreferencesManager(Context context) {
File prefsDir = new File(Environment.getDataSystemCeDirectory(USER_SYSTEM),
METRICS_DIR);
mMetricsPrefsFile = new File(prefsDir, METRICS_PREFS_FILE);
mSharedPreferences = context.getSharedPreferences(mMetricsPrefsFile, 0);
}
/** Reads the value of a given key with type long.
public long getLong(String key, long defaultValue) {
return mSharedPreferences.getLong(key, defaultValue);
}
/** Reads the value of a given key with type int.
public int getInt(String key, int defaultValue) {
return mSharedPreferences.getInt(key, defaultValue);
}
/** Stores the value of a given key with type long. | PreferencesManager::putLong | java | Reginer/aosp-android-jar | android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | MIT |
public void putInt(String key, int value) {
mSharedPreferences.edit().putInt(key, value).commit();
} |
Manages shared preference, i.e. the storage used for metrics reporting.
public static class PreferencesManager {
private static final String METRICS_DIR = "recovery_system";
private static final String METRICS_PREFS_FILE = "RecoverySystemMetricsPrefs.xml";
protected final SharedPreferences mSharedPreferences;
private final File mMetricsPrefsFile;
PreferencesManager(Context context) {
File prefsDir = new File(Environment.getDataSystemCeDirectory(USER_SYSTEM),
METRICS_DIR);
mMetricsPrefsFile = new File(prefsDir, METRICS_PREFS_FILE);
mSharedPreferences = context.getSharedPreferences(mMetricsPrefsFile, 0);
}
/** Reads the value of a given key with type long.
public long getLong(String key, long defaultValue) {
return mSharedPreferences.getLong(key, defaultValue);
}
/** Reads the value of a given key with type int.
public int getInt(String key, int defaultValue) {
return mSharedPreferences.getInt(key, defaultValue);
}
/** Stores the value of a given key with type long.
public void putLong(String key, long value) {
mSharedPreferences.edit().putLong(key, value).commit();
}
/** Stores the value of a given key with type int. | PreferencesManager::putInt | java | Reginer/aosp-android-jar | android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | MIT |
public synchronized void incrementIntKey(String key, int defaultInitialValue) {
int oldValue = getInt(key, defaultInitialValue);
putInt(key, oldValue + 1);
} |
Manages shared preference, i.e. the storage used for metrics reporting.
public static class PreferencesManager {
private static final String METRICS_DIR = "recovery_system";
private static final String METRICS_PREFS_FILE = "RecoverySystemMetricsPrefs.xml";
protected final SharedPreferences mSharedPreferences;
private final File mMetricsPrefsFile;
PreferencesManager(Context context) {
File prefsDir = new File(Environment.getDataSystemCeDirectory(USER_SYSTEM),
METRICS_DIR);
mMetricsPrefsFile = new File(prefsDir, METRICS_PREFS_FILE);
mSharedPreferences = context.getSharedPreferences(mMetricsPrefsFile, 0);
}
/** Reads the value of a given key with type long.
public long getLong(String key, long defaultValue) {
return mSharedPreferences.getLong(key, defaultValue);
}
/** Reads the value of a given key with type int.
public int getInt(String key, int defaultValue) {
return mSharedPreferences.getInt(key, defaultValue);
}
/** Stores the value of a given key with type long.
public void putLong(String key, long value) {
mSharedPreferences.edit().putLong(key, value).commit();
}
/** Stores the value of a given key with type int.
public void putInt(String key, int value) {
mSharedPreferences.edit().putInt(key, value).commit();
}
/** Increments the value of a given key with type int. | PreferencesManager::incrementIntKey | java | Reginer/aosp-android-jar | android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | MIT |
public void deletePrefsFile() {
if (!mMetricsPrefsFile.delete()) {
Slog.w(TAG, "Failed to delete metrics prefs");
}
} |
Manages shared preference, i.e. the storage used for metrics reporting.
public static class PreferencesManager {
private static final String METRICS_DIR = "recovery_system";
private static final String METRICS_PREFS_FILE = "RecoverySystemMetricsPrefs.xml";
protected final SharedPreferences mSharedPreferences;
private final File mMetricsPrefsFile;
PreferencesManager(Context context) {
File prefsDir = new File(Environment.getDataSystemCeDirectory(USER_SYSTEM),
METRICS_DIR);
mMetricsPrefsFile = new File(prefsDir, METRICS_PREFS_FILE);
mSharedPreferences = context.getSharedPreferences(mMetricsPrefsFile, 0);
}
/** Reads the value of a given key with type long.
public long getLong(String key, long defaultValue) {
return mSharedPreferences.getLong(key, defaultValue);
}
/** Reads the value of a given key with type int.
public int getInt(String key, int defaultValue) {
return mSharedPreferences.getInt(key, defaultValue);
}
/** Stores the value of a given key with type long.
public void putLong(String key, long value) {
mSharedPreferences.edit().putLong(key, value).commit();
}
/** Stores the value of a given key with type int.
public void putInt(String key, int value) {
mSharedPreferences.edit().putInt(key, value).commit();
}
/** Increments the value of a given key with type int.
public synchronized void incrementIntKey(String key, int defaultInitialValue) {
int oldValue = getInt(key, defaultInitialValue);
putInt(key, oldValue + 1);
}
/** Delete the preference file and cleanup all metrics storage. | PreferencesManager::deletePrefsFile | java | Reginer/aosp-android-jar | android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | MIT |
public android.hardware.boot.V1_2.IBootControl getBootControl() throws RemoteException {
IBootControl bootControlV10 = IBootControl.getService(true);
if (bootControlV10 == null) {
throw new RemoteException("Failed to get boot control HAL V1_0.");
}
android.hardware.boot.V1_2.IBootControl bootControlV12 =
android.hardware.boot.V1_2.IBootControl.castFrom(bootControlV10);
if (bootControlV12 == null) {
Slog.w(TAG, "Device doesn't implement boot control HAL V1_2.");
return null;
}
return bootControlV12;
} |
Throws remote exception if there's an error getting the boot control HAL.
Returns null if the boot control HAL's version is older than V1_2.
| public::getBootControl | java | Reginer/aosp-android-jar | android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | MIT |
public boolean connectService() {
mLocalSocket = new LocalSocket();
boolean done = false;
// The uncrypt socket will be created by init upon receiving the
// service request. It may not be ready by this point. So we will
// keep retrying until success or reaching timeout.
for (int retry = 0; retry < SOCKET_CONNECTION_MAX_RETRY; retry++) {
try {
mLocalSocket.connect(new LocalSocketAddress(UNCRYPT_SOCKET,
LocalSocketAddress.Namespace.RESERVED));
done = true;
break;
} catch (IOException ignored) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
Slog.w(TAG, "Interrupted:", e);
}
}
}
if (!done) {
Slog.e(TAG, "Timed out connecting to uncrypt socket");
close();
return false;
}
try {
mInputStream = new DataInputStream(mLocalSocket.getInputStream());
mOutputStream = new DataOutputStream(mLocalSocket.getOutputStream());
} catch (IOException e) {
close();
return false;
}
return true;
} |
Attempt to connect to the uncrypt service. Connection will be retried for up to
{@link #SOCKET_CONNECTION_MAX_RETRY} times. If the connection is unsuccessful, the
socket will be closed. If the connection is successful, the connection must be closed
by the caller.
@return true if connection was successful, false if unsuccessful
| UncryptSocket::connectService | java | Reginer/aosp-android-jar | android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | MIT |
public void sendCommand(String command) throws IOException {
byte[] cmdUtf8 = command.getBytes(StandardCharsets.UTF_8);
mOutputStream.writeInt(cmdUtf8.length);
mOutputStream.write(cmdUtf8, 0, cmdUtf8.length);
} |
Sends a command to the uncrypt service.
@param command command to send to the uncrypt service
@throws IOException if there was an error writing to the socket
| UncryptSocket::sendCommand | java | Reginer/aosp-android-jar | android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | MIT |
public int getPercentageUncrypted() throws IOException {
return mInputStream.readInt();
} |
Reads the status from the uncrypt service which is usually represented as a percentage.
@return an integer representing the percentage completed
@throws IOException if there was an error reading the socket
| UncryptSocket::getPercentageUncrypted | java | Reginer/aosp-android-jar | android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | MIT |
public void sendAck() throws IOException {
mOutputStream.writeInt(0);
} |
Sends a confirmation to the uncrypt service.
@throws IOException if there was an error writing to the socket
| UncryptSocket::sendAck | java | Reginer/aosp-android-jar | android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | MIT |
public void close() {
IoUtils.closeQuietly(mInputStream);
IoUtils.closeQuietly(mOutputStream);
IoUtils.closeQuietly(mLocalSocket);
} |
Closes the socket and all underlying data streams.
| UncryptSocket::close | java | Reginer/aosp-android-jar | android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/server/recoverysystem/RecoverySystemService.java | MIT |
public static final @NonNull ControlTemplate NO_TEMPLATE = new ControlTemplate("") {
@Override
public int getTemplateType() {
return TYPE_NO_TEMPLATE;
}
}; |
Singleton representing a {@link Control} with no input.
@hide
| ControlTemplate::ControlTemplate | java | Reginer/aosp-android-jar | android-35/src/android/service/controls/templates/ControlTemplate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/service/controls/templates/ControlTemplate.java | MIT |
private static final @NonNull ControlTemplate ERROR_TEMPLATE = new ControlTemplate("") {
@Override
public int getTemplateType() {
return TYPE_ERROR;
}
}; |
Object returned when there is an unparcelling error.
@hide
| ControlTemplate::ControlTemplate | java | Reginer/aosp-android-jar | android-35/src/android/service/controls/templates/ControlTemplate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/service/controls/templates/ControlTemplate.java | MIT |
ControlTemplate(@NonNull Bundle b) {
mTemplateId = b.getString(KEY_TEMPLATE_ID);
} |
@param b
@hide
| ControlTemplate::ControlTemplate | java | Reginer/aosp-android-jar | android-35/src/android/service/controls/templates/ControlTemplate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/service/controls/templates/ControlTemplate.java | MIT |
public void prepareTemplateForBinder(@NonNull Context context) {} |
Call to prepare values for Binder transport.
@hide
| ControlTemplate::prepareTemplateForBinder | java | Reginer/aosp-android-jar | android-35/src/android/service/controls/templates/ControlTemplate.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/service/controls/templates/ControlTemplate.java | MIT |
public NetworkInfo(int type, int subtype,
@Nullable String typeName, @Nullable String subtypeName) {
if (!ConnectivityManager.isNetworkTypeValid(type)
&& type != ConnectivityManager.TYPE_NONE) {
throw new IllegalArgumentException("Invalid network type: " + type);
}
mNetworkType = type;
mSubtype = subtype;
mTypeName = typeName;
mSubtypeName = subtypeName;
setDetailedState(DetailedState.IDLE, null, null);
mState = State.UNKNOWN;
} |
Create a new instance of NetworkInfo.
This may be useful for apps to write unit tests.
@param type the legacy type of the network, as one of the ConnectivityManager.TYPE_*
constants.
@param subtype the subtype if applicable, as one of the TelephonyManager.NETWORK_TYPE_*
constants.
@param typeName a human-readable string for the network type, or an empty string or null.
@param subtypeName a human-readable string for the subtype, or an empty string or null.
| NetworkInfo::NetworkInfo | java | Reginer/aosp-android-jar | android-35/src/android/net/NetworkInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/net/NetworkInfo.java | MIT |
public String getReason() {
synchronized (this) {
return mReason;
}
} |
Report the reason an attempt to establish connectivity failed,
if one is available.
@return the reason for failure, or null if not available
@deprecated This method does not have a consistent contract that could make it useful
to callers.
| NetworkInfo::getReason | java | Reginer/aosp-android-jar | android-35/src/android/net/NetworkInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/net/NetworkInfo.java | MIT |
public String toShortString() {
synchronized (this) {
final StringBuilder builder = new StringBuilder();
builder.append(getTypeName());
final String subtype = getSubtypeName();
if (!TextUtils.isEmpty(subtype)) {
builder.append("[").append(subtype).append("]");
}
builder.append(" ");
builder.append(mDetailedState);
if (mIsRoaming) {
builder.append(" ROAMING");
}
if (mExtraInfo != null) {
builder.append(" extra: ").append(mExtraInfo);
}
return builder.toString();
}
} |
Returns a brief summary string suitable for debugging.
@hide
| NetworkInfo::toShortString | java | Reginer/aosp-android-jar | android-35/src/android/net/NetworkInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/net/NetworkInfo.java | MIT |
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector(10);
v.add(new ASN1Integer(version)); // version
v.add(new ASN1Integer(getModulus()));
v.add(new ASN1Integer(getPublicExponent()));
v.add(new ASN1Integer(getPrivateExponent()));
v.add(new ASN1Integer(getPrime1()));
v.add(new ASN1Integer(getPrime2()));
v.add(new ASN1Integer(getExponent1()));
v.add(new ASN1Integer(getExponent2()));
v.add(new ASN1Integer(getCoefficient()));
if (otherPrimeInfos != null)
{
v.add(otherPrimeInfos);
}
return new DERSequence(v);
} |
This outputs the key in PKCS1v2 format.
<pre>
RSAPrivateKey ::= SEQUENCE {
version Version,
modulus INTEGER, -- n
publicExponent INTEGER, -- e
privateExponent INTEGER, -- d
prime1 INTEGER, -- p
prime2 INTEGER, -- q
exponent1 INTEGER, -- d mod (p-1)
exponent2 INTEGER, -- d mod (q-1)
coefficient INTEGER, -- (inverse of q) mod p
otherPrimeInfos OtherPrimeInfos OPTIONAL
}
Version ::= INTEGER { two-prime(0), multi(1) }
(CONSTRAINED BY {-- version must be multi if otherPrimeInfos present --})
</pre>
<p>
This routine is written to output PKCS1 version 2.1, private keys.
| RSAPrivateKey::toASN1Primitive | java | Reginer/aosp-android-jar | android-35/src/com/android/internal/org/bouncycastle/asn1/pkcs/RSAPrivateKey.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/internal/org/bouncycastle/asn1/pkcs/RSAPrivateKey.java | MIT |
public void setCustomBackground(Drawable background) {
if (mBackground != null) {
mBackground.setCallback(null);
unscheduleDrawable(mBackground);
}
mBackground = background;
mBackground.mutate();
if (mBackground != null) {
mBackground.setCallback(this);
setTint(mTintColor);
}
if (mBackground instanceof RippleDrawable) {
((RippleDrawable) mBackground).setForceSoftware(true);
}
updateBackgroundRadii();
invalidate();
} |
Sets a background drawable. As we need to change our bounds independently of layout, we need
the notion of a background independently of the regular View background..
| NotificationBackgroundView::setCustomBackground | java | Reginer/aosp-android-jar | android-31/src/com/android/systemui/statusbar/notification/row/NotificationBackgroundView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/systemui/statusbar/notification/row/NotificationBackgroundView.java | MIT |
public void setRadius(float topRoundness, float bottomRoundness) {
if (topRoundness == mCornerRadii[0] && bottomRoundness == mCornerRadii[4]) {
return;
}
mBottomIsRounded = bottomRoundness != 0.0f;
mCornerRadii[0] = topRoundness;
mCornerRadii[1] = topRoundness;
mCornerRadii[2] = topRoundness;
mCornerRadii[3] = topRoundness;
mCornerRadii[4] = bottomRoundness;
mCornerRadii[5] = bottomRoundness;
mCornerRadii[6] = bottomRoundness;
mCornerRadii[7] = bottomRoundness;
updateBackgroundRadii();
} |
Sets the current top and bottom radius for this background.
| NotificationBackgroundView::setRadius | java | Reginer/aosp-android-jar | android-31/src/com/android/systemui/statusbar/notification/row/NotificationBackgroundView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/systemui/statusbar/notification/row/NotificationBackgroundView.java | MIT |
public void setExpandAnimationSize(int actualWidth, int actualHeight) {
mActualHeight = actualHeight;
mActualWidth = actualWidth;
invalidate();
} |
Sets the current top and bottom radius for this background.
public void setRadius(float topRoundness, float bottomRoundness) {
if (topRoundness == mCornerRadii[0] && bottomRoundness == mCornerRadii[4]) {
return;
}
mBottomIsRounded = bottomRoundness != 0.0f;
mCornerRadii[0] = topRoundness;
mCornerRadii[1] = topRoundness;
mCornerRadii[2] = topRoundness;
mCornerRadii[3] = topRoundness;
mCornerRadii[4] = bottomRoundness;
mCornerRadii[5] = bottomRoundness;
mCornerRadii[6] = bottomRoundness;
mCornerRadii[7] = bottomRoundness;
updateBackgroundRadii();
}
public void setBottomAmountClips(boolean clips) {
if (clips != mBottomAmountClips) {
mBottomAmountClips = clips;
invalidate();
}
}
private void updateBackgroundRadii() {
if (mDontModifyCorners) {
return;
}
if (mBackground instanceof LayerDrawable) {
GradientDrawable gradientDrawable =
(GradientDrawable) ((LayerDrawable) mBackground).getDrawable(0);
gradientDrawable.setCornerRadii(mCornerRadii);
}
}
public void setBackgroundTop(int backgroundTop) {
mBackgroundTop = backgroundTop;
invalidate();
}
/** Set the current expand animation size. | NotificationBackgroundView::setExpandAnimationSize | java | Reginer/aosp-android-jar | android-31/src/com/android/systemui/statusbar/notification/row/NotificationBackgroundView.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-31/src/com/android/systemui/statusbar/notification/row/NotificationBackgroundView.java | MIT |
public static @NonNull String digestOf(@NonNull String... keys) {
Arrays.sort(keys);
try {
final MessageDigest digest = MessageDigest.getInstance("SHA-1");
for (String key : keys) {
final String item = key + "=" + get(key) + "\n";
digest.update(item.getBytes(StandardCharsets.UTF_8));
}
return HexEncoding.encodeToString(digest.digest()).toLowerCase();
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
} |
Return a {@code SHA-1} digest of the given keys and their values as a
hex-encoded string. The ordering of the incoming keys doesn't change the
digest result.
@hide
| SystemProperties::digestOf | java | Reginer/aosp-android-jar | android-32/src/android/os/SystemProperties.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/os/SystemProperties.java | MIT |
@Nullable public static Handle find(@NonNull String name) {
long nativeHandle = native_find(name);
if (nativeHandle == 0) {
return null;
}
return new Handle(nativeHandle);
} |
Look up a property location by name.
@name name of the property
@return property handle or {@code null} if property isn't set
@hide
| SystemProperties::find | java | Reginer/aosp-android-jar | android-32/src/android/os/SystemProperties.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/os/SystemProperties.java | MIT |
@NonNull public String get() {
return native_get(mNativeHandle);
} |
@return Value of the property
| Handle::get | java | Reginer/aosp-android-jar | android-32/src/android/os/SystemProperties.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/os/SystemProperties.java | MIT |
public int getInt(int def) {
return native_get_int(mNativeHandle, def);
} |
@param def default value
@return value or {@code def} on parse error
| Handle::getInt | java | Reginer/aosp-android-jar | android-32/src/android/os/SystemProperties.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/os/SystemProperties.java | MIT |
public IsChunkBreakpoint(long averageNumberOfTrialsUntilBreakpoint) {
checkArgument(
averageNumberOfTrialsUntilBreakpoint >= 0,
"Average number of trials must be non-negative");
// Want n leading zeros after t trials.
// P(leading zeros = n) = 1/2^n
// Expected num trials to get n leading zeros = 1/2^-n
// t = 1/2^-n
// n = log2(t)
mLeadingZeros = (int) Math.round(log2(averageNumberOfTrialsUntilBreakpoint));
mBitmask = ~(~0L >>> mLeadingZeros);
} |
A new instance that causes a breakpoint after a given number of trials on average.
@param averageNumberOfTrialsUntilBreakpoint The number of trials after which on average to
create a new chunk. If this is not a power of 2, some precision is sacrificed (i.e., on
average, breaks will actually happen after the nearest power of 2 to the average number
of trials passed in).
| IsChunkBreakpoint::IsChunkBreakpoint | java | Reginer/aosp-android-jar | android-32/src/com/android/server/backup/encryption/chunking/cdc/IsChunkBreakpoint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/backup/encryption/chunking/cdc/IsChunkBreakpoint.java | MIT |
public int getLeadingZeros() {
return mLeadingZeros;
} |
Returns {@code true} if {@code fingerprint} indicates that there should be a chunk
breakpoint.
@Override
public boolean isBreakpoint(long fingerprint) {
return (fingerprint & mBitmask) == 0;
}
/** Returns the number of leading zeros in the fingerprint that causes a breakpoint. | IsChunkBreakpoint::getLeadingZeros | java | Reginer/aosp-android-jar | android-32/src/com/android/server/backup/encryption/chunking/cdc/IsChunkBreakpoint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/backup/encryption/chunking/cdc/IsChunkBreakpoint.java | MIT |
private static double log2(double x) {
return Math.log(x) / Math.log(2);
} |
Calculates log base 2 of x. Not the most efficient possible implementation, but it's simple,
obviously correct, and is only invoked on object construction.
| IsChunkBreakpoint::log2 | java | Reginer/aosp-android-jar | android-32/src/com/android/server/backup/encryption/chunking/cdc/IsChunkBreakpoint.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/com/android/server/backup/encryption/chunking/cdc/IsChunkBreakpoint.java | MIT |
public BluetoothLeScanner(BluetoothAdapter bluetoothAdapter) {
mBluetoothAdapter = Objects.requireNonNull(bluetoothAdapter);
mBluetoothManager = mBluetoothAdapter.getBluetoothManager();
mAttributionSource = mBluetoothAdapter.getAttributionSource();
mHandler = new Handler(Looper.getMainLooper());
mLeScanClients = new HashMap<ScanCallback, BleScanCallbackWrapper>();
} |
Use {@link BluetoothAdapter#getBluetoothLeScanner()} instead.
@param bluetoothManager BluetoothManager that conducts overall Bluetooth Management.
@param opPackageName The opPackageName of the context this object was created from
@param featureId The featureId of the context this object was created from
@hide
| BluetoothLeScanner::BluetoothLeScanner | java | Reginer/aosp-android-jar | android-32/src/android/bluetooth/le/BluetoothLeScanner.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-32/src/android/bluetooth/le/BluetoothLeScanner.java | MIT |
public TransitionRequestInfo(
@WindowManager.TransitionType int type,
@Nullable ActivityManager.RunningTaskInfo triggerTask,
@Nullable RemoteTransition remoteTransition) {
this(type, triggerTask, remoteTransition, null /* displayChange */);
} |
If non-null, this request was triggered by this display change. This will not be complete:
The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds
(if size is changing).
private @Nullable DisplayChange mDisplayChange;
/** constructor override | TransitionRequestInfo::TransitionRequestInfo | java | Reginer/aosp-android-jar | android-34/src/android/window/TransitionRequestInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/window/TransitionRequestInfo.java | MIT |
public DisplayChange(int displayId) {
mDisplayId = displayId;
} |
If non-null, this request was triggered by this display change. This will not be complete:
The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds
(if size is changing).
private @Nullable DisplayChange mDisplayChange;
/** constructor override
public TransitionRequestInfo(
@WindowManager.TransitionType int type,
@Nullable ActivityManager.RunningTaskInfo triggerTask,
@Nullable RemoteTransition remoteTransition) {
this(type, triggerTask, remoteTransition, null /* displayChange */);
}
/** Requested change to a display.
@DataClass(genToString = true, genSetters = true, genBuilder = false, genConstructor = false)
public static class DisplayChange implements Parcelable {
private final int mDisplayId;
@Nullable private Rect mStartAbsBounds = null;
@Nullable private Rect mEndAbsBounds = null;
private int mStartRotation = WindowConfiguration.ROTATION_UNDEFINED;
private int mEndRotation = WindowConfiguration.ROTATION_UNDEFINED;
private boolean mPhysicalDisplayChanged = false;
/** Create empty display-change. | DisplayChange::DisplayChange | java | Reginer/aosp-android-jar | android-34/src/android/window/TransitionRequestInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/window/TransitionRequestInfo.java | MIT |
public DisplayChange(int displayId, int startRotation, int endRotation) {
mDisplayId = displayId;
mStartRotation = startRotation;
mEndRotation = endRotation;
} |
If non-null, this request was triggered by this display change. This will not be complete:
The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds
(if size is changing).
private @Nullable DisplayChange mDisplayChange;
/** constructor override
public TransitionRequestInfo(
@WindowManager.TransitionType int type,
@Nullable ActivityManager.RunningTaskInfo triggerTask,
@Nullable RemoteTransition remoteTransition) {
this(type, triggerTask, remoteTransition, null /* displayChange */);
}
/** Requested change to a display.
@DataClass(genToString = true, genSetters = true, genBuilder = false, genConstructor = false)
public static class DisplayChange implements Parcelable {
private final int mDisplayId;
@Nullable private Rect mStartAbsBounds = null;
@Nullable private Rect mEndAbsBounds = null;
private int mStartRotation = WindowConfiguration.ROTATION_UNDEFINED;
private int mEndRotation = WindowConfiguration.ROTATION_UNDEFINED;
private boolean mPhysicalDisplayChanged = false;
/** Create empty display-change.
public DisplayChange(int displayId) {
mDisplayId = displayId;
}
/** Create a display-change representing a rotation. | DisplayChange::DisplayChange | java | Reginer/aosp-android-jar | android-34/src/android/window/TransitionRequestInfo.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/window/TransitionRequestInfo.java | MIT |
public RtpHeaderExtensionType(@IntRange(from = 1, to = 14) int localIdentifier,
@NonNull Uri uri) {
if (localIdentifier < 1 || localIdentifier > 13) {
throw new IllegalArgumentException("localIdentifier must be in range 1-14");
}
if (uri == null) {
throw new NullPointerException("uri is required.");
}
mLocalIdentifier = localIdentifier;
mUri = uri;
} |
Create a new RTP header extension type.
@param localIdentifier the local identifier.
@param uri the {@link Uri} identifying the RTP header extension type.
@throws IllegalArgumentException if {@code localIdentifier} is out of the expected range.
@throws NullPointerException if {@code uri} is null.
| RtpHeaderExtensionType::RtpHeaderExtensionType | java | Reginer/aosp-android-jar | android-33/src/android/telephony/ims/RtpHeaderExtensionType.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/telephony/ims/RtpHeaderExtensionType.java | MIT |
public static final String concatGroups(Matcher matcher) {
StringBuilder b = new StringBuilder();
final int numGroups = matcher.groupCount();
for (int i = 1; i <= numGroups; i++) {
String s = matcher.group(i);
if (s != null) {
b.append(s);
}
}
return b.toString();
} |
Convenience method to take all of the non-null matching groups in a
regex Matcher and return them as a concatenated string.
@param matcher The Matcher object from which grouped text will
be extracted
@return A String comprising all of the non-null matched
groups concatenated together
| Patterns::concatGroups | java | Reginer/aosp-android-jar | android-35/src/android/util/Patterns.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/Patterns.java | MIT |
public static final String digitsAndPlusOnly(Matcher matcher) {
StringBuilder buffer = new StringBuilder();
String matchingRegion = matcher.group();
for (int i = 0, size = matchingRegion.length(); i < size; i++) {
char character = matchingRegion.charAt(i);
if (character == '+' || Character.isDigit(character)) {
buffer.append(character);
}
}
return buffer.toString();
} |
Convenience method to return only the digits and plus signs
in the matching string.
@param matcher The Matcher object from which digits and plus will
be extracted
@return A String comprising all of the digits and plus in
the match
| Patterns::digitsAndPlusOnly | java | Reginer/aosp-android-jar | android-35/src/android/util/Patterns.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/Patterns.java | MIT |
private Patterns() {} |
Do not create this static utility class.
| Patterns::Patterns | java | Reginer/aosp-android-jar | android-35/src/android/util/Patterns.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/util/Patterns.java | MIT |
protected SelectionKey() { } |
Constructs an instance of this class.
| SelectionKey::SelectionKey | java | Reginer/aosp-android-jar | android-33/src/java/nio/channels/SelectionKey.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/nio/channels/SelectionKey.java | MIT |
public int interestOpsOr(int ops) {
synchronized (this) {
int oldVal = interestOps();
interestOps(oldVal | ops);
return oldVal;
}
} |
Atomically sets this key's interest set to the bitwise union ("or") of
the existing interest set and the given value. This method is guaranteed
to be atomic with respect to other concurrent calls to this method or to
{@link #interestOpsAnd(int)}.
<p> This method may be invoked at any time. If this method is invoked
while a selection operation is in progress then it has no effect upon
that operation; the change to the key's interest set will be seen by the
next selection operation.
@implSpec The default implementation synchronizes on this key and invokes
{@code interestOps()} and {@code interestOps(int)} to retrieve and set
this key's interest set.
@param ops The interest set to apply
@return The previous interest set
@throws IllegalArgumentException
If a bit in the set does not correspond to an operation that
is supported by this key's channel, that is, if
{@code (ops & ~channel().validOps()) != 0}
@throws CancelledKeyException
If this key has been cancelled
@since 11
| SelectionKey::interestOpsOr | java | Reginer/aosp-android-jar | android-33/src/java/nio/channels/SelectionKey.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/nio/channels/SelectionKey.java | MIT |
public int interestOpsAnd(int ops) {
synchronized (this) {
int oldVal = interestOps();
interestOps(oldVal & ops);
return oldVal;
}
} |
Atomically sets this key's interest set to the bitwise intersection ("and")
of the existing interest set and the given value. This method is guaranteed
to be atomic with respect to other concurrent calls to this method or to
{@link #interestOpsOr(int)}.
<p> This method may be invoked at any time. If this method is invoked
while a selection operation is in progress then it has no effect upon
that operation; the change to the key's interest set will be seen by the
next selection operation.
@apiNote Unlike the {@code interestOps(int)} and {@code interestOpsOr(int)}
methods, this method does not throw {@code IllegalArgumentException} when
invoked with bits in the interest set that do not correspond to an
operation that is supported by this key's channel. This is to allow
operation bits in the interest set to be cleared using bitwise complement
values, e.g., {@code interestOpsAnd(~SelectionKey.OP_READ)} will remove
the {@code OP_READ} from the interest set without affecting other bits.
@implSpec The default implementation synchronizes on this key and invokes
{@code interestOps()} and {@code interestOps(int)} to retrieve and set
this key's interest set.
@param ops The interest set to apply
@return The previous interest set
@throws CancelledKeyException
If this key has been cancelled
@since 11
| SelectionKey::interestOpsAnd | java | Reginer/aosp-android-jar | android-33/src/java/nio/channels/SelectionKey.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/nio/channels/SelectionKey.java | MIT |
public final boolean isReadable() {
return (readyOps() & OP_READ) != 0;
} |
Tests whether this key's channel is ready for reading.
<p> An invocation of this method of the form {@code k.isReadable()}
behaves in exactly the same way as the expression
<blockquote><pre>{@code
k.readyOps() & OP_READ != 0
}</pre></blockquote>
<p> If this key's channel does not support read operations then this
method always returns {@code false}. </p>
@return {@code true} if, and only if,
{@code readyOps() & OP_READ} is nonzero
@throws CancelledKeyException
If this key has been cancelled
| SelectionKey::isReadable | java | Reginer/aosp-android-jar | android-33/src/java/nio/channels/SelectionKey.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/nio/channels/SelectionKey.java | MIT |
public final boolean isWritable() {
return (readyOps() & OP_WRITE) != 0;
} |
Tests whether this key's channel is ready for writing.
<p> An invocation of this method of the form {@code k.isWritable()}
behaves in exactly the same way as the expression
<blockquote><pre>{@code
k.readyOps() & OP_WRITE != 0
}</pre></blockquote>
<p> If this key's channel does not support write operations then this
method always returns {@code false}. </p>
@return {@code true} if, and only if,
{@code readyOps() & OP_WRITE} is nonzero
@throws CancelledKeyException
If this key has been cancelled
| SelectionKey::isWritable | java | Reginer/aosp-android-jar | android-33/src/java/nio/channels/SelectionKey.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/nio/channels/SelectionKey.java | MIT |
public final boolean isConnectable() {
return (readyOps() & OP_CONNECT) != 0;
} |
Tests whether this key's channel has either finished, or failed to
finish, its socket-connection operation.
<p> An invocation of this method of the form {@code k.isConnectable()}
behaves in exactly the same way as the expression
<blockquote><pre>{@code
k.readyOps() & OP_CONNECT != 0
}</pre></blockquote>
<p> If this key's channel does not support socket-connect operations
then this method always returns {@code false}. </p>
@return {@code true} if, and only if,
{@code readyOps() & OP_CONNECT} is nonzero
@throws CancelledKeyException
If this key has been cancelled
| SelectionKey::isConnectable | java | Reginer/aosp-android-jar | android-33/src/java/nio/channels/SelectionKey.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/nio/channels/SelectionKey.java | MIT |
public final boolean isAcceptable() {
return (readyOps() & OP_ACCEPT) != 0;
} |
Tests whether this key's channel is ready to accept a new socket
connection.
<p> An invocation of this method of the form {@code k.isAcceptable()}
behaves in exactly the same way as the expression
<blockquote><pre>{@code
k.readyOps() & OP_ACCEPT != 0
}</pre></blockquote>
<p> If this key's channel does not support socket-accept operations then
this method always returns {@code false}. </p>
@return {@code true} if, and only if,
{@code readyOps() & OP_ACCEPT} is nonzero
@throws CancelledKeyException
If this key has been cancelled
| SelectionKey::isAcceptable | java | Reginer/aosp-android-jar | android-33/src/java/nio/channels/SelectionKey.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/nio/channels/SelectionKey.java | MIT |
public final Object attach(Object ob) {
return attachmentUpdater.getAndSet(this, ob);
} |
Attaches the given object to this key.
<p> An attached object may later be retrieved via the {@link #attachment()
attachment} method. Only one object may be attached at a time; invoking
this method causes any previous attachment to be discarded. The current
attachment may be discarded by attaching {@code null}. </p>
@param ob
The object to be attached; may be {@code null}
@return The previously-attached object, if any,
otherwise {@code null}
| SelectionKey::attach | java | Reginer/aosp-android-jar | android-33/src/java/nio/channels/SelectionKey.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/nio/channels/SelectionKey.java | MIT |
public final Object attachment() {
return attachment;
} |
Retrieves the current attachment.
@return The object currently attached to this key,
or {@code null} if there is no attachment
| SelectionKey::attachment | java | Reginer/aosp-android-jar | android-33/src/java/nio/channels/SelectionKey.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/java/nio/channels/SelectionKey.java | MIT |
private ProvisioningIntentHelper() { } |
This class is never instantiated
| ProvisioningIntentHelper::ProvisioningIntentHelper | java | Reginer/aosp-android-jar | android-35/src/android/app/admin/ProvisioningIntentHelper.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/app/admin/ProvisioningIntentHelper.java | MIT |
static ServiceConfigAccessor getInstance(Context context) {
synchronized (SLOCK) {
if (sInstance == null) {
sInstance = new ServiceConfigAccessorImpl(context);
}
return sInstance;
}
} |
If a newly calculated system clock time and the current system clock time differs by this or
more the system clock will actually be updated. Used to prevent the system clock being set
for only minor differences.
private final int mSystemClockUpdateThresholdMillis;
private ServiceConfigAccessorImpl(@NonNull Context context) {
mContext = Objects.requireNonNull(context);
mCr = context.getContentResolver();
mUserManager = context.getSystemService(UserManager.class);
mServerFlags = ServerFlags.getInstance(mContext);
mConfigOriginPrioritiesSupplier = new ConfigOriginPrioritiesSupplier(context);
mServerFlagsOriginPrioritiesSupplier =
new ServerFlagsOriginPrioritiesSupplier(mServerFlags);
mSystemClockUpdateThresholdMillis =
SystemProperties.getInt("ro.sys.time_detector_update_diff",
SYSTEM_CLOCK_UPDATE_THRESHOLD_MILLIS_DEFAULT);
// Wire up the config change listeners for anything that could affect ConfigurationInternal.
// Use the main thread for event delivery, listeners can post to their chosen thread.
// Listen for the user changing / the user's location mode changing. Report on the main
// thread.
IntentFilter filter = new IntentFilter();
filter.addAction(ACTION_USER_SWITCHED);
mContext.registerReceiverForAllUsers(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
handleConfigurationInternalChangeOnMainThread();
}
}, filter, null, null /* main thread */);
// Add async callbacks for global settings being changed.
ContentResolver contentResolver = mContext.getContentResolver();
ContentObserver contentObserver = new ContentObserver(mContext.getMainThreadHandler()) {
@Override
public void onChange(boolean selfChange) {
handleConfigurationInternalChangeOnMainThread();
}
};
contentResolver.registerContentObserver(
Settings.Global.getUriFor(Settings.Global.AUTO_TIME), true, contentObserver);
// Watch server flags.
mServerFlags.addListener(this::handleConfigurationInternalChangeOnMainThread,
SERVER_FLAGS_KEYS_TO_WATCH);
}
/** Returns the singleton instance. | ServiceConfigAccessorImpl::getInstance | java | Reginer/aosp-android-jar | android-34/src/com/android/server/timedetector/ServiceConfigAccessorImpl.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/com/android/server/timedetector/ServiceConfigAccessorImpl.java | MIT |
public BulletSpan() {
this(STANDARD_GAP_WIDTH, STANDARD_COLOR, false, STANDARD_BULLET_RADIUS);
} |
Creates a {@link BulletSpan} with the default values.
| BulletSpan::BulletSpan | java | Reginer/aosp-android-jar | android-34/src/android/text/style/BulletSpan.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/text/style/BulletSpan.java | MIT |
public BulletSpan(int gapWidth) {
this(gapWidth, STANDARD_COLOR, false, STANDARD_BULLET_RADIUS);
} |
Creates a {@link BulletSpan} based on a gap width
@param gapWidth the distance, in pixels, between the bullet point and the paragraph.
| BulletSpan::BulletSpan | java | Reginer/aosp-android-jar | android-34/src/android/text/style/BulletSpan.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/text/style/BulletSpan.java | MIT |
public BulletSpan(int gapWidth, @ColorInt int color) {
this(gapWidth, color, true, STANDARD_BULLET_RADIUS);
} |
Creates a {@link BulletSpan} based on a gap width and a color integer.
@param gapWidth the distance, in pixels, between the bullet point and the paragraph.
@param color the bullet point color, as a color integer
@see android.content.res.Resources#getColor(int, Resources.Theme)
| BulletSpan::BulletSpan | java | Reginer/aosp-android-jar | android-34/src/android/text/style/BulletSpan.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/text/style/BulletSpan.java | MIT |
public BulletSpan(int gapWidth, @ColorInt int color, @IntRange(from = 0) int bulletRadius) {
this(gapWidth, color, true, bulletRadius);
} |
Creates a {@link BulletSpan} based on a gap width and a color integer.
@param gapWidth the distance, in pixels, between the bullet point and the paragraph.
@param color the bullet point color, as a color integer.
@param bulletRadius the radius of the bullet point, in pixels.
@see android.content.res.Resources#getColor(int, Resources.Theme)
| BulletSpan::BulletSpan | java | Reginer/aosp-android-jar | android-34/src/android/text/style/BulletSpan.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/text/style/BulletSpan.java | MIT |
public BulletSpan(@NonNull Parcel src) {
mGapWidth = src.readInt();
mWantColor = src.readInt() != 0;
mColor = src.readInt();
mBulletRadius = src.readInt();
} |
Creates a {@link BulletSpan} from a parcel.
| BulletSpan::BulletSpan | java | Reginer/aosp-android-jar | android-34/src/android/text/style/BulletSpan.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/text/style/BulletSpan.java | MIT |
public int getGapWidth() {
return mGapWidth;
} |
Get the distance, in pixels, between the bullet point and the paragraph.
@return the distance, in pixels, between the bullet point and the paragraph.
| BulletSpan::getGapWidth | java | Reginer/aosp-android-jar | android-34/src/android/text/style/BulletSpan.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/text/style/BulletSpan.java | MIT |
public int getBulletRadius() {
return mBulletRadius;
} |
Get the radius, in pixels, of the bullet point.
@return the radius, in pixels, of the bullet point.
| BulletSpan::getBulletRadius | java | Reginer/aosp-android-jar | android-34/src/android/text/style/BulletSpan.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/text/style/BulletSpan.java | MIT |
public int getColor() {
return mColor;
} |
Get the bullet point color.
@return the bullet point color
| BulletSpan::getColor | java | Reginer/aosp-android-jar | android-34/src/android/text/style/BulletSpan.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-34/src/android/text/style/BulletSpan.java | MIT |
public HebrewCalendar() {
this(TimeZone.getDefault(), ULocale.getDefault(Category.FORMAT));
} |
Constructs a default <code>HebrewCalendar</code> using the current time
in the default time zone with the default <code>FORMAT</code> locale.
@see Category#FORMAT
| HebrewCalendar::HebrewCalendar | java | Reginer/aosp-android-jar | android-35/src/android/icu/util/HebrewCalendar.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/util/HebrewCalendar.java | MIT |
public HebrewCalendar(TimeZone zone) {
this(zone, ULocale.getDefault(Category.FORMAT));
} |
Constructs a <code>HebrewCalendar</code> based on the current time
in the given time zone with the default <code>FORMAT</code> locale.
@param zone The time zone for the new calendar.
@see Category#FORMAT
| HebrewCalendar::HebrewCalendar | java | Reginer/aosp-android-jar | android-35/src/android/icu/util/HebrewCalendar.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/util/HebrewCalendar.java | MIT |
public HebrewCalendar(Locale aLocale) {
this(TimeZone.forLocaleOrDefault(aLocale), aLocale);
} |
Constructs a <code>HebrewCalendar</code> based on the current time
in the default time zone with the given locale.
@param aLocale The locale for the new calendar.
| HebrewCalendar::HebrewCalendar | java | Reginer/aosp-android-jar | android-35/src/android/icu/util/HebrewCalendar.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/util/HebrewCalendar.java | MIT |
public HebrewCalendar(ULocale locale) {
this(TimeZone.forULocaleOrDefault(locale), locale);
} |
Constructs a <code>HebrewCalendar</code> based on the current time
in the default time zone with the given locale.
@param locale The locale for the new calendar.
| HebrewCalendar::HebrewCalendar | java | Reginer/aosp-android-jar | android-35/src/android/icu/util/HebrewCalendar.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/util/HebrewCalendar.java | MIT |
public HebrewCalendar(TimeZone zone, Locale aLocale) {
super(zone, aLocale);
setTimeInMillis(System.currentTimeMillis());
} |
Constructs a <code>HebrewCalendar</code> based on the current time
in the given time zone with the given locale.
@param zone The time zone for the new calendar.
@param aLocale The locale for the new calendar.
| HebrewCalendar::HebrewCalendar | java | Reginer/aosp-android-jar | android-35/src/android/icu/util/HebrewCalendar.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/util/HebrewCalendar.java | MIT |
public HebrewCalendar(TimeZone zone, ULocale locale) {
super(zone, locale);
setTimeInMillis(System.currentTimeMillis());
} |
Constructs a <code>HebrewCalendar</code> based on the current time
in the given time zone with the given locale.
@param zone The time zone for the new calendar.
@param locale The locale for the new calendar.
| HebrewCalendar::HebrewCalendar | java | Reginer/aosp-android-jar | android-35/src/android/icu/util/HebrewCalendar.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/util/HebrewCalendar.java | MIT |
public HebrewCalendar(int year, int month, int date) {
super(TimeZone.getDefault(), ULocale.getDefault(Category.FORMAT));
this.set(YEAR, year);
this.set(MONTH, month);
this.set(DATE, date);
} |
Constructs a <code>HebrewCalendar</code> with the given date set
in the default time zone with the default <code>FORMAT</code> locale.
@param year The value used to set the calendar's {@link #YEAR YEAR} time field.
@param month The value used to set the calendar's {@link #MONTH MONTH} time field.
The value is 0-based. e.g., 0 for Tishri.
@param date The value used to set the calendar's {@link #DATE DATE} time field.
@see Category#FORMAT
| HebrewCalendar::HebrewCalendar | java | Reginer/aosp-android-jar | android-35/src/android/icu/util/HebrewCalendar.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/util/HebrewCalendar.java | MIT |
public HebrewCalendar(Date date) {
super(TimeZone.getDefault(), ULocale.getDefault(Category.FORMAT));
this.setTime(date);
} |
Constructs a <code>HebrewCalendar</code> with the given date set
in the default time zone with the default <code>FORMAT</code> locale.
@param date The date to which the new calendar is set.
@see Category#FORMAT
| HebrewCalendar::HebrewCalendar | java | Reginer/aosp-android-jar | android-35/src/android/icu/util/HebrewCalendar.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/util/HebrewCalendar.java | MIT |
public HebrewCalendar(int year, int month, int date, int hour,
int minute, int second)
{
super(TimeZone.getDefault(), ULocale.getDefault(Category.FORMAT));
this.set(YEAR, year);
this.set(MONTH, month);
this.set(DATE, date);
this.set(HOUR_OF_DAY, hour);
this.set(MINUTE, minute);
this.set(SECOND, second);
} |
Constructs a <code>HebrewCalendar</code> with the given date
and time set for the default time zone with the default <code>FORMAT</code> locale.
@param year The value used to set the calendar's {@link #YEAR YEAR} time field.
@param month The value used to set the calendar's {@link #MONTH MONTH} time field.
The value is 0-based. e.g., 0 for Tishri.
@param date The value used to set the calendar's {@link #DATE DATE} time field.
@param hour The value used to set the calendar's {@link #HOUR_OF_DAY HOUR_OF_DAY} time field.
@param minute The value used to set the calendar's {@link #MINUTE MINUTE} time field.
@param second The value used to set the calendar's {@link #SECOND SECOND} time field.
@see Category#FORMAT
| HebrewCalendar::HebrewCalendar | java | Reginer/aosp-android-jar | android-35/src/android/icu/util/HebrewCalendar.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/util/HebrewCalendar.java | MIT |
private static long startOfYear(int year)
{
long day = cache.get(year);
if (day == CalendarCache.EMPTY) {
// # of months before year
int months = (int)floorDivide((MONTHS_IN_CYCLE * (long)year - (MONTHS_IN_CYCLE-1)), YEARS_IN_CYCLE);
long frac = months * MONTH_FRACT + BAHARAD; // Fractional part of day #
day = months * 29 + (frac / DAY_PARTS); // Whole # part of calculation
frac = frac % DAY_PARTS; // Time of day
int wd = (int)(day % 7); // Day of week (0 == Monday)
if (wd == 2 || wd == 4 || wd == 6) {
// If the 1st is on Sun, Wed, or Fri, postpone to the next day
day += 1;
wd = (int)(day % 7);
}
if (wd == 1 && frac > 15*HOUR_PARTS+204 && !isLeapYear(year) ) {
// If the new moon falls after 3:11:20am (15h204p from the previous noon)
// on a Tuesday and it is not a leap year, postpone by 2 days.
// This prevents 356-day years.
day += 2;
}
else if (wd == 0 && frac > 21*HOUR_PARTS+589 && isLeapYear(year-1) ) {
// If the new moon falls after 9:32:43 1/3am (21h589p from yesterday noon)
// on a Monday and *last* year was a leap year, postpone by 1 day.
// Prevents 382-day years.
day += 1;
}
cache.put(year, day);
}
return day;
} |
Finds the day # of the first day in the given Hebrew year.
To do this, we want to calculate the time of the Tishri 1 new moon
in that year.
<p>
The algorithm here is similar to ones described in a number of
references, including:
<ul>
<li>"Calendrical Calculations", by Nachum Dershowitz & Edward Reingold,
Cambridge University Press, 1997, pages 85-91.
<li>Hebrew Calendar Science and Myths,
<a href="http://www.geocities.com/Athens/1584/">
http://www.geocities.com/Athens/1584/</a>
<li>The Calendar FAQ,
<a href="http://www.faqs.org/faqs/calendars/faq/">
http://www.faqs.org/faqs/calendars/faq/</a>
</ul>
| HebrewCalendar::startOfYear | java | Reginer/aosp-android-jar | android-35/src/android/icu/util/HebrewCalendar.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/util/HebrewCalendar.java | MIT |
private final int yearType(int year)
{
int yearLength = handleGetYearLength(year);
if (yearLength > 380) {
yearLength -= 30; // Subtract length of leap month.
}
int type = 0;
switch (yearLength) {
case 353:
type = 0; break;
case 354:
type = 1; break;
case 355:
type = 2; break;
default:
throw new IllegalArgumentException("Illegal year length " + yearLength + " in year " + year);
}
return type;
} |
Returns the the type of a given year.
0 "Deficient" year with 353 or 383 days
1 "Normal" year with 354 or 384 days
2 "Complete" year with 355 or 385 days
| HebrewCalendar::yearType | java | Reginer/aosp-android-jar | android-35/src/android/icu/util/HebrewCalendar.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/util/HebrewCalendar.java | MIT |
public boolean inTemporalLeapYear() {
return isLeapYear(get(EXTENDED_YEAR));
} |
{@inheritDoc}
@hide draft / provisional / internal are hidden on Android
| HebrewCalendar::inTemporalLeapYear | java | Reginer/aosp-android-jar | android-35/src/android/icu/util/HebrewCalendar.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/util/HebrewCalendar.java | MIT |
public String getTemporalMonthCode() {
return gTemporalMonthCodesForHebrew[get(MONTH)];
} |
Gets The Temporal monthCode value corresponding to the month for the date.
The value is a string identifier that starts with the literal grapheme
"M" followed by two graphemes representing the zero-padded month number
of the current month in a normal (non-leap) year and suffixed by an
optional literal grapheme "L" if this is a leap month in a lunisolar
calendar. For the Hebrew calendar, the values are "M01" .. "M12" for
non-leap year, and "M01" .. "M05", "M05L", "M06" .. "M12" for leap year.
@return One of 13 possible strings in {"M01".. "M05", "M05L", "M06" .. "M12"}.
@hide draft / provisional / internal are hidden on Android
| HebrewCalendar::getTemporalMonthCode | java | Reginer/aosp-android-jar | android-35/src/android/icu/util/HebrewCalendar.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/util/HebrewCalendar.java | MIT |
public void setTemporalMonthCode( String temporalMonth ) {
if (temporalMonth.length() == 3 || temporalMonth.length() == 4) {
for (int m = 0; m < gTemporalMonthCodesForHebrew.length; m++) {
if (temporalMonth.equals(gTemporalMonthCodesForHebrew[m])) {
set(MONTH, m);
return;
}
}
}
throw new IllegalArgumentException("Incorrect temporal Month code: " + temporalMonth);
} |
Sets The Temporal monthCode which is a string identifier that starts
with the literal grapheme "M" followed by two graphemes representing
the zero-padded month number of the current month in a normal
(non-leap) year and suffixed by an optional literal grapheme "L" if this
is a leap month in a lunisolar calendar. For Hebrew calendar, the values
are "M01" .. "M12" for non-leap years, and "M01" .. "M05", "M05L", "M06"
.. "M12" for leap year.
@param temporalMonth The value to be set for temporal monthCode.
@hide draft / provisional / internal are hidden on Android
| HebrewCalendar::setTemporalMonthCode | java | Reginer/aosp-android-jar | android-35/src/android/icu/util/HebrewCalendar.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/android/icu/util/HebrewCalendar.java | MIT |
boolean didFrameSizeChange() {
return (mLastFrame.width() != mFrame.width()) || (mLastFrame.height() != mFrame.height());
} |
@return true if the width or height has changed since last updating resizing window.
| WindowFrames::didFrameSizeChange | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/WindowFrames.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/WindowFrames.java | MIT |
boolean setReportResizeHints() {
mLastForceReportingResized |= mForceReportingResized;
mFrameSizeChanged |= didFrameSizeChange();
return mLastForceReportingResized || mFrameSizeChanged;
} |
Updates info about whether the size of the window has changed since last reported.
@return true if info about size has changed since last reported.
| WindowFrames::setReportResizeHints | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/WindowFrames.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/WindowFrames.java | MIT |
boolean isFrameSizeChangeReported() {
return mFrameSizeChanged || didFrameSizeChange();
} |
@return true if the width or height has changed since last reported to the client.
| WindowFrames::isFrameSizeChangeReported | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/WindowFrames.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/WindowFrames.java | MIT |
void clearReportResizeHints() {
mLastForceReportingResized = false;
mFrameSizeChanged = false;
} |
Resets the size changed flags so they're all set to false again. This should be called
after the frames are reported to client.
| WindowFrames::clearReportResizeHints | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/WindowFrames.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/WindowFrames.java | MIT |
void onResizeHandled() {
mForceReportingResized = false;
} |
Clears factors that would cause report-resize.
| WindowFrames::onResizeHandled | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/WindowFrames.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/WindowFrames.java | MIT |
void forceReportingResized() {
mForceReportingResized = true;
} |
Forces the next layout pass to update the client.
| WindowFrames::forceReportingResized | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/WindowFrames.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/WindowFrames.java | MIT |
public void setContentChanged(boolean contentChanged) {
mContentChanged = contentChanged;
} |
Sets whether the content has changed. This means that either the size or parent frame has
changed.
| WindowFrames::setContentChanged | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/WindowFrames.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/WindowFrames.java | MIT |
boolean hasContentChanged() {
return mContentChanged;
} |
@see #setContentChanged(boolean)
| WindowFrames::hasContentChanged | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/WindowFrames.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/WindowFrames.java | MIT |
void setInsetsChanged(boolean insetsChanged) {
mInsetsChanged = insetsChanged;
} |
Sets whether we need to report {@link android.view.InsetsState} to the client.
| WindowFrames::setInsetsChanged | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/WindowFrames.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/WindowFrames.java | MIT |
boolean hasInsetsChanged() {
return mInsetsChanged;
} |
@see #setInsetsChanged(boolean)
| WindowFrames::hasInsetsChanged | java | Reginer/aosp-android-jar | android-35/src/com/android/server/wm/WindowFrames.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-35/src/com/android/server/wm/WindowFrames.java | MIT |
public TypefaceSpan(@Nullable String family) {
this(family, null);
} |
Constructs a {@link TypefaceSpan} based on the font family. The previous style of the
TextPaint is kept. If the font family is null, the text paint is not modified.
@param family The font family for this typeface. Examples include
"monospace", "serif", and "sans-serif"
| TypefaceSpan::TypefaceSpan | java | Reginer/aosp-android-jar | android-33/src/android/text/style/TypefaceSpan.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/text/style/TypefaceSpan.java | MIT |
public TypefaceSpan(@NonNull Typeface typeface) {
this(null, typeface);
} |
Constructs a {@link TypefaceSpan} from a {@link Typeface}. The previous style of the
TextPaint is overridden and the style of the typeface is used.
@param typeface the typeface
| TypefaceSpan::TypefaceSpan | java | Reginer/aosp-android-jar | android-33/src/android/text/style/TypefaceSpan.java | https://github.com/Reginer/aosp-android-jar/blob/master/android-33/src/android/text/style/TypefaceSpan.java | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.